0.3.2 • Published 10 months ago
@apophis-sdk/cosmwasm v0.3.2
@apophis-sdk/cosmwasm
CosmWasm integration for the Apophis SDK. This integration builds upon the Cosmos SDK integration, adding support for CosmWasm smart contracts. Similar to the Cosmos integration which exports the Cosmos API object, this package exports the CosmWasm API object.
Note that this API will likely change in the future.
Installation
Install with your favorite package manager's equivalent of:
npm install @apophis-sdk/core @apophis-sdk/cosmos @apophis-sdk/cosmwasmUsage
import { Cosmos, LocalSigner, mw } from '@apophis-sdk/cosmos';
import { CosmWasm, DefaultCosmWasmMiddlewares } from '@apophis-sdk/cosmwasm';
mw.use(DefaultCosmWasmMiddlewares); // includes `DefaultCosmosMiddlewares`
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
);Check out the Apophis SDK GitBook for more information.
License
0.3.2
10 months ago
0.3.1
10 months ago
0.3.0
10 months ago
0.3.0-rc.6
11 months ago
0.3.0-rc.5
11 months ago
0.3.0-rc.4
12 months ago
0.3.0-rc.3
12 months ago
0.3.0-rc.2
12 months ago
0.3.0-rc.1
12 months ago
0.2.1
12 months ago
0.2.0-fix.1
1 year ago
0.2.0
1 year ago
0.1.0-alpha.4
1 year ago
0.1.0-alpha.3
1 year ago
0.1.0-alpha.2
1 year ago