A client to interact with the Archway chain.
Copy export default class ArchwayClient extends BaseChainClient {
public signingClient ?: SigningArchwayClient ;
public queryClient ?: CosmWasmClient ;
public gasPrice ?: GasPrice ; The client used to sign any transactions broadcast to the chain.
The client used to query the chain.
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.
Copy 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 ;
}
} The endpoint of the chain to connect to.
Optional signer used to sign the messages.
Optional field to set the client options.
Disconnects the assigned clients.
Signs a given message with the connected signer.
The fee to pay for signing.
Defaults to an empty string.
Broadcasts a given transaction to the connected client.
The transaction to broadcast.
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.
The messages to sign and broadcast.
The fee to pay for signing and broadcasting the message. Defaults to auto if not specified.
An optional memo to attach to the transaction.
Simulates all given messages and returns a gas fee estimate.
The messages to simulate.
The fee to pay. Defaults to auto if not specified.
Optional memo to attach to the transaction.
Simulates the given message and returns a gas fee estimate.
Optional fee attached to the message.
Optional memo to attach to the transaction.
Executes a message on the specified contract.
The contract address to execute on.
Optional fee. Defaults to auto
Optional memo to attach to the transaction.
Optional funds to attach along with the message.
simulateExecute
Simulates an execute message and returns a gas fee estimate.
The contract address you are executing on.
The execute message to simulate.
The funds attached along with the message.
Optional fee for executing the message.
Optional memo to add to the transaction.
Uploads given contract code (Uint8Array) to the chain.
The wasm binary code to upload to the connected client.
Optional Fee. Defaults to "auto".
Optional memo to add to the transaction.
Simulate an upload message and returns a gas fee estimate.
The wasm binary code to simulate uploading.
Fee to pay for uploading.
Optional memo to add to the transaction.
Instantiates a contract with the given code id using the provided instantiate message.
The code Id of the contract to instantiate.
The instantiation message.
A label for the instantiation. Can be any string such as " instantiating a CW721" or "my_label" ect...
Fee to pay for instantiation. Defaults to auto.
The options of an .instantiate() call. All properties are optional.
simulateInstantiate
Simulates an instantiation message and returns a gas fee estimate.
The code Id of the contract to simulate instantiating.
The instantiation message.
A label for the instantiation. Can be any string such as " instantiating a CW721" or "my_label" ect...
Fee to pay for instantiation. Defaults to auto.
The options of an .instantiate() call. All properties are optional.
Migrates a contract to a given code id.
The address of the contract that you want to migrate.
The code Id to migrate to.
The fee to pay for the migration.
Optional memo to attach to the transaction.
simulateMigrate
Simulates a migrate message for a given contract address, code id and migrate message and returns a gas estimate.
The contract address that you want to migrate.
The code Id to migrate to.
Optional fee to pay to send the funds.
Optional memo to attach to the transaction.
Sends tokens from the signing address to the provided receiving address.
The address to receive the tokens.
Optional fee to pay to send the funds.
Optional memo to attach to the transaction.