@ledgerhq/coin-xrp 6.2.2 → 6.3.0-nightly.0
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/CHANGELOG.md +12 -0
- package/lib/api/index.d.ts +2 -11
- package/lib/api/index.d.ts.map +1 -1
- package/lib/api/index.integ.test.js +20 -5
- package/lib/api/index.integ.test.js.map +1 -1
- package/lib/api/index.js +16 -5
- package/lib/api/index.js.map +1 -1
- package/lib/api/index.test.js +18 -9
- package/lib/api/index.test.js.map +1 -1
- package/lib/index.d.ts +0 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +0 -3
- package/lib/index.js.map +1 -1
- package/lib/logic/getAccountInfo.d.ts +3 -0
- package/lib/logic/getAccountInfo.d.ts.map +1 -0
- package/lib/logic/getAccountInfo.js +9 -0
- package/lib/logic/getAccountInfo.js.map +1 -0
- package/lib/logic/getBalance.d.ts.map +1 -1
- package/lib/logic/getBalance.js +13 -1
- package/lib/logic/getBalance.js.map +1 -1
- package/lib/logic/getBalance.test.js +14 -1
- package/lib/logic/getBalance.test.js.map +1 -1
- package/lib/logic/getTransactionStatus.d.ts +3 -0
- package/lib/logic/getTransactionStatus.d.ts.map +1 -0
- package/lib/{bridge → logic}/getTransactionStatus.js +15 -19
- package/lib/logic/getTransactionStatus.js.map +1 -0
- package/lib/logic/getTransactionStatus.test.d.ts +2 -0
- package/lib/logic/getTransactionStatus.test.d.ts.map +1 -0
- package/lib/logic/getTransactionStatus.test.js +184 -0
- package/lib/logic/getTransactionStatus.test.js.map +1 -0
- package/lib/logic/index.d.ts +3 -1
- package/lib/logic/index.d.ts.map +1 -1
- package/lib/logic/index.js +5 -2
- package/lib/logic/index.js.map +1 -1
- package/lib/logic/utils.d.ts +0 -1
- package/lib/logic/utils.d.ts.map +1 -1
- package/lib/logic/utils.js +14 -10
- package/lib/logic/utils.js.map +1 -1
- package/lib/test/bridgeDatasetTest.js +7 -7
- package/lib/test/bridgeDatasetTest.js.map +1 -1
- package/lib/{bridge/transaction.d.ts → transaction.d.ts} +1 -1
- package/lib/transaction.d.ts.map +1 -0
- package/lib/transaction.js.map +1 -0
- package/lib/types/model.d.ts +7 -0
- package/lib/types/model.d.ts.map +1 -1
- package/lib-es/api/index.d.ts +2 -11
- package/lib-es/api/index.d.ts.map +1 -1
- package/lib-es/api/index.integ.test.js +20 -5
- package/lib-es/api/index.integ.test.js.map +1 -1
- package/lib-es/api/index.js +17 -6
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/api/index.test.js +18 -9
- package/lib-es/api/index.test.js.map +1 -1
- package/lib-es/index.d.ts +0 -1
- package/lib-es/index.d.ts.map +1 -1
- package/lib-es/index.js +0 -1
- package/lib-es/index.js.map +1 -1
- package/lib-es/logic/getAccountInfo.d.ts +3 -0
- package/lib-es/logic/getAccountInfo.d.ts.map +1 -0
- package/lib-es/logic/getAccountInfo.js +6 -0
- package/lib-es/logic/getAccountInfo.js.map +1 -0
- package/lib-es/logic/getBalance.d.ts.map +1 -1
- package/lib-es/logic/getBalance.js +14 -2
- package/lib-es/logic/getBalance.js.map +1 -1
- package/lib-es/logic/getBalance.test.js +14 -1
- package/lib-es/logic/getBalance.test.js.map +1 -1
- package/lib-es/logic/getTransactionStatus.d.ts +3 -0
- package/lib-es/logic/getTransactionStatus.d.ts.map +1 -0
- package/lib-es/{bridge → logic}/getTransactionStatus.js +13 -14
- package/lib-es/logic/getTransactionStatus.js.map +1 -0
- package/lib-es/logic/getTransactionStatus.test.d.ts +2 -0
- package/lib-es/logic/getTransactionStatus.test.d.ts.map +1 -0
- package/lib-es/logic/getTransactionStatus.test.js +159 -0
- package/lib-es/logic/getTransactionStatus.test.js.map +1 -0
- package/lib-es/logic/index.d.ts +3 -1
- package/lib-es/logic/index.d.ts.map +1 -1
- package/lib-es/logic/index.js +3 -1
- package/lib-es/logic/index.js.map +1 -1
- package/lib-es/logic/utils.d.ts +0 -1
- package/lib-es/logic/utils.d.ts.map +1 -1
- package/lib-es/logic/utils.js +13 -8
- package/lib-es/logic/utils.js.map +1 -1
- package/lib-es/test/bridgeDatasetTest.js +7 -7
- package/lib-es/test/bridgeDatasetTest.js.map +1 -1
- package/lib-es/{bridge/transaction.d.ts → transaction.d.ts} +1 -1
- package/lib-es/transaction.d.ts.map +1 -0
- package/lib-es/transaction.js.map +1 -0
- package/lib-es/types/model.d.ts +7 -0
- package/lib-es/types/model.d.ts.map +1 -1
- package/package.json +6 -7
- package/src/api/index.integ.test.ts +20 -6
- package/src/api/index.test.ts +23 -22
- package/src/api/index.ts +30 -19
- package/src/index.ts +0 -1
- package/src/logic/getAccountInfo.ts +7 -0
- package/src/logic/getBalance.test.ts +14 -1
- package/src/logic/getBalance.ts +18 -2
- package/src/logic/getTransactionStatus.test.ts +215 -0
- package/src/{bridge → logic}/getTransactionStatus.ts +18 -21
- package/src/logic/index.ts +3 -6
- package/src/logic/utils.ts +24 -8
- package/src/test/bridgeDatasetTest.ts +7 -7
- package/src/{bridge/transaction.ts → transaction.ts} +1 -1
- package/src/types/model.ts +11 -0
- package/lib/bridge/broadcast.d.ts +0 -4
- package/lib/bridge/broadcast.d.ts.map +0 -1
- package/lib/bridge/broadcast.js +0 -11
- package/lib/bridge/broadcast.js.map +0 -1
- package/lib/bridge/createTransaction.d.ts +0 -4
- package/lib/bridge/createTransaction.d.ts.map +0 -1
- package/lib/bridge/createTransaction.js +0 -18
- package/lib/bridge/createTransaction.js.map +0 -1
- package/lib/bridge/estimateMaxSpendable.d.ts +0 -4
- package/lib/bridge/estimateMaxSpendable.d.ts.map +0 -1
- package/lib/bridge/estimateMaxSpendable.js +0 -26
- package/lib/bridge/estimateMaxSpendable.js.map +0 -1
- package/lib/bridge/getTransactionStatus.d.ts +0 -4
- package/lib/bridge/getTransactionStatus.d.ts.map +0 -1
- package/lib/bridge/getTransactionStatus.js.map +0 -1
- package/lib/bridge/index.d.ts +0 -11
- package/lib/bridge/index.d.ts.map +0 -1
- package/lib/bridge/index.js +0 -47
- package/lib/bridge/index.js.map +0 -1
- package/lib/bridge/prepareTransaction.d.ts +0 -4
- package/lib/bridge/prepareTransaction.d.ts.map +0 -1
- package/lib/bridge/prepareTransaction.js +0 -14
- package/lib/bridge/prepareTransaction.js.map +0 -1
- package/lib/bridge/signOperation.d.ts +0 -5
- package/lib/bridge/signOperation.d.ts.map +0 -1
- package/lib/bridge/signOperation.js +0 -76
- package/lib/bridge/signOperation.js.map +0 -1
- package/lib/bridge/synchronization.d.ts +0 -3
- package/lib/bridge/synchronization.d.ts.map +0 -1
- package/lib/bridge/synchronization.js +0 -85
- package/lib/bridge/synchronization.js.map +0 -1
- package/lib/bridge/synchronization.test.d.ts +0 -2
- package/lib/bridge/synchronization.test.d.ts.map +0 -1
- package/lib/bridge/synchronization.test.js +0 -140
- package/lib/bridge/synchronization.test.js.map +0 -1
- package/lib/bridge/transaction.d.ts.map +0 -1
- package/lib/bridge/transaction.js.map +0 -1
- package/lib-es/bridge/broadcast.d.ts +0 -4
- package/lib-es/bridge/broadcast.d.ts.map +0 -1
- package/lib-es/bridge/broadcast.js +0 -7
- package/lib-es/bridge/broadcast.js.map +0 -1
- package/lib-es/bridge/createTransaction.d.ts +0 -4
- package/lib-es/bridge/createTransaction.d.ts.map +0 -1
- package/lib-es/bridge/createTransaction.js +0 -11
- package/lib-es/bridge/createTransaction.js.map +0 -1
- package/lib-es/bridge/estimateMaxSpendable.d.ts +0 -4
- package/lib-es/bridge/estimateMaxSpendable.d.ts.map +0 -1
- package/lib-es/bridge/estimateMaxSpendable.js +0 -19
- package/lib-es/bridge/estimateMaxSpendable.js.map +0 -1
- package/lib-es/bridge/getTransactionStatus.d.ts +0 -4
- package/lib-es/bridge/getTransactionStatus.d.ts.map +0 -1
- package/lib-es/bridge/getTransactionStatus.js.map +0 -1
- package/lib-es/bridge/index.d.ts +0 -11
- package/lib-es/bridge/index.d.ts.map +0 -1
- package/lib-es/bridge/index.js +0 -41
- package/lib-es/bridge/index.js.map +0 -1
- package/lib-es/bridge/prepareTransaction.d.ts +0 -4
- package/lib-es/bridge/prepareTransaction.d.ts.map +0 -1
- package/lib-es/bridge/prepareTransaction.js +0 -10
- package/lib-es/bridge/prepareTransaction.js.map +0 -1
- package/lib-es/bridge/signOperation.d.ts +0 -5
- package/lib-es/bridge/signOperation.d.ts.map +0 -1
- package/lib-es/bridge/signOperation.js +0 -72
- package/lib-es/bridge/signOperation.js.map +0 -1
- package/lib-es/bridge/synchronization.d.ts +0 -3
- package/lib-es/bridge/synchronization.d.ts.map +0 -1
- package/lib-es/bridge/synchronization.js +0 -78
- package/lib-es/bridge/synchronization.js.map +0 -1
- package/lib-es/bridge/synchronization.test.d.ts +0 -2
- package/lib-es/bridge/synchronization.test.d.ts.map +0 -1
- package/lib-es/bridge/synchronization.test.js +0 -135
- package/lib-es/bridge/synchronization.test.js.map +0 -1
- package/lib-es/bridge/transaction.d.ts.map +0 -1
- package/lib-es/bridge/transaction.js.map +0 -1
- package/src/bridge/broadcast.ts +0 -11
- package/src/bridge/createTransaction.ts +0 -13
- package/src/bridge/estimateMaxSpendable.ts +0 -25
- package/src/bridge/index.ts +0 -59
- package/src/bridge/prepareTransaction.ts +0 -18
- package/src/bridge/signOperation.ts +0 -100
- package/src/bridge/synchronization.test.ts +0 -153
- package/src/bridge/synchronization.ts +0 -108
- /package/lib/{bridge/transaction.js → transaction.js} +0 -0
- /package/lib-es/{bridge/transaction.js → transaction.js} +0 -0
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { AccountShapeInfo } from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
|
2
|
-
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/index";
|
|
3
|
-
import { Account, SyncConfig } from "@ledgerhq/types-live";
|
|
4
|
-
import BigNumber from "bignumber.js";
|
|
5
|
-
import { getAccountShape } from "./synchronization";
|
|
6
|
-
|
|
7
|
-
const mockGetServerInfos = jest.fn().mockResolvedValue({
|
|
8
|
-
info: {
|
|
9
|
-
complete_ledgers: "1-2",
|
|
10
|
-
validated_ledger: {
|
|
11
|
-
reserve_base_xrp: "0",
|
|
12
|
-
reserve_inc_xrp: "0",
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
const mockGetAccountInfo = jest.fn().mockResolvedValue({
|
|
17
|
-
isNewAccount: true,
|
|
18
|
-
balance: "0",
|
|
19
|
-
ownerCount: 0,
|
|
20
|
-
sequence: 0,
|
|
21
|
-
});
|
|
22
|
-
const mockGetTransactions = jest.fn();
|
|
23
|
-
jest.mock("../network", () => ({
|
|
24
|
-
getServerInfos: () => mockGetServerInfos(),
|
|
25
|
-
getAccountInfo: () => mockGetAccountInfo(),
|
|
26
|
-
getTransactions: () => mockGetTransactions(),
|
|
27
|
-
}));
|
|
28
|
-
|
|
29
|
-
describe("getAccountShape", () => {
|
|
30
|
-
beforeEach(() => {
|
|
31
|
-
mockGetServerInfos.mockClear();
|
|
32
|
-
mockGetAccountInfo.mockClear();
|
|
33
|
-
mockGetTransactions.mockClear();
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it("returns early when account is new", async () => {
|
|
37
|
-
// Given
|
|
38
|
-
mockGetAccountInfo.mockResolvedValue({
|
|
39
|
-
isNewAccount: true,
|
|
40
|
-
balance: "0",
|
|
41
|
-
ownerCount: 0,
|
|
42
|
-
sequence: 0,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// When
|
|
46
|
-
const account = await getAccountShape(
|
|
47
|
-
{
|
|
48
|
-
address: "address",
|
|
49
|
-
currency: getCryptoCurrencyById("ripple"),
|
|
50
|
-
derivationMode: "",
|
|
51
|
-
index: 0,
|
|
52
|
-
} as AccountShapeInfo<Account>,
|
|
53
|
-
{} as SyncConfig,
|
|
54
|
-
);
|
|
55
|
-
|
|
56
|
-
// Then
|
|
57
|
-
expect(mockGetAccountInfo).toHaveBeenCalledTimes(1);
|
|
58
|
-
expect(mockGetServerInfos).toHaveBeenCalledTimes(0);
|
|
59
|
-
expect(mockGetTransactions).toHaveBeenCalledTimes(0);
|
|
60
|
-
expect(account).toEqual({
|
|
61
|
-
id: "js:2:ripple:address:",
|
|
62
|
-
xpub: "address",
|
|
63
|
-
blockHeight: 0,
|
|
64
|
-
balance: new BigNumber(0),
|
|
65
|
-
spendableBalance: new BigNumber(0),
|
|
66
|
-
operations: [],
|
|
67
|
-
operationsCount: 0,
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
const someMarker = { ledger: 1, seq: 1 };
|
|
72
|
-
function mockNetworkTxs(txs: unknown): unknown {
|
|
73
|
-
return {
|
|
74
|
-
account: "account",
|
|
75
|
-
ledger_index_max: 1,
|
|
76
|
-
ledger_index_min: 1,
|
|
77
|
-
limit: 1,
|
|
78
|
-
validated: false,
|
|
79
|
-
transactions: txs,
|
|
80
|
-
marker: someMarker,
|
|
81
|
-
error: "",
|
|
82
|
-
};
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
it("convert correctly operations", async () => {
|
|
86
|
-
// Given
|
|
87
|
-
mockGetAccountInfo.mockResolvedValue({
|
|
88
|
-
isNewAccount: false,
|
|
89
|
-
balance: "0",
|
|
90
|
-
ownerCount: 0,
|
|
91
|
-
sequence: 0,
|
|
92
|
-
});
|
|
93
|
-
mockGetTransactions.mockResolvedValue(
|
|
94
|
-
mockNetworkTxs([
|
|
95
|
-
{
|
|
96
|
-
ledger_hash: "HASH_VALUE_BLOCK",
|
|
97
|
-
hash: "HASH_VALUE",
|
|
98
|
-
meta: { delivered_amount: "100" },
|
|
99
|
-
tx_json: {
|
|
100
|
-
TransactionType: "Payment",
|
|
101
|
-
Fee: "10",
|
|
102
|
-
ledger_index: 1,
|
|
103
|
-
date: 1000,
|
|
104
|
-
Account: "account_addr",
|
|
105
|
-
Destination: "destination_addr",
|
|
106
|
-
Sequence: 1,
|
|
107
|
-
},
|
|
108
|
-
},
|
|
109
|
-
]),
|
|
110
|
-
);
|
|
111
|
-
|
|
112
|
-
// When
|
|
113
|
-
const account = await getAccountShape(
|
|
114
|
-
{
|
|
115
|
-
address: "address",
|
|
116
|
-
currency: getCryptoCurrencyById("ripple"),
|
|
117
|
-
derivationMode: "",
|
|
118
|
-
index: 0,
|
|
119
|
-
} as AccountShapeInfo<Account>,
|
|
120
|
-
{} as SyncConfig,
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
// Then
|
|
124
|
-
expect(mockGetAccountInfo).toHaveBeenCalledTimes(1);
|
|
125
|
-
expect(mockGetServerInfos).toHaveBeenCalled();
|
|
126
|
-
expect(mockGetTransactions).toHaveBeenCalledTimes(1);
|
|
127
|
-
expect(account).toEqual({
|
|
128
|
-
id: "js:2:ripple:address:",
|
|
129
|
-
xpub: "address",
|
|
130
|
-
blockHeight: 2,
|
|
131
|
-
operationsCount: 1,
|
|
132
|
-
balance: new BigNumber(0),
|
|
133
|
-
spendableBalance: new BigNumber(0),
|
|
134
|
-
operations: [
|
|
135
|
-
{
|
|
136
|
-
accountId: "js:2:ripple:address:",
|
|
137
|
-
blockHash: "HASH_VALUE_BLOCK",
|
|
138
|
-
blockHeight: 1,
|
|
139
|
-
date: new Date("2000-01-01T00:16:40.000Z"),
|
|
140
|
-
hash: "HASH_VALUE",
|
|
141
|
-
id: "js:2:ripple:address:-HASH_VALUE-IN",
|
|
142
|
-
recipients: ["destination_addr"],
|
|
143
|
-
senders: ["account_addr"],
|
|
144
|
-
transactionSequenceNumber: 1,
|
|
145
|
-
type: "IN",
|
|
146
|
-
value: new BigNumber("100"),
|
|
147
|
-
fee: new BigNumber("10"),
|
|
148
|
-
extra: {},
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
});
|
|
152
|
-
});
|
|
153
|
-
});
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { encodeAccountId } from "@ledgerhq/coin-framework/account/index";
|
|
2
|
-
import { GetAccountShape, mergeOps } from "@ledgerhq/coin-framework/bridge/jsHelpers";
|
|
3
|
-
import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
|
|
4
|
-
import { Operation, OperationType } from "@ledgerhq/types-live";
|
|
5
|
-
import { Operation as CoreOperation } from "@ledgerhq/coin-framework/api/types";
|
|
6
|
-
import BigNumber from "bignumber.js";
|
|
7
|
-
import { listOperations, parseAPIValue } from "../logic";
|
|
8
|
-
import { getAccountInfo, getServerInfos } from "../network";
|
|
9
|
-
import { ServerInfoResponse } from "../network/types";
|
|
10
|
-
import { AccountInfo, XrpAsset } from "../types";
|
|
11
|
-
|
|
12
|
-
export const getAccountShape: GetAccountShape = async info => {
|
|
13
|
-
const { address, initialAccount, currency, derivationMode } = info;
|
|
14
|
-
const accountId = encodeAccountId({
|
|
15
|
-
type: "js",
|
|
16
|
-
version: "2",
|
|
17
|
-
currencyId: currency.id,
|
|
18
|
-
xpubOrAddress: address,
|
|
19
|
-
derivationMode,
|
|
20
|
-
});
|
|
21
|
-
const accountInfo = await getAccountInfo(address);
|
|
22
|
-
|
|
23
|
-
if (accountInfo.isNewAccount) {
|
|
24
|
-
return {
|
|
25
|
-
id: accountId,
|
|
26
|
-
xpub: address,
|
|
27
|
-
blockHeight: 0,
|
|
28
|
-
balance: new BigNumber(0),
|
|
29
|
-
spendableBalance: new BigNumber(0),
|
|
30
|
-
operations: [],
|
|
31
|
-
operationsCount: 0,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const oldOperations = initialAccount?.operations || [];
|
|
36
|
-
const blockHeight = oldOperations.length ? (oldOperations[0].blockHeight || 0) + 1 : 0;
|
|
37
|
-
|
|
38
|
-
const serverInfo = await getServerInfos();
|
|
39
|
-
const ledgers = serverInfo.info.complete_ledgers.split("-");
|
|
40
|
-
const maxLedgerVersion = Number(ledgers[1]);
|
|
41
|
-
|
|
42
|
-
const balance = new BigNumber(accountInfo.balance);
|
|
43
|
-
const spendableBalance = await calculateSpendableBalance(accountInfo, serverInfo);
|
|
44
|
-
|
|
45
|
-
const newOperations = await filterOperations(accountId, address, blockHeight);
|
|
46
|
-
|
|
47
|
-
const operations = mergeOps(oldOperations, newOperations);
|
|
48
|
-
|
|
49
|
-
const shape = {
|
|
50
|
-
id: accountId,
|
|
51
|
-
xpub: address,
|
|
52
|
-
blockHeight: maxLedgerVersion,
|
|
53
|
-
balance,
|
|
54
|
-
spendableBalance,
|
|
55
|
-
operations,
|
|
56
|
-
operationsCount: operations.length,
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return shape;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
async function filterOperations(
|
|
63
|
-
accountId: string,
|
|
64
|
-
address: string,
|
|
65
|
-
blockHeight: number,
|
|
66
|
-
): Promise<Operation[]> {
|
|
67
|
-
const [operations, _] = await listOperations(address, { minHeight: blockHeight });
|
|
68
|
-
|
|
69
|
-
return operations.map(op => adaptCoreOperationToLiveOperation(accountId, op) satisfies Operation);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
function adaptCoreOperationToLiveOperation(
|
|
73
|
-
accountId: string,
|
|
74
|
-
op: CoreOperation<XrpAsset>,
|
|
75
|
-
): Operation {
|
|
76
|
-
return {
|
|
77
|
-
id: encodeOperationId(accountId, op.tx.hash, op.type),
|
|
78
|
-
hash: op.tx.hash,
|
|
79
|
-
accountId,
|
|
80
|
-
type: op.type as OperationType,
|
|
81
|
-
value: new BigNumber(op.value.toString()),
|
|
82
|
-
fee: new BigNumber(op.tx.fees.toString()),
|
|
83
|
-
blockHash: op.tx.block.hash,
|
|
84
|
-
blockHeight: op.tx.block.height,
|
|
85
|
-
senders: op.senders,
|
|
86
|
-
recipients: op.recipients,
|
|
87
|
-
date: op.tx.date,
|
|
88
|
-
transactionSequenceNumber: op.details?.sequence as number,
|
|
89
|
-
extra: {},
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
async function calculateSpendableBalance(
|
|
94
|
-
account: AccountInfo,
|
|
95
|
-
serverInfo: ServerInfoResponse,
|
|
96
|
-
): Promise<BigNumber> {
|
|
97
|
-
const reserveMinXRP = parseAPIValue(serverInfo.info.validated_ledger.reserve_base_xrp.toString());
|
|
98
|
-
const reservePerTrustline = parseAPIValue(
|
|
99
|
-
serverInfo.info.validated_ledger.reserve_inc_xrp.toString(),
|
|
100
|
-
);
|
|
101
|
-
const trustlines = account.ownerCount;
|
|
102
|
-
|
|
103
|
-
const spendableBalance = new BigNumber(account.balance)
|
|
104
|
-
.minus(reserveMinXRP)
|
|
105
|
-
.minus(reservePerTrustline.times(trustlines));
|
|
106
|
-
|
|
107
|
-
return spendableBalance;
|
|
108
|
-
}
|
|
File without changes
|
|
File without changes
|