How to send transaction with Ethers? #2342
Answered
by
zemse
chronicIntrovert
asked this question in
Q&A
-
Hi all, I've been trying to wrack my head on this for a while and can't figure this out... would appreciate some help if available. In the ethers.js docs, it mentions that hexlify should be able to convert an object into a hexstring, but when I try this code, it keeps providing me invalid hexlify value Any ideas?
Error with data is:
|
Beta Was this translation helpful? Give feedback.
Answered by
zemse
Nov 29, 2021
Replies: 1 comment 1 reply
-
What is your const provider = new ethers.provider.InfuraProvider('ropsten');
const wallet = new ethers.Wallet('privatekey', provider);
const unsignedTransaction = {
from: address,
to: recipient,
data: txnData,
};
const tx = wallet.sendTransaction(unsignedTransaction);
console.log(tx.hash) Does the above example help? |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
chronicIntrovert
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What is your
web3
object? Is it an ethers provider? Can you mention where didi you get this example in the docs.Does the above example help?