Skip to content

Contract call with custom sendTransaction parameters #1717

Answered by zemse
girishnuli asked this question in Q&A
Discussion options

You must be logged in to vote

So instead of doing just stableTokenContract.transfer(), is there a way to do signer.sendTransaction() with a contract method so that we can use a wrapper over the signer and specify the feeCurrency parameter?

You can just populate the data field. And the stableTokenContractAddress is pretty much the to address in terms of ERC20 transfer transaction.

const populatedTx = await await stabletoken.populateTransaction.transfer(anAddress, amount);

await signer.sendTransaction({
  to: stableTokenContractAddress,
  data: populatedTx.data
})

Also note that, you don't need to use the signer API, you can also change the contract address in a Contract object as well as the signer for the from addr…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@girishnuli
Comment options

Answer selected by girishnuli
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants