@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,2 @@
1
+ PUB_KEY = "XPUB"
2
+ SECRET_KEY = "SECRET"
package/.eslintrc.js ADDED
@@ -0,0 +1,37 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es6: true,
5
+ },
6
+ extends: ["plugin:import/typescript"],
7
+ plugins: ["import"],
8
+ overrides: [
9
+ {
10
+ files: ["src/**/*.test.{ts,tsx}"],
11
+ env: {
12
+ "jest/globals": true,
13
+ },
14
+ plugins: ["jest"],
15
+ rules: {
16
+ "jest/no-restricted-matchers": [
17
+ "error",
18
+ {
19
+ toBeFalsy: null,
20
+ toBeTruthy: null,
21
+ toBeDefined: null,
22
+ },
23
+ ],
24
+ },
25
+ },
26
+ ],
27
+ rules: {
28
+ eqeqeq: ["error"],
29
+ "no-console": ["error", { allow: ["warn", "error"] }],
30
+ "@typescript-eslint/no-empty-function": "off",
31
+ "no-empty-pattern": "off",
32
+ "@typescript-eslint/no-explicit-any": "warn",
33
+ "@typescript-eslint/no-unused-vars": "warn",
34
+ "import/no-cycle": ["error"],
35
+ "import/order": ["error"],
36
+ },
37
+ };
@@ -0,0 +1,4 @@
1
+
2
+ > @ledgerhq/coin-concordium@0.1.0 build /home/runner/work/ledger-live/ledger-live/libs/coin-modules/coin-concordium
3
+ > tsc && tsc -m esnext --moduleResolution bundler --outDir lib-es
4
+
@@ -0,0 +1,29 @@
1
+ {
2
+ "entry": [
3
+ "src/api/index.ts",
4
+ "src/bridge/index.ts",
5
+ "src/bridge/deviceTransactionConfig.ts",
6
+ "src/signer/index.ts",
7
+ "src/test/index.ts",
8
+ "src/index.ts"
9
+ ],
10
+ "ignorePatterns": [
11
+ "**/node_modules/**",
12
+ "**/*.fixture.ts",
13
+ "**/*.mock.ts",
14
+ "**/*.test.{js,jsx,ts,tsx}"
15
+ ],
16
+ "ignoreUnresolved": [
17
+ "jest-get-type",
18
+ "jest-matcher-utils",
19
+ "jest-message-util"
20
+ ],
21
+ "ignoreUnimported": [
22
+ "src/network/mock-network.ts",
23
+ "src/test/bot-specs.ts",
24
+ "src/types/assets.ts"
25
+ ],
26
+ "ignoreUnused": [
27
+ "@ledgerhq/devices"
28
+ ]
29
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,18 @@
1
+ # @ledgerhq/coin-concordium
2
+
3
+ ## 0.2.0-nightly.20251209140356
4
+
5
+ ### Minor Changes
6
+
7
+ - [#13167](https://github.com/LedgerHQ/ledger-live/pull/13167) [`e44d216`](https://github.com/LedgerHQ/ledger-live/commit/e44d216d516df87e13f033ed64fedc1ce96380f4) Thanks [@lysyi3m](https://github.com/lysyi3m)! - Concordium module init
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [[`50aeea1`](https://github.com/LedgerHQ/ledger-live/commit/50aeea1233056e9abff9568eb928927f39e76cff), [`fd031d7`](https://github.com/LedgerHQ/ledger-live/commit/fd031d77ca7ed011ec492700fd4d7bc86c518907), [`480a08a`](https://github.com/LedgerHQ/ledger-live/commit/480a08ae190119829910b46ecc6d2a9fb11bb7c2), [`19a54fd`](https://github.com/LedgerHQ/ledger-live/commit/19a54fd89a2d3c7481aebc28817870875f9d44dc), [`a2ecb55`](https://github.com/LedgerHQ/ledger-live/commit/a2ecb55df9d383dc282f5fe489cb14386208215e), [`7ae71b6`](https://github.com/LedgerHQ/ledger-live/commit/7ae71b64161424b398b63f77da5127085143fcdc), [`5fa83e4`](https://github.com/LedgerHQ/ledger-live/commit/5fa83e49c5fb103da7ecf0777b7e75bb35d5ed61), [`c5da2ce`](https://github.com/LedgerHQ/ledger-live/commit/c5da2cef7cded2b53c1af9aa3174cd27e5c92e0a), [`fe81926`](https://github.com/LedgerHQ/ledger-live/commit/fe81926afeb2df8e917e6bd1e4cbab13f09647fd), [`67137eb`](https://github.com/LedgerHQ/ledger-live/commit/67137eb5d7f04dd5f3610fdaa4e463d292654105), [`49ef24c`](https://github.com/LedgerHQ/ledger-live/commit/49ef24cbd1948bfd146af0b20f2128951b2dc170), [`30be235`](https://github.com/LedgerHQ/ledger-live/commit/30be2354822b3497c69322294ff1dab43375be50), [`bdacedf`](https://github.com/LedgerHQ/ledger-live/commit/bdacedfe32bea8ffce96ab675a44c0d7cf395143), [`b4a4e16`](https://github.com/LedgerHQ/ledger-live/commit/b4a4e160aae6fd64f944ab25633f6931dc4358d3), [`927ae64`](https://github.com/LedgerHQ/ledger-live/commit/927ae64db0bb04af54e25623655a001a68e0f2d3), [`903ea9c`](https://github.com/LedgerHQ/ledger-live/commit/903ea9cdacf704a0119de2803a4f409b775391a5), [`768718d`](https://github.com/LedgerHQ/ledger-live/commit/768718df029bc8799b88c0299925dc56302b0c53), [`9251b77`](https://github.com/LedgerHQ/ledger-live/commit/9251b77fcb01709723842f19220a2a41a6fc8f3b), [`a5ad7d4`](https://github.com/LedgerHQ/ledger-live/commit/a5ad7d4578c06db3e40f260451b644c27e20cb62), [`02ef98f`](https://github.com/LedgerHQ/ledger-live/commit/02ef98faeb13c182ef255e06a43c39abeb55ecc7), [`3e70677`](https://github.com/LedgerHQ/ledger-live/commit/3e706774f8c4e9b768ab18b67abc3471cf61b6b6), [`6d0c6b2`](https://github.com/LedgerHQ/ledger-live/commit/6d0c6b2eda60049d8eebda5de2c54e8f0be7d009), [`aadb3d5`](https://github.com/LedgerHQ/ledger-live/commit/aadb3d57f5719cc2cc397975eafec8094b160afe), [`e44d216`](https://github.com/LedgerHQ/ledger-live/commit/e44d216d516df87e13f033ed64fedc1ce96380f4), [`d4bad44`](https://github.com/LedgerHQ/ledger-live/commit/d4bad4433c3fb083d95820d2927a9e8beeaf244f), [`8d8e1b7`](https://github.com/LedgerHQ/ledger-live/commit/8d8e1b7bb26305af326ea21710248223d1e8653b), [`38d5880`](https://github.com/LedgerHQ/ledger-live/commit/38d5880ca6c3cc8808182e9d0f046b204914d34a), [`0d33751`](https://github.com/LedgerHQ/ledger-live/commit/0d33751bb2ae599d0d26ce6a8efdbe01757f12fb), [`07de7a8`](https://github.com/LedgerHQ/ledger-live/commit/07de7a87415ae4d1126e751d6a4d521ced3065e3), [`d37fa4b`](https://github.com/LedgerHQ/ledger-live/commit/d37fa4baf4534161bffe5033ce44fc7780c79d89), [`5e0556a`](https://github.com/LedgerHQ/ledger-live/commit/5e0556a3bd0ea60277462eed10c997b17b09d299), [`aadcec6`](https://github.com/LedgerHQ/ledger-live/commit/aadcec66847b800f79452ba1df09149e0a1cb9e8), [`bce6610`](https://github.com/LedgerHQ/ledger-live/commit/bce6610ca8554a85f8f17b6014e921fdecd3fa4f), [`2a60165`](https://github.com/LedgerHQ/ledger-live/commit/2a601656b7a23a424a29f006ec53090648fdae4f), [`b113920`](https://github.com/LedgerHQ/ledger-live/commit/b11392056bc334fc1813c473569ad3ae7be08045), [`ed8532b`](https://github.com/LedgerHQ/ledger-live/commit/ed8532bad754ca2b5f1788c6e92f4646b775ec79), [`88a5018`](https://github.com/LedgerHQ/ledger-live/commit/88a501871d58c980f18495b5b32012a3eaa9ab2c), [`c56ab86`](https://github.com/LedgerHQ/ledger-live/commit/c56ab86ab65597caf87a09b7596faa54f3104bd4), [`9659a34`](https://github.com/LedgerHQ/ledger-live/commit/9659a34d9998d5c4dff8618bf6cef7d16403680d)]:
12
+ - @ledgerhq/cryptoassets@13.34.0-nightly.20251209140356
13
+ - @ledgerhq/types-live@6.90.0-nightly.20251209140356
14
+ - @ledgerhq/coin-framework@6.10.0-nightly.20251209140356
15
+ - @ledgerhq/live-env@2.22.0-nightly.20251209140356
16
+ - @ledgerhq/errors@6.28.0-nightly.20251209140356
17
+ - @ledgerhq/devices@8.8.0-nightly.20251209140356
18
+ - @ledgerhq/live-network@2.1.2-nightly.20251209140356
package/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2017-present Ledger https://www.ledger.com/
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/jest.config.js ADDED
@@ -0,0 +1,21 @@
1
+ /** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
2
+ // `workerThreads: true` is required for validating object with `bigint` values
3
+ module.exports = {
4
+ preset: "ts-jest",
5
+ testEnvironment: "node",
6
+ passWithNoTests: true,
7
+ setupFilesAfterEnv: ["@ledgerhq/disable-network-setup"],
8
+ collectCoverageFrom: [
9
+ "src/**/*.ts",
10
+ "!src/**/*.test.ts",
11
+ "!src/**/*.spec.ts",
12
+ "!src/test/**/*.ts",
13
+ ],
14
+ coverageReporters: ["json", ["lcov", { file: "lcov.info", projectRoot: "../../../" }], "text"],
15
+ testPathIgnorePatterns: ["lib/", "lib-es/", ".*\\.integ\\.test\\.[tj]s"],
16
+ workerThreads: true,
17
+ reporters: [
18
+ "default",
19
+ ["jest-sonar", { outputName: "sonar-executionTests-report.xml", reportedFilePath: "absolute" }],
20
+ ],
21
+ };
@@ -0,0 +1,8 @@
1
+ /** @type {import('ts-jest/dist/types').JestConfigWithTsJest} */
2
+ module.exports = {
3
+ preset: "ts-jest",
4
+ testEnvironment: "node",
5
+ testRegex: ".integ.test.ts$",
6
+ testPathIgnorePatterns: ["lib/", "lib-es/"],
7
+ setupFiles: ["dotenv/config"],
8
+ };
@@ -0,0 +1,4 @@
1
+ import { AlpacaApi } from "@ledgerhq/coin-framework/api/index";
2
+ import { type ConcordiumConfig } from "../config";
3
+ export declare function createApi(config: ConcordiumConfig): AlpacaApi;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAWV,MAAM,oCAAoC,CAAC;AAE5C,OAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAY9D,wBAAgB,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAmC7D"}
@@ -0,0 +1,56 @@
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.createApi = createApi;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const config_1 = __importDefault(require("../config"));
9
+ const common_logic_1 = require("../common-logic");
10
+ function createApi(config) {
11
+ config_1.default.setCoinConfig(() => ({ ...config, status: { type: "active" } }));
12
+ return {
13
+ broadcast: common_logic_1.broadcast,
14
+ combine: common_logic_1.combine,
15
+ craftTransaction: craft,
16
+ craftRawTransaction: (_transaction, _sender, _publicKey, _sequence) => {
17
+ throw new Error("craftRawTransaction is not supported");
18
+ },
19
+ estimateFees: estimate,
20
+ getBalance: common_logic_1.getBalance,
21
+ lastBlock: common_logic_1.lastBlock,
22
+ listOperations: common_logic_1.listOperations,
23
+ getBlock(_height) {
24
+ throw new Error("getBlock is not supported");
25
+ },
26
+ getBlockInfo(_height) {
27
+ throw new Error("getBlockInfo is not supported");
28
+ },
29
+ getStakes(_address, _cursor) {
30
+ throw new Error("getStakes is not supported");
31
+ },
32
+ getRewards(_address, _cursor) {
33
+ throw new Error("getRewards is not supported");
34
+ },
35
+ getValidators(_cursor) {
36
+ throw new Error("getValidators is not supported");
37
+ },
38
+ };
39
+ }
40
+ async function craft(transactionIntent) {
41
+ const nextSequenceNumber = await (0, common_logic_1.getNextValidSequence)(transactionIntent.sender);
42
+ const tx = await (0, common_logic_1.craftTransaction)({ address: transactionIntent.sender, nextSequenceNumber }, {
43
+ recipient: transactionIntent.recipient,
44
+ amount: new bignumber_js_1.default(transactionIntent.amount.toString()),
45
+ });
46
+ return { transaction: tx.serializedTransaction };
47
+ }
48
+ async function estimate(transactionIntent) {
49
+ const { serializedTransaction } = await (0, common_logic_1.craftTransaction)({ address: transactionIntent.sender }, {
50
+ recipient: transactionIntent.recipient,
51
+ amount: new bignumber_js_1.default(transactionIntent.amount.toString()),
52
+ });
53
+ const value = await (0, common_logic_1.estimateFees)(serializedTransaction);
54
+ return { value };
55
+ }
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;;;AA0BA,8BAmCC;AAhDD,gEAAqC;AACrC,uDAA8D;AAC9D,kDASyB;AAEzB,SAAgB,SAAS,CAAC,MAAwB;IAChD,gBAAU,CAAC,aAAa,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;IAE5E,OAAO;QACL,SAAS,EAAT,wBAAS;QACT,OAAO,EAAP,sBAAO;QACP,gBAAgB,EAAE,KAAK;QACvB,mBAAmB,EAAE,CACnB,YAAoB,EACpB,OAAe,EACf,UAAkB,EAClB,SAAiB,EACY,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QACD,YAAY,EAAE,QAAQ;QACtB,UAAU,EAAV,yBAAU;QACV,SAAS,EAAT,wBAAS;QACT,cAAc,EAAd,6BAAc;QACd,QAAQ,CAAC,OAAO;YACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QACD,YAAY,CAAC,OAAe;YAC1B,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;QACnD,CAAC;QACD,SAAS,CAAC,QAAgB,EAAE,OAAgB;YAC1C,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,UAAU,CAAC,QAAgB,EAAE,OAAgB;YAC3C,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QACjD,CAAC;QACD,aAAa,CAAC,OAAgB;YAC5B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,KAAK,CAAC,iBAAoC;IACvD,MAAM,kBAAkB,GAAG,MAAM,IAAA,mCAAoB,EAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChF,MAAM,EAAE,GAAG,MAAM,IAAA,+BAAgB,EAC/B,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,EAAE,EACzD;QACE,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,MAAM,EAAE,IAAI,sBAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KAC3D,CACF,CAAC;IACF,OAAO,EAAE,WAAW,EAAE,EAAE,CAAC,qBAAqB,EAAE,CAAC;AACnD,CAAC;AAED,KAAK,UAAU,QAAQ,CAAC,iBAAoC;IAC1D,MAAM,EAAE,qBAAqB,EAAE,GAAG,MAAM,IAAA,+BAAgB,EACtD,EAAE,OAAO,EAAE,iBAAiB,CAAC,MAAM,EAAE,EACrC;QACE,SAAS,EAAE,iBAAiB,CAAC,SAAS;QACtC,MAAM,EAAE,IAAI,sBAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;KAC3D,CACF,CAAC;IAEF,MAAM,KAAK,GAAG,MAAM,IAAA,2BAAY,EAAC,qBAAqB,CAAC,CAAC;IAExD,OAAO,EAAE,KAAK,EAAE,CAAC;AACnB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { AccountBridge } from "@ledgerhq/types-live";
2
+ import { Transaction } from "../types";
3
+ export declare const broadcast: AccountBridge<Transaction>["broadcast"];
4
+ //# sourceMappingURL=broadcast.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcast.d.ts","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,SAAS,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,WAAW,CAK7D,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.broadcast = void 0;
4
+ const operation_1 = require("@ledgerhq/coin-framework/operation");
5
+ const common_logic_1 = require("../common-logic");
6
+ const broadcast = async ({ signedOperation: { signature, operation }, }) => {
7
+ const hash = await (0, common_logic_1.broadcast)(signature);
8
+ return (0, operation_1.patchOperationWithHash)(operation, hash);
9
+ };
10
+ exports.broadcast = broadcast;
11
+ //# sourceMappingURL=broadcast.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../src/bridge/broadcast.ts"],"names":[],"mappings":";;;AACA,kEAA4E;AAC5E,kDAA8D;AAGvD,MAAM,SAAS,GAA4C,KAAK,EAAE,EACvE,eAAe,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAC1C,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,MAAM,IAAA,wBAAc,EAAC,SAAS,CAAC,CAAC;IAC7C,OAAO,IAAA,kCAAsB,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;AACjD,CAAC,CAAC;AALW,QAAA,SAAS,aAKpB"}
@@ -0,0 +1,4 @@
1
+ import { AccountBridge } from "@ledgerhq/types-live";
2
+ import { Transaction } from "../types";
3
+ export declare const createTransaction: AccountBridge<Transaction>["createTransaction"];
4
+ //# sourceMappingURL=createTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../../src/bridge/createTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAGvC,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,mBAAmB,CAQ5E,CAAC"}
@@ -0,0 +1,19 @@
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.createTransaction = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ // We create an empty transaction that will be filled later
9
+ const createTransaction = () => ({
10
+ family: "concordium",
11
+ amount: new bignumber_js_1.default(0),
12
+ recipient: "",
13
+ fee: null,
14
+ memo: undefined,
15
+ networkInfo: null,
16
+ feeCustomUnit: null,
17
+ });
18
+ exports.createTransaction = createTransaction;
19
+ //# sourceMappingURL=createTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../../src/bridge/createTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAIrC,2DAA2D;AACpD,MAAM,iBAAiB,GAAoD,GAAG,EAAE,CAAC,CAAC;IACvF,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,EAAE;IACb,GAAG,EAAE,IAAI;IACT,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC;AARU,QAAA,iBAAiB,qBAQ3B"}
@@ -0,0 +1,11 @@
1
+ import type { AccountLike, Account } from "@ledgerhq/types-live";
2
+ import type { CommonDeviceTransactionField } from "@ledgerhq/coin-framework/transaction/common";
3
+ import type { Transaction, TransactionStatus } from "../types";
4
+ declare function getDeviceTransactionConfig({ transaction: {}, status: { amount, estimatedFees }, }: {
5
+ account: AccountLike;
6
+ parentAccount: Account | null | undefined;
7
+ transaction: Transaction;
8
+ status: TransactionStatus;
9
+ }): Promise<Array<CommonDeviceTransactionField>>;
10
+ export default getDeviceTransactionConfig;
11
+ //# sourceMappingURL=deviceTransactionConfig.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceTransactionConfig.d.ts","sourceRoot":"","sources":["../../src/bridge/deviceTransactionConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAChG,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAG/D,iBAAe,0BAA0B,CAAC,EACxC,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,GAClC,EAAE;IACD,OAAO,EAAE,WAAW,CAAC;IACrB,aAAa,EAAE,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;IAC1C,WAAW,EAAE,WAAW,CAAC;IACzB,MAAM,EAAE,iBAAiB,CAAC;CAC3B,GAAG,OAAO,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,CAkB/C;AAED,eAAe,0BAA0B,CAAC"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // This method adds additional fields that need to be reviewed when signing a transaction on the device.
4
+ async function getDeviceTransactionConfig({ transaction: {}, status: { amount, estimatedFees }, }) {
5
+ const fields = [];
6
+ if (!amount.isZero()) {
7
+ fields.push({
8
+ type: "amount",
9
+ label: "Amount",
10
+ });
11
+ }
12
+ if (!estimatedFees.isZero()) {
13
+ fields.push({
14
+ type: "fees",
15
+ label: "Fees",
16
+ });
17
+ }
18
+ return fields;
19
+ }
20
+ exports.default = getDeviceTransactionConfig;
21
+ //# sourceMappingURL=deviceTransactionConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deviceTransactionConfig.js","sourceRoot":"","sources":["../../src/bridge/deviceTransactionConfig.ts"],"names":[],"mappings":";;AAIA,wGAAwG;AACxG,KAAK,UAAU,0BAA0B,CAAC,EACxC,WAAW,EAAE,EAAE,EACf,MAAM,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,GAMlC;IACC,MAAM,MAAM,GAAwC,EAAE,CAAC;IAEvD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC;QACrB,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,EAAE,CAAC;QAC5B,MAAM,CAAC,IAAI,CAAC;YACV,IAAI,EAAE,MAAM;YACZ,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,0BAA0B,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { AccountBridge } from "@ledgerhq/types-live";
2
+ import { Transaction } from "../types";
3
+ export declare const estimateMaxSpendable: AccountBridge<Transaction>["estimateMaxSpendable"];
4
+ //# sourceMappingURL=estimateMaxSpendable.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateMaxSpendable.d.ts","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKvC,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,sBAAsB,CAenF,CAAC"}
@@ -0,0 +1,26 @@
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.estimateMaxSpendable = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const index_1 = require("@ledgerhq/coin-framework/account/index");
9
+ const abandonseed_1 = require("@ledgerhq/cryptoassets/abandonseed");
10
+ const getTransactionStatus_1 = require("./getTransactionStatus");
11
+ const prepareTransaction_1 = require("./prepareTransaction");
12
+ const createTransaction_1 = require("./createTransaction");
13
+ const estimateMaxSpendable = async ({ account, parentAccount, transaction, }) => {
14
+ const mainAccount = (0, index_1.getMainAccount)(account, parentAccount);
15
+ const newTransaction = await (0, prepareTransaction_1.prepareTransaction)(mainAccount, {
16
+ ...(0, createTransaction_1.createTransaction)(account),
17
+ ...transaction,
18
+ // fee estimation might require a recipient to work, in that case, we use a dummy one
19
+ recipient: transaction?.recipient || (0, abandonseed_1.getAbandonSeedAddress)("concordium"),
20
+ amount: new bignumber_js_1.default(0),
21
+ });
22
+ const status = await (0, getTransactionStatus_1.getTransactionStatus)(mainAccount, newTransaction);
23
+ return bignumber_js_1.default.max(0, account.spendableBalance.minus(status.estimatedFees));
24
+ };
25
+ exports.estimateMaxSpendable = estimateMaxSpendable;
26
+ //# sourceMappingURL=estimateMaxSpendable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../../src/bridge/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAErC,kEAAwE;AACxE,oEAA2E;AAE3E,iEAA8D;AAC9D,6DAA0D;AAC1D,2DAAwD;AAEjD,MAAM,oBAAoB,GAAuD,KAAK,EAAE,EAC7F,OAAO,EACP,aAAa,EACb,WAAW,GACZ,EAAE,EAAE;IACH,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,MAAM,IAAA,uCAAkB,EAAC,WAAW,EAAE;QAC3D,GAAG,IAAA,qCAAiB,EAAC,OAAO,CAAC;QAC7B,GAAG,WAAW;QACd,qFAAqF;QACrF,SAAS,EAAE,WAAW,EAAE,SAAS,IAAI,IAAA,mCAAqB,EAAC,YAAY,CAAC;QACxE,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;KACzB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,IAAA,2CAAoB,EAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACvE,OAAO,sBAAS,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC;AAfW,QAAA,oBAAoB,wBAe/B"}
@@ -0,0 +1,4 @@
1
+ import { Account, AccountBridge } from "@ledgerhq/types-live";
2
+ import { Transaction, TransactionStatus } from "../types";
3
+ export declare const getTransactionStatus: AccountBridge<Transaction, Account, TransactionStatus>["getTransactionStatus"];
4
+ //# sourceMappingURL=getTransactionStatus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI1D,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAC9C,WAAW,EACX,OAAO,EACP,iBAAiB,CAClB,CAAC,sBAAsB,CAiEvB,CAAC"}
@@ -0,0 +1,78 @@
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.getTransactionStatus = void 0;
7
+ const errors_1 = require("@ledgerhq/errors");
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
+ const index_1 = require("@ledgerhq/coin-framework/currencies/index");
10
+ const utils_1 = require("../common-logic/utils");
11
+ const config_1 = __importDefault(require("../config"));
12
+ const getTransactionStatus = async (account, transaction) => {
13
+ const errors = {};
14
+ const warnings = {};
15
+ // reserveAmount is the minimum amount of currency that an account must hold in order to stay activated
16
+ const reserveAmount = new bignumber_js_1.default(config_1.default.getCoinConfig().minReserve);
17
+ const estimatedFees = new bignumber_js_1.default(transaction.fee || 0);
18
+ const totalSpent = new bignumber_js_1.default(transaction.amount).plus(estimatedFees);
19
+ const amount = new bignumber_js_1.default(transaction.amount);
20
+ if (amount.gt(0) && estimatedFees.times(10).gt(amount)) {
21
+ // if the fee is more than 10 times the amount, we warn the user that fee is high compared to what he is sending
22
+ warnings.feeTooHigh = new errors_1.FeeTooHigh();
23
+ }
24
+ if (!transaction.fee) {
25
+ // if the fee is not loaded, we can't do much
26
+ errors.fee = new errors_1.FeeNotLoaded();
27
+ }
28
+ else if (transaction.fee.eq(0)) {
29
+ // On some chains, 0 fee could still work so this is optional
30
+ errors.fee = new errors_1.FeeRequired();
31
+ }
32
+ else if (totalSpent.gt(account.balance.minus(reserveAmount))) {
33
+ // if the total spent is greater than the balance minus the reserve amount, tx is invalid
34
+ errors.amount = new errors_1.NotEnoughSpendableBalance("", {
35
+ minimumAmount: (0, index_1.formatCurrencyUnit)(account.currency.units[0], reserveAmount, {
36
+ disableRounding: true,
37
+ useGrouping: false,
38
+ showCode: true,
39
+ }),
40
+ });
41
+ }
42
+ else if (transaction.recipient && transaction.amount.lt(reserveAmount)) {
43
+ // if we send an amount lower than reserve amount AND target account is new, we need to warn the user that the target account will not be activated
44
+ errors.amount = new errors_1.NotEnoughBalanceBecauseDestinationNotCreated("", {
45
+ minimalAmount: (0, index_1.formatCurrencyUnit)(account.currency.units[0], reserveAmount, {
46
+ disableRounding: true,
47
+ useGrouping: false,
48
+ showCode: true,
49
+ }),
50
+ });
51
+ }
52
+ if (!transaction.recipient) {
53
+ errors.recipient = new errors_1.RecipientRequired("");
54
+ }
55
+ else if (account.freshAddress === transaction.recipient) {
56
+ // we want to prevent user from sending to themselves (even if it's technically feasible)
57
+ errors.recipient = new errors_1.InvalidAddressBecauseDestinationIsAlsoSource();
58
+ }
59
+ else if (!(0, utils_1.isRecipientValid)(transaction.recipient)) {
60
+ // We want to prevent user from sending to an invalid address
61
+ errors.recipient = new errors_1.InvalidAddress("", {
62
+ currencyName: account.currency.name,
63
+ });
64
+ }
65
+ if (!errors.amount && amount.eq(0)) {
66
+ // if the amount is 0, we prevent the user from sending the tx (even if it's technically feasible)
67
+ errors.amount = new errors_1.AmountRequired();
68
+ }
69
+ return {
70
+ errors,
71
+ warnings,
72
+ estimatedFees,
73
+ amount,
74
+ totalSpent,
75
+ };
76
+ };
77
+ exports.getTransactionStatus = getTransactionStatus;
78
+ //# sourceMappingURL=getTransactionStatus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../../src/bridge/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;AAAA,6CAU0B;AAC1B,gEAAqC;AAErC,qEAA+E;AAE/E,iDAAyD;AACzD,uDAAmC;AAE5B,MAAM,oBAAoB,GAIL,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,EAAE;IACzD,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAE3C,uGAAuG;IACvG,MAAM,aAAa,GAAG,IAAI,sBAAS,CAAC,gBAAU,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC,CAAC;IAC3E,MAAM,aAAa,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAEjD,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,gHAAgH;QAChH,QAAQ,CAAC,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;QACrB,6CAA6C;QAC7C,MAAM,CAAC,GAAG,GAAG,IAAI,qBAAY,EAAE,CAAC;IAClC,CAAC;SAAM,IAAI,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,6DAA6D;QAC7D,MAAM,CAAC,GAAG,GAAG,IAAI,oBAAW,EAAE,CAAC;IACjC,CAAC;SAAM,IAAI,UAAU,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QAC/D,yFAAyF;QACzF,MAAM,CAAC,MAAM,GAAG,IAAI,kCAAyB,CAAC,EAAE,EAAE;YAChD,aAAa,EAAE,IAAA,0BAAkB,EAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE;gBAC1E,eAAe,EAAE,IAAI;gBACrB,WAAW,EAAE,KAAK;gBAClB,QAAQ,EAAE,IAAI;aACf,CAAC;SACH,CAAC,CAAC;IACL,CAAC;SAAM,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC;QACzE,mJAAmJ;QACnJ,MAAM,CAAC,MAAM,GAAG,IAAI,qDAA4C,CAAC,EAAE,EAAE;YACnE,aAAa,EAAE,IAAA,0BAAkB,EAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE;gBAC1E,eAAe,EAAE,IAAI;gBACrB,WAAW,EAAE,KAAK;gBAClB,QAAQ,EAAE,IAAI;aACf,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC;QAC3B,MAAM,CAAC,SAAS,GAAG,IAAI,0BAAiB,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;SAAM,IAAI,OAAO,CAAC,YAAY,KAAK,WAAW,CAAC,SAAS,EAAE,CAAC;QAC1D,yFAAyF;QACzF,MAAM,CAAC,SAAS,GAAG,IAAI,qDAA4C,EAAE,CAAC;IACxE,CAAC;SAAM,IAAI,CAAC,IAAA,wBAAgB,EAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,6DAA6D;QAC7D,MAAM,CAAC,SAAS,GAAG,IAAI,uBAAc,CAAC,EAAE,EAAE;YACxC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;SACpC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,kGAAkG;QAClG,MAAM,CAAC,MAAM,GAAG,IAAI,uBAAc,EAAE,CAAC;IACvC,CAAC;IAED,OAAO;QACL,MAAM;QACN,QAAQ;QACR,aAAa;QACb,MAAM;QACN,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AArEW,QAAA,oBAAoB,wBAqE/B"}
@@ -0,0 +1,11 @@
1
+ import { CoinConfig } from "@ledgerhq/coin-framework/config";
2
+ import { SignerContext } from "@ledgerhq/coin-framework/signer";
3
+ import type { AccountBridge, CurrencyBridge } from "@ledgerhq/types-live";
4
+ import { type ConcordiumCoinConfig } from "../config";
5
+ import { ConcordiumSigner } from "../types";
6
+ import type { Transaction } from "../types";
7
+ export declare function createBridges(signerContext: SignerContext<ConcordiumSigner>, coinConfig: CoinConfig<ConcordiumCoinConfig>): {
8
+ currencyBridge: CurrencyBridge;
9
+ accountBridge: AccountBridge<Transaction>;
10
+ };
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAA6B,EAAE,KAAK,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAE5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAU5C,wBAAgB,aAAa,CAC3B,aAAa,EAAE,aAAa,CAAC,gBAAgB,CAAC,EAC9C,UAAU,EAAE,UAAU,CAAC,oBAAoB,CAAC;;;EAuC7C"}
@@ -0,0 +1,54 @@
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.createBridges = createBridges;
7
+ const getAddressWrapper_1 = __importDefault(require("@ledgerhq/coin-framework/bridge/getAddressWrapper"));
8
+ const jsHelpers_1 = require("@ledgerhq/coin-framework/bridge/jsHelpers");
9
+ const config_1 = __importDefault(require("../config"));
10
+ const signer_1 = __importDefault(require("../signer"));
11
+ const broadcast_1 = require("./broadcast");
12
+ const createTransaction_1 = require("./createTransaction");
13
+ const estimateMaxSpendable_1 = require("./estimateMaxSpendable");
14
+ const getTransactionStatus_1 = require("./getTransactionStatus");
15
+ const prepareTransaction_1 = require("./prepareTransaction");
16
+ const signOperation_1 = require("./signOperation");
17
+ const sync_1 = require("./sync");
18
+ const updateTransaction_1 = require("./updateTransaction");
19
+ function createBridges(signerContext, coinConfig) {
20
+ config_1.default.setCoinConfig(coinConfig);
21
+ const getAddress = (0, signer_1.default)(signerContext);
22
+ const receive = (0, jsHelpers_1.makeAccountBridgeReceive)((0, getAddressWrapper_1.default)(getAddress));
23
+ const scanAccounts = (0, jsHelpers_1.makeScanAccounts)({ getAccountShape: sync_1.getAccountShape, getAddressFn: getAddress });
24
+ const currencyBridge = {
25
+ preload: () => Promise.resolve({}),
26
+ hydrate: () => { },
27
+ scanAccounts,
28
+ };
29
+ const signOperation = (0, signOperation_1.buildSignOperation)(signerContext);
30
+ const sync = (0, jsHelpers_1.makeSync)({ getAccountShape: sync_1.getAccountShape });
31
+ // we want one method per file
32
+ const accountBridge = {
33
+ broadcast: broadcast_1.broadcast,
34
+ createTransaction: createTransaction_1.createTransaction,
35
+ updateTransaction: updateTransaction_1.updateTransaction,
36
+ // NOTE: use updateTransaction: defaultUpdateTransaction<Transaction>,
37
+ // if you don't need to update the transaction patch object
38
+ prepareTransaction: prepareTransaction_1.prepareTransaction,
39
+ getTransactionStatus: getTransactionStatus_1.getTransactionStatus,
40
+ estimateMaxSpendable: estimateMaxSpendable_1.estimateMaxSpendable,
41
+ sync,
42
+ receive,
43
+ signOperation,
44
+ signRawOperation: () => {
45
+ throw new Error("signRawOperation is not supported");
46
+ },
47
+ getSerializedAddressParameters: jsHelpers_1.getSerializedAddressParameters,
48
+ };
49
+ return {
50
+ currencyBridge,
51
+ accountBridge,
52
+ };
53
+ }
54
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/bridge/index.ts"],"names":[],"mappings":";;;;;AAuBA,sCAyCC;AAhED,0GAAkF;AAClF,yEAKmD;AAInD,uDAA4E;AAC5E,uDAAiC;AAGjC,2CAAwC;AACxC,2DAAwD;AACxD,iEAA8D;AAC9D,iEAA8D;AAC9D,6DAA0D;AAC1D,mDAAqD;AACrD,iCAAyC;AACzC,2DAAwD;AAExD,SAAgB,aAAa,CAC3B,aAA8C,EAC9C,UAA4C;IAE5C,gBAAoB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAE/C,MAAM,UAAU,GAAG,IAAA,gBAAQ,EAAC,aAAa,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAA,oCAAwB,EAAC,IAAA,2BAAiB,EAAC,UAAU,CAAC,CAAC,CAAC;IAExE,MAAM,YAAY,GAAG,IAAA,4BAAgB,EAAC,EAAE,eAAe,EAAf,sBAAe,EAAE,YAAY,EAAE,UAAU,EAAE,CAAC,CAAC;IACrF,MAAM,cAAc,GAAmB;QACrC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE,GAAE,CAAC;QACjB,YAAY;KACb,CAAC;IAEF,MAAM,aAAa,GAAG,IAAA,kCAAkB,EAAC,aAAa,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,IAAA,oBAAQ,EAAC,EAAE,eAAe,EAAf,sBAAe,EAAE,CAAC,CAAC;IAC3C,8BAA8B;IAC9B,MAAM,aAAa,GAA+B;QAChD,SAAS,EAAT,qBAAS;QACT,iBAAiB,EAAjB,qCAAiB;QACjB,iBAAiB,EAAjB,qCAAiB;QACjB,sEAAsE;QACtE,2DAA2D;QAC3D,kBAAkB,EAAlB,uCAAkB;QAClB,oBAAoB,EAApB,2CAAoB;QACpB,oBAAoB,EAApB,2CAAoB;QACpB,IAAI;QACJ,OAAO;QACP,aAAa;QACb,gBAAgB,EAAE,GAAG,EAAE;YACrB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;QACvD,CAAC;QACD,8BAA8B,EAA9B,0CAA8B;KAC/B,CAAC;IAEF,OAAO;QACL,cAAc;QACd,aAAa;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { AccountBridge } from "@ledgerhq/types-live";
2
+ import { Transaction } from "../types";
3
+ export declare const prepareTransaction: AccountBridge<Transaction>["prepareTransaction"];
4
+ //# sourceMappingURL=prepareTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIvC,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,oBAAoB,CAkB/E,CAAC"}
@@ -0,0 +1,20 @@
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.prepareTransaction = void 0;
7
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
8
+ const common_logic_1 = require("../common-logic");
9
+ const node_1 = require("../network/node");
10
+ const prepareTransaction = async (account, transaction) => {
11
+ const seq = await (0, node_1.getNextSequence)(account.freshAddress);
12
+ const craftedTransaction = await (0, common_logic_1.craftTransaction)({ address: account.freshAddress, nextSequenceNumber: seq }, { amount: transaction.amount, recipient: transaction.recipient });
13
+ const fee = await (0, common_logic_1.estimateFees)(craftedTransaction.serializedTransaction);
14
+ if (transaction.fee !== new bignumber_js_1.default(fee.toString())) {
15
+ return { ...transaction, fee: new bignumber_js_1.default(fee.toString()) };
16
+ }
17
+ return transaction;
18
+ };
19
+ exports.prepareTransaction = prepareTransaction;
20
+ //# sourceMappingURL=prepareTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareTransaction.js","sourceRoot":"","sources":["../../src/bridge/prepareTransaction.ts"],"names":[],"mappings":";;;;;;AACA,gEAAqC;AAErC,kDAAiE;AACjE,0CAAkD;AAE3C,MAAM,kBAAkB,GAAqD,KAAK,EACvF,OAAO,EACP,WAAW,EACX,EAAE;IACF,MAAM,GAAG,GAAG,MAAM,IAAA,sBAAe,EAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAExD,MAAM,kBAAkB,GAAG,MAAM,IAAA,+BAAgB,EAC/C,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,EAAE,EAC1D,EAAE,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,EAAE,WAAW,CAAC,SAAS,EAAE,CACjE,CAAC;IAEF,MAAM,GAAG,GAAG,MAAM,IAAA,2BAAY,EAAC,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;IAEzE,IAAI,WAAW,CAAC,GAAG,KAAK,IAAI,sBAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;QACtD,OAAO,EAAE,GAAG,WAAW,EAAE,GAAG,EAAE,IAAI,sBAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;IAChE,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAlBW,QAAA,kBAAkB,sBAkB7B"}
@@ -0,0 +1,5 @@
1
+ import { AccountBridge } from "@ledgerhq/types-live";
2
+ import { SignerContext } from "@ledgerhq/coin-framework/signer";
3
+ import { Transaction, ConcordiumSigner } from "../types";
4
+ export declare const buildSignOperation: (signerContext: SignerContext<ConcordiumSigner>) => AccountBridge<Transaction>["signOperation"];
5
+ //# sourceMappingURL=signOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signOperation.d.ts","sourceRoot":"","sources":["../../src/bridge/signOperation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAa,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAIhE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAA+B,MAAM,UAAU,CAAC;AAEtF,eAAO,MAAM,kBAAkB,kBACb,aAAa,CAAC,gBAAgB,CAAC,KAAG,aAAa,CAAC,WAAW,CAAC,CAAC,eAAe,CAmFxF,CAAC"}