@ledgerhq/coin-concordium 0.2.0-nightly.20251209140356

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 (385) hide show
  1. package/.env.integ.test.example +2 -0
  2. package/.eslintrc.js +37 -0
  3. package/.turbo/turbo-build.log +4 -0
  4. package/.unimportedrc.json +29 -0
  5. package/CHANGELOG.md +18 -0
  6. package/LICENSE.txt +21 -0
  7. package/jest.config.js +21 -0
  8. package/jest.integ.config.js +8 -0
  9. package/lib/api/index.d.ts +4 -0
  10. package/lib/api/index.d.ts.map +1 -0
  11. package/lib/api/index.js +56 -0
  12. package/lib/api/index.js.map +1 -0
  13. package/lib/bridge/broadcast.d.ts +4 -0
  14. package/lib/bridge/broadcast.d.ts.map +1 -0
  15. package/lib/bridge/broadcast.js +11 -0
  16. package/lib/bridge/broadcast.js.map +1 -0
  17. package/lib/bridge/createTransaction.d.ts +4 -0
  18. package/lib/bridge/createTransaction.d.ts.map +1 -0
  19. package/lib/bridge/createTransaction.js +19 -0
  20. package/lib/bridge/createTransaction.js.map +1 -0
  21. package/lib/bridge/deviceTransactionConfig.d.ts +11 -0
  22. package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
  23. package/lib/bridge/deviceTransactionConfig.js +21 -0
  24. package/lib/bridge/deviceTransactionConfig.js.map +1 -0
  25. package/lib/bridge/estimateMaxSpendable.d.ts +4 -0
  26. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
  27. package/lib/bridge/estimateMaxSpendable.js +26 -0
  28. package/lib/bridge/estimateMaxSpendable.js.map +1 -0
  29. package/lib/bridge/getTransactionStatus.d.ts +4 -0
  30. package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
  31. package/lib/bridge/getTransactionStatus.js +78 -0
  32. package/lib/bridge/getTransactionStatus.js.map +1 -0
  33. package/lib/bridge/index.d.ts +11 -0
  34. package/lib/bridge/index.d.ts.map +1 -0
  35. package/lib/bridge/index.js +54 -0
  36. package/lib/bridge/index.js.map +1 -0
  37. package/lib/bridge/prepareTransaction.d.ts +4 -0
  38. package/lib/bridge/prepareTransaction.d.ts.map +1 -0
  39. package/lib/bridge/prepareTransaction.js +20 -0
  40. package/lib/bridge/prepareTransaction.js.map +1 -0
  41. package/lib/bridge/signOperation.d.ts +5 -0
  42. package/lib/bridge/signOperation.d.ts.map +1 -0
  43. package/lib/bridge/signOperation.js +75 -0
  44. package/lib/bridge/signOperation.js.map +1 -0
  45. package/lib/bridge/sync.d.ts +3 -0
  46. package/lib/bridge/sync.d.ts.map +1 -0
  47. package/lib/bridge/sync.js +86 -0
  48. package/lib/bridge/sync.js.map +1 -0
  49. package/lib/bridge/transaction.d.ts +15 -0
  50. package/lib/bridge/transaction.d.ts.map +1 -0
  51. package/lib/bridge/transaction.js +50 -0
  52. package/lib/bridge/transaction.js.map +1 -0
  53. package/lib/bridge/updateTransaction.d.ts +4 -0
  54. package/lib/bridge/updateTransaction.d.ts.map +1 -0
  55. package/lib/bridge/updateTransaction.js +17 -0
  56. package/lib/bridge/updateTransaction.js.map +1 -0
  57. package/lib/common-logic/account/getBalance.d.ts +3 -0
  58. package/lib/common-logic/account/getBalance.d.ts.map +1 -0
  59. package/lib/common-logic/account/getBalance.js +10 -0
  60. package/lib/common-logic/account/getBalance.js.map +1 -0
  61. package/lib/common-logic/account/getNextSequence.d.ts +2 -0
  62. package/lib/common-logic/account/getNextSequence.d.ts.map +1 -0
  63. package/lib/common-logic/account/getNextSequence.js +9 -0
  64. package/lib/common-logic/account/getNextSequence.js.map +1 -0
  65. package/lib/common-logic/common.d.ts +3 -0
  66. package/lib/common-logic/common.d.ts.map +1 -0
  67. package/lib/common-logic/common.js +11 -0
  68. package/lib/common-logic/common.js.map +1 -0
  69. package/lib/common-logic/history/lastBlock.d.ts +3 -0
  70. package/lib/common-logic/history/lastBlock.d.ts.map +1 -0
  71. package/lib/common-logic/history/lastBlock.js +13 -0
  72. package/lib/common-logic/history/lastBlock.js.map +1 -0
  73. package/lib/common-logic/history/listOperations.d.ts +11 -0
  74. package/lib/common-logic/history/listOperations.d.ts.map +1 -0
  75. package/lib/common-logic/history/listOperations.js +53 -0
  76. package/lib/common-logic/history/listOperations.js.map +1 -0
  77. package/lib/common-logic/index.d.ts +11 -0
  78. package/lib/common-logic/index.d.ts.map +1 -0
  79. package/lib/common-logic/index.js +24 -0
  80. package/lib/common-logic/index.js.map +1 -0
  81. package/lib/common-logic/transaction/broadcast.d.ts +2 -0
  82. package/lib/common-logic/transaction/broadcast.d.ts.map +1 -0
  83. package/lib/common-logic/transaction/broadcast.js +9 -0
  84. package/lib/common-logic/transaction/broadcast.js.map +1 -0
  85. package/lib/common-logic/transaction/combine.d.ts +2 -0
  86. package/lib/common-logic/transaction/combine.d.ts.map +1 -0
  87. package/lib/common-logic/transaction/combine.js +9 -0
  88. package/lib/common-logic/transaction/combine.js.map +1 -0
  89. package/lib/common-logic/transaction/craftTransaction.d.ts +15 -0
  90. package/lib/common-logic/transaction/craftTransaction.d.ts.map +1 -0
  91. package/lib/common-logic/transaction/craftTransaction.js +20 -0
  92. package/lib/common-logic/transaction/craftTransaction.js.map +1 -0
  93. package/lib/common-logic/transaction/estimateFees.d.ts +2 -0
  94. package/lib/common-logic/transaction/estimateFees.d.ts.map +1 -0
  95. package/lib/common-logic/transaction/estimateFees.js +21 -0
  96. package/lib/common-logic/transaction/estimateFees.js.map +1 -0
  97. package/lib/common-logic/utils.d.ts +6 -0
  98. package/lib/common-logic/utils.d.ts.map +1 -0
  99. package/lib/common-logic/utils.js +22 -0
  100. package/lib/common-logic/utils.js.map +1 -0
  101. package/lib/config.d.ts +12 -0
  102. package/lib/config.d.ts.map +1 -0
  103. package/lib/config.js +9 -0
  104. package/lib/config.js.map +1 -0
  105. package/lib/index.d.ts +4 -0
  106. package/lib/index.d.ts.map +1 -0
  107. package/lib/index.js +21 -0
  108. package/lib/index.js.map +1 -0
  109. package/lib/network/indexer.d.ts +6 -0
  110. package/lib/network/indexer.d.ts.map +1 -0
  111. package/lib/network/indexer.js +19 -0
  112. package/lib/network/indexer.js.map +1 -0
  113. package/lib/network/mock-network.d.ts +5 -0
  114. package/lib/network/mock-network.d.ts.map +1 -0
  115. package/lib/network/mock-network.js +29 -0
  116. package/lib/network/mock-network.js.map +1 -0
  117. package/lib/network/node.d.ts +12 -0
  118. package/lib/network/node.d.ts.map +1 -0
  119. package/lib/network/node.js +92 -0
  120. package/lib/network/node.js.map +1 -0
  121. package/lib/network/types.d.ts +47 -0
  122. package/lib/network/types.d.ts.map +1 -0
  123. package/lib/network/types.js +7 -0
  124. package/lib/network/types.js.map +1 -0
  125. package/lib/signer/getAddress.d.ts +6 -0
  126. package/lib/signer/getAddress.d.ts.map +1 -0
  127. package/lib/signer/getAddress.js +14 -0
  128. package/lib/signer/getAddress.js.map +1 -0
  129. package/lib/signer/index.d.ts +6 -0
  130. package/lib/signer/index.d.ts.map +1 -0
  131. package/lib/signer/index.js +11 -0
  132. package/lib/signer/index.js.map +1 -0
  133. package/lib/test/bot-deviceActions.d.ts +4 -0
  134. package/lib/test/bot-deviceActions.d.ts.map +1 -0
  135. package/lib/test/bot-deviceActions.js +44 -0
  136. package/lib/test/bot-deviceActions.js.map +1 -0
  137. package/lib/test/bot-specs.d.ts +2 -0
  138. package/lib/test/bot-specs.d.ts.map +1 -0
  139. package/lib/test/bot-specs.js +79 -0
  140. package/lib/test/bot-specs.js.map +1 -0
  141. package/lib/test/bridgeDatasetTest.d.ts +5 -0
  142. package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
  143. package/lib/test/bridgeDatasetTest.js +148 -0
  144. package/lib/test/bridgeDatasetTest.js.map +1 -0
  145. package/lib/test/cli.d.ts +26 -0
  146. package/lib/test/cli.d.ts.map +1 -0
  147. package/lib/test/cli.js +36 -0
  148. package/lib/test/cli.js.map +1 -0
  149. package/lib/test/index.d.ts +5 -0
  150. package/lib/test/index.d.ts.map +1 -0
  151. package/lib/test/index.js +26 -0
  152. package/lib/test/index.js.map +1 -0
  153. package/lib/types/assets.d.ts +3 -0
  154. package/lib/types/assets.d.ts.map +1 -0
  155. package/lib/types/assets.js +3 -0
  156. package/lib/types/assets.js.map +1 -0
  157. package/lib/types/bridge.d.ts +23 -0
  158. package/lib/types/bridge.d.ts.map +1 -0
  159. package/lib/types/bridge.js +3 -0
  160. package/lib/types/bridge.js.map +1 -0
  161. package/lib/types/errors.d.ts +4 -0
  162. package/lib/types/errors.d.ts.map +1 -0
  163. package/lib/types/errors.js +6 -0
  164. package/lib/types/errors.js.map +1 -0
  165. package/lib/types/index.d.ts +13 -0
  166. package/lib/types/index.d.ts.map +1 -0
  167. package/lib/types/index.js +19 -0
  168. package/lib/types/index.js.map +1 -0
  169. package/lib/types/signer.d.ts +10 -0
  170. package/lib/types/signer.d.ts.map +1 -0
  171. package/lib/types/signer.js +3 -0
  172. package/lib/types/signer.js.map +1 -0
  173. package/lib-es/api/index.d.ts +4 -0
  174. package/lib-es/api/index.d.ts.map +1 -0
  175. package/lib-es/api/index.js +50 -0
  176. package/lib-es/api/index.js.map +1 -0
  177. package/lib-es/bridge/broadcast.d.ts +4 -0
  178. package/lib-es/bridge/broadcast.d.ts.map +1 -0
  179. package/lib-es/bridge/broadcast.js +7 -0
  180. package/lib-es/bridge/broadcast.js.map +1 -0
  181. package/lib-es/bridge/createTransaction.d.ts +4 -0
  182. package/lib-es/bridge/createTransaction.d.ts.map +1 -0
  183. package/lib-es/bridge/createTransaction.js +12 -0
  184. package/lib-es/bridge/createTransaction.js.map +1 -0
  185. package/lib-es/bridge/deviceTransactionConfig.d.ts +11 -0
  186. package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
  187. package/lib-es/bridge/deviceTransactionConfig.js +19 -0
  188. package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
  189. package/lib-es/bridge/estimateMaxSpendable.d.ts +4 -0
  190. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
  191. package/lib-es/bridge/estimateMaxSpendable.js +19 -0
  192. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
  193. package/lib-es/bridge/getTransactionStatus.d.ts +4 -0
  194. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
  195. package/lib-es/bridge/getTransactionStatus.js +71 -0
  196. package/lib-es/bridge/getTransactionStatus.js.map +1 -0
  197. package/lib-es/bridge/index.d.ts +11 -0
  198. package/lib-es/bridge/index.d.ts.map +1 -0
  199. package/lib-es/bridge/index.js +48 -0
  200. package/lib-es/bridge/index.js.map +1 -0
  201. package/lib-es/bridge/prepareTransaction.d.ts +4 -0
  202. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
  203. package/lib-es/bridge/prepareTransaction.js +13 -0
  204. package/lib-es/bridge/prepareTransaction.js.map +1 -0
  205. package/lib-es/bridge/signOperation.d.ts +5 -0
  206. package/lib-es/bridge/signOperation.d.ts.map +1 -0
  207. package/lib-es/bridge/signOperation.js +68 -0
  208. package/lib-es/bridge/signOperation.js.map +1 -0
  209. package/lib-es/bridge/sync.d.ts +3 -0
  210. package/lib-es/bridge/sync.d.ts.map +1 -0
  211. package/lib-es/bridge/sync.js +79 -0
  212. package/lib-es/bridge/sync.js.map +1 -0
  213. package/lib-es/bridge/transaction.d.ts +15 -0
  214. package/lib-es/bridge/transaction.d.ts.map +1 -0
  215. package/lib-es/bridge/transaction.js +44 -0
  216. package/lib-es/bridge/transaction.js.map +1 -0
  217. package/lib-es/bridge/updateTransaction.d.ts +4 -0
  218. package/lib-es/bridge/updateTransaction.d.ts.map +1 -0
  219. package/lib-es/bridge/updateTransaction.js +13 -0
  220. package/lib-es/bridge/updateTransaction.js.map +1 -0
  221. package/lib-es/common-logic/account/getBalance.d.ts +3 -0
  222. package/lib-es/common-logic/account/getBalance.d.ts.map +1 -0
  223. package/lib-es/common-logic/account/getBalance.js +7 -0
  224. package/lib-es/common-logic/account/getBalance.js.map +1 -0
  225. package/lib-es/common-logic/account/getNextSequence.d.ts +2 -0
  226. package/lib-es/common-logic/account/getNextSequence.d.ts.map +1 -0
  227. package/lib-es/common-logic/account/getNextSequence.js +6 -0
  228. package/lib-es/common-logic/account/getNextSequence.js.map +1 -0
  229. package/lib-es/common-logic/common.d.ts +3 -0
  230. package/lib-es/common-logic/common.d.ts.map +1 -0
  231. package/lib-es/common-logic/common.js +7 -0
  232. package/lib-es/common-logic/common.js.map +1 -0
  233. package/lib-es/common-logic/history/lastBlock.d.ts +3 -0
  234. package/lib-es/common-logic/history/lastBlock.d.ts.map +1 -0
  235. package/lib-es/common-logic/history/lastBlock.js +10 -0
  236. package/lib-es/common-logic/history/lastBlock.js.map +1 -0
  237. package/lib-es/common-logic/history/listOperations.d.ts +11 -0
  238. package/lib-es/common-logic/history/listOperations.d.ts.map +1 -0
  239. package/lib-es/common-logic/history/listOperations.js +50 -0
  240. package/lib-es/common-logic/history/listOperations.js.map +1 -0
  241. package/lib-es/common-logic/index.d.ts +11 -0
  242. package/lib-es/common-logic/index.d.ts.map +1 -0
  243. package/lib-es/common-logic/index.js +11 -0
  244. package/lib-es/common-logic/index.js.map +1 -0
  245. package/lib-es/common-logic/transaction/broadcast.d.ts +2 -0
  246. package/lib-es/common-logic/transaction/broadcast.d.ts.map +1 -0
  247. package/lib-es/common-logic/transaction/broadcast.js +6 -0
  248. package/lib-es/common-logic/transaction/broadcast.js.map +1 -0
  249. package/lib-es/common-logic/transaction/combine.d.ts +2 -0
  250. package/lib-es/common-logic/transaction/combine.d.ts.map +1 -0
  251. package/lib-es/common-logic/transaction/combine.js +6 -0
  252. package/lib-es/common-logic/transaction/combine.js.map +1 -0
  253. package/lib-es/common-logic/transaction/craftTransaction.d.ts +15 -0
  254. package/lib-es/common-logic/transaction/craftTransaction.d.ts.map +1 -0
  255. package/lib-es/common-logic/transaction/craftTransaction.js +17 -0
  256. package/lib-es/common-logic/transaction/craftTransaction.js.map +1 -0
  257. package/lib-es/common-logic/transaction/estimateFees.d.ts +2 -0
  258. package/lib-es/common-logic/transaction/estimateFees.d.ts.map +1 -0
  259. package/lib-es/common-logic/transaction/estimateFees.js +18 -0
  260. package/lib-es/common-logic/transaction/estimateFees.js.map +1 -0
  261. package/lib-es/common-logic/utils.d.ts +6 -0
  262. package/lib-es/common-logic/utils.d.ts.map +1 -0
  263. package/lib-es/common-logic/utils.js +13 -0
  264. package/lib-es/common-logic/utils.js.map +1 -0
  265. package/lib-es/config.d.ts +12 -0
  266. package/lib-es/config.d.ts.map +1 -0
  267. package/lib-es/config.js +4 -0
  268. package/lib-es/config.js.map +1 -0
  269. package/lib-es/index.d.ts +4 -0
  270. package/lib-es/index.d.ts.map +1 -0
  271. package/lib-es/index.js +3 -0
  272. package/lib-es/index.js.map +1 -0
  273. package/lib-es/network/indexer.d.ts +6 -0
  274. package/lib-es/network/indexer.d.ts.map +1 -0
  275. package/lib-es/network/indexer.js +12 -0
  276. package/lib-es/network/indexer.js.map +1 -0
  277. package/lib-es/network/mock-network.d.ts +5 -0
  278. package/lib-es/network/mock-network.d.ts.map +1 -0
  279. package/lib-es/network/mock-network.js +25 -0
  280. package/lib-es/network/mock-network.js.map +1 -0
  281. package/lib-es/network/node.d.ts +12 -0
  282. package/lib-es/network/node.d.ts.map +1 -0
  283. package/lib-es/network/node.js +80 -0
  284. package/lib-es/network/node.js.map +1 -0
  285. package/lib-es/network/types.d.ts +47 -0
  286. package/lib-es/network/types.d.ts.map +1 -0
  287. package/lib-es/network/types.js +4 -0
  288. package/lib-es/network/types.js.map +1 -0
  289. package/lib-es/signer/getAddress.d.ts +6 -0
  290. package/lib-es/signer/getAddress.d.ts.map +1 -0
  291. package/lib-es/signer/getAddress.js +12 -0
  292. package/lib-es/signer/getAddress.js.map +1 -0
  293. package/lib-es/signer/index.d.ts +6 -0
  294. package/lib-es/signer/index.d.ts.map +1 -0
  295. package/lib-es/signer/index.js +6 -0
  296. package/lib-es/signer/index.js.map +1 -0
  297. package/lib-es/test/bot-deviceActions.d.ts +4 -0
  298. package/lib-es/test/bot-deviceActions.d.ts.map +1 -0
  299. package/lib-es/test/bot-deviceActions.js +41 -0
  300. package/lib-es/test/bot-deviceActions.js.map +1 -0
  301. package/lib-es/test/bot-specs.d.ts +1 -0
  302. package/lib-es/test/bot-specs.d.ts.map +1 -0
  303. package/lib-es/test/bot-specs.js +78 -0
  304. package/lib-es/test/bot-specs.js.map +1 -0
  305. package/lib-es/test/bridgeDatasetTest.d.ts +5 -0
  306. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
  307. package/lib-es/test/bridgeDatasetTest.js +142 -0
  308. package/lib-es/test/bridgeDatasetTest.js.map +1 -0
  309. package/lib-es/test/cli.d.ts +26 -0
  310. package/lib-es/test/cli.d.ts.map +1 -0
  311. package/lib-es/test/cli.js +30 -0
  312. package/lib-es/test/cli.js.map +1 -0
  313. package/lib-es/test/index.d.ts +5 -0
  314. package/lib-es/test/index.d.ts.map +1 -0
  315. package/lib-es/test/index.js +6 -0
  316. package/lib-es/test/index.js.map +1 -0
  317. package/lib-es/types/assets.d.ts +3 -0
  318. package/lib-es/types/assets.d.ts.map +1 -0
  319. package/lib-es/types/assets.js +2 -0
  320. package/lib-es/types/assets.js.map +1 -0
  321. package/lib-es/types/bridge.d.ts +23 -0
  322. package/lib-es/types/bridge.d.ts.map +1 -0
  323. package/lib-es/types/bridge.js +2 -0
  324. package/lib-es/types/bridge.js.map +1 -0
  325. package/lib-es/types/errors.d.ts +4 -0
  326. package/lib-es/types/errors.d.ts.map +1 -0
  327. package/lib-es/types/errors.js +3 -0
  328. package/lib-es/types/errors.js.map +1 -0
  329. package/lib-es/types/index.d.ts +13 -0
  330. package/lib-es/types/index.d.ts.map +1 -0
  331. package/lib-es/types/index.js +3 -0
  332. package/lib-es/types/index.js.map +1 -0
  333. package/lib-es/types/signer.d.ts +10 -0
  334. package/lib-es/types/signer.d.ts.map +1 -0
  335. package/lib-es/types/signer.js +2 -0
  336. package/lib-es/types/signer.js.map +1 -0
  337. package/package.json +137 -0
  338. package/src/api/index.test.ts +22 -0
  339. package/src/api/index.ts +88 -0
  340. package/src/bridge/broadcast.test.ts +36 -0
  341. package/src/bridge/broadcast.ts +11 -0
  342. package/src/bridge/createTransaction.test.ts +12 -0
  343. package/src/bridge/createTransaction.ts +14 -0
  344. package/src/bridge/deviceTransactionConfig.test.ts +20 -0
  345. package/src/bridge/deviceTransactionConfig.ts +34 -0
  346. package/src/bridge/estimateMaxSpendable.ts +25 -0
  347. package/src/bridge/getTransactionStatus.ts +88 -0
  348. package/src/bridge/index.test.ts +26 -0
  349. package/src/bridge/index.ts +65 -0
  350. package/src/bridge/prepareTransaction.test.ts +29 -0
  351. package/src/bridge/prepareTransaction.ts +25 -0
  352. package/src/bridge/signOperation.ts +94 -0
  353. package/src/bridge/sync.ts +106 -0
  354. package/src/bridge/transaction.ts +61 -0
  355. package/src/bridge/updateTransaction.ts +17 -0
  356. package/src/common-logic/account/getBalance.ts +8 -0
  357. package/src/common-logic/account/getNextSequence.ts +6 -0
  358. package/src/common-logic/common.ts +8 -0
  359. package/src/common-logic/history/lastBlock.ts +11 -0
  360. package/src/common-logic/history/listOperations.ts +65 -0
  361. package/src/common-logic/index.ts +11 -0
  362. package/src/common-logic/transaction/broadcast.ts +6 -0
  363. package/src/common-logic/transaction/combine.ts +6 -0
  364. package/src/common-logic/transaction/craftTransaction.ts +36 -0
  365. package/src/common-logic/transaction/estimateFees.ts +16 -0
  366. package/src/common-logic/utils.ts +18 -0
  367. package/src/config.ts +12 -0
  368. package/src/index.ts +4 -0
  369. package/src/network/indexer.ts +17 -0
  370. package/src/network/mock-network.ts +25 -0
  371. package/src/network/node.ts +94 -0
  372. package/src/network/types.ts +51 -0
  373. package/src/signer/getAddress.ts +20 -0
  374. package/src/signer/index.ts +7 -0
  375. package/src/test/bot-deviceActions.ts +48 -0
  376. package/src/test/bot-specs.ts +76 -0
  377. package/src/test/bridgeDatasetTest.ts +147 -0
  378. package/src/test/cli.ts +44 -0
  379. package/src/test/index.ts +6 -0
  380. package/src/types/assets.ts +3 -0
  381. package/src/types/bridge.ts +33 -0
  382. package/src/types/errors.ts +3 -0
  383. package/src/types/index.ts +13 -0
  384. package/src/types/signer.ts +11 -0
  385. package/tsconfig.json +12 -0
@@ -0,0 +1,75 @@
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.buildSignOperation = void 0;
7
+ const rxjs_1 = require("rxjs");
8
+ const errors_1 = require("@ledgerhq/errors");
9
+ const operation_1 = require("@ledgerhq/coin-framework/operation");
10
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
11
+ const common_logic_1 = require("../common-logic");
12
+ const buildSignOperation = (signerContext) => ({ account, deviceId, transaction }) => new rxjs_1.Observable(o => {
13
+ async function main() {
14
+ const { fee } = transaction;
15
+ if (!fee)
16
+ throw new errors_1.FeeNotLoaded();
17
+ try {
18
+ // o observables allows to define steps of the signing process with the device
19
+ o.next({
20
+ type: "device-signature-requested",
21
+ });
22
+ const nextSequenceNumber = await (0, common_logic_1.getNextValidSequence)(account.freshAddress);
23
+ const signature = await signerContext(deviceId, async (signer) => {
24
+ const { freshAddressPath: derivationPath } = account;
25
+ const { publicKey } = await signer.getAddress(derivationPath);
26
+ const { nativeTransaction, serializedTransaction } = await (0, common_logic_1.craftTransaction)({
27
+ address: account.freshAddress,
28
+ publicKey,
29
+ }, {
30
+ recipient: transaction.recipient,
31
+ amount: transaction.amount,
32
+ fee: fee,
33
+ });
34
+ const transactionSignature = await signer.signTransaction(derivationPath, serializedTransaction);
35
+ return (0, common_logic_1.combine)(serializedTransaction, transactionSignature, publicKey);
36
+ });
37
+ o.next({
38
+ type: "device-signature-granted",
39
+ });
40
+ // We create an optimistic operation here, the framework will then replace this transaction with the one returned by the indexer
41
+ const hash = "";
42
+ const operation = {
43
+ id: (0, operation_1.encodeOperationId)(account.id, hash, "OUT"),
44
+ hash,
45
+ accountId: account.id,
46
+ type: "OUT",
47
+ value: transaction.amount,
48
+ fee,
49
+ blockHash: null,
50
+ blockHeight: null,
51
+ senders: [account.freshAddress],
52
+ recipients: [transaction.recipient],
53
+ date: new Date(),
54
+ transactionSequenceNumber: new bignumber_js_1.default(nextSequenceNumber),
55
+ extra: {},
56
+ };
57
+ o.next({
58
+ type: "signed",
59
+ signedOperation: {
60
+ operation,
61
+ signature,
62
+ },
63
+ });
64
+ }
65
+ catch (e) {
66
+ if (e instanceof Error) {
67
+ throw new Error(e?.data?.resultMessage);
68
+ }
69
+ throw e;
70
+ }
71
+ }
72
+ main().then(() => o.complete(), e => o.error(e));
73
+ });
74
+ exports.buildSignOperation = buildSignOperation;
75
+ //# sourceMappingURL=signOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signOperation.js","sourceRoot":"","sources":["../../src/bridge/signOperation.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,3 @@
1
+ import { GetAccountShape } from "@ledgerhq/coin-framework/bridge/jsHelpers";
2
+ export declare const getAccountShape: GetAccountShape;
3
+ //# sourceMappingURL=sync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../src/bridge/sync.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAY,MAAM,2CAA2C,CAAC;AA4DtF,eAAO,MAAM,eAAe,EAAE,eA0C7B,CAAC"}
@@ -0,0 +1,86 @@
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.getAccountShape = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const index_1 = require("@ledgerhq/coin-framework/account/index");
9
+ const jsHelpers_1 = require("@ledgerhq/coin-framework/bridge/jsHelpers");
10
+ const operation_1 = require("@ledgerhq/coin-framework/operation");
11
+ const indexer_1 = require("../network/indexer");
12
+ const node_1 = require("../network/node");
13
+ const config_1 = __importDefault(require("../config"));
14
+ const operationAdapter = (accountId, address) => ({ meta: { delivered_amount }, tx: { Fee, hash, inLedger, date, Account, Destination, Sequence }, }) => {
15
+ const type = Account === address ? "OUT" : "IN";
16
+ let value = delivered_amount && typeof delivered_amount === "string"
17
+ ? new bignumber_js_1.default(delivered_amount)
18
+ : new bignumber_js_1.default(0);
19
+ const feeValue = new bignumber_js_1.default(Fee);
20
+ if (type === "OUT") {
21
+ if (!Number.isNaN(feeValue)) {
22
+ value = value.plus(feeValue);
23
+ }
24
+ }
25
+ const op = {
26
+ id: (0, operation_1.encodeOperationId)(accountId, hash, type),
27
+ hash: hash,
28
+ accountId,
29
+ type,
30
+ value,
31
+ fee: feeValue,
32
+ blockHash: null,
33
+ blockHeight: inLedger,
34
+ senders: [Account],
35
+ recipients: [Destination],
36
+ date: new Date(),
37
+ transactionSequenceNumber: new bignumber_js_1.default(Sequence),
38
+ extra: {},
39
+ };
40
+ return op;
41
+ };
42
+ const filterOperations = (transactions, accountId, address) => {
43
+ return transactions
44
+ .filter(({ tx, meta }) => tx.TransactionType === "Payment" && typeof meta.delivered_amount === "string")
45
+ .map(operationAdapter(accountId, address))
46
+ .filter((op) => Boolean(op));
47
+ };
48
+ const getAccountShape = async (info) => {
49
+ const { address, initialAccount, currency, derivationMode } = info;
50
+ const accountId = (0, index_1.encodeAccountId)({
51
+ type: "js",
52
+ version: "2",
53
+ currencyId: currency.id,
54
+ xpubOrAddress: address,
55
+ derivationMode,
56
+ });
57
+ // blockheight retrieval
58
+ const blockHeight = await (0, node_1.getBlockHeight)();
59
+ // Account info retrieval + spendable balance calculation
60
+ const accountInfo = await (0, node_1.getAccountInfo)(address);
61
+ const balance = new bignumber_js_1.default(accountInfo.account_data.Balance);
62
+ const reserveMin = config_1.default.getCoinConfig().minReserve;
63
+ const spendableBalance = new bignumber_js_1.default(accountInfo.account_data.Balance).minus(reserveMin);
64
+ // Tx history fetching
65
+ const oldOperations = initialAccount?.operations || [];
66
+ const startAt = oldOperations.length ? (oldOperations[0].blockHeight || 0) + 1 : 0;
67
+ const newTransactions = await (0, indexer_1.getTransactions)(address, {
68
+ from: startAt,
69
+ size: 100,
70
+ });
71
+ const newOperations = filterOperations(newTransactions, accountId, address);
72
+ const operations = (0, jsHelpers_1.mergeOps)(oldOperations, newOperations);
73
+ // We return the new account shape
74
+ const shape = {
75
+ id: accountId,
76
+ xpub: address,
77
+ blockHeight,
78
+ balance,
79
+ spendableBalance,
80
+ operations,
81
+ operationsCount: operations.length,
82
+ };
83
+ return shape;
84
+ };
85
+ exports.getAccountShape = getAccountShape;
86
+ //# sourceMappingURL=sync.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sync.js","sourceRoot":"","sources":["../../src/bridge/sync.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,15 @@
1
+ import type { Account } from "@ledgerhq/types-live";
2
+ import type { Transaction, TransactionRaw } from "../types";
3
+ export declare const formatTransaction: ({ amount, recipient, fee, useAllAmount }: Transaction, account: Account) => string;
4
+ export declare const fromTransactionRaw: (tr: TransactionRaw) => Transaction;
5
+ export declare const toTransactionRaw: (t: Transaction) => TransactionRaw;
6
+ declare const _default: {
7
+ formatTransaction: ({ amount, recipient, fee, useAllAmount }: Transaction, account: Account) => string;
8
+ fromTransactionRaw: (tr: TransactionRaw) => Transaction;
9
+ toTransactionRaw: (t: Transaction) => TransactionRaw;
10
+ fromTransactionStatusRaw: (ts: import("@ledgerhq/types-live").TransactionStatusCommonRaw) => import("@ledgerhq/types-live").TransactionStatusCommon;
11
+ toTransactionStatusRaw: (ts: import("@ledgerhq/types-live").TransactionStatusCommon) => import("@ledgerhq/types-live").TransactionStatusCommonRaw;
12
+ formatTransactionStatus: (t: import("@ledgerhq/types-live").TransactionCommon, { errors, warnings, estimatedFees, amount, totalSpent }: import("@ledgerhq/types-live").TransactionStatusCommon, mainAccount: Account) => string;
13
+ };
14
+ export default _default;
15
+ //# sourceMappingURL=transaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../src/bridge/transaction.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE5D,eAAO,MAAM,iBAAiB,6CACc,WAAW,WAC5C,OAAO,KACf,MAiBD,CAAC;AAEH,eAAO,MAAM,kBAAkB,OAAQ,cAAc,KAAG,WAOvD,CAAC;AAEF,eAAO,MAAM,gBAAgB,MAAO,WAAW,KAAG,cAOjD,CAAC;;kEArC0C,WAAW,WAC5C,OAAO,KACf,MAAM;6BAmB8B,cAAc,KAAG,WAAW;0BAS/B,WAAW,KAAG,cAAc;;;;;AAShE,wBAOE"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toTransactionRaw = exports.fromTransactionRaw = exports.formatTransaction = void 0;
4
+ const bignumber_js_1 = require("bignumber.js");
5
+ const formatters_1 = require("@ledgerhq/coin-framework/formatters");
6
+ const transaction_1 = require("@ledgerhq/coin-framework/serialization/transaction");
7
+ const index_1 = require("@ledgerhq/coin-framework/account/index");
8
+ const index_2 = require("@ledgerhq/coin-framework/currencies/index");
9
+ const formatTransaction = ({ amount, recipient, fee, useAllAmount }, account) => `
10
+ SEND ${useAllAmount
11
+ ? "MAX"
12
+ : (0, index_2.formatCurrencyUnit)((0, index_1.getAccountCurrency)(account).units[0], amount, {
13
+ showCode: true,
14
+ disableRounding: true,
15
+ })}
16
+ TO ${recipient}
17
+ with fee=${!fee
18
+ ? "?"
19
+ : (0, index_2.formatCurrencyUnit)((0, index_1.getAccountCurrency)(account).units[0], fee, {
20
+ showCode: true,
21
+ disableRounding: true,
22
+ })}`;
23
+ exports.formatTransaction = formatTransaction;
24
+ const fromTransactionRaw = (tr) => {
25
+ const common = (0, transaction_1.fromTransactionCommonRaw)(tr);
26
+ return {
27
+ ...common,
28
+ family: tr.family,
29
+ fee: tr.fee ? new bignumber_js_1.BigNumber(tr.fee) : null,
30
+ };
31
+ };
32
+ exports.fromTransactionRaw = fromTransactionRaw;
33
+ const toTransactionRaw = (t) => {
34
+ const common = (0, transaction_1.toTransactionCommonRaw)(t);
35
+ return {
36
+ ...common,
37
+ family: t.family,
38
+ fee: t.fee ? t.fee.toString() : null,
39
+ };
40
+ };
41
+ exports.toTransactionRaw = toTransactionRaw;
42
+ exports.default = {
43
+ formatTransaction: exports.formatTransaction,
44
+ fromTransactionRaw: exports.fromTransactionRaw,
45
+ toTransactionRaw: exports.toTransactionRaw,
46
+ fromTransactionStatusRaw: transaction_1.fromTransactionStatusRawCommon,
47
+ toTransactionStatusRaw: transaction_1.toTransactionStatusRawCommon,
48
+ formatTransactionStatus: formatters_1.formatTransactionStatus,
49
+ };
50
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/bridge/transaction.ts"],"names":[],"mappings":";;;AAAA,+CAAyC;AACzC,oEAA8E;AAC9E,oFAK4D;AAE5D,kEAA4E;AAC5E,qEAA+E;AAGxE,MAAM,iBAAiB,GAAG,CAC/B,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAe,EACrD,OAAgB,EACR,EAAE,CAAC;OAEX,YAAY;IACV,CAAC,CAAC,KAAK;IACP,CAAC,CAAC,IAAA,0BAAkB,EAAC,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE;QAC/D,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,IAAI;KACtB,CACP;KACK,SAAS;WAEZ,CAAC,GAAG;IACF,CAAC,CAAC,GAAG;IACL,CAAC,CAAC,IAAA,0BAAkB,EAAC,IAAA,0BAAkB,EAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE;QAC5D,QAAQ,EAAE,IAAI;QACd,eAAe,EAAE,IAAI;KACtB,CACP,EAAE,CAAC;AApBU,QAAA,iBAAiB,qBAoB3B;AAEI,MAAM,kBAAkB,GAAG,CAAC,EAAkB,EAAe,EAAE;IACpE,MAAM,MAAM,GAAG,IAAA,sCAAwB,EAAC,EAAE,CAAC,CAAC;IAC5C,OAAO;QACL,GAAG,MAAM;QACT,MAAM,EAAE,EAAE,CAAC,MAAM;QACjB,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,wBAAS,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI;KAC3C,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,kBAAkB,sBAO7B;AAEK,MAAM,gBAAgB,GAAG,CAAC,CAAc,EAAkB,EAAE;IACjE,MAAM,MAAM,GAAG,IAAA,oCAAsB,EAAC,CAAC,CAAC,CAAC;IACzC,OAAO;QACL,GAAG,MAAM;QACT,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,GAAG,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,IAAI;KACrC,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,gBAAgB,oBAO3B;AAEF,kBAAe;IACb,iBAAiB,EAAjB,yBAAiB;IACjB,kBAAkB,EAAlB,0BAAkB;IAClB,gBAAgB,EAAhB,wBAAgB;IAChB,wBAAwB,EAAxB,4CAAwB;IACxB,sBAAsB,EAAtB,0CAAsB;IACtB,uBAAuB,EAAvB,oCAAuB;CACxB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { AccountBridge } from "@ledgerhq/types-live";
2
+ import type { Transaction } from "../types";
3
+ export declare const updateTransaction: AccountBridge<Transaction>["updateTransaction"];
4
+ //# sourceMappingURL=updateTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateTransaction.d.ts","sourceRoot":"","sources":["../../src/bridge/updateTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAO5C,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,mBAAmB,CAO7E,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTransaction = void 0;
4
+ const jsHelpers_1 = require("@ledgerhq/coin-framework/bridge/jsHelpers");
5
+ // NOTE: this method is optional, use defaultUpdateTransaction
6
+ // acts as a middleware to update the transaction patch object
7
+ // NOTE: here is an example transaction updater function
8
+ // in this case, it resets fee to null depending on the patch content
9
+ const updateTransaction = (tx, patch) => {
10
+ // eslint-disable-next-line no-constant-condition
11
+ if (patch.recipient === "concordium1" || true) {
12
+ patch = { ...patch, fee: null };
13
+ }
14
+ return (0, jsHelpers_1.updateTransaction)(tx, patch);
15
+ };
16
+ exports.updateTransaction = updateTransaction;
17
+ //# sourceMappingURL=updateTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateTransaction.js","sourceRoot":"","sources":["../../src/bridge/updateTransaction.ts"],"names":[],"mappings":";;;AAAA,yEAA0G;AAI1G,8DAA8D;AAC9D,8DAA8D;AAE9D,wDAAwD;AACxD,qEAAqE;AAC9D,MAAM,iBAAiB,GAAoD,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;IAC9F,iDAAiD;IACjD,IAAI,KAAK,CAAC,SAAS,KAAK,aAAa,IAAI,IAAI,EAAE,CAAC;QAC9C,KAAK,GAAG,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAClC,CAAC;IAED,OAAO,IAAA,6BAAwB,EAAC,EAAE,EAAE,KAAK,CAAC,CAAC;AAC7C,CAAC,CAAC;AAPW,QAAA,iBAAiB,qBAO5B"}
@@ -0,0 +1,3 @@
1
+ import { Balance } from "@ledgerhq/coin-framework/api/types";
2
+ export declare function getBalance(address: string): Promise<Balance[]>;
3
+ //# sourceMappingURL=getBalance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBalance.d.ts","sourceRoot":"","sources":["../../../src/common-logic/account/getBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAI7D,wBAAsB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAGpE"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBalance = getBalance;
4
+ const node_1 = require("../../network/node");
5
+ // Could be getAccountInfo so it is used in both bridge and api
6
+ async function getBalance(address) {
7
+ const accountInfo = await (0, node_1.getAccountInfo)(address);
8
+ return [{ asset: { type: "native" }, value: BigInt(accountInfo.account_data.Balance) }];
9
+ }
10
+ //# sourceMappingURL=getBalance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBalance.js","sourceRoot":"","sources":["../../../src/common-logic/account/getBalance.ts"],"names":[],"mappings":";;AAIA,gCAGC;AAND,6CAAoD;AAEpD,+DAA+D;AACxD,KAAK,UAAU,UAAU,CAAC,OAAe;IAC9C,MAAM,WAAW,GAAG,MAAM,IAAA,qBAAc,EAAC,OAAO,CAAC,CAAC;IAClD,OAAO,CAAC,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getNextValidSequence(address: string): Promise<number>;
2
+ //# sourceMappingURL=getNextSequence.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNextSequence.d.ts","sourceRoot":"","sources":["../../../src/common-logic/account/getNextSequence.ts"],"names":[],"mappings":"AAGA,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE3E"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNextValidSequence = getNextValidSequence;
4
+ const node_1 = require("../../network/node");
5
+ // Could be getAccountInfo so it is used in both bridge and api
6
+ async function getNextValidSequence(address) {
7
+ return await (0, node_1.getNextSequence)(address);
8
+ }
9
+ //# sourceMappingURL=getNextSequence.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNextSequence.js","sourceRoot":"","sources":["../../../src/common-logic/account/getNextSequence.ts"],"names":[],"mappings":";;AAGA,oDAEC;AALD,6CAAqD;AAErD,+DAA+D;AACxD,KAAK,UAAU,oBAAoB,CAAC,OAAe;IACxD,OAAO,MAAM,IAAA,sBAAe,EAAC,OAAO,CAAC,CAAC;AACxC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { BigNumber } from "bignumber.js";
2
+ export declare const parseAPIValue: (value: string) => BigNumber;
3
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/common-logic/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAOzC,eAAO,MAAM,aAAa,UAAW,MAAM,KAAG,SAAqD,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAPIValue = void 0;
4
+ const currencies_1 = require("@ledgerhq/coin-framework/currencies");
5
+ const currencies_2 = require("@ledgerhq/cryptoassets/currencies");
6
+ // NOTE: replace ripple by your currency id, it should be found in
7
+ // libs/ledgerjs/packages/cryptoassets/src/currencies.ts
8
+ const concordiumUnit = (0, currencies_2.getCryptoCurrencyById)("ripple").units[0];
9
+ const parseAPIValue = (value) => (0, currencies_1.parseCurrencyUnit)(concordiumUnit, value);
10
+ exports.parseAPIValue = parseAPIValue;
11
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common-logic/common.ts"],"names":[],"mappings":";;;AACA,oEAAwE;AACxE,kEAA0E;AAE1E,kEAAkE;AAClE,wDAAwD;AACxD,MAAM,cAAc,GAAG,IAAA,kCAAqB,EAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzD,MAAM,aAAa,GAAG,CAAC,KAAa,EAAa,EAAE,CAAC,IAAA,8BAAiB,EAAC,cAAc,EAAE,KAAK,CAAC,CAAC;AAAvF,QAAA,aAAa,iBAA0E"}
@@ -0,0 +1,3 @@
1
+ import type { BlockInfo } from "@ledgerhq/coin-framework/api/index";
2
+ export declare function lastBlock(): Promise<BlockInfo>;
3
+ //# sourceMappingURL=lastBlock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lastBlock.d.ts","sourceRoot":"","sources":["../../../src/common-logic/history/lastBlock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAGpE,wBAAsB,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,CAOpD"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.lastBlock = lastBlock;
4
+ const node_1 = require("../../network/node");
5
+ async function lastBlock() {
6
+ const result = await (0, node_1.getLastBlock)();
7
+ return {
8
+ height: result.blockHeight,
9
+ hash: result.blockHash,
10
+ time: new Date(result.timestamp),
11
+ };
12
+ }
13
+ //# sourceMappingURL=lastBlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lastBlock.js","sourceRoot":"","sources":["../../../src/common-logic/history/lastBlock.ts"],"names":[],"mappings":";;AAGA,8BAOC;AATD,6CAAkD;AAE3C,KAAK,UAAU,SAAS;IAC7B,MAAM,MAAM,GAAG,MAAM,IAAA,mBAAY,GAAE,CAAC;IACpC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,WAAW;QAC1B,IAAI,EAAE,MAAM,CAAC,SAAS;QACtB,IAAI,EAAE,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC;KACjC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Operation, Pagination } from "@ledgerhq/coin-framework/api/index";
2
+ /**
3
+ * Returns list of operations associated to an account.
4
+ * @param address Account address
5
+ * @param pagination Pagination options
6
+ * @returns Operations found and the next "id" or "index" to use for pagination (i.e. `start` property).\
7
+ * If `0` is returns, no pagination needed.
8
+ * This "id" or "index" value, thus it has functional meaning, is different for each blockchain.
9
+ */
10
+ export declare function listOperations(address: string, page: Pagination): Promise<[Operation[], string]>;
11
+ //# sourceMappingURL=listOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listOperations.d.ts","sourceRoot":"","sources":["../../../src/common-logic/history/listOperations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAIhF;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,UAAU,GACf,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE,MAAM,CAAC,CAAC,CAGhC"}
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listOperations = listOperations;
4
+ const indexer_1 = require("../../network/indexer");
5
+ /**
6
+ * Returns list of operations associated to an account.
7
+ * @param address Account address
8
+ * @param pagination Pagination options
9
+ * @returns Operations found and the next "id" or "index" to use for pagination (i.e. `start` property).\
10
+ * If `0` is returns, no pagination needed.
11
+ * This "id" or "index" value, thus it has functional meaning, is different for each blockchain.
12
+ */
13
+ async function listOperations(address, page) {
14
+ const transactions = await (0, indexer_1.getTransactions)(address, { from: page.minHeight });
15
+ return [transactions.map(convertToCoreOperation(address)), ""];
16
+ }
17
+ const convertToCoreOperation = (address) => (operation) => {
18
+ const { meta: { delivered_amount }, tx: { Fee, hash, inLedger, date, Account, Destination }, } = operation;
19
+ const type = Account === address ? "OUT" : "IN";
20
+ let value = delivered_amount && typeof delivered_amount === "string"
21
+ ? BigInt(delivered_amount)
22
+ : BigInt(0);
23
+ const feeValue = BigInt(Fee);
24
+ if (type === "OUT") {
25
+ if (!Number.isNaN(feeValue)) {
26
+ value = value + feeValue;
27
+ }
28
+ }
29
+ return {
30
+ /**
31
+ * Note: The operation ID must be concatenated with another
32
+ * value if the transaction hash is not enough to identify it
33
+ */
34
+ id: hash,
35
+ asset: { type: "native" },
36
+ tx: {
37
+ hash,
38
+ fees: feeValue,
39
+ date: new Date(date),
40
+ failed: false,
41
+ block: {
42
+ height: inLedger,
43
+ hash,
44
+ time: new Date(date),
45
+ },
46
+ },
47
+ type,
48
+ value,
49
+ senders: [Account],
50
+ recipients: [Destination],
51
+ };
52
+ };
53
+ //# sourceMappingURL=listOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listOperations.js","sourceRoot":"","sources":["../../../src/common-logic/history/listOperations.ts"],"names":[],"mappings":";;AAYA,wCAMC;AAjBD,mDAAwD;AAGxD;;;;;;;GAOG;AACI,KAAK,UAAU,cAAc,CAClC,OAAe,EACf,IAAgB;IAEhB,MAAM,YAAY,GAAG,MAAM,IAAA,yBAAe,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IAC9E,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,sBAAsB,GAC1B,CAAC,OAAe,EAAE,EAAE,CACpB,CAAC,SAA8B,EAAa,EAAE;IAC5C,MAAM,EACJ,IAAI,EAAE,EAAE,gBAAgB,EAAE,EAC1B,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,EAAE,GACxD,GAAG,SAAS,CAAC;IAEd,MAAM,IAAI,GAAG,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAChD,IAAI,KAAK,GACP,gBAAgB,IAAI,OAAO,gBAAgB,KAAK,QAAQ;QACtD,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC;QAC1B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAEhB,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5B,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,OAAO;QACL;;;WAGG;QACH,EAAE,EAAE,IAAI;QACR,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,EAAE,EAAE;YACF,IAAI;YACJ,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC;YACpB,MAAM,EAAE,KAAK;YACb,KAAK,EAAE;gBACL,MAAM,EAAE,QAAQ;gBAChB,IAAI;gBACJ,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC;aACrB;SACF;QACD,IAAI;QACJ,KAAK;QACL,OAAO,EAAE,CAAC,OAAO,CAAC;QAClB,UAAU,EAAE,CAAC,WAAW,CAAC;KAC1B,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ export { broadcast } from "./transaction/broadcast";
2
+ export { combine } from "./transaction/combine";
3
+ export { craftTransaction } from "./transaction/craftTransaction";
4
+ export { estimateFees } from "./transaction/estimateFees";
5
+ export { getBalance } from "./account/getBalance";
6
+ export { lastBlock } from "./history/lastBlock";
7
+ export { listOperations } from "./history/listOperations";
8
+ export { isRecipientValid } from "./utils";
9
+ export { getNextValidSequence } from "./account/getNextSequence";
10
+ export { parseAPIValue } from "./common";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/common-logic/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseAPIValue = exports.getNextValidSequence = exports.isRecipientValid = exports.listOperations = exports.lastBlock = exports.getBalance = exports.estimateFees = exports.craftTransaction = exports.combine = exports.broadcast = void 0;
4
+ var broadcast_1 = require("./transaction/broadcast");
5
+ Object.defineProperty(exports, "broadcast", { enumerable: true, get: function () { return broadcast_1.broadcast; } });
6
+ var combine_1 = require("./transaction/combine");
7
+ Object.defineProperty(exports, "combine", { enumerable: true, get: function () { return combine_1.combine; } });
8
+ var craftTransaction_1 = require("./transaction/craftTransaction");
9
+ Object.defineProperty(exports, "craftTransaction", { enumerable: true, get: function () { return craftTransaction_1.craftTransaction; } });
10
+ var estimateFees_1 = require("./transaction/estimateFees");
11
+ Object.defineProperty(exports, "estimateFees", { enumerable: true, get: function () { return estimateFees_1.estimateFees; } });
12
+ var getBalance_1 = require("./account/getBalance");
13
+ Object.defineProperty(exports, "getBalance", { enumerable: true, get: function () { return getBalance_1.getBalance; } });
14
+ var lastBlock_1 = require("./history/lastBlock");
15
+ Object.defineProperty(exports, "lastBlock", { enumerable: true, get: function () { return lastBlock_1.lastBlock; } });
16
+ var listOperations_1 = require("./history/listOperations");
17
+ Object.defineProperty(exports, "listOperations", { enumerable: true, get: function () { return listOperations_1.listOperations; } });
18
+ var utils_1 = require("./utils");
19
+ Object.defineProperty(exports, "isRecipientValid", { enumerable: true, get: function () { return utils_1.isRecipientValid; } });
20
+ var getNextSequence_1 = require("./account/getNextSequence");
21
+ Object.defineProperty(exports, "getNextValidSequence", { enumerable: true, get: function () { return getNextSequence_1.getNextValidSequence; } });
22
+ var common_1 = require("./common");
23
+ Object.defineProperty(exports, "parseAPIValue", { enumerable: true, get: function () { return common_1.parseAPIValue; } });
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/common-logic/index.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAA3C,sGAAA,SAAS,OAAA;AAClB,iDAAgD;AAAvC,kGAAA,OAAO,OAAA;AAChB,mEAAkE;AAAzD,oHAAA,gBAAgB,OAAA;AACzB,2DAA0D;AAAjD,4GAAA,YAAY,OAAA;AACrB,mDAAkD;AAAzC,wGAAA,UAAU,OAAA;AACnB,iDAAgD;AAAvC,sGAAA,SAAS,OAAA;AAClB,2DAA0D;AAAjD,gHAAA,cAAc,OAAA;AACvB,iCAA2C;AAAlC,yGAAA,gBAAgB,OAAA;AACzB,6DAAiE;AAAxD,uHAAA,oBAAoB,OAAA;AAE7B,mCAAyC;AAAhC,uGAAA,aAAa,OAAA"}
@@ -0,0 +1,2 @@
1
+ export declare function broadcast(signedTx: string): Promise<string>;
2
+ //# sourceMappingURL=broadcast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/broadcast.ts"],"names":[],"mappings":"AAEA,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAGjE"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.broadcast = broadcast;
4
+ const node_1 = require("../../network/node");
5
+ async function broadcast(signedTx) {
6
+ const submittedPayment = await (0, node_1.submit)(signedTx);
7
+ return submittedPayment.tx_hash;
8
+ }
9
+ //# sourceMappingURL=broadcast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/broadcast.ts"],"names":[],"mappings":";;AAEA,8BAGC;AALD,6CAA4C;AAErC,KAAK,UAAU,SAAS,CAAC,QAAgB;IAC9C,MAAM,gBAAgB,GAAG,MAAM,IAAA,aAAM,EAAC,QAAQ,CAAC,CAAC;IAChD,OAAO,gBAAgB,CAAC,OAAO,CAAC;AAClC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function combine(transaction: string, signature: string, publicKey?: string): string;
2
+ //# sourceMappingURL=combine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combine.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/combine.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAE1F"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.combine = combine;
4
+ const utils_1 = require("../utils");
5
+ // Combines signature with raw transaction
6
+ function combine(transaction, signature, publicKey) {
7
+ return (0, utils_1.encode)(transaction, signature, publicKey || "");
8
+ }
9
+ //# sourceMappingURL=combine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"combine.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/combine.ts"],"names":[],"mappings":";;AAGA,0BAEC;AALD,oCAAkC;AAElC,0CAA0C;AAC1C,SAAgB,OAAO,CAAC,WAAmB,EAAE,SAAiB,EAAE,SAAkB;IAChF,OAAO,IAAA,cAAM,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;AACzD,CAAC"}
@@ -0,0 +1,15 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { ConcordiumNativeTransaction } from "../../types";
3
+ export declare function craftTransaction(account: {
4
+ address: string;
5
+ nextSequenceNumber?: number;
6
+ publicKey?: string;
7
+ }, transaction: {
8
+ recipient?: string;
9
+ amount: BigNumber;
10
+ fee?: BigNumber;
11
+ }): Promise<{
12
+ nativeTransaction: ConcordiumNativeTransaction;
13
+ serializedTransaction: string;
14
+ }>;
15
+ //# sourceMappingURL=craftTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"craftTransaction.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/craftTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAI1D,wBAAsB,gBAAgB,CACpC,OAAO,EAAE;IACP,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,EACD,WAAW,EAAE;IACX,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB,GACA,OAAO,CAAC;IACT,iBAAiB,EAAE,2BAA2B,CAAC;IAC/C,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC,CAgBD"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.craftTransaction = craftTransaction;
4
+ const encodeNativeTx = (nativeTx) => JSON.stringify(nativeTx);
5
+ async function craftTransaction(account, transaction) {
6
+ const nativeTransaction = {
7
+ TransactionType: "Payment",
8
+ Account: account.address,
9
+ Amount: transaction.amount.toString(),
10
+ Destination: transaction.recipient || "",
11
+ Fee: transaction.fee?.toString() || "0",
12
+ Sequence: account.nextSequenceNumber || 0,
13
+ };
14
+ const serializedTransaction = encodeNativeTx(nativeTransaction);
15
+ return {
16
+ nativeTransaction,
17
+ serializedTransaction,
18
+ };
19
+ }
20
+ //# sourceMappingURL=craftTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"craftTransaction.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/craftTransaction.ts"],"names":[],"mappings":";;AAKA,4CA8BC;AAhCD,MAAM,cAAc,GAAG,CAAC,QAAqC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEpF,KAAK,UAAU,gBAAgB,CACpC,OAIC,EACD,WAIC;IAKD,MAAM,iBAAiB,GAAgC;QACrD,eAAe,EAAE,SAAS;QAC1B,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,QAAQ,EAAE;QACrC,WAAW,EAAE,WAAW,CAAC,SAAS,IAAI,EAAE;QACxC,GAAG,EAAE,WAAW,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG;QACvC,QAAQ,EAAE,OAAO,CAAC,kBAAkB,IAAI,CAAC;KAC1C,CAAC;IAEF,MAAM,qBAAqB,GAAG,cAAc,CAAC,iBAAiB,CAAC,CAAC;IAEhE,OAAO;QACL,iBAAiB;QACjB,qBAAqB;KACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function estimateFees(serializedTransaction: string): Promise<bigint>;
2
+ //# sourceMappingURL=estimateFees.d.ts.map