Allow the use of a custom gas multiplier

This commit is contained in:
Simon Warta
2021-11-20 09:46:11 +01:00
parent 86467822f9
commit 37b472af44
3 changed files with 51 additions and 21 deletions
+28
View File
@@ -34,6 +34,16 @@ const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, wallet
console.log("Successfully broadcasted:", result);
}
// Send transaction (using sendTokens with auto gas and custom muliplier)
{
const recipient = "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5";
const amount = coins(1234567, "ucosm");
const memo = "With simulate";
const result = await client.sendTokens(account.address, recipient, amount, 1.2, memo);
assertIsBroadcastTxSuccess(result);
console.log("Successfully broadcasted:", result);
}
// Send transaction (using sendTokens with manual gas)
{
const recipient = "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5";
@@ -72,6 +82,24 @@ const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, wallet
console.log("Successfully broadcasted:", result);
}
// Send transaction (using signAndBroadcast with auto gas and custom muliplier)
{
const recipient = "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5";
const amount = coins(1234567, "ucosm");
const sendMsg: MsgSendEncodeObject = {
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
value: {
fromAddress: account.address,
toAddress: recipient,
amount: amount,
},
};
const memo = "With simulate";
const result = await client.signAndBroadcast(account.address, [sendMsg], 1.4, memo);
assertIsBroadcastTxSuccess(result);
console.log("Successfully broadcasted:", result);
}
// Send transaction (using signAndBroadcast with manual gas)
{
const recipient = "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5";