@ledgerhq/live-common 21.30.1 → 21.32.2

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 (362) hide show
  1. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.d.ts +2 -0
  2. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.d.ts.map +1 -0
  3. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js +100 -0
  4. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.js.map +1 -0
  5. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js +0 -10
  6. package/lib/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.js.map +1 -1
  7. package/lib/__tests__/test-helpers/setup.js +1 -0
  8. package/lib/__tests__/test-helpers/setup.js.map +1 -1
  9. package/lib/account/support.d.ts.map +1 -1
  10. package/lib/account/support.js.map +1 -1
  11. package/lib/api/Ethereum.d.ts.map +1 -1
  12. package/lib/api/Ethereum.js +1 -0
  13. package/lib/api/Ethereum.js.map +1 -1
  14. package/lib/apps/polyfill.d.ts.map +1 -1
  15. package/lib/apps/polyfill.js +1 -0
  16. package/lib/apps/polyfill.js.map +1 -1
  17. package/lib/bot/engine.d.ts.map +1 -1
  18. package/lib/bot/engine.js +4 -1
  19. package/lib/bot/engine.js.map +1 -1
  20. package/lib/bridge/jsHelpers.js +1 -1
  21. package/lib/data/icons/react/celo.d.ts +8 -0
  22. package/lib/data/icons/react/celo.d.ts.map +1 -0
  23. package/lib/data/icons/react/celo.js +32 -0
  24. package/lib/data/icons/react/celo.js.map +1 -0
  25. package/lib/data/icons/react/index.d.ts +1 -0
  26. package/lib/data/icons/react/index.d.ts.map +1 -1
  27. package/lib/data/icons/react/index.js +11 -8
  28. package/lib/data/icons/react/index.js.map +1 -1
  29. package/lib/data/icons/reactNative/celo.d.ts +8 -0
  30. package/lib/data/icons/reactNative/celo.d.ts.map +1 -0
  31. package/lib/data/icons/reactNative/celo.js +33 -0
  32. package/lib/data/icons/reactNative/celo.js.map +1 -0
  33. package/lib/data/icons/reactNative/index.d.ts +1 -0
  34. package/lib/data/icons/reactNative/index.d.ts.map +1 -1
  35. package/lib/data/icons/reactNative/index.js +11 -8
  36. package/lib/data/icons/reactNative/index.js.map +1 -1
  37. package/lib/env.d.ts +15 -5
  38. package/lib/env.d.ts.map +1 -1
  39. package/lib/env.js +10 -0
  40. package/lib/env.js.map +1 -1
  41. package/lib/env.react.d.ts +1 -1
  42. package/lib/env.react.d.ts.map +1 -1
  43. package/lib/exchange/platform/transfer/index.d.ts.map +1 -1
  44. package/lib/exchange/platform/transfer/index.js +15 -1
  45. package/lib/exchange/platform/transfer/index.js.map +1 -1
  46. package/lib/families/algorand/buildTransaction.d.ts +2 -2
  47. package/lib/families/algorand/buildTransaction.d.ts.map +1 -1
  48. package/lib/families/algorand/buildTransaction.js +13 -19
  49. package/lib/families/algorand/buildTransaction.js.map +1 -1
  50. package/lib/families/algorand/js-getFeesForTransaction.js +4 -6
  51. package/lib/families/algorand/js-getFeesForTransaction.js.map +1 -1
  52. package/lib/families/algorand/js-signOperation.js +3 -7
  53. package/lib/families/algorand/js-signOperation.js.map +1 -1
  54. package/lib/families/algorand/js-synchronization.d.ts.map +1 -1
  55. package/lib/families/algorand/js-synchronization.js +1 -0
  56. package/lib/families/algorand/js-synchronization.js.map +1 -1
  57. package/lib/families/bitcoin/js-signOperation.d.ts.map +1 -1
  58. package/lib/families/bitcoin/js-signOperation.js +3 -5
  59. package/lib/families/bitcoin/js-signOperation.js.map +1 -1
  60. package/lib/families/bitcoin/js-synchronisation.js +4 -4
  61. package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
  62. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts +4 -3
  63. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts.map +1 -1
  64. package/lib/families/bitcoin/wallet-btc/crypto/base.js +8 -7
  65. package/lib/families/bitcoin/wallet-btc/crypto/base.js.map +1 -1
  66. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts +1 -1
  67. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.d.ts.map +1 -1
  68. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js +3 -7
  69. package/lib/families/bitcoin/wallet-btc/crypto/bitcoin.js.map +1 -1
  70. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts +3 -4
  71. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.d.ts.map +1 -1
  72. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js +27 -53
  73. package/lib/families/bitcoin/wallet-btc/crypto/bitcoincash.js.map +1 -1
  74. package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts +1 -1
  75. package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts.map +1 -1
  76. package/lib/families/bitcoin/wallet-btc/crypto/decred.js +2 -7
  77. package/lib/families/bitcoin/wallet-btc/crypto/decred.js.map +1 -1
  78. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts +1 -6
  79. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.d.ts.map +1 -1
  80. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js +0 -51
  81. package/lib/families/bitcoin/wallet-btc/crypto/litecoin.js.map +1 -1
  82. package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts +1 -0
  83. package/lib/families/bitcoin/wallet-btc/crypto/types.d.ts.map +1 -1
  84. package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts +3 -4
  85. package/lib/families/bitcoin/wallet-btc/crypto/zec.d.ts.map +1 -1
  86. package/lib/families/bitcoin/wallet-btc/crypto/zec.js +26 -17
  87. package/lib/families/bitcoin/wallet-btc/crypto/zec.js.map +1 -1
  88. package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts +3 -4
  89. package/lib/families/bitcoin/wallet-btc/crypto/zen.d.ts.map +1 -1
  90. package/lib/families/bitcoin/wallet-btc/crypto/zen.js +33 -24
  91. package/lib/families/bitcoin/wallet-btc/crypto/zen.js.map +1 -1
  92. package/lib/families/bitcoin/wallet-btc/explorer/index.d.ts.map +1 -1
  93. package/lib/families/bitcoin/wallet-btc/explorer/index.js +20 -0
  94. package/lib/families/bitcoin/wallet-btc/explorer/index.js.map +1 -1
  95. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +0 -1
  96. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
  97. package/lib/families/celo/api/hubble.d.ts +8 -0
  98. package/lib/families/celo/api/hubble.d.ts.map +1 -0
  99. package/lib/families/celo/api/hubble.js +144 -0
  100. package/lib/families/celo/api/hubble.js.map +1 -0
  101. package/lib/families/celo/api/index.d.ts +2 -0
  102. package/lib/families/celo/api/index.d.ts.map +1 -0
  103. package/lib/families/celo/api/index.js +13 -0
  104. package/lib/families/celo/api/index.js.map +1 -0
  105. package/lib/families/celo/api/sdk.d.ts +3 -0
  106. package/lib/families/celo/api/sdk.d.ts.map +1 -0
  107. package/lib/families/celo/api/sdk.js +13 -0
  108. package/lib/families/celo/api/sdk.js.map +1 -0
  109. package/lib/families/celo/bridge/js.d.ts +8 -0
  110. package/lib/families/celo/bridge/js.d.ts.map +1 -0
  111. package/lib/families/celo/bridge/js.js +87 -0
  112. package/lib/families/celo/bridge/js.js.map +1 -0
  113. package/lib/families/celo/cli-transaction.d.ts +14 -0
  114. package/lib/families/celo/cli-transaction.d.ts.map +1 -0
  115. package/lib/families/celo/cli-transaction.js +37 -0
  116. package/lib/families/celo/cli-transaction.js.map +1 -0
  117. package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts +5 -0
  118. package/lib/families/celo/datasets/celo.scanAccounts.1.d.ts.map +1 -0
  119. package/lib/families/celo/datasets/celo.scanAccounts.1.js +12 -0
  120. package/lib/families/celo/datasets/celo.scanAccounts.1.js.map +1 -0
  121. package/lib/families/celo/deviceTransactionConfig.d.ts +4 -0
  122. package/lib/families/celo/deviceTransactionConfig.d.ts.map +1 -0
  123. package/lib/families/celo/deviceTransactionConfig.js +16 -0
  124. package/lib/families/celo/deviceTransactionConfig.js.map +1 -0
  125. package/lib/families/celo/hw-app-celo.d.ts +19 -0
  126. package/lib/families/celo/hw-app-celo.d.ts.map +1 -0
  127. package/lib/families/celo/hw-app-celo.js +147 -0
  128. package/lib/families/celo/hw-app-celo.js.map +1 -0
  129. package/lib/families/celo/hw-getAddress.d.ts +2 -0
  130. package/lib/families/celo/hw-getAddress.d.ts.map +1 -0
  131. package/lib/families/celo/hw-getAddress.js +13 -0
  132. package/lib/families/celo/hw-getAddress.js.map +1 -0
  133. package/lib/families/celo/js-broadcast.d.ts +8 -0
  134. package/lib/families/celo/js-broadcast.d.ts.map +1 -0
  135. package/lib/families/celo/js-broadcast.js +58 -0
  136. package/lib/families/celo/js-broadcast.js.map +1 -0
  137. package/lib/families/celo/js-buildTransaction.d.ts +6 -0
  138. package/lib/families/celo/js-buildTransaction.d.ts.map +1 -0
  139. package/lib/families/celo/js-buildTransaction.js +89 -0
  140. package/lib/families/celo/js-buildTransaction.js.map +1 -0
  141. package/lib/families/celo/js-createTransaction.d.ts +4 -0
  142. package/lib/families/celo/js-createTransaction.d.ts.map +1 -0
  143. package/lib/families/celo/js-createTransaction.js +12 -0
  144. package/lib/families/celo/js-createTransaction.js.map +1 -0
  145. package/lib/families/celo/js-estimateMaxSpendable.d.ts +10 -0
  146. package/lib/families/celo/js-estimateMaxSpendable.d.ts.map +1 -0
  147. package/lib/families/celo/js-estimateMaxSpendable.js +77 -0
  148. package/lib/families/celo/js-estimateMaxSpendable.js.map +1 -0
  149. package/lib/families/celo/js-getFeesForTransaction.d.ts +8 -0
  150. package/lib/families/celo/js-getFeesForTransaction.d.ts.map +1 -0
  151. package/lib/families/celo/js-getFeesForTransaction.js +76 -0
  152. package/lib/families/celo/js-getFeesForTransaction.js.map +1 -0
  153. package/lib/families/celo/js-getTransactionStatus.d.ts +5 -0
  154. package/lib/families/celo/js-getTransactionStatus.d.ts.map +1 -0
  155. package/lib/families/celo/js-getTransactionStatus.js +86 -0
  156. package/lib/families/celo/js-getTransactionStatus.js.map +1 -0
  157. package/lib/families/celo/js-prepareTransaction.d.ts +5 -0
  158. package/lib/families/celo/js-prepareTransaction.d.ts.map +1 -0
  159. package/lib/families/celo/js-prepareTransaction.js +76 -0
  160. package/lib/families/celo/js-prepareTransaction.js.map +1 -0
  161. package/lib/families/celo/js-signOperation.d.ts +13 -0
  162. package/lib/families/celo/js-signOperation.d.ts.map +1 -0
  163. package/lib/families/celo/js-signOperation.js +150 -0
  164. package/lib/families/celo/js-signOperation.js.map +1 -0
  165. package/lib/families/celo/js-synchronisation.d.ts +10 -0
  166. package/lib/families/celo/js-synchronisation.d.ts.map +1 -0
  167. package/lib/families/celo/js-synchronisation.js +88 -0
  168. package/lib/families/celo/js-synchronisation.js.map +1 -0
  169. package/lib/families/celo/specs.d.ts +7 -0
  170. package/lib/families/celo/specs.d.ts.map +1 -0
  171. package/lib/families/celo/specs.js +56 -0
  172. package/lib/families/celo/specs.js.map +1 -0
  173. package/lib/families/celo/speculos-deviceActions.d.ts +7 -0
  174. package/lib/families/celo/speculos-deviceActions.d.ts.map +1 -0
  175. package/lib/families/celo/speculos-deviceActions.js +52 -0
  176. package/lib/families/celo/speculos-deviceActions.js.map +1 -0
  177. package/lib/families/celo/transaction.d.ts +11 -0
  178. package/lib/families/celo/transaction.d.ts.map +1 -0
  179. package/lib/families/celo/transaction.js +39 -0
  180. package/lib/families/celo/transaction.js.map +1 -0
  181. package/lib/families/celo/types.d.ts +16 -0
  182. package/lib/families/celo/types.d.ts.map +1 -0
  183. package/lib/families/celo/types.js +6 -0
  184. package/lib/families/celo/types.js.map +1 -0
  185. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.d.ts +1 -0
  186. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.d.ts.map +1 -1
  187. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js +1 -0
  188. package/lib/families/ethereum/datasets/ethereum.scanAccounts.1.js.map +1 -1
  189. package/lib/families/ethereum/modules/erc1155.d.ts.map +1 -1
  190. package/lib/families/ethereum/modules/erc1155.js +8 -2
  191. package/lib/families/ethereum/modules/erc1155.js.map +1 -1
  192. package/lib/families/ethereum/signOperation.d.ts.map +1 -1
  193. package/lib/families/ethereum/signOperation.js +26 -15
  194. package/lib/families/ethereum/signOperation.js.map +1 -1
  195. package/lib/families/ethereum/specs.d.ts.map +1 -1
  196. package/lib/families/ethereum/specs.js +2 -4
  197. package/lib/families/ethereum/specs.js.map +1 -1
  198. package/lib/families/ethereum/transaction.d.ts +4 -1
  199. package/lib/families/ethereum/transaction.d.ts.map +1 -1
  200. package/lib/families/ethereum/transaction.js +15 -27
  201. package/lib/families/ethereum/transaction.js.map +1 -1
  202. package/lib/families/polkadot/cache.d.ts +1 -1
  203. package/lib/families/polkadot/cache.js +1 -1
  204. package/lib/families/solana/api/chain/instruction/token/types.d.ts +1 -1
  205. package/lib/families/solana/specs.js +1 -1
  206. package/lib/families/solana/specs.js.map +1 -1
  207. package/lib/families/tezos/bakers.whitelist-default.d.ts.map +1 -1
  208. package/lib/families/tezos/bakers.whitelist-default.js +1 -1
  209. package/lib/families/tezos/bakers.whitelist-default.js.map +1 -1
  210. package/lib/families/tezos/bridge/js.d.ts.map +1 -1
  211. package/lib/families/tezos/bridge/js.js +2 -1
  212. package/lib/families/tezos/bridge/js.js.map +1 -1
  213. package/lib/families/tezos/test-specifics.d.ts.map +1 -1
  214. package/lib/families/tezos/test-specifics.js +1 -0
  215. package/lib/families/tezos/test-specifics.js.map +1 -1
  216. package/lib/featureFlags/FeatureToggle.d.ts +10 -0
  217. package/lib/featureFlags/FeatureToggle.d.ts.map +1 -0
  218. package/lib/featureFlags/FeatureToggle.js +17 -0
  219. package/lib/featureFlags/FeatureToggle.js.map +1 -0
  220. package/lib/featureFlags/defaultFeatures.d.ts +3 -0
  221. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -0
  222. package/lib/featureFlags/defaultFeatures.js +9 -0
  223. package/lib/featureFlags/defaultFeatures.js.map +1 -0
  224. package/lib/featureFlags/index.d.ts +5 -0
  225. package/lib/featureFlags/index.d.ts.map +1 -0
  226. package/lib/featureFlags/index.js +17 -0
  227. package/lib/featureFlags/index.js.map +1 -0
  228. package/lib/featureFlags/provider.d.ts +13 -0
  229. package/lib/featureFlags/provider.d.ts.map +1 -0
  230. package/lib/featureFlags/provider.js +68 -0
  231. package/lib/featureFlags/provider.js.map +1 -0
  232. package/lib/featureFlags/types.d.ts +8 -0
  233. package/lib/featureFlags/types.d.ts.map +1 -0
  234. package/lib/featureFlags/types.js +3 -0
  235. package/lib/featureFlags/types.js.map +1 -0
  236. package/lib/featureFlags/useFeature.d.ts +3 -0
  237. package/lib/featureFlags/useFeature.d.ts.map +1 -0
  238. package/lib/featureFlags/useFeature.js +9 -0
  239. package/lib/featureFlags/useFeature.js.map +1 -0
  240. package/lib/generated/bridge/js.d.ts +4 -0
  241. package/lib/generated/bridge/js.d.ts.map +1 -1
  242. package/lib/generated/bridge/js.js +24 -22
  243. package/lib/generated/bridge/js.js.map +1 -1
  244. package/lib/generated/cli-transaction.d.ts +9 -0
  245. package/lib/generated/cli-transaction.d.ts.map +1 -1
  246. package/lib/generated/cli-transaction.js +24 -22
  247. package/lib/generated/cli-transaction.js.map +1 -1
  248. package/lib/generated/deviceTransactionConfig.d.ts +2 -0
  249. package/lib/generated/deviceTransactionConfig.d.ts.map +1 -1
  250. package/lib/generated/deviceTransactionConfig.js +22 -20
  251. package/lib/generated/deviceTransactionConfig.js.map +1 -1
  252. package/lib/generated/hw-getAddress.d.ts +1 -0
  253. package/lib/generated/hw-getAddress.d.ts.map +1 -1
  254. package/lib/generated/hw-getAddress.js +26 -24
  255. package/lib/generated/hw-getAddress.js.map +1 -1
  256. package/lib/generated/specs.d.ts +3 -0
  257. package/lib/generated/specs.d.ts.map +1 -1
  258. package/lib/generated/specs.js +24 -22
  259. package/lib/generated/specs.js.map +1 -1
  260. package/lib/generated/speculos-deviceActions.d.ts +3 -0
  261. package/lib/generated/speculos-deviceActions.d.ts.map +1 -1
  262. package/lib/generated/speculos-deviceActions.js +24 -22
  263. package/lib/generated/speculos-deviceActions.js.map +1 -1
  264. package/lib/generated/transaction.d.ts +5 -0
  265. package/lib/generated/transaction.d.ts.map +1 -1
  266. package/lib/generated/transaction.js +26 -24
  267. package/lib/generated/transaction.js.map +1 -1
  268. package/lib/generated/types.d.ts +12 -6
  269. package/lib/generated/types.d.ts.map +1 -1
  270. package/lib/generated/types.js +14 -12
  271. package/lib/generated/types.js.map +1 -1
  272. package/lib/load/speculos.d.ts +7 -0
  273. package/lib/load/speculos.d.ts.map +1 -1
  274. package/lib/load/speculos.js +27 -11
  275. package/lib/load/speculos.js.map +1 -1
  276. package/lib/types/index.d.ts +1 -0
  277. package/lib/types/index.d.ts.map +1 -1
  278. package/lib/types/index.js +1 -0
  279. package/lib/types/index.js.map +1 -1
  280. package/package.json +23 -21
  281. package/src/.DS_Store +0 -0
  282. package/src/{data/flags → __tests__}/.DS_Store +0 -0
  283. package/src/__tests__/__snapshots__/all.libcore.ts.snap +457 -33509
  284. package/src/__tests__/families/bitcoin/wallet-btc/xpub.getAddress.ts +47 -0
  285. package/src/__tests__/families/bitcoin/wallet-btc/xpub.pickingStrategies.integration.test.ts +0 -11
  286. package/src/__tests__/test-helpers/setup.ts +1 -0
  287. package/src/account/support.ts +1 -0
  288. package/src/api/Ethereum.ts +1 -0
  289. package/src/apps/polyfill.ts +1 -0
  290. package/src/bot/engine.ts +4 -1
  291. package/src/bridge/jsHelpers.ts +1 -1
  292. package/src/data/icons/react/celo.tsx +12 -0
  293. package/src/data/icons/react/index.tsx +1 -0
  294. package/src/data/icons/reactNative/celo.tsx +13 -0
  295. package/src/data/icons/reactNative/index.tsx +1 -0
  296. package/src/data/icons/svg/CELO.svg +5 -0
  297. package/src/env.ts +10 -0
  298. package/src/exchange/platform/transfer/index.ts +21 -1
  299. package/src/families/algorand/buildTransaction.ts +4 -8
  300. package/src/families/algorand/js-getFeesForTransaction.ts +1 -1
  301. package/src/families/algorand/js-signOperation.ts +2 -2
  302. package/src/families/algorand/js-synchronization.ts +1 -0
  303. package/src/families/bitcoin/js-signOperation.ts +3 -5
  304. package/src/families/bitcoin/js-synchronisation.ts +4 -4
  305. package/src/families/bitcoin/wallet-btc/crypto/base.ts +31 -18
  306. package/src/families/bitcoin/wallet-btc/crypto/bitcoin.ts +3 -17
  307. package/src/families/bitcoin/wallet-btc/crypto/bitcoincash.ts +5 -39
  308. package/src/families/bitcoin/wallet-btc/crypto/decred.ts +2 -15
  309. package/src/families/bitcoin/wallet-btc/crypto/litecoin.ts +1 -71
  310. package/src/families/bitcoin/wallet-btc/crypto/types.ts +7 -0
  311. package/src/families/bitcoin/wallet-btc/crypto/zec.ts +4 -22
  312. package/src/families/bitcoin/wallet-btc/crypto/zen.ts +4 -22
  313. package/src/families/bitcoin/wallet-btc/explorer/index.ts +20 -0
  314. package/src/families/bitcoin/wallet-btc/storage/types.ts +0 -1
  315. package/src/families/celo/api/hubble.ts +93 -0
  316. package/src/families/celo/api/index.ts +1 -0
  317. package/src/families/celo/api/sdk.ts +8 -0
  318. package/src/families/celo/bridge/js.ts +38 -0
  319. package/src/families/celo/cli-transaction.ts +41 -0
  320. package/src/families/celo/datasets/celo.scanAccounts.1.ts +20 -0
  321. package/src/families/celo/deviceTransactionConfig.ts +19 -0
  322. package/src/families/celo/hw-app-celo.ts +108 -0
  323. package/src/families/celo/hw-getAddress.ts +1 -0
  324. package/src/families/celo/js-broadcast.ts +12 -0
  325. package/src/families/celo/js-buildTransaction.ts +32 -0
  326. package/src/families/celo/js-createTransaction.ts +12 -0
  327. package/src/families/celo/js-estimateMaxSpendable.ts +28 -0
  328. package/src/families/celo/js-getFeesForTransaction.ts +38 -0
  329. package/src/families/celo/js-getTransactionStatus.ts +67 -0
  330. package/src/families/celo/js-prepareTransaction.ts +28 -0
  331. package/src/families/celo/js-signOperation.ts +149 -0
  332. package/src/families/celo/js-synchronisation.ts +40 -0
  333. package/src/families/celo/specs.ts +53 -0
  334. package/src/families/celo/speculos-deviceActions.ts +50 -0
  335. package/src/families/celo/transaction.ts +39 -0
  336. package/src/families/celo/types.ts +20 -0
  337. package/src/families/ethereum/datasets/ethereum.scanAccounts.1.ts +1 -0
  338. package/src/families/ethereum/modules/erc1155.ts +9 -0
  339. package/src/families/ethereum/signOperation.ts +21 -20
  340. package/src/families/ethereum/specs.ts +0 -2
  341. package/src/families/ethereum/transaction.ts +10 -24
  342. package/src/families/polkadot/cache.ts +1 -1
  343. package/src/families/solana/specs.ts +1 -1
  344. package/src/families/tezos/bakers.whitelist-default.ts +0 -2
  345. package/src/families/tezos/bridge/js.ts +6 -1
  346. package/src/families/tezos/test-specifics.ts +1 -0
  347. package/src/featureFlags/FeatureToggle.tsx +24 -0
  348. package/src/featureFlags/defaultFeatures.ts +7 -0
  349. package/src/featureFlags/index.ts +4 -0
  350. package/src/featureFlags/provider.tsx +48 -0
  351. package/src/featureFlags/types.ts +9 -0
  352. package/src/featureFlags/useFeature.ts +8 -0
  353. package/src/generated/bridge/js.ts +3 -0
  354. package/src/generated/cli-transaction.ts +3 -0
  355. package/src/generated/deviceTransactionConfig.ts +3 -0
  356. package/src/generated/hw-getAddress.ts +3 -0
  357. package/src/generated/specs.ts +3 -0
  358. package/src/generated/speculos-deviceActions.ts +3 -0
  359. package/src/generated/transaction.ts +3 -0
  360. package/src/generated/types.ts +14 -0
  361. package/src/load/speculos.ts +23 -10
  362. package/src/types/index.ts +1 -0
@@ -0,0 +1,47 @@
1
+ import { DerivationModes } from "../../../../families/bitcoin/wallet-btc";
2
+ import BitcoinLikeStorage from "../../../../families/bitcoin/wallet-btc/storage";
3
+ import BitcoinLikeExplorer from "../../../../families/bitcoin/wallet-btc/explorer";
4
+ import Xpub from "../../../../families/bitcoin/wallet-btc/xpub";
5
+ import coininfo from "coininfo";
6
+ import BCHCrypto from "../../../../families/bitcoin/wallet-btc/crypto/bitcoincash";
7
+ import BTCCrypto from "../../../../families/bitcoin/wallet-btc/crypto/bitcoin";
8
+
9
+ describe("Unit tests for getAddress", () => {
10
+ it("Test getAddress for bch and btc", async () => {
11
+ const bchCrypto = new BCHCrypto({
12
+ network: coininfo.bitcoincash.main.toBitcoinJS(),
13
+ });
14
+ const btcCrypto = new BTCCrypto({
15
+ network: coininfo.bitcoin.main.toBitcoinJS(),
16
+ });
17
+ const bchxpub = new Xpub({
18
+ storage: new BitcoinLikeStorage(),
19
+ explorer: new BitcoinLikeExplorer({
20
+ explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/bch",
21
+ explorerVersion: "v3",
22
+ }),
23
+ crypto: bchCrypto,
24
+ xpub: "xpub6BtWBf3Pu6hYwJBKvEwG7JtrTxxDrSGy39HaTgZz6GTSaFWFdoCtuEXSQtoKGaYdz1emg8xTXKYwjhu3xXRPzFnYS1z4yjKj7hLDQyNeDZr",
25
+ derivationMode: DerivationModes.LEGACY,
26
+ });
27
+ await bchxpub.syncAddress(0, 0);
28
+ let addresses = await bchxpub.getXpubAddresses();
29
+ expect(addresses[0].address).toEqual(
30
+ "bitcoincash:qrgwhfg7tn4xs9pg2vu5rhkud490j9yfnqd63uk64m"
31
+ );
32
+
33
+ const btcxpub = new Xpub({
34
+ storage: new BitcoinLikeStorage(),
35
+ explorer: new BitcoinLikeExplorer({
36
+ explorerURI: "https://explorers.api.vault.ledger.com/blockchain/v3/btc",
37
+ explorerVersion: "v3",
38
+ }),
39
+ crypto: btcCrypto,
40
+ xpub: "xpub6BtWBf3Pu6hYwJBKvEwG7JtrTxxDrSGy39HaTgZz6GTSaFWFdoCtuEXSQtoKGaYdz1emg8xTXKYwjhu3xXRPzFnYS1z4yjKj7hLDQyNeDZr",
41
+ derivationMode: DerivationModes.LEGACY,
42
+ });
43
+ await btcxpub.syncAddress(0, 0);
44
+ addresses = await btcxpub.getXpubAddresses();
45
+ expect(addresses[0].address).toEqual("1L3fqoWstvLqEA6TgXkuLoXX8xG1xhirG3");
46
+ }, 60000);
47
+ });
@@ -67,7 +67,6 @@ describe("testing xpub legacy transactions", () => {
67
67
  output_index: 0,
68
68
  value: "5000000000",
69
69
  address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
70
- script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
71
70
  output_hash:
72
71
  "9e1b337875c21f751e70ee2c2c6ee93d8a6733d0f3ba6d139ae6a0479ebcefb0",
73
72
  block_height: 1,
@@ -77,8 +76,6 @@ describe("testing xpub legacy transactions", () => {
77
76
  output_index: 1,
78
77
  value: "0",
79
78
  address: "<unknown>",
80
- script_hex:
81
- "6a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf9",
82
79
  output_hash:
83
80
  "9e1b337875c21f751e70ee2c2c6ee93d8a6733d0f3ba6d139ae6a0479ebcefb0",
84
81
  block_height: 1,
@@ -112,7 +109,6 @@ describe("testing xpub legacy transactions", () => {
112
109
  output_index: 0,
113
110
  value: "300000000",
114
111
  address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
115
- script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
116
112
  output_hash:
117
113
  "0b9f98d07eb418fa20573112d3cba6b871d429a06c724a7888ff0886be5213d1",
118
114
  block_height: 120,
@@ -122,7 +118,6 @@ describe("testing xpub legacy transactions", () => {
122
118
  output_index: 1,
123
119
  value: "4699983200",
124
120
  address: "2MynSTpze5SDcuLr1DekSV7RVrFpQCo3LeP",
125
- script_hex: "a91447b810238a31777fc4e4de474419464c46aadf8187",
126
121
  output_hash:
127
122
  "0b9f98d07eb418fa20573112d3cba6b871d429a06c724a7888ff0886be5213d1",
128
123
  block_height: 120,
@@ -209,7 +204,6 @@ describe("testing xpub legacy transactions", () => {
209
204
  output_index: 0,
210
205
  value: "4599966400",
211
206
  address: "2NCSYYp4bWdHDYf9nYP1NDKb1GMBqa8e57H",
212
- script_hex: "a914d28e7592fc2657433296eafc89e4a8d29289ebf087",
213
207
  output_hash:
214
208
  "8f30fe84da5a5846d668b4bad260730f2b0125fa66fb2633fa1cee23c6b11053",
215
209
  block_height: 122,
@@ -219,7 +213,6 @@ describe("testing xpub legacy transactions", () => {
219
213
  output_index: 1,
220
214
  value: "100000000",
221
215
  address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
222
- script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
223
216
  output_hash:
224
217
  "8f30fe84da5a5846d668b4bad260730f2b0125fa66fb2633fa1cee23c6b11053",
225
218
  block_height: 122,
@@ -253,7 +246,6 @@ describe("testing xpub legacy transactions", () => {
253
246
  output_index: 0,
254
247
  value: "4399949600",
255
248
  address: "2NFToPiLBtuKiqzZj43nPXknN8d4xNySe3o",
256
- script_hex: "a914f3b3a49bd90e6e9ae30882a2b7e9b7edfe579a8c87",
257
249
  output_hash:
258
250
  "2f90f3312ffd4dce490cb2f7429c586a43ef68c99fc2f8e549127b72af7b4209",
259
251
  block_height: 123,
@@ -263,7 +255,6 @@ describe("testing xpub legacy transactions", () => {
263
255
  output_index: 1,
264
256
  value: "200000000",
265
257
  address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
266
- script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
267
258
  output_hash:
268
259
  "2f90f3312ffd4dce490cb2f7429c586a43ef68c99fc2f8e549127b72af7b4209",
269
260
  block_height: 123,
@@ -297,7 +288,6 @@ describe("testing xpub legacy transactions", () => {
297
288
  output_index: 0,
298
289
  value: "600000000",
299
290
  address: "mwXTtHo8Yy3aNKUUZLkBDrTcKT9qG9TqLb",
300
- script_hex: "76a914af9ab6987aa41b37c8bcb7c61154165d23f09e3488ac",
301
291
  output_hash:
302
292
  "2fee0c4b55e08583aa5bc565d7e428f7cdcbd2b73262f62208a6a72a74e2c945",
303
293
  block_height: 124,
@@ -307,7 +297,6 @@ describe("testing xpub legacy transactions", () => {
307
297
  output_index: 1,
308
298
  value: "3799932800",
309
299
  address: "2N53XuFRxqbShpK4XKwC1VXT4zu1wCzbAMU",
310
- script_hex: "a914816b7896ce2c4f21c39c865030fe07e7a042a9c687",
311
300
  output_hash:
312
301
  "2fee0c4b55e08583aa5bc565d7e428f7cdcbd2b73262f62208a6a72a74e2c945",
313
302
  block_height: 124,
@@ -56,4 +56,5 @@ setSupportedCurrencies([
56
56
  "crypto_org",
57
57
  "filecoin",
58
58
  "solana",
59
+ "celo",
59
60
  ]);
@@ -21,6 +21,7 @@ import { getAccountBridge } from "../bridge";
21
21
  import jsBridges from "../generated/bridge/js";
22
22
 
23
23
  const experimentalIntegrations = ["algorand", "tezos"];
24
+
24
25
  export function shouldUseJS(currency: CryptoCurrency) {
25
26
  const jsBridge = jsBridges[currency.family];
26
27
  if (!jsBridge) return false;
@@ -138,6 +138,7 @@ export const apiForCurrency = (currency: CryptoCurrency): API => {
138
138
  noinput: true,
139
139
  no_input: true,
140
140
  no_token: true,
141
+ filtering: true,
141
142
  block_hash,
142
143
  },
143
144
  }),
@@ -53,6 +53,7 @@ export const whitelistDependencies = ["Decred", "Decred Testnet"];
53
53
  ["POAP", "Ethereum"],
54
54
  ["OlympusDAO", "Ethereum"],
55
55
  ["Rarible", "Ethereum"],
56
+ ["Ricochet", "Ethereum"],
56
57
  ].forEach(([name, dep]) => declareDep(name, dep));
57
58
  export const getDependencies = (appName: string): string[] =>
58
59
  directDep[appName] || [];
package/src/bot/engine.ts CHANGED
@@ -81,6 +81,9 @@ export async function runWithAppSpec<T extends Transaction>(
81
81
  const mutationReports: MutationReport<T>[] = [];
82
82
  const { appQuery, currency, dependency } = spec;
83
83
  const appCandidate = findAppCandidate(appCandidates, appQuery);
84
+ if (!appCandidate) {
85
+ console.warn("no app found for " + spec.name, { appQuery, appCandidates });
86
+ }
84
87
  invariant(
85
88
  appCandidate,
86
89
  "%s: no app found. Are you sure your COINAPPS is up to date?",
@@ -401,7 +404,7 @@ export async function runOnAccount<T extends Transaction>({
401
404
  }
402
405
  }
403
406
 
404
- // without recovering mecanism, we simply assume an error is a failure
407
+ // without recovering mechanism, we simply assume an error is a failure
405
408
  if (errors.length) {
406
409
  throw errors[0];
407
410
  }
@@ -97,7 +97,7 @@ Operation[] {
97
97
  newOps.forEach((op) => {
98
98
  newOpsIds[op.id] = op;
99
99
  });
100
- // return existins when there is no real new operations
100
+ // return existing when there is no real new operations
101
101
  if (newOps.length === 0) return existing;
102
102
  // edge case, existing can be empty. return the sorted list.
103
103
  if (existing.length === 0) return Object.values(newOpsIds);
@@ -0,0 +1,12 @@
1
+
2
+ import * as React from "react";
3
+ interface Props {
4
+ size: number;
5
+ color?: string;
6
+ };
7
+
8
+ function celo({size, color = "currentColor"}: Props) {
9
+ return <svg width={size} height={size} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.1053 19.1053C12.9834 19.1053 15.3158 16.7728 15.3158 13.8947C15.3158 11.0166 12.9834 8.68421 10.1053 8.68421C7.22716 8.68421 4.89474 11.0166 4.89474 13.8947C4.89474 16.7728 7.22716 19.1053 10.1053 19.1053ZM10.1053 21C6.18126 21 3 17.8187 3 13.8947C3 9.97074 6.18126 6.78947 10.1053 6.78947C14.0293 6.78947 17.2105 9.97074 17.2105 13.8947C17.2105 17.8187 14.0293 21 10.1053 21Z" fill={color} /><path d="M13.8947 15.3158C16.7728 15.3158 19.1053 12.9834 19.1053 10.1053C19.1053 7.22716 16.7728 4.89474 13.8947 4.89474C11.0166 4.89474 8.68421 7.22716 8.68421 10.1053C8.68421 12.9834 11.0166 15.3158 13.8947 15.3158ZM13.8947 17.2105C9.97074 17.2105 6.78947 14.0293 6.78947 10.1053C6.78947 6.18126 9.97074 3 13.8947 3C17.8187 3 21 6.18126 21 10.1053C21 14.0293 17.8187 17.2105 13.8947 17.2105Z" fill={color} /><path d="M14.1297 17.2105C14.6223 16.6137 14.9747 15.9145 15.1623 15.1623C15.9126 14.9747 16.6118 14.6223 17.2105 14.1297C17.184 14.9994 16.9964 15.8558 16.6573 16.6592C15.8558 16.9964 14.9994 17.184 14.1297 17.2105ZM8.83768 8.83768C8.08737 9.02526 7.38821 9.37768 6.78947 9.87032C6.816 9.00063 7.00358 8.14421 7.34274 7.34274C8.14421 7.00547 9.00253 6.81789 9.87032 6.78947C9.37768 7.38632 9.02526 8.08547 8.83768 8.83768Z" fill={color} /></svg>;
10
+ }
11
+
12
+ export default celo;
@@ -78,6 +78,7 @@ export { default as call } from "./call";
78
78
  export { default as cc } from "./cc";
79
79
  export { default as cdn } from "./cdn";
80
80
  export { default as cdt } from "./cdt";
81
+ export { default as celo } from "./celo";
81
82
  export { default as cenz } from "./cenz";
82
83
  export { default as chain } from "./chain";
83
84
  export { default as chat } from "./chat";
@@ -0,0 +1,13 @@
1
+
2
+ import * as React from "react";
3
+ import Svg, { Path } from "react-native-svg";
4
+ interface Props {
5
+ size: number;
6
+ color: string;
7
+ };
8
+
9
+ function celo({ size, color }: Props) {
10
+ return <Svg width={size} height={size} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><Path d="M10.1053 19.1053C12.9834 19.1053 15.3158 16.7728 15.3158 13.8947C15.3158 11.0166 12.9834 8.68421 10.1053 8.68421C7.22716 8.68421 4.89474 11.0166 4.89474 13.8947C4.89474 16.7728 7.22716 19.1053 10.1053 19.1053ZM10.1053 21C6.18126 21 3 17.8187 3 13.8947C3 9.97074 6.18126 6.78947 10.1053 6.78947C14.0293 6.78947 17.2105 9.97074 17.2105 13.8947C17.2105 17.8187 14.0293 21 10.1053 21Z" fill={color} /><Path d="M13.8947 15.3158C16.7728 15.3158 19.1053 12.9834 19.1053 10.1053C19.1053 7.22716 16.7728 4.89474 13.8947 4.89474C11.0166 4.89474 8.68421 7.22716 8.68421 10.1053C8.68421 12.9834 11.0166 15.3158 13.8947 15.3158ZM13.8947 17.2105C9.97074 17.2105 6.78947 14.0293 6.78947 10.1053C6.78947 6.18126 9.97074 3 13.8947 3C17.8187 3 21 6.18126 21 10.1053C21 14.0293 17.8187 17.2105 13.8947 17.2105Z" fill={color} /><Path d="M14.1297 17.2105C14.6223 16.6137 14.9747 15.9145 15.1623 15.1623C15.9126 14.9747 16.6118 14.6223 17.2105 14.1297C17.184 14.9994 16.9964 15.8558 16.6573 16.6592C15.8558 16.9964 14.9994 17.184 14.1297 17.2105ZM8.83768 8.83768C8.08737 9.02526 7.38821 9.37768 6.78947 9.87032C6.816 9.00063 7.00358 8.14421 7.34274 7.34274C8.14421 7.00547 9.00253 6.81789 9.87032 6.78947C9.37768 7.38632 9.02526 8.08547 8.83768 8.83768Z" fill={color} /></Svg>;
11
+ }
12
+
13
+ export default celo;
@@ -78,6 +78,7 @@ export { default as call } from "./call";
78
78
  export { default as cc } from "./cc";
79
79
  export { default as cdn } from "./cdn";
80
80
  export { default as cdt } from "./cdt";
81
+ export { default as celo } from "./celo";
81
82
  export { default as cenz } from "./cenz";
82
83
  export { default as chain } from "./chain";
83
84
  export { default as chat } from "./chat";
@@ -0,0 +1,5 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M10.1053 19.1053C12.9834 19.1053 15.3158 16.7728 15.3158 13.8947C15.3158 11.0166 12.9834 8.68421 10.1053 8.68421C7.22716 8.68421 4.89474 11.0166 4.89474 13.8947C4.89474 16.7728 7.22716 19.1053 10.1053 19.1053ZM10.1053 21C6.18126 21 3 17.8187 3 13.8947C3 9.97074 6.18126 6.78947 10.1053 6.78947C14.0293 6.78947 17.2105 9.97074 17.2105 13.8947C17.2105 17.8187 14.0293 21 10.1053 21Z" fill="#42D689"/>
3
+ <path d="M13.8947 15.3158C16.7728 15.3158 19.1053 12.9834 19.1053 10.1053C19.1053 7.22716 16.7728 4.89474 13.8947 4.89474C11.0166 4.89474 8.68421 7.22716 8.68421 10.1053C8.68421 12.9834 11.0166 15.3158 13.8947 15.3158ZM13.8947 17.2105C9.97074 17.2105 6.78947 14.0293 6.78947 10.1053C6.78947 6.18126 9.97074 3 13.8947 3C17.8187 3 21 6.18126 21 10.1053C21 14.0293 17.8187 17.2105 13.8947 17.2105Z" fill="#42D689"/>
4
+ <path d="M14.1297 17.2105C14.6223 16.6137 14.9747 15.9145 15.1623 15.1623C15.9126 14.9747 16.6118 14.6223 17.2105 14.1297C17.184 14.9994 16.9964 15.8558 16.6573 16.6592C15.8558 16.9964 14.9994 17.184 14.1297 17.2105ZM8.83768 8.83768C8.08737 9.02526 7.38821 9.37768 6.78947 9.87032C6.816 9.00063 7.00358 8.14421 7.34274 7.34274C8.14421 7.00547 9.00253 6.81789 9.87032 6.78947C9.37768 7.38632 9.02526 8.08547 8.83768 8.83768Z" fill="#42D689"/>
5
+ </svg>
package/src/env.ts CHANGED
@@ -40,6 +40,16 @@ const envDefinitions = {
40
40
  parser: stringParser,
41
41
  desc: "Node API endpoint for algorand",
42
42
  },
43
+ API_CELO_INDEXER: {
44
+ def: "https://celo.coin.ledger.com/indexer/",
45
+ parser: stringParser,
46
+ desc: "Explorer API for celo",
47
+ },
48
+ API_CELO_NODE: {
49
+ def: "https://celo.coin.ledger.com/archive/",
50
+ parser: stringParser,
51
+ desc: "Node endpoint for celo",
52
+ },
43
53
  API_COSMOS_BLOCKCHAIN_EXPLORER_API_ENDPOINT: {
44
54
  def: "https://cosmoshub4.coin.ledger.com/",
45
55
  parser: stringParser,
@@ -32,7 +32,27 @@ const fundProviders: Record<
32
32
  curve: string;
33
33
  }
34
34
  > = {
35
- // FIXME: no prod provider for now
35
+ baanx: {
36
+ /**
37
+ * nameAndPubkey is the concatenation of:
38
+ * - an empty buffer of the size of the partner name
39
+ * - a buffer created from the partner name string in ascii encoding
40
+ * - a buffer created from the hexadecimal version of the partner public key
41
+ */
42
+ nameAndPubkey: Buffer.concat([
43
+ Buffer.from([5]),
44
+ Buffer.from("Baanx", "ascii"),
45
+ Buffer.from(
46
+ "04551878b446b6a711949fa51cc5a8685602f8ffb1dfd08f6ab869019d7c125d7737a79e8b5022d860ec7dfbe062d510fec3b5fe0f6ebb1f5e55a074bb7e5dbc4e",
47
+ "hex"
48
+ ),
49
+ ]),
50
+ signature: Buffer.from(
51
+ "304402200345c39e93a22c5ac3f1e70f8b9938b3a60d3a4906067443cf11095af0e685a502201ee5d88dd5539ce36341e49e2505c2a1659e26d8ff08801ed33c50a9126aedd1",
52
+ "hex"
53
+ ),
54
+ curve: "secp256r1",
55
+ },
36
56
  };
37
57
 
38
58
  const getProvider = (
@@ -1,6 +1,5 @@
1
1
  import { encode as msgpackEncode } from "algo-msgpack-with-bigint";
2
2
  import type {
3
- SuggestedParams as AlgoSuggestedParams,
4
3
  Transaction as AlgoTransaction,
5
4
  EncodedTransaction as AlgoTransactionPayload,
6
5
  EncodedSignedTransaction as AlgoSignedTransactionPayload,
@@ -28,8 +27,7 @@ export const buildTransactionPayload = async (
28
27
 
29
28
  const note = memo ? new TextEncoder().encode(memo) : undefined;
30
29
 
31
- // Minor hack: cast the result as a algosdk.SuggestedParams, while it's actually a TransactionParametersResponse
32
- const params = (await getTransactionParams()) as AlgoSuggestedParams;
30
+ const params = await getTransactionParams();
33
31
 
34
32
  let algoTxn: AlgoTransaction;
35
33
  if (subAccount || (assetId && mode === "optIn")) {
@@ -78,18 +76,16 @@ export const buildTransactionPayload = async (
78
76
  return sorted;
79
77
  };
80
78
 
81
- export const encodeToSign = async (
82
- payload: AlgoTransactionPayload
83
- ): Promise<string> => {
79
+ export const encodeToSign = (payload: AlgoTransactionPayload): string => {
84
80
  const msgPackEncoded = msgpackEncode(payload);
85
81
 
86
82
  return Buffer.from(msgPackEncoded).toString("hex");
87
83
  };
88
84
 
89
- export const encodeToBroadcast = async (
85
+ export const encodeToBroadcast = (
90
86
  payload: AlgoTransactionPayload,
91
87
  signature: Buffer
92
- ): Promise<Buffer> => {
88
+ ): Buffer => {
93
89
  const signedPayload: AlgoSignedTransactionPayload = {
94
90
  sig: signature,
95
91
  txn: payload,
@@ -17,7 +17,7 @@ export const getEstimatedFees = async (
17
17
  let suggestedFees = 0;
18
18
  if (params.fee) {
19
19
  const payload = await buildTransactionPayload(account, transaction);
20
- const encoded = await encodeToSign(payload);
20
+ const encoded = encodeToSign(payload);
21
21
  suggestedFees =
22
22
  params.fee * (Buffer.from(encoded, "hex").length + SINGLE_SIGNATURE_SIZE);
23
23
  }
@@ -36,7 +36,7 @@ export const signOperation = ({
36
36
 
37
37
  const algoTx = await buildTransactionPayload(account, transaction);
38
38
 
39
- const toSign = await encodeToSign(algoTx);
39
+ const toSign = encodeToSign(algoTx);
40
40
 
41
41
  const hwApp = new Algorand(transport);
42
42
  const { freshAddressPath } = account;
@@ -53,7 +53,7 @@ export const signOperation = ({
53
53
  throw new Error("No signature");
54
54
  }
55
55
 
56
- const toBroadcast = await encodeToBroadcast(algoTx, signature);
56
+ const toBroadcast = encodeToBroadcast(algoTx, signature);
57
57
 
58
58
  const operation = buildOptimisticOperation(account, transaction);
59
59
 
@@ -291,6 +291,7 @@ const getAccountShape: GetAccountShape = async (
291
291
 
292
292
  const shape = {
293
293
  id: accountId,
294
+ xpub: address,
294
295
  blockHeight: round,
295
296
  balance,
296
297
  spendableBalance,
@@ -32,7 +32,7 @@ const signOperation = ({
32
32
  try {
33
33
  log("hw", `signTransaction ${currency.id} for account ${account.id}`);
34
34
  const txInfo = await buildTransaction(account, transaction);
35
- let senders: string[] = [];
35
+ let senders = new Set<string>();
36
36
  let recipients: string[] = [];
37
37
  let fee = new BigNumber(0);
38
38
  // Maybe better not re-calculate these fields here, instead include them
@@ -41,9 +41,7 @@ const signOperation = ({
41
41
  account,
42
42
  transaction,
43
43
  }).then((res) => {
44
- senders = res.txInputs
45
- .map((i) => i.address)
46
- .filter(Boolean) as string[];
44
+ senders = new Set(res.txInputs.map((i) => i.address).filter(Boolean));
47
45
  recipients = res.txOutputs
48
46
  .filter((o) => o.address && !o.isChange)
49
47
  .map((o) => o.address) as string[];
@@ -140,7 +138,7 @@ const signOperation = ({
140
138
  fee,
141
139
  blockHash: null,
142
140
  blockHeight: null,
143
- senders,
141
+ senders: Array.from(senders),
144
142
  recipients,
145
143
  accountId: account.id,
146
144
  date: new Date(),
@@ -100,7 +100,7 @@ const mapTxToOperations = (
100
100
  const blockHeight = tx.block?.height;
101
101
  const blockHash = tx.block?.hash;
102
102
  const date = new Date(tx.block?.time || tx.received_at);
103
- const senders: string[] = [];
103
+ const senders = new Set<string>();
104
104
  const recipients: string[] = [];
105
105
  let type: OperationType = "OUT";
106
106
  let value = new BigNumber(0);
@@ -111,7 +111,7 @@ const mapTxToOperations = (
111
111
 
112
112
  for (const input of tx.inputs) {
113
113
  if (input.address) {
114
- senders.push(
114
+ senders.add(
115
115
  syncReplaceAddress ? syncReplaceAddress(input.address) : input.address
116
116
  );
117
117
 
@@ -195,7 +195,7 @@ const mapTxToOperations = (
195
195
  type,
196
196
  value,
197
197
  fee,
198
- senders,
198
+ senders: Array.from(senders),
199
199
  recipients,
200
200
  blockHeight,
201
201
  blockHash,
@@ -229,7 +229,7 @@ const mapTxToOperations = (
229
229
  type,
230
230
  value,
231
231
  fee,
232
- senders,
232
+ senders: Array.from(senders),
233
233
  recipients,
234
234
  blockHeight,
235
235
  blockHash,
@@ -84,14 +84,22 @@ class Base implements ICrypto {
84
84
  }
85
85
 
86
86
  // derive legacy address at account and index positions
87
- getLegacyAddress(xpub: string, account: number, index: number): string {
87
+ protected getLegacyAddress(
88
+ xpub: string,
89
+ account: number,
90
+ index: number
91
+ ): string {
88
92
  const publicKeyBuffer: Buffer = this.getPubkeyAt(xpub, account, index);
89
93
  const publicKeyHash160: Buffer = bjs.crypto.hash160(publicKeyBuffer);
90
94
  return bjs.address.toBase58Check(publicKeyHash160, this.network.pubKeyHash);
91
95
  }
92
96
 
93
97
  // derive native SegWit at account and index positions
94
- getNativeSegWitAddress(xpub: string, account: number, index: number): string {
98
+ private getNativeSegWitAddress(
99
+ xpub: string,
100
+ account: number,
101
+ index: number
102
+ ): string {
95
103
  const publicKeyBuffer: Buffer = this.getPubkeyAt(xpub, account, index);
96
104
  const publicKeyHash160: Buffer = bjs.crypto.hash160(publicKeyBuffer);
97
105
  const words: number[] = bech32.toWords(publicKeyHash160);
@@ -100,7 +108,11 @@ class Base implements ICrypto {
100
108
  }
101
109
 
102
110
  // derive SegWit at account and index positions
103
- getSegWitAddress(xpub: string, account: number, index: number): string {
111
+ private getSegWitAddress(
112
+ xpub: string,
113
+ account: number,
114
+ index: number
115
+ ): string {
104
116
  const publicKeyBuffer: Buffer = this.getPubkeyAt(xpub, account, index);
105
117
  const redeemOutput: Buffer = bjs.script.compile([
106
118
  0,
@@ -129,28 +141,29 @@ class Base implements ICrypto {
129
141
  `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
130
142
  ];
131
143
  }
144
+ const res = this.customGetAddress(derivationMode, xpub, account, index);
145
+ Base.addressCache[
146
+ `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
147
+ ] = res;
148
+ return res;
149
+ }
150
+
151
+ customGetAddress(
152
+ derivationMode: string,
153
+ xpub: string,
154
+ account: number,
155
+ index: number
156
+ ): string {
132
157
  switch (derivationMode) {
133
158
  case DerivationModes.LEGACY:
134
- Base.addressCache[
135
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
136
- ] = this.getLegacyAddress(xpub, account, index);
137
- break;
159
+ return this.getLegacyAddress(xpub, account, index);
138
160
  case DerivationModes.SEGWIT:
139
- Base.addressCache[
140
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
141
- ] = this.getSegWitAddress(xpub, account, index);
142
- break;
161
+ return this.getSegWitAddress(xpub, account, index);
143
162
  case DerivationModes.NATIVE_SEGWIT:
144
- Base.addressCache[
145
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
146
- ] = this.getNativeSegWitAddress(xpub, account, index);
147
- break;
163
+ return this.getNativeSegWitAddress(xpub, account, index);
148
164
  default:
149
165
  throw new Error(`Invalid derivation Mode: ${derivationMode}`);
150
166
  }
151
- return Base.addressCache[
152
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
153
- ];
154
167
  }
155
168
 
156
169
  // infer address type from its syntax
@@ -119,31 +119,17 @@ class Bitcoin extends Base {
119
119
  }
120
120
 
121
121
  // get address given an address type
122
- getAddress(
122
+ customGetAddress(
123
123
  derivationMode: string,
124
124
  xpub: string,
125
125
  account: number,
126
126
  index: number
127
127
  ): string {
128
- if (
129
- Base.addressCache[
130
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
131
- ]
132
- ) {
133
- return Base.addressCache[
134
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
135
- ];
136
- }
137
128
  switch (derivationMode) {
138
129
  case DerivationModes.TAPROOT:
139
- Base.addressCache[
140
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
141
- ] = this.getTaprootAddress(xpub, account, index);
142
- return Base.addressCache[
143
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
144
- ];
130
+ return this.getTaprootAddress(xpub, account, index);
145
131
  default:
146
- return super.getAddress(derivationMode, xpub, account, index);
132
+ return super.customGetAddress(derivationMode, xpub, account, index);
147
133
  }
148
134
  }
149
135
 
@@ -1,73 +1,44 @@
1
- // Fix the "More than one instance of bitcore-lib-cash" issue. Refer to https://github.com/bitpay/bitcore/issues/1457
2
- delete global._bitcoreCash;
3
- import * as bch from "bitcore-lib-cash";
4
1
  import bchaddr from "bchaddrjs";
5
2
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6
3
  // @ts-ignore
7
4
  import { toOutputScript } from "bitcoinjs-lib/src/address";
8
5
  import { InvalidAddress } from "@ledgerhq/errors";
9
6
  import { DerivationModes } from "../types";
10
- import { ICrypto } from "./types";
11
7
  import Base from "./base";
12
8
 
13
9
  // a mock explorer class that just use js objects
14
- class BitcoinCash implements ICrypto {
10
+ class BitcoinCash extends Base {
15
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
12
  network: any;
17
13
 
18
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
15
  constructor({ network }: { network: any }) {
16
+ super({ network });
20
17
  this.network = network;
21
18
  this.network.dustThreshold = 5430;
22
19
  this.network.dustPolicy = "FIXED";
23
20
  this.network.usesTimestampedTransaction = false;
24
21
  }
25
22
 
26
- // Based on https://github.com/go-faast/bitcoin-cash-payments/blob/54397eb97c7a9bf08b32e10bef23d5f27aa5ab01/index.js#L63-L73
27
23
  // eslint-disable-next-line
28
24
  getLegacyBitcoinCashAddress(
29
25
  xpub: string,
30
26
  account: number,
31
27
  index: number
32
28
  ): string {
33
- const node = new bch.HDPublicKey(xpub);
34
- const child = node.derive(account).derive(index);
35
- const address = new bch.Address(child.publicKey, bch.Networks.livenet);
36
- const addrstr = address.toString().split(":");
37
- if (addrstr.length === 2) {
38
- return bchaddr.toCashAddress(bchaddr.toLegacyAddress(addrstr[1]));
39
- }
40
- throw new Error(`Unable to derive cash address for ${address}`);
29
+ return bchaddr.toCashAddress(super.getLegacyAddress(xpub, account, index));
41
30
  }
42
31
 
43
32
  // get address given an address type
44
- getAddress(
33
+ customGetAddress(
45
34
  derivationMode: string,
46
35
  xpub: string,
47
36
  account: number,
48
37
  index: number
49
38
  ): string {
50
- if (
51
- Base.addressCache[
52
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
53
- ]
54
- ) {
55
- return Base.addressCache[
56
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
57
- ];
58
- }
59
- const address = this.getLegacyBitcoinCashAddress(xpub, account, index);
60
- Base.addressCache[
61
- `${this.network.name}-${derivationMode}-${xpub}-${account}-${index}`
62
- ] = address;
63
- return address;
39
+ return this.getLegacyBitcoinCashAddress(xpub, account, index);
64
40
  }
65
41
 
66
- // infer address type from its syntax
67
- //
68
- // TODO: improve the prefix matching: make the expected prefix
69
- // correspond to the actual type (currently, a `ltc1` prefix
70
- // could match a native Bitcoin address type for instance)
71
42
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
72
43
  getDerivationMode(address: string) {
73
44
  return DerivationModes.LEGACY;
@@ -85,11 +56,6 @@ class BitcoinCash implements ICrypto {
85
56
  validateAddress(address: string): boolean {
86
57
  return bchaddr.isValidAddress(address);
87
58
  }
88
-
89
- // eslint-disable-next-line
90
- isTaprootAddress(address: string): boolean {
91
- return false;
92
- }
93
59
  }
94
60
 
95
61
  export default BitcoinCash;