mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-12-06 17:27:59 +00:00
cover api/ledger/parse/trustline.js with tests
This commit is contained in:
@@ -207,6 +207,14 @@ describe('RippleAPI', function() {
|
||||
'getTransaction', done));
|
||||
});
|
||||
|
||||
it('getTransaction - trustline froze off', function(done) {
|
||||
const hash =
|
||||
'FE72FAD0FA7CA904FB6C633A1666EDF0B9C73B2F5A4555D37EEF2739A78A531B';
|
||||
this.api.getTransaction(hash, {},
|
||||
_.partial(checkResult, responses.getTransaction.trustlineFrozeOff,
|
||||
'getTransaction', done));
|
||||
});
|
||||
|
||||
it('getTransaction - tracking on', function(done) {
|
||||
const hash =
|
||||
'8925FC8844A1E930E2CC76AD0A15E7665AFCC5425376D548BB1413F484C31B8C';
|
||||
|
||||
31
test/fixtures/api/responses/get-transaction-trust-set-froze-off.json
vendored
Normal file
31
test/fixtures/api/responses/get-transaction-trust-set-froze-off.json
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"type": "trustline",
|
||||
"address": "r9UHu5CWni1qRY7Q4CfFZLGvXo2pGQy96b",
|
||||
"sequence": 478,
|
||||
"id": "FE72FAD0FA7CA904FB6C633A1666EDF0B9C73B2F5A4555D37EEF2739A78A531B",
|
||||
"specification": {
|
||||
"limit": "10000",
|
||||
"currency": "USD",
|
||||
"counterparty": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||
"qualityIn": 0.91,
|
||||
"qualityOut": 0.87,
|
||||
"ripplingDisabled": true,
|
||||
"frozen": false
|
||||
},
|
||||
"outcome": {
|
||||
"result": "tesSUCCESS",
|
||||
"timestamp": "2015-07-29T12:33:30.000Z",
|
||||
"fee": "0.012",
|
||||
"balanceChanges": {
|
||||
"r9UHu5CWni1qRY7Q4CfFZLGvXo2pGQy96b": [
|
||||
{
|
||||
"currency": "XRP",
|
||||
"value": "-0.012"
|
||||
}
|
||||
]
|
||||
},
|
||||
"orderbookChanges": {},
|
||||
"ledgerVersion": 14930204,
|
||||
"indexInLedger": 3
|
||||
}
|
||||
}
|
||||
3
test/fixtures/api/responses/index.js
vendored
3
test/fixtures/api/responses/index.js
vendored
@@ -21,7 +21,8 @@ module.exports = {
|
||||
trustline: require('./get-transaction-trustline-set.json'),
|
||||
trackingOn: require('./get-transaction-settings-tracking-on.json'),
|
||||
trackingOff: require('./get-transaction-settings-tracking-off.json'),
|
||||
setRegularKey: require('./get-transaction-settings-set-regular-key.json')
|
||||
setRegularKey: require('./get-transaction-settings-set-regular-key.json'),
|
||||
trustlineFrozeOff: require('./get-transaction-trust-set-froze-off.json')
|
||||
},
|
||||
getTransactions: require('./get-transactions.json'),
|
||||
getTrustlines: require('./get-trustlines.json'),
|
||||
|
||||
1
test/fixtures/api/rippled/index.js
vendored
1
test/fixtures/api/rippled/index.js
vendored
@@ -30,6 +30,7 @@ module.exports = {
|
||||
OfferCreate: require('./tx/offer-create.json'),
|
||||
OfferCancel: require('./tx/offer-cancel.json'),
|
||||
TrustSet: require('./tx/trust-set.json'),
|
||||
TrustSetFrozeOff: require('./tx/trust-set-froze-off.json'),
|
||||
NotFound: require('./tx/not-found.json'),
|
||||
NoLedgerIndex: require('./tx/no-ledger-index.json'),
|
||||
NoLedgerFound: require('./tx/no-ledger-found.json'),
|
||||
|
||||
87
test/fixtures/api/rippled/tx/trust-set-froze-off.json
vendored
Normal file
87
test/fixtures/api/rippled/tx/trust-set-froze-off.json
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
{
|
||||
"id": 0,
|
||||
"result": {
|
||||
"Account": "r9UHu5CWni1qRY7Q4CfFZLGvXo2pGQy96b",
|
||||
"Fee": "12000",
|
||||
"Flags": 2228224,
|
||||
"LastLedgerSequence": 14930302,
|
||||
"LimitAmount": {
|
||||
"currency": "USD",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||
"value": "10000"
|
||||
},
|
||||
"QualityIn": 910000000,
|
||||
"QualityOut": 870000000,
|
||||
"Sequence": 478,
|
||||
"SigningPubKey": "036A749E3B7187E43E8936E3D83A7030989325249E03803F12B7F64BAACABA6025",
|
||||
"TransactionType": "TrustSet",
|
||||
"TxnSignature": "3045022100EFC7E29D20C108CDFF6B825EB363923F25A92BFE7858466D82ECE5D578F5DFAD022035CEBF2DB99E70A0088B03037FA0F63BB2DAE33C8C48F7FF43B6AF112EE16121",
|
||||
"date": 491488410,
|
||||
"hash": "FE72FAD0FA7CA904FB6C633A1666EDF0B9C73B2F5A4555D37EEF2739A78A531B",
|
||||
"inLedger": 14930204,
|
||||
"ledger_index": 14930204,
|
||||
"meta": {
|
||||
"AffectedNodes": [
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Balance": {
|
||||
"currency": "USD",
|
||||
"issuer": "rrrrrrrrrrrrrrrrrrrrBZbvji",
|
||||
"value": "0"
|
||||
},
|
||||
"Flags": 3211264,
|
||||
"HighLimit": {
|
||||
"currency": "USD",
|
||||
"issuer": "rMH4UxPrbuMa1spCBR98hLLyNJp4d8p4tM",
|
||||
"value": "0"
|
||||
},
|
||||
"HighNode": "0000000000000000",
|
||||
"LowLimit": {
|
||||
"currency": "USD",
|
||||
"issuer": "r9UHu5CWni1qRY7Q4CfFZLGvXo2pGQy96b",
|
||||
"value": "10000"
|
||||
},
|
||||
"LowNode": "0000000000000000",
|
||||
"LowQualityIn": 910000000,
|
||||
"LowQualityOut": 870000000
|
||||
},
|
||||
"LedgerEntryType": "RippleState",
|
||||
"LedgerIndex": "072DF69CEE470A944D39E9994C335154504CFCB8B706C4E49199E1F8FB70828E",
|
||||
"PreviousFields": {
|
||||
"Flags": 7405568
|
||||
},
|
||||
"PreviousTxnID": "5ADB0B380834BB75506078422802175B6F54FD28FB7CE0C83F369C805EB4BF36",
|
||||
"PreviousTxnLgrSeq": 14930185
|
||||
}
|
||||
},
|
||||
{
|
||||
"ModifiedNode": {
|
||||
"FinalFields": {
|
||||
"Account": "r9UHu5CWni1qRY7Q4CfFZLGvXo2pGQy96b",
|
||||
"Balance": "71671088",
|
||||
"Domain": "726970706C652E636F6D",
|
||||
"Flags": 65536,
|
||||
"OwnerCount": 3,
|
||||
"RegularKey": "rsvEdWvfwzqkgvmaSEh9kgbcWiUc6s69ZC",
|
||||
"Sequence": 479
|
||||
},
|
||||
"LedgerEntryType": "AccountRoot",
|
||||
"LedgerIndex": "4AD70690C6FF8A069F8AE00B09F70E9B732360026E8085050D314432091A59C9",
|
||||
"PreviousFields": {
|
||||
"Balance": "71683088",
|
||||
"Sequence": 478
|
||||
},
|
||||
"PreviousTxnID": "5ADB0B380834BB75506078422802175B6F54FD28FB7CE0C83F369C805EB4BF36",
|
||||
"PreviousTxnLgrSeq": 14930185
|
||||
}
|
||||
}
|
||||
],
|
||||
"TransactionIndex": 3,
|
||||
"TransactionResult": "tesSUCCESS"
|
||||
},
|
||||
"validated": true
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
@@ -158,6 +158,9 @@ module.exports = function(port) {
|
||||
} else if (request.transaction ===
|
||||
'0F7ED9F40742D8A513AE86029462B7A6768325583DF8EE21B7EC663019DD6A04') {
|
||||
conn.send(createResponse(request, fixtures.tx.LedgerWithoutTime));
|
||||
} else if (request.transaction ===
|
||||
'FE72FAD0FA7CA904FB6C633A1666EDF0B9C73B2F5A4555D37EEF2739A78A531B') {
|
||||
conn.send(createResponse(request, fixtures.tx.TrustSetFrozeOff));
|
||||
} else if (request.transaction === hashes.NOTFOUND_TRANSACTION_HASH) {
|
||||
conn.send(createResponse(request, fixtures.tx.NotFound));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user