Skip to content

Commit

Permalink
refactor: extract fees constants
Browse files Browse the repository at this point in the history
  • Loading branch information
genaroibc committed Apr 8, 2024
1 parent 26e8804 commit 6cf212d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,27 +535,24 @@ export class Squid {
""
);
const gasMultiplier = Number(route.transactionRequest!.maxFeePerGas) || 1.3;
const fee = calculateFee(
Math.trunc(estimatedGas * gasMultiplier),
GasPrice.fromString(route.transactionRequest!.gasPrice)
);

if (useBroadcast) {
const fee = calculateFee(
Math.trunc(estimatedGas * gasMultiplier),
GasPrice.fromString(route.transactionRequest!.gasPrice)
);

return (signer as SigningCosmWasmClient).signAndBroadcast(
signerAddress,
[fromAminoMsg],
fee,
""
);
}

return (signer as SigningCosmWasmClient).sign(
signerAddress,
[fromAminoMsg],
calculateFee(
Math.trunc(estimatedGas * gasMultiplier),
GasPrice.fromString(route.transactionRequest!.gasPrice)
),
fee,
""
);
}
Expand Down

0 comments on commit 6cf212d

Please sign in to comment.