@ledgerhq/coin-xrp 7.3.0-nightly.3 → 7.3.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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +20 -23
- package/lib/api/index.integ.test.js +5 -162
- package/lib/api/index.integ.test.js.map +1 -1
- package/lib/api/index.js +52 -13
- package/lib/api/index.js.map +1 -1
- package/lib/api/index.test.js +20 -16
- package/lib/api/index.test.js.map +1 -1
- package/lib/logic/listOperations.js +6 -1
- package/lib/logic/listOperations.js.map +1 -1
- package/lib/logic/listOperations.test.js +3 -2
- package/lib/logic/listOperations.test.js.map +1 -1
- package/lib/types/model.d.ts +2 -1
- package/lib/types/model.d.ts.map +1 -1
- package/lib-es/api/index.integ.test.js +5 -162
- package/lib-es/api/index.integ.test.js.map +1 -1
- package/lib-es/api/index.js +52 -13
- package/lib-es/api/index.js.map +1 -1
- package/lib-es/api/index.test.js +20 -16
- package/lib-es/api/index.test.js.map +1 -1
- package/lib-es/logic/listOperations.js +6 -1
- package/lib-es/logic/listOperations.js.map +1 -1
- package/lib-es/logic/listOperations.test.js +3 -2
- package/lib-es/logic/listOperations.test.js.map +1 -1
- package/lib-es/types/model.d.ts +2 -1
- package/lib-es/types/model.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/api/index.integ.test.ts +5 -187
- package/src/api/index.test.ts +20 -16
- package/src/api/index.ts +68 -13
- package/src/logic/listOperations.test.ts +4 -2
- package/src/logic/listOperations.ts +6 -1
- package/src/types/model.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"listOperations.test.js","sourceRoot":"","sources":["../../src/logic/listOperations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAIvC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;gBACnB,UAAU,EAAE,CAAC,aAAa,CAAC;aAC5B;SACoB,CAAC,CAAC;IAC3B,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
package/lib-es/types/model.d.ts
CHANGED
|
@@ -16,11 +16,12 @@ export type XrpMemoValueMap = {
|
|
|
16
16
|
memos: string[];
|
|
17
17
|
};
|
|
18
18
|
export type XrpMapMemo = TypedMapMemo<XrpMemoValueMap>;
|
|
19
|
-
|
|
19
|
+
type Order = "asc" | "desc";
|
|
20
20
|
export type ListOperationsOptions = {
|
|
21
21
|
limit?: number;
|
|
22
22
|
token?: string;
|
|
23
23
|
order?: Order;
|
|
24
24
|
minHeight?: number;
|
|
25
25
|
};
|
|
26
|
+
export {};
|
|
26
27
|
//# sourceMappingURL=model.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/types/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAEpD,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAEvD,
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/types/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAElE,MAAM,MAAM,WAAW,GAAG;IACxB,YAAY,EAAE,OAAO,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG,MAAM,CAAC;AAEpD,MAAM,MAAM,eAAe,GAAG;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,eAAe,CAAC,CAAC;AAEvD,KAAK,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAE5B,MAAM,MAAM,qBAAqB,GAAG;IAElC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,KAAK,CAAC;IAEd,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-xrp",
|
|
3
|
-
"version": "7.3.0
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "Ledger XRP Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
"invariant": "^2.2.4",
|
|
104
104
|
"ripple-address-codec": "^5.0.0",
|
|
105
105
|
"ripple-binary-codec": "^1.3.0",
|
|
106
|
-
"@ledgerhq/
|
|
107
|
-
"@ledgerhq/
|
|
108
|
-
"@ledgerhq/
|
|
109
|
-
"@ledgerhq/
|
|
110
|
-
"@ledgerhq/
|
|
111
|
-
"@ledgerhq/types-live": "^6.83.0
|
|
106
|
+
"@ledgerhq/coin-framework": "^6.3.0",
|
|
107
|
+
"@ledgerhq/cryptoassets": "^13.27.0",
|
|
108
|
+
"@ledgerhq/devices": "8.5.1",
|
|
109
|
+
"@ledgerhq/errors": "^6.25.0",
|
|
110
|
+
"@ledgerhq/live-network": "^2.0.16",
|
|
111
|
+
"@ledgerhq/types-live": "^6.83.0",
|
|
112
112
|
"@ledgerhq/logs": "^6.13.0"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"ts-jest": "^29.1.1",
|
|
123
123
|
"typescript": "^5.4.5",
|
|
124
124
|
"@ledgerhq/disable-network-setup": "^0.0.0",
|
|
125
|
-
"@ledgerhq/types-cryptoassets": "^7.26.0
|
|
125
|
+
"@ledgerhq/types-cryptoassets": "^7.26.0"
|
|
126
126
|
},
|
|
127
127
|
"scripts": {
|
|
128
128
|
"clean": "rimraf lib lib-es",
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { decode } from "ripple-binary-codec";
|
|
2
2
|
import { createApi } from ".";
|
|
3
|
-
import { Operation } from "@ledgerhq/coin-framework/api/types";
|
|
4
3
|
//import { decode, encodeForSigning } from "ripple-binary-codec";
|
|
5
4
|
//import { sign } from "ripple-keypairs";
|
|
6
5
|
|
|
7
|
-
describe("Xrp Api
|
|
6
|
+
describe("Xrp Api", () => {
|
|
8
7
|
const SENDER = "rh1HPuRVsYYvThxG2Bs1MfjmrVC73S16Fb";
|
|
9
8
|
const api = createApi({ node: "https://s.altnet.rippletest.net:51234" });
|
|
10
9
|
|
|
@@ -34,7 +33,7 @@ describe("Xrp Api (testnet)", () => {
|
|
|
34
33
|
describe("listOperations", () => {
|
|
35
34
|
it.skip("returns a list regarding address parameter", async () => {
|
|
36
35
|
// When
|
|
37
|
-
const [tx, _] = await api.listOperations(SENDER, { minHeight: 200
|
|
36
|
+
const [tx, _] = await api.listOperations(SENDER, { minHeight: 200 });
|
|
38
37
|
|
|
39
38
|
// https://blockexplorer.one/xrp/testnet/address/rh1HPuRVsYYvThxG2Bs1MfjmrVC73S16Fb
|
|
40
39
|
// as of 2025-03-18, the address has 287 transactions
|
|
@@ -52,10 +51,7 @@ describe("Xrp Api (testnet)", () => {
|
|
|
52
51
|
const SENDER_WITH_TRANSACTIONS = "rUxSkt6hQpWxXQwTNRUCYYRQ7BC2yRA3F8";
|
|
53
52
|
|
|
54
53
|
// When
|
|
55
|
-
const [ops, _] = await api.listOperations(SENDER_WITH_TRANSACTIONS, {
|
|
56
|
-
minHeight: 0,
|
|
57
|
-
order: "asc",
|
|
58
|
-
});
|
|
54
|
+
const [ops, _] = await api.listOperations(SENDER_WITH_TRANSACTIONS, { minHeight: 0 });
|
|
59
55
|
// Then
|
|
60
56
|
const checkSet = new Set(ops.map(elt => elt.tx.hash));
|
|
61
57
|
expect(checkSet.size).toEqual(ops.length);
|
|
@@ -68,21 +64,6 @@ describe("Xrp Api (testnet)", () => {
|
|
|
68
64
|
// so here we are checking that this limit is bypassed
|
|
69
65
|
expect(ops.length).toBeGreaterThan(200);
|
|
70
66
|
});
|
|
71
|
-
|
|
72
|
-
it("returns operations from latest, but in asc order", async () => {
|
|
73
|
-
// When
|
|
74
|
-
const SENDER_WITH_TRANSACTIONS = "rUxSkt6hQpWxXQwTNRUCYYRQ7BC2yRA3F8";
|
|
75
|
-
const [txDesc] = await api.listOperations(SENDER_WITH_TRANSACTIONS, {
|
|
76
|
-
minHeight: 200,
|
|
77
|
-
order: "desc",
|
|
78
|
-
});
|
|
79
|
-
expect(txDesc.length).toBeGreaterThanOrEqual(200);
|
|
80
|
-
// Then
|
|
81
|
-
// Check if the result is sorted in ascending order
|
|
82
|
-
expect(txDesc[0].tx.block.height).toBeGreaterThanOrEqual(
|
|
83
|
-
txDesc[txDesc.length - 1].tx.block.height,
|
|
84
|
-
);
|
|
85
|
-
});
|
|
86
67
|
});
|
|
87
68
|
|
|
88
69
|
describe("lastBlock", () => {
|
|
@@ -101,13 +82,13 @@ describe("Xrp Api (testnet)", () => {
|
|
|
101
82
|
// Account with no transaction (at the time of this writing)
|
|
102
83
|
const SENDER_WITH_NO_TRANSACTION = "rKtXXTVno77jhu6tto1MAXjepyuaKaLcqB";
|
|
103
84
|
|
|
104
|
-
it("returns
|
|
85
|
+
it("returns an amount above 0 when address has transactions", async () => {
|
|
105
86
|
// When
|
|
106
87
|
const result = await api.getBalance(SENDER);
|
|
107
88
|
|
|
108
89
|
// Then
|
|
109
90
|
expect(result[0].asset).toEqual({ type: "native" });
|
|
110
|
-
expect(result[0].value).
|
|
91
|
+
expect(result[0].value).toBeGreaterThan(BigInt(0));
|
|
111
92
|
});
|
|
112
93
|
|
|
113
94
|
it("returns 0 when address has no transaction", async () => {
|
|
@@ -181,169 +162,6 @@ describe("Xrp Api (testnet)", () => {
|
|
|
181
162
|
});
|
|
182
163
|
});
|
|
183
164
|
|
|
184
|
-
describe("Xrp Api (mainnet)", () => {
|
|
185
|
-
const SENDER = "rn5BQvhksnPfbo277LtFks4iyYStPKGrnJ";
|
|
186
|
-
const api = createApi({ node: "https://xrp.coin.ledger.com" });
|
|
187
|
-
|
|
188
|
-
describe("estimateFees", () => {
|
|
189
|
-
it("returns a default value", async () => {
|
|
190
|
-
// Given
|
|
191
|
-
const amount = BigInt(100);
|
|
192
|
-
|
|
193
|
-
// When
|
|
194
|
-
const result = await api.estimateFees({
|
|
195
|
-
asset: { type: "native" },
|
|
196
|
-
type: "send",
|
|
197
|
-
sender: SENDER,
|
|
198
|
-
amount,
|
|
199
|
-
recipient: "r9m6MwViR4GnUNqoGXGa8eroBrZ9FAPHFS",
|
|
200
|
-
memo: {
|
|
201
|
-
type: "map",
|
|
202
|
-
memos: new Map(),
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
// Then
|
|
207
|
-
expect(result.value).toEqual(BigInt(10));
|
|
208
|
-
});
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
describe("listOperations", () => {
|
|
212
|
-
let ops: Operation[];
|
|
213
|
-
|
|
214
|
-
beforeAll(async () => {
|
|
215
|
-
const resp = await api.listOperations(SENDER, { minHeight: 0 });
|
|
216
|
-
ops = resp[0];
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
it("returns operations", async () => {
|
|
220
|
-
// https://xrpscan.com/account/rn5BQvhksnPfbo277LtFks4iyYStPKGrnJ
|
|
221
|
-
expect(ops.length).toBeGreaterThanOrEqual(200);
|
|
222
|
-
const checkSet = new Set(ops.map(elt => elt.tx.hash));
|
|
223
|
-
expect(checkSet.size).toEqual(ops.length);
|
|
224
|
-
ops.forEach(operation => {
|
|
225
|
-
const isSenderOrReceipt =
|
|
226
|
-
operation.senders.includes(SENDER) || operation.recipients.includes(SENDER);
|
|
227
|
-
expect(isSenderOrReceipt).toBeTruthy();
|
|
228
|
-
});
|
|
229
|
-
});
|
|
230
|
-
|
|
231
|
-
it("returns IN operation", async () => {
|
|
232
|
-
// https://xrpscan.com/tx/805E371FDA0223E8910F831802EE93DBA1A4CA40AC8C1337F26F566CD67788F5
|
|
233
|
-
const inTx = {
|
|
234
|
-
hash: "9E5141DCAE8158E51ED612333FF3EC2D60A3D2DCD2F6DD5E4F92E4A6704C3CE9",
|
|
235
|
-
amount: 7.5,
|
|
236
|
-
recipient: SENDER,
|
|
237
|
-
sender: "rnXQmrXk9HSKdNwkut1k9dpAMVYuBsJV49",
|
|
238
|
-
type: "IN",
|
|
239
|
-
fees: 0.00001,
|
|
240
|
-
};
|
|
241
|
-
const op = ops.find(o => o.tx.hash === inTx.hash) as Operation;
|
|
242
|
-
expect(op.tx.hash).toEqual(inTx.hash);
|
|
243
|
-
expect(op.value).toEqual(BigInt(inTx.amount * 1e6));
|
|
244
|
-
expect(op.recipients).toContain(inTx.recipient);
|
|
245
|
-
expect(op.senders).toContain(inTx.sender);
|
|
246
|
-
expect(op.type).toEqual(inTx.type);
|
|
247
|
-
expect(op.tx.fees).toEqual(BigInt(inTx.fees * 1e6));
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
it("returns OUT operation", async () => {
|
|
251
|
-
// https://xrpscan.com/tx/8D13FD7EE0D28B615905903D033A3DC3839FBAA2F545417E3DE51A1A745C1688
|
|
252
|
-
const outTx = {
|
|
253
|
-
hash: "8D13FD7EE0D28B615905903D033A3DC3839FBAA2F545417E3DE51A1A745C1688",
|
|
254
|
-
amount: 0.1,
|
|
255
|
-
recipient: "r3XzsqzQCC6r4ZzifWnwa32sFR2H9exkew",
|
|
256
|
-
sender: SENDER,
|
|
257
|
-
type: "OUT",
|
|
258
|
-
fees: 0.00001,
|
|
259
|
-
};
|
|
260
|
-
const op = ops.find(o => o.tx.hash === outTx.hash) as Operation;
|
|
261
|
-
expect(op.tx.hash).toEqual(outTx.hash);
|
|
262
|
-
expect(op.value).toEqual(BigInt(outTx.amount * 1e6));
|
|
263
|
-
expect(op.recipients).toContain(outTx.recipient);
|
|
264
|
-
expect(op.senders).toContain(outTx.sender);
|
|
265
|
-
expect(op.type).toEqual(outTx.type);
|
|
266
|
-
expect(op.tx.fees).toEqual(BigInt(outTx.fees * 1e6));
|
|
267
|
-
});
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
describe("lastBlock", () => {
|
|
271
|
-
it("returns last block info", async () => {
|
|
272
|
-
const result = await api.lastBlock();
|
|
273
|
-
expect(result.hash).toBeDefined();
|
|
274
|
-
expect(result.height).toBeDefined();
|
|
275
|
-
expect(result.time).toBeInstanceOf(Date);
|
|
276
|
-
});
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
describe("getBalance", () => {
|
|
280
|
-
it("returns an amount", async () => {
|
|
281
|
-
const result = await api.getBalance(SENDER);
|
|
282
|
-
expect(result[0].asset).toEqual({ type: "native" });
|
|
283
|
-
expect(result[0].value).toBeGreaterThanOrEqual(BigInt(0));
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
|
|
287
|
-
describe("craftTransaction", () => {
|
|
288
|
-
const RECIPIENT = "r9m6MwViR4GnUNqoGXGa8eroBrZ9FAPHFS";
|
|
289
|
-
|
|
290
|
-
it("returns a raw transaction", async () => {
|
|
291
|
-
const result = await api.craftTransaction({
|
|
292
|
-
asset: { type: "native" },
|
|
293
|
-
type: "send",
|
|
294
|
-
sender: SENDER,
|
|
295
|
-
recipient: RECIPIENT,
|
|
296
|
-
amount: BigInt(10),
|
|
297
|
-
memo: {
|
|
298
|
-
type: "map",
|
|
299
|
-
memos: new Map([["memos", ["testdata"]]]),
|
|
300
|
-
},
|
|
301
|
-
});
|
|
302
|
-
expect(result.length).toEqual(178);
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
it("should use default fees when user does not provide them for crafting a transaction", async () => {
|
|
306
|
-
const result = await api.craftTransaction({
|
|
307
|
-
asset: { type: "native" },
|
|
308
|
-
type: "send",
|
|
309
|
-
sender: SENDER,
|
|
310
|
-
recipient: RECIPIENT,
|
|
311
|
-
amount: BigInt(10),
|
|
312
|
-
memo: {
|
|
313
|
-
type: "map",
|
|
314
|
-
memos: new Map(),
|
|
315
|
-
},
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
expect(decode(result)).toMatchObject({
|
|
319
|
-
Fee: "10",
|
|
320
|
-
});
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
it("should use custom user fees when user provides it for crafting a transaction", async () => {
|
|
324
|
-
const customFees = 99n;
|
|
325
|
-
const result = await api.craftTransaction(
|
|
326
|
-
{
|
|
327
|
-
asset: { type: "native" },
|
|
328
|
-
type: "send",
|
|
329
|
-
sender: SENDER,
|
|
330
|
-
recipient: RECIPIENT,
|
|
331
|
-
amount: BigInt(10),
|
|
332
|
-
memo: {
|
|
333
|
-
type: "map",
|
|
334
|
-
memos: new Map(),
|
|
335
|
-
},
|
|
336
|
-
},
|
|
337
|
-
{ value: customFees },
|
|
338
|
-
);
|
|
339
|
-
|
|
340
|
-
expect(decode(result)).toMatchObject({
|
|
341
|
-
Fee: customFees.toString(),
|
|
342
|
-
});
|
|
343
|
-
});
|
|
344
|
-
});
|
|
345
|
-
});
|
|
346
|
-
|
|
347
165
|
// To enable this test, you need to fill an `.env` file at the root of this package. Example can be found in `.env.integ.test.example`.
|
|
348
166
|
// The value hardcoded here depends on the value filled in the `.env` file.
|
|
349
167
|
/*describe.skip("combine", () => {
|
package/src/api/index.test.ts
CHANGED
|
@@ -106,13 +106,14 @@ describe("listOperations", () => {
|
|
|
106
106
|
const txs = givenTxs(BigInt(10), BigInt(10), "src", "dest");
|
|
107
107
|
// each time it's called it returns a marker, so in theory it would loop forever
|
|
108
108
|
mockGetTransactions.mockResolvedValue(mockNetworkTxs(txs, defaultMarker));
|
|
109
|
-
const [results, _] = await api.listOperations("src", { minHeight: 0
|
|
109
|
+
const [results, _] = await api.listOperations("src", { minHeight: 0 });
|
|
110
110
|
|
|
111
|
-
// called
|
|
112
|
-
|
|
113
|
-
expect(
|
|
111
|
+
// called 10 times because there is a hard limit of 10 iterations in case something goes wrong
|
|
112
|
+
// with interpretation of the token (bug / explorer api changed ...)
|
|
113
|
+
expect(mockGetServerInfos).toHaveBeenCalledTimes(10);
|
|
114
|
+
expect(mockGetTransactions).toHaveBeenCalledTimes(10);
|
|
114
115
|
|
|
115
|
-
expect(results.length).toBe(txs.length);
|
|
116
|
+
expect(results.length).toBe(txs.length * 10);
|
|
116
117
|
});
|
|
117
118
|
|
|
118
119
|
it("should pass the token returned by previous calls", async () => {
|
|
@@ -121,10 +122,11 @@ describe("listOperations", () => {
|
|
|
121
122
|
.mockReturnValueOnce(mockNetworkTxs(txs, defaultMarker))
|
|
122
123
|
.mockReturnValueOnce(mockNetworkTxs(txs, undefined));
|
|
123
124
|
|
|
124
|
-
const [results,
|
|
125
|
+
const [results, _] = await api.listOperations("src", { minHeight: 0 });
|
|
125
126
|
|
|
126
|
-
|
|
127
|
-
expect(
|
|
127
|
+
// called 2 times because the second time there is no marker
|
|
128
|
+
expect(mockGetServerInfos).toHaveBeenCalledTimes(2);
|
|
129
|
+
expect(mockGetTransactions).toHaveBeenCalledTimes(2);
|
|
128
130
|
|
|
129
131
|
// check tokens are passed
|
|
130
132
|
const baseOptions = {
|
|
@@ -133,14 +135,13 @@ describe("listOperations", () => {
|
|
|
133
135
|
forward: true,
|
|
134
136
|
};
|
|
135
137
|
expect(mockGetTransactions).toHaveBeenNthCalledWith(1, "src", baseOptions);
|
|
136
|
-
await api.listOperations("src", { minHeight: 0, order: "asc", lastPagingToken: token });
|
|
137
138
|
const optionsWithToken = {
|
|
138
139
|
...baseOptions,
|
|
139
140
|
marker: defaultMarker,
|
|
140
141
|
};
|
|
141
142
|
expect(mockGetTransactions).toHaveBeenNthCalledWith(2, "src", optionsWithToken);
|
|
142
143
|
|
|
143
|
-
expect(results.length).toBe(txs.length);
|
|
144
|
+
expect(results.length).toBe(txs.length * 2);
|
|
144
145
|
});
|
|
145
146
|
|
|
146
147
|
it.each([
|
|
@@ -170,12 +171,15 @@ describe("listOperations", () => {
|
|
|
170
171
|
mockGetTransactions.mockResolvedValue(mockNetworkTxs([], undefined));
|
|
171
172
|
|
|
172
173
|
// When
|
|
173
|
-
const [results, _] = await api.listOperations(address, { minHeight: 0
|
|
174
|
+
const [results, _] = await api.listOperations(address, { minHeight: 0 });
|
|
174
175
|
|
|
175
176
|
// Then
|
|
176
|
-
|
|
177
|
-
expect(
|
|
177
|
+
// called twice because the marker is set the first time
|
|
178
|
+
expect(mockGetServerInfos).toHaveBeenCalledTimes(2);
|
|
179
|
+
expect(mockGetTransactions).toHaveBeenCalledTimes(2);
|
|
178
180
|
|
|
181
|
+
// if expectedType is "OUT", compute value with fees (i.e. delivered_amount + Fee)
|
|
182
|
+
const expectedValue = expectedType === "IN" ? deliveredAmount : deliveredAmount + fee;
|
|
179
183
|
// the order is reversed so that the result is always sorted by newest tx first element of the list
|
|
180
184
|
expect(results).toEqual([
|
|
181
185
|
{
|
|
@@ -192,7 +196,7 @@ describe("listOperations", () => {
|
|
|
192
196
|
},
|
|
193
197
|
},
|
|
194
198
|
type: expectedType,
|
|
195
|
-
value:
|
|
199
|
+
value: expectedValue,
|
|
196
200
|
senders: [opSender],
|
|
197
201
|
recipients: [opDestination],
|
|
198
202
|
details: {
|
|
@@ -220,7 +224,7 @@ describe("listOperations", () => {
|
|
|
220
224
|
},
|
|
221
225
|
},
|
|
222
226
|
type: expectedType,
|
|
223
|
-
value:
|
|
227
|
+
value: expectedValue,
|
|
224
228
|
senders: [opSender],
|
|
225
229
|
recipients: [opDestination],
|
|
226
230
|
details: {
|
|
@@ -243,7 +247,7 @@ describe("listOperations", () => {
|
|
|
243
247
|
},
|
|
244
248
|
},
|
|
245
249
|
type: expectedType,
|
|
246
|
-
value:
|
|
250
|
+
value: expectedValue,
|
|
247
251
|
senders: [opSender],
|
|
248
252
|
recipients: [opDestination],
|
|
249
253
|
details: {
|
package/src/api/index.ts
CHANGED
|
@@ -102,20 +102,75 @@ async function estimate(): Promise<FeeEstimation> {
|
|
|
102
102
|
return { value: estimation.fees };
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
type PaginationState = {
|
|
106
|
+
readonly pageSize: number; // must be large enough to avoid unnecessary calls to the underlying explorer
|
|
107
|
+
readonly maxIterations: number; // a security to avoid infinite loop
|
|
108
|
+
currentIteration: number;
|
|
109
|
+
readonly minHeight: number;
|
|
110
|
+
continueIterations: boolean;
|
|
111
|
+
apiNextCursor?: string;
|
|
112
|
+
accumulator: Operation[];
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
async function operationsFromHeight(
|
|
116
|
+
address: string,
|
|
117
|
+
minHeight: number,
|
|
118
|
+
): Promise<[Operation[], string]> {
|
|
119
|
+
async function fetchNextPage(state: PaginationState): Promise<PaginationState> {
|
|
120
|
+
const options: ListOperationsOptions = {
|
|
121
|
+
limit: state.pageSize,
|
|
122
|
+
minHeight: state.minHeight,
|
|
123
|
+
order: "asc",
|
|
124
|
+
};
|
|
125
|
+
if (state.apiNextCursor) {
|
|
126
|
+
options.token = state.apiNextCursor;
|
|
127
|
+
}
|
|
128
|
+
const [operations, apiNextCursor] = await listOperations(address, options);
|
|
129
|
+
const newCurrentIteration = state.currentIteration + 1;
|
|
130
|
+
let continueIteration = true;
|
|
131
|
+
if (apiNextCursor === "") {
|
|
132
|
+
continueIteration = false;
|
|
133
|
+
} else if (newCurrentIteration >= state.maxIterations) {
|
|
134
|
+
log("coin:xrp", "(api/operations): max iterations reached", state.maxIterations);
|
|
135
|
+
continueIteration = false;
|
|
136
|
+
}
|
|
137
|
+
const accumulated = state.accumulator.concat(operations);
|
|
138
|
+
return {
|
|
139
|
+
...state,
|
|
140
|
+
currentIteration: newCurrentIteration,
|
|
141
|
+
continueIterations: continueIteration,
|
|
142
|
+
apiNextCursor: apiNextCursor,
|
|
143
|
+
accumulator: accumulated,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const firstState: PaginationState = {
|
|
148
|
+
pageSize: 200,
|
|
149
|
+
maxIterations: 10,
|
|
150
|
+
currentIteration: 0,
|
|
110
151
|
minHeight: minHeight,
|
|
111
|
-
|
|
152
|
+
continueIterations: true,
|
|
153
|
+
accumulator: [],
|
|
112
154
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
155
|
+
|
|
156
|
+
let state = await fetchNextPage(firstState);
|
|
157
|
+
while (state.continueIterations) {
|
|
158
|
+
state = await fetchNextPage(state);
|
|
117
159
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
160
|
+
return [state.accumulator, state.apiNextCursor ?? ""];
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// NOTE: double check
|
|
164
|
+
async function operations(address: string, pagination: Pagination): Promise<[Operation[], string]> {
|
|
165
|
+
const { minHeight, lastPagingToken } = pagination;
|
|
166
|
+
if (minHeight) {
|
|
167
|
+
return await operationsFromHeight(address, minHeight);
|
|
168
|
+
}
|
|
169
|
+
const isInitSync = lastPagingToken === "";
|
|
170
|
+
|
|
171
|
+
const newPagination = {
|
|
172
|
+
minHeight: isInitSync ? 0 : parseInt(lastPagingToken || "0", 10),
|
|
173
|
+
};
|
|
174
|
+
// TODO token must be implemented properly (waiting ack from the design document)
|
|
175
|
+
return await operationsFromHeight(address, newPagination.minHeight);
|
|
121
176
|
}
|
|
@@ -41,7 +41,7 @@ describe("listOperations", () => {
|
|
|
41
41
|
// Given
|
|
42
42
|
mockNetworkGetTransactions.mockResolvedValue(mockNetworkTxs([]));
|
|
43
43
|
// When
|
|
44
|
-
const [results, token] = await listOperations("any address", { minHeight: 0
|
|
44
|
+
const [results, token] = await listOperations("any address", { minHeight: 0 });
|
|
45
45
|
// Then
|
|
46
46
|
expect(mockGetServerInfos).toHaveBeenCalledTimes(1);
|
|
47
47
|
expect(mockNetworkGetTransactions).toHaveBeenCalledTimes(1);
|
|
@@ -215,7 +215,9 @@ describe("listOperations", () => {
|
|
|
215
215
|
// Then
|
|
216
216
|
expect(mockGetServerInfos).toHaveBeenCalledTimes(1);
|
|
217
217
|
expect(mockNetworkGetTransactions).toHaveBeenCalledTimes(1);
|
|
218
|
-
|
|
218
|
+
// if expectedType is "OUT", compute value with fees (i.e. delivered_amount + Fee)
|
|
219
|
+
const expectedValue =
|
|
220
|
+
expectedType === "IN" ? BigInt(deliveredAmount) : BigInt(deliveredAmount + fees);
|
|
219
221
|
expect(results).toEqual([
|
|
220
222
|
{
|
|
221
223
|
id: "HASH_VALUE",
|
|
@@ -120,12 +120,17 @@ const convertToCoreOperation =
|
|
|
120
120
|
} = operation;
|
|
121
121
|
|
|
122
122
|
const type = Account === address ? "OUT" : "IN";
|
|
123
|
-
|
|
123
|
+
let value =
|
|
124
124
|
delivered_amount && typeof delivered_amount === "string"
|
|
125
125
|
? BigInt(delivered_amount)
|
|
126
126
|
: BigInt(0);
|
|
127
127
|
|
|
128
128
|
const fees = BigInt(Fee);
|
|
129
|
+
if (type === "OUT") {
|
|
130
|
+
if (!Number.isNaN(fees)) {
|
|
131
|
+
value = value + fees;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
129
134
|
|
|
130
135
|
const toEpochDate = (RIPPLE_EPOCH + date) * 1000;
|
|
131
136
|
|
package/src/types/model.ts
CHANGED