ethers.js icon indicating copy to clipboard operation
ethers.js copied to clipboard

in scroll, all the tx.wait() raise exception receipt.confirmations is not a function

Open vvsuperman opened this issue 1 year ago • 6 comments

Ethers Version

6.13.0

Search Terms

receipt.confirmations is not a function

Describe the Problem

in scroll , when use contract.function to interact with contract, all the tx.wait() raise excepiont TypeError: receipt.confirmations is not a function

but actually the tx is success

Code Snippet

const croc = new CrocEnv.CrocEnv("scroll", this.wallet)
const tx =  await croc.sellEth(amount).for(usdc).swap()
await tx.wait()

Contract ABI

none

Errors

TypeError: receipt.confirmations is not a function

Environment

node.js (v12 or newer)

Environment (Other)

none

vvsuperman avatar Jul 11 '24 09:07 vvsuperman

What does the object look like? If you console.log it? I’m not sure what scroll is. Link?

ricmoo avatar Jul 11 '24 12:07 ricmoo

scroll is a evm chain........, like arb, op, or zk, https://scrollscan.com/

vvsuperman avatar Jul 11 '24 13:07 vvsuperman

Ethers Version

6.13.0

Search Terms

receipt.confirmations is not a function

Describe the Problem

in scroll , when use contract.function to interact with contract, all the tx.wait() raise excepiont TypeError: receipt.confirmations is not a function

but actually the tx is success

Code Snippet

const croc = new CrocEnv.CrocEnv("scroll", this.wallet)
const tx =  await croc.sellEth(amount).for(usdc).swap()
await tx.wait()

Contract ABI

none

Errors

TypeError: receipt.confirmations is not a function

Environment

node.js (v12 or newer)

Environment (Other)

none

@vvsuperman Were you able resolve this?

abubakvr avatar Jul 18 '24 22:07 abubakvr

no, I catch the exception exactly, then though the transtraction success

vvsuperman avatar Jul 25 '24 05:07 vvsuperman

met the same issue in Hardhat block chain

CleanShot 2024-07-29 at 17 27 30@2x

googya avatar Jul 29 '24 09:07 googya

I encountered the same problem, but I solved it in a different way. After executing the method, instead of calling wait() first, I use getTransaction() to obtain the tx, and then call tx.wait() to retrieve the transaction result. Problem perfectly solved!

Below is my code; I hope it can be helpful to you

https://github.com/pengsp/smart-contract-caller/blob/2cbd7fc52a93a0aff3b159a07333614349206566/src/app/componets/OperationPanel/Caller.tsx#L133-L137

pengsp avatar Sep 29 '24 19:09 pengsp