Skip to content

Commit

Permalink
Estimate Gas (#30)
Browse files Browse the repository at this point in the history
* estimate gas (#29)
  • Loading branch information
kanatliemre authored Nov 19, 2021
1 parent 6880eca commit 14c9f5b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Wallet/Wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,22 @@ export abstract class WalletProvider {
return await estimateErc20Gas(contractAddress, from, to, amount);
}

/**
* Estimate gas limit for the given inputs.
* @param to
* @param data
*/
async estimateGas(to: string, data: string) {
const from = this.getAddressC();
const nonce = await web3.eth.getTransactionCount(from);
return await web3.eth.estimateGas({
from: from,
nonce: nonce,
to: to,
data: data,
});
}

/**
* Estimate the gas needed for a AVAX send transaction on the C chain.
* @param to Destination address.
Expand Down

0 comments on commit 14c9f5b

Please sign in to comment.