@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,76 @@
1
+ /*
2
+
3
+ import invariant from "invariant";
4
+ import expect from "expect";
5
+ import { DeviceModelId } from "@ledgerhq/devices";
6
+ import type { AppSpec } from "@ledgerhq/coin-framework/bot/types";
7
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
8
+ import { parseCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
9
+ import { botTest, genericTestDestination, pickSiblings } from "@ledgerhq/coin-framework/bot/specs";
10
+ import { acceptTransaction } from "./bot-deviceActions";
11
+ import type { Transaction } from "../types";
12
+
13
+ const currency = getCryptoCurrencyById("concordium");
14
+ const minAmountCutoff = parseCurrencyUnit(currency.units[0], "0.1");
15
+ const reserve = parseCurrencyUnit(currency.units[0], "20");
16
+
17
+ const concordiumSpec: AppSpec<Transaction> = {
18
+ name: "BOILERPLATE",
19
+ currency,
20
+ appQuery: {
21
+ model: DeviceModelId.nanoS,
22
+ appName: "BOILERPLATE_APP_NAME",
23
+ },
24
+ genericDeviceAction: acceptTransaction,
25
+ minViableAmount: minAmountCutoff,
26
+ mutations: [
27
+ {
28
+ name: "move ~50%",
29
+ maxRun: 2,
30
+ testDestination: genericTestDestination,
31
+ transaction: ({ account, siblings, bridge, maxSpendable }) => {
32
+ invariant(maxSpendable.gt(minAmountCutoff), "balance is too low");
33
+ const transaction = bridge.createTransaction(account);
34
+ const sibling = pickSiblings(siblings, 3);
35
+ const recipient = sibling.freshAddress;
36
+ let amount = maxSpendable.div(1.9 + 0.2 * Math.random()).integerValue();
37
+
38
+ if (!sibling.used && amount.lt(reserve)) {
39
+ invariant(
40
+ maxSpendable.gt(reserve.plus(minAmountCutoff)),
41
+ "not enough funds to send to new account",
42
+ );
43
+ amount = reserve;
44
+ }
45
+
46
+ return {
47
+ transaction,
48
+ updates: [
49
+ {
50
+ amount,
51
+ },
52
+ {
53
+ recipient,
54
+ },
55
+ Math.random() > 0.5
56
+ ? {
57
+ tag: 123,
58
+ }
59
+ : null,
60
+ ],
61
+ };
62
+ },
63
+ test: ({ account, accountBeforeTransaction, operation }) => {
64
+ botTest("account balance moved with operation.value", () =>
65
+ expect(account.balance.toString()).toBe(
66
+ accountBeforeTransaction.balance.minus(operation.value).toString(),
67
+ ),
68
+ );
69
+ },
70
+ },
71
+ ],
72
+ };
73
+ export default {
74
+ concordiumSpec,
75
+ };
76
+ */
@@ -0,0 +1,147 @@
1
+ import BigNumber from "bignumber.js";
2
+ import { DatasetTest } from "@ledgerhq/types-live";
3
+ import { InvalidAddressBecauseDestinationIsAlsoSource } from "@ledgerhq/errors";
4
+ import { fromTransactionRaw } from "../bridge/transaction";
5
+ import { Transaction } from "../types";
6
+
7
+ export const newAddress1 = "rZvBc5e2YR1A9otS3r9DyGh3NDP8XLLp4";
8
+
9
+ export const dataset: DatasetTest<Transaction> = {
10
+ implementations: ["mock", "ripplejs"],
11
+ currencies: {
12
+ ripple: {
13
+ scanAccounts: [
14
+ {
15
+ name: "ripple seed 1",
16
+ unstableAccounts: true,
17
+ // our account is getting spammed...
18
+ apdus: `
19
+ => e00200400d038000002c8000009080000000
20
+ <= 2103c73f64083463fa923e1530af6f558204853873c6a45cbfb1f2f1e2ac2a5d989c2272734a4675764165634c333153513750594864504b6b3335625a456f78446d5231789000
21
+ => e002004015058000002c80000090800000000000000000000000
22
+ <= 2103d1adcff3e0cf1232b1416a75cd6f23b49dd6a25c69bc291a1f6783ec6825ec062272616765584842365134566276765764547a4b414e776a65435434485846434b58379000
23
+ => e002004015058000002c80000090800000010000000000000000
24
+ <= 21036da109ee84825eab0f55fb57bcf9ef0b05621e71fb0400266fb42d6f68f9487c2272425065393169766d67384347573450414e6f657555555173756d337470786a55469000
25
+ => e002004015058000002c80000090800000020000000000000000
26
+ <= 2102df9a55b79fb3668dac70fee7372806195841cd713ab8da9fba82240f9db8a23921725a76426335653259523141396f745333723944794768334e445038584c4c70349000
27
+ `,
28
+ },
29
+ ],
30
+ accounts: [
31
+ {
32
+ transactions: [
33
+ // FIXME
34
+
35
+ /*
36
+ {
37
+ name: "not enough spendable balance with base reserve",
38
+ transaction: fromTransactionRaw({
39
+ family: "xrp",
40
+ recipient: "rB6pwovsyrFWhPYUsjj9V3CHck985QjiXi",
41
+ amount: "15000000",
42
+ tag: null,
43
+ fee: "1",
44
+ feeCustomUnit: null,
45
+ networkInfo: null,
46
+ }),
47
+ expectedStatus: {
48
+ amount: BigNumber("15000000"),
49
+ estimatedFees: BigNumber("1"),
50
+ errors: {
51
+ amount: new NotEnoughSpendableBalance(null, {
52
+ minimumAmount: formatCurrencyUnit(
53
+ rippleUnit,
54
+ BigNumber("20"),
55
+ {
56
+ disableRounding: true,
57
+ useGrouping: false,
58
+ showCode: true,
59
+ }
60
+ ),
61
+ }),
62
+ },
63
+ warnings: {},
64
+ totalSpent: BigNumber("15000001"),
65
+ },
66
+ },
67
+ */
68
+ // FIXME
69
+
70
+ /*
71
+ {
72
+ name: "operation amount to low to create the recipient account",
73
+ transaction: fromTransactionRaw({
74
+ family: "xrp",
75
+ recipient: newAddress1,
76
+ amount: "10000000",
77
+ tag: null,
78
+ fee: "1",
79
+ feeCustomUnit: null,
80
+ networkInfo: null
81
+ }),
82
+ expectedStatus: {
83
+ amount: BigNumber("10000000"),
84
+ estimatedFees: BigNumber("1"),
85
+ errors: {
86
+ amount: new NotEnoughBalanceBecauseDestinationNotCreated()
87
+ },
88
+ warnings: {},
89
+ totalSpent: BigNumber("10000001")
90
+ }
91
+ },
92
+ */
93
+ {
94
+ name: "recipient and sender must not be the same",
95
+ transaction: fromTransactionRaw({
96
+ family: "concordium",
97
+ recipient: "rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7",
98
+ amount: "10000000",
99
+ fee: "1",
100
+ }),
101
+ expectedStatus: {
102
+ amount: new BigNumber("10000000"),
103
+ estimatedFees: new BigNumber("1"),
104
+ errors: {
105
+ recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
106
+ },
107
+ warnings: {},
108
+ totalSpent: new BigNumber("10000001"),
109
+ },
110
+ },
111
+ {
112
+ name: "Operation with tag succeed",
113
+ transaction: fromTransactionRaw({
114
+ family: "concordium",
115
+ recipient: "rB6pwovsyrFWhPYUsjj9V3CHck985QjiXi",
116
+ amount: "10000000",
117
+ fee: "1",
118
+ }),
119
+ expectedStatus: {
120
+ amount: new BigNumber("10000000"),
121
+ estimatedFees: new BigNumber("1"),
122
+ errors: {},
123
+ warnings: {},
124
+ totalSpent: new BigNumber("10000001"),
125
+ },
126
+ },
127
+ ],
128
+ raw: {
129
+ id: "ripplejs:2:ripple:rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7:",
130
+ seedIdentifier: "rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7",
131
+ name: "XRP 1",
132
+ derivationMode: "",
133
+ index: 0,
134
+ freshAddress: "rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7",
135
+ freshAddressPath: "44'/144'/0'/0/0",
136
+ blockHeight: 0,
137
+ operations: [],
138
+ pendingOperations: [],
139
+ currencyId: "ripple",
140
+ lastSyncDate: "",
141
+ balance: "21000310",
142
+ },
143
+ },
144
+ ],
145
+ },
146
+ },
147
+ };
@@ -0,0 +1,44 @@
1
+ import invariant from "invariant";
2
+ import type { AccountLike } from "@ledgerhq/types-live";
3
+ import BigNumber from "bignumber.js";
4
+ import type { Transaction } from "../types";
5
+
6
+ const options = [
7
+ {
8
+ name: "fee",
9
+ type: String,
10
+ desc: "how much fee",
11
+ },
12
+ {
13
+ name: "tag",
14
+ type: Number,
15
+ desc: "ripple tag",
16
+ },
17
+ ];
18
+
19
+ function inferTransactions(
20
+ transactions: Array<{
21
+ account: AccountLike;
22
+ transaction: Transaction;
23
+ }>,
24
+ opts: { tag?: number | null | undefined; fee?: string },
25
+ {
26
+ inferAmount,
27
+ }: { inferAmount: (account: AccountLike, fee?: string) => BigNumber | null | undefined },
28
+ ): Transaction[] {
29
+ return transactions.flatMap(({ transaction, account }) => {
30
+ invariant(transaction.family === "concordium", "Concordium family");
31
+ return {
32
+ ...transaction,
33
+ fee: inferAmount(account, opts.fee || "0.001brp"),
34
+ tag: opts.tag,
35
+ };
36
+ });
37
+ }
38
+
39
+ export default function makeCliTools() {
40
+ return {
41
+ options,
42
+ inferTransactions,
43
+ };
44
+ }
@@ -0,0 +1,6 @@
1
+ import makeCliTools from "./cli";
2
+
3
+ export * from "./bridgeDatasetTest";
4
+ export { makeCliTools };
5
+ export * from "./bot-deviceActions";
6
+ // export * from "./bot-specs";
@@ -0,0 +1,3 @@
1
+ import { AssetInfo } from "@ledgerhq/coin-framework/api/types";
2
+
3
+ export type ConcordiumAsset = AssetInfo;
@@ -0,0 +1,33 @@
1
+ import type { BigNumber } from "bignumber.js";
2
+ import type { Unit } from "@ledgerhq/types-cryptoassets";
3
+ import type {
4
+ TransactionCommon,
5
+ TransactionCommonRaw,
6
+ TransactionStatusCommon,
7
+ TransactionStatusCommonRaw,
8
+ } from "@ledgerhq/types-live";
9
+
10
+ export type NetworkInfo = {
11
+ family: "concordium";
12
+ serverFee: BigNumber;
13
+ baseReserve: BigNumber;
14
+ };
15
+
16
+ export type NetworkInfoRaw = {
17
+ family: "concordium";
18
+ serverFee: string;
19
+ baseReserve: string;
20
+ };
21
+
22
+ export type Transaction = TransactionCommon & {
23
+ family: "concordium";
24
+ fee: BigNumber | null | undefined;
25
+ };
26
+
27
+ export type TransactionRaw = TransactionCommonRaw & {
28
+ family: "concordium";
29
+ fee: string | null | undefined;
30
+ };
31
+
32
+ export type TransactionStatus = TransactionStatusCommon;
33
+ export type TransactionStatusRaw = TransactionStatusCommonRaw;
@@ -0,0 +1,3 @@
1
+ import { createCustomErrorClass } from "@ledgerhq/errors";
2
+
3
+ export const SimulationError = createCustomErrorClass("SimulationError");
@@ -0,0 +1,13 @@
1
+ export * from "./bridge";
2
+ export * from "./signer";
3
+
4
+ export type ConcordiumNativeTransaction = {
5
+ TransactionType: "Payment";
6
+ Account: string;
7
+ Amount: string;
8
+ Destination: string;
9
+ Fee: string;
10
+ Sequence: number;
11
+ SigningPubKey?: string;
12
+ TxnSignature?: string;
13
+ };
@@ -0,0 +1,11 @@
1
+ export type ConcordiumAddress = {
2
+ publicKey: string;
3
+ address: string;
4
+ };
5
+
6
+ export type ConcordiumSignature = string; // `0x${string}`
7
+
8
+ export interface ConcordiumSigner {
9
+ getAddress(path: string): Promise<ConcordiumAddress>;
10
+ signTransaction(path: string, rawTx: string): Promise<ConcordiumSignature>;
11
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "extends": "../../../tsconfig.base",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "downlevelIteration": true,
7
+ "lib": ["es2020", "dom"],
8
+ "outDir": "lib",
9
+ "exactOptionalPropertyTypes": true
10
+ },
11
+ "include": ["src/**/*"]
12
+ }