When interacting with any Cosmos chain there may be differences in how they sign messages or how the messages themselves are constructed. This class is used to provide a generic interface for interacting with any Cosmos chain and is used by our AndromedaClient class. Most of the methods are simply wrappers however some require specific implementations.
Copy export default interface ChainClient {
signingClient ?:
| SigningCosmWasmClient
| SigningStargateClient
| LCDClient
| SigningArchwayClient ;
queryClient ?: CosmWasmClient ;
signer : string ;
isConnected : boolean ;
gasPrice ?: GasPrice ; The client used to sign any transactions broadcast to the chain. SigningCosmWamClient is used by the CosmClient , SigningStargateClient is used by the by the Injective client , LCDClient is used by the TerraClient , and SigningArchwayClient us used by the ArchwayClient .
The client used to query the chain.
The current signer address.
Whether the current chain is connected.
Optional configurations for the gas prices to use.
Connects to the given chain. Assigns all clients used within the chain client, if a signer is provided a signing client is assigned.
Disconnects from the current chain completely.
Signs a given message with the connected signer.
Broadcasts a given transaction to the connected chain.
signAndBroadcast
Signs a given message before broadcasting it to the connected chain.
Simulates all given messages and returns a gas fee estimate.
Simulates a given message and returns a gas fee estimate.
Executes a message on the specified contract.
simulateExecute
Simulates an execute message and returns a gas fee estimate.
Uploads given contract code (Uint8Array) to the chain.
Simulates an upload message and returns a gas fee estimate.
Instantiates a contract with the given code id using the provided instantiate message.
simulateInstantiate
Simulates an instantiation message and returns a gas fee estimate.
Migrates a contract to a given code id.
simulateMigrate
Simulates a migrate message for a given contract address, code id and migrate message and returns a gas estimate.
encodeExecuteMsg
Converts an execute message to an EncodeObject for signing or simulating.
encodeInstantiateMsg
Converts an instantiate message to an EncodeObject for signing or simulating.
encodeUploadMessage
Converts an upload message to an EncodeObject for signing or simulating.
encodeMigrateMessage
Converts a migrate message to an EncodeObject for signing or simulating.
encodeSendMessage
Converts a sendTokens message to an EncodeObject for signing or simulating.
Sends tokens from the signing address to the provided receiving address.