1

I try to send Eth to Weth (using code below) and it keeps on failing and I have no idea what I am doing wrong (or what I might have forgotten).

const exchangeEth = async () => {
const gasPrice = await providerTestnet.getGasPrice();
const valueHuman = "0.0035";
const txBuild = {
    from: myAddress,
    to: "0xcd48a86666D2a79e027D82cA6Adf853357c70d02",
    value: ethers.utils.parseEther(valueHuman),
    nonce: await providerTestnet.getTransactionCount(myAddress, "latest"),
    gasLimit: 1000000,
    gasPrice: gasPrice};

    const txSend = await walletSigner.sendTransaction(txBuild);
    console.log(txSend);
}

I hope someone can point me in the right direction>

Thx, Peter

btw, this is tx-hash on goerli etherscan:0x6f33c9b1f6fc30bed0b73220dba90e1a0cd5a53d340c8f73c8ecaa0fe60f82ff

0

1 Answer 1

0

address was token address not the contract address.

Instead of the address in my question, I used this address "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6" which has a contract. The address is the question is the address of a token. I am an absolute beginner in this, but the contract sends weth back when it receives eth. I need to dig a bit deeper into this about the why and why not (interesting stuff).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.