Skip to content

Instantly share code, notes, and snippets.

@julianeon
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julianeon/1ff52ccc087bf487097d to your computer and use it in GitHub Desktop.
Save julianeon/1ff52ccc087bf487097d to your computer and use it in GitHub Desktop.
Attempt to parse transaction.
var tx_parse=require('ripple-lib-transactionparser');
var json= {
success: true,
transaction: {
TransactionType: "Payment",
Flags: 0,
Sequence: 99,
DestinationTag: 88298231,
Amount: {
value: "535.29",
currency: "BTC",
issuer: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
Fee: "12",
SendMax: {
value: "540.6429",
currency: "BTC",
issuer: "rUp2wt425apcY5VMg1rcuuwdgbrJHt2FFz"
},
SigningPubKey: "03FF1E72DBAE4C8D581C807FB802701F13DF5BA8DE72466A352E14BF97FBC1ECA1",
TxnSignature: "3045022100F335AC228D6F45AA970CD60D1B9184230F14D6F4150F4052E3F3CC6CFD9DFFC102205EE7B360639A514374461DD9BADABE3E1CF90A3CFEBB68B55509E1FCF6B25277",
Account: "rUp2wt425apcY5VMg1rcuuwdgbrJHt2FFz",
Destination: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
date: 454298870,
hash: "3C53F46A00C3B55BE391BB1D932DAB8820B209231141D8F00786496C97464E9E",
inLedger: 6816100,
ledger_index: 6816100,
meta: {
TransactionIndex: 0,
AffectedNodes: [
{
ModifiedNode: {
LedgerEntryType: "AccountRoot",
PreviousTxnLgrSeq: 6816034,
PreviousTxnID: "BD42AA038D66E038FF0BE92BF23195BA2001AB9DC289D009365AF4736639F087",
LedgerIndex: "7A6587DE959FB0E4108C29AE000AE99F4456CC704908A1C904993425F50E8A28",
PreviousFields: {
Sequence: 99,
Balance: "174952472"
},
FinalFields: {
Flags: 0,
Sequence: 100,
OwnerCount: 2,
Balance: "174952460",
Account: "rUp2wt425apcY5VMg1rcuuwdgbrJHt2FFz"
}
}
},
{
ModifiedNode: {
LedgerEntryType: "RippleState",
PreviousTxnLgrSeq: 6816034,
PreviousTxnID: "BD42AA038D66E038FF0BE92BF23195BA2001AB9DC289D009365AF4736639F087",
LedgerIndex: "8F860D2B33FBDAE33B0D5FCCB59BFE5DF644DBF0781A7E245F4B1E8FF8E6182F",
PreviousFields: {
Balance: {
value: "-535.2931165500254",
currency: "BTC",
issuer: "rrrrrrrrrrrrrrrrrrrrBZbvji"
}
},
FinalFields: {
Flags: 2228224,
LowNode: "00000000000000CD",
HighNode: "0000000000000000",
Balance: {
value: "-0.0031165500254",
currency: "BTC",
issuer: "rrrrrrrrrrrrrrrrrrrrBZbvji"
},
LowLimit: {
value: "0",
currency: "BTC",
issuer: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
},
HighLimit: {
value: "1000",
currency: "BTC",
issuer: "rUp2wt425apcY5VMg1rcuuwdgbrJHt2FFz"
}
}
}
}
],
TransactionResult: "tesSUCCESS",
delivered_amount: {
value: "535.29",
currency: "BTC",
issuer: "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B"
}
},
validated: true
}
}
var output=tx_parse.parseBalanceChanges(json);
console.log(output);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment