AndromedaClient
Import
Class
A helper class for interacting with the Andromeda ecosystem
Name | Type | Description |
---|---|---|
| Client used to interact with the chain, includes a query client when connected and a signing client when connected with a signer. | |
| API for shared ADO messages. | |
| API for schema specific messages. | |
| API for OS contracts specific messages. |
Methods
connect
Connects to a new chain by endpoint.
Name | Type | Description |
---|---|---|
| string | The endpoint of the chain to connect to. |
kernelAddress | string | The contract address of the kernel contract. |
| string | The prefixo of the connecting address. |
| Optional signer used to sign the messages. | |
| Optional field to set the client options. |
assignKeyAddresses
Assigns the kernel address and fetches the VFS and ADODB addresses.
Name | Type | Description |
---|---|---|
| string | The address of the kernel contract to assign. |
disconnect
Disconnects the assigned clients.
isConnected
Getter method to indicate whether the client is currently connected.
signAndBroadcast
Wrapper function for CosmWasm sign and broadcast. Creates a transaction with the given messages, fee and memo and then signs and broadcasts the transaction.
Name | Type | Description |
---|---|---|
| The messages to broadcast. | |
| The fee to pay for the message. | |
| string | optional memo to the transaction. |
Fee
Check StdFee.
EncodeObject
upload
Wrapper function for CosmWasm upload. Uploads code and returns a receipt, including the code ID.
Name | Type | Description |
---|---|---|
| Uint8Array | The code to upload. |
| The fee to pay. Defaults to auto if not specified. | |
| string | Optional memo to attatch. |
execute
Wrapper function for CosmWasm execute. Execute the defined message.
Name | Type | Description |
---|---|---|
contractAddress | string | The contract address to execute on. |
| The message to execute. | |
| The fee to pay. | |
| string | Optional memo to attach along a message. |
| readonly Coin[] | Optional funds to send along the message. |
instantiate
Wrapper function for CosmWasm instantiate. Instantiates the defined message.
Name | Type | Description |
---|---|---|
| number | The code ID of the contract to instantiate. |
| The instantiation message. | |
| string | The label attached to instantiation. |
| string | The fee to pay. Defaults to auto if not specified. |
| Options for the instantiate call. Includes optional admin, funds, and memo. |
queryContract
Makes a smart query on the contract, returns the parsed JSON document. Promise is rejected when contract does not exist, for invalid query format, and for invalid response format.
Wrapper function for CosmWasm query.
Name | Type | Description |
---|---|---|
| string | The address of the contract to query. |
| The query message. |
Msg
migrate
Wrapper function to ComsWasm migrate.
Name | Type | Description |
---|---|---|
| string | The contract address to migrate. |
| number | The code Id to migrate to. |
| The migrate message. | |
| The fee to pay. Defaults to auto if not specified. | |
| string | Optional memo to attach. |
simulateMigrate
Estimates the gas cost of sending a migrate transaction.
Name | Type | Description |
---|---|---|
| string | The contract address to migrate. |
| number | The code Id to migrate to. |
| The migrate message. | |
| Fee to pay for the migration. Defaults to auto if not specified. |
estimateMigrateFee
Estimates the fee cost of sending a migrate transaction.
Name | Type | Description |
---|---|---|
| string | The contract address to migrate. |
| number | The code Id to migrate to. |
| The migrate message. |
simulateExecute
Estimates the gas cost of sending an execute transaction.
Name | Type | Description |
---|---|---|
| string | The contract address to simulate the execute for. |
| The message of the execute. | |
| Coin[] | The amount of funds attached to the message. |
| Fee to pay for the execution. Defaults to auto if not specified. | |
| string | Optional memo to attach. |
simulateMsgs
Simulates provided messages returning an estimated gas cost.
Name | Type | Description |
---|---|---|
| The messages to simulate. | |
| Fee to pay. | |
| string | Optional memo to attach. |
simulateInstantiate
Estimates the gas cost of sending an instantiate transaction and returns it.
Name | Type | Description |
---|---|---|
| number | The code Id of the contract to instantiate. |
| The instantiation message. | |
| string | The label attached to the instantiation. |
| Fee to pay. | |
| string | Optional memo to attach. |
simulateUpload
Estimates the gas cost of sending an upload transaction.
Name | Type | Description |
---|---|---|
| Uint8Array | The wasm code to simulate uploading. |
estimateUploadFee
Estimates the fee cost of sending an upload transaction.
Name | Type | Description |
---|---|---|
| Uint8Array | The wasm code to simulate uploading. |
calculateFee
Wrapped around cosmjs calculateFee using client's set gasPrice. Errors if no gas price provided.
Name | Type | Description |
---|---|---|
| number | The amount of gas. |
estimateFee
Simulates provided messages and calculates an estimated fee.
Name | Type | Description |
---|---|---|
| EncodeObject[] | The messages to estimate the fee for. |
| The fee to pay. | |
| string | Optional memo to attach. |
estimateExecuteFee
Estimates the fee cost of sending an execute transaction.
The fields are the same as in execute but will return an estimate of the fees instead of executing the message.
estimateInstantiationFee
Estimates the fee cost of sending an instantiate transaction and returns it.
Name | Type | Description |
---|---|---|
| number | The code ID of the contract to instantiate. |
| The instantiation message | |
| string | The label attached to instantiation |
| string | Optional memo to attach. |
getBalance
Gets the balance for a given address and denom. Defaults to the signing wallet address if none provided.
Name | Type | Description |
---|---|---|
| string | The denom to check the balance for. |
| string | The address to check the balance for. If not specified, the address of the connected signer is used. |
getSentTxsByAddress
Gets all send transactions for a given address.
Name | Type | Description |
---|---|---|
| string | The address to get the send transactions for. |
getTx
Wrapper around the cosm.js client's getTx function.
Name | Type | Description |
---|---|---|
| string | The tx hash. |
getTxsByContract
Gets all transactions sent to a contract.
Name | Type | Description |
---|---|---|
| string | The contract address to check transactions for. |
getBankTxsByAddress
Gets all bank messages sent to or from an address.
Name | Type | Description |
---|---|---|
| string | The address to check the bank messages for. |
getAllTxsByAddress
Queries all possible transactions for a given address.
Name | Type | Description |
---|---|---|
| string | The address to get all the transactions for. |
sendTokens
wrapper around the cosm.js client's sendTokens function. Send tokens to another address.
Name | Type | Description |
---|---|---|
| string | The address to receive the tokens. |
| The amount of tokens to send. | |
| Fee to pay for sending the tokens. Defaults to auto if not specified. | |
| string | An optional memo to attach. |
Helper Function
JsonToArray
Helper function to convert JSON to Uint8Array
Name | Type | Description |
---|---|---|
| Record<string, any> | JSON object to convert to Uint8Array |
Returns the Uint8Array.
Last updated