Transaction status code #11
Unanswered
nagendraK6
asked this question in
SDK
Replies: 1 comment
-
To fetch the transaction status using the zkSync SDK, you can follow these steps to write the code. This example assumes you are using JavaScript:
const { ethers } = require('ethers');
const { getDefaultProvider } = require('zksync');
async function getTransactionStatus(txHash) {
// Connect to the zkSync network
const provider = getDefaultProvider('mainnet');
// Fetch the transaction status
const status = await provider.getTransactionStatus(txHash);
console.log(`Transaction Status: ${status}`);
}
// Replace 'your_transaction_hash_here' with your actual transaction hash
getTransactionStatus('your_transaction_hash_here');
This script connects to the zkSync mainnet, fetches the status of the specified transaction, and prints it to the console. Make sure to replace Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
How can i write the code for fetching transaction status?
Beta Was this translation helpful? Give feedback.
All reactions