@ledgerhq/live-common 34.36.0 → 34.37.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/lib/__tests__/test-helpers/bridge.d.ts.map +1 -1
  2. package/lib/__tests__/test-helpers/bridge.js +4 -4
  3. package/lib/__tests__/test-helpers/bridge.js.map +1 -1
  4. package/lib/apps/config.d.ts.map +1 -1
  5. package/lib/apps/config.js +6 -0
  6. package/lib/apps/config.js.map +1 -1
  7. package/lib/bridge/generic-alpaca/accountBridge.d.ts +3 -0
  8. package/lib/bridge/generic-alpaca/accountBridge.d.ts.map +1 -0
  9. package/lib/bridge/generic-alpaca/accountBridge.js +34 -0
  10. package/lib/bridge/generic-alpaca/accountBridge.js.map +1 -0
  11. package/lib/bridge/generic-alpaca/alpaca/index.d.ts +3 -0
  12. package/lib/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -0
  13. package/lib/bridge/generic-alpaca/alpaca/index.js +20 -0
  14. package/lib/bridge/generic-alpaca/alpaca/index.js.map +1 -0
  15. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +16 -0
  16. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -0
  17. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js +123 -0
  18. package/lib/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -0
  19. package/lib/bridge/generic-alpaca/broadcast.d.ts +3 -0
  20. package/lib/bridge/generic-alpaca/broadcast.d.ts.map +1 -0
  21. package/lib/bridge/generic-alpaca/broadcast.js +11 -0
  22. package/lib/bridge/generic-alpaca/broadcast.js.map +1 -0
  23. package/lib/bridge/generic-alpaca/createTransaction.d.ts +16 -0
  24. package/lib/bridge/generic-alpaca/createTransaction.d.ts.map +1 -0
  25. package/lib/bridge/generic-alpaca/createTransaction.js +20 -0
  26. package/lib/bridge/generic-alpaca/createTransaction.js.map +1 -0
  27. package/lib/bridge/generic-alpaca/currencyBridge.d.ts +3 -0
  28. package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -0
  29. package/lib/bridge/generic-alpaca/currencyBridge.js +20 -0
  30. package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -0
  31. package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts +3 -0
  32. package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -0
  33. package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +26 -0
  34. package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -0
  35. package/lib/bridge/generic-alpaca/getAccountShape.d.ts +3 -0
  36. package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -0
  37. package/lib/bridge/generic-alpaca/getAccountShape.js +58 -0
  38. package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -0
  39. package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts +3 -0
  40. package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -0
  41. package/lib/bridge/generic-alpaca/getTransactionStatus.js +36 -0
  42. package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -0
  43. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts +3 -0
  44. package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -0
  45. package/lib/bridge/generic-alpaca/prepareTransaction.js +21 -0
  46. package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -0
  47. package/lib/bridge/generic-alpaca/signOperation.d.ts +7 -0
  48. package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -0
  49. package/lib/bridge/generic-alpaca/signOperation.js +49 -0
  50. package/lib/bridge/generic-alpaca/signOperation.js.map +1 -0
  51. package/lib/bridge/generic-alpaca/signer/index.d.ts +11 -0
  52. package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -0
  53. package/lib/bridge/generic-alpaca/signer/index.js +28 -0
  54. package/lib/bridge/generic-alpaca/signer/index.js.map +1 -0
  55. package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts +5 -0
  56. package/lib/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -0
  57. package/lib/bridge/generic-alpaca/signer/signTransaction.js +11 -0
  58. package/lib/bridge/generic-alpaca/signer/signTransaction.js.map +1 -0
  59. package/lib/bridge/generic-alpaca/signer/types.d.ts +5 -0
  60. package/lib/bridge/generic-alpaca/signer/types.d.ts.map +1 -0
  61. package/lib/bridge/generic-alpaca/signer/types.js +3 -0
  62. package/lib/bridge/generic-alpaca/signer/types.js.map +1 -0
  63. package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.d.ts +2 -0
  64. package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.d.ts.map +1 -0
  65. package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +90 -0
  66. package/lib/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -0
  67. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.d.ts +2 -0
  68. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.d.ts.map +1 -0
  69. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js +53 -0
  70. package/lib/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -0
  71. package/lib/bridge/generic-alpaca/tests/signOperation.test.d.ts +2 -0
  72. package/lib/bridge/generic-alpaca/tests/signOperation.test.d.ts.map +1 -0
  73. package/lib/bridge/generic-alpaca/tests/signOperation.test.js +79 -0
  74. package/lib/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -0
  75. package/lib/bridge/generic-alpaca/utils.d.ts +6 -0
  76. package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -0
  77. package/lib/bridge/generic-alpaca/utils.js +55 -0
  78. package/lib/bridge/generic-alpaca/utils.js.map +1 -0
  79. package/lib/bridge/impl.d.ts.map +1 -1
  80. package/lib/bridge/impl.js +59 -3
  81. package/lib/bridge/impl.js.map +1 -1
  82. package/lib/config/index.d.ts +3 -2
  83. package/lib/config/index.d.ts.map +1 -1
  84. package/lib/config/index.js +9 -1
  85. package/lib/config/index.js.map +1 -1
  86. package/lib/config/sharedConfig.d.ts.map +1 -1
  87. package/lib/config/sharedConfig.js +7 -0
  88. package/lib/config/sharedConfig.js.map +1 -1
  89. package/lib/e2e/enum/OperationType.d.ts +5 -0
  90. package/lib/e2e/enum/OperationType.d.ts.map +1 -0
  91. package/lib/e2e/enum/OperationType.js +9 -0
  92. package/lib/e2e/enum/OperationType.js.map +1 -0
  93. package/lib/e2e/enum/{Swap.d.ts → Provider.d.ts} +2 -1
  94. package/lib/e2e/enum/Provider.d.ts.map +1 -0
  95. package/lib/e2e/enum/{Swap.js → Provider.js} +2 -1
  96. package/lib/e2e/enum/Provider.js.map +1 -0
  97. package/lib/e2e/index.d.ts +4 -2
  98. package/lib/e2e/index.d.ts.map +1 -1
  99. package/lib/e2e/models/BuySell.d.ts +2 -0
  100. package/lib/e2e/models/BuySell.d.ts.map +1 -1
  101. package/lib/env.react.d.ts +1 -1
  102. package/lib/env.react.d.ts.map +1 -1
  103. package/lib/families/casper/bridge.integration.test.js +2 -2
  104. package/lib/families/casper/bridge.integration.test.js.map +1 -1
  105. package/lib/families/casper/config.d.ts +2 -2
  106. package/lib/families/casper/config.d.ts.map +1 -1
  107. package/lib/families/casper/config.js +4 -0
  108. package/lib/families/casper/config.js.map +1 -1
  109. package/lib/families/casper/setup.d.ts +1 -1
  110. package/lib/families/casper/setup.d.ts.map +1 -1
  111. package/lib/families/casper/setup.js +7 -4
  112. package/lib/families/casper/setup.js.map +1 -1
  113. package/lib/families/casper/types.d.ts +1 -1
  114. package/lib/families/casper/types.d.ts.map +1 -1
  115. package/lib/families/casper/types.js +1 -1
  116. package/lib/families/casper/types.js.map +1 -1
  117. package/lib/families/xrp/setup.d.ts +3 -6
  118. package/lib/families/xrp/setup.d.ts.map +1 -1
  119. package/lib/families/xrp/setup.js +1 -7
  120. package/lib/families/xrp/setup.js.map +1 -1
  121. package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
  122. package/lib/featureFlags/defaultFeatures.js +2 -0
  123. package/lib/featureFlags/defaultFeatures.js.map +1 -1
  124. package/lib/featureFlags/useFeature.d.ts +1 -1
  125. package/lib/featureFlags/useFeature.d.ts.map +1 -1
  126. package/lib/generated/bridge/js.d.ts +0 -1
  127. package/lib/generated/bridge/js.d.ts.map +1 -1
  128. package/lib/generated/bridge/js.js +4 -6
  129. package/lib/generated/bridge/js.js.map +1 -1
  130. package/lib/hooks/useOFACGeoBlockCheck.d.ts +8 -0
  131. package/lib/hooks/useOFACGeoBlockCheck.d.ts.map +1 -0
  132. package/lib/hooks/useOFACGeoBlockCheck.js +32 -0
  133. package/lib/hooks/useOFACGeoBlockCheck.js.map +1 -0
  134. package/lib/sanction/errors.d.ts +13 -0
  135. package/lib/sanction/errors.d.ts.map +1 -0
  136. package/lib/sanction/errors.js +36 -0
  137. package/lib/sanction/errors.js.map +1 -0
  138. package/lib/sanction/index.d.ts +3 -0
  139. package/lib/sanction/index.d.ts.map +1 -0
  140. package/lib/sanction/index.js +51 -0
  141. package/lib/sanction/index.js.map +1 -0
  142. package/lib-es/__tests__/test-helpers/bridge.d.ts.map +1 -1
  143. package/lib-es/__tests__/test-helpers/bridge.js +4 -4
  144. package/lib-es/__tests__/test-helpers/bridge.js.map +1 -1
  145. package/lib-es/apps/config.d.ts.map +1 -1
  146. package/lib-es/apps/config.js +6 -0
  147. package/lib-es/apps/config.js.map +1 -1
  148. package/lib-es/bridge/generic-alpaca/accountBridge.d.ts +3 -0
  149. package/lib-es/bridge/generic-alpaca/accountBridge.d.ts.map +1 -0
  150. package/lib-es/bridge/generic-alpaca/accountBridge.js +27 -0
  151. package/lib-es/bridge/generic-alpaca/accountBridge.js.map +1 -0
  152. package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts +3 -0
  153. package/lib-es/bridge/generic-alpaca/alpaca/index.d.ts.map +1 -0
  154. package/lib-es/bridge/generic-alpaca/alpaca/index.js +16 -0
  155. package/lib-es/bridge/generic-alpaca/alpaca/index.js.map +1 -0
  156. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts +16 -0
  157. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.d.ts.map +1 -0
  158. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js +116 -0
  159. package/lib-es/bridge/generic-alpaca/alpaca/network/network-alpaca.js.map +1 -0
  160. package/lib-es/bridge/generic-alpaca/broadcast.d.ts +3 -0
  161. package/lib-es/bridge/generic-alpaca/broadcast.d.ts.map +1 -0
  162. package/lib-es/bridge/generic-alpaca/broadcast.js +7 -0
  163. package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -0
  164. package/lib-es/bridge/generic-alpaca/createTransaction.d.ts +16 -0
  165. package/lib-es/bridge/generic-alpaca/createTransaction.d.ts.map +1 -0
  166. package/lib-es/bridge/generic-alpaca/createTransaction.js +13 -0
  167. package/lib-es/bridge/generic-alpaca/createTransaction.js.map +1 -0
  168. package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts +3 -0
  169. package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -0
  170. package/lib-es/bridge/generic-alpaca/currencyBridge.js +16 -0
  171. package/lib-es/bridge/generic-alpaca/currencyBridge.js.map +1 -0
  172. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts +3 -0
  173. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -0
  174. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +19 -0
  175. package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -0
  176. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts +3 -0
  177. package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -0
  178. package/lib-es/bridge/generic-alpaca/getAccountShape.js +51 -0
  179. package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -0
  180. package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts +3 -0
  181. package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -0
  182. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +29 -0
  183. package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -0
  184. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts +3 -0
  185. package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -0
  186. package/lib-es/bridge/generic-alpaca/prepareTransaction.js +14 -0
  187. package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -0
  188. package/lib-es/bridge/generic-alpaca/signOperation.d.ts +7 -0
  189. package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -0
  190. package/lib-es/bridge/generic-alpaca/signOperation.js +45 -0
  191. package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -0
  192. package/lib-es/bridge/generic-alpaca/signer/index.d.ts +11 -0
  193. package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -0
  194. package/lib-es/bridge/generic-alpaca/signer/index.js +21 -0
  195. package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -0
  196. package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts +5 -0
  197. package/lib-es/bridge/generic-alpaca/signer/signTransaction.d.ts.map +1 -0
  198. package/lib-es/bridge/generic-alpaca/signer/signTransaction.js +7 -0
  199. package/lib-es/bridge/generic-alpaca/signer/signTransaction.js.map +1 -0
  200. package/lib-es/bridge/generic-alpaca/signer/types.d.ts +5 -0
  201. package/lib-es/bridge/generic-alpaca/signer/types.d.ts.map +1 -0
  202. package/lib-es/bridge/generic-alpaca/signer/types.js +2 -0
  203. package/lib-es/bridge/generic-alpaca/signer/types.js.map +1 -0
  204. package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.d.ts +2 -0
  205. package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.d.ts.map +1 -0
  206. package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js +62 -0
  207. package/lib-es/bridge/generic-alpaca/tests/estimateMaxSpendable.test.js.map +1 -0
  208. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.d.ts +2 -0
  209. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.d.ts.map +1 -0
  210. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js +48 -0
  211. package/lib-es/bridge/generic-alpaca/tests/prepareTransaction.test.js.map +1 -0
  212. package/lib-es/bridge/generic-alpaca/tests/signOperation.test.d.ts +2 -0
  213. package/lib-es/bridge/generic-alpaca/tests/signOperation.test.d.ts.map +1 -0
  214. package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js +77 -0
  215. package/lib-es/bridge/generic-alpaca/tests/signOperation.test.js.map +1 -0
  216. package/lib-es/bridge/generic-alpaca/utils.d.ts +6 -0
  217. package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -0
  218. package/lib-es/bridge/generic-alpaca/utils.js +46 -0
  219. package/lib-es/bridge/generic-alpaca/utils.js.map +1 -0
  220. package/lib-es/bridge/impl.d.ts.map +1 -1
  221. package/lib-es/bridge/impl.js +59 -3
  222. package/lib-es/bridge/impl.js.map +1 -1
  223. package/lib-es/config/index.d.ts +3 -2
  224. package/lib-es/config/index.d.ts.map +1 -1
  225. package/lib-es/config/index.js +8 -1
  226. package/lib-es/config/index.js.map +1 -1
  227. package/lib-es/config/sharedConfig.d.ts.map +1 -1
  228. package/lib-es/config/sharedConfig.js +7 -0
  229. package/lib-es/config/sharedConfig.js.map +1 -1
  230. package/lib-es/e2e/enum/OperationType.d.ts +5 -0
  231. package/lib-es/e2e/enum/OperationType.d.ts.map +1 -0
  232. package/lib-es/e2e/enum/OperationType.js +6 -0
  233. package/lib-es/e2e/enum/OperationType.js.map +1 -0
  234. package/lib-es/e2e/enum/{Swap.d.ts → Provider.d.ts} +2 -1
  235. package/lib-es/e2e/enum/Provider.d.ts.map +1 -0
  236. package/lib-es/e2e/enum/{Swap.js → Provider.js} +2 -1
  237. package/lib-es/e2e/enum/Provider.js.map +1 -0
  238. package/lib-es/e2e/index.d.ts +4 -2
  239. package/lib-es/e2e/index.d.ts.map +1 -1
  240. package/lib-es/e2e/models/BuySell.d.ts +2 -0
  241. package/lib-es/e2e/models/BuySell.d.ts.map +1 -1
  242. package/lib-es/env.react.d.ts +1 -1
  243. package/lib-es/env.react.d.ts.map +1 -1
  244. package/lib-es/families/casper/bridge.integration.test.js +1 -1
  245. package/lib-es/families/casper/bridge.integration.test.js.map +1 -1
  246. package/lib-es/families/casper/config.d.ts +2 -2
  247. package/lib-es/families/casper/config.d.ts.map +1 -1
  248. package/lib-es/families/casper/config.js +4 -0
  249. package/lib-es/families/casper/config.js.map +1 -1
  250. package/lib-es/families/casper/setup.d.ts +1 -1
  251. package/lib-es/families/casper/setup.d.ts.map +1 -1
  252. package/lib-es/families/casper/setup.js +6 -3
  253. package/lib-es/families/casper/setup.js.map +1 -1
  254. package/lib-es/families/casper/types.d.ts +1 -1
  255. package/lib-es/families/casper/types.d.ts.map +1 -1
  256. package/lib-es/families/casper/types.js +1 -1
  257. package/lib-es/families/casper/types.js.map +1 -1
  258. package/lib-es/families/xrp/setup.d.ts +3 -6
  259. package/lib-es/families/xrp/setup.d.ts.map +1 -1
  260. package/lib-es/families/xrp/setup.js +2 -7
  261. package/lib-es/families/xrp/setup.js.map +1 -1
  262. package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
  263. package/lib-es/featureFlags/defaultFeatures.js +2 -0
  264. package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
  265. package/lib-es/featureFlags/useFeature.d.ts +1 -1
  266. package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
  267. package/lib-es/generated/bridge/js.d.ts +0 -1
  268. package/lib-es/generated/bridge/js.d.ts.map +1 -1
  269. package/lib-es/generated/bridge/js.js +0 -2
  270. package/lib-es/generated/bridge/js.js.map +1 -1
  271. package/lib-es/hooks/useOFACGeoBlockCheck.d.ts +8 -0
  272. package/lib-es/hooks/useOFACGeoBlockCheck.d.ts.map +1 -0
  273. package/lib-es/hooks/useOFACGeoBlockCheck.js +28 -0
  274. package/lib-es/hooks/useOFACGeoBlockCheck.js.map +1 -0
  275. package/lib-es/sanction/errors.d.ts +13 -0
  276. package/lib-es/sanction/errors.d.ts.map +1 -0
  277. package/lib-es/sanction/errors.js +29 -0
  278. package/lib-es/sanction/errors.js.map +1 -0
  279. package/lib-es/sanction/index.d.ts +3 -0
  280. package/lib-es/sanction/index.d.ts.map +1 -0
  281. package/lib-es/sanction/index.js +44 -0
  282. package/lib-es/sanction/index.js.map +1 -0
  283. package/package.json +47 -46
  284. package/src/__tests__/test-helpers/bridge.ts +2 -4
  285. package/src/apps/config.ts +6 -0
  286. package/src/bridge/generic-alpaca/accountBridge.ts +32 -0
  287. package/src/bridge/generic-alpaca/alpaca/index.ts +20 -0
  288. package/src/bridge/generic-alpaca/alpaca/network/network-alpaca.ts +182 -0
  289. package/src/bridge/generic-alpaca/broadcast.ts +11 -0
  290. package/src/bridge/generic-alpaca/createTransaction.ts +27 -0
  291. package/src/bridge/generic-alpaca/currencyBridge.ts +17 -0
  292. package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +27 -0
  293. package/src/bridge/generic-alpaca/getAccountShape.ts +62 -0
  294. package/src/bridge/generic-alpaca/getTransactionStatus.ts +38 -0
  295. package/src/bridge/generic-alpaca/prepareTransaction.ts +22 -0
  296. package/src/bridge/generic-alpaca/signOperation.ts +83 -0
  297. package/src/bridge/generic-alpaca/signer/index.ts +33 -0
  298. package/src/bridge/generic-alpaca/signer/signTransaction.ts +13 -0
  299. package/src/bridge/generic-alpaca/signer/types.ts +4 -0
  300. package/src/bridge/generic-alpaca/tests/estimateMaxSpendable.test.ts +76 -0
  301. package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +66 -0
  302. package/src/bridge/generic-alpaca/tests/signOperation.test.ts +96 -0
  303. package/src/bridge/generic-alpaca/utils.ts +63 -0
  304. package/src/bridge/impl.ts +87 -5
  305. package/src/config/index.ts +11 -2
  306. package/src/config/sharedConfig.ts +8 -0
  307. package/src/e2e/enum/OperationType.ts +4 -0
  308. package/src/e2e/enum/{Swap.ts → Provider.ts} +1 -0
  309. package/src/e2e/models/BuySell.ts +2 -0
  310. package/src/families/casper/bridge.integration.test.ts +1 -1
  311. package/src/families/casper/config.ts +6 -2
  312. package/src/families/casper/setup.ts +10 -3
  313. package/src/families/casper/types.ts +1 -1
  314. package/src/families/xrp/setup.ts +2 -15
  315. package/src/featureFlags/defaultFeatures.ts +2 -0
  316. package/src/generated/bridge/js.ts +0 -2
  317. package/src/hooks/useOFACGeoBlockCheck.ts +37 -0
  318. package/src/sanction/errors.ts +31 -0
  319. package/src/sanction/index.ts +59 -0
  320. package/lib/e2e/enum/Swap.d.ts.map +0 -1
  321. package/lib/e2e/enum/Swap.js.map +0 -1
  322. package/lib-es/e2e/enum/Swap.d.ts.map +0 -1
  323. package/lib-es/e2e/enum/Swap.js.map +0 -1
@@ -0,0 +1,66 @@
1
+ import { genericPrepareTransaction } from "../prepareTransaction";
2
+ import { getAlpacaApi } from "../alpaca";
3
+ import { transactionToIntent } from "../utils";
4
+ import BigNumber from "bignumber.js";
5
+ import type { TransactionCommon } from "@ledgerhq/types-live";
6
+
7
+ jest.mock("../alpaca", () => ({
8
+ getAlpacaApi: jest.fn(),
9
+ }));
10
+
11
+ jest.mock("../utils", () => ({
12
+ transactionToIntent: jest.fn(),
13
+ }));
14
+
15
+ describe("genericPrepareTransaction", () => {
16
+ const network = "testnet";
17
+ const kind = "local";
18
+
19
+ const account = {
20
+ id: "test-account",
21
+ address: "0xabc",
22
+ } as any;
23
+
24
+ const baseTransaction: TransactionCommon & { fees: BigNumber } = {
25
+ amount: new BigNumber(100_000),
26
+ fees: new BigNumber(500),
27
+ recipient: "0xrecipient",
28
+ };
29
+
30
+ const txIntent = { mock: "intent" };
31
+
32
+ beforeEach(() => {
33
+ jest.clearAllMocks();
34
+ (transactionToIntent as jest.Mock).mockReturnValue(txIntent);
35
+ });
36
+
37
+ it("updates fees if they differ", async () => {
38
+ const newFee = new BigNumber(700);
39
+
40
+ (getAlpacaApi as jest.Mock).mockReturnValue({
41
+ estimateFees: jest.fn().mockResolvedValue({ value: newFee }),
42
+ });
43
+
44
+ const prepareTransaction = genericPrepareTransaction(network, kind);
45
+ const result = await prepareTransaction(account, { ...baseTransaction });
46
+
47
+ expect((result as any).fees.toString()).toBe(newFee.toString());
48
+ expect(transactionToIntent).toHaveBeenCalledWith(
49
+ account,
50
+ expect.objectContaining(baseTransaction),
51
+ );
52
+ });
53
+
54
+ it("returns original transaction if fees are the same", async () => {
55
+ const sameFee = baseTransaction.fees;
56
+
57
+ (getAlpacaApi as jest.Mock).mockReturnValue({
58
+ estimateFees: jest.fn().mockResolvedValue({ value: sameFee }),
59
+ });
60
+
61
+ const prepareTransaction = genericPrepareTransaction(network, kind);
62
+ const result = await prepareTransaction(account, { ...baseTransaction });
63
+
64
+ expect(result).toStrictEqual(baseTransaction);
65
+ });
66
+ });
@@ -0,0 +1,96 @@
1
+ import { lastValueFrom } from "rxjs";
2
+ import { toArray } from "rxjs/operators";
3
+ import { genericSignOperation } from "../signOperation";
4
+ import { FeeNotLoaded } from "@ledgerhq/errors";
5
+ import { getAlpacaApi } from "../alpaca";
6
+ import { buildOptimisticOperation, transactionToIntent } from "../utils";
7
+
8
+ jest.mock("../alpaca", () => ({
9
+ getAlpacaApi: jest.fn(),
10
+ }));
11
+
12
+ jest.mock("../utils", () => ({
13
+ buildOptimisticOperation: jest.fn(),
14
+ transactionToIntent: jest.fn(),
15
+ }));
16
+
17
+ describe("genericSignOperation", () => {
18
+ const network = "xrp";
19
+ const kind = "local";
20
+
21
+ const mockSignerContext = jest.fn();
22
+ const mockSigner = {
23
+ getAddress: jest.fn(),
24
+ signTransaction: jest.fn(),
25
+ };
26
+
27
+ const account = {
28
+ freshAddressPath: "44'/144'/0'/0/0",
29
+ address: "rTestAddress",
30
+ } as any;
31
+
32
+ const transaction = {
33
+ amount: 100_000n,
34
+ fees: 500n,
35
+ tag: 1234,
36
+ } as any;
37
+
38
+ const deviceId = "mockDevice";
39
+
40
+ const txIntent = {
41
+ memo: {
42
+ type: "map",
43
+ memos: new Map(),
44
+ },
45
+ };
46
+
47
+ const unsignedTx = "unsignedTx";
48
+ const signedTx = "signedTx";
49
+ const pubKey = "pubKey";
50
+
51
+ beforeEach(() => {
52
+ jest.clearAllMocks();
53
+
54
+ (getAlpacaApi as jest.Mock).mockReturnValue({
55
+ craftTransaction: jest.fn().mockResolvedValue(unsignedTx),
56
+ combine: jest.fn().mockResolvedValue(signedTx),
57
+ });
58
+
59
+ (transactionToIntent as jest.Mock).mockReturnValue(txIntent);
60
+ (buildOptimisticOperation as jest.Mock).mockReturnValue({ id: "mock-op" });
61
+
62
+ mockSigner.getAddress.mockResolvedValue({ publicKey: pubKey });
63
+ mockSigner.signTransaction.mockResolvedValue("sig");
64
+ mockSignerContext.mockImplementation(async (_deviceId, cb) => cb(mockSigner));
65
+ });
66
+
67
+ it("emits full sign operation flow", async () => {
68
+ const signOperation = genericSignOperation(network, kind)(mockSignerContext);
69
+ const observable = signOperation({ account, transaction, deviceId });
70
+
71
+ const events = await lastValueFrom(observable.pipe(toArray()));
72
+
73
+ expect(events[0]).toEqual({ type: "device-signature-requested" });
74
+ expect(events[1]).toEqual({ type: "device-signature-granted" });
75
+ expect(events[2]).toEqual({
76
+ type: "signed",
77
+ signedOperation: {
78
+ operation: { id: "mock-op" },
79
+ signature: signedTx,
80
+ },
81
+ });
82
+
83
+ expect(transactionToIntent).toHaveBeenCalledWith(account, transaction);
84
+ expect(txIntent.memo.memos.get("destinationTag")).toBe("1234");
85
+ });
86
+
87
+ it("throws FeeNotLoaded if fees are missing", async () => {
88
+ const txWithoutFees = { ...transaction };
89
+ delete txWithoutFees.fees;
90
+
91
+ const signOperation = genericSignOperation(network, kind)(mockSignerContext);
92
+ const observable = signOperation({ account, transaction: txWithoutFees, deviceId });
93
+
94
+ await expect(observable.toPromise()).rejects.toThrow(FeeNotLoaded);
95
+ });
96
+ });
@@ -0,0 +1,63 @@
1
+ import { encodeOperationId } from "@ledgerhq/coin-framework/operation";
2
+ import { Account, Operation, OperationType, TransactionCommon } from "@ledgerhq/types-live";
3
+ import {
4
+ Operation as CoreOperation,
5
+ Asset,
6
+ TransactionIntent,
7
+ } from "@ledgerhq/coin-framework/api/types";
8
+ import BigNumber from "bignumber.js";
9
+ import { fromBigNumberToBigInt } from "@ledgerhq/coin-framework/utils";
10
+
11
+ export function adaptCoreOperationToLiveOperation(
12
+ accountId: string,
13
+ op: CoreOperation<Asset>,
14
+ ): Operation {
15
+ return {
16
+ id: encodeOperationId(accountId, op.tx.hash, op.type),
17
+ hash: op.tx.hash,
18
+ accountId,
19
+ type: op.type as OperationType,
20
+ value: new BigNumber(op.value.toString()),
21
+ fee: new BigNumber(op.tx.fees.toString()),
22
+ blockHash: op.tx.block.hash,
23
+ blockHeight: op.tx.block.height,
24
+ senders: op.senders,
25
+ recipients: op.recipients,
26
+ date: op.tx.date,
27
+ transactionSequenceNumber: op.details?.sequence as number,
28
+ extra: {},
29
+ };
30
+ }
31
+
32
+ export function transactionToIntent(
33
+ _account: Account,
34
+ transaction: TransactionCommon,
35
+ ): TransactionIntent<any> {
36
+ return {
37
+ type: "Payment",
38
+ sender: _account.freshAddress,
39
+ recipient: transaction.recipient,
40
+ amount: fromBigNumberToBigInt(transaction.amount, BigInt(0)),
41
+ asset: null,
42
+ };
43
+ }
44
+
45
+ export const buildOptimisticOperation = (
46
+ account: Account,
47
+ transaction: TransactionCommon,
48
+ ): Operation => {
49
+ return {
50
+ id: encodeOperationId(account.id, "", "OUT"),
51
+ hash: "",
52
+ type: "OUT",
53
+ value: transaction.amount,
54
+ fee: transaction["fees"] ?? BigNumber(0),
55
+ blockHash: null,
56
+ blockHeight: null,
57
+ senders: [account.freshAddress.toString()],
58
+ recipients: [transaction.recipient],
59
+ accountId: account.id,
60
+ date: new Date(),
61
+ extra: {},
62
+ };
63
+ };
@@ -1,11 +1,29 @@
1
+ import { isAddressSanctioned } from "../sanction";
1
2
  import { CurrencyNotSupported } from "@ledgerhq/errors";
2
- import { decodeAccountId, getMainAccount } from "../account";
3
3
  import { getEnv } from "@ledgerhq/live-env";
4
+ import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
5
+ import {
6
+ Account,
7
+ AccountBridge,
8
+ AccountLike,
9
+ CurrencyBridge,
10
+ TransactionStatusCommon,
11
+ } from "@ledgerhq/types-live";
12
+ import { decodeAccountId, getMainAccount } from "../account";
4
13
  import { checkAccountSupported } from "../account/index";
5
14
  import jsBridges from "../generated/bridge/js";
6
15
  import mockBridges from "../generated/bridge/mock";
7
- import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
8
- import { Account, AccountBridge, AccountLike, CurrencyBridge } from "@ledgerhq/types-live";
16
+ import { RecipientAddressSanctionedError, UserAddressSanctionedError } from "../sanction/errors";
17
+ import { getAlpacaCurrencyBridge } from "./generic-alpaca/currencyBridge";
18
+ import { getAlpacaAccountBridge } from "./generic-alpaca/accountBridge";
19
+ import { TransactionCommon } from "@ledgerhq/types-live";
20
+
21
+ const alpacaized = {
22
+ xrp: true,
23
+ };
24
+
25
+ let accountBridgeInstance: AccountBridge<any> | null = null;
26
+ let currencyBridgeInstance: CurrencyBridge | null = null;
9
27
 
10
28
  export const getCurrencyBridge = (currency: CryptoCurrency): CurrencyBridge => {
11
29
  if (getEnv("MOCK")) {
@@ -16,6 +34,13 @@ export const getCurrencyBridge = (currency: CryptoCurrency): CurrencyBridge => {
16
34
  });
17
35
  }
18
36
 
37
+ if (alpacaized[currency.family]) {
38
+ if (!currencyBridgeInstance) {
39
+ currencyBridgeInstance = getAlpacaCurrencyBridge(currency.family, "local");
40
+ }
41
+ return currencyBridgeInstance;
42
+ }
43
+
19
44
  const jsBridge = jsBridges[currency.family];
20
45
  if (jsBridge) {
21
46
  return jsBridge.currencyBridge;
@@ -57,9 +82,66 @@ export function getAccountBridgeByFamily(family: string, accountId?: string): Ac
57
82
  }
58
83
  }
59
84
 
85
+ if (alpacaized[family]) {
86
+ if (!accountBridgeInstance) {
87
+ accountBridgeInstance = getAlpacaAccountBridge(family, "local");
88
+ }
89
+ return accountBridgeInstance;
90
+ }
91
+
60
92
  const jsBridge = jsBridges[family];
61
93
  if (!jsBridge) {
62
- throw new CurrencyNotSupported("currency bridge not found " + family);
94
+ throw new CurrencyNotSupported("account currency bridge not found " + family);
63
95
  }
64
- return jsBridge.accountBridge;
96
+ return wrapAccountBridge(jsBridge.accountBridge);
97
+ }
98
+
99
+ function wrapAccountBridge<T extends TransactionCommon>(
100
+ bridge: AccountBridge<T>,
101
+ ): AccountBridge<T> {
102
+ return {
103
+ ...bridge,
104
+ getTransactionStatus: async (...args) => {
105
+ const blockchainSpecific = await bridge.getTransactionStatus(...args);
106
+ const common = await commonGetTransactionStatus(...args);
107
+ const merged = mergeResults(blockchainSpecific, common);
108
+ return merged;
109
+ },
110
+ };
111
+ }
112
+
113
+ function mergeResults(
114
+ blockchainSpecific: TransactionStatusCommon,
115
+ common: Partial<TransactionStatusCommon>,
116
+ ): TransactionStatusCommon {
117
+ const errors = { ...blockchainSpecific.errors, ...common.errors };
118
+ const warnings = { ...blockchainSpecific.warnings, ...common.warnings };
119
+ return { ...blockchainSpecific, errors, warnings };
120
+ }
121
+
122
+ async function commonGetTransactionStatus(
123
+ account: Account,
124
+ transaction: TransactionCommon,
125
+ ): Promise<Partial<TransactionStatusCommon>> {
126
+ const errors: Record<string, Error> = {};
127
+ const warnings: Record<string, Error> = {};
128
+
129
+ let recipientIsBlacklisted = false;
130
+ if (transaction.recipient && transaction.recipient !== "") {
131
+ recipientIsBlacklisted = await isAddressSanctioned(account.currency, transaction.recipient);
132
+ if (recipientIsBlacklisted) {
133
+ errors.recipient = new RecipientAddressSanctionedError();
134
+ }
135
+ }
136
+
137
+ const userIsBlacklisted = await isAddressSanctioned(account.currency, account.freshAddress);
138
+ if (userIsBlacklisted) {
139
+ errors.amount = new UserAddressSanctionedError();
140
+ }
141
+
142
+ if (userIsBlacklisted || recipientIsBlacklisted) {
143
+ // Send log
144
+ }
145
+
146
+ return { errors, warnings };
65
147
  }
@@ -1,11 +1,20 @@
1
1
  import { CryptoCurrency, CryptoCurrencyId } from "@ledgerhq/types-cryptoassets";
2
2
  import { ConfigInfo, LiveConfig } from "@ledgerhq/live-config/LiveConfig";
3
- import { CurrencyConfig } from "@ledgerhq/coin-framework/config";
3
+ import { CurrencyConfig, SharedConfig } from "@ledgerhq/coin-framework/config";
4
4
 
5
5
  export type CurrencyLiveConfigDefinition = Partial<
6
6
  Record<`config_currency_${CryptoCurrencyId}`, ConfigInfo>
7
7
  >;
8
8
 
9
+ const getSharedConfiguration = (): SharedConfig => {
10
+ const config = LiveConfig.getValueByKey("config_currency");
11
+ if (!config) {
12
+ throw new Error("Configuration config_currency not found, please check Firebase Remote Config");
13
+ }
14
+
15
+ return config;
16
+ };
17
+
9
18
  const getCurrencyConfiguration = <T extends CurrencyConfig>(
10
19
  currency: CryptoCurrency,
11
20
  ): T & Record<string, unknown> => {
@@ -17,4 +26,4 @@ const getCurrencyConfiguration = <T extends CurrencyConfig>(
17
26
  return currencyData;
18
27
  };
19
28
 
20
- export { getCurrencyConfiguration };
29
+ export { getCurrencyConfiguration, getSharedConfiguration };
@@ -36,6 +36,13 @@ const countervaluesConfig: ConfigSchema = {
36
36
  },
37
37
  };
38
38
 
39
+ const sharedCurrencyConfig: ConfigSchema = {
40
+ config_currency: {
41
+ type: "object",
42
+ default: {},
43
+ },
44
+ };
45
+
39
46
  const liveCommonConfig: ConfigSchema = {
40
47
  ...appConfig,
41
48
  };
@@ -67,4 +74,5 @@ export const liveConfig: ConfigSchema = {
67
74
  ...iconConfig,
68
75
  ...tonConfig,
69
76
  ...suiConfig,
77
+ ...sharedCurrencyConfig,
70
78
  };
@@ -0,0 +1,4 @@
1
+ export enum OperationType {
2
+ Buy = "Buy",
3
+ Sell = "Sell",
4
+ }
@@ -15,6 +15,7 @@ export class Provider {
15
15
  static readonly UNISWAP = new Provider("uniswap", "Uniswap", false, false, false);
16
16
  static readonly LIFI = new Provider("lifi", "LI.FI", false, true, false);
17
17
  static readonly CIC = new Provider("cic", "CIC", false, true, true);
18
+ static readonly COINBASE = new Provider("coinbase", "Coinbase", false, true, true);
18
19
 
19
20
  static getNameByUiName(uiName: string): string {
20
21
  const provider = Object.values(Provider).find(p => p.uiName === uiName);
@@ -1,4 +1,5 @@
1
1
  import { AccountType } from "../enum/Account";
2
+ import { OperationType } from "../enum/OperationType";
2
3
 
3
4
  export interface Fiat {
4
5
  locale: string;
@@ -9,4 +10,5 @@ export interface BuySell {
9
10
  crypto: AccountType;
10
11
  fiat: Fiat;
11
12
  amount: string;
13
+ operation: OperationType;
12
14
  }
@@ -1,5 +1,5 @@
1
1
  import "../../__tests__/test-helpers/setup";
2
2
  import { testBridge } from "../../__tests__/test-helpers/bridge";
3
- import { dataset } from "@ledgerhq/coin-casper/test/index";
3
+ import { dataset } from "@ledgerhq/coin-casper/test";
4
4
 
5
5
  testBridge(dataset);
@@ -1,12 +1,16 @@
1
- import { ConfigInfo } from "@ledgerhq/live-config/LiveConfig";
1
+ import { CurrencyLiveConfigDefinition } from "../../config";
2
2
 
3
- export const casperConfig: Record<string, ConfigInfo> = {
3
+ export const casperConfig: CurrencyLiveConfigDefinition = {
4
4
  config_currency_casper: {
5
5
  type: "object",
6
6
  default: {
7
7
  status: {
8
8
  type: "active",
9
9
  },
10
+ infra: {
11
+ API_CASPER_NODE_ENDPOINT: "https://casper.coin.ledger.com/node/",
12
+ API_CASPER_INDEXER: "https://casper.coin.ledger.com/indexer/",
13
+ },
10
14
  },
11
15
  },
12
16
  };
@@ -1,17 +1,20 @@
1
1
  // Goal of this file is to inject all necessary device/signer dependency to coin-modules
2
2
 
3
- import { createBridges } from "@ledgerhq/coin-casper/bridge/index";
3
+ import { createBridges } from "@ledgerhq/coin-casper/bridge";
4
4
  import Transport from "@ledgerhq/hw-transport";
5
5
  import Casper from "@zondax/ledger-casper";
6
- import casperResolver from "@ledgerhq/coin-casper/signer/index";
6
+ import casperResolver from "@ledgerhq/coin-casper/signer";
7
7
  import { signMessage } from "@ledgerhq/coin-casper/hw-signMessage";
8
8
  import type { Account, Bridge } from "@ledgerhq/types-live";
9
9
  import makeCliTools from "@ledgerhq/coin-casper/test/cli";
10
10
  import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
11
11
  import { Resolver } from "../../hw/getAddress/types";
12
- import { TransactionStatus, Transaction } from "@ledgerhq/coin-casper/types/index";
12
+ import { TransactionStatus, Transaction } from "@ledgerhq/coin-casper/types";
13
13
  import { CasperGetAddrResponse, CasperSignature, CasperSigner } from "./types";
14
+ import { getCurrencyConfiguration } from "../../config";
15
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
14
16
  import { getPath, isError } from "./common";
17
+ import { CasperCoinConfig } from "@ledgerhq/coin-casper/config";
15
18
 
16
19
  const createSigner: CreateSigner<CasperSigner> = (transport: Transport) => {
17
20
  const casper = new Casper(transport);
@@ -37,8 +40,12 @@ const createSigner: CreateSigner<CasperSigner> = (transport: Transport) => {
37
40
  };
38
41
  };
39
42
 
43
+ const getCoinConfig: CasperCoinConfig = () =>
44
+ getCurrencyConfiguration<ReturnType<CasperCoinConfig>>(getCryptoCurrencyById("casper"));
45
+
40
46
  const bridge: Bridge<Transaction, Account, TransactionStatus> = createBridges(
41
47
  executeWithSigner(createSigner),
48
+ getCoinConfig,
42
49
  );
43
50
 
44
51
  const messageSigner = {
@@ -1,2 +1,2 @@
1
1
  // Encapsulate for LLD & LLM
2
- export * from "@ledgerhq/coin-casper/types/index";
2
+ export * from "@ledgerhq/coin-casper/types";
@@ -1,31 +1,18 @@
1
1
  // Goal of this file is to inject all necessary device/signer dependency to coin-modules
2
2
 
3
3
  import Xrp from "@ledgerhq/hw-app-xrp";
4
- import { Bridge } from "@ledgerhq/types-live";
5
4
  import Transport from "@ledgerhq/hw-transport";
6
- import { createBridges, type XrpCoinConfig } from "@ledgerhq/coin-xrp";
7
5
  import xrpResolver from "@ledgerhq/coin-xrp/signer/index";
8
6
  import makeCliTools from "@ledgerhq/coin-xrp/test/cli";
9
- import { Transaction as XrpTransaction } from "@ledgerhq/coin-xrp/types";
10
- import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
11
- import { CreateSigner, createResolver, executeWithSigner } from "../../bridge/setup";
12
- import { getCurrencyConfiguration } from "../../config";
7
+ import { CreateSigner, createResolver } from "../../bridge/setup";
13
8
  import { Resolver } from "../../hw/getAddress/types";
14
9
 
15
10
  const createSigner: CreateSigner<Xrp> = (transport: Transport) => {
16
11
  return new Xrp(transport);
17
12
  };
18
13
 
19
- const getCoinConfig = () =>
20
- getCurrencyConfiguration<XrpCoinConfig>(getCryptoCurrencyById("ripple"));
21
-
22
- const bridge: Bridge<XrpTransaction> = createBridges(
23
- executeWithSigner(createSigner),
24
- getCoinConfig,
25
- );
26
-
27
14
  const resolver: Resolver = createResolver(createSigner, xrpResolver);
28
15
 
29
16
  const cliTools = makeCliTools();
30
17
 
31
- export { bridge, cliTools, resolver };
18
+ export { cliTools, resolver };
@@ -618,6 +618,8 @@ export const DEFAULT_FEATURES: Features = {
618
618
  },
619
619
  ldmkConnectApp: DEFAULT_FEATURE,
620
620
  lldNetworkBasedAddAccount: DEFAULT_FEATURE,
621
+ llmOfacGeoBlocking: DEFAULT_FEATURE,
622
+ lldOfacGeoBlocking: DEFAULT_FEATURE,
621
623
  };
622
624
 
623
625
  // Firebase SDK treat JSON values as strings
@@ -20,7 +20,6 @@ import { bridge as tezos } from "../../families/tezos/setup";
20
20
  import { bridge as ton } from "../../families/ton/setup";
21
21
  import { bridge as tron } from "../../families/tron/setup";
22
22
  import { bridge as vechain } from "../../families/vechain/setup";
23
- import { bridge as xrp } from "../../families/xrp/setup";
24
23
  import { bridge as sui } from "../../families/sui/setup";
25
24
  import { bridge as mina } from "../../families/mina/setup";
26
25
 
@@ -47,7 +46,6 @@ export default {
47
46
  ton,
48
47
  tron,
49
48
  vechain,
50
- xrp,
51
49
  sui,
52
50
  mina,
53
51
  };
@@ -0,0 +1,37 @@
1
+ import { useEffect, useState } from "react";
2
+ import { useFeature } from "../featureFlags";
3
+ import { useQuery } from "@tanstack/react-query";
4
+ import { getEnv } from "@ledgerhq/live-env";
5
+
6
+ const baseURL = () => getEnv("LEDGER_COUNTERVALUES_API");
7
+
8
+ export const useOFACGeoBlockCheck = ({
9
+ onFinish,
10
+ geoBlockingFeatureFlagKey,
11
+ }: {
12
+ onFinish?: () => void;
13
+ geoBlockingFeatureFlagKey: "llmOfacGeoBlocking" | "lldOfacGeoBlocking";
14
+ }) => {
15
+ const [blocked, setBlocked] = useState<boolean>(false);
16
+
17
+ const platformOfacGeoBlocking = useFeature(geoBlockingFeatureFlagKey);
18
+
19
+ const { data, isLoading } = useQuery({
20
+ queryKey: ["ofac-geo-block", geoBlockingFeatureFlagKey],
21
+ queryFn: async () => {
22
+ if (!platformOfacGeoBlocking?.enabled) return false;
23
+ const res = await fetch(`${baseURL()}/v3/market`);
24
+ return res.status === 451;
25
+ },
26
+ });
27
+
28
+ useEffect(() => {
29
+ if (!platformOfacGeoBlocking?.enabled) return;
30
+ setBlocked(data ?? false);
31
+ if (typeof onFinish === "function") {
32
+ onFinish();
33
+ }
34
+ }, [data, onFinish, platformOfacGeoBlocking]);
35
+
36
+ return { blocked, isLoading };
37
+ };
@@ -0,0 +1,31 @@
1
+ export class UserAddressSanctionedError extends Error {
2
+ constructor() {
3
+ super();
4
+ this.message = this.constructor.name;
5
+ this.name = this.constructor.name;
6
+ }
7
+ }
8
+
9
+ export class UserAddressSanctionedForSendError extends Error {
10
+ constructor() {
11
+ super();
12
+ this.message = this.constructor.name;
13
+ this.name = this.constructor.name;
14
+ }
15
+ }
16
+
17
+ export class UserAddressSanctionedForStakingError extends Error {
18
+ constructor() {
19
+ super();
20
+ this.message = this.constructor.name;
21
+ this.name = this.constructor.name;
22
+ }
23
+ }
24
+
25
+ export class RecipientAddressSanctionedError extends Error {
26
+ constructor() {
27
+ super();
28
+ this.message = this.constructor.name;
29
+ this.name = this.constructor.name;
30
+ }
31
+ }
@@ -0,0 +1,59 @@
1
+ import { LiveConfig } from "@ledgerhq/live-config/LiveConfig";
2
+ import axios from "axios";
3
+ import { hours, makeLRUCache } from "@ledgerhq/live-network/cache";
4
+ import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
5
+ import { getCurrencyConfiguration, getSharedConfiguration } from "../config";
6
+ import { CurrencyConfig } from "@ledgerhq/coin-framework/config";
7
+
8
+ const cache = makeLRUCache(fetchSanctionedAddresses, () => "all_sanctioned_addresses", hours(12));
9
+
10
+ async function fetchSanctionedAddresses(): Promise<Record<string, string[]>> {
11
+ const { data } = await axios.get(
12
+ "https://ofac-compliance.pages.dev/all_sanctioned_addresses.json",
13
+ );
14
+ return data;
15
+ }
16
+
17
+ export async function isAddressSanctioned(
18
+ currency: CryptoCurrency,
19
+ address: string,
20
+ ): Promise<boolean> {
21
+ if (!isCheckBlacklistAddressEnabled(currency)) {
22
+ return false;
23
+ }
24
+
25
+ // Only for testing, should be deleted after
26
+ const temporarySanctionedAddresses: string[] | undefined =
27
+ LiveConfig.getValueByKey(`tmp_sanctioned_addresses`);
28
+
29
+ const data: Record<string, string[]> = await cache();
30
+ const addresses = data[currency.ticker] || [];
31
+
32
+ if (temporarySanctionedAddresses) {
33
+ return addresses.concat(temporarySanctionedAddresses).includes(address);
34
+ }
35
+
36
+ return addresses.includes(address);
37
+ }
38
+
39
+ function isCheckBlacklistAddressEnabled(currency: CryptoCurrency): boolean {
40
+ const currencyConfig = tryGetCurrencyConfig(currency);
41
+ if (currencyConfig && "checkBlacklistAddress" in currencyConfig) {
42
+ return currencyConfig.checkBlacklistAddress === true;
43
+ } else {
44
+ const sharedConfiguration = getSharedConfiguration();
45
+ if ("checkBlacklistAddress" in sharedConfiguration) {
46
+ return sharedConfiguration.checkBlacklistAddress === true;
47
+ }
48
+ }
49
+
50
+ return false;
51
+ }
52
+
53
+ function tryGetCurrencyConfig(currency: CryptoCurrency): CurrencyConfig | undefined {
54
+ try {
55
+ return getCurrencyConfiguration(currency);
56
+ } catch (error) {
57
+ return undefined;
58
+ }
59
+ }