-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path053_tx_details.ts
39 lines (32 loc) · 1.04 KB
/
053_tx_details.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Usage: npx ts-node app/deploy/053_tx_details.ts
import { Connection } from "@solana/web3.js";
import { RPC_NODE } from "./devnet_consts";
import {
getProgramTransactions,
printTransactionDetails,
} from "../utils/parse_transactions";
async function main() {
const connection = new Connection(RPC_NODE, "confirmed");
const programId = "AFuHPdrQGsW8rNQ4oEFF35sm5fg36gwrxyqjkjKvi6ap";
const limit = 2;
try {
const transactions = await getProgramTransactions(
connection,
programId,
limit,
);
console.log(
`Found ${transactions.length} transactions for program ${programId}\n`,
);
for (const [index, tx] of transactions.entries()) {
console.log(`Transaction ${index + 1} details:\n`);
const signature = tx.transaction.signatures[0];
await printTransactionDetails(connection, signature);
console.log("-------------------------------------");
}
console.log("Transaction details fetched successfully.");
} catch (error) {
console.error("Error:", error);
}
}
main();