Use string gas price in simple calculateFee cases

This commit is contained in:
willclarktech 2021-06-16 10:22:21 +02:00
parent 1bc770327d
commit fca794e92e
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
3 changed files with 4 additions and 4 deletions

View File

@ -16,7 +16,6 @@ import {
import { import {
assertIsBroadcastTxSuccess as assertIsBroadcastTxSuccessStargate, assertIsBroadcastTxSuccess as assertIsBroadcastTxSuccessStargate,
calculateFee, calculateFee,
GasPrice,
SigningStargateClient, SigningStargateClient,
} from "@cosmjs/stargate"; } from "@cosmjs/stargate";
import { sleep } from "@cosmjs/utils"; import { sleep } from "@cosmjs/utils";
@ -54,7 +53,7 @@ async function createTransport(): Promise<Transport> {
describe("LedgerSigner", () => { describe("LedgerSigner", () => {
const defaultChainId = "testing"; const defaultChainId = "testing";
const defaultFee = calculateFee(80_000, GasPrice.fromString("0.025ucosm")); const defaultFee = calculateFee(80_000, "0.025ucosm");
const defaultMemo = "Some memo"; const defaultMemo = "Some memo";
const defaultSequence = "0"; const defaultSequence = "0";
const defaultAccountNumber = "42"; const defaultAccountNumber = "42";

View File

@ -48,7 +48,8 @@ export function fromOneElementArray<T>(elements: ArrayLike<T>): T {
return elements[0]; return elements[0];
} }
export const defaultSendFee = calculateFee(80_000, GasPrice.fromString("0.025ucosm")); export const defaultGasPrice = GasPrice.fromString("0.025ucosm");
export const defaultSendFee = calculateFee(80_000, defaultGasPrice);
export const simapp = { export const simapp = {
tendermintUrl: "localhost:26658", tendermintUrl: "localhost:26658",

View File

@ -25,7 +25,7 @@ async function main() {
const client = await SigningStargateClient.connectWithSigner(rpcUrl, wallet, { prefix: prefix }); const client = await SigningStargateClient.connectWithSigner(rpcUrl, wallet, { prefix: prefix });
const recipient = Bech32.encode(prefix, Random.getBytes(20)); const recipient = Bech32.encode(prefix, Random.getBytes(20));
const amount = coins(226644, "ucosm"); const amount = coins(226644, "ucosm");
const fee = calculateFee(80_000, GasPrice.fromString("0.025ucosm")); const fee = calculateFee(80_000, "0.025ucosm");
const memo = "Ensure chain has my pubkey"; const memo = "Ensure chain has my pubkey";
const sendResult = await client.sendTokens(faucet.address0, recipient, amount, fee, memo); const sendResult = await client.sendTokens(faucet.address0, recipient, amount, fee, memo);
assertIsBroadcastTxSuccess(sendResult); assertIsBroadcastTxSuccess(sendResult);