@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 @@
1
+ {"version":3,"file":"estimateFees.d.ts","sourceRoot":"","sources":["../../../src/common-logic/transaction/estimateFees.ts"],"names":[],"mappings":"AAGA,wBAAsB,YAAY,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYjF"}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.estimateFees = estimateFees;
4
+ const node_1 = require("../../network/node");
5
+ const errors_1 = require("../../types/errors");
6
+ async function estimateFees(serializedTransaction) {
7
+ try {
8
+ // We call the node to do a dry run and estimate fees
9
+ return BigInt(await (0, node_1.simulate)(serializedTransaction));
10
+ }
11
+ catch (e) {
12
+ // default value is required in case of simulation error, else user will encounter an error in the flow
13
+ if (e instanceof errors_1.SimulationError) {
14
+ return BigInt(1000);
15
+ }
16
+ else {
17
+ throw new Error("Unexpected error while estimating fees.");
18
+ }
19
+ }
20
+ }
21
+ //# sourceMappingURL=estimateFees.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"estimateFees.js","sourceRoot":"","sources":["../../../src/common-logic/transaction/estimateFees.ts"],"names":[],"mappings":";;AAGA,oCAYC;AAfD,6CAA8C;AAC9C,+CAAqD;AAE9C,KAAK,UAAU,YAAY,CAAC,qBAA6B;IAC9D,IAAI,CAAC;QACH,qDAAqD;QACrD,OAAO,MAAM,CAAC,MAAM,IAAA,eAAQ,EAAC,qBAAqB,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,uGAAuG;QACvG,IAAI,CAAC,YAAY,wBAAe,EAAE,CAAC;YACjC,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import BigNumber from "bignumber.js";
2
+ export declare const UINT32_MAX: BigNumber;
3
+ export declare const validateTag: (tag: BigNumber) => boolean;
4
+ export declare function isRecipientValid(recipient: string): boolean;
5
+ export declare const encode: (transaction: string, signature: string, publicKey?: string) => string;
6
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/common-logic/utils.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,eAAO,MAAM,UAAU,WAAoC,CAAC;AAE5D,eAAO,MAAM,WAAW,QAAS,SAAS,YAIzC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED,eAAO,MAAM,MAAM,gBAAiB,MAAM,aAAa,MAAM,cAAc,MAAM,WAGhF,CAAC"}
@@ -0,0 +1,22 @@
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.encode = exports.validateTag = exports.UINT32_MAX = void 0;
7
+ exports.isRecipientValid = isRecipientValid;
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
+ exports.UINT32_MAX = new bignumber_js_1.default(2).pow(32).minus(1);
10
+ const validateTag = (tag) => {
11
+ return (!tag.isNaN() && tag.isFinite() && tag.isInteger() && tag.isPositive() && tag.lte(exports.UINT32_MAX));
12
+ };
13
+ exports.validateTag = validateTag;
14
+ function isRecipientValid(recipient) {
15
+ return recipient.length > 0;
16
+ }
17
+ const encode = (transaction, signature, publicKey) => {
18
+ // sample encoding
19
+ return `${transaction}${publicKey}${signature}encodedTx`;
20
+ };
21
+ exports.encode = encode;
22
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/common-logic/utils.ts"],"names":[],"mappings":";;;;;;AAUA,4CAEC;AAZD,gEAAqC;AAExB,QAAA,UAAU,GAAG,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAErD,MAAM,WAAW,GAAG,CAAC,GAAc,EAAE,EAAE;IAC5C,OAAO,CACL,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,EAAE,IAAI,GAAG,CAAC,SAAS,EAAE,IAAI,GAAG,CAAC,UAAU,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,kBAAU,CAAC,CAC7F,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,WAAW,eAItB;AAEF,SAAgB,gBAAgB,CAAC,SAAiB;IAChD,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC;AAC9B,CAAC;AAEM,MAAM,MAAM,GAAG,CAAC,WAAmB,EAAE,SAAiB,EAAE,SAAkB,EAAE,EAAE;IACnF,kBAAkB;IAClB,OAAO,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,WAAW,CAAC;AAC3D,CAAC,CAAC;AAHW,QAAA,MAAM,UAGjB"}
@@ -0,0 +1,12 @@
1
+ import { type CurrencyConfig } from "@ledgerhq/coin-framework/config";
2
+ export type ConcordiumConfig = {
3
+ nodeUrl: string;
4
+ minReserve: number;
5
+ };
6
+ export type ConcordiumCoinConfig = CurrencyConfig & ConcordiumConfig;
7
+ declare const coinConfig: {
8
+ setCoinConfig: (config: import("@ledgerhq/coin-framework/config").CoinConfig<ConcordiumCoinConfig>) => void;
9
+ getCoinConfig: (currency?: import("@ledgerhq/types-cryptoassets").CryptoCurrency) => ConcordiumCoinConfig;
10
+ };
11
+ export default coinConfig;
12
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAwB,EAAE,KAAK,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEvF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAErE,QAAA,MAAM,UAAU;;;CAA0C,CAAC;AAE3D,eAAe,UAAU,CAAC"}
package/lib/config.js ADDED
@@ -0,0 +1,9 @@
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
+ const config_1 = __importDefault(require("@ledgerhq/coin-framework/config"));
7
+ const coinConfig = (0, config_1.default)();
8
+ exports.default = coinConfig;
9
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;AAAA,6EAAuF;AASvF,MAAM,UAAU,GAAG,IAAA,gBAAe,GAAwB,CAAC;AAE3D,kBAAe,UAAU,CAAC"}
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./types";
2
+ export { createBridges } from "./bridge/index";
3
+ export type { ConcordiumCoinConfig } from "./config";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,YAAY,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC"}
package/lib/index.js ADDED
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createBridges = void 0;
18
+ __exportStar(require("./types"), exports);
19
+ var index_1 = require("./bridge/index");
20
+ Object.defineProperty(exports, "createBridges", { enumerable: true, get: function () { return index_1.createBridges; } });
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,0CAAwB;AAExB,wCAA+C;AAAtC,sGAAA,aAAa,OAAA"}
@@ -0,0 +1,6 @@
1
+ import { AccountTxResponse } from "./types";
2
+ export declare const getTransactions: (address: string, params: {
3
+ from: number;
4
+ size?: number;
5
+ }) => Promise<AccountTxResponse["transactions"]>;
6
+ //# sourceMappingURL=indexer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexer.d.ts","sourceRoot":"","sources":["../../src/network/indexer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,eAAe,YACjB,MAAM,UACP;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,KACtC,OAAO,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAS3C,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.getTransactions = void 0;
7
+ const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
8
+ const live_env_1 = require("@ledgerhq/live-env");
9
+ const getTransactions = async (address, params) => {
10
+ const { data } = await (0, network_1.default)({
11
+ // NOTE: add INDEXER_BOILERPLATE to libs/env/src/env.ts
12
+ // @ts-expect-error: add INDEXER_BOILERPLATE to libs/env/src/env.ts
13
+ url: `${(0, live_env_1.getEnv)("INDEXER_BOILERPLATE")}/account/${address}/transactions`,
14
+ method: "GET",
15
+ });
16
+ return data.transactions;
17
+ };
18
+ exports.getTransactions = getTransactions;
19
+ //# sourceMappingURL=indexer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"indexer.js","sourceRoot":"","sources":["../../src/network/indexer.ts"],"names":[],"mappings":";;;;;;AAAA,6EAAqD;AACrD,iDAA4C;AAGrC,MAAM,eAAe,GAAG,KAAK,EAClC,OAAe,EACf,MAAuC,EACK,EAAE;IAC9C,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,iBAAO,EAAoB;QAChD,uDAAuD;QACvD,mEAAmE;QACnE,GAAG,EAAE,GAAG,IAAA,iBAAM,EAAC,qBAAqB,CAAC,YAAY,OAAO,eAAe;QACvE,MAAM,EAAE,KAAK;KACd,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC,YAAY,CAAC;AAC3B,CAAC,CAAC;AAZW,QAAA,eAAe,mBAY1B"}
@@ -0,0 +1,5 @@
1
+ export declare const network: (params: {
2
+ url: string;
3
+ method: "GET" | "POST";
4
+ }) => void;
5
+ //# sourceMappingURL=mock-network.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-network.d.ts","sourceRoot":"","sources":["../../src/network/mock-network.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,OAAO,WAAY;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAA;CAAE,SAatE,CAAC"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ /*
3
+
4
+ In a real use case you should use live-network library like this :
5
+
6
+ import network from "@ledgerhq/live-network/network";
7
+
8
+
9
+ instead of this mocked method
10
+
11
+ */
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.network = void 0;
14
+ const network = (params) => {
15
+ switch (true) {
16
+ case params.url.includes("simulate"):
17
+ break;
18
+ case params.url.includes("submit"):
19
+ break;
20
+ case params.url.includes("account_info"):
21
+ break;
22
+ case params.url.includes("transactions"):
23
+ break;
24
+ default:
25
+ throw new Error("Mock network 404");
26
+ }
27
+ };
28
+ exports.network = network;
29
+ //# sourceMappingURL=mock-network.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-network.js","sourceRoot":"","sources":["../../src/network/mock-network.ts"],"names":[],"mappings":";AAAA;;;;;;;;;EASE;;;AAEK,MAAM,OAAO,GAAG,CAAC,MAA+C,EAAE,EAAE;IACzE,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,UAAU,CAAC;YAClC,MAAM;QACR,KAAK,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAChC,MAAM;QACR,KAAK,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC;YACtC,MAAM;QACR,KAAK,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,cAAc,CAAC;YACtC,MAAM;QACR;YACE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;IACxC,CAAC;AACH,CAAC,CAAC;AAbW,QAAA,OAAO,WAalB"}
@@ -0,0 +1,12 @@
1
+ import { AccountInfoResponse, SubmitReponse } from "./types";
2
+ export declare const simulate: (serializedTx: string) => Promise<number>;
3
+ export declare const getNextSequence: (address: string) => Promise<number>;
4
+ export declare const getBlockHeight: () => Promise<number>;
5
+ export declare const getLastBlock: () => Promise<{
6
+ blockHeight: number;
7
+ blockHash: string;
8
+ timestamp: number;
9
+ }>;
10
+ export declare const submit: (signedTx: string) => Promise<SubmitReponse>;
11
+ export declare const getAccountInfo: (address: string) => Promise<AccountInfoResponse>;
12
+ //# sourceMappingURL=node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/network/node.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAO7D,eAAO,MAAM,QAAQ,iBAAwB,MAAM,KAAG,OAAO,CAAC,MAAM,CAcnE,CAAC;AAGF,eAAO,MAAM,eAAe,YAAmB,MAAM,KAAG,OAAO,CAAC,MAAM,CAYrE,CAAC;AAEF,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,MAAM,CAQrD,CAAC;AAEF,eAAO,MAAM,YAAY,QAAa,OAAO,CAAC;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAQA,CAAC;AAEF,eAAO,MAAM,MAAM,aAAoB,MAAM,KAAG,OAAO,CAAC,aAAa,CAQpE,CAAC;AAEF,eAAO,MAAM,cAAc,YAAmB,MAAM,KAAG,OAAO,CAAC,mBAAmB,CAiBjF,CAAC"}
@@ -0,0 +1,92 @@
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.getAccountInfo = exports.submit = exports.getLastBlock = exports.getBlockHeight = exports.getNextSequence = exports.simulate = void 0;
7
+ const network_1 = __importDefault(require("@ledgerhq/live-network/network"));
8
+ const live_env_1 = require("@ledgerhq/live-env");
9
+ const errors_1 = require("../types/errors");
10
+ const config_1 = __importDefault(require("../config"));
11
+ const getNodeUrl = () => config_1.default.getCoinConfig().nodeUrl;
12
+ // NOTE: add NODE_BOILERPLATE to libs/env/src/env.ts
13
+ // txPayload needs to be unsigned
14
+ const simulate = async (serializedTx) => {
15
+ // @ts-expect-error: add NODE_BOILERPLATE to libs/env/src/env.ts
16
+ const url = `${(0, live_env_1.getEnv)("NODE_BOILERPLATE")}/simulate`;
17
+ const { data } = await (0, network_1.default)({
18
+ url,
19
+ method: "POST",
20
+ data: {
21
+ txPayload: serializedTx,
22
+ },
23
+ });
24
+ if (data.error) {
25
+ throw new errors_1.SimulationError();
26
+ }
27
+ return data.fees;
28
+ };
29
+ exports.simulate = simulate;
30
+ // can be called nonce or sequence
31
+ const getNextSequence = async (address) => {
32
+ // @ts-expect-error: add NODE_BOILERPLATE to libs/env/src/env.ts
33
+ const url = `${(0, live_env_1.getEnv)("NODE_BOILERPLATE")}/${address}/sequence`;
34
+ try {
35
+ const { data } = await (0, network_1.default)({
36
+ url,
37
+ method: "GET",
38
+ });
39
+ return data.sequence;
40
+ }
41
+ catch (e) {
42
+ return 0;
43
+ }
44
+ };
45
+ exports.getNextSequence = getNextSequence;
46
+ const getBlockHeight = async () => {
47
+ // @ts-expect-error: add NODE_BOILERPLATE to libs/env/src/env.ts
48
+ const url = `${(0, live_env_1.getEnv)("NODE_BOILERPLATE")}/blockheight`;
49
+ const { data } = await (0, network_1.default)({
50
+ url,
51
+ method: "GET",
52
+ });
53
+ return data.blockHeight;
54
+ };
55
+ exports.getBlockHeight = getBlockHeight;
56
+ const getLastBlock = async () => {
57
+ // @ts-expect-error: add NODE_BOILERPLATE to libs/env/src/env.ts
58
+ const url = `${(0, live_env_1.getEnv)("NODE_BOILERPLATE")}/block/current`;
59
+ const { data } = await (0, network_1.default)({
60
+ url,
61
+ method: "GET",
62
+ });
63
+ return data;
64
+ };
65
+ exports.getLastBlock = getLastBlock;
66
+ const submit = async (signedTx) => {
67
+ // @ts-expect-error: add NODE_BOILERPLATE to libs/env/src/env.ts
68
+ const url = `${(0, live_env_1.getEnv)("NODE_BOILERPLATE")}/submit`;
69
+ const { data } = await (0, network_1.default)({
70
+ url,
71
+ method: "GET",
72
+ });
73
+ return data;
74
+ };
75
+ exports.submit = submit;
76
+ const getAccountInfo = async (address) => {
77
+ const { data: { result }, } = await (0, network_1.default)({
78
+ method: "POST",
79
+ url: getNodeUrl(),
80
+ data: {
81
+ method: "account_info",
82
+ params: [
83
+ {
84
+ account: address,
85
+ },
86
+ ],
87
+ },
88
+ });
89
+ return result;
90
+ };
91
+ exports.getAccountInfo = getAccountInfo;
92
+ //# sourceMappingURL=node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/network/node.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,47 @@
1
+ export type ConcordiumOperation = {
2
+ meta: {
3
+ delivered_amount: string;
4
+ };
5
+ tx: {
6
+ Account: string;
7
+ Amount: string;
8
+ Destination: string;
9
+ Fee: string;
10
+ Memo: string;
11
+ Sequence: number;
12
+ SigningPubKey: string;
13
+ TransactionType: string;
14
+ TxnSignature: string;
15
+ date: number;
16
+ hash: string;
17
+ inLedger: number;
18
+ };
19
+ validated: boolean;
20
+ };
21
+ export type ResponseStatus = {
22
+ status: string;
23
+ error?: never;
24
+ } | {
25
+ status?: never;
26
+ error: string;
27
+ };
28
+ export declare function isResponseStatus(obj: object): obj is ResponseStatus;
29
+ export type NewAccount = "NewAccount";
30
+ export type AccountInfoResponse = {
31
+ account_data: {
32
+ Account: string;
33
+ Balance: string;
34
+ };
35
+ ledger_hash: string;
36
+ ledger_index: number;
37
+ validated: boolean;
38
+ } & ResponseStatus;
39
+ export type SubmitReponse = {
40
+ accepted: boolean;
41
+ tx_hash: string;
42
+ };
43
+ export type AccountTxResponse = {
44
+ account: string;
45
+ transactions: ConcordiumOperation[];
46
+ } & ResponseStatus;
47
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/network/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE;QACJ,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,EAAE,EAAE;QACF,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,GAAG,EAAE,MAAM,CAAC;QACZ,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,aAAa,EAAE,MAAM,CAAC;QACtB,eAAe,EAAE,MAAM,CAAC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,cAAc,GACtB;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CAAE,GACjC;IACE,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACN,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,IAAI,cAAc,CAEnE;AAED,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC;AACtC,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,OAAO,CAAC;CACpB,GAAG,cAAc,CAAC;AAEnB,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,mBAAmB,EAAE,CAAC;CACrC,GAAG,cAAc,CAAC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isResponseStatus = isResponseStatus;
4
+ function isResponseStatus(obj) {
5
+ return "status" in obj || "error" in obj;
6
+ }
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/network/types.ts"],"names":[],"mappings":";;AA2BA,4CAEC;AAFD,SAAgB,gBAAgB,CAAC,GAAW;IAC1C,OAAO,QAAQ,IAAI,GAAG,IAAI,OAAO,IAAI,GAAG,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { GetAddressFn } from "@ledgerhq/coin-framework/bridge/getAddressWrapper";
2
+ import { SignerContext } from "@ledgerhq/coin-framework/signer";
3
+ import { ConcordiumSigner } from "../types";
4
+ declare const getAddress: (signerContext: SignerContext<ConcordiumSigner>) => GetAddressFn;
5
+ export default getAddress;
6
+ //# sourceMappingURL=getAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAddress.d.ts","sourceRoot":"","sources":["../../src/signer/getAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAqB,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE/D,QAAA,MAAM,UAAU,kBAAmB,aAAa,CAAC,gBAAgB,CAAC,KAAG,YAYpE,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getAddress = (signerContext) => {
4
+ return async (deviceId, { path, verify }) => {
5
+ const { address, publicKey } = (await signerContext(deviceId, signer => signer.getAddress(path)));
6
+ return {
7
+ path,
8
+ address,
9
+ publicKey,
10
+ };
11
+ };
12
+ };
13
+ exports.default = getAddress;
14
+ //# sourceMappingURL=getAddress.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAddress.js","sourceRoot":"","sources":["../../src/signer/getAddress.ts"],"names":[],"mappings":";;AAKA,MAAM,UAAU,GAAG,CAAC,aAA8C,EAAgB,EAAE;IAClF,OAAO,KAAK,EAAE,QAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAqB,EAAE,EAAE;QACrE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CACrE,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CACxB,CAAsB,CAAC;QAExB,OAAO;YACL,IAAI;YACJ,OAAO;YACP,SAAS;SACV,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,UAAU,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This directory is the home for all types and logic based on Ledgers signer.
3
+ */
4
+ import getAddress from "./getAddress";
5
+ export default getAddress;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/signer/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,eAAe,UAAU,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ /**
3
+ * This directory is the home for all types and logic based on Ledgers signer.
4
+ */
5
+ var __importDefault = (this && this.__importDefault) || function (mod) {
6
+ return (mod && mod.__esModule) ? mod : { "default": mod };
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ const getAddress_1 = __importDefault(require("./getAddress"));
10
+ exports.default = getAddress_1.default;
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signer/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;AAEH,8DAAsC;AAEtC,kBAAe,oBAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DeviceAction } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../types";
3
+ export declare const acceptTransaction: DeviceAction<Transaction, any>;
4
+ //# sourceMappingURL=bot-deviceActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-deviceActions.d.ts","sourceRoot":"","sources":["../../src/test/bot-deviceActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAMvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE5C,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,EAAE,GAAG,CAuC3D,CAAC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.acceptTransaction = void 0;
4
+ const specs_1 = require("@ledgerhq/coin-framework/bot/specs");
5
+ exports.acceptTransaction = (0, specs_1.deviceActionFlow)({
6
+ steps: [
7
+ {
8
+ title: "Transaction Type",
9
+ button: specs_1.SpeculosButton.RIGHT,
10
+ expectedValue: () => "Payment",
11
+ },
12
+ {
13
+ title: "Amount",
14
+ button: specs_1.SpeculosButton.RIGHT,
15
+ expectedValue: ({ account, status }) => (0, specs_1.formatDeviceAmount)(account.currency, status.amount),
16
+ },
17
+ {
18
+ title: "Fee",
19
+ button: specs_1.SpeculosButton.RIGHT,
20
+ expectedValue: ({ account, status }) => (0, specs_1.formatDeviceAmount)(account.currency, status.estimatedFees),
21
+ },
22
+ {
23
+ title: "Destination",
24
+ button: specs_1.SpeculosButton.RIGHT,
25
+ trimValue: true,
26
+ expectedValue: ({ transaction }) => transaction.recipient,
27
+ },
28
+ {
29
+ title: "Account",
30
+ button: specs_1.SpeculosButton.RIGHT,
31
+ trimValue: true,
32
+ expectedValue: ({ account }) => account.freshAddress,
33
+ },
34
+ {
35
+ title: "Accept",
36
+ button: specs_1.SpeculosButton.BOTH,
37
+ },
38
+ {
39
+ title: "Sign transaction",
40
+ button: specs_1.SpeculosButton.BOTH,
41
+ },
42
+ ],
43
+ });
44
+ //# sourceMappingURL=bot-deviceActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-deviceActions.js","sourceRoot":"","sources":["../../src/test/bot-deviceActions.ts"],"names":[],"mappings":";;;AACA,8DAI4C;AAG/B,QAAA,iBAAiB,GAAmC,IAAA,wBAAgB,EAAC;IAChF,KAAK,EAAE;QACL;YACE,KAAK,EAAE,kBAAkB;YACzB,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS;SAC/B;QACD;YACE,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,IAAA,0BAAkB,EAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC;SAC5F;QACD;YACE,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CACrC,IAAA,0BAAkB,EAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,aAAa,CAAC;SAC7D;QACD;YACE,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,SAAS,EAAE,IAAI;YACf,aAAa,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS;SAC1D;QACD;YACE,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,SAAS,EAAE,IAAI;YACf,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC,YAAY;SACrD;QACD;YACE,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,sBAAc,CAAC,IAAI;SAC5B;QACD;YACE,KAAK,EAAE,kBAAkB;YACzB,MAAM,EAAE,sBAAc,CAAC,IAAI;SAC5B;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=bot-specs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-specs.d.ts","sourceRoot":"","sources":["../../src/test/bot-specs.ts"],"names":[],"mappings":""}
@@ -0,0 +1,79 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /*
4
+
5
+ import invariant from "invariant";
6
+ import expect from "expect";
7
+ import { DeviceModelId } from "@ledgerhq/devices";
8
+ import type { AppSpec } from "@ledgerhq/coin-framework/bot/types";
9
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
10
+ import { parseCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
11
+ import { botTest, genericTestDestination, pickSiblings } from "@ledgerhq/coin-framework/bot/specs";
12
+ import { acceptTransaction } from "./bot-deviceActions";
13
+ import type { Transaction } from "../types";
14
+
15
+ const currency = getCryptoCurrencyById("concordium");
16
+ const minAmountCutoff = parseCurrencyUnit(currency.units[0], "0.1");
17
+ const reserve = parseCurrencyUnit(currency.units[0], "20");
18
+
19
+ const concordiumSpec: AppSpec<Transaction> = {
20
+ name: "BOILERPLATE",
21
+ currency,
22
+ appQuery: {
23
+ model: DeviceModelId.nanoS,
24
+ appName: "BOILERPLATE_APP_NAME",
25
+ },
26
+ genericDeviceAction: acceptTransaction,
27
+ minViableAmount: minAmountCutoff,
28
+ mutations: [
29
+ {
30
+ name: "move ~50%",
31
+ maxRun: 2,
32
+ testDestination: genericTestDestination,
33
+ transaction: ({ account, siblings, bridge, maxSpendable }) => {
34
+ invariant(maxSpendable.gt(minAmountCutoff), "balance is too low");
35
+ const transaction = bridge.createTransaction(account);
36
+ const sibling = pickSiblings(siblings, 3);
37
+ const recipient = sibling.freshAddress;
38
+ let amount = maxSpendable.div(1.9 + 0.2 * Math.random()).integerValue();
39
+
40
+ if (!sibling.used && amount.lt(reserve)) {
41
+ invariant(
42
+ maxSpendable.gt(reserve.plus(minAmountCutoff)),
43
+ "not enough funds to send to new account",
44
+ );
45
+ amount = reserve;
46
+ }
47
+
48
+ return {
49
+ transaction,
50
+ updates: [
51
+ {
52
+ amount,
53
+ },
54
+ {
55
+ recipient,
56
+ },
57
+ Math.random() > 0.5
58
+ ? {
59
+ tag: 123,
60
+ }
61
+ : null,
62
+ ],
63
+ };
64
+ },
65
+ test: ({ account, accountBeforeTransaction, operation }) => {
66
+ botTest("account balance moved with operation.value", () =>
67
+ expect(account.balance.toString()).toBe(
68
+ accountBeforeTransaction.balance.minus(operation.value).toString(),
69
+ ),
70
+ );
71
+ },
72
+ },
73
+ ],
74
+ };
75
+ export default {
76
+ concordiumSpec,
77
+ };
78
+ */
79
+ //# sourceMappingURL=bot-specs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot-specs.js","sourceRoot":"","sources":["../../src/test/bot-specs.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EE"}
@@ -0,0 +1,5 @@
1
+ import { DatasetTest } from "@ledgerhq/types-live";
2
+ import { Transaction } from "../types";
3
+ export declare const newAddress1 = "rZvBc5e2YR1A9otS3r9DyGh3NDP8XLLp4";
4
+ export declare const dataset: DatasetTest<Transaction>;
5
+ //# sourceMappingURL=bridgeDatasetTest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bridgeDatasetTest.d.ts","sourceRoot":"","sources":["../../src/test/bridgeDatasetTest.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGnD,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,WAAW,sCAAsC,CAAC;AAE/D,eAAO,MAAM,OAAO,EAAE,WAAW,CAAC,WAAW,CA0I5C,CAAC"}