@ledgerhq/coin-evm 0.2.0 → 0.2.1-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 (39) hide show
  1. package/.eslintrc.js +11 -46
  2. package/CHANGELOG.md +16 -0
  3. package/package.json +12 -21
  4. package/src/__tests__/adapters.unit.test.ts +22 -52
  5. package/src/__tests__/broadcast.unit.test.ts +8 -26
  6. package/src/__tests__/buildOptimisticOperation.unit.test.ts +4 -4
  7. package/src/__tests__/deviceTransactionConfig.unit.test.ts +7 -7
  8. package/src/__tests__/estimateMaxSpendable.unit.test.ts +1 -3
  9. package/src/__tests__/getTransactionStatus.unit.test.ts +35 -40
  10. package/src/__tests__/hw-getAddress.unit.test.ts +1 -1
  11. package/src/__tests__/logic.unit.test.ts +24 -71
  12. package/src/__tests__/preload.unit.test.ts +3 -9
  13. package/src/__tests__/prepareTransaction.unit.test.ts +34 -73
  14. package/src/__tests__/rpc.unit.test.ts +45 -79
  15. package/src/__tests__/signOperation.unit.test.ts +9 -11
  16. package/src/__tests__/synchronization.unit.test.ts +96 -148
  17. package/src/__tests__/transaction.unit.test.ts +5 -13
  18. package/src/adapters.ts +8 -18
  19. package/src/api/etherscan.ts +12 -27
  20. package/src/api/rpc.common.ts +35 -58
  21. package/src/bridge/js.ts +5 -10
  22. package/src/bridge.integration.test.ts +3 -10
  23. package/src/broadcast.ts +3 -7
  24. package/src/buildOptimisticOperation.ts +7 -17
  25. package/src/cli-transaction.ts +1 -4
  26. package/src/createTransaction.ts +14 -15
  27. package/src/deviceTransactionConfig.ts +1 -1
  28. package/src/estimateMaxSpendable.ts +14 -11
  29. package/src/getTransactionStatus.ts +41 -52
  30. package/src/hw-getAddress.ts +1 -5
  31. package/src/logic.ts +4 -14
  32. package/src/preload.ts +6 -16
  33. package/src/prepareTransaction.ts +12 -30
  34. package/src/signOperation.ts +15 -28
  35. package/src/specs.ts +27 -52
  36. package/src/speculos-deviceActions.ts +56 -65
  37. package/src/synchronization.ts +19 -43
  38. package/src/testUtils.ts +5 -19
  39. package/src/transaction.ts +6 -10
package/.eslintrc.js CHANGED
@@ -1,57 +1,22 @@
1
1
  module.exports = {
2
- parser: "@typescript-eslint/parser",
3
2
  env: {
4
3
  browser: true,
5
4
  es6: true,
6
- node: true,
7
- jest: true,
8
5
  },
9
- extends: [
10
- "eslint:recommended",
11
- "plugin:@typescript-eslint/eslint-recommended",
12
- "plugin:@typescript-eslint/recommended",
13
- "prettier",
6
+ overrides: [
7
+ {
8
+ files: ["src/**/*.test.{ts,tsx}"],
9
+ env: {
10
+ "jest/globals": true,
11
+ },
12
+ plugins: ["jest"],
13
+ rules: {
14
+ "@typescript-eslint/no-non-null-assertion": "off",
15
+ },
16
+ },
14
17
  ],
15
- globals: {
16
- Atomics: "readonly",
17
- SharedArrayBuffer: "readonly",
18
- },
19
- plugins: ["@typescript-eslint", "prettier"],
20
18
  rules: {
21
19
  "no-console": ["error", { allow: ["warn", "error"] }],
22
- "linebreak-style": ["error", "unix"],
23
- semi: ["error", "always"],
24
- "no-unused-vars": "off",
25
- "import/prefer-default-export": 0,
26
- "no-plusplus": 0,
27
- "no-underscore-dangle": 0,
28
- "prefer-template": 0,
29
- "no-await-in-loop": 0,
30
- "no-restricted-syntax": 0,
31
- "consistent-return": 0,
32
- "no-lonely-if": 0,
33
- "no-use-before-define": 0,
34
- "no-nested-ternary": 0,
35
- "import/no-cycle": 0,
36
- "no-multi-assign": 0,
37
- "guard-for-in": 0,
38
- "no-continue": 0,
39
- "lines-between-class-members": 0,
40
- "prefer-destructuring": 0,
41
- "prettier/prettier": "error",
42
- "@typescript-eslint/no-use-before-define": "off",
43
- "@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
44
20
  "@typescript-eslint/no-empty-function": "off",
45
- "@typescript-eslint/no-namespace": ["error", { allowDeclarations: true }],
46
- "@typescript-eslint/no-explicit-any": 0,
47
- "@typescript-eslint/ban-types": [
48
- "error",
49
- {
50
- extendDefaults: true,
51
- types: {
52
- "{}": false,
53
- },
54
- },
55
- ],
56
21
  },
57
22
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @ledgerhq/coin-evm
2
2
 
3
+ ## 0.2.1-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`9adc1862dd`](https://github.com/LedgerHQ/ledger-live/commit/9adc1862dda605a722d19f3b6895bd324834c914), [`4a1454beb3`](https://github.com/LedgerHQ/ledger-live/commit/4a1454beb3f86405ba2686e07879c12a7d35ad8e), [`809065c571`](https://github.com/LedgerHQ/ledger-live/commit/809065c57198646a49adea112b9d799e35a57d25), [`d1aa522db7`](https://github.com/LedgerHQ/ledger-live/commit/d1aa522db75f7ea850efe412abaa4dc7d37af6b7), [`ebe5b07afe`](https://github.com/LedgerHQ/ledger-live/commit/ebe5b07afec441ea3e2d9103da9e1175972add47)]:
8
+ - @ledgerhq/errors@6.12.7-next.0
9
+ - @ledgerhq/cryptoassets@9.8.0-next.0
10
+ - @ledgerhq/types-cryptoassets@7.2.1-next.0
11
+ - @ledgerhq/types-live@6.35.1-next.0
12
+ - @ledgerhq/coin-framework@0.3.6-next.0
13
+ - @ledgerhq/domain-service@1.1.4-next.0
14
+ - @ledgerhq/devices@8.0.4-next.0
15
+ - @ledgerhq/hw-app-eth@6.33.6-next.0
16
+ - @ledgerhq/live-network@1.1.1-next.0
17
+ - @ledgerhq/live-portfolio@0.0.8-next.0
18
+
3
19
  ## 0.2.0
4
20
 
5
21
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ledgerhq/coin-evm",
3
- "version": "0.2.0",
3
+ "version": "0.2.1-next.0",
4
4
  "description": "Ledger EVM Coin integration",
5
5
  "keywords": [
6
6
  "Ledger",
@@ -59,34 +59,25 @@
59
59
  "lodash": "^4.17.21",
60
60
  "react-native-get-random-values": "^1.8.0",
61
61
  "rxjs": "^6.6.7",
62
- "@ledgerhq/coin-framework": "^0.3.5",
63
- "@ledgerhq/cryptoassets": "^9.7.0",
64
- "@ledgerhq/devices": "^8.0.3",
65
- "@ledgerhq/domain-service": "^1.1.3",
66
- "@ledgerhq/errors": "^6.12.6",
67
- "@ledgerhq/hw-app-eth": "^6.33.5",
62
+ "@ledgerhq/coin-framework": "^0.3.6-next.0",
63
+ "@ledgerhq/cryptoassets": "^9.8.0-next.0",
64
+ "@ledgerhq/devices": "^8.0.4-next.0",
65
+ "@ledgerhq/domain-service": "^1.1.4-next.0",
66
+ "@ledgerhq/errors": "^6.12.7-next.0",
67
+ "@ledgerhq/hw-app-eth": "^6.33.6-next.0",
68
68
  "@ledgerhq/live-env": "^0.3.0",
69
- "@ledgerhq/live-network": "^1.1.0",
70
- "@ledgerhq/live-portfolio": "^0.0.7",
69
+ "@ledgerhq/live-network": "^1.1.1-next.0",
70
+ "@ledgerhq/live-portfolio": "^0.0.8-next.0",
71
71
  "@ledgerhq/live-promise": "^0.0.1",
72
72
  "@ledgerhq/logs": "^6.10.1",
73
- "@ledgerhq/types-cryptoassets": "^7.2.0",
74
- "@ledgerhq/types-live": "^6.35.0"
73
+ "@ledgerhq/types-cryptoassets": "^7.2.1-next.0",
74
+ "@ledgerhq/types-live": "^6.35.1-next.0"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@types/invariant": "^2.2.2",
78
78
  "@types/jest": "^29.2.4",
79
79
  "@types/lodash": "^4.14.191",
80
- "@typescript-eslint/eslint-plugin": "^5.46.1",
81
- "@typescript-eslint/parser": "^5.46.1",
82
- "eslint": "^7.32.0",
83
- "eslint-config-prettier": "^8.3.0",
84
- "eslint-config-typescript": "^3.0.0",
85
- "eslint-formatter-pretty": "^3.0.1",
86
- "eslint-plugin-prettier": "^3.4.0",
87
- "eslint-plugin-typescript": "^0.14.0",
88
80
  "jest": "^28.1.1",
89
- "prettier": "^2.8.1",
90
81
  "ts-jest": "^28.0.5"
91
82
  },
92
83
  "scripts": {
@@ -95,7 +86,7 @@
95
86
  "prewatch": "pnpm build",
96
87
  "watch": "tsc --watch",
97
88
  "doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
98
- "lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx",
89
+ "lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
99
90
  "lint:fix": "pnpm lint --fix",
100
91
  "test": "jest"
101
92
  }
@@ -1,7 +1,4 @@
1
- import {
2
- encodeAccountId,
3
- encodeTokenAccountId,
4
- } from "@ledgerhq/coin-framework/account/index";
1
+ import { encodeAccountId, encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
5
2
  import { findTokenById } from "@ledgerhq/cryptoassets";
6
3
  import { Operation } from "@ledgerhq/types-live";
7
4
  import BigNumber from "bignumber.js";
@@ -82,9 +79,7 @@ describe("EVM Family", () => {
82
79
  gasPrice: ethers.BigNumber.from(10000),
83
80
  };
84
81
 
85
- expect(transactionToEthersTransaction(legacyTx)).toEqual(
86
- legacyEthersTx
87
- );
82
+ expect(transactionToEthersTransaction(legacyTx)).toEqual(legacyEthersTx);
88
83
  });
89
84
  });
90
85
 
@@ -95,8 +90,7 @@ describe("EVM Family", () => {
95
90
  timeStamp: "1654646570",
96
91
  hash: "0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338",
97
92
  nonce: "7",
98
- blockHash:
99
- "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
93
+ blockHash: "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
100
94
  transactionIndex: "27",
101
95
  from: "0x9aa99c23f67c81701c772b106b4f83f6e858dd2e",
102
96
  to: "0xc5102fe9359fd9a28f877a67e36b0f050d81a3cc",
@@ -127,8 +121,7 @@ describe("EVM Family", () => {
127
121
  id: "js:2:ethereum:0x9aa99c23f67c81701c772b106b4f83f6e858dd2e:-0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338-FEES",
128
122
  hash: "0xaa45b4858ba44230a5fce5a29570a5dec2bf1f0ba95bacdec4fe8f2c4fa99338",
129
123
  accountId,
130
- blockHash:
131
- "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
124
+ blockHash: "0x8df71a12a8c06b36c06c26bf6248857dd2a2b75b6edbb4e33e9477078897b282",
132
125
  blockHeight: 14923692,
133
126
  recipients: ["0xc5102fE9359FD9a28f877a67E36B0F050d81a3CC"],
134
127
  senders: ["0x9AA99C23F67c81701C772B106b4F83f6e858dd2E"],
@@ -140,9 +133,7 @@ describe("EVM Family", () => {
140
133
  extra: {},
141
134
  };
142
135
 
143
- expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
144
- expectedOperation
145
- );
136
+ expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
146
137
  });
147
138
 
148
139
  it("should convert a etherscan-like coin out operation (from their API) to a Ledger Live Operation", () => {
@@ -151,8 +142,7 @@ describe("EVM Family", () => {
151
142
  timeStamp: "1639544926",
152
143
  hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
153
144
  nonce: "11898499",
154
- blockHash:
155
- "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
145
+ blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
156
146
  transactionIndex: "394",
157
147
  from: "0x829bd824b016326a401d083b33d092293333a830",
158
148
  to: "0x26e3fd2dec89bf645ba7b41c4ddfad8454ee6245",
@@ -182,8 +172,7 @@ describe("EVM Family", () => {
182
172
  id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-OUT",
183
173
  hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
184
174
  accountId,
185
- blockHash:
186
- "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
175
+ blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
187
176
  blockHeight: 13807766,
188
177
  recipients: ["0x26E3fd2dEc89bF645BA7b41c4DdFad8454Ee6245"],
189
178
  senders: ["0x829BD824B016326A401d083B33D092293333A830"],
@@ -195,9 +184,7 @@ describe("EVM Family", () => {
195
184
  extra: {},
196
185
  };
197
186
 
198
- expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
199
- expectedOperation
200
- );
187
+ expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
201
188
  });
202
189
 
203
190
  it("should convert a etherscan-like coin in operation (from their API) to a Ledger Live Operation", () => {
@@ -206,8 +193,7 @@ describe("EVM Family", () => {
206
193
  timeStamp: "1639544926",
207
194
  hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
208
195
  nonce: "11898499",
209
- blockHash:
210
- "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
196
+ blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
211
197
  transactionIndex: "394",
212
198
  from: "0x26e3fd2dec89bf645ba7b41c4ddfad8454ee6245",
213
199
  to: "0x829bd824b016326a401d083b33d092293333a830",
@@ -237,8 +223,7 @@ describe("EVM Family", () => {
237
223
  id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-IN",
238
224
  hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
239
225
  accountId,
240
- blockHash:
241
- "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
226
+ blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
242
227
  blockHeight: 13807766,
243
228
  recipients: ["0x829BD824B016326A401d083B33D092293333A830"],
244
229
  senders: ["0x26E3fd2dEc89bF645BA7b41c4DdFad8454Ee6245"],
@@ -250,9 +235,7 @@ describe("EVM Family", () => {
250
235
  extra: {},
251
236
  };
252
237
 
253
- expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
254
- expectedOperation
255
- );
238
+ expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
256
239
  });
257
240
 
258
241
  it("should convert a etherscan-like coin none operation (from their API) to a Ledger Live Operation", () => {
@@ -261,8 +244,7 @@ describe("EVM Family", () => {
261
244
  timeStamp: "1639544926",
262
245
  hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
263
246
  nonce: "11898499",
264
- blockHash:
265
- "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
247
+ blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
266
248
  transactionIndex: "394",
267
249
  from: "0x6bfd74c0996f269bcece59191eff667b3dfd73b9",
268
250
  to: "0x02a357476a300c89ce27d7d4c7e57bbd2dd3f006",
@@ -292,8 +274,7 @@ describe("EVM Family", () => {
292
274
  id: "js:2:ethereum:0x829BD824B016326A401d083B33D092293333A830:-0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944-NONE",
293
275
  hash: "0x8d3e871469ce549c5a80b8c8beaae0d502ecea85bb43eb84703cebeea7d25944",
294
276
  accountId,
295
- blockHash:
296
- "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
277
+ blockHash: "0xad04a8ed598c9c270f7ffd9a113224bc16fc285af814a2dc735c261620bad669",
297
278
  blockHeight: 13807766,
298
279
  recipients: ["0x02a357476A300c89Ce27D7D4C7E57Bbd2DD3f006"],
299
280
  senders: ["0x6bfD74C0996F269Bcece59191EFf667b3dFD73b9"],
@@ -305,9 +286,7 @@ describe("EVM Family", () => {
305
286
  extra: {},
306
287
  };
307
288
 
308
- expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(
309
- expectedOperation
310
- );
289
+ expect(etherscanOperationToOperation(accountId, etherscanOp)).toEqual(expectedOperation);
311
290
  });
312
291
  });
313
292
 
@@ -318,8 +297,7 @@ describe("EVM Family", () => {
318
297
  timeStamp: "1671717983",
319
298
  hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
320
299
  nonce: "53",
321
- blockHash:
322
- "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
300
+ blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
323
301
  from: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
324
302
  contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb41",
325
303
  to: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
@@ -344,9 +322,7 @@ describe("EVM Family", () => {
344
322
  derivationMode: "",
345
323
  });
346
324
 
347
- expect(etherscanERC20EventToOperation(accountId, etherscanOp)).toEqual(
348
- null
349
- );
325
+ expect(etherscanERC20EventToOperation(accountId, etherscanOp)).toEqual(null);
350
326
  });
351
327
 
352
328
  it("should convert a etherscan-like usdc out event (from their API) to a Ledger Live Operation", () => {
@@ -355,8 +331,7 @@ describe("EVM Family", () => {
355
331
  timeStamp: "1671717983",
356
332
  hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
357
333
  nonce: "53",
358
- blockHash:
359
- "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
334
+ blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
360
335
  from: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
361
336
  contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
362
337
  to: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
@@ -387,8 +362,7 @@ describe("EVM Family", () => {
387
362
  id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-OUT",
388
363
  hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
389
364
  accountId: tokenAccountId,
390
- blockHash:
391
- "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
365
+ blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
392
366
  blockHeight: 16240731,
393
367
  senders: ["0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"],
394
368
  recipients: ["0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"],
@@ -413,8 +387,7 @@ describe("EVM Family", () => {
413
387
  timeStamp: "1671717983",
414
388
  hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
415
389
  nonce: "53",
416
- blockHash:
417
- "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
390
+ blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
418
391
  from: "0xc2907efcce4011c491bbeda8a0fa63ba7aab596c",
419
392
  contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
420
393
  to: "0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d",
@@ -445,8 +418,7 @@ describe("EVM Family", () => {
445
418
  id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-IN",
446
419
  hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
447
420
  accountId: tokenAccountId,
448
- blockHash:
449
- "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
421
+ blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
450
422
  blockHeight: 16240731,
451
423
  senders: ["0xC2907EFccE4011C491BbedA8A0fA63BA7aab596C"],
452
424
  recipients: ["0x6cBCD73CD8e8a42844662f0A0e76D7F79Afd933d"],
@@ -471,8 +443,7 @@ describe("EVM Family", () => {
471
443
  timeStamp: "1671717983",
472
444
  hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
473
445
  nonce: "53",
474
- blockHash:
475
- "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
446
+ blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
476
447
  from: "0x6bfd74c0996f269bcece59191eff667b3dfd73b9",
477
448
  contractAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
478
449
  to: "0x02a357476a300c89ce27d7d4c7e57bbd2dd3f006",
@@ -503,8 +474,7 @@ describe("EVM Family", () => {
503
474
  id: "js:2:ethereum:0x6cbcd73cd8e8a42844662f0a0e76d7f79afd933d:+ethereum%2Ferc20%2Fusd__coin-0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf-NONE",
504
475
  hash: "0x02b972f304dc24c9bc362e6435c4ad654241f9af916689a4790145c9bcbdf4cf",
505
476
  accountId: tokenAccountId,
506
- blockHash:
507
- "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
477
+ blockHash: "0x58ee7556044cd139e569c87c173a6dedbfbeb9ada6693ee6090fd510acee9c21",
508
478
  blockHeight: 16240731,
509
479
  recipients: ["0x02a357476A300c89Ce27D7D4C7E57Bbd2DD3f006"],
510
480
  senders: ["0x6bfD74C0996F269Bcece59191EFf667b3dFD73b9"],
@@ -14,12 +14,12 @@ const currency: CryptoCurrency = getCryptoCurrencyById("ethereum");
14
14
  const tokenCurrency = getTokenById("ethereum/erc20/usd__coin");
15
15
  const tokenAccount: TokenAccount = makeTokenAccount(
16
16
  "0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
17
- tokenCurrency
17
+ tokenCurrency,
18
18
  );
19
19
  const account: Account = makeAccount(
20
20
  "0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
21
21
  currency,
22
- [tokenAccount]
22
+ [tokenAccount],
23
23
  );
24
24
  const mockedBroadcastResponse = {
25
25
  hash: "0xH4sH",
@@ -58,10 +58,7 @@ describe("EVM Family", () => {
58
58
  type: 2,
59
59
  };
60
60
  const estimatedFees = getEstimatedFees(coinTransaction);
61
- const optimisticCoinOperation = buildOptimisticOperation(
62
- account,
63
- coinTransaction
64
- );
61
+ const optimisticCoinOperation = buildOptimisticOperation(account, coinTransaction);
65
62
 
66
63
  const finalOperation = await broadcast({
67
64
  account,
@@ -74,11 +71,7 @@ describe("EVM Family", () => {
74
71
 
75
72
  expect(API.broadcastTransaction).toBeCalled();
76
73
  expect(finalOperation).toEqual({
77
- id: encodeOperationId(
78
- account.id,
79
- mockedBroadcastResponse.hash,
80
- "OUT"
81
- ),
74
+ id: encodeOperationId(account.id, mockedBroadcastResponse.hash, "OUT"),
82
75
  hash: mockedBroadcastResponse.hash,
83
76
  blockNumber: mockedBroadcastResponse.blockNumber,
84
77
  blockHeight: mockedBroadcastResponse.blockNumber,
@@ -104,7 +97,7 @@ describe("EVM Family", () => {
104
97
  recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
105
98
  data: Buffer.from(
106
99
  "a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
107
- "hex"
100
+ "hex",
108
101
  ),
109
102
  feesStrategy: "custom",
110
103
  family: "evm",
@@ -117,10 +110,7 @@ describe("EVM Family", () => {
117
110
  type: 2,
118
111
  };
119
112
  const estimatedFees = getEstimatedFees(tokenTransaction);
120
- const optimisticTokenOperation = buildOptimisticOperation(
121
- account,
122
- tokenTransaction
123
- );
113
+ const optimisticTokenOperation = buildOptimisticOperation(account, tokenTransaction);
124
114
 
125
115
  const finalOperation = await broadcast({
126
116
  account,
@@ -133,11 +123,7 @@ describe("EVM Family", () => {
133
123
 
134
124
  expect(API.broadcastTransaction).toBeCalled();
135
125
  expect(finalOperation).toEqual({
136
- id: encodeOperationId(
137
- account.id,
138
- mockedBroadcastResponse.hash,
139
- "FEES"
140
- ),
126
+ id: encodeOperationId(account.id, mockedBroadcastResponse.hash, "FEES"),
141
127
  hash: mockedBroadcastResponse.hash,
142
128
  blockNumber: mockedBroadcastResponse.blockNumber,
143
129
  blockHeight: mockedBroadcastResponse.blockNumber,
@@ -152,11 +138,7 @@ describe("EVM Family", () => {
152
138
  date: new Date(mockedBroadcastResponse.timestamp * 1000),
153
139
  subOperations: [
154
140
  {
155
- id: encodeOperationId(
156
- tokenAccount.id,
157
- mockedBroadcastResponse.hash,
158
- "OUT"
159
- ),
141
+ id: encodeOperationId(tokenAccount.id, mockedBroadcastResponse.hash, "OUT"),
160
142
  hash: mockedBroadcastResponse.hash,
161
143
  blockNumber: mockedBroadcastResponse.blockNumber,
162
144
  blockHeight: mockedBroadcastResponse.blockNumber,
@@ -11,7 +11,7 @@ const tokenCurrency = getTokenById("ethereum/erc20/usd__coin");
11
11
  const tokenAccount = {
12
12
  ...makeTokenAccount(
13
13
  "0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
14
- tokenCurrency
14
+ tokenCurrency,
15
15
  ),
16
16
  balance: new BigNumber(150),
17
17
  spendableBalance: new BigNumber(150),
@@ -19,7 +19,7 @@ const tokenAccount = {
19
19
  const account = makeAccount(
20
20
  "0x055C1e159E345cB4197e3844a86A61E0a801d856", // jacquie.eth
21
21
  currency,
22
- [tokenAccount]
22
+ [tokenAccount],
23
23
  );
24
24
 
25
25
  describe("EVM Family", () => {
@@ -70,7 +70,7 @@ describe("EVM Family", () => {
70
70
  recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
71
71
  data: Buffer.from(
72
72
  "a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
73
- "hex"
73
+ "hex",
74
74
  ),
75
75
  feesStrategy: "custom",
76
76
  family: "evm",
@@ -128,7 +128,7 @@ describe("EVM Family", () => {
128
128
  recipient: "0x51DF0aF74a0DBae16cB845B46dAF2a35cB1D4168", // michel.eth
129
129
  data: Buffer.from(
130
130
  "a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
131
- "hex"
131
+ "hex",
132
132
  ),
133
133
  feesStrategy: "custom",
134
134
  family: "evm",
@@ -38,7 +38,7 @@ describe("EVM Family", () => {
38
38
  parentAccount: undefined,
39
39
  transaction: coinTransaction,
40
40
  status,
41
- })
41
+ }),
42
42
  ).toEqual([
43
43
  { type: "amount", label: "Amount" },
44
44
  {
@@ -80,7 +80,7 @@ describe("EVM Family", () => {
80
80
  parentAccount: undefined,
81
81
  transaction: coinTransaction,
82
82
  status,
83
- })
83
+ }),
84
84
  ).toEqual([
85
85
  { type: "amount", label: "Amount" },
86
86
  {
@@ -128,7 +128,7 @@ describe("EVM Family", () => {
128
128
  parentAccount: undefined,
129
129
  transaction: coinTransaction,
130
130
  status,
131
- })
131
+ }),
132
132
  ).toEqual([
133
133
  { type: "amount", label: "Amount" },
134
134
  {
@@ -153,7 +153,7 @@ describe("EVM Family", () => {
153
153
  recipient: "0x997e135e96114c0E84FFc58754552368E4abf329", // celinedion.eth
154
154
  data: Buffer.from(
155
155
  "a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
156
- "hex"
156
+ "hex",
157
157
  ),
158
158
  feesStrategy: "custom",
159
159
  family: "evm",
@@ -173,7 +173,7 @@ describe("EVM Family", () => {
173
173
  parentAccount: account,
174
174
  transaction: tokenTransaction,
175
175
  status,
176
- })
176
+ }),
177
177
  ).toEqual([
178
178
  { type: "amount", label: "Amount" },
179
179
  {
@@ -198,7 +198,7 @@ describe("EVM Family", () => {
198
198
  recipient: "0x997e135e96114c0E84FFc58754552368E4abf329", // celinedion.eth
199
199
  data: Buffer.from(
200
200
  "a9059cbb00000000000000000000000059569e96d0e3d9728dc07bf5c1443809e6f237fd0000000000000000000000000000000000000000000000000c06701668d322ac",
201
- "hex"
201
+ "hex",
202
202
  ),
203
203
  feesStrategy: "custom",
204
204
  family: "evm",
@@ -224,7 +224,7 @@ describe("EVM Family", () => {
224
224
  parentAccount: account,
225
225
  transaction: tokenTransaction,
226
226
  status,
227
- })
227
+ }),
228
228
  ).toEqual([
229
229
  { type: "amount", label: "Amount" },
230
230
  {
@@ -14,9 +14,7 @@ const account = {
14
14
  balance: new BigNumber(42069000000),
15
15
  };
16
16
 
17
- jest
18
- .spyOn(rpcAPI, "getGasEstimation")
19
- .mockImplementation(async () => new BigNumber(21000));
17
+ jest.spyOn(rpcAPI, "getGasEstimation").mockImplementation(async () => new BigNumber(21000));
20
18
  jest.spyOn(rpcAPI, "getFeesEstimation").mockImplementation(async () => ({
21
19
  gasPrice: new BigNumber(10000),
22
20
  maxFeePerGas: new BigNumber(10000),