Add CLI example to show the new GasPrice/GasLimits interface
This commit is contained in:
parent
0bd8d5ecf2
commit
e99e0f2eef
@ -145,6 +145,7 @@ jobs:
|
||||
environment:
|
||||
SKIP_BUILD: 1
|
||||
command: |
|
||||
./bin/cosmwasm-cli --init examples/coralnet.ts --code "process.exit(0)"
|
||||
./bin/cosmwasm-cli --init examples/delegate.ts --code "process.exit(0)"
|
||||
./bin/cosmwasm-cli --init examples/faucet_addresses.ts --code "process.exit(0)"
|
||||
./bin/cosmwasm-cli --init examples/generate_address.ts --code "process.exit(0)"
|
||||
|
||||
28
packages/cli/examples/coralnet.ts
Normal file
28
packages/cli/examples/coralnet.ts
Normal file
@ -0,0 +1,28 @@
|
||||
interface Options {
|
||||
readonly httpUrl: string;
|
||||
readonly bech32prefix: string;
|
||||
readonly hdPath: readonly Slip10RawIndex[];
|
||||
readonly gasPrice: GasPrice;
|
||||
readonly gasLimits: Partial<GasLimits<CosmWasmFeeTable>>; // only set the ones you want to override
|
||||
}
|
||||
|
||||
const coralnetOptions: Options = {
|
||||
httpUrl: 'https://lcd.coralnet.cosmwasm.com',
|
||||
gasPrice: GasPrice.fromString("0.025ushell"),
|
||||
bech32prefix: 'coral',
|
||||
hdPath: makeCosmoshubPath(0),
|
||||
gasLimits: {
|
||||
upload: 1500000,
|
||||
}
|
||||
}
|
||||
|
||||
const wallet = await Secp256k1Wallet.generate(12, coralnetOptions.hdPath, coralnetOptions.bech32prefix);
|
||||
const [{ address }] = await wallet.getAccounts();
|
||||
|
||||
const client = new SigningCosmWasmClient(
|
||||
coralnetOptions.httpUrl,
|
||||
address,
|
||||
wallet,
|
||||
coralnetOptions.gasPrice,
|
||||
coralnetOptions.gasLimits,
|
||||
);
|
||||
@ -102,6 +102,7 @@ export async function main(originalArgs: readonly string[]): Promise<void> {
|
||||
"BroadcastTxResult",
|
||||
"Coin",
|
||||
"CosmosClient",
|
||||
"GasLimits",
|
||||
"GasPrice",
|
||||
"Msg",
|
||||
"MsgDelegate",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user