@apophis-sdk/cosmwasm
CosmWasm module on top of the Cosmos module.
Example
import { Cosmos, LocalSigner, mw } from '@apophis-sdk/cosmos';
import { DefaultCosmWasmMiddlewares, CosmWasm } from '@apophis-sdk/cosmwasm';
mw.use(...DefaultCosmWasmMiddlewares);
const network = await Cosmos.getNetworkFromRegistry('neutrontestnet');
const signer = LocalSigner.fromMnemonic('...');
await Cosmos.ws(network).ready();
const response = await CosmWasm.query.smart({
network,
'neutron1...', // contract address
// smart query messages are only JSON-formatted by convention, not by requirement
// toBinary is a helper to serialize JSON messages
// it's really just implemented using `TextEncoder`, `JSON`, and a marshaller
CosmWasm.toBinary({
config: {},
}),
});
console.log(response);
await CosmWasm.execute(
network,
signer,
'neutron1...', // contract address
// same JSON convention here
CosmWasm.toBinary({
increment: {},
}),
[Cosmos.coin(1_000000n, 'untrn')], // optional native coin "funds" to pass along the call
);Queries
Outlook
Last updated