@ledgerhq/live-common 29.1.0 → 29.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) hide show
  1. package/lib/account/serialization.d.ts +0 -6
  2. package/lib/account/serialization.d.ts.map +1 -1
  3. package/lib/account/serialization.js +11 -50
  4. package/lib/account/serialization.js.map +1 -1
  5. package/lib/apps/hw.js +1 -1
  6. package/lib/apps/hw.js.map +1 -1
  7. package/lib/countervalues/react.d.ts.map +1 -1
  8. package/lib/countervalues/react.js +1 -1
  9. package/lib/countervalues/react.js.map +1 -1
  10. package/lib/data/icons/react/gm.d.ts +8 -0
  11. package/lib/data/icons/react/gm.d.ts.map +1 -0
  12. package/lib/data/icons/react/gm.js +36 -0
  13. package/lib/data/icons/react/gm.js.map +1 -0
  14. package/lib/data/icons/react/index.d.ts +1 -0
  15. package/lib/data/icons/react/index.d.ts.map +1 -1
  16. package/lib/data/icons/react/index.js +9 -7
  17. package/lib/data/icons/react/index.js.map +1 -1
  18. package/lib/data/icons/reactNative/gm.d.ts +8 -0
  19. package/lib/data/icons/reactNative/gm.d.ts.map +1 -0
  20. package/lib/data/icons/reactNative/gm.js +37 -0
  21. package/lib/data/icons/reactNative/gm.js.map +1 -0
  22. package/lib/data/icons/reactNative/index.d.ts +1 -0
  23. package/lib/data/icons/reactNative/index.d.ts.map +1 -1
  24. package/lib/data/icons/reactNative/index.js +9 -7
  25. package/lib/data/icons/reactNative/index.js.map +1 -1
  26. package/lib/families/algorand/bridge/js.d.ts.map +1 -1
  27. package/lib/families/algorand/bridge/js.js +0 -1
  28. package/lib/families/algorand/bridge/js.js.map +1 -1
  29. package/lib/families/algorand/bridge/mock.d.ts.map +1 -1
  30. package/lib/families/algorand/bridge/mock.js +0 -1
  31. package/lib/families/algorand/bridge/mock.js.map +1 -1
  32. package/lib/families/algorand/serialization.d.ts +0 -1
  33. package/lib/families/algorand/serialization.d.ts.map +1 -1
  34. package/lib/families/algorand/serialization.js +1 -16
  35. package/lib/families/algorand/serialization.js.map +1 -1
  36. package/lib/families/bitcoin/bridge/js.d.ts.map +1 -1
  37. package/lib/families/bitcoin/bridge/js.js +4 -1
  38. package/lib/families/bitcoin/bridge/js.js.map +1 -1
  39. package/lib/families/bitcoin/descriptor.test.js +2 -0
  40. package/lib/families/bitcoin/descriptor.test.js.map +1 -1
  41. package/lib/families/bitcoin/satstack.test.js +2 -0
  42. package/lib/families/bitcoin/satstack.test.js.map +1 -1
  43. package/lib/families/bitcoin/serialization.d.ts +3 -0
  44. package/lib/families/bitcoin/serialization.d.ts.map +1 -1
  45. package/lib/families/bitcoin/serialization.js +16 -1
  46. package/lib/families/bitcoin/serialization.js.map +1 -1
  47. package/lib/families/bitcoin/serialization.test.d.ts +2 -0
  48. package/lib/families/bitcoin/serialization.test.d.ts.map +1 -0
  49. package/lib/families/bitcoin/serialization.test.js +110 -0
  50. package/lib/families/bitcoin/serialization.test.js.map +1 -0
  51. package/lib/families/cardano/bridge/js.d.ts.map +1 -1
  52. package/lib/families/cardano/bridge/js.js +0 -1
  53. package/lib/families/cardano/bridge/js.js.map +1 -1
  54. package/lib/families/cardano/serialization.d.ts +0 -1
  55. package/lib/families/cardano/serialization.d.ts.map +1 -1
  56. package/lib/families/cardano/serialization.js +1 -18
  57. package/lib/families/cardano/serialization.js.map +1 -1
  58. package/lib/families/celo/bridge/js.d.ts.map +1 -1
  59. package/lib/families/celo/bridge/js.js +0 -1
  60. package/lib/families/celo/bridge/js.js.map +1 -1
  61. package/lib/families/celo/serialization.d.ts +0 -1
  62. package/lib/families/celo/serialization.d.ts.map +1 -1
  63. package/lib/families/celo/serialization.js +1 -15
  64. package/lib/families/celo/serialization.js.map +1 -1
  65. package/lib/families/cosmos/bridge/js.d.ts.map +1 -1
  66. package/lib/families/cosmos/bridge/js.js +0 -2
  67. package/lib/families/cosmos/bridge/js.js.map +1 -1
  68. package/lib/families/cosmos/js-synchronisation.d.ts +1 -3
  69. package/lib/families/cosmos/js-synchronisation.d.ts.map +1 -1
  70. package/lib/families/cosmos/js-synchronisation.js +1 -16
  71. package/lib/families/cosmos/js-synchronisation.js.map +1 -1
  72. package/lib/families/crypto_org/api/sdk.d.ts.map +1 -1
  73. package/lib/families/crypto_org/api/sdk.js +6 -9
  74. package/lib/families/crypto_org/api/sdk.js.map +1 -1
  75. package/lib/families/crypto_org/js-buildTransaction.d.ts.map +1 -1
  76. package/lib/families/crypto_org/js-buildTransaction.js +3 -2
  77. package/lib/families/crypto_org/js-buildTransaction.js.map +1 -1
  78. package/lib/families/crypto_org/js-signOperation.js +1 -1
  79. package/lib/families/crypto_org/js-signOperation.js.map +1 -1
  80. package/lib/families/crypto_org/logic.d.ts +0 -16
  81. package/lib/families/crypto_org/logic.d.ts.map +1 -1
  82. package/lib/families/crypto_org/logic.js +6 -20
  83. package/lib/families/crypto_org/logic.js.map +1 -1
  84. package/lib/families/elrond/bridge/js.d.ts.map +1 -1
  85. package/lib/families/elrond/bridge/js.js +0 -2
  86. package/lib/families/elrond/bridge/js.js.map +1 -1
  87. package/lib/families/elrond/js-synchronisation.d.ts +1 -3
  88. package/lib/families/elrond/js-synchronisation.d.ts.map +1 -1
  89. package/lib/families/elrond/js-synchronisation.js +1 -16
  90. package/lib/families/elrond/js-synchronisation.js.map +1 -1
  91. package/lib/families/ethereum/__tests__/nft.integration.test.js +0 -7
  92. package/lib/families/ethereum/__tests__/nft.integration.test.js.map +1 -1
  93. package/lib/families/hedera/api/mirror.d.ts.map +1 -1
  94. package/lib/families/hedera/api/mirror.js +40 -16
  95. package/lib/families/hedera/api/mirror.js.map +1 -1
  96. package/lib/families/hedera/api/network.js +6 -1
  97. package/lib/families/hedera/api/network.js.map +1 -1
  98. package/lib/families/hedera/bridge.integration.test.js +1 -2
  99. package/lib/families/hedera/bridge.integration.test.js.map +1 -1
  100. package/lib/families/hedera/js-estimateMaxSpendable.d.ts.map +1 -1
  101. package/lib/families/hedera/js-estimateMaxSpendable.js +55 -11
  102. package/lib/families/hedera/js-estimateMaxSpendable.js.map +1 -1
  103. package/lib/families/hedera/js-getTransactionStatus.d.ts.map +1 -1
  104. package/lib/families/hedera/js-getTransactionStatus.js +5 -2
  105. package/lib/families/hedera/js-getTransactionStatus.js.map +1 -1
  106. package/lib/families/hedera/js-signOperation.js +23 -16
  107. package/lib/families/hedera/js-signOperation.js.map +1 -1
  108. package/lib/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts +2 -0
  109. package/lib/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts.map +1 -0
  110. package/lib/families/hedera/tests/{js-estimateMaxSpendable.test.js → js-estimateMaxSpendable.integration.test.js} +27 -3
  111. package/lib/families/hedera/tests/js-estimateMaxSpendable.integration.test.js.map +1 -0
  112. package/lib/families/hedera/tests/utils.integration.test.d.ts +2 -0
  113. package/lib/families/hedera/tests/utils.integration.test.d.ts.map +1 -0
  114. package/lib/families/hedera/tests/{utils.test.js → utils.integration.test.js} +28 -4
  115. package/lib/families/hedera/tests/utils.integration.test.js.map +1 -0
  116. package/lib/families/hedera/utils.d.ts +1 -1
  117. package/lib/families/hedera/utils.d.ts.map +1 -1
  118. package/lib/families/hedera/utils.js +40 -14
  119. package/lib/families/hedera/utils.js.map +1 -1
  120. package/lib/families/near/bridge/js.d.ts.map +1 -1
  121. package/lib/families/near/bridge/js.js +1 -2
  122. package/lib/families/near/bridge/js.js.map +1 -1
  123. package/lib/families/near/serialization.d.ts +0 -1
  124. package/lib/families/near/serialization.d.ts.map +1 -1
  125. package/lib/families/near/serialization.js +1 -15
  126. package/lib/families/near/serialization.js.map +1 -1
  127. package/lib/families/solana/api/chain/web3.d.ts +1 -0
  128. package/lib/families/solana/api/chain/web3.d.ts.map +1 -1
  129. package/lib/families/solana/api/chain/web3.js +16 -1
  130. package/lib/families/solana/api/chain/web3.js.map +1 -1
  131. package/lib/families/solana/bridge/bridge.d.ts.map +1 -1
  132. package/lib/families/solana/bridge/bridge.js +0 -1
  133. package/lib/families/solana/bridge/bridge.js.map +1 -1
  134. package/lib/families/solana/bridge.integration.test.js +7 -4
  135. package/lib/families/solana/bridge.integration.test.js.map +1 -1
  136. package/lib/families/solana/js-estimateMaxSpendable.d.ts.map +1 -1
  137. package/lib/families/solana/js-estimateMaxSpendable.js +9 -6
  138. package/lib/families/solana/js-estimateMaxSpendable.js.map +1 -1
  139. package/lib/families/solana/js-prepareTransaction.d.ts.map +1 -1
  140. package/lib/families/solana/js-prepareTransaction.js +15 -8
  141. package/lib/families/solana/js-prepareTransaction.js.map +1 -1
  142. package/lib/families/solana/logic.d.ts +0 -1
  143. package/lib/families/solana/logic.d.ts.map +1 -1
  144. package/lib/families/solana/logic.js +1 -4
  145. package/lib/families/solana/logic.js.map +1 -1
  146. package/lib/families/solana/serialization.d.ts +0 -1
  147. package/lib/families/solana/serialization.d.ts.map +1 -1
  148. package/lib/families/solana/serialization.js +1 -15
  149. package/lib/families/solana/serialization.js.map +1 -1
  150. package/lib/families/tezos/bridge/js.d.ts.map +1 -1
  151. package/lib/families/tezos/bridge/js.js +0 -1
  152. package/lib/families/tezos/bridge/js.js.map +1 -1
  153. package/lib/families/tezos/serialization.d.ts +0 -1
  154. package/lib/families/tezos/serialization.d.ts.map +1 -1
  155. package/lib/families/tezos/serialization.js +1 -18
  156. package/lib/families/tezos/serialization.js.map +1 -1
  157. package/lib/families/tron/bridge/js.d.ts.map +1 -1
  158. package/lib/families/tron/bridge/js.js +0 -1
  159. package/lib/families/tron/bridge/js.js.map +1 -1
  160. package/lib/families/tron/serialization.d.ts +0 -1
  161. package/lib/families/tron/serialization.d.ts.map +1 -1
  162. package/lib/families/tron/serialization.js +1 -15
  163. package/lib/families/tron/serialization.js.map +1 -1
  164. package/lib/hw/deviceAccess.d.ts.map +1 -1
  165. package/lib/hw/deviceAccess.js +4 -2
  166. package/lib/hw/deviceAccess.js.map +1 -1
  167. package/lib/hw/extractOnboardingState.d.ts +5 -3
  168. package/lib/hw/extractOnboardingState.d.ts.map +1 -1
  169. package/lib/hw/extractOnboardingState.js +6 -2
  170. package/lib/hw/extractOnboardingState.js.map +1 -1
  171. package/lib/hw/extractOnboardingState.test.js +46 -16
  172. package/lib/hw/extractOnboardingState.test.js.map +1 -1
  173. package/lib/hw/getDeviceName.d.ts.map +1 -1
  174. package/lib/hw/getDeviceName.js +2 -0
  175. package/lib/hw/getDeviceName.js.map +1 -1
  176. package/lib/hw/getDeviceName.test.js +16 -0
  177. package/lib/hw/getDeviceName.test.js.map +1 -1
  178. package/lib/hw/getOnboardingStatePolling.d.ts.map +1 -1
  179. package/lib/hw/getOnboardingStatePolling.js +38 -58
  180. package/lib/hw/getOnboardingStatePolling.js.map +1 -1
  181. package/lib/hw/getOnboardingStatePolling.test.js +1 -1
  182. package/lib/hw/getOnboardingStatePolling.test.js.map +1 -1
  183. package/lib/hw/hooks/useGenuineCheck.d.ts.map +1 -1
  184. package/lib/hw/hooks/useGenuineCheck.js +1 -0
  185. package/lib/hw/hooks/useGenuineCheck.js.map +1 -1
  186. package/lib/migrations/accounts-dataset.js +1 -1
  187. package/lib/migrations/accounts-dataset.js.map +1 -1
  188. package/lib/platform/providers/RemoteLiveAppProvider/index.d.ts +1 -0
  189. package/lib/platform/providers/RemoteLiveAppProvider/index.d.ts.map +1 -1
  190. package/lib/platform/providers/RemoteLiveAppProvider/index.js +6 -1
  191. package/lib/platform/providers/RemoteLiveAppProvider/index.js.map +1 -1
  192. package/lib/platform/types.d.ts +1 -0
  193. package/lib/platform/types.d.ts.map +1 -1
  194. package/lib-es/account/serialization.d.ts +0 -6
  195. package/lib-es/account/serialization.d.ts.map +1 -1
  196. package/lib-es/account/serialization.js +0 -36
  197. package/lib-es/account/serialization.js.map +1 -1
  198. package/lib-es/apps/hw.js +1 -1
  199. package/lib-es/apps/hw.js.map +1 -1
  200. package/lib-es/countervalues/react.d.ts.map +1 -1
  201. package/lib-es/countervalues/react.js +1 -1
  202. package/lib-es/countervalues/react.js.map +1 -1
  203. package/lib-es/data/icons/react/gm.d.ts +8 -0
  204. package/lib-es/data/icons/react/gm.d.ts.map +1 -0
  205. package/lib-es/data/icons/react/gm.js +11 -0
  206. package/lib-es/data/icons/react/gm.js.map +1 -0
  207. package/lib-es/data/icons/react/index.d.ts +1 -0
  208. package/lib-es/data/icons/react/index.d.ts.map +1 -1
  209. package/lib-es/data/icons/react/index.js +1 -0
  210. package/lib-es/data/icons/react/index.js.map +1 -1
  211. package/lib-es/data/icons/reactNative/gm.d.ts +8 -0
  212. package/lib-es/data/icons/reactNative/gm.d.ts.map +1 -0
  213. package/lib-es/data/icons/reactNative/gm.js +12 -0
  214. package/lib-es/data/icons/reactNative/gm.js.map +1 -0
  215. package/lib-es/data/icons/reactNative/index.d.ts +1 -0
  216. package/lib-es/data/icons/reactNative/index.d.ts.map +1 -1
  217. package/lib-es/data/icons/reactNative/index.js +1 -0
  218. package/lib-es/data/icons/reactNative/index.js.map +1 -1
  219. package/lib-es/families/algorand/bridge/js.d.ts.map +1 -1
  220. package/lib-es/families/algorand/bridge/js.js +1 -2
  221. package/lib-es/families/algorand/bridge/js.js.map +1 -1
  222. package/lib-es/families/algorand/bridge/mock.d.ts.map +1 -1
  223. package/lib-es/families/algorand/bridge/mock.js +1 -2
  224. package/lib-es/families/algorand/bridge/mock.js.map +1 -1
  225. package/lib-es/families/algorand/serialization.d.ts +0 -1
  226. package/lib-es/families/algorand/serialization.d.ts.map +1 -1
  227. package/lib-es/families/algorand/serialization.js +0 -11
  228. package/lib-es/families/algorand/serialization.js.map +1 -1
  229. package/lib-es/families/bitcoin/bridge/js.d.ts.map +1 -1
  230. package/lib-es/families/bitcoin/bridge/js.js +4 -1
  231. package/lib-es/families/bitcoin/bridge/js.js.map +1 -1
  232. package/lib-es/families/bitcoin/descriptor.test.js +2 -0
  233. package/lib-es/families/bitcoin/descriptor.test.js.map +1 -1
  234. package/lib-es/families/bitcoin/satstack.test.js +2 -0
  235. package/lib-es/families/bitcoin/satstack.test.js.map +1 -1
  236. package/lib-es/families/bitcoin/serialization.d.ts +3 -0
  237. package/lib-es/families/bitcoin/serialization.d.ts.map +1 -1
  238. package/lib-es/families/bitcoin/serialization.js +13 -0
  239. package/lib-es/families/bitcoin/serialization.js.map +1 -1
  240. package/lib-es/families/bitcoin/serialization.test.d.ts +2 -0
  241. package/lib-es/families/bitcoin/serialization.test.d.ts.map +1 -0
  242. package/lib-es/families/bitcoin/serialization.test.js +105 -0
  243. package/lib-es/families/bitcoin/serialization.test.js.map +1 -0
  244. package/lib-es/families/cardano/bridge/js.d.ts.map +1 -1
  245. package/lib-es/families/cardano/bridge/js.js +1 -2
  246. package/lib-es/families/cardano/bridge/js.js.map +1 -1
  247. package/lib-es/families/cardano/serialization.d.ts +0 -1
  248. package/lib-es/families/cardano/serialization.d.ts.map +1 -1
  249. package/lib-es/families/cardano/serialization.js +0 -13
  250. package/lib-es/families/cardano/serialization.js.map +1 -1
  251. package/lib-es/families/celo/bridge/js.d.ts.map +1 -1
  252. package/lib-es/families/celo/bridge/js.js +1 -2
  253. package/lib-es/families/celo/bridge/js.js.map +1 -1
  254. package/lib-es/families/celo/serialization.d.ts +0 -1
  255. package/lib-es/families/celo/serialization.d.ts.map +1 -1
  256. package/lib-es/families/celo/serialization.js +0 -13
  257. package/lib-es/families/celo/serialization.js.map +1 -1
  258. package/lib-es/families/cosmos/bridge/js.d.ts.map +1 -1
  259. package/lib-es/families/cosmos/bridge/js.js +0 -2
  260. package/lib-es/families/cosmos/bridge/js.js.map +1 -1
  261. package/lib-es/families/cosmos/js-synchronisation.d.ts +1 -3
  262. package/lib-es/families/cosmos/js-synchronisation.d.ts.map +1 -1
  263. package/lib-es/families/cosmos/js-synchronisation.js +0 -14
  264. package/lib-es/families/cosmos/js-synchronisation.js.map +1 -1
  265. package/lib-es/families/crypto_org/api/sdk.d.ts.map +1 -1
  266. package/lib-es/families/crypto_org/api/sdk.js +6 -9
  267. package/lib-es/families/crypto_org/api/sdk.js.map +1 -1
  268. package/lib-es/families/crypto_org/js-buildTransaction.d.ts.map +1 -1
  269. package/lib-es/families/crypto_org/js-buildTransaction.js +3 -2
  270. package/lib-es/families/crypto_org/js-buildTransaction.js.map +1 -1
  271. package/lib-es/families/crypto_org/js-signOperation.js +1 -1
  272. package/lib-es/families/crypto_org/js-signOperation.js.map +1 -1
  273. package/lib-es/families/crypto_org/logic.d.ts +0 -16
  274. package/lib-es/families/crypto_org/logic.d.ts.map +1 -1
  275. package/lib-es/families/crypto_org/logic.js +5 -19
  276. package/lib-es/families/crypto_org/logic.js.map +1 -1
  277. package/lib-es/families/elrond/bridge/js.d.ts.map +1 -1
  278. package/lib-es/families/elrond/bridge/js.js +0 -2
  279. package/lib-es/families/elrond/bridge/js.js.map +1 -1
  280. package/lib-es/families/elrond/js-synchronisation.d.ts +1 -3
  281. package/lib-es/families/elrond/js-synchronisation.d.ts.map +1 -1
  282. package/lib-es/families/elrond/js-synchronisation.js +0 -14
  283. package/lib-es/families/elrond/js-synchronisation.js.map +1 -1
  284. package/lib-es/families/ethereum/__tests__/nft.integration.test.js +1 -8
  285. package/lib-es/families/ethereum/__tests__/nft.integration.test.js.map +1 -1
  286. package/lib-es/families/hedera/api/mirror.d.ts.map +1 -1
  287. package/lib-es/families/hedera/api/mirror.js +40 -16
  288. package/lib-es/families/hedera/api/mirror.js.map +1 -1
  289. package/lib-es/families/hedera/api/network.js +6 -1
  290. package/lib-es/families/hedera/api/network.js.map +1 -1
  291. package/lib-es/families/hedera/bridge.integration.test.js +1 -2
  292. package/lib-es/families/hedera/bridge.integration.test.js.map +1 -1
  293. package/lib-es/families/hedera/js-estimateMaxSpendable.d.ts.map +1 -1
  294. package/lib-es/families/hedera/js-estimateMaxSpendable.js +56 -12
  295. package/lib-es/families/hedera/js-estimateMaxSpendable.js.map +1 -1
  296. package/lib-es/families/hedera/js-getTransactionStatus.d.ts.map +1 -1
  297. package/lib-es/families/hedera/js-getTransactionStatus.js +5 -2
  298. package/lib-es/families/hedera/js-getTransactionStatus.js.map +1 -1
  299. package/lib-es/families/hedera/js-signOperation.js +24 -17
  300. package/lib-es/families/hedera/js-signOperation.js.map +1 -1
  301. package/lib-es/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts +2 -0
  302. package/lib-es/families/hedera/tests/js-estimateMaxSpendable.integration.test.d.ts.map +1 -0
  303. package/lib-es/families/hedera/tests/{js-estimateMaxSpendable.test.js → js-estimateMaxSpendable.integration.test.js} +27 -3
  304. package/lib-es/families/hedera/tests/js-estimateMaxSpendable.integration.test.js.map +1 -0
  305. package/lib-es/families/hedera/tests/utils.integration.test.d.ts +2 -0
  306. package/lib-es/families/hedera/tests/utils.integration.test.d.ts.map +1 -0
  307. package/lib-es/families/hedera/tests/{utils.test.js → utils.integration.test.js} +28 -4
  308. package/lib-es/families/hedera/tests/utils.integration.test.js.map +1 -0
  309. package/lib-es/families/hedera/utils.d.ts +1 -1
  310. package/lib-es/families/hedera/utils.d.ts.map +1 -1
  311. package/lib-es/families/hedera/utils.js +38 -13
  312. package/lib-es/families/hedera/utils.js.map +1 -1
  313. package/lib-es/families/near/bridge/js.d.ts.map +1 -1
  314. package/lib-es/families/near/bridge/js.js +2 -3
  315. package/lib-es/families/near/bridge/js.js.map +1 -1
  316. package/lib-es/families/near/serialization.d.ts +0 -1
  317. package/lib-es/families/near/serialization.d.ts.map +1 -1
  318. package/lib-es/families/near/serialization.js +0 -13
  319. package/lib-es/families/near/serialization.js.map +1 -1
  320. package/lib-es/families/solana/api/chain/web3.d.ts +1 -0
  321. package/lib-es/families/solana/api/chain/web3.d.ts.map +1 -1
  322. package/lib-es/families/solana/api/chain/web3.js +14 -0
  323. package/lib-es/families/solana/api/chain/web3.js.map +1 -1
  324. package/lib-es/families/solana/bridge/bridge.d.ts.map +1 -1
  325. package/lib-es/families/solana/bridge/bridge.js +1 -2
  326. package/lib-es/families/solana/bridge/bridge.js.map +1 -1
  327. package/lib-es/families/solana/bridge.integration.test.js +8 -5
  328. package/lib-es/families/solana/bridge.integration.test.js.map +1 -1
  329. package/lib-es/families/solana/js-estimateMaxSpendable.d.ts.map +1 -1
  330. package/lib-es/families/solana/js-estimateMaxSpendable.js +10 -7
  331. package/lib-es/families/solana/js-estimateMaxSpendable.js.map +1 -1
  332. package/lib-es/families/solana/js-prepareTransaction.d.ts.map +1 -1
  333. package/lib-es/families/solana/js-prepareTransaction.js +17 -10
  334. package/lib-es/families/solana/js-prepareTransaction.js.map +1 -1
  335. package/lib-es/families/solana/logic.d.ts +0 -1
  336. package/lib-es/families/solana/logic.d.ts.map +1 -1
  337. package/lib-es/families/solana/logic.js +1 -4
  338. package/lib-es/families/solana/logic.js.map +1 -1
  339. package/lib-es/families/solana/serialization.d.ts +0 -1
  340. package/lib-es/families/solana/serialization.d.ts.map +1 -1
  341. package/lib-es/families/solana/serialization.js +0 -13
  342. package/lib-es/families/solana/serialization.js.map +1 -1
  343. package/lib-es/families/tezos/bridge/js.d.ts.map +1 -1
  344. package/lib-es/families/tezos/bridge/js.js +1 -2
  345. package/lib-es/families/tezos/bridge/js.js.map +1 -1
  346. package/lib-es/families/tezos/serialization.d.ts +0 -1
  347. package/lib-es/families/tezos/serialization.d.ts.map +1 -1
  348. package/lib-es/families/tezos/serialization.js +0 -13
  349. package/lib-es/families/tezos/serialization.js.map +1 -1
  350. package/lib-es/families/tron/bridge/js.d.ts.map +1 -1
  351. package/lib-es/families/tron/bridge/js.js +1 -2
  352. package/lib-es/families/tron/bridge/js.js.map +1 -1
  353. package/lib-es/families/tron/serialization.d.ts +0 -1
  354. package/lib-es/families/tron/serialization.d.ts.map +1 -1
  355. package/lib-es/families/tron/serialization.js +0 -13
  356. package/lib-es/families/tron/serialization.js.map +1 -1
  357. package/lib-es/hw/deviceAccess.d.ts.map +1 -1
  358. package/lib-es/hw/deviceAccess.js +4 -2
  359. package/lib-es/hw/deviceAccess.js.map +1 -1
  360. package/lib-es/hw/extractOnboardingState.d.ts +5 -3
  361. package/lib-es/hw/extractOnboardingState.d.ts.map +1 -1
  362. package/lib-es/hw/extractOnboardingState.js +6 -2
  363. package/lib-es/hw/extractOnboardingState.js.map +1 -1
  364. package/lib-es/hw/extractOnboardingState.test.js +46 -16
  365. package/lib-es/hw/extractOnboardingState.test.js.map +1 -1
  366. package/lib-es/hw/getDeviceName.d.ts.map +1 -1
  367. package/lib-es/hw/getDeviceName.js +2 -0
  368. package/lib-es/hw/getDeviceName.js.map +1 -1
  369. package/lib-es/hw/getDeviceName.test.js +16 -0
  370. package/lib-es/hw/getDeviceName.test.js.map +1 -1
  371. package/lib-es/hw/getOnboardingStatePolling.d.ts.map +1 -1
  372. package/lib-es/hw/getOnboardingStatePolling.js +39 -59
  373. package/lib-es/hw/getOnboardingStatePolling.js.map +1 -1
  374. package/lib-es/hw/getOnboardingStatePolling.test.js +1 -1
  375. package/lib-es/hw/getOnboardingStatePolling.test.js.map +1 -1
  376. package/lib-es/hw/hooks/useGenuineCheck.d.ts.map +1 -1
  377. package/lib-es/hw/hooks/useGenuineCheck.js +1 -0
  378. package/lib-es/hw/hooks/useGenuineCheck.js.map +1 -1
  379. package/lib-es/migrations/accounts-dataset.js +1 -1
  380. package/lib-es/migrations/accounts-dataset.js.map +1 -1
  381. package/lib-es/platform/providers/RemoteLiveAppProvider/index.d.ts +1 -0
  382. package/lib-es/platform/providers/RemoteLiveAppProvider/index.d.ts.map +1 -1
  383. package/lib-es/platform/providers/RemoteLiveAppProvider/index.js +4 -0
  384. package/lib-es/platform/providers/RemoteLiveAppProvider/index.js.map +1 -1
  385. package/lib-es/platform/types.d.ts +1 -0
  386. package/lib-es/platform/types.d.ts.map +1 -1
  387. package/package.json +21 -21
  388. package/src/account/serialization.ts +0 -55
  389. package/src/apps/hw.ts +1 -1
  390. package/src/bot/portfolio/__snapshots__/formatter.test.ts.snap +1 -1
  391. package/src/countervalues/react.tsx +2 -2
  392. package/src/currencies/__snapshots__/sortByMarketcap.test.ts.snap +34 -2
  393. package/src/data/icons/react/gm.tsx +14 -0
  394. package/src/data/icons/react/index.tsx +1 -0
  395. package/src/data/icons/reactNative/gm.tsx +15 -0
  396. package/src/data/icons/reactNative/index.tsx +1 -0
  397. package/src/data/icons/svg/GM.svg +4 -0
  398. package/src/families/algorand/bridge/js.ts +1 -6
  399. package/src/families/algorand/bridge/mock.ts +1 -6
  400. package/src/families/algorand/serialization.ts +0 -23
  401. package/src/families/bitcoin/bridge/js.ts +3 -0
  402. package/src/families/bitcoin/descriptor.test.ts +3 -0
  403. package/src/families/bitcoin/satstack.test.ts +3 -0
  404. package/src/families/bitcoin/serialization.test.ts +150 -0
  405. package/src/families/bitcoin/serialization.ts +22 -0
  406. package/src/families/cardano/bridge/js.ts +1 -6
  407. package/src/families/cardano/serialization.ts +0 -25
  408. package/src/families/celo/bridge/js.ts +1 -6
  409. package/src/families/celo/serialization.ts +0 -25
  410. package/src/families/cosmos/bridge/js.ts +0 -2
  411. package/src/families/cosmos/js-synchronisation.ts +1 -28
  412. package/src/families/crypto_org/api/sdk.ts +14 -18
  413. package/src/families/crypto_org/js-buildTransaction.ts +3 -2
  414. package/src/families/crypto_org/js-signOperation.ts +1 -1
  415. package/src/families/crypto_org/logic.ts +5 -19
  416. package/src/families/elrond/bridge/js.ts +0 -2
  417. package/src/families/elrond/js-synchronisation.ts +0 -28
  418. package/src/families/ethereum/__tests__/nft.integration.test.ts +1 -12
  419. package/src/families/hedera/api/mirror.ts +16 -15
  420. package/src/families/hedera/api/network.ts +9 -1
  421. package/src/families/hedera/bridge.integration.test.ts +1 -4
  422. package/src/families/hedera/js-estimateMaxSpendable.ts +4 -6
  423. package/src/families/hedera/js-getTransactionStatus.ts +3 -1
  424. package/src/families/hedera/js-signOperation.ts +2 -2
  425. package/src/families/hedera/tests/{js-estimateMaxSpendable.test.ts → js-estimateMaxSpendable.integration.test.ts} +17 -2
  426. package/src/families/hedera/tests/{utils.test.ts → utils.integration.test.ts} +18 -3
  427. package/src/families/hedera/utils.ts +17 -5
  428. package/src/families/near/bridge/js.ts +1 -6
  429. package/src/families/near/serialization.ts +0 -25
  430. package/src/families/solana/api/chain/web3.ts +11 -0
  431. package/src/families/solana/bridge/bridge.ts +1 -6
  432. package/src/families/solana/bridge.integration.test.ts +11 -5
  433. package/src/families/solana/js-estimateMaxSpendable.ts +14 -3
  434. package/src/families/solana/js-prepareTransaction.ts +23 -5
  435. package/src/families/solana/logic.ts +1 -6
  436. package/src/families/solana/serialization.ts +0 -26
  437. package/src/families/tezos/bridge/js.ts +1 -6
  438. package/src/families/tezos/serialization.ts +0 -25
  439. package/src/families/tron/bridge/js.ts +1 -6
  440. package/src/families/tron/serialization.ts +0 -25
  441. package/src/hw/deviceAccess.ts +6 -2
  442. package/src/hw/extractOnboardingState.test.ts +63 -16
  443. package/src/hw/extractOnboardingState.ts +6 -2
  444. package/src/hw/getDeviceName.test.ts +10 -0
  445. package/src/hw/getDeviceName.ts +2 -0
  446. package/src/hw/getOnboardingStatePolling.test.ts +1 -1
  447. package/src/hw/getOnboardingStatePolling.ts +13 -40
  448. package/src/hw/hooks/useGenuineCheck.ts +1 -0
  449. package/src/migrations/accounts-dataset.ts +1 -1
  450. package/src/platform/providers/RemoteLiveAppProvider/index.tsx +4 -0
  451. package/src/platform/types.ts +1 -0
  452. package/lib/__tests__/reconciliation.d.ts +0 -2
  453. package/lib/__tests__/reconciliation.d.ts.map +0 -1
  454. package/lib/__tests__/reconciliation.js +0 -51
  455. package/lib/__tests__/reconciliation.js.map +0 -1
  456. package/lib/families/hedera/tests/js-estimateMaxSpendable.test.d.ts +0 -2
  457. package/lib/families/hedera/tests/js-estimateMaxSpendable.test.d.ts.map +0 -1
  458. package/lib/families/hedera/tests/js-estimateMaxSpendable.test.js.map +0 -1
  459. package/lib/families/hedera/tests/utils.test.d.ts +0 -2
  460. package/lib/families/hedera/tests/utils.test.d.ts.map +0 -1
  461. package/lib/families/hedera/tests/utils.test.js.map +0 -1
  462. package/lib/reconciliation.d.ts +0 -9
  463. package/lib/reconciliation.d.ts.map +0 -1
  464. package/lib/reconciliation.js +0 -450
  465. package/lib/reconciliation.js.map +0 -1
  466. package/lib-es/__tests__/reconciliation.d.ts +0 -2
  467. package/lib-es/__tests__/reconciliation.d.ts.map +0 -1
  468. package/lib-es/__tests__/reconciliation.js +0 -49
  469. package/lib-es/__tests__/reconciliation.js.map +0 -1
  470. package/lib-es/families/hedera/tests/js-estimateMaxSpendable.test.d.ts +0 -2
  471. package/lib-es/families/hedera/tests/js-estimateMaxSpendable.test.d.ts.map +0 -1
  472. package/lib-es/families/hedera/tests/js-estimateMaxSpendable.test.js.map +0 -1
  473. package/lib-es/families/hedera/tests/utils.test.d.ts +0 -2
  474. package/lib-es/families/hedera/tests/utils.test.d.ts.map +0 -1
  475. package/lib-es/families/hedera/tests/utils.test.js.map +0 -1
  476. package/lib-es/reconciliation.d.ts +0 -9
  477. package/lib-es/reconciliation.d.ts.map +0 -1
  478. package/lib-es/reconciliation.js +0 -438
  479. package/lib-es/reconciliation.js.map +0 -1
  480. package/src/__tests__/reconciliation.ts +0 -40
  481. package/src/reconciliation.ts +0 -536
@@ -2,13 +2,25 @@ import estimateMaxSpendable from "./js-estimateMaxSpendable";
2
2
  import BigNumber from "bignumber.js";
3
3
  import type { Account } from "@ledgerhq/types-live";
4
4
  import type { Transaction } from "./types";
5
+ import network from "../../network";
5
6
 
6
- // NOTE: Hedera declares stable fees in USD
7
- // If we can get the current USD/HBAR price here..
8
- // > transfer fee is 0.0001 USD
9
- export const estimatedFees = new BigNumber("83300"); // 0.000833 ℏ (as of 2021-09-20)
10
7
  export const estimatedFeeSafetyRate = 2;
11
8
 
9
+ export async function getEstimatedFees(): Promise<BigNumber> {
10
+ try {
11
+ const { data } = await network({
12
+ method: "GET",
13
+ url: "https://countervalues.live.ledger.com/latest/direct?pairs=hbar:usd",
14
+ });
15
+
16
+ return new BigNumber(10000).dividedBy(data[0]);
17
+ } catch {
18
+ // as fees are based on a currency conversion, we stay
19
+ // on the safe side here and double the estimate for "max spendable"
20
+ return new BigNumber("150200").multipliedBy(estimatedFeeSafetyRate); // 0.001502 ℏ (as of 2023-03-14)
21
+ }
22
+ }
23
+
12
24
  export async function calculateAmount({
13
25
  account,
14
26
  transaction,
@@ -25,7 +37,7 @@ export async function calculateAmount({
25
37
 
26
38
  return {
27
39
  amount,
28
- totalSpent: amount.plus(estimatedFees),
40
+ totalSpent: amount.plus(await getEstimatedFees()),
29
41
  };
30
42
  }
31
43
 
@@ -13,11 +13,7 @@ import signOperation from "../js-signOperation";
13
13
  import broadcast from "../js-broadcast";
14
14
  import estimateMaxSpendable from "../js-estimateMaxSpendable";
15
15
  import { preload, hydrate, getPreloadStrategy } from "../preload";
16
- import {
17
- assignToAccountRaw,
18
- assignFromAccountRaw,
19
- applyReconciliation,
20
- } from "../serialization";
16
+ import { assignToAccountRaw, assignFromAccountRaw } from "../serialization";
21
17
 
22
18
  const receive = makeAccountBridgeReceive();
23
19
 
@@ -40,7 +36,6 @@ const accountBridge: AccountBridge<Transaction> = {
40
36
  broadcast,
41
37
  assignToAccountRaw,
42
38
  assignFromAccountRaw,
43
- applyReconciliation,
44
39
  };
45
40
 
46
41
  export default { currencyBridge, accountBridge };
@@ -1,5 +1,4 @@
1
1
  import { BigNumber } from "bignumber.js";
2
- import { isEqual } from "lodash";
3
2
  import type {
4
3
  NearAccount,
5
4
  NearAccountRaw,
@@ -73,27 +72,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
73
72
  (account as NearAccount).nearResources =
74
73
  fromNearResourcesRaw(nearResourcesRaw);
75
74
  }
76
-
77
- export function applyReconciliation(
78
- account: Account,
79
- updatedRaw: AccountRaw,
80
- next: Account
81
- ): boolean {
82
- let changed = false;
83
- const nearAcc = account as NearAccount;
84
- const nearUpdatedRaw = updatedRaw as NearAccountRaw;
85
- if (
86
- nearUpdatedRaw.nearResources &&
87
- (!nearAcc.nearResources ||
88
- !isEqual(
89
- toNearResourcesRaw(nearAcc.nearResources),
90
- nearUpdatedRaw.nearResources
91
- ))
92
- ) {
93
- (next as NearAccount).nearResources = fromNearResourcesRaw(
94
- nearUpdatedRaw.nearResources
95
- );
96
- changed = true;
97
- }
98
- return changed;
99
- }
@@ -260,6 +260,17 @@ export function getStakeAccountMinimumBalanceForRentExemption(api: ChainAPI) {
260
260
  return api.getMinimumBalanceForRentExemption(StakeProgram.space);
261
261
  }
262
262
 
263
+ export async function getAccountMinimumBalanceForRentExemption(
264
+ api: ChainAPI,
265
+ address: string
266
+ ) {
267
+ const accInfo = await api.getAccountInfo(address);
268
+ const accSpace =
269
+ accInfo !== null && "parsed" in accInfo.data ? accInfo.data.space : 0;
270
+
271
+ return api.getMinimumBalanceForRentExemption(accSpace);
272
+ }
273
+
263
274
  export async function getStakeAccountAddressWithSeed({
264
275
  fromAddress,
265
276
  seed,
@@ -26,11 +26,7 @@ import { getAccountShapeWithAPI } from "../js-synchronization";
26
26
  import type { SolanaAccount, Transaction } from "../types";
27
27
  import { endpointByCurrencyId } from "../utils";
28
28
  import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
29
- import {
30
- assignToAccountRaw,
31
- applyReconciliation,
32
- assignFromAccountRaw,
33
- } from "../serialization";
29
+ import { assignToAccountRaw, assignFromAccountRaw } from "../serialization";
34
30
 
35
31
  function makePrepare(getChainAPI: (config: Config) => Promise<ChainAPI>) {
36
32
  async function prepareTransaction(
@@ -178,7 +174,6 @@ export function makeBridges({
178
174
  prepareTransaction: makePrepare(getQueuedAndCachedAPI),
179
175
  broadcast: makeBroadcast(getAPI),
180
176
  signOperation: makeSign(getAPI),
181
- applyReconciliation,
182
177
  assignFromAccountRaw,
183
178
  assignToAccountRaw,
184
179
  };
@@ -32,7 +32,6 @@ import {
32
32
  import {
33
33
  encodeAccountIdWithTokenAccountAddress,
34
34
  MAX_MEMO_LENGTH,
35
- SOLANA_DUST,
36
35
  } from "./logic";
37
36
  import createTransaction from "./js-createTransaction";
38
37
  import { compact } from "lodash/fp";
@@ -73,6 +72,7 @@ const testOnChainData = {
73
72
  validatorAddress: "9QU2QSxhb24FUX3Tu2FpczXjpK3VYrvRudywSZaM29mF",
74
73
  fees: {
75
74
  stakeAccountRentExempt: 2282880,
75
+ systemAccountRentExempt: 890880,
76
76
  lamportsPerSignature: 5000,
77
77
  },
78
78
  // --- maybe outdated or not real, fine for tests ---
@@ -328,8 +328,12 @@ function transferTests(): TransactionTestSpec[] {
328
328
  errors: {},
329
329
  warnings: {},
330
330
  estimatedFees: fees(1),
331
- amount: testOnChainData.fundedSenderBalance.minus(fees(1)),
332
- totalSpent: testOnChainData.fundedSenderBalance,
331
+ amount: testOnChainData.fundedSenderBalance
332
+ .minus(fees(1))
333
+ .minus(testOnChainData.fees.systemAccountRentExempt),
334
+ totalSpent: testOnChainData.fundedSenderBalance.minus(
335
+ testOnChainData.fees.systemAccountRentExempt
336
+ ),
333
337
  },
334
338
  },
335
339
  {
@@ -758,11 +762,13 @@ function stakingTests(): TransactionTestSpec[] {
758
762
  amount: testOnChainData.fundedSenderBalance
759
763
  .minus(fees(1))
760
764
  .minus(testOnChainData.fees.stakeAccountRentExempt)
761
- .minus(SOLANA_DUST),
765
+ .minus(testOnChainData.fees.systemAccountRentExempt),
762
766
  estimatedFees: fees(1).plus(
763
767
  testOnChainData.fees.stakeAccountRentExempt
764
768
  ),
765
- totalSpent: testOnChainData.fundedSenderBalance.minus(SOLANA_DUST),
769
+ totalSpent: testOnChainData.fundedSenderBalance.minus(
770
+ testOnChainData.fees.systemAccountRentExempt
771
+ ),
766
772
  errors: {},
767
773
  },
768
774
  },
@@ -2,7 +2,10 @@ import type { AccountBridge } from "@ledgerhq/types-live";
2
2
  import type { Transaction } from "./types";
3
3
  import BigNumber from "bignumber.js";
4
4
  import { ChainAPI } from "./api";
5
- import { getStakeAccountMinimumBalanceForRentExemption } from "./api/chain/web3";
5
+ import {
6
+ getAccountMinimumBalanceForRentExemption,
7
+ getStakeAccountMinimumBalanceForRentExemption,
8
+ } from "./api/chain/web3";
6
9
  import { getMainAccount } from "../../account";
7
10
  import { estimateTxFee } from "./tx-fees";
8
11
 
@@ -30,8 +33,16 @@ const estimateMaxSpendableWithAPI = async (
30
33
  0
31
34
  );
32
35
  }
33
- default:
34
- return BigNumber.max(account.spendableBalance.minus(txFee), 0);
36
+ default: {
37
+ const rentExemptMin = await getAccountMinimumBalanceForRentExemption(
38
+ api,
39
+ account.freshAddress
40
+ );
41
+ return BigNumber.max(
42
+ account.spendableBalance.minus(txFee).minus(rentExemptMin),
43
+ 0
44
+ );
45
+ }
35
46
  }
36
47
  }
37
48
  case "TokenAccount":
@@ -11,6 +11,7 @@ import { findSubAccountById } from "../../account";
11
11
  import type { Account } from "@ledgerhq/types-live";
12
12
  import { ChainAPI } from "./api";
13
13
  import {
14
+ getAccountMinimumBalanceForRentExemption,
14
15
  getMaybeTokenAccount,
15
16
  getMaybeVoteAccount,
16
17
  getStakeAccountAddressWithSeed,
@@ -40,7 +41,6 @@ import {
40
41
  isEd25519Address,
41
42
  isValidBase58Address,
42
43
  MAX_MEMO_LENGTH,
43
- SOLANA_DUST,
44
44
  } from "./logic";
45
45
  import { estimateTxFee } from "./tx-fees";
46
46
  import type {
@@ -326,8 +326,16 @@ async function deriveTransferCommandDescriptor(
326
326
 
327
327
  const fee = await estimateTxFee(api, mainAccount, "transfer");
328
328
 
329
+ const rentExemptMin = await getAccountMinimumBalanceForRentExemption(
330
+ api,
331
+ mainAccount.freshAddress
332
+ );
333
+
329
334
  const txAmount = tx.useAllAmount
330
- ? BigNumber.max(mainAccount.spendableBalance.minus(fee), 0)
335
+ ? BigNumber.max(
336
+ mainAccount.spendableBalance.minus(fee).minus(rentExemptMin),
337
+ 0
338
+ )
331
339
  : tx.amount;
332
340
 
333
341
  if (tx.useAllAmount) {
@@ -337,7 +345,9 @@ async function deriveTransferCommandDescriptor(
337
345
  } else {
338
346
  if (txAmount.lte(0)) {
339
347
  errors.amount = new AmountRequired();
340
- } else if (txAmount.plus(fee).gt(mainAccount.spendableBalance)) {
348
+ } else if (
349
+ txAmount.plus(fee).plus(rentExemptMin).gt(mainAccount.spendableBalance)
350
+ ) {
341
351
  errors.amount = new NotEnoughBalance();
342
352
  }
343
353
  }
@@ -375,16 +385,24 @@ async function deriveStakeCreateAccountCommandDescriptor(
375
385
  const stakeAccRentExemptAmount =
376
386
  await getStakeAccountMinimumBalanceForRentExemption(api);
377
387
 
388
+ const rentExemptMin = await getAccountMinimumBalanceForRentExemption(
389
+ api,
390
+ mainAccount.freshAddress
391
+ );
392
+
378
393
  const fee = txFee + stakeAccRentExemptAmount;
379
394
 
380
395
  const amount = tx.useAllAmount
381
396
  ? BigNumber.max(
382
- mainAccount.spendableBalance.minus(fee).minus(SOLANA_DUST),
397
+ mainAccount.spendableBalance.minus(fee).minus(rentExemptMin),
383
398
  0
384
399
  )
385
400
  : tx.amount;
386
401
 
387
- if (!errors.amount && mainAccount.spendableBalance.lt(amount.plus(fee))) {
402
+ if (
403
+ !errors.amount &&
404
+ mainAccount.spendableBalance.lt(amount.plus(fee).plus(rentExemptMin))
405
+ ) {
388
406
  errors.amount = new NotEnoughBalance();
389
407
  }
390
408
 
@@ -1,19 +1,14 @@
1
- import { findTokenById, getCryptoCurrencyById } from "@ledgerhq/cryptoassets";
1
+ import { findTokenById } from "@ledgerhq/cryptoassets";
2
2
  import { PublicKey } from "@solana/web3.js";
3
3
  import { TokenAccount } from "@ledgerhq/types-live";
4
4
  import { StakeMeta } from "./api/chain/account/stake";
5
5
  import { SolanaStake, StakeAction } from "./types";
6
6
  import { assertUnreachable } from "./utils";
7
- import { parseCurrencyUnit } from "../../currencies";
8
-
9
- const currency = getCryptoCurrencyById("solana");
10
7
 
11
8
  export type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
12
9
 
13
10
  export const MAX_MEMO_LENGTH = 500;
14
11
 
15
- export const SOLANA_DUST = parseCurrencyUnit(currency.units[0], "0.00001");
16
-
17
12
  export const isValidBase58Address = (address: string): boolean => {
18
13
  try {
19
14
  return Boolean(new PublicKey(address));
@@ -5,7 +5,6 @@ import {
5
5
  SolanaResourcesRaw,
6
6
  } from "./types";
7
7
  import { Account, AccountRaw } from "@ledgerhq/types-live";
8
- import { isEqual } from "lodash";
9
8
 
10
9
  export function toSolanaResourcesRaw(
11
10
  resources: SolanaResources
@@ -38,28 +37,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
38
37
  (account as SolanaAccount).solanaResources =
39
38
  fromSolanaResourcesRaw(solanaResourcesRaw);
40
39
  }
41
-
42
- export function applyReconciliation(
43
- account: Account,
44
- updatedRaw: AccountRaw,
45
- next: Account
46
- ): boolean {
47
- let changed = false;
48
- const solanaAcc = account as SolanaAccount;
49
- const solanaUpdatedRaw = updatedRaw as SolanaAccountRaw;
50
-
51
- if (
52
- solanaUpdatedRaw.solanaResources &&
53
- (!solanaAcc.solanaResources ||
54
- !isEqual(
55
- toSolanaResourcesRaw(solanaAcc.solanaResources),
56
- solanaUpdatedRaw.solanaResources
57
- ))
58
- ) {
59
- (next as SolanaAccount).solanaResources = fromSolanaResourcesRaw(
60
- solanaUpdatedRaw.solanaResources
61
- );
62
- changed = true;
63
- }
64
- return changed;
65
- }
@@ -41,11 +41,7 @@ import { patchOperationWithHash } from "../../../operation";
41
41
  import { log } from "@ledgerhq/logs";
42
42
  import { InvalidAddressBecauseAlreadyDelegated } from "../../../errors";
43
43
  import api from "../api/tzkt";
44
- import {
45
- applyReconciliation,
46
- assignFromAccountRaw,
47
- assignToAccountRaw,
48
- } from "../serialization";
44
+ import { assignFromAccountRaw, assignToAccountRaw } from "../serialization";
49
45
 
50
46
  const validateRecipient = (currency, recipient) => {
51
47
  let recipientError: Error | null = null;
@@ -403,7 +399,6 @@ const accountBridge: AccountBridge<Transaction> = {
403
399
  receive,
404
400
  signOperation,
405
401
  broadcast,
406
- applyReconciliation,
407
402
  assignToAccountRaw,
408
403
  assignFromAccountRaw,
409
404
  };
@@ -5,7 +5,6 @@ import type {
5
5
  TezosResourcesRaw,
6
6
  } from "./types";
7
7
  import { Account, AccountRaw } from "@ledgerhq/types-live";
8
- import isEqual from "lodash/isEqual";
9
8
 
10
9
  export function toTezosResourcesRaw(r: TezosResources): TezosResourcesRaw {
11
10
  const { revealed, counter } = r;
@@ -32,27 +31,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
32
31
  (account as TezosAccount).tezosResources =
33
32
  fromTezosResourcesRaw(tezosResourcesRaw);
34
33
  }
35
-
36
- export function applyReconciliation(
37
- account: Account,
38
- updatedRaw: AccountRaw,
39
- next: Account
40
- ): boolean {
41
- let changed = false;
42
- const tezosAcc = account as TezosAccount;
43
- const tezosUpdatedRaw = updatedRaw as TezosAccountRaw;
44
- if (
45
- tezosUpdatedRaw.tezosResources &&
46
- (!tezosAcc.tezosResources ||
47
- !isEqual(
48
- toTezosResourcesRaw(tezosAcc.tezosResources),
49
- tezosUpdatedRaw.tezosResources
50
- ))
51
- ) {
52
- (next as TezosAccount).tezosResources = fromTezosResourcesRaw(
53
- tezosUpdatedRaw.tezosResources
54
- );
55
- changed = true;
56
- }
57
- return changed;
58
- }
@@ -86,11 +86,7 @@ import {
86
86
  import { activationFees, oneTrx } from "../constants";
87
87
  import { makeAccountBridgeReceive } from "../../../bridge/jsHelpers";
88
88
  import type { AccountShapeInfo } from "../../../bridge/jsHelpers";
89
- import {
90
- assignFromAccountRaw,
91
- assignToAccountRaw,
92
- applyReconciliation,
93
- } from "../serialization";
89
+ import { assignFromAccountRaw, assignToAccountRaw } from "../serialization";
94
90
 
95
91
  const receive = makeAccountBridgeReceive();
96
92
 
@@ -849,7 +845,6 @@ const accountBridge: AccountBridge<Transaction> = {
849
845
  receive,
850
846
  signOperation,
851
847
  broadcast,
852
- applyReconciliation,
853
848
  assignFromAccountRaw,
854
849
  assignToAccountRaw,
855
850
  };
@@ -1,5 +1,4 @@
1
1
  import { BigNumber } from "bignumber.js";
2
- import { isEqual } from "lodash";
3
2
  import type {
4
3
  TronAccount,
5
4
  TronAccountRaw,
@@ -171,27 +170,3 @@ export function assignFromAccountRaw(accountRaw: AccountRaw, account: Account) {
171
170
  (account as TronAccount).tronResources =
172
171
  fromTronResourcesRaw(tronResourcesRaw);
173
172
  }
174
-
175
- export function applyReconciliation(
176
- account: Account,
177
- updatedRaw: AccountRaw,
178
- next: Account
179
- ): boolean {
180
- let changed = false;
181
- const tronAcc = account as TronAccount;
182
- const tronUpdatedRaw = updatedRaw as TronAccountRaw;
183
- if (
184
- tronUpdatedRaw.tronResources &&
185
- (!tronAcc.tronResources ||
186
- !isEqual(
187
- toTronResourcesRaw(tronAcc.tronResources),
188
- tronUpdatedRaw.tronResources
189
- ))
190
- ) {
191
- (next as TronAccount).tronResources = fromTronResourcesRaw(
192
- tronUpdatedRaw.tronResources
193
- );
194
- changed = true;
195
- }
196
- return changed;
197
- }
@@ -106,6 +106,7 @@ export const withDevice =
106
106
 
107
107
  // When we'll finish all the current job, we'll call finish
108
108
  let resolveQueuedDevice;
109
+
109
110
  // This new promise is the next exec queue
110
111
  deviceQueues[deviceId] = new Promise((resolve) => {
111
112
  resolveQueuedDevice = resolve;
@@ -118,12 +119,14 @@ export const withDevice =
118
119
  deviceQueue
119
120
  .then(() => open(deviceId)) // open the transport
120
121
  .then(async (transport) => {
121
- log("withDevice", `${nonce}: Starting job`);
122
- setAllowAutoDisconnect(transport, deviceId, false);
122
+ log("withDevice", `${nonce}: got a transport`);
123
+
123
124
  if (unsubscribed) {
125
+ log("withDevice", `${nonce}: but we're unsubscribed`);
124
126
  // It was unsubscribed prematurely
125
127
  return finalize(transport, [resolveQueuedDevice]);
126
128
  }
129
+ setAllowAutoDisconnect(transport, deviceId, false);
127
130
 
128
131
  if (needsCleanup[identifyTransport(transport)]) {
129
132
  delete needsCleanup[identifyTransport(transport)];
@@ -149,6 +152,7 @@ export const withDevice =
149
152
  return finalize(transport, [resolveQueuedDevice]);
150
153
  }
151
154
 
155
+ log("withDevice", `${nonce}: Starting job`);
152
156
  sub = job(transport)
153
157
  .pipe(
154
158
  catchError(initialErrorRemapping),
@@ -1,3 +1,4 @@
1
+ import { DeviceExtractOnboardingStateError } from "@ledgerhq/errors";
1
2
  import {
2
3
  extractOnboardingState,
3
4
  OnboardingStep,
@@ -8,9 +9,10 @@ describe("@hw/extractOnboardingState", () => {
8
9
  describe("When the flag bytes are incorrect", () => {
9
10
  it("should throw an error", () => {
10
11
  const incompleteFlagsBytes = Buffer.from([0, 0]);
11
- // DeviceExtractOnboardingStateError is not of type Error,
12
- // so cannot check in toThrow(DeviceExtractOnboardingStateError)
13
- expect(() => extractOnboardingState(incompleteFlagsBytes)).toThrow();
12
+
13
+ expect(() => extractOnboardingState(incompleteFlagsBytes)).toThrow(
14
+ DeviceExtractOnboardingStateError
15
+ );
14
16
  });
15
17
  });
16
18
 
@@ -75,17 +77,17 @@ describe("@hw/extractOnboardingState", () => {
75
77
  });
76
78
  });
77
79
 
78
- describe("and the user is choosing what kind of setup they want", () => {
80
+ describe("and the user is on 'choose name' step", () => {
79
81
  beforeEach(() => {
80
- flagsBytes[3] = 5;
82
+ flagsBytes[3] = 12;
81
83
  });
82
84
 
83
- it("should return an onboarding step that is set at the setup choice", () => {
85
+ it("should return an onboarding step that is set at ready", () => {
84
86
  const onboardingState = extractOnboardingState(flagsBytes);
85
87
 
86
88
  expect(onboardingState).not.toBeNull();
87
89
  expect(onboardingState?.currentOnboardingStep).toBe(
88
- OnboardingStep.SetupChoice
90
+ OnboardingStep.ChooseName
89
91
  );
90
92
  });
91
93
  });
@@ -105,6 +107,21 @@ describe("@hw/extractOnboardingState", () => {
105
107
  });
106
108
  });
107
109
 
110
+ describe("and the user is choosing what kind of setup they want", () => {
111
+ beforeEach(() => {
112
+ flagsBytes[3] = 5;
113
+ });
114
+
115
+ it("should return an onboarding step that is set at the setup choice", () => {
116
+ const onboardingState = extractOnboardingState(flagsBytes);
117
+
118
+ expect(onboardingState).not.toBeNull();
119
+ expect(onboardingState?.currentOnboardingStep).toBe(
120
+ OnboardingStep.SetupChoice
121
+ );
122
+ });
123
+ });
124
+
108
125
  describe("and the user is generating a new seed", () => {
109
126
  describe("and the seed phrase type is set to 24 words", () => {
110
127
  beforeEach(() => {
@@ -175,7 +192,22 @@ describe("@hw/extractOnboardingState", () => {
175
192
  });
176
193
  });
177
194
 
178
- describe("and the user is recovering a seed", () => {
195
+ describe("and the user wants to restore a seed, choosing between restoring their own seed or Recover", () => {
196
+ beforeEach(() => {
197
+ flagsBytes[3] = 14;
198
+ });
199
+
200
+ it("should return an onboarding step that is set at the setup restore choice", () => {
201
+ const onboardingState = extractOnboardingState(flagsBytes);
202
+
203
+ expect(onboardingState).not.toBeNull();
204
+ expect(onboardingState?.currentOnboardingStep).toBe(
205
+ OnboardingStep.SetupChoiceRestore
206
+ );
207
+ });
208
+ });
209
+
210
+ describe("and the user is restoring a seed directly (without Recover)", () => {
179
211
  describe("and the seed phrase type is set to X words", () => {
180
212
  it("should return a device state with the correct seed phrase type", () => {
181
213
  const byte3 = flagsBytes[2];
@@ -234,32 +266,32 @@ describe("@hw/extractOnboardingState", () => {
234
266
  });
235
267
  });
236
268
 
237
- describe("and the user is on the safety warning screen", () => {
269
+ describe("and the user wants to restore with Recover", () => {
238
270
  beforeEach(() => {
239
- flagsBytes[3] = 10;
271
+ flagsBytes[3] = 13;
240
272
  });
241
273
 
242
- it("should return an onboarding step that is set at the safety warning screen", () => {
274
+ it("should return an onboarding step that is set at the restore with Recover", () => {
243
275
  const onboardingState = extractOnboardingState(flagsBytes);
244
276
 
245
277
  expect(onboardingState).not.toBeNull();
246
278
  expect(onboardingState?.currentOnboardingStep).toBe(
247
- OnboardingStep.SafetyWarning
279
+ OnboardingStep.RecoverRestore
248
280
  );
249
281
  });
250
282
  });
251
283
 
252
- describe("and the user is on 'choose name' step", () => {
284
+ describe("and the user is on the safety warning screen", () => {
253
285
  beforeEach(() => {
254
- flagsBytes[3] = 12;
286
+ flagsBytes[3] = 10;
255
287
  });
256
288
 
257
- it("should return an onboarding step that is set at ready", () => {
289
+ it("should return an onboarding step that is set at the safety warning screen", () => {
258
290
  const onboardingState = extractOnboardingState(flagsBytes);
259
291
 
260
292
  expect(onboardingState).not.toBeNull();
261
293
  expect(onboardingState?.currentOnboardingStep).toBe(
262
- OnboardingStep.ChooseName
294
+ OnboardingStep.SafetyWarning
263
295
  );
264
296
  });
265
297
  });
@@ -278,6 +310,21 @@ describe("@hw/extractOnboardingState", () => {
278
310
  );
279
311
  });
280
312
  });
313
+
314
+ describe("and the device is set to an onboarding step/flag that is not handled yet", () => {
315
+ beforeEach(() => {
316
+ // To update so it's never handled
317
+ flagsBytes[3] = 20;
318
+ });
319
+
320
+ it("should thrown an error", () => {
321
+ // DeviceExtractOnboardingStateError is not of type Error,
322
+ // so cannot check in toThrow(DeviceExtractOnboardingStateError)
323
+ expect(() => extractOnboardingState(flagsBytes)).toThrow(
324
+ DeviceExtractOnboardingStateError
325
+ );
326
+ });
327
+ });
281
328
  });
282
329
  });
283
330
  });
@@ -30,14 +30,16 @@ export enum OnboardingStep {
30
30
  WelcomeScreen3 = "WELCOME_SCREEN_3",
31
31
  WelcomeScreen4 = "WELCOME_SCREEN_4",
32
32
  WelcomeScreenReminder = "WELCOME_SCREEN_REMINDER",
33
- SetupChoice = "SETUP_CHOICE",
33
+ ChooseName = "CHOOSE_NAME",
34
34
  Pin = "PIN",
35
+ SetupChoice = "SETUP_CHOICE",
35
36
  NewDevice = "NEW_DEVICE", // path "new device" & currentSeedWordIndex available
36
37
  NewDeviceConfirming = "NEW_DEVICE_CONFIRMING", // path "new device" & currentSeedWordIndex available
38
+ SetupChoiceRestore = "SETUP_CHOICE_RESTORE", // choosing between restoring a see directly (RestoreSeed) or use Recover (RecoverRestore)
37
39
  RestoreSeed = "RESTORE_SEED", // path "restore seed" & currentSeedWordIndex available
40
+ RecoverRestore = "RECOVER_RESTORE", // path "restore with Recover"
38
41
  SafetyWarning = "SAFETY WARNING",
39
42
  Ready = "READY",
40
- ChooseName = "CHOOSE_NAME",
41
43
  }
42
44
 
43
45
  const fromBitsToOnboardingStep = new Map<number, OnboardingStep>([
@@ -54,6 +56,8 @@ const fromBitsToOnboardingStep = new Map<number, OnboardingStep>([
54
56
  [10, OnboardingStep.SafetyWarning],
55
57
  [11, OnboardingStep.Ready],
56
58
  [12, OnboardingStep.ChooseName],
59
+ [13, OnboardingStep.RecoverRestore],
60
+ [14, OnboardingStep.SetupChoiceRestore],
57
61
  ]);
58
62
 
59
63
  export type OnboardingState = {