ethers.js
ethers.js copied to clipboard
in scroll, all the tx.wait() raise exception receipt.confirmations is not a function
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
What does the object look like? If you console.log it? I’m not sure what scroll is. Link?
scroll is a evm chain........, like arb, op, or zk, https://scrollscan.com/
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
noneErrors
TypeError: receipt.confirmations is not a functionEnvironment
node.js (v12 or newer)
Environment (Other)
none
@vvsuperman Were you able resolve this?
no, I catch the exception exactly, then though the transtraction success
met the same issue in Hardhat block chain
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