Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation incorrectly shows .wait() method for transaction objects #676

Open
Vivkzz opened this issue Jan 1, 2025 · 0 comments
Open

Comments

@Vivkzz
Copy link

Vivkzz commented Jan 1, 2025

The official OpenZeppelin Defender SDK documentation shows an example using tx.wait() to wait for a transaction to be mined. However, the tx object returned by sendTransaction does not have a .wait() method. This discrepancy can cause confusion for developers.

In sending transaction part of documentation. it says to use tx.wait()

Ex:

const tx = await relayer.sendTransaction({ ... });
const mined = await tx.wait(); 

Error: TypeError: tx.wait is not a function

Expected Behavior:
The documentation should reflect the correct approach for waiting for transactions to be mined. For example, using getRelayerTransaction or a blockchain provider like Ethers.js.

Actual Behavior:
The tx object returned by sendTransaction does not have a .wait() method, leading to a TypeError. this is same issue with all 3 ways using solidity, Ether.js, Web3.js

Environment:
Defender SDK version: 2.0.0
Node.js version: 23.x

Suggested Fix:
Update the documentation to reflect the correct approach for waiting for transactions. For example:

const tx = await relayer.sendTransaction({ ... });

// Poll for transaction status
let minedTx;
while (true) {
    minedTx = await client.relay.getRelayerTransaction(tx.transactionId);
    if (minedTx.status === 'mined') {
        console.log('Transaction mined:', minedTx);
        break;
    }
    console.log('Waiting for transaction to be mined...');
    await new Promise((resolve) => setTimeout(resolve, 5000)); // Wait 5 seconds
}

Additional Context:
This issue was encountered while working with the Defender SDK to send gasless transactions. The documentation should be updated to avoid confusion and provide clear guidance on how to wait for transactions to be mined. I know issue is too small and simple but can be avoided.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant