-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdebug_xdr_parse.js
More file actions
22 lines (17 loc) · 929 Bytes
/
Copy pathdebug_xdr_parse.js
File metadata and controls
22 lines (17 loc) · 929 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
const { Horizon, TransactionBuilder, Networks, scValToNative } = require('@stellar/stellar-sdk');
const horizonUrl = 'https://horizon.stellar.org';
const server = new Horizon.Server(horizonUrl);
const txHash = 'c0a0b05a5ad2cd538d442e3a47d9e3a3e576af1636dc694038277360447e0709';
async function main() {
const tx = await server.transactions().transaction(txHash).call();
console.log('Envelope XDR:', tx.envelope_xdr);
const signedTx = TransactionBuilder.fromXDR(tx.envelope_xdr, Networks.PUBLIC);
console.log('Operations count:', signedTx.operations.length);
for (let i = 0; i < signedTx.operations.length; i++) {
const op = signedTx.operations[i];
console.log(`Operation ${i} type:`, op.type);
console.log(`Operation ${i} keys:`, Object.keys(op));
console.log(`Operation ${i} full:`, JSON.stringify(op, (k, v) => typeof v === 'bigint' ? v.toString() : v, 2));
}
}
main().catch(console.error);