Skip to content

Offline sign contract token transfer #2848

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

You must be logged in to vote

Your code should work, I am not able to spot error. But I'm including some minimal code which you can try:

const iface = new ethers.utils.Interface(['function transfer(address sender, uint amount)'])
const contractWithoutProvider = new Contract(iface, AddressZero); // note that there is no signer or provider here
const unsignedTx = await contractWithoutProvider.populateTransaction.transfer(AddressZero, parseUnits(amountStr, 18));

// now you can add more stuff to this unsignedTx like nonce and gas prices
unsignedTx.gasLimit = 210000;
unsignedTx.nonce = await this.provider.getTransactionCount(wallet.address);
unsignedTx.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas;
unsignedTx.maxFee…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

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

Answer selected by animosi
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