@bithomp/xrpl-api 3.2.8 → 3.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/ledger/account_lines.d.ts +1 -1
- package/lib/ledger/account_lines.js +11 -2
- package/lib/ledger/currency.d.ts +1 -0
- package/lib/ledger/currency.js +4 -2
- package/lib/ledger/transaction.js +6 -0
- package/lib/models/book_offers.d.ts +3 -3
- package/lib/models/book_offers.js +1 -1
- package/lib/parse/ledger/amount.d.ts +2 -2
- package/lib/parse/ledger/amount.js +1 -0
- package/lib/parse/ledger/asset.d.ts +1 -1
- package/lib/parse/ledger/asset.js +1 -0
- package/lib/parse/ledger/destination.d.ts +2 -0
- package/lib/parse/ledger/destination.js +12 -0
- package/lib/parse/ledger/gateway-balances.js +4 -4
- package/lib/parse/ledger/ledger.js +12 -8
- package/lib/parse/ledger/regular-key.d.ts +2 -0
- package/lib/parse/ledger/regular-key.js +14 -0
- package/lib/parse/ledger/signers.d.ts +2 -0
- package/lib/parse/ledger/signers.js +12 -0
- package/lib/parse/ledger/source.d.ts +3 -0
- package/lib/parse/ledger/source.js +28 -0
- package/lib/parse/outcome/amm_changes.js +4 -2
- package/lib/parse/outcome/balance_changes.d.ts +2 -1
- package/lib/parse/outcome/balance_changes.js +5 -3
- package/lib/parse/outcome/locked_balance_changes.d.ts +2 -1
- package/lib/parse/outcome/locked_balance_changes.js +2 -1
- package/lib/parse/outcome.js +3 -2
- package/lib/parse/specification/account-delete.js +8 -11
- package/lib/parse/specification/amm-bid.js +6 -6
- package/lib/parse/specification/amm-clawback.js +6 -5
- package/lib/parse/specification/amm-create.js +6 -6
- package/lib/parse/specification/amm-delete.js +6 -6
- package/lib/parse/specification/amm-deposit.js +6 -6
- package/lib/parse/specification/amm-vote.js +6 -6
- package/lib/parse/specification/amm-withdraw.js +6 -6
- package/lib/parse/specification/check-cancel.js +6 -0
- package/lib/parse/specification/check-cash.js +6 -0
- package/lib/parse/specification/check-create.js +8 -11
- package/lib/parse/specification/clawback.js +6 -6
- package/lib/parse/specification/deposit-preauth.js +6 -0
- package/lib/parse/specification/did-delete.js +6 -6
- package/lib/parse/specification/did-set.js +6 -6
- package/lib/parse/specification/escrow-cancel.js +6 -5
- package/lib/parse/specification/escrow-create.js +8 -10
- package/lib/parse/specification/escrow-finish.js +6 -5
- package/lib/parse/specification/fee-update.js +2 -0
- package/lib/parse/specification/genesis-mint.js +2 -0
- package/lib/parse/specification/import.js +6 -5
- package/lib/parse/specification/invoke.js +8 -10
- package/lib/parse/specification/mptoken-authorize.js +6 -6
- package/lib/parse/specification/mptoken-issuance-create.js +6 -6
- package/lib/parse/specification/mptoken-issuance-destroy.js +6 -6
- package/lib/parse/specification/mptoken-issuance-set.js +6 -6
- package/lib/parse/specification/nftoken-accept-offer.js +6 -5
- package/lib/parse/specification/nftoken-burn.js +6 -5
- package/lib/parse/specification/nftoken-cancel-offer.js +6 -5
- package/lib/parse/specification/nftoken-create-offer.js +8 -10
- package/lib/parse/specification/nftoken-mint.js +8 -10
- package/lib/parse/specification/offer-cancel.js +8 -5
- package/lib/parse/specification/offer-create.js +8 -5
- package/lib/parse/specification/oracle-delete.js +6 -6
- package/lib/parse/specification/oracle-set.js +6 -6
- package/lib/parse/specification/payment-channel-claim.js +9 -3
- package/lib/parse/specification/payment-channel-create.js +10 -13
- package/lib/parse/specification/payment-channel-fund.js +8 -2
- package/lib/parse/specification/payment.js +8 -15
- package/lib/parse/specification/remit.js +8 -11
- package/lib/parse/specification/settings.js +6 -0
- package/lib/parse/specification/ticket-create.js +6 -0
- package/lib/parse/specification/trustline.js +6 -0
- package/lib/parse/specification/unl-report.js +2 -7
- package/lib/parse/specification/unrecognized.js +6 -6
- package/lib/parse/specification/uritoken-burn.js +6 -0
- package/lib/parse/specification/uritoken-buy.js +6 -0
- package/lib/parse/specification/uritoken-cancel-sell-offer.js +6 -0
- package/lib/parse/specification/uritoken-create-sell-offer.js +8 -10
- package/lib/parse/specification/uritoken-mint.js +8 -10
- package/lib/parse/utils.d.ts +2 -2
- package/lib/parse/utils.js +3 -0
- package/lib/types/account.d.ts +5 -2
- package/lib/types/adjustments.d.ts +4 -4
- package/lib/types/amounts.d.ts +1 -1
- package/lib/types/escrows.d.ts +0 -5
- package/lib/types/gateway_balances.d.ts +3 -3
- package/lib/types/import.d.ts +0 -2
- package/lib/types/invoke.d.ts +2 -3
- package/lib/types/ledger.d.ts +1 -0
- package/lib/types/outcome.d.ts +1 -0
- package/lib/types/payments.d.ts +2 -2
- package/lib/types/remits.d.ts +0 -3
- package/lib/types/signers.d.ts +16 -0
- package/lib/types/specification.d.ts +4 -1
- package/lib/types/unl_reports.d.ts +0 -2
- package/lib/v1/transaction/payment.js +14 -2
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { LedgerIndex } from "../models/ledger";
|
|
|
2
2
|
import { AccountLinesResponse } from "../models/account_lines";
|
|
3
3
|
import { ErrorResponse } from "../models/base_model";
|
|
4
4
|
export interface GetAccountLinesOptions {
|
|
5
|
-
|
|
5
|
+
issuer?: string;
|
|
6
6
|
currency?: string;
|
|
7
7
|
ledgerIndex?: LedgerIndex;
|
|
8
8
|
limit?: number;
|
|
@@ -46,8 +46,6 @@ async function getAccountLines(account, options = {}) {
|
|
|
46
46
|
const response = await connection.request({
|
|
47
47
|
command: "account_lines",
|
|
48
48
|
account,
|
|
49
|
-
counterparty: options.counterparty,
|
|
50
|
-
currency: options.currency,
|
|
51
49
|
ledger_index: options.ledgerIndex || "validated",
|
|
52
50
|
limit: options.limit,
|
|
53
51
|
marker: options.marker,
|
|
@@ -71,6 +69,17 @@ async function getAccountLines(account, options = {}) {
|
|
|
71
69
|
};
|
|
72
70
|
}
|
|
73
71
|
const result = response.result;
|
|
72
|
+
if (options.currency || options.issuer) {
|
|
73
|
+
result.lines = result.lines.filter((line) => {
|
|
74
|
+
if (options.currency && line.currency !== options.currency) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
if (options.issuer && line.account !== options.issuer) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return true;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
74
83
|
const newMarker = (0, utils_1.createMarker)(connection.hash, result.marker);
|
|
75
84
|
if (newMarker) {
|
|
76
85
|
result.marker = newMarker;
|
package/lib/ledger/currency.d.ts
CHANGED
package/lib/ledger/currency.js
CHANGED
|
@@ -38,6 +38,7 @@ const Client = __importStar(require("../client"));
|
|
|
38
38
|
const utils_1 = require("../parse/utils");
|
|
39
39
|
const transaction_1 = require("../parse/transaction");
|
|
40
40
|
const client_1 = require("../client");
|
|
41
|
+
const common_1 = require("../common");
|
|
41
42
|
const maxLength = 12;
|
|
42
43
|
async function parseCurrencyInformation(currency) {
|
|
43
44
|
if (!currency || typeof currency !== "string") {
|
|
@@ -90,14 +91,15 @@ async function decodeXlf15d(currencyCode) {
|
|
|
90
91
|
if (transaction.metaData.TransactionIndex === ctiTxIndex) {
|
|
91
92
|
const { Account: account, Destination: destination, LimitAmount: limit, Memos: memos, hash: hash, } = transaction;
|
|
92
93
|
const type = (0, transaction_1.parseTransactionType)(transaction.TransactionType);
|
|
93
|
-
ctiTx = {
|
|
94
|
+
ctiTx = (0, common_1.removeUndefined)({
|
|
94
95
|
type,
|
|
95
96
|
account,
|
|
96
97
|
destination,
|
|
98
|
+
issuer: limit?.issuer,
|
|
97
99
|
counterparty: limit?.issuer,
|
|
98
100
|
hash,
|
|
99
101
|
memos,
|
|
100
|
-
};
|
|
102
|
+
});
|
|
101
103
|
break;
|
|
102
104
|
}
|
|
103
105
|
}
|
|
@@ -245,6 +245,9 @@ async function getAccountPaymentParams(account, connection) {
|
|
|
245
245
|
if (fee > FEE_LIMIT) {
|
|
246
246
|
fee = FEE_LIMIT;
|
|
247
247
|
}
|
|
248
|
+
if (!fee) {
|
|
249
|
+
throw new Error("Fee is not defined");
|
|
250
|
+
}
|
|
248
251
|
resolve((0, common_1.xrpToDrops)(fee.toString()));
|
|
249
252
|
});
|
|
250
253
|
const sequencePromise = new Promise(async (resolve, rejects) => {
|
|
@@ -310,6 +313,9 @@ async function getTxSubmitParams(account, tx, definitions, connection, skip) {
|
|
|
310
313
|
if (fee > FEE_LIMIT) {
|
|
311
314
|
fee = FEE_LIMIT;
|
|
312
315
|
}
|
|
316
|
+
if (!fee) {
|
|
317
|
+
throw new Error("Fee is not defined");
|
|
318
|
+
}
|
|
313
319
|
resolve((0, common_1.xrpToDrops)(fee.toString()));
|
|
314
320
|
}
|
|
315
321
|
catch (e) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FormattedIssuedCurrency } from "../types";
|
|
1
|
+
import { IssuedCurrency, FormattedIssuedCurrency } from "../types";
|
|
2
2
|
export type OrderbookInfo = {
|
|
3
|
-
base: FormattedIssuedCurrency;
|
|
4
|
-
counter: FormattedIssuedCurrency;
|
|
3
|
+
base: IssuedCurrency | FormattedIssuedCurrency;
|
|
4
|
+
counter: IssuedCurrency | FormattedIssuedCurrency;
|
|
5
5
|
};
|
|
6
6
|
export declare function formatBidsAndAsks(orderbook: OrderbookInfo, offers: any[]): {
|
|
7
7
|
bids: any[];
|
|
@@ -8,7 +8,7 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
8
8
|
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
9
9
|
const orderbook_order_1 = require("../parse/ledger/orderbook-order");
|
|
10
10
|
function isSameIssue(a, b) {
|
|
11
|
-
return a.currency === b.currency && a.
|
|
11
|
+
return a.currency === b.currency && a.issuer === b.issuer;
|
|
12
12
|
}
|
|
13
13
|
function directionFilter(direction, order) {
|
|
14
14
|
return order.specification.direction === direction;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { FormattedIssuedCurrencyAmount, FormattedIssuedMPTAmount, Amount } from "../../types";
|
|
2
|
-
declare function parseAmount(amount: Amount): FormattedIssuedCurrencyAmount | FormattedIssuedMPTAmount;
|
|
1
|
+
import { IssuedCurrencyAmount, FormattedIssuedCurrencyAmount, FormattedIssuedMPTAmount, Amount } from "../../types";
|
|
2
|
+
declare function parseAmount(amount: Amount): IssuedCurrencyAmount | FormattedIssuedCurrencyAmount | FormattedIssuedMPTAmount;
|
|
3
3
|
export default parseAmount;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { FormattedIssuedCurrency, IssuedCurrency } from "../../types";
|
|
2
|
-
declare function parseAsset(asset: IssuedCurrency): FormattedIssuedCurrency | undefined;
|
|
2
|
+
declare function parseAsset(asset: IssuedCurrency): IssuedCurrency | FormattedIssuedCurrency | undefined;
|
|
3
3
|
export default parseAsset;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDestination = parseDestination;
|
|
4
|
+
const common_1 = require("../../common");
|
|
5
|
+
function parseDestination(tx) {
|
|
6
|
+
if (tx && tx.Destination) {
|
|
7
|
+
return (0, common_1.removeUndefined)({
|
|
8
|
+
address: tx.Destination,
|
|
9
|
+
tag: tx.DestinationTag,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -5,22 +5,22 @@ function parseGatewayBalances(balanceSheet) {
|
|
|
5
5
|
const result = {};
|
|
6
6
|
if (typeof balanceSheet.balances === "object") {
|
|
7
7
|
Object.entries(balanceSheet.balances).forEach((entry) => {
|
|
8
|
-
const [
|
|
8
|
+
const [issuer, balances] = entry;
|
|
9
9
|
balances.forEach((balance) => {
|
|
10
10
|
if (!result.balances) {
|
|
11
11
|
result.balances = [];
|
|
12
12
|
}
|
|
13
|
-
result.balances.push(Object.assign({ counterparty }, balance));
|
|
13
|
+
result.balances.push(Object.assign({ issuer, counterparty: issuer }, balance));
|
|
14
14
|
});
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
if (typeof balanceSheet.assets === "object") {
|
|
18
|
-
Object.entries(balanceSheet.assets).forEach(([
|
|
18
|
+
Object.entries(balanceSheet.assets).forEach(([issuer, assets]) => {
|
|
19
19
|
assets.forEach((balance) => {
|
|
20
20
|
if (!result.assets) {
|
|
21
21
|
result.assets = [];
|
|
22
22
|
}
|
|
23
|
-
result.assets.push(Object.assign({ counterparty }, balance));
|
|
23
|
+
result.assets.push(Object.assign({ issuer, counterparty: issuer }, balance));
|
|
24
24
|
});
|
|
25
25
|
});
|
|
26
26
|
}
|
|
@@ -8,21 +8,24 @@ const lodash_1 = __importDefault(require("lodash"));
|
|
|
8
8
|
const common_1 = require("../../common");
|
|
9
9
|
const models_1 = require("../../models");
|
|
10
10
|
const transaction_1 = require("../transaction");
|
|
11
|
-
function parseTransactionWrapper(
|
|
11
|
+
function parseTransactionWrapper(ledgerIndex, includeRawTransaction, tx) {
|
|
12
12
|
const transaction = Object.assign({}, lodash_1.default.omit(tx, "metaData"), {
|
|
13
13
|
meta: tx.metaData,
|
|
14
|
-
ledger_index:
|
|
14
|
+
ledger_index: ledgerIndex,
|
|
15
15
|
});
|
|
16
16
|
const result = (0, transaction_1.parseTransaction)(transaction, includeRawTransaction);
|
|
17
17
|
if (!result.outcome) {
|
|
18
18
|
result.outcome = {};
|
|
19
19
|
}
|
|
20
|
+
if (!result.outcome.ledgerIndex) {
|
|
21
|
+
result.outcome.ledgerIndex = ledgerIndex;
|
|
22
|
+
}
|
|
20
23
|
if (!result.outcome.ledgerVersion) {
|
|
21
|
-
result.outcome.ledgerVersion =
|
|
24
|
+
result.outcome.ledgerVersion = ledgerIndex;
|
|
22
25
|
}
|
|
23
26
|
return result;
|
|
24
27
|
}
|
|
25
|
-
function parseTransactions(transactions,
|
|
28
|
+
function parseTransactions(transactions, ledgerIndex, includeRawTransactions) {
|
|
26
29
|
if (lodash_1.default.isEmpty(transactions)) {
|
|
27
30
|
return {};
|
|
28
31
|
}
|
|
@@ -30,7 +33,7 @@ function parseTransactions(transactions, ledgerVersion, includeRawTransactions)
|
|
|
30
33
|
return { transactionHashes: transactions };
|
|
31
34
|
}
|
|
32
35
|
return {
|
|
33
|
-
transactions: transactions.map(lodash_1.default.partial(parseTransactionWrapper,
|
|
36
|
+
transactions: transactions.map(lodash_1.default.partial(parseTransactionWrapper, ledgerIndex, includeRawTransactions)),
|
|
34
37
|
};
|
|
35
38
|
}
|
|
36
39
|
function parseState(state) {
|
|
@@ -43,7 +46,7 @@ function parseState(state) {
|
|
|
43
46
|
return { rawState: JSON.stringify(state) };
|
|
44
47
|
}
|
|
45
48
|
function parseLedger(ledger, includeRawTransactions) {
|
|
46
|
-
const
|
|
49
|
+
const ledgerIndex = parseInt(ledger.ledger_index, 10);
|
|
47
50
|
return (0, common_1.removeUndefined)(Object.assign({
|
|
48
51
|
stateHash: ledger.account_hash,
|
|
49
52
|
close_time: (0, models_1.ledgerTimeToUnixTime)(ledger.close_time),
|
|
@@ -51,10 +54,11 @@ function parseLedger(ledger, includeRawTransactions) {
|
|
|
51
54
|
closeTimeResolution: ledger.close_time_resolution,
|
|
52
55
|
closeFlags: ledger.close_flags,
|
|
53
56
|
ledgerHash: ledger.ledger_hash,
|
|
54
|
-
|
|
57
|
+
ledgerIndex: ledgerIndex,
|
|
58
|
+
ledgerVersion: ledgerIndex,
|
|
55
59
|
parentLedgerHash: ledger.parent_hash,
|
|
56
60
|
parentCloseTime: (0, models_1.ledgerTimeToISO8601)(ledger.parent_close_time),
|
|
57
61
|
totalDrops: ledger.total_coins,
|
|
58
62
|
transactionHash: ledger.transaction_hash,
|
|
59
|
-
}, parseTransactions(ledger.transactions,
|
|
63
|
+
}, parseTransactions(ledger.transactions, ledgerIndex, includeRawTransactions), parseState(ledger.accountState)));
|
|
60
64
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSignerRegularKey = parseSignerRegularKey;
|
|
4
|
+
const ripple_keypairs_1 = require("ripple-keypairs");
|
|
5
|
+
function parseSignerRegularKey(tx) {
|
|
6
|
+
if (tx && tx.SigningPubKey && !tx.Signers) {
|
|
7
|
+
const signedBy = (0, ripple_keypairs_1.deriveAddress)(tx.SigningPubKey);
|
|
8
|
+
if (signedBy !== tx.Account) {
|
|
9
|
+
return {
|
|
10
|
+
address: signedBy,
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseSigners = parseSigners;
|
|
4
|
+
function parseSigners(tx) {
|
|
5
|
+
if (tx && tx.Signers) {
|
|
6
|
+
return tx.Signers.map((signer) => {
|
|
7
|
+
return {
|
|
8
|
+
address: signer.Signer.Account,
|
|
9
|
+
};
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseSourceWithAmount = parseSourceWithAmount;
|
|
7
|
+
exports.parseSource = parseSource;
|
|
8
|
+
const common_1 = require("../../common");
|
|
9
|
+
const amount_1 = __importDefault(require("./amount"));
|
|
10
|
+
const account_1 = require("./account");
|
|
11
|
+
const utils_1 = require("../utils");
|
|
12
|
+
function parseSourceWithAmount(tx) {
|
|
13
|
+
if (tx && (tx.Account || tx.Account === "")) {
|
|
14
|
+
return (0, common_1.removeUndefined)({
|
|
15
|
+
address: (0, account_1.parseAccount)(tx.Account),
|
|
16
|
+
maxAmount: (0, utils_1.removeGenericCounterparty)((0, amount_1.default)(tx.SendMax || tx.DeliverMax || tx.Amount), tx.Account),
|
|
17
|
+
tag: tx.SourceTag,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function parseSource(tx) {
|
|
22
|
+
if (tx && (tx.Account || tx.Account === "")) {
|
|
23
|
+
return (0, common_1.removeUndefined)({
|
|
24
|
+
address: (0, account_1.parseAccount)(tx.Account),
|
|
25
|
+
tag: tx.SourceTag,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -104,10 +104,11 @@ function summarizeActionSlotChanges(node) {
|
|
|
104
104
|
if (final.AuctionSlot.Price.value !== prev.AuctionSlot.Price.value) {
|
|
105
105
|
changes.priceChange = {
|
|
106
106
|
currency: final.AuctionSlot.Price.currency,
|
|
107
|
-
|
|
107
|
+
issuer: final.AuctionSlot.Price.issuer,
|
|
108
108
|
value: new bignumber_js_1.default(final.AuctionSlot.Price.value)
|
|
109
109
|
.minus(new bignumber_js_1.default(prev.AuctionSlot.Price.value))
|
|
110
110
|
.toString(10),
|
|
111
|
+
counterparty: final.AuctionSlot.Price.issuer,
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
114
|
if (final.AuctionSlot.TimeInterval !== prev.AuctionSlot.TimeInterval) {
|
|
@@ -184,8 +185,9 @@ function summarizeAmm(node) {
|
|
|
184
185
|
if (prev.LPTokenBalance) {
|
|
185
186
|
summary.lpTokenBalanceChange = {
|
|
186
187
|
currency: final.LPTokenBalance.currency,
|
|
187
|
-
|
|
188
|
+
issuer: final.LPTokenBalance.issuer,
|
|
188
189
|
value: new bignumber_js_1.default(final.LPTokenBalance.value).minus(new bignumber_js_1.default(prev.LPTokenBalance.value)).toString(10),
|
|
190
|
+
counterparty: final.LPTokenBalance.issuer,
|
|
189
191
|
};
|
|
190
192
|
}
|
|
191
193
|
if (prev.VoteSlots) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TransactionMetadata } from "xrpl";
|
|
2
2
|
interface BalanceChangeQuantity {
|
|
3
|
-
|
|
3
|
+
issuer?: string;
|
|
4
4
|
currency?: string;
|
|
5
5
|
value: string;
|
|
6
|
+
counterparty?: string;
|
|
6
7
|
mpt_issuance_id?: string;
|
|
7
8
|
}
|
|
8
9
|
export interface AddressBalanceChangeQuantity {
|
|
@@ -73,11 +73,12 @@ function parseXRPQuantity(node, valueParser, nativeCurrency) {
|
|
|
73
73
|
function flipTrustlinePerspective(quantity) {
|
|
74
74
|
const negatedBalance = new bignumber_js_1.default(quantity.balance.value).negated();
|
|
75
75
|
return {
|
|
76
|
-
address: quantity.balance.
|
|
76
|
+
address: quantity.balance.issuer,
|
|
77
77
|
balance: {
|
|
78
|
-
|
|
78
|
+
issuer: quantity.address,
|
|
79
79
|
currency: quantity.balance.currency,
|
|
80
80
|
value: negatedBalance.toString(),
|
|
81
|
+
counterparty: quantity.address,
|
|
81
82
|
},
|
|
82
83
|
};
|
|
83
84
|
}
|
|
@@ -90,9 +91,10 @@ function parseTrustlineQuantity(node, valueParser) {
|
|
|
90
91
|
const result = {
|
|
91
92
|
address: fields.LowLimit.issuer,
|
|
92
93
|
balance: {
|
|
93
|
-
|
|
94
|
+
issuer: fields.HighLimit.issuer,
|
|
94
95
|
currency: fields.Balance.currency,
|
|
95
96
|
value: value.toString(),
|
|
97
|
+
counterparty: fields.HighLimit.issuer,
|
|
96
98
|
},
|
|
97
99
|
};
|
|
98
100
|
return [result, flipTrustlinePerspective(result)];
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { TransactionMetadata } from "xrpl";
|
|
2
2
|
interface LockedBalanceChangeQuantity {
|
|
3
|
-
|
|
3
|
+
issuer: string;
|
|
4
4
|
currency: string;
|
|
5
5
|
value: string;
|
|
6
|
+
counterparty: string;
|
|
6
7
|
}
|
|
7
8
|
export interface AddressLockedBalanceChangeQuantity {
|
|
8
9
|
address: string;
|
|
@@ -53,9 +53,10 @@ function parseTrustlineQuantity(node, valueParser) {
|
|
|
53
53
|
const result = {
|
|
54
54
|
address: fields.LowLimit.issuer,
|
|
55
55
|
lockedBalance: {
|
|
56
|
-
|
|
56
|
+
issuer: LockedBalanceFields.LockedBalance.issuer,
|
|
57
57
|
currency: LockedBalanceFields.LockedBalance.currency,
|
|
58
58
|
value: value.toString(),
|
|
59
|
+
counterparty: LockedBalanceFields.LockedBalance.issuer,
|
|
59
60
|
},
|
|
60
61
|
};
|
|
61
62
|
return [result];
|
package/lib/parse/outcome.js
CHANGED
|
@@ -31,7 +31,7 @@ function parseOutcome(tx, nativeCurrency, definitions) {
|
|
|
31
31
|
result: tx.meta.TransactionResult,
|
|
32
32
|
timestamp: (0, utils_1.parseTimestamp)(tx.date),
|
|
33
33
|
fee: (0, common_1.dropsToXrp)(tx.Fee),
|
|
34
|
-
balanceChanges,
|
|
34
|
+
balanceChanges: Object.keys(balanceChanges).length > 0 ? balanceChanges : undefined,
|
|
35
35
|
lockedBalanceChanges: Object.keys(lockedBalanceChanges).length > 0 ? lockedBalanceChanges : undefined,
|
|
36
36
|
orderbookChanges: Object.keys(orderbookChanges).length > 0 ? orderbookChanges : undefined,
|
|
37
37
|
channelChanges,
|
|
@@ -49,7 +49,8 @@ function parseOutcome(tx, nativeCurrency, definitions) {
|
|
|
49
49
|
unlReportChanges,
|
|
50
50
|
hooksExecutions,
|
|
51
51
|
emittedTxns,
|
|
52
|
-
|
|
52
|
+
ledgerIndex: tx.ledger_index || tx.inLedger,
|
|
53
|
+
ledgerVersion: tx.ledger_index || tx.inLedger,
|
|
53
54
|
indexInLedger: tx.meta.TransactionIndex,
|
|
54
55
|
deliveredAmount: (0, index_1.parseDeliveredAmount)(tx),
|
|
55
56
|
});
|
|
@@ -37,20 +37,17 @@ const assert = __importStar(require("assert"));
|
|
|
37
37
|
const common_1 = require("../../common");
|
|
38
38
|
const emit_details_1 = require("../ledger/emit_details");
|
|
39
39
|
const memos_1 = require("../ledger/memos");
|
|
40
|
-
const
|
|
40
|
+
const signers_1 = require("../ledger/signers");
|
|
41
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
42
|
+
const source_1 = require("../ledger/source");
|
|
43
|
+
const destination_1 = require("../ledger/destination");
|
|
41
44
|
function parseAccountDelete(tx) {
|
|
42
45
|
assert.ok(tx.TransactionType === "AccountDelete");
|
|
43
|
-
const source = (0, common_1.removeUndefined)({
|
|
44
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
45
|
-
tag: tx.SourceTag,
|
|
46
|
-
});
|
|
47
|
-
const destination = (0, common_1.removeUndefined)({
|
|
48
|
-
address: tx.Destination,
|
|
49
|
-
tag: tx.DestinationTag,
|
|
50
|
-
});
|
|
51
46
|
return (0, common_1.removeUndefined)({
|
|
52
|
-
|
|
53
|
-
|
|
47
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
48
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
49
|
+
source: (0, source_1.parseSource)(tx),
|
|
50
|
+
destination: (0, destination_1.parseDestination)(tx),
|
|
54
51
|
emittedDetails: (0, emit_details_1.parseEmittedDetails)(tx),
|
|
55
52
|
memos: (0, memos_1.parseMemos)(tx),
|
|
56
53
|
});
|
|
@@ -42,15 +42,15 @@ const amount_1 = __importDefault(require("../ledger/amount"));
|
|
|
42
42
|
const asset_1 = __importDefault(require("../ledger/asset"));
|
|
43
43
|
const auth_accounts_1 = __importDefault(require("../ledger/auth-accounts"));
|
|
44
44
|
const memos_1 = require("../ledger/memos");
|
|
45
|
-
const
|
|
45
|
+
const signers_1 = require("../ledger/signers");
|
|
46
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
47
|
+
const source_1 = require("../ledger/source");
|
|
46
48
|
function parseAmmBid(tx) {
|
|
47
49
|
assert.ok(tx.TransactionType === "AMMBid");
|
|
48
|
-
const source = (0, common_1.removeUndefined)({
|
|
49
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
50
|
-
tag: tx.SourceTag,
|
|
51
|
-
});
|
|
52
50
|
return (0, common_1.removeUndefined)({
|
|
53
|
-
|
|
51
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
52
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
53
|
+
source: (0, source_1.parseSource)(tx),
|
|
54
54
|
asset: (0, asset_1.default)(tx.Asset),
|
|
55
55
|
asset2: (0, asset_1.default)(tx.Asset2),
|
|
56
56
|
bidMin: tx.BidMin ? (0, amount_1.default)(tx.BidMin) : undefined,
|
|
@@ -42,15 +42,16 @@ const amount_1 = __importDefault(require("../ledger/amount"));
|
|
|
42
42
|
const asset_1 = __importDefault(require("../ledger/asset"));
|
|
43
43
|
const memos_1 = require("../ledger/memos");
|
|
44
44
|
const account_1 = require("../ledger/account");
|
|
45
|
+
const signers_1 = require("../ledger/signers");
|
|
46
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
47
|
+
const source_1 = require("../ledger/source");
|
|
45
48
|
const amm_clawback_flags_1 = __importDefault(require("../ledger/amm-clawback-flags"));
|
|
46
49
|
function parseAmmClawback(tx) {
|
|
47
50
|
assert.ok(tx.TransactionType === "AMMClawback");
|
|
48
|
-
const source = (0, common_1.removeUndefined)({
|
|
49
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
50
|
-
tag: tx.SourceTag,
|
|
51
|
-
});
|
|
52
51
|
return (0, common_1.removeUndefined)({
|
|
53
|
-
|
|
52
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
53
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
54
|
+
source: (0, source_1.parseSource)(tx),
|
|
54
55
|
asset: (0, asset_1.default)(tx.Asset),
|
|
55
56
|
asset2: (0, asset_1.default)(tx.Asset2),
|
|
56
57
|
amount: tx.Amount ? (0, amount_1.default)(tx.Amount) : undefined,
|
|
@@ -40,15 +40,15 @@ const assert = __importStar(require("assert"));
|
|
|
40
40
|
const common_1 = require("../../common");
|
|
41
41
|
const amount_1 = __importDefault(require("../ledger/amount"));
|
|
42
42
|
const memos_1 = require("../ledger/memos");
|
|
43
|
-
const
|
|
43
|
+
const signers_1 = require("../ledger/signers");
|
|
44
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
45
|
+
const source_1 = require("../ledger/source");
|
|
44
46
|
function parseAmmCreate(tx) {
|
|
45
47
|
assert.ok(tx.TransactionType === "AMMCreate");
|
|
46
|
-
const source = (0, common_1.removeUndefined)({
|
|
47
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
48
|
-
tag: tx.SourceTag,
|
|
49
|
-
});
|
|
50
48
|
return (0, common_1.removeUndefined)({
|
|
51
|
-
|
|
49
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
50
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
51
|
+
source: (0, source_1.parseSource)(tx),
|
|
52
52
|
amount: (0, amount_1.default)(tx.Amount),
|
|
53
53
|
amount2: (0, amount_1.default)(tx.Amount2),
|
|
54
54
|
tradingFee: tx.TradingFee,
|
|
@@ -40,15 +40,15 @@ const assert = __importStar(require("assert"));
|
|
|
40
40
|
const common_1 = require("../../common");
|
|
41
41
|
const asset_1 = __importDefault(require("../ledger/asset"));
|
|
42
42
|
const memos_1 = require("../ledger/memos");
|
|
43
|
-
const
|
|
43
|
+
const signers_1 = require("../ledger/signers");
|
|
44
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
45
|
+
const source_1 = require("../ledger/source");
|
|
44
46
|
function parseAmmDelete(tx) {
|
|
45
47
|
assert.ok(tx.TransactionType === "AMMDelete");
|
|
46
|
-
const source = (0, common_1.removeUndefined)({
|
|
47
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
48
|
-
tag: tx.SourceTag,
|
|
49
|
-
});
|
|
50
48
|
return (0, common_1.removeUndefined)({
|
|
51
|
-
|
|
49
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
50
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
51
|
+
source: (0, source_1.parseSource)(tx),
|
|
52
52
|
asset: (0, asset_1.default)(tx.Asset),
|
|
53
53
|
asset2: (0, asset_1.default)(tx.Asset2),
|
|
54
54
|
memos: (0, memos_1.parseMemos)(tx),
|
|
@@ -41,16 +41,16 @@ const common_1 = require("../../common");
|
|
|
41
41
|
const amount_1 = __importDefault(require("../ledger/amount"));
|
|
42
42
|
const asset_1 = __importDefault(require("../ledger/asset"));
|
|
43
43
|
const memos_1 = require("../ledger/memos");
|
|
44
|
-
const
|
|
44
|
+
const signers_1 = require("../ledger/signers");
|
|
45
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
46
|
+
const source_1 = require("../ledger/source");
|
|
45
47
|
const amm_deposit_flags_1 = __importDefault(require("../ledger/amm-deposit-flags"));
|
|
46
48
|
function parseAmmDeposit(tx) {
|
|
47
49
|
assert.ok(tx.TransactionType === "AMMDeposit");
|
|
48
|
-
const source = (0, common_1.removeUndefined)({
|
|
49
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
50
|
-
tag: tx.SourceTag,
|
|
51
|
-
});
|
|
52
50
|
return (0, common_1.removeUndefined)({
|
|
53
|
-
|
|
51
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
52
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
53
|
+
source: (0, source_1.parseSource)(tx),
|
|
54
54
|
asset: (0, asset_1.default)(tx.Asset),
|
|
55
55
|
asset2: (0, asset_1.default)(tx.Asset2),
|
|
56
56
|
amount: tx.Amount ? (0, amount_1.default)(tx.Amount) : undefined,
|
|
@@ -40,15 +40,15 @@ const assert = __importStar(require("assert"));
|
|
|
40
40
|
const common_1 = require("../../common");
|
|
41
41
|
const asset_1 = __importDefault(require("../ledger/asset"));
|
|
42
42
|
const memos_1 = require("../ledger/memos");
|
|
43
|
-
const
|
|
43
|
+
const signers_1 = require("../ledger/signers");
|
|
44
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
45
|
+
const source_1 = require("../ledger/source");
|
|
44
46
|
function parseAmmVote(tx) {
|
|
45
47
|
assert.ok(tx.TransactionType === "AMMVote");
|
|
46
|
-
const source = (0, common_1.removeUndefined)({
|
|
47
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
48
|
-
tag: tx.SourceTag,
|
|
49
|
-
});
|
|
50
48
|
return (0, common_1.removeUndefined)({
|
|
51
|
-
|
|
49
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
50
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
51
|
+
source: (0, source_1.parseSource)(tx),
|
|
52
52
|
asset: (0, asset_1.default)(tx.Asset),
|
|
53
53
|
asset2: (0, asset_1.default)(tx.Asset2),
|
|
54
54
|
tradingFee: tx.TradingFee,
|
|
@@ -41,16 +41,16 @@ const common_1 = require("../../common");
|
|
|
41
41
|
const amount_1 = __importDefault(require("../ledger/amount"));
|
|
42
42
|
const asset_1 = __importDefault(require("../ledger/asset"));
|
|
43
43
|
const memos_1 = require("../ledger/memos");
|
|
44
|
-
const
|
|
44
|
+
const signers_1 = require("../ledger/signers");
|
|
45
|
+
const regular_key_1 = require("../ledger/regular-key");
|
|
46
|
+
const source_1 = require("../ledger/source");
|
|
45
47
|
const amm_withdraw_flags_1 = __importDefault(require("../ledger/amm-withdraw-flags"));
|
|
46
48
|
function parseAmmDeposit(tx) {
|
|
47
49
|
assert.ok(tx.TransactionType === "AMMWithdraw");
|
|
48
|
-
const source = (0, common_1.removeUndefined)({
|
|
49
|
-
address: (0, account_1.parseAccount)(tx.Account),
|
|
50
|
-
tag: tx.SourceTag,
|
|
51
|
-
});
|
|
52
50
|
return (0, common_1.removeUndefined)({
|
|
53
|
-
|
|
51
|
+
signers: (0, signers_1.parseSigners)(tx),
|
|
52
|
+
signer: (0, regular_key_1.parseSignerRegularKey)(tx),
|
|
53
|
+
source: (0, source_1.parseSource)(tx),
|
|
54
54
|
asset: (0, asset_1.default)(tx.Asset),
|
|
55
55
|
asset2: (0, asset_1.default)(tx.Asset2),
|
|
56
56
|
amount: tx.Amount ? (0, amount_1.default)(tx.Amount) : undefined,
|