@ledgerhq/live-common 21.25.2 → 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 (253) hide show
  1. package/lib/__tests__/currencies.js +1 -1
  2. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.synced.unit.test.js +27 -26
  3. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.synced.unit.test.js.map +1 -1
  4. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js +9 -7
  5. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.js.map +1 -1
  6. package/lib/account/support.d.ts.map +1 -1
  7. package/lib/account/support.js +1 -25
  8. package/lib/account/support.js.map +1 -1
  9. package/lib/api/Ethereum.d.ts.map +1 -1
  10. package/lib/api/Ethereum.js +1 -4
  11. package/lib/api/Ethereum.js.map +1 -1
  12. package/lib/api/explorerConfig/index.d.ts.map +1 -1
  13. package/lib/api/explorerConfig/index.js +0 -4
  14. package/lib/api/explorerConfig/index.js.map +1 -1
  15. package/lib/apps/support.d.ts.map +1 -1
  16. package/lib/apps/support.js +2 -1
  17. package/lib/apps/support.js.map +1 -1
  18. package/lib/bridge/jsHelpers.js +1 -1
  19. package/lib/bridge/jsHelpers.js.map +1 -1
  20. package/lib/data/icons/react/index.d.ts +1 -0
  21. package/lib/data/icons/react/index.d.ts.map +1 -1
  22. package/lib/data/icons/react/index.js +4 -2
  23. package/lib/data/icons/react/index.js.map +1 -1
  24. package/lib/data/icons/react/sol.js +3 -3
  25. package/lib/data/icons/react/sol.js.map +1 -1
  26. package/lib/data/icons/react/tyc.d.ts +8 -0
  27. package/lib/data/icons/react/tyc.d.ts.map +1 -0
  28. package/lib/data/icons/react/tyc.js +33 -0
  29. package/lib/data/icons/react/tyc.js.map +1 -0
  30. package/lib/data/icons/reactNative/index.d.ts +1 -0
  31. package/lib/data/icons/reactNative/index.d.ts.map +1 -1
  32. package/lib/data/icons/reactNative/index.js +4 -2
  33. package/lib/data/icons/reactNative/index.js.map +1 -1
  34. package/lib/data/icons/reactNative/sol.js +3 -3
  35. package/lib/data/icons/reactNative/sol.js.map +1 -1
  36. package/lib/data/icons/reactNative/tyc.d.ts +8 -0
  37. package/lib/data/icons/reactNative/tyc.d.ts.map +1 -0
  38. package/lib/data/icons/reactNative/tyc.js +34 -0
  39. package/lib/data/icons/reactNative/tyc.js.map +1 -0
  40. package/lib/env.d.ts +15 -6
  41. package/lib/env.d.ts.map +1 -1
  42. package/lib/env.js +11 -2
  43. package/lib/env.js.map +1 -1
  44. package/lib/env.react.d.ts +1 -1
  45. package/lib/env.react.d.ts.map +1 -1
  46. package/lib/errors.d.ts +3 -0
  47. package/lib/errors.d.ts.map +1 -1
  48. package/lib/errors.js +3 -2
  49. package/lib/errors.js.map +1 -1
  50. package/lib/exchange/hw-app-exchange/Exchange.d.ts +12 -15
  51. package/lib/exchange/hw-app-exchange/Exchange.d.ts.map +1 -1
  52. package/lib/exchange/hw-app-exchange/Exchange.js +4 -13
  53. package/lib/exchange/hw-app-exchange/Exchange.js.map +1 -1
  54. package/lib/exchange/index.d.ts.map +1 -1
  55. package/lib/exchange/index.js +9 -2
  56. package/lib/exchange/index.js.map +1 -1
  57. package/lib/exchange/platform/completeExchange.d.ts +6 -0
  58. package/lib/exchange/platform/completeExchange.d.ts.map +1 -0
  59. package/lib/exchange/platform/completeExchange.js +24 -0
  60. package/lib/exchange/platform/completeExchange.js.map +1 -0
  61. package/lib/exchange/platform/serialization.d.ts +4 -0
  62. package/lib/exchange/platform/serialization.d.ts.map +1 -0
  63. package/lib/exchange/platform/serialization.js +57 -0
  64. package/lib/exchange/platform/serialization.js.map +1 -0
  65. package/lib/exchange/{swap → platform}/startExchange.d.ts +0 -0
  66. package/lib/exchange/platform/startExchange.d.ts.map +1 -0
  67. package/lib/exchange/{swap → platform}/startExchange.js +3 -3
  68. package/lib/exchange/platform/startExchange.js.map +1 -0
  69. package/lib/exchange/platform/transfer/completeExchange.d.ts +5 -0
  70. package/lib/exchange/platform/transfer/completeExchange.d.ts.map +1 -0
  71. package/lib/exchange/platform/transfer/completeExchange.js +198 -0
  72. package/lib/exchange/platform/transfer/completeExchange.js.map +1 -0
  73. package/lib/exchange/platform/transfer/index.d.ts +5 -0
  74. package/lib/exchange/platform/transfer/index.d.ts.map +1 -0
  75. package/lib/exchange/platform/transfer/index.js +49 -0
  76. package/lib/exchange/platform/transfer/index.js.map +1 -0
  77. package/lib/exchange/platform/types.d.ts +59 -0
  78. package/lib/exchange/platform/types.d.ts.map +1 -0
  79. package/lib/exchange/platform/types.js +3 -0
  80. package/lib/exchange/platform/types.js.map +1 -0
  81. package/lib/exchange/sell/checkSignatureAndPrepare.js +1 -2
  82. package/lib/exchange/sell/checkSignatureAndPrepare.js.map +1 -1
  83. package/lib/exchange/sell/getTransactionId.js +1 -2
  84. package/lib/exchange/sell/getTransactionId.js.map +1 -1
  85. package/lib/exchange/sell/index.d.ts +6 -0
  86. package/lib/exchange/sell/index.d.ts.map +1 -1
  87. package/lib/exchange/sell/index.js +3 -3
  88. package/lib/exchange/sell/index.js.map +1 -1
  89. package/lib/exchange/swap/completeExchange.d.ts +2 -13
  90. package/lib/exchange/swap/completeExchange.d.ts.map +1 -1
  91. package/lib/exchange/swap/completeExchange.js +2 -4
  92. package/lib/exchange/swap/completeExchange.js.map +1 -1
  93. package/lib/exchange/swap/initSwap.d.ts.map +1 -1
  94. package/lib/exchange/swap/initSwap.js +3 -4
  95. package/lib/exchange/swap/initSwap.js.map +1 -1
  96. package/lib/exchange/swap/types.d.ts +0 -12
  97. package/lib/exchange/swap/types.d.ts.map +1 -1
  98. package/lib/exchange/testCurrencyConfig/data/coins.d.ts +8 -0
  99. package/lib/exchange/testCurrencyConfig/data/coins.d.ts.map +1 -0
  100. package/lib/exchange/testCurrencyConfig/data/coins.js +21 -0
  101. package/lib/exchange/testCurrencyConfig/data/coins.js.map +1 -0
  102. package/lib/exchange/testCurrencyConfig/index.d.ts +8 -0
  103. package/lib/exchange/testCurrencyConfig/index.d.ts.map +1 -0
  104. package/lib/exchange/testCurrencyConfig/index.js +68 -0
  105. package/lib/exchange/testCurrencyConfig/index.js.map +1 -0
  106. package/lib/families/algorand/api/algodv2.d.ts +2 -1
  107. package/lib/families/algorand/api/algodv2.d.ts.map +1 -1
  108. package/lib/families/algorand/api/algodv2.js +2 -2
  109. package/lib/families/algorand/api/algodv2.js.map +1 -1
  110. package/lib/families/algorand/js-broadcast.js +1 -1
  111. package/lib/families/algorand/js-broadcast.js.map +1 -1
  112. package/lib/families/algorand/js-signOperation.d.ts.map +1 -1
  113. package/lib/families/algorand/js-signOperation.js +1 -1
  114. package/lib/families/algorand/js-signOperation.js.map +1 -1
  115. package/lib/families/bitcoin/test-dataset.js +1 -1
  116. package/lib/families/bitcoin/test-dataset.js.map +1 -1
  117. package/lib/families/bitcoin/wallet-btc/wallet.d.ts.map +1 -1
  118. package/lib/families/bitcoin/wallet-btc/wallet.js +8 -2
  119. package/lib/families/bitcoin/wallet-btc/wallet.js.map +1 -1
  120. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js +1 -1
  121. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js.map +1 -1
  122. package/lib/families/ethereum/modules/send.d.ts.map +1 -1
  123. package/lib/families/ethereum/modules/send.js +3 -1
  124. package/lib/families/ethereum/modules/send.js.map +1 -1
  125. package/lib/families/ethereum/nft.integration.test.js +1 -36
  126. package/lib/families/ethereum/nft.integration.test.js.map +1 -1
  127. package/lib/families/ethereum/specs.d.ts.map +1 -1
  128. package/lib/families/ethereum/specs.js +2 -0
  129. package/lib/families/ethereum/specs.js.map +1 -1
  130. package/lib/families/ethereum/synchronisation.d.ts.map +1 -1
  131. package/lib/families/ethereum/synchronisation.js +2 -7
  132. package/lib/families/ethereum/synchronisation.js.map +1 -1
  133. package/lib/families/tezos/bridge/js.d.ts.map +1 -1
  134. package/lib/families/tezos/bridge/js.js +19 -20
  135. package/lib/families/tezos/bridge/js.js.map +1 -1
  136. package/lib/families/tezos/hw-getAddress.d.ts.map +1 -1
  137. package/lib/families/tezos/hw-getAddress.js +1 -3
  138. package/lib/families/tezos/hw-getAddress.js.map +1 -1
  139. package/lib/families/tezos/synchronisation.d.ts.map +1 -1
  140. package/lib/families/tezos/synchronisation.js +1 -1
  141. package/lib/families/tezos/synchronisation.js.map +1 -1
  142. package/lib/hw/actions/app.d.ts +3 -0
  143. package/lib/hw/actions/app.d.ts.map +1 -1
  144. package/lib/hw/actions/app.js +7 -1
  145. package/lib/hw/actions/app.js.map +1 -1
  146. package/lib/hw/actions/completeExchange.d.ts +1 -0
  147. package/lib/hw/actions/completeExchange.d.ts.map +1 -1
  148. package/lib/hw/actions/completeExchange.js +4 -3
  149. package/lib/hw/actions/completeExchange.js.map +1 -1
  150. package/lib/hw/connectApp.d.ts +5 -0
  151. package/lib/hw/connectApp.d.ts.map +1 -1
  152. package/lib/hw/connectApp.js +37 -26
  153. package/lib/hw/connectApp.js.map +1 -1
  154. package/lib/market/MarketDataProvider.d.ts +26 -0
  155. package/lib/market/MarketDataProvider.d.ts.map +1 -0
  156. package/lib/market/MarketDataProvider.js +339 -0
  157. package/lib/market/MarketDataProvider.js.map +1 -0
  158. package/lib/market/api/api.d.ts +15 -0
  159. package/lib/market/api/api.d.ts.map +1 -0
  160. package/lib/market/api/api.js +261 -0
  161. package/lib/market/api/api.js.map +1 -0
  162. package/lib/market/api/api.mock.d.ts +15 -0
  163. package/lib/market/api/api.mock.d.ts.map +1 -0
  164. package/lib/market/api/api.mock.js +454 -0
  165. package/lib/market/api/api.mock.js.map +1 -0
  166. package/lib/market/types.d.ts +83 -0
  167. package/lib/market/types.d.ts.map +1 -0
  168. package/lib/market/types.js +3 -0
  169. package/lib/market/types.js.map +1 -0
  170. package/lib/market/utils/countervalueFormatter.d.ts +8 -0
  171. package/lib/market/utils/countervalueFormatter.d.ts.map +1 -0
  172. package/lib/market/utils/countervalueFormatter.js +18 -0
  173. package/lib/market/utils/countervalueFormatter.js.map +1 -0
  174. package/lib/market/utils/rangeDataTable.d.ts +10 -0
  175. package/lib/market/utils/rangeDataTable.d.ts.map +1 -0
  176. package/lib/market/utils/rangeDataTable.js +36 -0
  177. package/lib/market/utils/rangeDataTable.js.map +1 -0
  178. package/lib/nft/support.d.ts.map +1 -1
  179. package/lib/nft/support.js +1 -1
  180. package/lib/nft/support.js.map +1 -1
  181. package/lib/platform/PlatformAppProvider/api/api.mock.d.ts.map +1 -1
  182. package/lib/platform/PlatformAppProvider/api/api.mock.js +27 -0
  183. package/lib/platform/PlatformAppProvider/api/api.mock.js.map +1 -1
  184. package/package.json +10 -10
  185. package/src/__tests__/__snapshots__/all.libcore.ts.snap +221 -212
  186. package/src/__tests__/currencies.ts +1 -1
  187. package/src/__tests__/families/bitcoin/wallet-btc/xpub.synced.unit.test.ts +26 -25
  188. package/src/__tests__/families/bitcoin/wallet-btc/xpub.syncing.integration.test.ts +2 -0
  189. package/src/account/support.ts +1 -25
  190. package/src/api/Ethereum.ts +1 -4
  191. package/src/api/explorerConfig/index.ts +0 -4
  192. package/src/apps/support.ts +1 -0
  193. package/src/bridge/jsHelpers.ts +1 -1
  194. package/src/data/icons/react/index.tsx +1 -0
  195. package/src/data/icons/react/sol.tsx +1 -1
  196. package/src/data/icons/react/tyc.tsx +12 -0
  197. package/src/data/icons/reactNative/index.tsx +1 -0
  198. package/src/data/icons/reactNative/sol.tsx +1 -1
  199. package/src/data/icons/reactNative/tyc.tsx +13 -0
  200. package/src/data/icons/svg/SOL.svg +8 -1
  201. package/src/data/icons/svg/TYC.svg +6 -0
  202. package/src/env.ts +11 -2
  203. package/src/errors.ts +3 -0
  204. package/src/exchange/hw-app-exchange/Exchange.ts +22 -18
  205. package/src/exchange/index.ts +19 -1
  206. package/src/exchange/platform/completeExchange.ts +42 -0
  207. package/src/exchange/platform/serialization.ts +78 -0
  208. package/src/exchange/{swap → platform}/startExchange.ts +6 -2
  209. package/src/exchange/platform/transfer/completeExchange.ts +187 -0
  210. package/src/exchange/platform/transfer/index.ts +66 -0
  211. package/src/exchange/platform/types.ts +76 -0
  212. package/src/exchange/sell/checkSignatureAndPrepare.ts +2 -2
  213. package/src/exchange/sell/getTransactionId.ts +2 -2
  214. package/src/exchange/sell/index.ts +1 -1
  215. package/src/exchange/swap/completeExchange.ts +41 -50
  216. package/src/exchange/swap/initSwap.ts +4 -7
  217. package/src/exchange/swap/types.ts +1 -14
  218. package/src/exchange/testCurrencyConfig/data/coins.ts +20 -0
  219. package/src/exchange/testCurrencyConfig/index.ts +24 -0
  220. package/src/families/algorand/api/algodv2.ts +2 -2
  221. package/src/families/algorand/js-broadcast.ts +1 -1
  222. package/src/families/algorand/js-signOperation.ts +8 -3
  223. package/src/families/bitcoin/test-dataset.ts +1 -1
  224. package/src/families/bitcoin/wallet-btc/wallet.ts +6 -2
  225. package/src/families/ethereum/datasets/ethereum.scanAccounts.1.ts +43 -43
  226. package/src/families/ethereum/modules/send.ts +3 -0
  227. package/src/families/ethereum/nft.integration.test.ts +1 -18
  228. package/src/families/ethereum/specs.ts +2 -0
  229. package/src/families/ethereum/synchronisation.ts +1 -6
  230. package/src/families/tezos/bridge/js.ts +41 -40
  231. package/src/families/tezos/hw-getAddress.ts +1 -3
  232. package/src/families/tezos/synchronisation.ts +4 -3
  233. package/src/hw/actions/app.ts +17 -1
  234. package/src/hw/actions/completeExchange.ts +9 -3
  235. package/src/hw/connectApp.ts +53 -31
  236. package/src/market/MarketDataProvider.tsx +440 -0
  237. package/src/market/api/api.mock.ts +374 -0
  238. package/src/market/api/api.ts +227 -0
  239. package/src/market/types.ts +92 -0
  240. package/src/market/utils/countervalueFormatter.ts +24 -0
  241. package/src/market/utils/rangeDataTable.ts +40 -0
  242. package/src/nft/support.ts +1 -3
  243. package/src/platform/PlatformAppProvider/api/api.mock.ts +27 -0
  244. package/lib/exchange/swap/startExchange.d.ts.map +0 -1
  245. package/lib/exchange/swap/startExchange.js.map +0 -1
  246. package/lib/families/ethereum/versions.d.ts +0 -2
  247. package/lib/families/ethereum/versions.d.ts.map +0 -1
  248. package/lib/families/ethereum/versions.js +0 -5
  249. package/lib/families/ethereum/versions.js.map +0 -1
  250. package/src/.DS_Store +0 -0
  251. package/src/__tests__/.DS_Store +0 -0
  252. package/src/currencies/__snapshots__/.DS_Store +0 -0
  253. package/src/families/ethereum/versions.ts +0 -1
@@ -229,7 +229,6 @@ class BitcoinLikeWallet {
229
229
  btc,
230
230
  fromAccount,
231
231
  txInfo,
232
- hasTimestamp,
233
232
  initialTimestamp,
234
233
  additionals,
235
234
  hasExtraData,
@@ -237,7 +236,7 @@ class BitcoinLikeWallet {
237
236
  onDeviceSignatureGranted,
238
237
  onDeviceStreaming,
239
238
  } = params;
240
-
239
+ let hasTimestamp = params.hasTimestamp;
241
240
  let length = txInfo.outputs.reduce((sum, output) => {
242
241
  return sum + 8 + output.script.length + 1;
243
242
  }, 1);
@@ -270,6 +269,11 @@ class BitcoinLikeWallet {
270
269
  number | null | undefined
271
270
  ][];
272
271
  const inputs: Inputs = txInfo.inputs.map((i) => {
272
+ if (additionals && additionals.includes("peercoin")) {
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
+ const version = i.txHex.substring(0, 8);
275
+ hasTimestamp = version === "01000000" || version === "02000000";
276
+ }
273
277
  log("hw", `splitTransaction`, {
274
278
  transactionHex: i.txHex,
275
279
  isSegwitSupported: true,
@@ -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
  };
@@ -189,6 +189,9 @@ const send: ModeModule = {
189
189
  ];
190
190
  }
191
191
  },
192
+
193
+ // This is resolution config is necessary for plugins like Lido and stuff cause they use the send mode
194
+ getResolutionConfig: () => ({ erc20: true, externalPlugins: true }),
192
195
  };
193
196
 
194
197
  function serializeTransactionData(
@@ -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
 
@@ -406,6 +406,7 @@ const bsc: AppSpec<Transaction> = {
406
406
  model: DeviceModelId.nanoS,
407
407
  appName: "Binance Smart Chain",
408
408
  },
409
+ dependency: "Ethereum",
409
410
  testTimeout: 2 * 60 * 1000,
410
411
  transactionCheck: ({ maxSpendable }) => {
411
412
  invariant(
@@ -452,6 +453,7 @@ const polygon: AppSpec<Transaction> = {
452
453
  model: DeviceModelId.nanoS,
453
454
  appName: "Polygon",
454
455
  },
456
+ dependency: "Ethereum",
455
457
  testTimeout: 2 * 60 * 1000,
456
458
  transactionCheck: ({ maxSpendable }) => {
457
459
  invariant(
@@ -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);
@@ -30,6 +30,7 @@ import { getEnv } from "../../../env";
30
30
  import { signOperation } from "../signOperation";
31
31
  import { patchOperationWithHash } from "../../../operation";
32
32
  import { log } from "@ledgerhq/logs";
33
+ import { InvalidAddressBecauseAlreadyDelegated } from "../../../errors";
33
34
 
34
35
  const receive = makeAccountBridgeReceive();
35
36
 
@@ -70,54 +71,52 @@ const getTransactionStatus = async (
70
71
  const { tezosResources } = account;
71
72
  if (!tezosResources) throw new Error("tezosResources is missing");
72
73
 
73
- if (!t.taquitoError) {
74
- if (t.mode !== "undelegate") {
75
- if (account.freshAddress === t.recipient) {
76
- errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
77
- } else {
78
- const { recipientError, recipientWarning } = await validateRecipient(
79
- account.currency,
80
- t.recipient
81
- );
74
+ if (t.mode !== "undelegate") {
75
+ if (account.freshAddress === t.recipient) {
76
+ errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
77
+ } else {
78
+ const { recipientError, recipientWarning } = await validateRecipient(
79
+ account.currency,
80
+ t.recipient
81
+ );
82
82
 
83
- if (recipientError) {
84
- errors.recipient = recipientError;
85
- }
83
+ if (recipientError) {
84
+ errors.recipient = recipientError;
85
+ }
86
86
 
87
- if (recipientWarning) {
88
- warnings.recipient = recipientWarning;
89
- }
87
+ if (recipientWarning) {
88
+ warnings.recipient = recipientWarning;
90
89
  }
91
90
  }
91
+ }
92
92
 
93
- if (t.mode === "send") {
94
- if (!errors.amount && t.amount.eq(0)) {
95
- errors.amount = new AmountRequired();
96
- } else if (!errors.amount && t.amount.lt(0)) {
97
- errors.amount = new NotEnoughBalance();
98
- } else if (t.amount.gt(0) && estimatedFees.times(10).gt(t.amount)) {
99
- warnings.feeTooHigh = new FeeTooHigh();
100
- }
93
+ if (t.mode === "send") {
94
+ if (!errors.amount && t.amount.eq(0)) {
95
+ errors.amount = new AmountRequired();
96
+ } else if (!errors.amount && t.amount.lt(0)) {
97
+ errors.amount = new NotEnoughBalance();
98
+ } else if (t.amount.gt(0) && estimatedFees.times(10).gt(t.amount)) {
99
+ warnings.feeTooHigh = new FeeTooHigh();
100
+ }
101
101
 
102
- const thresholdWarning = 0.5 * 10 ** account.currency.units[0].magnitude;
103
-
104
- if (
105
- !errors.amount &&
106
- account.balance
107
- .minus(t.amount)
108
- .minus(estimatedFees)
109
- .lt(thresholdWarning)
110
- ) {
111
- if (isAccountDelegating(account)) {
112
- if (t.useAllAmount) {
113
- errors.amount = new RecommendUndelegation();
114
- } else {
115
- warnings.amount = new RecommendUndelegation();
116
- }
102
+ const thresholdWarning = 0.5 * 10 ** account.currency.units[0].magnitude;
103
+
104
+ if (
105
+ !errors.amount &&
106
+ account.balance.minus(t.amount).minus(estimatedFees).lt(thresholdWarning)
107
+ ) {
108
+ if (isAccountDelegating(account)) {
109
+ if (t.useAllAmount) {
110
+ errors.amount = new RecommendUndelegation();
111
+ } else {
112
+ warnings.amount = new RecommendUndelegation();
117
113
  }
118
114
  }
119
115
  }
120
- } else {
116
+ }
117
+
118
+ // if we also have taquitoError, we interprete them and they override the previously inferred errors
119
+ if (t.taquitoError) {
121
120
  log("taquitoerror", String(t.taquitoError));
122
121
 
123
122
  // remap taquito errors
@@ -127,7 +126,9 @@ const getTransactionStatus = async (
127
126
  } else {
128
127
  errors.amount = new NotEnoughBalanceToDelegate();
129
128
  }
130
- } else {
129
+ } else if (t.taquitoError.endsWith("delegate.unchanged")) {
130
+ errors.recipient = new InvalidAddressBecauseAlreadyDelegated();
131
+ } else if (!errors.amount) {
131
132
  // unidentified error case
132
133
  errors.amount = new Error(t.taquitoError);
133
134
  }
@@ -3,9 +3,7 @@ import type { Resolver } from "../../hw/getAddress/types";
3
3
 
4
4
  const resolver: Resolver = async (transport, { path, verify }) => {
5
5
  const xtz = new Xtz(transport);
6
- const r = await xtz.getAddress(path, {
7
- verify,
8
- });
6
+ const r = await xtz.getAddress(path, { verify });
9
7
  return { ...r, path };
10
8
  };
11
9
 
@@ -48,9 +48,10 @@ export const getAccountShape: GetAccountShape = async (infoInput) => {
48
48
  derivationMode,
49
49
  });
50
50
 
51
- const initialStableOperations = initialAccount
52
- ? initialAccount.operations
53
- : [];
51
+ const initialStableOperations =
52
+ initialAccount && initialAccount.id === accountId
53
+ ? initialAccount.operations
54
+ : [];
54
55
 
55
56
  // fetch transactions, incrementally if possible
56
57
  const mostRecentStableOperation = initialStableOperations[0];
@@ -40,6 +40,7 @@ import type { Device, Action } from "./types";
40
40
  import { shouldUpgrade } from "../../apps";
41
41
  import { ConnectAppTimeout } from "../../errors";
42
42
  import perFamilyAccount from "../../generated/account";
43
+ import type { DeviceInfo, FirmwareUpdateContext } from "../../types/manager";
43
44
 
44
45
  type State = {
45
46
  isLoading: boolean;
@@ -60,6 +61,8 @@ type State = {
60
61
  allowManagerRequestedWording: string | null | undefined;
61
62
  allowManagerGranted: boolean;
62
63
  device: Device | null | undefined;
64
+ deviceInfo?: DeviceInfo | null | undefined;
65
+ latestFirmware?: FirmwareUpdateContext | null | undefined;
63
66
  error: Error | null | undefined;
64
67
  derivation:
65
68
  | {
@@ -146,6 +149,8 @@ const getInitialState = (device?: Device | null | undefined): State => ({
146
149
  allowManagerRequestedWording: null,
147
150
  allowManagerGranted: false,
148
151
  device: null,
152
+ deviceInfo: null,
153
+ latestFirmware: null,
149
154
  opened: false,
150
155
  appAndVersion: null,
151
156
  error: null,
@@ -160,6 +165,13 @@ const reducer = (state: State, e: Event): State => {
160
165
  case "unresponsiveDevice":
161
166
  return { ...state, unresponsive: true };
162
167
 
168
+ case "device-update-last-seen":
169
+ return {
170
+ ...state,
171
+ deviceInfo: e.deviceInfo,
172
+ latestFirmware: e.latestFirmware,
173
+ };
174
+
163
175
  case "disconnected":
164
176
  return { ...getInitialState(), isLoading: !!e.expected };
165
177
 
@@ -585,7 +597,11 @@ export const createAction = (
585
597
  scan(reducer, getInitialState()), // tap((s) => console.log("connectApp state", s)),
586
598
  // we debounce the UI state to not blink on the UI
587
599
  debounce((s: State) => {
588
- if (s.allowOpeningRequestedWording || s.allowOpeningGranted) {
600
+ if (
601
+ s.allowOpeningRequestedWording ||
602
+ s.allowOpeningGranted ||
603
+ s.deviceInfo
604
+ ) {
589
605
  // no debounce for allow event
590
606
  return EMPTY;
591
607
  }
@@ -11,6 +11,7 @@ type State = {
11
11
  completeExchangeResult: Transaction | null | undefined;
12
12
  completeExchangeError: Error | null | undefined;
13
13
  freezeReduxDevice: boolean;
14
+ completeExchangeRequested: boolean;
14
15
  isLoading: boolean;
15
16
  };
16
17
 
@@ -61,14 +62,19 @@ const mapResult = ({
61
62
  const initialState: State = {
62
63
  completeExchangeResult: null,
63
64
  completeExchangeError: null,
65
+ completeExchangeRequested: false,
64
66
  freezeReduxDevice: false,
65
- isLoading: false,
67
+ isLoading: true,
66
68
  };
67
69
 
68
70
  const reducer = (state: State, e: ExchangeRequestEvent) => {
69
71
  switch (e.type) {
70
72
  case "complete-exchange":
71
- return { ...state, isLoading: true, freezeReduxDevice: true };
73
+ return {
74
+ ...state,
75
+ completeExchangeStarted: true,
76
+ freezeReduxDevice: true,
77
+ };
72
78
 
73
79
  case "complete-exchange-error":
74
80
  return {
@@ -81,7 +87,7 @@ const reducer = (state: State, e: ExchangeRequestEvent) => {
81
87
  return {
82
88
  ...state,
83
89
  completeExchangeRequested: true,
84
- isLoading: true,
90
+ isLoading: false,
85
91
  };
86
92
  case "complete-exchange-result":
87
93
  return {
@@ -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,
@@ -55,6 +55,11 @@ export type ConnectAppEvent =
55
55
  type: "disconnected";
56
56
  expected?: boolean;
57
57
  }
58
+ | {
59
+ type: "device-update-last-seen";
60
+ deviceInfo: DeviceInfo;
61
+ latestFirmware: FirmwareUpdateContext | null | undefined;
62
+ }
58
63
  | {
59
64
  type: "device-permission-requested";
60
65
  wording: string;
@@ -102,37 +107,54 @@ export const openAppFromDashboard = (
102
107
  transport: Transport,
103
108
  appName: string
104
109
  ): Observable<ConnectAppEvent> =>
105
- concat(
106
- of<ConnectAppEvent>({
107
- type: "ask-open-app",
108
- appName,
109
- }),
110
- defer(() => from(openApp(transport, appName))).pipe(
111
- concatMap(() =>
112
- of<ConnectAppEvent>({
113
- type: "device-permission-granted",
114
- })
115
- ),
116
- catchError((e) => {
117
- if (e && e instanceof TransportStatusError) {
118
- // @ts-expect-error TransportStatusError to be typed on ledgerjs
119
- switch (e.statusCode) {
120
- case 0x6984:
121
- case 0x6807:
122
- return streamAppInstall({
123
- transport,
124
- appNames: [appName],
125
- onSuccessObs: () =>
126
- from(openAppFromDashboard(transport, appName)),
127
- }) as Observable<ConnectAppEvent>;
128
- case 0x6985:
129
- case 0x5501:
130
- return throwError(new UserRefusedOnDevice());
131
- }
132
- }
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.
115
+ from(manager.getLatestFirmwareForDevice(deviceInfo)).pipe(
116
+ concatMap((latestFirmware) =>
117
+ of<ConnectAppEvent>({
118
+ type: "device-update-last-seen",
119
+ deviceInfo,
120
+ latestFirmware,
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
+ }
133
152
 
134
- return throwError(e);
135
- })
153
+ return throwError(e);
154
+ })
155
+ )
156
+ )
157
+ )
136
158
  )
137
159
  );
138
160