mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-27 07:35:52 +00:00
Rewrite transaction parser and add unit test for getTransaction
This commit is contained in:
21
src/api/ledger/parse/trustline.js
Normal file
21
src/api/ledger/parse/trustline.js
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
const assert = require('assert');
|
||||
const utils = require('./utils');
|
||||
const flags = utils.core.Transaction.flags.TrustSet;
|
||||
|
||||
function parseTrustline(tx) {
|
||||
assert(tx.TransactionType === 'TrustSet');
|
||||
|
||||
return {
|
||||
limit: tx.LimitAmount.value,
|
||||
currency: tx.LimitAmount.currency,
|
||||
counterparty: tx.LimitAmount.issuer,
|
||||
qualityIn: tx.QualityIn,
|
||||
qualityOut: tx.QualityOut,
|
||||
allowRippling: tx.Flags & flags.NoRipple === 0,
|
||||
frozen: tx.Flags & flags.SetFreeze !== 0,
|
||||
authorized: tx.Flags & flags.SetAuth !== 0
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = parseTrustline;
|
||||
Reference in New Issue
Block a user