@ledgerhq/coin-xrp 6.1.3-nightly.1 → 6.2.0-next.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.
Files changed (191) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.unimportedrc.json +3 -1
  3. package/CHANGELOG.md +45 -8
  4. package/jest.config.js +2 -5
  5. package/lib/api/index.d.ts +2 -11
  6. package/lib/api/index.d.ts.map +1 -1
  7. package/lib/api/index.integ.test.js +24 -7
  8. package/lib/api/index.integ.test.js.map +1 -1
  9. package/lib/api/index.js +15 -5
  10. package/lib/api/index.js.map +1 -1
  11. package/lib/api/index.test.js +18 -9
  12. package/lib/api/index.test.js.map +1 -1
  13. package/lib/index.d.ts +0 -1
  14. package/lib/index.d.ts.map +1 -1
  15. package/lib/index.js +0 -3
  16. package/lib/index.js.map +1 -1
  17. package/lib/logic/combine.d.ts.map +1 -1
  18. package/lib/logic/combine.js +8 -3
  19. package/lib/logic/combine.js.map +1 -1
  20. package/lib/logic/getBalance.d.ts.map +1 -1
  21. package/lib/logic/getBalance.js +13 -1
  22. package/lib/logic/getBalance.js.map +1 -1
  23. package/lib/logic/getBalance.test.js +14 -1
  24. package/lib/logic/getBalance.test.js.map +1 -1
  25. package/lib/logic/getTransactionStatus.d.ts +3 -0
  26. package/lib/logic/getTransactionStatus.d.ts.map +1 -0
  27. package/lib/{bridge → logic}/getTransactionStatus.js +15 -19
  28. package/lib/logic/getTransactionStatus.js.map +1 -0
  29. package/lib/logic/getTransactionStatus.test.d.ts +2 -0
  30. package/lib/logic/getTransactionStatus.test.d.ts.map +1 -0
  31. package/lib/logic/getTransactionStatus.test.js +184 -0
  32. package/lib/logic/getTransactionStatus.test.js.map +1 -0
  33. package/lib/logic/index.d.ts +2 -1
  34. package/lib/logic/index.d.ts.map +1 -1
  35. package/lib/logic/index.js +3 -2
  36. package/lib/logic/index.js.map +1 -1
  37. package/lib/logic/utils.d.ts +0 -1
  38. package/lib/logic/utils.d.ts.map +1 -1
  39. package/lib/logic/utils.js +14 -10
  40. package/lib/logic/utils.js.map +1 -1
  41. package/lib/test/bridgeDatasetTest.d.ts.map +1 -1
  42. package/lib/test/bridgeDatasetTest.js +7 -7
  43. package/lib/test/bridgeDatasetTest.js.map +1 -1
  44. package/lib/{bridge/transaction.d.ts → transaction.d.ts} +1 -1
  45. package/lib/transaction.d.ts.map +1 -0
  46. package/lib/transaction.js.map +1 -0
  47. package/lib/types/model.d.ts +7 -0
  48. package/lib/types/model.d.ts.map +1 -1
  49. package/lib-es/api/index.d.ts +2 -11
  50. package/lib-es/api/index.d.ts.map +1 -1
  51. package/lib-es/api/index.integ.test.js +24 -7
  52. package/lib-es/api/index.integ.test.js.map +1 -1
  53. package/lib-es/api/index.js +16 -6
  54. package/lib-es/api/index.js.map +1 -1
  55. package/lib-es/api/index.test.js +18 -9
  56. package/lib-es/api/index.test.js.map +1 -1
  57. package/lib-es/index.d.ts +0 -1
  58. package/lib-es/index.d.ts.map +1 -1
  59. package/lib-es/index.js +0 -1
  60. package/lib-es/index.js.map +1 -1
  61. package/lib-es/logic/combine.d.ts.map +1 -1
  62. package/lib-es/logic/combine.js +8 -3
  63. package/lib-es/logic/combine.js.map +1 -1
  64. package/lib-es/logic/getBalance.d.ts.map +1 -1
  65. package/lib-es/logic/getBalance.js +14 -2
  66. package/lib-es/logic/getBalance.js.map +1 -1
  67. package/lib-es/logic/getBalance.test.js +14 -1
  68. package/lib-es/logic/getBalance.test.js.map +1 -1
  69. package/lib-es/logic/getTransactionStatus.d.ts +3 -0
  70. package/lib-es/logic/getTransactionStatus.d.ts.map +1 -0
  71. package/lib-es/{bridge → logic}/getTransactionStatus.js +13 -14
  72. package/lib-es/logic/getTransactionStatus.js.map +1 -0
  73. package/lib-es/logic/getTransactionStatus.test.d.ts +2 -0
  74. package/lib-es/logic/getTransactionStatus.test.d.ts.map +1 -0
  75. package/lib-es/logic/getTransactionStatus.test.js +159 -0
  76. package/lib-es/logic/getTransactionStatus.test.js.map +1 -0
  77. package/lib-es/logic/index.d.ts +2 -1
  78. package/lib-es/logic/index.d.ts.map +1 -1
  79. package/lib-es/logic/index.js +2 -1
  80. package/lib-es/logic/index.js.map +1 -1
  81. package/lib-es/logic/utils.d.ts +0 -1
  82. package/lib-es/logic/utils.d.ts.map +1 -1
  83. package/lib-es/logic/utils.js +13 -8
  84. package/lib-es/logic/utils.js.map +1 -1
  85. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -1
  86. package/lib-es/test/bridgeDatasetTest.js +7 -7
  87. package/lib-es/test/bridgeDatasetTest.js.map +1 -1
  88. package/lib-es/{bridge/transaction.d.ts → transaction.d.ts} +1 -1
  89. package/lib-es/transaction.d.ts.map +1 -0
  90. package/lib-es/transaction.js.map +1 -0
  91. package/lib-es/types/model.d.ts +7 -0
  92. package/lib-es/types/model.d.ts.map +1 -1
  93. package/package.json +10 -11
  94. package/src/api/index.integ.test.ts +24 -8
  95. package/src/api/index.test.ts +23 -22
  96. package/src/api/index.ts +28 -19
  97. package/src/index.ts +0 -1
  98. package/src/logic/combine.ts +10 -3
  99. package/src/logic/getBalance.test.ts +14 -1
  100. package/src/logic/getBalance.ts +18 -2
  101. package/src/logic/getTransactionStatus.test.ts +215 -0
  102. package/src/{bridge → logic}/getTransactionStatus.ts +18 -21
  103. package/src/logic/index.ts +2 -6
  104. package/src/logic/utils.ts +24 -8
  105. package/src/test/bridgeDatasetTest.ts +8 -7
  106. package/src/{bridge/transaction.ts → transaction.ts} +1 -1
  107. package/src/types/model.ts +11 -0
  108. package/lib/bridge/broadcast.d.ts +0 -4
  109. package/lib/bridge/broadcast.d.ts.map +0 -1
  110. package/lib/bridge/broadcast.js +0 -11
  111. package/lib/bridge/broadcast.js.map +0 -1
  112. package/lib/bridge/createTransaction.d.ts +0 -4
  113. package/lib/bridge/createTransaction.d.ts.map +0 -1
  114. package/lib/bridge/createTransaction.js +0 -18
  115. package/lib/bridge/createTransaction.js.map +0 -1
  116. package/lib/bridge/estimateMaxSpendable.d.ts +0 -4
  117. package/lib/bridge/estimateMaxSpendable.d.ts.map +0 -1
  118. package/lib/bridge/estimateMaxSpendable.js +0 -26
  119. package/lib/bridge/estimateMaxSpendable.js.map +0 -1
  120. package/lib/bridge/getTransactionStatus.d.ts +0 -4
  121. package/lib/bridge/getTransactionStatus.d.ts.map +0 -1
  122. package/lib/bridge/getTransactionStatus.js.map +0 -1
  123. package/lib/bridge/index.d.ts +0 -11
  124. package/lib/bridge/index.d.ts.map +0 -1
  125. package/lib/bridge/index.js +0 -47
  126. package/lib/bridge/index.js.map +0 -1
  127. package/lib/bridge/prepareTransaction.d.ts +0 -4
  128. package/lib/bridge/prepareTransaction.d.ts.map +0 -1
  129. package/lib/bridge/prepareTransaction.js +0 -14
  130. package/lib/bridge/prepareTransaction.js.map +0 -1
  131. package/lib/bridge/signOperation.d.ts +0 -5
  132. package/lib/bridge/signOperation.d.ts.map +0 -1
  133. package/lib/bridge/signOperation.js +0 -76
  134. package/lib/bridge/signOperation.js.map +0 -1
  135. package/lib/bridge/synchronization.d.ts +0 -3
  136. package/lib/bridge/synchronization.d.ts.map +0 -1
  137. package/lib/bridge/synchronization.js +0 -85
  138. package/lib/bridge/synchronization.js.map +0 -1
  139. package/lib/bridge/synchronization.test.d.ts +0 -2
  140. package/lib/bridge/synchronization.test.d.ts.map +0 -1
  141. package/lib/bridge/synchronization.test.js +0 -140
  142. package/lib/bridge/synchronization.test.js.map +0 -1
  143. package/lib/bridge/transaction.d.ts.map +0 -1
  144. package/lib/bridge/transaction.js.map +0 -1
  145. package/lib-es/bridge/broadcast.d.ts +0 -4
  146. package/lib-es/bridge/broadcast.d.ts.map +0 -1
  147. package/lib-es/bridge/broadcast.js +0 -7
  148. package/lib-es/bridge/broadcast.js.map +0 -1
  149. package/lib-es/bridge/createTransaction.d.ts +0 -4
  150. package/lib-es/bridge/createTransaction.d.ts.map +0 -1
  151. package/lib-es/bridge/createTransaction.js +0 -11
  152. package/lib-es/bridge/createTransaction.js.map +0 -1
  153. package/lib-es/bridge/estimateMaxSpendable.d.ts +0 -4
  154. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +0 -1
  155. package/lib-es/bridge/estimateMaxSpendable.js +0 -19
  156. package/lib-es/bridge/estimateMaxSpendable.js.map +0 -1
  157. package/lib-es/bridge/getTransactionStatus.d.ts +0 -4
  158. package/lib-es/bridge/getTransactionStatus.d.ts.map +0 -1
  159. package/lib-es/bridge/getTransactionStatus.js.map +0 -1
  160. package/lib-es/bridge/index.d.ts +0 -11
  161. package/lib-es/bridge/index.d.ts.map +0 -1
  162. package/lib-es/bridge/index.js +0 -41
  163. package/lib-es/bridge/index.js.map +0 -1
  164. package/lib-es/bridge/prepareTransaction.d.ts +0 -4
  165. package/lib-es/bridge/prepareTransaction.d.ts.map +0 -1
  166. package/lib-es/bridge/prepareTransaction.js +0 -10
  167. package/lib-es/bridge/prepareTransaction.js.map +0 -1
  168. package/lib-es/bridge/signOperation.d.ts +0 -5
  169. package/lib-es/bridge/signOperation.d.ts.map +0 -1
  170. package/lib-es/bridge/signOperation.js +0 -72
  171. package/lib-es/bridge/signOperation.js.map +0 -1
  172. package/lib-es/bridge/synchronization.d.ts +0 -3
  173. package/lib-es/bridge/synchronization.d.ts.map +0 -1
  174. package/lib-es/bridge/synchronization.js +0 -78
  175. package/lib-es/bridge/synchronization.js.map +0 -1
  176. package/lib-es/bridge/synchronization.test.d.ts +0 -2
  177. package/lib-es/bridge/synchronization.test.d.ts.map +0 -1
  178. package/lib-es/bridge/synchronization.test.js +0 -135
  179. package/lib-es/bridge/synchronization.test.js.map +0 -1
  180. package/lib-es/bridge/transaction.d.ts.map +0 -1
  181. package/lib-es/bridge/transaction.js.map +0 -1
  182. package/src/bridge/broadcast.ts +0 -11
  183. package/src/bridge/createTransaction.ts +0 -13
  184. package/src/bridge/estimateMaxSpendable.ts +0 -25
  185. package/src/bridge/index.ts +0 -59
  186. package/src/bridge/prepareTransaction.ts +0 -18
  187. package/src/bridge/signOperation.ts +0 -100
  188. package/src/bridge/synchronization.test.ts +0 -153
  189. package/src/bridge/synchronization.ts +0 -108
  190. /package/lib/{bridge/transaction.js → transaction.js} +0 -0
  191. /package/lib-es/{bridge/transaction.js → transaction.js} +0 -0
@@ -1,100 +0,0 @@
1
- import { Observable } from "rxjs";
2
- import { encode } from "ripple-binary-codec";
3
- import { FeeNotLoaded } from "@ledgerhq/errors";
4
- import { AccountBridge, Operation } from "@ledgerhq/types-live";
5
- import { SignerContext } from "@ledgerhq/coin-framework/signer";
6
- import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
7
- import { craftTransaction, getNextValidSequence, removeCachedRecipientIsNew } from "../logic";
8
- import { Transaction, XrpSignature, XrpSigner } from "../types";
9
-
10
- export const buildSignOperation =
11
- (signerContext: SignerContext<XrpSigner>): AccountBridge<Transaction>["signOperation"] =>
12
- ({ account, deviceId, transaction }) =>
13
- new Observable(o => {
14
- removeCachedRecipientIsNew(transaction.recipient);
15
-
16
- async function main() {
17
- const { fee } = transaction;
18
- if (!fee) throw new FeeNotLoaded();
19
-
20
- try {
21
- o.next({
22
- type: "device-signature-requested",
23
- });
24
-
25
- const nextSequenceNumber = await getNextValidSequence(account.freshAddress);
26
-
27
- const signature = await signerContext(deviceId, async signer => {
28
- const { freshAddressPath: derivationPath } = account;
29
- const { publicKey } = await signer.getAddress(derivationPath);
30
-
31
- const { xrplTransaction, serializedTransaction } = await craftTransaction(
32
- {
33
- address: account.freshAddress,
34
- nextSequenceNumber,
35
- },
36
- {
37
- recipient: transaction.recipient,
38
- amount: BigInt(transaction.amount.toString()),
39
- fee: BigInt(fee.toString()),
40
- destinationTag: transaction.tag,
41
- },
42
- publicKey,
43
- );
44
-
45
- const transactionSignature = await signer.signTransaction(
46
- derivationPath,
47
- serializedTransaction,
48
- );
49
-
50
- return encode({
51
- ...xrplTransaction,
52
- SigningPubKey: publicKey,
53
- TxnSignature: transactionSignature,
54
- }).toUpperCase() as XrpSignature;
55
- });
56
-
57
- o.next({
58
- type: "device-signature-granted",
59
- });
60
-
61
- const hash = "";
62
- const operation: Operation = {
63
- id: encodeOperationId(account.id, hash, "OUT"),
64
- hash,
65
- accountId: account.id,
66
- type: "OUT",
67
- value: transaction.amount,
68
- fee,
69
- blockHash: null,
70
- blockHeight: null,
71
- senders: [account.freshAddress],
72
- recipients: [transaction.recipient],
73
- date: new Date(),
74
- transactionSequenceNumber: nextSequenceNumber,
75
- extra: {},
76
- };
77
-
78
- o.next({
79
- type: "signed",
80
- signedOperation: {
81
- operation,
82
- signature,
83
- },
84
- });
85
- } catch (e) {
86
- if (e instanceof Error) {
87
- throw new Error(
88
- (e as Error & { data?: { resultMessage?: string } })?.data?.resultMessage,
89
- );
90
- }
91
-
92
- throw e;
93
- }
94
- }
95
-
96
- main().then(
97
- () => o.complete(),
98
- e => o.error(e),
99
- );
100
- });
@@ -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