ethers-io / ethers.js

Complete Ethereum library and wallet implementation in JavaScript.
https://ethers.org/
MIT License
7.91k stars 1.84k forks source link

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

Open vvsuperman opened 2 months ago

vvsuperman commented 2 months ago

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

ricmoo commented 2 months ago

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

vvsuperman commented 2 months ago

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

sadeeqdev commented 2 months ago

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?

vvsuperman commented 2 months ago

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

googya commented 2 months ago

met the same issue in Hardhat block chain

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

pengsp commented 2 days ago

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