@ledgerhq/live-common 21.27.0 → 21.28.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 (62) hide show
  1. package/lib/apps/support.d.ts.map +1 -1
  2. package/lib/apps/support.js +2 -1
  3. package/lib/apps/support.js.map +1 -1
  4. package/lib/env.d.ts +5 -10
  5. package/lib/env.d.ts.map +1 -1
  6. package/lib/env.js +0 -5
  7. package/lib/env.js.map +1 -1
  8. package/lib/env.react.d.ts +1 -1
  9. package/lib/env.react.d.ts.map +1 -1
  10. package/lib/families/algorand/api/algodv2.d.ts +2 -1
  11. package/lib/families/algorand/api/algodv2.d.ts.map +1 -1
  12. package/lib/families/algorand/api/algodv2.js +2 -2
  13. package/lib/families/algorand/api/algodv2.js.map +1 -1
  14. package/lib/families/algorand/js-broadcast.js +1 -1
  15. package/lib/families/algorand/js-broadcast.js.map +1 -1
  16. package/lib/families/algorand/js-signOperation.d.ts.map +1 -1
  17. package/lib/families/algorand/js-signOperation.js +1 -1
  18. package/lib/families/algorand/js-signOperation.js.map +1 -1
  19. package/lib/families/bitcoin/wallet-btc/wallet.d.ts.map +1 -1
  20. package/lib/families/bitcoin/wallet-btc/wallet.js +1 -3
  21. package/lib/families/bitcoin/wallet-btc/wallet.js.map +1 -1
  22. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js +1 -1
  23. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js.map +1 -1
  24. package/lib/families/ethereum/nft.integration.test.js +1 -36
  25. package/lib/families/ethereum/nft.integration.test.js.map +1 -1
  26. package/lib/families/ethereum/synchronisation.d.ts.map +1 -1
  27. package/lib/families/ethereum/synchronisation.js +2 -7
  28. package/lib/families/ethereum/synchronisation.js.map +1 -1
  29. package/lib/hw/connectApp.d.ts.map +1 -1
  30. package/lib/hw/connectApp.js +32 -31
  31. package/lib/hw/connectApp.js.map +1 -1
  32. package/lib/market/utils/countervalueFormatter.js +1 -1
  33. package/lib/market/utils/countervalueFormatter.js.map +1 -1
  34. package/lib/nft/support.d.ts.map +1 -1
  35. package/lib/nft/support.js +1 -1
  36. package/lib/nft/support.js.map +1 -1
  37. package/lib/platform/PlatformAppProvider/api/api.mock.d.ts.map +1 -1
  38. package/lib/platform/PlatformAppProvider/api/api.mock.js +27 -0
  39. package/lib/platform/PlatformAppProvider/api/api.mock.js.map +1 -1
  40. package/package.json +6 -6
  41. package/src/__tests__/__snapshots__/all.libcore.ts.snap +84 -26
  42. package/src/apps/support.ts +1 -0
  43. package/src/env.ts +0 -5
  44. package/src/families/algorand/api/algodv2.ts +2 -2
  45. package/src/families/algorand/js-broadcast.ts +1 -1
  46. package/src/families/algorand/js-signOperation.ts +8 -3
  47. package/src/families/bitcoin/wallet-btc/wallet.ts +1 -3
  48. package/src/families/ethereum/datasets/ethereum.scanAccounts.1.ts +43 -43
  49. package/src/families/ethereum/nft.integration.test.ts +1 -18
  50. package/src/families/ethereum/synchronisation.ts +1 -6
  51. package/src/hw/connectApp.ts +39 -36
  52. package/src/market/utils/countervalueFormatter.ts +1 -1
  53. package/src/nft/support.ts +1 -3
  54. package/src/platform/PlatformAppProvider/api/api.mock.ts +27 -0
  55. package/lib/families/ethereum/versions.d.ts +0 -2
  56. package/lib/families/ethereum/versions.d.ts.map +0 -1
  57. package/lib/families/ethereum/versions.js +0 -5
  58. package/lib/families/ethereum/versions.js.map +0 -1
  59. package/src/.DS_Store +0 -0
  60. package/src/__tests__/.DS_Store +0 -0
  61. package/src/currencies/__snapshots__/.DS_Store +0 -0
  62. package/src/families/ethereum/versions.ts +0 -1
@@ -15062,15 +15062,25 @@ Array [
15062
15062
  "id": "js:2:ethereum:0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd:ethM",
15063
15063
  "index": 0,
15064
15064
  "name": "Ethereum 1",
15065
- "nfts": undefined,
15066
- "operationsCount": 73,
15065
+ "nfts": Array [
15066
+ Object {
15067
+ "amount": "4",
15068
+ "collection": Object {
15069
+ "contract": "0x495f947276749Ce646f68AC8c248420045cb7b5e",
15070
+ "standard": "ERC1155",
15071
+ },
15072
+ "id": "js:2:ethereum:0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd:ethM+0x495f947276749Ce646f68AC8c248420045cb7b5e+77770246133050101334277152821957558007745772239357041338818208158214799753316",
15073
+ "tokenId": "77770246133050101334277152821957558007745772239357041338818208158214799753316",
15074
+ },
15075
+ ],
15076
+ "operationsCount": 74,
15067
15077
  "pendingOperations": Array [],
15068
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
15078
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
15069
15079
  "spendableBalance": "0",
15070
15080
  "starred": false,
15071
15081
  "subAccounts": Array [],
15072
15082
  "swapHistory": Array [],
15073
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_6062",
15083
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_6062",
15074
15084
  "unitMagnitude": 18,
15075
15085
  "used": true,
15076
15086
  },
@@ -15103,15 +15113,15 @@ Array [
15103
15113
  "id": "js:2:ethereum:0x0E3F0bb9516F01f2C34c25E0957518b8aC9414c5:",
15104
15114
  "index": 0,
15105
15115
  "name": "Ethereum 1",
15106
- "nfts": undefined,
15116
+ "nfts": Array [],
15107
15117
  "operationsCount": 367,
15108
15118
  "pendingOperations": Array [],
15109
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
15119
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
15110
15120
  "spendableBalance": "0",
15111
15121
  "starred": false,
15112
15122
  "subAccounts": Array [],
15113
15123
  "swapHistory": Array [],
15114
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_6062",
15124
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_6062",
15115
15125
  "unitMagnitude": 18,
15116
15126
  "used": true,
15117
15127
  },
@@ -15578,15 +15588,15 @@ Array [
15578
15588
  "id": "js:2:ethereum:0x667F9BE94a42458cb53A3A66511Dca19b397738d:",
15579
15589
  "index": 1,
15580
15590
  "name": "Ethereum 2",
15581
- "nfts": undefined,
15591
+ "nfts": Array [],
15582
15592
  "operationsCount": 185,
15583
15593
  "pendingOperations": Array [],
15584
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
15594
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
15585
15595
  "spendableBalance": "200000000000000",
15586
15596
  "starred": false,
15587
15597
  "subAccounts": Array [],
15588
15598
  "swapHistory": Array [],
15589
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_6062",
15599
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_6062",
15590
15600
  "unitMagnitude": 18,
15591
15601
  "used": true,
15592
15602
  },
@@ -15913,15 +15923,15 @@ Array [
15913
15923
  "id": "js:2:ethereum:0x8f95502911C81a5EC2ba4b815ed2d2C5e1c88925:",
15914
15924
  "index": 2,
15915
15925
  "name": "Ethereum 3",
15916
- "nfts": undefined,
15926
+ "nfts": Array [],
15917
15927
  "operationsCount": 26,
15918
15928
  "pendingOperations": Array [],
15919
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
15929
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
15920
15930
  "spendableBalance": "0",
15921
15931
  "starred": false,
15922
15932
  "subAccounts": Array [],
15923
15933
  "swapHistory": Array [],
15924
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_6062",
15934
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_6062",
15925
15935
  "unitMagnitude": 18,
15926
15936
  "used": true,
15927
15937
  },
@@ -16010,15 +16020,15 @@ Array [
16010
16020
  "id": "js:2:ethereum:0x8ba41105fFA54510cb9D67cb3A72624D4052cA08:",
16011
16021
  "index": 3,
16012
16022
  "name": "Ethereum 4",
16013
- "nfts": undefined,
16023
+ "nfts": Array [],
16014
16024
  "operationsCount": 49,
16015
16025
  "pendingOperations": Array [],
16016
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
16026
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
16017
16027
  "spendableBalance": "0",
16018
16028
  "starred": false,
16019
16029
  "subAccounts": Array [],
16020
16030
  "swapHistory": Array [],
16021
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_6062",
16031
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_6062",
16022
16032
  "unitMagnitude": 18,
16023
16033
  "used": true,
16024
16034
  },
@@ -16135,15 +16145,15 @@ Array [
16135
16145
  "id": "js:2:ethereum:0x6b3493FE181EA283e0335e5D8D768e2122bC6c18:",
16136
16146
  "index": 4,
16137
16147
  "name": "Ethereum 5",
16138
- "nfts": undefined,
16148
+ "nfts": Array [],
16139
16149
  "operationsCount": 32,
16140
16150
  "pendingOperations": Array [],
16141
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
16151
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
16142
16152
  "spendableBalance": "9121744300000000",
16143
16153
  "starred": false,
16144
16154
  "subAccounts": Array [],
16145
16155
  "swapHistory": Array [],
16146
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_6062",
16156
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_6062",
16147
16157
  "unitMagnitude": 18,
16148
16158
  "used": true,
16149
16159
  },
@@ -16232,15 +16242,15 @@ Array [
16232
16242
  "id": "js:2:ethereum:0x25FEa94454Fd3A7A18D95811F5e4eb573c1cCC42:",
16233
16243
  "index": 5,
16234
16244
  "name": "Ethereum 6",
16235
- "nfts": undefined,
16245
+ "nfts": Array [],
16236
16246
  "operationsCount": 84,
16237
16247
  "pendingOperations": Array [],
16238
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
16248
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
16239
16249
  "spendableBalance": "0",
16240
16250
  "starred": false,
16241
16251
  "subAccounts": Array [],
16242
16252
  "swapHistory": Array [],
16243
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_6062",
16253
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_6062",
16244
16254
  "unitMagnitude": 18,
16245
16255
  "used": true,
16246
16256
  },
@@ -16388,7 +16398,7 @@ Array [
16388
16398
  "nfts": undefined,
16389
16399
  "operationsCount": 0,
16390
16400
  "pendingOperations": Array [],
16391
- "seedIdentifier": "0434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f42",
16401
+ "seedIdentifier": "0469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb6210",
16392
16402
  "spendableBalance": "0",
16393
16403
  "starred": false,
16394
16404
  "subAccounts": Array [],
@@ -16428,6 +16438,54 @@ Array [
16428
16438
  "type": "OUT",
16429
16439
  "value": "1273288000000000",
16430
16440
  },
16441
+ Object {
16442
+ "accountId": "js:2:ethereum:0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd:ethM",
16443
+ "blockHash": "0x807ea3bc234c1b37f3659ad0cd0af3423ac4d6ffe7552ddf195393d136aa46d0",
16444
+ "blockHeight": 13314884,
16445
+ "contract": undefined,
16446
+ "extra": Object {},
16447
+ "fee": "5606826680224380",
16448
+ "hash": "0x074692133155d2019c2f71d509c671520a85a796197691bcc6ccd21c00d965bc",
16449
+ "id": "js:2:ethereum:0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd:ethM-0x074692133155d2019c2f71d509c671520a85a796197691bcc6ccd21c00d965bc-NONE",
16450
+ "internalOperations": Array [],
16451
+ "nftOperations": Array [
16452
+ Object {
16453
+ "accountId": "js:2:ethereum:0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd:ethM",
16454
+ "blockHash": "0x807ea3bc234c1b37f3659ad0cd0af3423ac4d6ffe7552ddf195393d136aa46d0",
16455
+ "blockHeight": 13314884,
16456
+ "contract": "0x495f947276749Ce646f68AC8c248420045cb7b5e",
16457
+ "date": "2021-09-28T14:54:24.000Z",
16458
+ "extra": Object {},
16459
+ "fee": "5606826680224380",
16460
+ "hash": "0x074692133155d2019c2f71d509c671520a85a796197691bcc6ccd21c00d965bc",
16461
+ "id": "js:2:ethereum:0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd:ethM+0x495f947276749ce646f68ac8c248420045cb7b5e+77770246133050101334277152821957558007745772239357041338818208158214799753316-0x074692133155d2019c2f71d509c671520a85a796197691bcc6ccd21c00d965bc-NFT_IN-i0_0",
16462
+ "operator": "0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43",
16463
+ "recipients": Array [
16464
+ "0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd",
16465
+ ],
16466
+ "senders": Array [
16467
+ "0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43",
16468
+ ],
16469
+ "standard": "ERC1155",
16470
+ "tokenId": "77770246133050101334277152821957558007745772239357041338818208158214799753316",
16471
+ "transactionSequenceNumber": 68,
16472
+ "type": "NFT_IN",
16473
+ "value": "4",
16474
+ },
16475
+ ],
16476
+ "operator": undefined,
16477
+ "recipients": Array [
16478
+ "0x495f947276749Ce646f68AC8c248420045cb7b5e",
16479
+ ],
16480
+ "senders": Array [
16481
+ "0xabf06640f8ca8fC5e0Ed471b10BeFCDf65A33e43",
16482
+ ],
16483
+ "standard": undefined,
16484
+ "tokenId": undefined,
16485
+ "transactionSequenceNumber": 68,
16486
+ "type": "NONE",
16487
+ "value": "0",
16488
+ },
16431
16489
  Object {
16432
16490
  "accountId": "js:2:ethereum:0x5df0C369641B8Af3c7e9ae076E5466eF678319Cd:ethM",
16433
16491
  "blockHash": "0x13a0efd8512a666b25f772797ed29c3d0b9f53dc556070ba5eac7c192a958c3a",
@@ -48129,7 +48187,7 @@ Array [
48129
48187
  "starred": false,
48130
48188
  "subAccounts": Array [],
48131
48189
  "swapHistory": Array [],
48132
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_0",
48190
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_0",
48133
48191
  "unitMagnitude": 18,
48134
48192
  "used": true,
48135
48193
  },
@@ -48156,7 +48214,7 @@ Array [
48156
48214
  "starred": false,
48157
48215
  "subAccounts": Array [],
48158
48216
  "swapHistory": Array [],
48159
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_0",
48217
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_0",
48160
48218
  "unitMagnitude": 18,
48161
48219
  "used": true,
48162
48220
  },
@@ -48183,7 +48241,7 @@ Array [
48183
48241
  "starred": false,
48184
48242
  "subAccounts": Array [],
48185
48243
  "swapHistory": Array [],
48186
- "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_false_0",
48244
+ "syncHash": "[\\"ethereum/erc20/ampleforth\\",\\"ethereum/erc20/steth\\"]_0",
48187
48245
  "unitMagnitude": 18,
48188
48246
  "used": true,
48189
48247
  },
@@ -31,6 +31,7 @@ const appVersionsRequired = {
31
31
  Algorand: ">= 1.2.9",
32
32
  Polkadot: ">= 9.9140.0",
33
33
  Elrond: ">= 1.0.11",
34
+ Ethereum: ">= 1.9.17",
34
35
  };
35
36
  export function mustUpgrade(
36
37
  deviceModel: DeviceModelId,
package/src/env.ts CHANGED
@@ -380,11 +380,6 @@ const envDefinitions = {
380
380
  parser: boolParser,
381
381
  desc: "mock the cryptoassets config and test partner (in the context of app-exchange)",
382
382
  },
383
- NFT: {
384
- def: false,
385
- parser: boolParser,
386
- desc: "synchronizing nfts",
387
- },
388
383
  NFT_CURRENCIES: {
389
384
  def: "ethereum",
390
385
  parser: stringParser,
@@ -37,7 +37,6 @@ export const getAccount = async (address: string): Promise<AlgoAccount> => {
37
37
  };
38
38
  };
39
39
 
40
- // TODO Cache
41
40
  export const getTransactionParams =
42
41
  async (): Promise<AlgoTransactionParams> => {
43
42
  const { data } = await network({
@@ -56,12 +55,13 @@ export const getTransactionParams =
56
55
  };
57
56
 
58
57
  export const broadcastTransaction = async (
59
- payload: string
58
+ payload: Buffer
60
59
  ): Promise<string> => {
61
60
  const { data }: { data: AlgoTransactionBroadcastResponse } = await network({
62
61
  method: "POST",
63
62
  url: fullUrl(`/transactions`),
64
63
  data: payload,
64
+ headers: { "Content-Type": "application/x-binary" },
65
65
  });
66
66
 
67
67
  return data.txId;
@@ -12,6 +12,6 @@ export const broadcast = async ({
12
12
  signedOperation: SignedOperation;
13
13
  }): Promise<Operation> => {
14
14
  const { signature, operation } = signedOperation;
15
- const hash = await apiBroadcast(signature);
15
+ const hash = await apiBroadcast(Buffer.from(signature, "hex"));
16
16
  return patchOperationWithHash(operation, hash);
17
17
  };
@@ -2,7 +2,12 @@ import { BigNumber } from "bignumber.js";
2
2
  import { Observable } from "rxjs";
3
3
  import { FeeNotLoaded } from "@ledgerhq/errors";
4
4
  import Algorand from "@ledgerhq/hw-app-algorand";
5
- import type { Account, Operation, SignOperationEvent } from "../../types";
5
+ import type {
6
+ Account,
7
+ Operation,
8
+ SignedOperation,
9
+ SignOperationEvent,
10
+ } from "../../types";
6
11
  import { withDevice } from "../../hw/deviceAccess";
7
12
  import type { Transaction } from "./types";
8
13
  import {
@@ -56,9 +61,9 @@ export const signOperation = ({
56
61
  type: "signed",
57
62
  signedOperation: {
58
63
  operation,
59
- signature: toBroadcast,
64
+ signature: toBroadcast.toString("hex"),
60
65
  expirationDate: null,
61
- },
66
+ } as SignedOperation,
62
67
  });
63
68
  }
64
69
 
@@ -272,9 +272,7 @@ class BitcoinLikeWallet {
272
272
  if (additionals && additionals.includes("peercoin")) {
273
273
  // remove timestamp for new version of peercoin input, refer to https://github.com/peercoin/rfcs/issues/5 and https://github.com/LedgerHQ/ledgerjs/issues/701
274
274
  const version = i.txHex.substring(0, 8);
275
- if (version !== "01000000" && version !== "02000000") {
276
- hasTimestamp = false;
277
- }
275
+ hasTimestamp = version === "01000000" || version === "02000000";
278
276
  }
279
277
  log("hw", `splitTransaction`, {
280
278
  transactionHex: i.txHex,
@@ -1,47 +1,47 @@
1
1
  export default {
2
2
  name: "ethereum seed 1",
3
3
  apdus: `
4
- => e00200000d038000002c8000003c80000000
5
- <= 410434ab5fd7ee8bd794b8a41875aa9a78a296d7c4246531dfd36d47fa6bb42c8eb02720c6d9802b8590c4a461f08c2a7696557a9ec1d4fd0ca340c63b33ad359f4228323031653833363838324636384541456433346338323545423463333036446537303830323663629000
6
- => e002000011048000002c8000003c8000000000000000
7
- <= 4104b7577f404537d1e934a8d2a1fd2552a7f399928b5af0aad714acc17b36865b3f5d1843d6a580c737c051656ac35978283a388a759911d289e9994071247d167528356466304333363936343142384166336337653961653037364535343636654636373833313943649000
8
- => e002000011048000002c8000003c8000000000000001
9
- <= 4104bee21a16156c645d0150e262c40648b9fd938c6462efe3adf9051efe077d30b356c86b8bc8a182e58cdc514e6d0c2670f6626d34f78220187e2d279d661d23f628446336313732383838343733383239324134373236353042624133653936433261344638383739369000
10
- => e002000011048000002c8000003c8000000000000002
11
- <= 410467f77bf213f0de5fd7ae7ac2ca2b6f7ad6cacecbb8688acd0bcf0fcc5b7b58512fe786639619b9f4a513061dd0355590ec5b7d2c4d934c43a37778920bf07e1a28623262344230413836384543326530613162326533314131304142414130393365463032386544389000
12
- => e002000011048000002c8000003c8000000000000003
13
- <= 4104dcce479cd733a7972cea67f0b5bf92d786a1e62a9afe5e50ddd2f7f7c8c1aaff89e28b236f5f1e75c702c3c0116de49dde6b32f06f66937f0b190bdd730bd84e28613563334139333430364465323733666639386244443343653935314232653431423137436443469000
14
- => e002000011048000002c8000003c8000000000000004
15
- <= 4104b60582b8ea13540e5292396949f9d2ed23d9ec4344e2463e9fe7fa36c12372da03a0427c48d653dd59abfcbb7628b323076415f1fd53bc601b8071d82ddd635528393945363561463136626644393139303246623638394163373938343338633042464334373439359000
16
- => e002000011048000002c8000003c8000000000000005
17
- <= 4104126bf90b475158cb8c947dbe47d9ecdff88c34c96c7b7f4fc17a05257dff1024c089fd51f657fa7f5b1041d23bc67d46cd0dd4df86c5318f653486199313e18f28663736394533463933663831313733653836333365354461653646433031426262443163634230389000
18
- => e002000011048000002c8000003c8000000000000006
19
- <= 4104dc7934183510e92e07136e9192da7d5bbd4c3a757b4d9bdf8dcca9baabdf8efddfad24ef74e8a0db52d9e4171516665ff6e4cd152273f460627933df3ced177828463439386638653139323342653437633335343932376445334332313661633341453734666535619000
20
- => e002000011048000002c8000003c8000000000000007
21
- <= 4104b7664a7012f69cee691362377df6d8558b0acfe1541dbf95af90e919d6867ac9d46b3b0b42e98fe8543c15ae501fed3d85869fd0310d9804faed0d07ae3b871628353932393338336336626631624439666533383462423665363162394232413230416637434361429000
22
- => e002000011048000002c8000003c8000000000000008
23
- <= 41045cdb8bc99d890837444698a53d9c18d22c6159e0727e051fee54e7299318282d3fe882b4aa133e7e15529e90b824b4f83ea5242b3ad4651c7d9cca12c796e45428634339303838363541443934303634623733433739663235393861373966393843654544364446619000
24
- => e002000011048000002c8000003c8000000000000009
25
- <= 4104720ec99d2297e627e239764e519be6900d06fc3d9145e306daeace60944c3c6dc14e74f24d27fc98278c0c07de821bae71ed5c95e9a7b95538637e817763609128373731663039424535353143386346393734426141426336373365324232323132643637383236469000
26
- => e002000011048000002c8000003c800000000000000a
27
- <= 41043a98496a4115f61e264bd74ba1ea661729ccfa239e72318ecbd307fb747d2032be5e308e435b24417320a95b719d60b7740b0bf297f926b414b4d3b44d903a9f28384138383238373537353662333831336262613844644631376634304232363064423232466334379000
28
- => e002000011048000002c8000003c800000000000000b
29
- <= 41040f3a6497cdef24c68b895a0d8a9f8b54e16ee84e4905a24236a242a82a900e068cb72ad71f52b57dfa41e00090cd035d1a4205dbe3982ac88189c743edb856a828646431344537456135384533384343316134653737386265663338323831664139413134353232419000
30
- => e002000015058000002c8000003c800000000000000000000001
31
- <= 41040374fb34926a57e184cdd3438109021b3169a9c74ffe726d1abc7a187fa9440a11f071b96f72c8e9e0ea1f82dc2180166bd8c7bae9401cdd3d2466a40e1755ca28304536613732456439323243323338394466303365383666354537394261374336344535343933379000
32
- => e002000015058000002c8000003c800000000000000000000000
33
- <= 410478f6d00bc3be349f69a8b88b3957d569d7ed44d27d0824988107ba1a6117cfcefc22b03b9be870ddadb643eeda4357761d44419cfbdccb19701be086780ff71128304533463062623935313646303166324333346332354530393537353138623861433934313463359000
34
- => e002000015058000002c8000003c800000010000000000000000
35
- <= 4104c20d717f7652a279588b267457c051e387fbeb8648b730cd3daeaa8fa3774f37ab535ab9bd024b87776b77b3409546a0b64e1b14828ea43891b4200318fc90fd28363637463942453934613432343538636235334133413636353131446361313962333937373338649000
36
- => e002000015058000002c8000003c800000020000000000000000
37
- <= 4104e788111a6c0254ec8184453383d2d8b18c8e0b86d1fea93c2691a9bc6240572f24129a634155d1291228a1721fc88737f75e51bb7575ccc69937d649c1422ea028386639353530323931314338316135454332626134623831356564326432433565316338383932359000
38
- => e002000015058000002c8000003c800000030000000000000000
39
- <= 4104ffd79641446518c675ad32e6434a2aba9e7c426200bc336d78222cbec00d2c8aa7a8c685084f450870e2a801049795ba051f8b3a878a586158697d6bd4ce0b6d28386261343131303566464135343531306362394436376362334137323632344434303532634130389000
40
- => e002000015058000002c8000003c800000040000000000000000
41
- <= 4104602f7c0f3f73a914b3dd83e8bb6f11f3dc8ea1d2c7308fa4f8d9d2000a4419eec324393f4cf191e83f3adc64de9388f5979664c6d6dac4c23c0566d7aabbddfa28366233343933464531383145413238336530333335653544384437363865323132326243366331389000
42
- => e002000015058000002c8000003c800000050000000000000000
43
- <= 410484f94dfa2c52fee4f8b37b578b0087de88ee282cb788a56af1eabd7711ddd37e6da1c9eada59926b7828d7e12db21c443ed0a2ca4521561806d3175407a557c128323546456139343435344664334137413138443935383131463565346562353733633163434334329000
44
- => e002000015058000002c8000003c800000060000000000000000
45
- <= 4104e7c7f373d0a568554b5372b68f6e697aee3947c053ee5d882afba2f2c9a44273768b2e61b01de519b0c1f365e23aea5e3d041a40a347a125e202a2d7d7ef596828624636373337664138373538463134443838376531646633323442423431363136334533366436319000
46
- `,
4
+ => e00200000d038000002c8000003c80000000
5
+ <= 410469877df9567b58e6ef8f6cf1fb8a8e1bf28a327dee31b183a6b9cd1f3da063af0924506a9912793ef31e41df19f8653fa31bb1fecc32d2e41abdddb22ccb621028373561453661383832363036353137343345356546433033373937313136413335363539663638359000
6
+ => e002000011048000002c8000003c8000000000000000
7
+ <= 4104b7577f404537d1e934a8d2a1fd2552a7f399928b5af0aad714acc17b36865b3f5d1843d6a580c737c051656ac35978283a388a759911d289e9994071247d167528356466304333363936343142384166336337653961653037364535343636654636373833313943649000
8
+ => e002000011048000002c8000003c8000000000000001
9
+ <= 4104bee21a16156c645d0150e262c40648b9fd938c6462efe3adf9051efe077d30b356c86b8bc8a182e58cdc514e6d0c2670f6626d34f78220187e2d279d661d23f628446336313732383838343733383239324134373236353042624133653936433261344638383739369000
10
+ => e002000011048000002c8000003c8000000000000002
11
+ <= 410467f77bf213f0de5fd7ae7ac2ca2b6f7ad6cacecbb8688acd0bcf0fcc5b7b58512fe786639619b9f4a513061dd0355590ec5b7d2c4d934c43a37778920bf07e1a28623262344230413836384543326530613162326533314131304142414130393365463032386544389000
12
+ => e002000011048000002c8000003c8000000000000003
13
+ <= 4104dcce479cd733a7972cea67f0b5bf92d786a1e62a9afe5e50ddd2f7f7c8c1aaff89e28b236f5f1e75c702c3c0116de49dde6b32f06f66937f0b190bdd730bd84e28613563334139333430364465323733666639386244443343653935314232653431423137436443469000
14
+ => e002000011048000002c8000003c8000000000000004
15
+ <= 4104b60582b8ea13540e5292396949f9d2ed23d9ec4344e2463e9fe7fa36c12372da03a0427c48d653dd59abfcbb7628b323076415f1fd53bc601b8071d82ddd635528393945363561463136626644393139303246623638394163373938343338633042464334373439359000
16
+ => e002000011048000002c8000003c8000000000000005
17
+ <= 4104126bf90b475158cb8c947dbe47d9ecdff88c34c96c7b7f4fc17a05257dff1024c089fd51f657fa7f5b1041d23bc67d46cd0dd4df86c5318f653486199313e18f28663736394533463933663831313733653836333365354461653646433031426262443163634230389000
18
+ => e002000011048000002c8000003c8000000000000006
19
+ <= 4104dc7934183510e92e07136e9192da7d5bbd4c3a757b4d9bdf8dcca9baabdf8efddfad24ef74e8a0db52d9e4171516665ff6e4cd152273f460627933df3ced177828463439386638653139323342653437633335343932376445334332313661633341453734666535619000
20
+ => e002000011048000002c8000003c8000000000000007
21
+ <= 4104b7664a7012f69cee691362377df6d8558b0acfe1541dbf95af90e919d6867ac9d46b3b0b42e98fe8543c15ae501fed3d85869fd0310d9804faed0d07ae3b871628353932393338336336626631624439666533383462423665363162394232413230416637434361429000
22
+ => e002000011048000002c8000003c8000000000000008
23
+ <= 41045cdb8bc99d890837444698a53d9c18d22c6159e0727e051fee54e7299318282d3fe882b4aa133e7e15529e90b824b4f83ea5242b3ad4651c7d9cca12c796e45428634339303838363541443934303634623733433739663235393861373966393843654544364446619000
24
+ => e002000011048000002c8000003c8000000000000009
25
+ <= 4104720ec99d2297e627e239764e519be6900d06fc3d9145e306daeace60944c3c6dc14e74f24d27fc98278c0c07de821bae71ed5c95e9a7b95538637e817763609128373731663039424535353143386346393734426141426336373365324232323132643637383236469000
26
+ => e002000011048000002c8000003c800000000000000a
27
+ <= 41043a98496a4115f61e264bd74ba1ea661729ccfa239e72318ecbd307fb747d2032be5e308e435b24417320a95b719d60b7740b0bf297f926b414b4d3b44d903a9f28384138383238373537353662333831336262613844644631376634304232363064423232466334379000
28
+ => e002000011048000002c8000003c800000000000000b
29
+ <= 41040f3a6497cdef24c68b895a0d8a9f8b54e16ee84e4905a24236a242a82a900e068cb72ad71f52b57dfa41e00090cd035d1a4205dbe3982ac88189c743edb856a828646431344537456135384533384343316134653737386265663338323831664139413134353232419000
30
+ => e002000015058000002c8000003c800000000000000000000001
31
+ <= 41040374fb34926a57e184cdd3438109021b3169a9c74ffe726d1abc7a187fa9440a11f071b96f72c8e9e0ea1f82dc2180166bd8c7bae9401cdd3d2466a40e1755ca28304536613732456439323243323338394466303365383666354537394261374336344535343933379000
32
+ => e002000015058000002c8000003c800000000000000000000000
33
+ <= 410478f6d00bc3be349f69a8b88b3957d569d7ed44d27d0824988107ba1a6117cfcefc22b03b9be870ddadb643eeda4357761d44419cfbdccb19701be086780ff71128304533463062623935313646303166324333346332354530393537353138623861433934313463359000
34
+ => e002000015058000002c8000003c800000010000000000000000
35
+ <= 4104c20d717f7652a279588b267457c051e387fbeb8648b730cd3daeaa8fa3774f37ab535ab9bd024b87776b77b3409546a0b64e1b14828ea43891b4200318fc90fd28363637463942453934613432343538636235334133413636353131446361313962333937373338649000
36
+ => e002000015058000002c8000003c800000020000000000000000
37
+ <= 4104e788111a6c0254ec8184453383d2d8b18c8e0b86d1fea93c2691a9bc6240572f24129a634155d1291228a1721fc88737f75e51bb7575ccc69937d649c1422ea028386639353530323931314338316135454332626134623831356564326432433565316338383932359000
38
+ => e002000015058000002c8000003c800000030000000000000000
39
+ <= 4104ffd79641446518c675ad32e6434a2aba9e7c426200bc336d78222cbec00d2c8aa7a8c685084f450870e2a801049795ba051f8b3a878a586158697d6bd4ce0b6d28386261343131303566464135343531306362394436376362334137323632344434303532634130389000
40
+ => e002000015058000002c8000003c800000040000000000000000
41
+ <= 4104602f7c0f3f73a914b3dd83e8bb6f11f3dc8ea1d2c7308fa4f8d9d2000a4419eec324393f4cf191e83f3adc64de9388f5979664c6d6dac4c23c0566d7aabbddfa28366233343933464531383145413238336530333335653544384437363865323132326243366331389000
42
+ => e002000015058000002c8000003c800000050000000000000000
43
+ <= 410484f94dfa2c52fee4f8b37b578b0087de88ee282cb788a56af1eabd7711ddd37e6da1c9eada59926b7828d7e12db21c443ed0a2ca4521561806d3175407a557c128323546456139343435344664334137413138443935383131463565346562353733633163434334329000
44
+ => e002000015058000002c8000003c800000060000000000000000
45
+ <= 4104e7c7f373d0a568554b5372b68f6e697aee3947c053ee5d882afba2f2c9a44273768b2e61b01de519b0c1f365e23aea5e3d041a40a347a125e202a2d7d7ef596828624636373337664138373538463134443838376531646633323442423431363136334533366436319000
46
+ `,
47
47
  };
@@ -5,7 +5,6 @@ import type { Account, AccountRaw } from "../../types";
5
5
  import { getAccountBridge } from "../../bridge";
6
6
  import { makeBridgeCacheSystem } from "../../bridge/cache";
7
7
  import { patchAccount } from "../../reconciliation";
8
- import { setEnv } from "../../env";
9
8
 
10
9
  jest.setTimeout(200000);
11
10
 
@@ -68,10 +67,9 @@ const gaspardBscAccount: AccountRaw = {
68
67
  xpub: "",
69
68
  };
70
69
 
71
- async function sync(account, withNFT = true) {
70
+ async function sync(account) {
72
71
  const bridge = getAccountBridge(account);
73
72
  const blacklistedTokenIds = [];
74
- setEnv("NFT", withNFT);
75
73
  const r = await bridge
76
74
  .sync(account, {
77
75
  paginationConfig: {},
@@ -79,7 +77,6 @@ async function sync(account, withNFT = true) {
79
77
  })
80
78
  .pipe(reduce((a, f: (arg0: Account) => Account) => f(a), account))
81
79
  .toPromise();
82
- setEnv("NFT", false);
83
80
  return r;
84
81
  }
85
82
 
@@ -128,20 +125,6 @@ ethTestingAccounts.forEach((a) => {
128
125
  const resync = await sync(copy);
129
126
  expect(resync.nfts).toEqual(account.nfts);
130
127
  });
131
-
132
- test("start account with .nfts and disable the NFT flag should make it disappear", async () => {
133
- expect(account.nfts).not.toBeFalsy();
134
- const resync = await sync(account, false);
135
- expect(resync.nfts).toBeFalsy();
136
- });
137
-
138
- test("start account without .nfts and enable the NFT flag should make it appear", async () => {
139
- const first = await sync(account, false);
140
- expect(first.nfts).toBeFalsy();
141
- const second = await sync(first, true);
142
- expect(second.nfts).not.toBeFalsy();
143
- expect(second.nfts).toEqual(account.nfts);
144
- });
145
128
  });
146
129
  });
147
130
 
@@ -20,7 +20,6 @@ import { API, apiForCurrency, Tx } from "../../api/Ethereum";
20
20
  import { digestTokenAccounts, prepareTokenAccounts } from "./modules";
21
21
  import { findTokenByAddressInCurrency } from "@ledgerhq/cryptoassets";
22
22
  import { encodeNftId, isNFTActive, nftsFromOperations } from "../../nft";
23
- import { NFT_VERSION } from "./versions";
24
23
 
25
24
  export const getAccountShape: GetAccountShape = async (
26
25
  infoInput,
@@ -40,15 +39,12 @@ export const getAccountShape: GetAccountShape = async (
40
39
  const initialStableOperations = initialAccount
41
40
  ? stableOperations(initialAccount)
42
41
  : [];
43
- const shouldNFTBeActive = isNFTActive(currency);
44
42
  // fetch transactions, incrementally if possible
45
43
  const mostRecentStableOperation = initialStableOperations[0];
46
44
  // when new tokens are added / blacklist changes, we need to sync again because we need to go through all operations again
47
45
  const syncHash =
48
46
  JSON.stringify(blacklistedTokenIds || []) +
49
47
  "_" +
50
- shouldNFTBeActive +
51
- "_" +
52
48
  listTokensForCryptoCurrency(currency, {
53
49
  withDelisted: true,
54
50
  }).length;
@@ -57,8 +53,7 @@ export const getAccountShape: GetAccountShape = async (
57
53
  initialAccount &&
58
54
  areAllOperationsLoaded(initialAccount) &&
59
55
  mostRecentStableOperation &&
60
- !outdatedSyncHash &&
61
- NFT_VERSION
56
+ !outdatedSyncHash
62
57
  ? mostRecentStableOperation.blockHash
63
58
  : undefined;
64
59
  const txsP = fetchAllTransactions(api, address, pullFromBlockHash);
@@ -1,5 +1,5 @@
1
1
  import semver from "semver";
2
- import { Observable, concat, from, of, throwError, defer } from "rxjs";
2
+ import { Observable, concat, from, of, throwError, defer, merge } from "rxjs";
3
3
  import { mergeMap, concatMap, map, catchError, delay } from "rxjs/operators";
4
4
  import {
5
5
  TransportStatusError,
@@ -107,10 +107,11 @@ export const openAppFromDashboard = (
107
107
  transport: Transport,
108
108
  appName: string
109
109
  ): Observable<ConnectAppEvent> =>
110
- concat(
111
- // Nb Allows LLD/LLM to update lastSeenDevice
112
- from(getDeviceInfo(transport)).pipe(
113
- mergeMap((deviceInfo) =>
110
+ from(getDeviceInfo(transport)).pipe(
111
+ mergeMap((deviceInfo) =>
112
+ merge(
113
+ // Nb Allows LLD/LLM to update lastSeenDevice, this can run in parallel
114
+ // since there are no more device exchanges.
114
115
  from(manager.getLatestFirmwareForDevice(deviceInfo)).pipe(
115
116
  concatMap((latestFirmware) =>
116
117
  of<ConnectAppEvent>({
@@ -119,39 +120,41 @@ export const openAppFromDashboard = (
119
120
  latestFirmware,
120
121
  })
121
122
  )
123
+ ),
124
+ concat(
125
+ of<ConnectAppEvent>({
126
+ type: "ask-open-app",
127
+ appName,
128
+ }),
129
+ defer(() => from(openApp(transport, appName))).pipe(
130
+ concatMap(() =>
131
+ of<ConnectAppEvent>({
132
+ type: "device-permission-granted",
133
+ })
134
+ ),
135
+ catchError((e) => {
136
+ if (e && e instanceof TransportStatusError) {
137
+ // @ts-expect-error TransportStatusError to be typed on ledgerjs
138
+ switch (e.statusCode) {
139
+ case 0x6984:
140
+ case 0x6807:
141
+ return streamAppInstall({
142
+ transport,
143
+ appNames: [appName],
144
+ onSuccessObs: () =>
145
+ from(openAppFromDashboard(transport, appName)),
146
+ }) as Observable<ConnectAppEvent>;
147
+ case 0x6985:
148
+ case 0x5501:
149
+ return throwError(new UserRefusedOnDevice());
150
+ }
151
+ }
152
+
153
+ return throwError(e);
154
+ })
155
+ )
122
156
  )
123
157
  )
124
- ),
125
- of<ConnectAppEvent>({
126
- type: "ask-open-app",
127
- appName,
128
- }),
129
- defer(() => from(openApp(transport, appName))).pipe(
130
- concatMap(() =>
131
- of<ConnectAppEvent>({
132
- type: "device-permission-granted",
133
- })
134
- ),
135
- catchError((e) => {
136
- if (e && e instanceof TransportStatusError) {
137
- // @ts-expect-error TransportStatusError to be typed on ledgerjs
138
- switch (e.statusCode) {
139
- case 0x6984:
140
- case 0x6807:
141
- return streamAppInstall({
142
- transport,
143
- appNames: [appName],
144
- onSuccessObs: () =>
145
- from(openAppFromDashboard(transport, appName)),
146
- }) as Observable<ConnectAppEvent>;
147
- case 0x6985:
148
- case 0x5501:
149
- return throwError(new UserRefusedOnDevice());
150
- }
151
- }
152
-
153
- return throwError(e);
154
- })
155
158
  )
156
159
  );
157
160
 
@@ -17,7 +17,7 @@ export const counterValueFormatter = ({
17
17
  style: currency ? "currency" : "decimal",
18
18
  currency,
19
19
  notation: shorten ? "compact" : "standard",
20
- maximumFractionDigits: 8,
20
+ maximumFractionDigits: shorten ? 3 : 8,
21
21
  }).format(value);
22
22
  };
23
23
 
@@ -10,7 +10,5 @@ export const isNftTransaction = (transaction: Transaction): boolean => {
10
10
  };
11
11
 
12
12
  export function isNFTActive(currency: CryptoCurrency): boolean {
13
- return (
14
- getEnv("NFT") && getEnv("NFT_CURRENCIES").split(",").includes(currency.id)
15
- );
13
+ return getEnv("NFT_CURRENCIES").split(",").includes(currency.id);
16
14
  }