I want to see balance changes (including the gas fees) for a transfer request. From the docs of dryRun method - The dryRun method should be used to dry-run a contract call.
How can i get the balance changes for transfer requests ?
3 Likes
- But in the fulet wallet you can see it saying it is coming soon.
Therefore we can see this feature future in this network !
1 Like
@dapkns Thanks for the reply.
But we do have a method called dry run in the typescript sdk right ?
Can’t we use this to get the balance changes ?
1 Like
@singhparshant To get the estimated balance difference from a contract call
// the maxFee (Big Number) here will be the estimated balance to be deducted.
const { maxFee } = await contract.functions.xyz().getTransactionCost()
For a simple transfer with the base asset ID:
const transferAmount = 1000;
const transactionRequest = await myWallet.createTransfer(
receiverWallet.address,
transferAmount,
baseAssetId,
);
const { maxFee } = await provider.getTransactionCost(transactionRequest)
// When the transfer amount is from the base asset ID, the transfer amount should be part of the calculation
const estimatedBalanceToBeDeducted: BN = maxFee.add(transferAmount)
However, this is just an estimation. This happens because the VM calculates the fee using the gas price which is a value that fluctuates and it can change on every new block.
2 Likes
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

