@ledgerhq/live-common 34.45.0-nightly.2 → 34.45.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 (289) hide show
  1. package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
  2. package/lib/__tests__/test-helpers/bridge.js +1 -3
  3. package/lib/__tests__/test-helpers/bridge.js.map +1 -1
  4. package/lib/bridge/generic-alpaca/accountBridge.d.ts +1 -1
  5. package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
  6. package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -1
  7. package/lib/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
  8. package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
  9. package/lib/bridge/generic-alpaca/alpaca/index.js +2 -4
  10. package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -1
  11. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +4 -4
  12. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  13. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +10 -10
  14. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  15. package/lib/bridge/generic-alpaca/broadcast.d.ts +1 -1
  16. package/lib/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
  17. package/lib/bridge/generic-alpaca/broadcast.js.map +1 -1
  18. package/lib/bridge/generic-alpaca/createTransaction.d.ts +9 -17
  19. package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
  20. package/lib/bridge/generic-alpaca/createTransaction.js +10 -36
  21. package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -1
  22. package/lib/bridge/generic-alpaca/currencyBridge.d.ts +1 -1
  23. package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
  24. package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -1
  25. package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts +1 -1
  26. package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
  27. package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +0 -9
  28. package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
  29. package/lib/bridge/generic-alpaca/getAccountShape.d.ts +1 -1
  30. package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  31. package/lib/bridge/generic-alpaca/getAccountShape.js +37 -66
  32. package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  33. package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts +1 -1
  34. package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
  35. package/lib/bridge/generic-alpaca/getTransactionStatus.js +15 -27
  36. package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
  37. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +1 -5
  38. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  39. package/lib/bridge/generic-alpaca/prepareTransaction.js +5 -28
  40. package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  41. package/lib/bridge/generic-alpaca/signOperation.d.ts +1 -1
  42. package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
  43. package/lib/bridge/generic-alpaca/signOperation.js +13 -64
  44. package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
  45. package/lib/bridge/generic-alpaca/signer/index.d.ts +1 -1
  46. package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
  47. package/lib/bridge/generic-alpaca/signer/index.js +5 -38
  48. package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
  49. package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +0 -2
  50. package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
  51. package/lib/bridge/generic-alpaca/signer/signTransaction.js +1 -8
  52. package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
  53. package/lib/bridge/generic-alpaca/signer/types.d.ts +0 -3
  54. package/lib/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
  55. package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +46 -70
  56. package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
  57. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
  58. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
  59. package/lib/bridge/generic-alpaca/tests/signOperation.test.js +22 -25
  60. package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
  61. package/lib/bridge/generic-alpaca/utils.d.ts +1 -36
  62. package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
  63. package/lib/bridge/generic-alpaca/utils.js +14 -130
  64. package/lib/bridge/generic-alpaca/utils.js.map +1 -1
  65. package/lib/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
  66. package/lib/bridge/generic-alpaca/{tests/utils.test.js → utils.test.js} +1 -1
  67. package/lib/bridge/generic-alpaca/utils.test.js.map +1 -0
  68. package/lib/bridge/impl.d.ts.map +1 -1
  69. package/lib/bridge/impl.js +4 -5
  70. package/lib/bridge/impl.js.map +1 -1
  71. package/lib/e2e/enum/Account.js +4 -4
  72. package/lib/e2e/enum/Account.js.map +1 -1
  73. package/lib/e2e/enum/AppInfos.d.ts +1 -1
  74. package/lib/e2e/enum/AppInfos.d.ts.map +1 -1
  75. package/lib/e2e/enum/AppInfos.js +1 -1
  76. package/lib/e2e/enum/AppInfos.js.map +1 -1
  77. package/lib/e2e/enum/Currency.d.ts.map +1 -1
  78. package/lib/e2e/enum/Currency.js +3 -3
  79. package/lib/e2e/enum/Currency.js.map +1 -1
  80. package/lib/e2e/speculos.js +2 -2
  81. package/lib/e2e/speculos.js.map +1 -1
  82. package/lib/exchange/index.d.ts.map +1 -1
  83. package/lib/exchange/index.js +0 -1
  84. package/lib/exchange/index.js.map +1 -1
  85. package/lib/families/canton/bridge.integration.test.d.ts +2 -0
  86. package/lib/families/canton/bridge.integration.test.d.ts.map +1 -0
  87. package/lib/families/canton/bridge.integration.test.js +7 -0
  88. package/lib/families/canton/bridge.integration.test.js.map +1 -0
  89. package/lib/families/stellar/bridge/logic.d.ts +1 -1
  90. package/lib/families/stellar/bridge/logic.d.ts.map +1 -1
  91. package/lib/families/stellar/bridge/logic.js +1 -1
  92. package/lib/families/stellar/bridge/logic.js.map +1 -1
  93. package/lib/families/stellar/bridge/mock.js +2 -2
  94. package/lib/families/stellar/bridge/mock.js.map +1 -1
  95. package/lib/families/stellar/setup.d.ts +6 -3
  96. package/lib/families/stellar/setup.d.ts.map +1 -1
  97. package/lib/families/stellar/setup.js +12 -3
  98. package/lib/families/stellar/setup.js.map +1 -1
  99. package/lib/families/xrp/bridge/mock.js +2 -2
  100. package/lib/families/xrp/bridge/mock.js.map +1 -1
  101. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  102. package/lib/featureFlags/defaultFeatures.js +2 -4
  103. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  104. package/lib/generated/bridge/js.d.ts +1 -0
  105. package/lib/generated/bridge/js.d.ts.map +1 -1
  106. package/lib/generated/bridge/js.js +14 -12
  107. package/lib/generated/bridge/js.js.map +1 -1
  108. package/lib/generated/transaction.d.ts +1 -1
  109. package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js +14 -229
  110. package/lib/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -1
  111. package/lib/modularDrawer/enums.d.ts +1 -0
  112. package/lib/modularDrawer/enums.d.ts.map +1 -1
  113. package/lib/modularDrawer/enums.js +1 -0
  114. package/lib/modularDrawer/enums.js.map +1 -1
  115. package/lib/modularDrawer/useModularDrawerVisibility.d.ts +1 -7
  116. package/lib/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -1
  117. package/lib/modularDrawer/useModularDrawerVisibility.js +2 -18
  118. package/lib/modularDrawer/useModularDrawerVisibility.js.map +1 -1
  119. package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
  120. package/lib-es/__tests__/test-helpers/bridge.js +1 -3
  121. package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
  122. package/lib-es/bridge/generic-alpaca/accountBridge.d.ts +1 -1
  123. package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -1
  124. package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -1
  125. package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts +1 -1
  126. package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -1
  127. package/lib-es/bridge/generic-alpaca/alpaca/index.js +2 -4
  128. package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -1
  129. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +4 -4
  130. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -1
  131. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +10 -10
  132. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -1
  133. package/lib-es/bridge/generic-alpaca/broadcast.d.ts +1 -1
  134. package/lib-es/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
  135. package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -1
  136. package/lib-es/bridge/generic-alpaca/createTransaction.d.ts +9 -17
  137. package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -1
  138. package/lib-es/bridge/generic-alpaca/createTransaction.js +9 -35
  139. package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -1
  140. package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts +1 -1
  141. package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
  142. package/lib-es/bridge/generic-alpaca/currencyBridge.js.map +1 -1
  143. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts +1 -1
  144. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
  145. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +0 -9
  146. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
  147. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts +1 -1
  148. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
  149. package/lib-es/bridge/generic-alpaca/getAccountShape.js +37 -66
  150. package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
  151. package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts +1 -1
  152. package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
  153. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +15 -27
  154. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
  155. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +1 -5
  156. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
  157. package/lib-es/bridge/generic-alpaca/prepareTransaction.js +4 -26
  158. package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
  159. package/lib-es/bridge/generic-alpaca/signOperation.d.ts +1 -1
  160. package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
  161. package/lib-es/bridge/generic-alpaca/signOperation.js +13 -61
  162. package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
  163. package/lib-es/bridge/generic-alpaca/signer/index.d.ts +1 -1
  164. package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
  165. package/lib-es/bridge/generic-alpaca/signer/index.js +6 -39
  166. package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
  167. package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +0 -2
  168. package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -1
  169. package/lib-es/bridge/generic-alpaca/signer/signTransaction.js +0 -6
  170. package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -1
  171. package/lib-es/bridge/generic-alpaca/signer/types.d.ts +0 -3
  172. package/lib-es/bridge/generic-alpaca/signer/types.d.ts.map +1 -1
  173. package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +46 -70
  174. package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -1
  175. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +1 -1
  176. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -1
  177. package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js +22 -25
  178. package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -1
  179. package/lib-es/bridge/generic-alpaca/utils.d.ts +1 -36
  180. package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
  181. package/lib-es/bridge/generic-alpaca/utils.js +14 -130
  182. package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
  183. package/lib-es/bridge/generic-alpaca/utils.test.d.ts.map +1 -0
  184. package/lib-es/bridge/generic-alpaca/{tests/utils.test.js → utils.test.js} +1 -1
  185. package/lib-es/bridge/generic-alpaca/utils.test.js.map +1 -0
  186. package/lib-es/bridge/impl.d.ts.map +1 -1
  187. package/lib-es/bridge/impl.js +4 -5
  188. package/lib-es/bridge/impl.js.map +1 -1
  189. package/lib-es/e2e/enum/Account.js +4 -4
  190. package/lib-es/e2e/enum/Account.js.map +1 -1
  191. package/lib-es/e2e/enum/AppInfos.d.ts +1 -1
  192. package/lib-es/e2e/enum/AppInfos.d.ts.map +1 -1
  193. package/lib-es/e2e/enum/AppInfos.js +1 -1
  194. package/lib-es/e2e/enum/AppInfos.js.map +1 -1
  195. package/lib-es/e2e/enum/Currency.d.ts.map +1 -1
  196. package/lib-es/e2e/enum/Currency.js +3 -3
  197. package/lib-es/e2e/enum/Currency.js.map +1 -1
  198. package/lib-es/e2e/speculos.js +2 -2
  199. package/lib-es/e2e/speculos.js.map +1 -1
  200. package/lib-es/exchange/index.d.ts.map +1 -1
  201. package/lib-es/exchange/index.js +0 -1
  202. package/lib-es/exchange/index.js.map +1 -1
  203. package/lib-es/families/canton/bridge.integration.test.d.ts +2 -0
  204. package/lib-es/families/canton/bridge.integration.test.d.ts.map +1 -0
  205. package/lib-es/families/canton/bridge.integration.test.js +5 -0
  206. package/lib-es/families/canton/bridge.integration.test.js.map +1 -0
  207. package/lib-es/families/stellar/bridge/logic.d.ts +1 -1
  208. package/lib-es/families/stellar/bridge/logic.d.ts.map +1 -1
  209. package/lib-es/families/stellar/bridge/logic.js +1 -1
  210. package/lib-es/families/stellar/bridge/logic.js.map +1 -1
  211. package/lib-es/families/stellar/bridge/mock.js +2 -2
  212. package/lib-es/families/stellar/bridge/mock.js.map +1 -1
  213. package/lib-es/families/stellar/setup.d.ts +6 -3
  214. package/lib-es/families/stellar/setup.d.ts.map +1 -1
  215. package/lib-es/families/stellar/setup.js +10 -2
  216. package/lib-es/families/stellar/setup.js.map +1 -1
  217. package/lib-es/families/xrp/bridge/mock.js +2 -2
  218. package/lib-es/families/xrp/bridge/mock.js.map +1 -1
  219. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  220. package/lib-es/featureFlags/defaultFeatures.js +2 -4
  221. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  222. package/lib-es/generated/bridge/js.d.ts +1 -0
  223. package/lib-es/generated/bridge/js.d.ts.map +1 -1
  224. package/lib-es/generated/bridge/js.js +2 -0
  225. package/lib-es/generated/bridge/js.js.map +1 -1
  226. package/lib-es/generated/transaction.d.ts +1 -1
  227. package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js +14 -229
  228. package/lib-es/modularDrawer/__test__/useModularDrawerVisibility.test.js.map +1 -1
  229. package/lib-es/modularDrawer/enums.d.ts +1 -0
  230. package/lib-es/modularDrawer/enums.d.ts.map +1 -1
  231. package/lib-es/modularDrawer/enums.js +1 -0
  232. package/lib-es/modularDrawer/enums.js.map +1 -1
  233. package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts +1 -7
  234. package/lib-es/modularDrawer/useModularDrawerVisibility.d.ts.map +1 -1
  235. package/lib-es/modularDrawer/useModularDrawerVisibility.js +2 -18
  236. package/lib-es/modularDrawer/useModularDrawerVisibility.js.map +1 -1
  237. package/package.json +70 -71
  238. package/src/__tests__/test-helpers/bridge.ts +1 -3
  239. package/src/bridge/generic-alpaca/accountBridge.ts +4 -1
  240. package/src/bridge/generic-alpaca/alpaca/index.ts +2 -7
  241. package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +22 -17
  242. package/src/bridge/generic-alpaca/broadcast.ts +4 -1
  243. package/src/bridge/generic-alpaca/createTransaction.ts +18 -48
  244. package/src/bridge/generic-alpaca/currencyBridge.ts +1 -1
  245. package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +4 -13
  246. package/src/bridge/generic-alpaca/getAccountShape.ts +46 -84
  247. package/src/bridge/generic-alpaca/getTransactionStatus.ts +22 -46
  248. package/src/bridge/generic-alpaca/prepareTransaction.ts +7 -41
  249. package/src/bridge/generic-alpaca/signOperation.ts +18 -85
  250. package/src/bridge/generic-alpaca/signer/index.ts +7 -43
  251. package/src/bridge/generic-alpaca/signer/signTransaction.ts +0 -11
  252. package/src/bridge/generic-alpaca/signer/types.ts +0 -1
  253. package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +47 -72
  254. package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +1 -1
  255. package/src/bridge/generic-alpaca/tests/signOperation.test.ts +26 -28
  256. package/src/bridge/generic-alpaca/{tests/utils.test.ts → utils.test.ts} +1 -1
  257. package/src/bridge/generic-alpaca/utils.ts +18 -158
  258. package/src/bridge/impl.ts +4 -5
  259. package/src/e2e/enum/Account.ts +4 -4
  260. package/src/e2e/enum/AppInfos.ts +1 -1
  261. package/src/e2e/enum/Currency.ts +13 -3
  262. package/src/e2e/speculos.ts +2 -2
  263. package/src/exchange/index.ts +0 -1
  264. package/src/families/canton/bridge.integration.test.ts +6 -0
  265. package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +2009 -202
  266. package/src/families/stellar/bridge/logic.ts +1 -1
  267. package/src/families/stellar/bridge/mock.ts +2 -2
  268. package/src/families/stellar/setup.ts +22 -2
  269. package/src/families/xrp/bridge/mock.ts +2 -2
  270. package/src/featureFlags/defaultFeatures.ts +2 -4
  271. package/src/generated/bridge/js.ts +2 -0
  272. package/src/modularDrawer/__test__/useModularDrawerVisibility.test.ts +14 -345
  273. package/src/modularDrawer/enums.ts +1 -0
  274. package/src/modularDrawer/useModularDrawerVisibility.ts +2 -26
  275. package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts +0 -17
  276. package/lib/bridge/generic-alpaca/buildSubAccounts.d.ts.map +0 -1
  277. package/lib/bridge/generic-alpaca/buildSubAccounts.js +0 -75
  278. package/lib/bridge/generic-alpaca/buildSubAccounts.js.map +0 -1
  279. package/lib/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
  280. package/lib/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
  281. package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts +0 -17
  282. package/lib-es/bridge/generic-alpaca/buildSubAccounts.d.ts.map +0 -1
  283. package/lib-es/bridge/generic-alpaca/buildSubAccounts.js +0 -65
  284. package/lib-es/bridge/generic-alpaca/buildSubAccounts.js.map +0 -1
  285. package/lib-es/bridge/generic-alpaca/tests/utils.test.d.ts.map +0 -1
  286. package/lib-es/bridge/generic-alpaca/tests/utils.test.js.map +0 -1
  287. package/src/bridge/generic-alpaca/buildSubAccounts.ts +0 -110
  288. /package/lib/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
  289. /package/lib-es/bridge/generic-alpaca/{tests/utils.test.d.ts → utils.test.d.ts} +0 -0
@@ -1 +1 @@
1
- export * from "@ledgerhq/coin-stellar/logic";
1
+ export * from "@ledgerhq/coin-stellar/bridge/logic";
@@ -55,8 +55,8 @@ const createTransaction = (): Transaction => ({
55
55
  memoType: null,
56
56
  useAllAmount: false,
57
57
  mode: "send",
58
- assetReference: "",
59
- assetOwner: "",
58
+ assetCode: "",
59
+ assetIssuer: "",
60
60
  });
61
61
 
62
62
  const updateTransaction = (t, patch) => {
@@ -1,17 +1,37 @@
1
1
  // Goal of this file is to inject all necessary device/signer dependency to coin-modules
2
+ import { createBridges } from "@ledgerhq/coin-stellar/bridge/index";
2
3
  import makeCliTools from "@ledgerhq/coin-stellar/test/cli";
4
+ import { StellarCoinConfig } from "@ledgerhq/coin-stellar/config";
3
5
  import stellarResolver from "@ledgerhq/coin-stellar/signer/index";
6
+ import type {
7
+ StellarAccount,
8
+ Transaction,
9
+ TransactionStatus,
10
+ } from "@ledgerhq/coin-stellar/types/index";
11
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
4
12
  import Stellar from "@ledgerhq/hw-app-str";
5
13
  import Transport from "@ledgerhq/hw-transport";
6
- import { CreateSigner, createResolver } from "../../bridge/setup";
14
+ import type { Bridge } from "@ledgerhq/types-live";
15
+ import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
16
+ import { getCurrencyConfiguration } from "../../config";
7
17
  import { Resolver } from "../../hw/getAddress/types";
8
18
 
9
19
  const createSigner: CreateSigner<Stellar> = (transport: Transport) => {
10
20
  return new Stellar(transport);
11
21
  };
12
22
 
23
+ const stellar = getCryptoCurrencyById("stellar");
24
+ function getCurrencyConfig(): StellarCoinConfig {
25
+ return getCurrencyConfiguration(stellar);
26
+ }
27
+
28
+ const bridge: Bridge<Transaction, StellarAccount, TransactionStatus> = createBridges(
29
+ executeWithSigner(createSigner),
30
+ getCurrencyConfig,
31
+ );
32
+
13
33
  const resolver: Resolver = createResolver(createSigner, stellarResolver);
14
34
 
15
35
  const cliTools = makeCliTools();
16
36
 
17
- export { cliTools, resolver };
37
+ export { bridge, cliTools, resolver };
@@ -33,13 +33,13 @@ export function addNotCreatedRippleMockAddress(addr: string) {
33
33
  notCreatedAddresses.push(addr);
34
34
  }
35
35
 
36
- const defaultGetFees = (a: Account, t: any) => t.fees;
36
+ const defaultGetFees = (a: Account, t: any) => t.fee || new BigNumber(0);
37
37
 
38
38
  const createTransaction = (): Transaction => ({
39
39
  family: "xrp",
40
40
  amount: new BigNumber(0),
41
41
  recipient: "",
42
- fees: new BigNumber(10),
42
+ fee: new BigNumber(10),
43
43
  feeCustomUnit: getCryptoCurrencyById("ripple").units[1],
44
44
  tag: undefined,
45
45
  networkInfo: null,
@@ -616,9 +616,8 @@ export const DEFAULT_FEATURES: Features = {
616
616
  ...DEFAULT_FEATURE,
617
617
  params: {
618
618
  add_account: true,
619
+ earn_flow: true,
619
620
  live_app: true,
620
- live_apps_allowlist: [],
621
- live_apps_blocklist: [],
622
621
  receive_flow: true,
623
622
  send_flow: true,
624
623
  enableModularization: false,
@@ -629,9 +628,8 @@ export const DEFAULT_FEATURES: Features = {
629
628
  ...DEFAULT_FEATURE,
630
629
  params: {
631
630
  add_account: true,
631
+ earn_flow: true,
632
632
  live_app: true,
633
- live_apps_allowlist: [],
634
- live_apps_blocklist: [],
635
633
  receive_flow: true,
636
634
  send_flow: true,
637
635
  enableModularization: false,
@@ -16,6 +16,7 @@ import { bridge as near } from "../../families/near/setup";
16
16
  import { bridge as polkadot } from "../../families/polkadot/setup";
17
17
  import { bridge as solana } from "../../families/solana/setup";
18
18
  import { bridge as stacks } from "../../families/stacks/setup";
19
+ import { bridge as stellar } from "../../families/stellar/setup";
19
20
  import { bridge as tezos } from "../../families/tezos/setup";
20
21
  import { bridge as ton } from "../../families/ton/setup";
21
22
  import { bridge as tron } from "../../families/tron/setup";
@@ -42,6 +43,7 @@ export default {
42
43
  polkadot,
43
44
  solana,
44
45
  stacks,
46
+ stellar,
45
47
  tezos,
46
48
  ton,
47
49
  tron,
@@ -29,9 +29,7 @@ describe("useModularDrawerVisibility", () => {
29
29
  },
30
30
  );
31
31
 
32
- expect(
33
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
34
- ).toBe(false);
32
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
35
33
  });
36
34
 
37
35
  it("should return false if the location param is not set", () => {
@@ -49,9 +47,7 @@ describe("useModularDrawerVisibility", () => {
49
47
  },
50
48
  );
51
49
 
52
- expect(
53
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
54
- ).toBe(false);
50
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
55
51
  });
56
52
 
57
53
  it("should return the correct visibility for each location", () => {
@@ -60,6 +56,7 @@ describe("useModularDrawerVisibility", () => {
60
56
  enabled: true,
61
57
  params: {
62
58
  [ModularDrawerLocation.ADD_ACCOUNT]: true,
59
+ [ModularDrawerLocation.EARN_FLOW]: false,
63
60
  },
64
61
  },
65
62
  };
@@ -74,15 +71,9 @@ describe("useModularDrawerVisibility", () => {
74
71
  },
75
72
  );
76
73
 
77
- expect(
78
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
79
- ).toBe(true);
80
- expect(
81
- result.current.isModularDrawerVisible({
82
- location: ModularDrawerLocation.LIVE_APP,
83
- liveAppId: "earn",
84
- }),
85
- ).toBe(false);
74
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(true);
75
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.EARN_FLOW)).toBe(false);
76
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.LIVE_APP)).toBe(false);
86
77
  });
87
78
  });
88
79
 
@@ -105,9 +96,7 @@ describe("useModularDrawerVisibility", () => {
105
96
  },
106
97
  );
107
98
 
108
- expect(
109
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
110
- ).toBe(false);
99
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
111
100
  });
112
101
 
113
102
  it("should return false if the location param is not set", () => {
@@ -125,9 +114,7 @@ describe("useModularDrawerVisibility", () => {
125
114
  },
126
115
  );
127
116
 
128
- expect(
129
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
130
- ).toBe(false);
117
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
131
118
  });
132
119
 
133
120
  it("should return the correct visibility for each location", () => {
@@ -136,6 +123,7 @@ describe("useModularDrawerVisibility", () => {
136
123
  enabled: true,
137
124
  params: {
138
125
  [ModularDrawerLocation.ADD_ACCOUNT]: false,
126
+ [ModularDrawerLocation.EARN_FLOW]: true,
139
127
  [ModularDrawerLocation.RECEIVE_FLOW]: true,
140
128
  },
141
129
  },
@@ -151,330 +139,11 @@ describe("useModularDrawerVisibility", () => {
151
139
  },
152
140
  );
153
141
 
154
- expect(
155
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.ADD_ACCOUNT }),
156
- ).toBe(false);
157
- expect(
158
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.RECEIVE_FLOW }),
159
- ).toBe(true);
160
- expect(
161
- result.current.isModularDrawerVisible({
162
- location: ModularDrawerLocation.LIVE_APP,
163
- liveAppId: "earn",
164
- }),
165
- ).toBe(false);
166
- expect(
167
- result.current.isModularDrawerVisible({ location: ModularDrawerLocation.SEND_FLOW }),
168
- ).toBe(false);
169
- });
170
- });
171
-
172
- describe("Live app whitelist and blacklist logic", () => {
173
- describe("lldModularDrawer", () => {
174
- it("should return false if live_app location is not enabled", () => {
175
- const mockedFeatures = {
176
- lldModularDrawer: {
177
- enabled: true,
178
- params: {
179
- [ModularDrawerLocation.LIVE_APP]: false,
180
- live_apps_allowlist: ["earn"],
181
- live_apps_blocklist: [],
182
- },
183
- },
184
- };
185
-
186
- const { result } = renderHook(
187
- () =>
188
- useModularDrawerVisibility({
189
- modularDrawerFeatureFlagKey: "lldModularDrawer",
190
- }),
191
- {
192
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
193
- },
194
- );
195
-
196
- expect(
197
- result.current.isModularDrawerVisible({
198
- location: ModularDrawerLocation.LIVE_APP,
199
- liveAppId: "earn",
200
- }),
201
- ).toBe(false);
202
- });
203
-
204
- it("should return true for whitelisted apps when whitelist is provided", () => {
205
- const mockedFeatures = {
206
- lldModularDrawer: {
207
- enabled: true,
208
- params: {
209
- [ModularDrawerLocation.LIVE_APP]: true,
210
- live_apps_allowlist: ["earn", "swap"],
211
- live_apps_blocklist: [],
212
- },
213
- },
214
- };
215
-
216
- const { result } = renderHook(
217
- () =>
218
- useModularDrawerVisibility({
219
- modularDrawerFeatureFlagKey: "lldModularDrawer",
220
- }),
221
- {
222
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
223
- },
224
- );
225
-
226
- expect(
227
- result.current.isModularDrawerVisible({
228
- location: ModularDrawerLocation.LIVE_APP,
229
- liveAppId: "earn",
230
- }),
231
- ).toBe(true);
232
-
233
- expect(
234
- result.current.isModularDrawerVisible({
235
- location: ModularDrawerLocation.LIVE_APP,
236
- liveAppId: "swap",
237
- }),
238
- ).toBe(true);
239
- });
240
-
241
- it("should return false for non-whitelisted apps when whitelist is provided", () => {
242
- const mockedFeatures = {
243
- lldModularDrawer: {
244
- enabled: true,
245
- params: {
246
- [ModularDrawerLocation.LIVE_APP]: true,
247
- live_apps_allowlist: ["earn"],
248
- live_apps_blocklist: [],
249
- },
250
- },
251
- };
252
-
253
- const { result } = renderHook(
254
- () =>
255
- useModularDrawerVisibility({
256
- modularDrawerFeatureFlagKey: "lldModularDrawer",
257
- }),
258
- {
259
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
260
- },
261
- );
262
-
263
- expect(
264
- result.current.isModularDrawerVisible({
265
- location: ModularDrawerLocation.LIVE_APP,
266
- liveAppId: "swap",
267
- }),
268
- ).toBe(false);
269
-
270
- expect(
271
- result.current.isModularDrawerVisible({
272
- location: ModularDrawerLocation.LIVE_APP,
273
- liveAppId: "unknown-app",
274
- }),
275
- ).toBe(false);
276
- });
277
-
278
- it("should return false for blacklisted apps", () => {
279
- const mockedFeatures = {
280
- lldModularDrawer: {
281
- enabled: true,
282
- params: {
283
- [ModularDrawerLocation.LIVE_APP]: true,
284
- live_apps_allowlist: [],
285
- live_apps_blocklist: ["blocked-app", "another-blocked-app"],
286
- },
287
- },
288
- };
289
-
290
- const { result } = renderHook(
291
- () =>
292
- useModularDrawerVisibility({
293
- modularDrawerFeatureFlagKey: "lldModularDrawer",
294
- }),
295
- {
296
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
297
- },
298
- );
299
-
300
- expect(
301
- result.current.isModularDrawerVisible({
302
- location: ModularDrawerLocation.LIVE_APP,
303
- liveAppId: "blocked-app",
304
- }),
305
- ).toBe(false);
306
-
307
- expect(
308
- result.current.isModularDrawerVisible({
309
- location: ModularDrawerLocation.LIVE_APP,
310
- liveAppId: "another-blocked-app",
311
- }),
312
- ).toBe(false);
313
- });
314
-
315
- it("should return true for non-blacklisted apps when no whitelist is provided", () => {
316
- const mockedFeatures = {
317
- lldModularDrawer: {
318
- enabled: true,
319
- params: {
320
- [ModularDrawerLocation.LIVE_APP]: true,
321
- live_apps_allowlist: [],
322
- live_apps_blocklist: ["blocked-app"],
323
- },
324
- },
325
- };
326
-
327
- const { result } = renderHook(
328
- () =>
329
- useModularDrawerVisibility({
330
- modularDrawerFeatureFlagKey: "lldModularDrawer",
331
- }),
332
- {
333
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
334
- },
335
- );
336
-
337
- expect(
338
- result.current.isModularDrawerVisible({
339
- location: ModularDrawerLocation.LIVE_APP,
340
- liveAppId: "allowed-app",
341
- }),
342
- ).toBe(true);
343
-
344
- expect(
345
- result.current.isModularDrawerVisible({
346
- location: ModularDrawerLocation.LIVE_APP,
347
- liveAppId: "earn",
348
- }),
349
- ).toBe(true);
350
- });
351
-
352
- it("should prioritize blacklist over whitelist", () => {
353
- const mockedFeatures = {
354
- lldModularDrawer: {
355
- enabled: true,
356
- params: {
357
- [ModularDrawerLocation.LIVE_APP]: true,
358
- live_apps_allowlist: ["earn", "swap"],
359
- live_apps_blocklist: ["swap"],
360
- },
361
- },
362
- };
363
-
364
- const { result } = renderHook(
365
- () =>
366
- useModularDrawerVisibility({
367
- modularDrawerFeatureFlagKey: "lldModularDrawer",
368
- }),
369
- {
370
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
371
- },
372
- );
373
-
374
- expect(
375
- result.current.isModularDrawerVisible({
376
- location: ModularDrawerLocation.LIVE_APP,
377
- liveAppId: "earn",
378
- }),
379
- ).toBe(true);
380
-
381
- expect(
382
- result.current.isModularDrawerVisible({
383
- location: ModularDrawerLocation.LIVE_APP,
384
- liveAppId: "swap",
385
- }),
386
- ).toBe(false);
387
- });
388
-
389
- it("should handle missing whitelist and blacklist arrays", () => {
390
- const mockedFeatures = {
391
- lldModularDrawer: {
392
- enabled: true,
393
- params: {
394
- [ModularDrawerLocation.LIVE_APP]: true,
395
- },
396
- },
397
- };
398
-
399
- const { result } = renderHook(
400
- () =>
401
- useModularDrawerVisibility({
402
- modularDrawerFeatureFlagKey: "lldModularDrawer",
403
- }),
404
- {
405
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
406
- },
407
- );
408
-
409
- expect(
410
- result.current.isModularDrawerVisible({
411
- location: ModularDrawerLocation.LIVE_APP,
412
- liveAppId: "any-app",
413
- }),
414
- ).toBe(true);
415
- });
416
- });
417
-
418
- describe("llmModularDrawer", () => {
419
- it("should return true for whitelisted apps", () => {
420
- const mockedFeatures = {
421
- llmModularDrawer: {
422
- enabled: true,
423
- params: {
424
- [ModularDrawerLocation.LIVE_APP]: true,
425
- live_apps_allowlist: ["earn", "swap"],
426
- live_apps_blocklist: [],
427
- },
428
- },
429
- };
430
-
431
- const { result } = renderHook(
432
- () =>
433
- useModularDrawerVisibility({
434
- modularDrawerFeatureFlagKey: "llmModularDrawer",
435
- }),
436
- {
437
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
438
- },
439
- );
440
-
441
- expect(
442
- result.current.isModularDrawerVisible({
443
- location: ModularDrawerLocation.LIVE_APP,
444
- liveAppId: "earn",
445
- }),
446
- ).toBe(true);
447
- });
448
-
449
- it("should return false for blacklisted apps even if whitelisted", () => {
450
- const mockedFeatures = {
451
- llmModularDrawer: {
452
- enabled: true,
453
- params: {
454
- [ModularDrawerLocation.LIVE_APP]: true,
455
- live_apps_allowlist: ["earn", "swap"],
456
- live_apps_blocklist: ["swap"],
457
- },
458
- },
459
- };
460
-
461
- const { result } = renderHook(
462
- () =>
463
- useModularDrawerVisibility({
464
- modularDrawerFeatureFlagKey: "llmModularDrawer",
465
- }),
466
- {
467
- wrapper: makeMockedFeatureFlagsProviderWrapper(makeMockedContextValue(mockedFeatures)),
468
- },
469
- );
470
-
471
- expect(
472
- result.current.isModularDrawerVisible({
473
- location: ModularDrawerLocation.LIVE_APP,
474
- liveAppId: "swap",
475
- }),
476
- ).toBe(false);
477
- });
142
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.ADD_ACCOUNT)).toBe(false);
143
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.EARN_FLOW)).toBe(true);
144
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.RECEIVE_FLOW)).toBe(true);
145
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.LIVE_APP)).toBe(false);
146
+ expect(result.current.isModularDrawerVisible(ModularDrawerLocation.SEND_FLOW)).toBe(false);
478
147
  });
479
148
  });
480
149
  });
@@ -1,5 +1,6 @@
1
1
  export enum ModularDrawerLocation {
2
2
  ADD_ACCOUNT = "add_account",
3
+ EARN_FLOW = "earn_flow",
3
4
  LIVE_APP = "live_app",
4
5
  RECEIVE_FLOW = "receive_flow",
5
6
  SEND_FLOW = "send_flow",
@@ -4,10 +4,6 @@ import { ModularDrawerLocation } from "./enums";
4
4
 
5
5
  type ModularDrawerFeatureFlagKey = "lldModularDrawer" | "llmModularDrawer";
6
6
 
7
- export type ModularDrawerVisibleParams =
8
- | { location: ModularDrawerLocation.LIVE_APP; liveAppId: string }
9
- | { location: Exclude<ModularDrawerLocation, ModularDrawerLocation.LIVE_APP> };
10
-
11
7
  export function useModularDrawerVisibility({
12
8
  modularDrawerFeatureFlagKey,
13
9
  }: {
@@ -16,29 +12,9 @@ export function useModularDrawerVisibility({
16
12
  const featureModularDrawer = useFeature(modularDrawerFeatureFlagKey);
17
13
 
18
14
  const isModularDrawerVisible = useCallback(
19
- (params: ModularDrawerVisibleParams) => {
15
+ (location: ModularDrawerLocation) => {
20
16
  if (!featureModularDrawer?.enabled) return false;
21
-
22
- if (params.location === ModularDrawerLocation.LIVE_APP) {
23
- const isLiveAppEnabled = featureModularDrawer.params?.[params.location] ?? false;
24
- if (!isLiveAppEnabled) return false;
25
-
26
- const { liveAppId } = params;
27
- const allowed = featureModularDrawer.params?.live_apps_allowlist ?? [];
28
- const blocked = featureModularDrawer.params?.live_apps_blocklist ?? [];
29
-
30
- if (allowed.length > 0 && !allowed.includes(liveAppId)) {
31
- return false;
32
- }
33
-
34
- if (blocked.includes(liveAppId)) {
35
- return false;
36
- }
37
-
38
- return true;
39
- }
40
-
41
- return featureModularDrawer.params?.[params.location] ?? false;
17
+ return featureModularDrawer.params?.[location] ?? false;
42
18
  },
43
19
  [featureModularDrawer],
44
20
  );
@@ -1,17 +0,0 @@
1
- import type { CryptoCurrency, TokenCurrency } from "@ledgerhq/types-cryptoassets";
2
- import type { Operation, SyncConfig, TokenAccount } from "@ledgerhq/types-live";
3
- import { AssetInfo, Balance } from "@ledgerhq/coin-framework/api/types";
4
- export interface OperationCommon extends Operation {
5
- extra: Record<string, any>;
6
- }
7
- export declare const getAssetIdFromTokenId: (tokenId: string) => string;
8
- export declare const getAssetIdFromAsset: (asset: AssetInfo) => string;
9
- export declare function buildSubAccounts({ currency, accountId, assetsBalance, syncConfig, operations, }: {
10
- currency: CryptoCurrency;
11
- accountId: string;
12
- assetsBalance: Balance[];
13
- syncConfig: SyncConfig;
14
- operations: OperationCommon[];
15
- }): TokenAccount[] | undefined;
16
- export declare function findToken(currency: CryptoCurrency, balance: Balance): TokenCurrency | undefined;
17
- //# sourceMappingURL=buildSubAccounts.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildSubAccounts.d.ts","sourceRoot":"","sources":["../../../src/bridge/generic-alpaca/buildSubAccounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClF,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGhF,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAGxE,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,YAAa,MAAM,KAAG,MAA+B,CAAC;AAExF,eAAO,MAAM,mBAAmB,UAAW,SAAS,WAG5C,CAAC;AA8CT,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,SAAS,EACT,aAAa,EACb,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,cAAc,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,OAAO,EAAE,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC;IACvB,UAAU,EAAE,eAAe,EAAE,CAAC;CAC/B,GAAG,YAAY,EAAE,GAAG,SAAS,CA6B7B;AAED,wBAAgB,SAAS,CAAC,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAE/F"}
@@ -1,75 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.findToken = exports.buildSubAccounts = exports.getAssetIdFromAsset = exports.getAssetIdFromTokenId = void 0;
7
- const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
- const index_1 = require("@ledgerhq/coin-framework/account/index");
9
- const operation_1 = require("@ledgerhq/coin-framework/operation");
10
- const cryptoassets_1 = require("@ledgerhq/cryptoassets");
11
- const tokens_1 = require("@ledgerhq/cryptoassets/tokens");
12
- const getAssetIdFromTokenId = (tokenId) => tokenId.split("/")[2];
13
- exports.getAssetIdFromTokenId = getAssetIdFromTokenId;
14
- const getAssetIdFromAsset = (asset) => asset.type !== "native" && "assetReference" in asset && "assetOwner" in asset
15
- ? `${asset.assetReference}:${asset.assetOwner}`
16
- : "";
17
- exports.getAssetIdFromAsset = getAssetIdFromAsset;
18
- function buildTokenAccount({ parentAccountId, assetBalance, token, operations, }) {
19
- const assetId = (0, exports.getAssetIdFromTokenId)(token.id);
20
- const id = `${parentAccountId}+${assetId}`;
21
- const balance = new bignumber_js_1.default(assetBalance.value.toString() || "0");
22
- // TODO: recheck this logic
23
- const spendableBalance = new bignumber_js_1.default(assetBalance.value.toString()).minus(new bignumber_js_1.default(assetBalance.locked?.toString() || "0"));
24
- const tokenOperations = operations.map(op => ({
25
- ...op,
26
- id: (0, operation_1.encodeOperationId)(id, op.hash, op.extra?.ledgerOpType),
27
- accountId: id,
28
- type: op.extra?.ledgerOpType,
29
- value: op.extra?.assetAmount ? new bignumber_js_1.default(op.extra?.assetAmount) : op.value,
30
- }));
31
- return {
32
- type: "TokenAccount",
33
- id,
34
- parentId: parentAccountId,
35
- token,
36
- operationsCount: operations.length,
37
- operations: tokenOperations,
38
- pendingOperations: [],
39
- balance,
40
- spendableBalance: spendableBalance,
41
- swapHistory: [],
42
- creationDate: operations.length > 0 ? operations[operations.length - 1].date : new Date(),
43
- balanceHistoryCache: index_1.emptyHistoryCache, // calculated in the jsHelpers
44
- };
45
- }
46
- function buildSubAccounts({ currency, accountId, assetsBalance, syncConfig, operations, }) {
47
- const { blacklistedTokenIds = [] } = syncConfig;
48
- const allTokens = (0, cryptoassets_1.listTokensForCryptoCurrency)(currency);
49
- if (allTokens.length === 0 || assetsBalance.length === 0) {
50
- return undefined;
51
- }
52
- const tokenAccounts = [];
53
- assetsBalance
54
- .filter(b => b.asset.type !== "native") // NOTE: this could be removed, keeping here while fixing things up
55
- .map(balance => {
56
- const token = findToken(currency, balance);
57
- // NOTE: for future tokens, will need to check over currencyName/standard(erc20,trc10,trc20, etc)/id
58
- if (token && !blacklistedTokenIds.includes(token.id)) {
59
- tokenAccounts.push(buildTokenAccount({
60
- parentAccountId: accountId,
61
- assetBalance: balance,
62
- token,
63
- operations: operations.filter(op => op.extra.assetReference === balance.asset?.["assetReference"] &&
64
- op.extra.assetOwner === balance.asset?.["assetOwner"]),
65
- }));
66
- }
67
- });
68
- return tokenAccounts;
69
- }
70
- exports.buildSubAccounts = buildSubAccounts;
71
- function findToken(currency, balance) {
72
- return (0, tokens_1.findTokenById)(`${currency.family}/asset/${(0, exports.getAssetIdFromAsset)(balance.asset)}`);
73
- }
74
- exports.findToken = findToken;
75
- //# sourceMappingURL=buildSubAccounts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"buildSubAccounts.js","sourceRoot":"","sources":["../../../src/bridge/generic-alpaca/buildSubAccounts.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AACrC,kEAA2E;AAG3E,kEAAuE;AACvE,yDAAqE;AAErE,0DAA8D;AAMvD,MAAM,qBAAqB,GAAG,CAAC,OAAe,EAAU,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAA3E,QAAA,qBAAqB,yBAAsD;AAEjF,MAAM,mBAAmB,GAAG,CAAC,KAAgB,EAAE,EAAE,CACtD,KAAK,CAAC,IAAI,K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