ArchwayClient
Class
A client to interact with the Archway chain.
export default class ArchwayClient extends BaseChainClient {
public signingClient?: SigningArchwayClient;
public queryClient?: CosmWasmClient;
public gasPrice?: GasPrice;Methods
connect
Connects to the given chain. Assigns all clients used within the chain client, if a signer is provided a signing client is assigned.
async connect(
endpoint: string,
signer?: OfflineSigner,
options?: SigningCosmWasmClientOptions
): Promise<void> {
delete this.signingClient;
delete this.queryClient;
this.gasPrice = options?.gasPrice;
this.queryClient = await CosmWasmClient.connect(endpoint);
if (signer) {
this.signingClient = await SigningArchwayClient.connectWithSigner(
endpoint,
signer,
{
gasAdjustment: 1.4,
}
);
const [account] = await signer.getAccounts();
this.signer = account.address;
}
}endpoint
string
The endpoint of the chain to connect to.
disconnect
Disconnects the assigned clients.
sign
Signs a given message with the connected signer.
messages
EncodeObject[]
The messages to sign.
memo
string
Defaults to an empty string.
broadcast
Broadcasts a given transaction to the connected client.
TxRaw
TxRaw is a variant of Tx that pins the signer's exact binary representationof body and auth_info. This is used for signing, broadcasting and verification. The binary serialize(tx: TxRaw) is stored in Tendermint and the hash sha256(serialize(tx: TxRaw)) becomes the "txhash", commonly used as the transaction ID.
signAndBroadcast
Signs a given message before broadcasting it to the connected chain.
memo
string or undefined
An optional memo to attach to the transaction.
EncodeObject
Fee
simulateMulti
Simulates all given messages and returns a gas fee estimate.
memo
string or undefined
Optional memo to attach to the transaction.
simulate
Simulates the given message and returns a gas fee estimate.
memo
string or undefined
Optional memo to attach to the transaction.
execute
Executes a message on the specified contract.
Msg
simulateExecute
Simulates an execute message and returns a gas fee estimate.
upload
Uploads given contract code (Uint8Array) to the chain.
code
Uint8Array
The wasm binary code to upload to the connected client.
memo
string or undefined
Optional memo to add to the transaction.
simulateUpload
Simulate an upload message and returns a gas fee estimate.
code
Uint8Array
The wasm binary code to simulate uploading.
memo
string or undefined
Optional memo to add to the transaction.
instantiate
Instantiates a contract with the given code id using the provided instantiate message.
codeId
number
The code Id of the contract to instantiate.
label
string
A label for the instantiation. Can be any string such as " instantiating a CW721" or "my_label" ect...
simulateInstantiate
Simulates an instantiation message and returns a gas fee estimate.
codeId
number
The code Id of the contract to simulate instantiating.
label
string
A label for the instantiation. Can be any string such as " instantiating a CW721" or "my_label" ect...
migrate
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.
contractAddress
string
The contract address that you want to migrate.
codeId
number
The code Id to migrate to.
msg
Msg
The migrate message.
memo
string
Optional memo to attach to the transaction.
sendTokens
Sends tokens from the signing address to the provided receiving address.
Last updated