@ledgerhq/coin-mina 1.1.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (414) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.turbo/turbo-build.log +4 -0
  3. package/.unimportedrc.json +24 -0
  4. package/CHANGELOG.md +15 -0
  5. package/LICENSE.txt +21 -0
  6. package/jest.config.js +8 -0
  7. package/jest.integ.config.js +8 -0
  8. package/lib/api/index.d.ts +13 -0
  9. package/lib/api/index.d.ts.map +1 -0
  10. package/lib/api/index.integ.test.d.ts +2 -0
  11. package/lib/api/index.integ.test.d.ts.map +1 -0
  12. package/lib/api/index.integ.test.js +57 -0
  13. package/lib/api/index.integ.test.js.map +1 -0
  14. package/lib/api/index.js +91 -0
  15. package/lib/api/index.js.map +1 -0
  16. package/lib/api/rosetta/index.d.ts +9 -0
  17. package/lib/api/rosetta/index.d.ts.map +1 -0
  18. package/lib/api/rosetta/index.js +90 -0
  19. package/lib/api/rosetta/index.js.map +1 -0
  20. package/lib/api/rosetta/types.d.ts +143 -0
  21. package/lib/api/rosetta/types.d.ts.map +1 -0
  22. package/lib/api/rosetta/types.js +3 -0
  23. package/lib/api/rosetta/types.js.map +1 -0
  24. package/lib/api/rosetta/utils.d.ts +43 -0
  25. package/lib/api/rosetta/utils.d.ts.map +1 -0
  26. package/lib/api/rosetta/utils.js +60 -0
  27. package/lib/api/rosetta/utils.js.map +1 -0
  28. package/lib/api/rosetta/utils.test.d.ts +2 -0
  29. package/lib/api/rosetta/utils.test.d.ts.map +1 -0
  30. package/lib/api/rosetta/utils.test.js +82 -0
  31. package/lib/api/rosetta/utils.test.js.map +1 -0
  32. package/lib/bridge/broadcast.d.ts +6 -0
  33. package/lib/bridge/broadcast.d.ts.map +1 -0
  34. package/lib/bridge/broadcast.js +11 -0
  35. package/lib/bridge/broadcast.js.map +1 -0
  36. package/lib/bridge/broadcast.test.d.ts +2 -0
  37. package/lib/bridge/broadcast.test.d.ts.map +1 -0
  38. package/lib/bridge/broadcast.test.js +36 -0
  39. package/lib/bridge/broadcast.test.js.map +1 -0
  40. package/lib/bridge/buildTransaction.d.ts +4 -0
  41. package/lib/bridge/buildTransaction.d.ts.map +1 -0
  42. package/lib/bridge/buildTransaction.js +37 -0
  43. package/lib/bridge/buildTransaction.js.map +1 -0
  44. package/lib/bridge/buildTransaction.test.d.ts +2 -0
  45. package/lib/bridge/buildTransaction.test.d.ts.map +1 -0
  46. package/lib/bridge/buildTransaction.test.js +57 -0
  47. package/lib/bridge/buildTransaction.test.js.map +1 -0
  48. package/lib/bridge/cli-transaction.d.ts +18 -0
  49. package/lib/bridge/cli-transaction.d.ts.map +1 -0
  50. package/lib/bridge/cli-transaction.js +37 -0
  51. package/lib/bridge/cli-transaction.js.map +1 -0
  52. package/lib/bridge/createTransaction.d.ts +4 -0
  53. package/lib/bridge/createTransaction.d.ts.map +1 -0
  54. package/lib/bridge/createTransaction.js +21 -0
  55. package/lib/bridge/createTransaction.js.map +1 -0
  56. package/lib/bridge/createTransaction.test.d.ts +2 -0
  57. package/lib/bridge/createTransaction.test.d.ts.map +1 -0
  58. package/lib/bridge/createTransaction.test.js +24 -0
  59. package/lib/bridge/createTransaction.test.js.map +1 -0
  60. package/lib/bridge/deviceTransactionConfig.d.ts +11 -0
  61. package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
  62. package/lib/bridge/deviceTransactionConfig.js +8 -0
  63. package/lib/bridge/deviceTransactionConfig.js.map +1 -0
  64. package/lib/bridge/errors.d.ts +10 -0
  65. package/lib/bridge/errors.d.ts.map +1 -0
  66. package/lib/bridge/errors.js +17 -0
  67. package/lib/bridge/errors.js.map +1 -0
  68. package/lib/bridge/estimateMaxSpendable.d.ts +5 -0
  69. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
  70. package/lib/bridge/estimateMaxSpendable.js +26 -0
  71. package/lib/bridge/estimateMaxSpendable.js.map +1 -0
  72. package/lib/bridge/getEstimatedFees.d.ts +8 -0
  73. package/lib/bridge/getEstimatedFees.d.ts.map +1 -0
  74. package/lib/bridge/getEstimatedFees.js +9 -0
  75. package/lib/bridge/getEstimatedFees.js.map +1 -0
  76. package/lib/bridge/getTransactionStatus.d.ts +5 -0
  77. package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
  78. package/lib/bridge/getTransactionStatus.js +62 -0
  79. package/lib/bridge/getTransactionStatus.js.map +1 -0
  80. package/lib/bridge/getTransactionStatus.test.d.ts +2 -0
  81. package/lib/bridge/getTransactionStatus.test.d.ts.map +1 -0
  82. package/lib/bridge/getTransactionStatus.test.js +138 -0
  83. package/lib/bridge/getTransactionStatus.test.js.map +1 -0
  84. package/lib/bridge/index.d.ts +14 -0
  85. package/lib/bridge/index.d.ts.map +1 -0
  86. package/lib/bridge/index.js +59 -0
  87. package/lib/bridge/index.js.map +1 -0
  88. package/lib/bridge/index.test.d.ts +2 -0
  89. package/lib/bridge/index.test.d.ts.map +1 -0
  90. package/lib/bridge/index.test.js +32 -0
  91. package/lib/bridge/index.test.js.map +1 -0
  92. package/lib/bridge/prepareTransaction.d.ts +4 -0
  93. package/lib/bridge/prepareTransaction.d.ts.map +1 -0
  94. package/lib/bridge/prepareTransaction.js +23 -0
  95. package/lib/bridge/prepareTransaction.js.map +1 -0
  96. package/lib/bridge/prepareTransaction.test.d.ts +2 -0
  97. package/lib/bridge/prepareTransaction.test.d.ts.map +1 -0
  98. package/lib/bridge/prepareTransaction.test.js +43 -0
  99. package/lib/bridge/prepareTransaction.test.js.map +1 -0
  100. package/lib/bridge/signOperation.d.ts +12 -0
  101. package/lib/bridge/signOperation.d.ts.map +1 -0
  102. package/lib/bridge/signOperation.js +72 -0
  103. package/lib/bridge/signOperation.js.map +1 -0
  104. package/lib/bridge/signOperation.test.d.ts +2 -0
  105. package/lib/bridge/signOperation.test.d.ts.map +1 -0
  106. package/lib/bridge/signOperation.test.js +129 -0
  107. package/lib/bridge/signOperation.test.js.map +1 -0
  108. package/lib/bridge/synchronisation.d.ts +7 -0
  109. package/lib/bridge/synchronisation.d.ts.map +1 -0
  110. package/lib/bridge/synchronisation.js +155 -0
  111. package/lib/bridge/synchronisation.js.map +1 -0
  112. package/lib/bridge/synchronisation.test.d.ts +2 -0
  113. package/lib/bridge/synchronisation.test.d.ts.map +1 -0
  114. package/lib/bridge/synchronisation.test.js +164 -0
  115. package/lib/bridge/synchronisation.test.js.map +1 -0
  116. package/lib/bridge/transaction.d.ts +14 -0
  117. package/lib/bridge/transaction.d.ts.map +1 -0
  118. package/lib/bridge/transaction.js +61 -0
  119. package/lib/bridge/transaction.js.map +1 -0
  120. package/lib/common-logic/index.d.ts +9 -0
  121. package/lib/common-logic/index.d.ts.map +1 -0
  122. package/lib/common-logic/index.js +96 -0
  123. package/lib/common-logic/index.js.map +1 -0
  124. package/lib/common-logic/index.test.d.ts +2 -0
  125. package/lib/common-logic/index.test.d.ts.map +1 -0
  126. package/lib/common-logic/index.test.js +181 -0
  127. package/lib/common-logic/index.test.js.map +1 -0
  128. package/lib/config.d.ts +9 -0
  129. package/lib/config.d.ts.map +1 -0
  130. package/lib/config.js +16 -0
  131. package/lib/config.js.map +1 -0
  132. package/lib/consts.d.ts +16 -0
  133. package/lib/consts.d.ts.map +1 -0
  134. package/lib/consts.js +19 -0
  135. package/lib/consts.js.map +1 -0
  136. package/lib/signer/getAddress.d.ts +6 -0
  137. package/lib/signer/getAddress.d.ts.map +1 -0
  138. package/lib/signer/getAddress.js +22 -0
  139. package/lib/signer/getAddress.js.map +1 -0
  140. package/lib/signer/getAddress.test.d.ts +2 -0
  141. package/lib/signer/getAddress.test.d.ts.map +1 -0
  142. package/lib/signer/getAddress.test.js +106 -0
  143. package/lib/signer/getAddress.test.js.map +1 -0
  144. package/lib/signer/index.d.ts +3 -0
  145. package/lib/signer/index.d.ts.map +1 -0
  146. package/lib/signer/index.js +8 -0
  147. package/lib/signer/index.js.map +1 -0
  148. package/lib/test/bot-deviceActions.d.ts +4 -0
  149. package/lib/test/bot-deviceActions.d.ts.map +1 -0
  150. package/lib/test/bot-deviceActions.js +67 -0
  151. package/lib/test/bot-deviceActions.js.map +1 -0
  152. package/lib/test/bot-specs.d.ts +7 -0
  153. package/lib/test/bot-specs.d.ts.map +1 -0
  154. package/lib/test/bot-specs.js +107 -0
  155. package/lib/test/bot-specs.js.map +1 -0
  156. package/lib/test/bridgeDatasetTest.d.ts +4 -0
  157. package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
  158. package/lib/test/bridgeDatasetTest.js +174 -0
  159. package/lib/test/bridgeDatasetTest.js.map +1 -0
  160. package/lib/test/fixtures.d.ts +55 -0
  161. package/lib/test/fixtures.d.ts.map +1 -0
  162. package/lib/test/fixtures.js +194 -0
  163. package/lib/test/fixtures.js.map +1 -0
  164. package/lib/test/index.d.ts +4 -0
  165. package/lib/test/index.d.ts.map +1 -0
  166. package/lib/test/index.js +20 -0
  167. package/lib/test/index.js.map +1 -0
  168. package/lib/test/testUtils.d.ts +2 -0
  169. package/lib/test/testUtils.d.ts.map +1 -0
  170. package/lib/test/testUtils.js +8 -0
  171. package/lib/test/testUtils.js.map +1 -0
  172. package/lib/test/testUtils.test.d.ts +2 -0
  173. package/lib/test/testUtils.test.d.ts.map +1 -0
  174. package/lib/test/testUtils.test.js +11 -0
  175. package/lib/test/testUtils.test.js.map +1 -0
  176. package/lib/types/common.d.ts +55 -0
  177. package/lib/types/common.d.ts.map +1 -0
  178. package/lib/types/common.js +3 -0
  179. package/lib/types/common.js.map +1 -0
  180. package/lib/types/index.d.ts +3 -0
  181. package/lib/types/index.d.ts.map +1 -0
  182. package/lib/types/index.js +19 -0
  183. package/lib/types/index.js.map +1 -0
  184. package/lib/types/signer.d.ts +32 -0
  185. package/lib/types/signer.d.ts.map +1 -0
  186. package/lib/types/signer.js +3 -0
  187. package/lib/types/signer.js.map +1 -0
  188. package/lib-es/api/index.d.ts +13 -0
  189. package/lib-es/api/index.d.ts.map +1 -0
  190. package/lib-es/api/index.integ.test.d.ts +2 -0
  191. package/lib-es/api/index.integ.test.d.ts.map +1 -0
  192. package/lib-es/api/index.integ.test.js +55 -0
  193. package/lib-es/api/index.integ.test.js.map +1 -0
  194. package/lib-es/api/index.js +79 -0
  195. package/lib-es/api/index.js.map +1 -0
  196. package/lib-es/api/rosetta/index.d.ts +8 -0
  197. package/lib-es/api/rosetta/index.d.ts.map +1 -0
  198. package/lib-es/api/rosetta/index.js +78 -0
  199. package/lib-es/api/rosetta/index.js.map +1 -0
  200. package/lib-es/api/rosetta/types.d.ts +143 -0
  201. package/lib-es/api/rosetta/types.d.ts.map +1 -0
  202. package/lib-es/api/rosetta/types.js +2 -0
  203. package/lib-es/api/rosetta/types.js.map +1 -0
  204. package/lib-es/api/rosetta/utils.d.ts +43 -0
  205. package/lib-es/api/rosetta/utils.d.ts.map +1 -0
  206. package/lib-es/api/rosetta/utils.js +54 -0
  207. package/lib-es/api/rosetta/utils.js.map +1 -0
  208. package/lib-es/api/rosetta/utils.test.d.ts +2 -0
  209. package/lib-es/api/rosetta/utils.test.d.ts.map +1 -0
  210. package/lib-es/api/rosetta/utils.test.js +80 -0
  211. package/lib-es/api/rosetta/utils.test.js.map +1 -0
  212. package/lib-es/bridge/broadcast.d.ts +6 -0
  213. package/lib-es/bridge/broadcast.d.ts.map +1 -0
  214. package/lib-es/bridge/broadcast.js +9 -0
  215. package/lib-es/bridge/broadcast.js.map +1 -0
  216. package/lib-es/bridge/broadcast.test.d.ts +2 -0
  217. package/lib-es/bridge/broadcast.test.d.ts.map +1 -0
  218. package/lib-es/bridge/broadcast.test.js +31 -0
  219. package/lib-es/bridge/broadcast.test.js.map +1 -0
  220. package/lib-es/bridge/buildTransaction.d.ts +4 -0
  221. package/lib-es/bridge/buildTransaction.d.ts.map +1 -0
  222. package/lib-es/bridge/buildTransaction.js +30 -0
  223. package/lib-es/bridge/buildTransaction.js.map +1 -0
  224. package/lib-es/bridge/buildTransaction.test.d.ts +2 -0
  225. package/lib-es/bridge/buildTransaction.test.d.ts.map +1 -0
  226. package/lib-es/bridge/buildTransaction.test.js +55 -0
  227. package/lib-es/bridge/buildTransaction.test.js.map +1 -0
  228. package/lib-es/bridge/cli-transaction.d.ts +18 -0
  229. package/lib-es/bridge/cli-transaction.d.ts.map +1 -0
  230. package/lib-es/bridge/cli-transaction.js +31 -0
  231. package/lib-es/bridge/cli-transaction.js.map +1 -0
  232. package/lib-es/bridge/createTransaction.d.ts +4 -0
  233. package/lib-es/bridge/createTransaction.d.ts.map +1 -0
  234. package/lib-es/bridge/createTransaction.js +14 -0
  235. package/lib-es/bridge/createTransaction.js.map +1 -0
  236. package/lib-es/bridge/createTransaction.test.d.ts +2 -0
  237. package/lib-es/bridge/createTransaction.test.d.ts.map +1 -0
  238. package/lib-es/bridge/createTransaction.test.js +19 -0
  239. package/lib-es/bridge/createTransaction.test.js.map +1 -0
  240. package/lib-es/bridge/deviceTransactionConfig.d.ts +11 -0
  241. package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
  242. package/lib-es/bridge/deviceTransactionConfig.js +6 -0
  243. package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
  244. package/lib-es/bridge/errors.d.ts +10 -0
  245. package/lib-es/bridge/errors.d.ts.map +1 -0
  246. package/lib-es/bridge/errors.js +14 -0
  247. package/lib-es/bridge/errors.js.map +1 -0
  248. package/lib-es/bridge/estimateMaxSpendable.d.ts +5 -0
  249. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
  250. package/lib-es/bridge/estimateMaxSpendable.js +21 -0
  251. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
  252. package/lib-es/bridge/getEstimatedFees.d.ts +8 -0
  253. package/lib-es/bridge/getEstimatedFees.d.ts.map +1 -0
  254. package/lib-es/bridge/getEstimatedFees.js +7 -0
  255. package/lib-es/bridge/getEstimatedFees.js.map +1 -0
  256. package/lib-es/bridge/getTransactionStatus.d.ts +5 -0
  257. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
  258. package/lib-es/bridge/getTransactionStatus.js +60 -0
  259. package/lib-es/bridge/getTransactionStatus.js.map +1 -0
  260. package/lib-es/bridge/getTransactionStatus.test.d.ts +2 -0
  261. package/lib-es/bridge/getTransactionStatus.test.d.ts.map +1 -0
  262. package/lib-es/bridge/getTransactionStatus.test.js +133 -0
  263. package/lib-es/bridge/getTransactionStatus.test.js.map +1 -0
  264. package/lib-es/bridge/index.d.ts +14 -0
  265. package/lib-es/bridge/index.d.ts.map +1 -0
  266. package/lib-es/bridge/index.js +50 -0
  267. package/lib-es/bridge/index.js.map +1 -0
  268. package/lib-es/bridge/index.test.d.ts +2 -0
  269. package/lib-es/bridge/index.test.d.ts.map +1 -0
  270. package/lib-es/bridge/index.test.js +30 -0
  271. package/lib-es/bridge/index.test.js.map +1 -0
  272. package/lib-es/bridge/prepareTransaction.d.ts +4 -0
  273. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
  274. package/lib-es/bridge/prepareTransaction.js +16 -0
  275. package/lib-es/bridge/prepareTransaction.js.map +1 -0
  276. package/lib-es/bridge/prepareTransaction.test.d.ts +2 -0
  277. package/lib-es/bridge/prepareTransaction.test.d.ts.map +1 -0
  278. package/lib-es/bridge/prepareTransaction.test.js +38 -0
  279. package/lib-es/bridge/prepareTransaction.test.js.map +1 -0
  280. package/lib-es/bridge/signOperation.d.ts +12 -0
  281. package/lib-es/bridge/signOperation.d.ts.map +1 -0
  282. package/lib-es/bridge/signOperation.js +64 -0
  283. package/lib-es/bridge/signOperation.js.map +1 -0
  284. package/lib-es/bridge/signOperation.test.d.ts +2 -0
  285. package/lib-es/bridge/signOperation.test.d.ts.map +1 -0
  286. package/lib-es/bridge/signOperation.test.js +127 -0
  287. package/lib-es/bridge/signOperation.test.js.map +1 -0
  288. package/lib-es/bridge/synchronisation.d.ts +7 -0
  289. package/lib-es/bridge/synchronisation.d.ts.map +1 -0
  290. package/lib-es/bridge/synchronisation.js +147 -0
  291. package/lib-es/bridge/synchronisation.js.map +1 -0
  292. package/lib-es/bridge/synchronisation.test.d.ts +2 -0
  293. package/lib-es/bridge/synchronisation.test.d.ts.map +1 -0
  294. package/lib-es/bridge/synchronisation.test.js +159 -0
  295. package/lib-es/bridge/synchronisation.test.js.map +1 -0
  296. package/lib-es/bridge/transaction.d.ts +14 -0
  297. package/lib-es/bridge/transaction.d.ts.map +1 -0
  298. package/lib-es/bridge/transaction.js +53 -0
  299. package/lib-es/bridge/transaction.js.map +1 -0
  300. package/lib-es/common-logic/index.d.ts +9 -0
  301. package/lib-es/common-logic/index.d.ts.map +1 -0
  302. package/lib-es/common-logic/index.js +84 -0
  303. package/lib-es/common-logic/index.js.map +1 -0
  304. package/lib-es/common-logic/index.test.d.ts +2 -0
  305. package/lib-es/common-logic/index.test.d.ts.map +1 -0
  306. package/lib-es/common-logic/index.test.js +179 -0
  307. package/lib-es/common-logic/index.test.js.map +1 -0
  308. package/lib-es/config.d.ts +9 -0
  309. package/lib-es/config.d.ts.map +1 -0
  310. package/lib-es/config.js +11 -0
  311. package/lib-es/config.js.map +1 -0
  312. package/lib-es/consts.d.ts +16 -0
  313. package/lib-es/consts.d.ts.map +1 -0
  314. package/lib-es/consts.js +16 -0
  315. package/lib-es/consts.js.map +1 -0
  316. package/lib-es/signer/getAddress.d.ts +6 -0
  317. package/lib-es/signer/getAddress.d.ts.map +1 -0
  318. package/lib-es/signer/getAddress.js +17 -0
  319. package/lib-es/signer/getAddress.js.map +1 -0
  320. package/lib-es/signer/getAddress.test.d.ts +2 -0
  321. package/lib-es/signer/getAddress.test.d.ts.map +1 -0
  322. package/lib-es/signer/getAddress.test.js +101 -0
  323. package/lib-es/signer/getAddress.test.js.map +1 -0
  324. package/lib-es/signer/index.d.ts +3 -0
  325. package/lib-es/signer/index.d.ts.map +1 -0
  326. package/lib-es/signer/index.js +3 -0
  327. package/lib-es/signer/index.js.map +1 -0
  328. package/lib-es/test/bot-deviceActions.d.ts +4 -0
  329. package/lib-es/test/bot-deviceActions.d.ts.map +1 -0
  330. package/lib-es/test/bot-deviceActions.js +64 -0
  331. package/lib-es/test/bot-deviceActions.js.map +1 -0
  332. package/lib-es/test/bot-specs.d.ts +7 -0
  333. package/lib-es/test/bot-specs.d.ts.map +1 -0
  334. package/lib-es/test/bot-specs.js +102 -0
  335. package/lib-es/test/bot-specs.js.map +1 -0
  336. package/lib-es/test/bridgeDatasetTest.d.ts +4 -0
  337. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
  338. package/lib-es/test/bridgeDatasetTest.js +171 -0
  339. package/lib-es/test/bridgeDatasetTest.js.map +1 -0
  340. package/lib-es/test/fixtures.d.ts +55 -0
  341. package/lib-es/test/fixtures.d.ts.map +1 -0
  342. package/lib-es/test/fixtures.js +182 -0
  343. package/lib-es/test/fixtures.js.map +1 -0
  344. package/lib-es/test/index.d.ts +4 -0
  345. package/lib-es/test/index.d.ts.map +1 -0
  346. package/lib-es/test/index.js +4 -0
  347. package/lib-es/test/index.js.map +1 -0
  348. package/lib-es/test/testUtils.d.ts +2 -0
  349. package/lib-es/test/testUtils.d.ts.map +1 -0
  350. package/lib-es/test/testUtils.js +4 -0
  351. package/lib-es/test/testUtils.js.map +1 -0
  352. package/lib-es/test/testUtils.test.d.ts +2 -0
  353. package/lib-es/test/testUtils.test.d.ts.map +1 -0
  354. package/lib-es/test/testUtils.test.js +9 -0
  355. package/lib-es/test/testUtils.test.js.map +1 -0
  356. package/lib-es/types/common.d.ts +55 -0
  357. package/lib-es/types/common.d.ts.map +1 -0
  358. package/lib-es/types/common.js +2 -0
  359. package/lib-es/types/common.js.map +1 -0
  360. package/lib-es/types/index.d.ts +3 -0
  361. package/lib-es/types/index.d.ts.map +1 -0
  362. package/lib-es/types/index.js +3 -0
  363. package/lib-es/types/index.js.map +1 -0
  364. package/lib-es/types/signer.d.ts +32 -0
  365. package/lib-es/types/signer.d.ts.map +1 -0
  366. package/lib-es/types/signer.js +2 -0
  367. package/lib-es/types/signer.js.map +1 -0
  368. package/package.json +143 -0
  369. package/src/api/index.integ.test.ts +62 -0
  370. package/src/api/index.ts +120 -0
  371. package/src/api/rosetta/index.ts +110 -0
  372. package/src/api/rosetta/types.ts +156 -0
  373. package/src/api/rosetta/utils.test.ts +100 -0
  374. package/src/api/rosetta/utils.ts +71 -0
  375. package/src/bridge/broadcast.test.ts +35 -0
  376. package/src/bridge/broadcast.ts +17 -0
  377. package/src/bridge/buildTransaction.test.ts +68 -0
  378. package/src/bridge/buildTransaction.ts +34 -0
  379. package/src/bridge/cli-transaction.ts +43 -0
  380. package/src/bridge/createTransaction.test.ts +21 -0
  381. package/src/bridge/createTransaction.ts +19 -0
  382. package/src/bridge/deviceTransactionConfig.ts +15 -0
  383. package/src/bridge/errors.ts +16 -0
  384. package/src/bridge/estimateMaxSpendable.ts +31 -0
  385. package/src/bridge/getEstimatedFees.ts +17 -0
  386. package/src/bridge/getTransactionStatus.test.ts +175 -0
  387. package/src/bridge/getTransactionStatus.ts +87 -0
  388. package/src/bridge/index.test.ts +39 -0
  389. package/src/bridge/index.ts +72 -0
  390. package/src/bridge/prepareTransaction.test.ts +43 -0
  391. package/src/bridge/prepareTransaction.ts +24 -0
  392. package/src/bridge/signOperation.test.ts +158 -0
  393. package/src/bridge/signOperation.ts +112 -0
  394. package/src/bridge/synchronisation.test.ts +184 -0
  395. package/src/bridge/synchronisation.ts +168 -0
  396. package/src/bridge/transaction.ts +69 -0
  397. package/src/common-logic/index.test.ts +225 -0
  398. package/src/common-logic/index.ts +97 -0
  399. package/src/config.ts +21 -0
  400. package/src/consts.ts +18 -0
  401. package/src/signer/getAddress.test.ts +131 -0
  402. package/src/signer/getAddress.ts +24 -0
  403. package/src/signer/index.ts +3 -0
  404. package/src/test/bot-deviceActions.ts +73 -0
  405. package/src/test/bot-specs.ts +130 -0
  406. package/src/test/bridgeDatasetTest.ts +180 -0
  407. package/src/test/fixtures.ts +226 -0
  408. package/src/test/index.ts +3 -0
  409. package/src/test/testUtils.test.ts +9 -0
  410. package/src/test/testUtils.ts +3 -0
  411. package/src/types/common.ts +70 -0
  412. package/src/types/index.ts +2 -0
  413. package/src/types/signer.ts +29 -0
  414. package/tsconfig.json +13 -0
@@ -0,0 +1,130 @@
1
+ import invariant from "invariant";
2
+ import { DeviceModelId } from "@ledgerhq/devices";
3
+ import BigNumber from "bignumber.js";
4
+ import expect from "expect";
5
+
6
+ import type { MinaOperation, Transaction } from "../types/common";
7
+ import { genericTestDestination, botTest, pickSiblings } from "@ledgerhq/coin-framework/bot/specs";
8
+ import type { AppSpec, TransactionTestInput } from "@ledgerhq/coin-framework/bot/types";
9
+ import { acceptTransaction } from "./bot-deviceActions";
10
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/index";
11
+ import { getRandomTransferID } from "./testUtils";
12
+
13
+ const maxAccount = 6;
14
+ // 0.1 MINA
15
+ const MIN_SAFE = new BigNumber(1 * 10 ** 8);
16
+
17
+ const minaSpecs: AppSpec<Transaction> = {
18
+ name: "Mina",
19
+ currency: getCryptoCurrencyById("mina"),
20
+ appQuery: {
21
+ model: DeviceModelId.nanoS,
22
+ appName: "Mina",
23
+ },
24
+ genericDeviceAction: acceptTransaction,
25
+ testTimeout: 15 * 60 * 1000,
26
+ minViableAmount: MIN_SAFE,
27
+ transactionCheck: ({ maxSpendable }) => {
28
+ invariant(maxSpendable.gt(MIN_SAFE), "balance is too low");
29
+ },
30
+ mutations: [
31
+ {
32
+ name: "Send ~50% to another account",
33
+ maxRun: 1,
34
+ testDestination: genericTestDestination,
35
+ feature: "send",
36
+ transaction: ({ account, siblings, bridge, maxSpendable }) => {
37
+ invariant(maxSpendable.gt(MIN_SAFE), "balance is too low");
38
+ const sibling = pickSiblings(siblings, maxAccount);
39
+ const recipient = sibling.freshAddress;
40
+ const amount = maxSpendable.div(2).integerValue();
41
+
42
+ const transaction = bridge.createTransaction(account);
43
+ const updates: Array<Partial<Transaction>> = [
44
+ {
45
+ recipient,
46
+ },
47
+ { amount },
48
+ ];
49
+
50
+ if (Math.random() < 0.5) {
51
+ updates.push({
52
+ memo: getRandomTransferID(),
53
+ });
54
+ }
55
+
56
+ return {
57
+ transaction,
58
+ updates,
59
+ };
60
+ },
61
+
62
+ test: ({
63
+ accountBeforeTransaction,
64
+ operation,
65
+ account,
66
+ transaction,
67
+ }: TransactionTestInput<Transaction>) => {
68
+ botTest("account spendable balance decreased with operation", () =>
69
+ expect(account.spendableBalance).toEqual(
70
+ accountBeforeTransaction.spendableBalance
71
+ .minus(operation.value)
72
+ .minus((operation.extra as MinaOperation["extra"]).accountCreationFee),
73
+ ),
74
+ );
75
+
76
+ if (transaction.memo) {
77
+ botTest("operation memo", () =>
78
+ expect(operation.extra).toMatchObject({
79
+ memo: transaction.memo,
80
+ }),
81
+ );
82
+ }
83
+ },
84
+ },
85
+ {
86
+ name: "Transfer Max",
87
+ feature: "sendMax",
88
+ maxRun: 1,
89
+ transaction: ({ account, siblings, bridge }) => {
90
+ const updates: Array<Partial<Transaction>> = [
91
+ {
92
+ recipient: pickSiblings(siblings, maxAccount).freshAddress,
93
+ },
94
+ {
95
+ useAllAmount: true,
96
+ },
97
+ ];
98
+
99
+ if (Math.random() < 0.5) {
100
+ updates.push({
101
+ memo: getRandomTransferID(),
102
+ });
103
+ }
104
+
105
+ return {
106
+ transaction: bridge.createTransaction(account),
107
+ updates,
108
+ };
109
+ },
110
+ testDestination: genericTestDestination,
111
+ test: ({ account, transaction, operation }) => {
112
+ botTest("account spendable balance is zero", () =>
113
+ expect(account.spendableBalance.toString()).toBe("0"),
114
+ );
115
+
116
+ if (transaction.memo) {
117
+ botTest("operation memo", () =>
118
+ expect(operation.extra).toMatchObject({
119
+ memo: transaction.memo,
120
+ }),
121
+ );
122
+ }
123
+ },
124
+ },
125
+ ],
126
+ };
127
+
128
+ export default {
129
+ minaSpecs,
130
+ };
@@ -0,0 +1,180 @@
1
+ import { BigNumber } from "bignumber.js";
2
+ import {
3
+ AmountRequired,
4
+ InvalidAddress,
5
+ InvalidAddressBecauseDestinationIsAlsoSource,
6
+ NotEnoughBalance,
7
+ } from "@ledgerhq/errors";
8
+ import type { DatasetTest, CurrenciesData } from "@ledgerhq/types-live";
9
+ import type { Transaction } from "../types/common";
10
+ import { fromTransactionRaw } from "../bridge/transaction";
11
+ import { InvalidMemoMina } from "../bridge/errors";
12
+
13
+ const ACCOUNT_ADDRESS = "B62qjWLs1W3J2fFGixeX49w1o7VvSGuMBNotnFhzs3PZ7PbtdFbhdeD";
14
+ const ACCOUNT_ADDRESS_1 = "B62qkWcHhoisWDCR7v3gvWzX6wXEVuGYLHXq3mSym4GEzfYXmSDv314";
15
+
16
+ const mina: CurrenciesData<Transaction> = {
17
+ FIXME_ignoreAccountFields: ["blockHash"],
18
+ scanAccounts: [
19
+ {
20
+ name: "mina seed 1",
21
+ apdus: `
22
+ => e00201000400000000
23
+ <= 423632716a574c733157334a3266464769786558343977316f3756765347754d424e6f746e46687a7333505a3750627464466268646544009000
24
+ => e00201000400000001
25
+ <= 423632716e4438387474693632364d694d6e7568504d624c69504c766664644657486a47667377795646754c5845614b644b366f344263009000
26
+ => e00201000400000002
27
+ <= 423632716a7048577878544457506e474372714b546b56414b596f4e5250374c6e454b356564766d717151394658736e61313166674741009000
28
+ `,
29
+ },
30
+ ],
31
+ accounts: [
32
+ {
33
+ // Skipping due to rewards being auto-compounded, no operation as evidence
34
+ FIXME_tests: ["balance is sum of ops"],
35
+ raw: {
36
+ id: `js:2:mina:${ACCOUNT_ADDRESS}:`,
37
+ seedIdentifier: `${ACCOUNT_ADDRESS}`,
38
+ name: "MINA 1",
39
+ derivationMode: "minabip44",
40
+ index: 0,
41
+ freshAddress: `${ACCOUNT_ADDRESS}`,
42
+ freshAddressPath: "44'/12586'/0'/0'/0'",
43
+ blockHeight: 0,
44
+ operations: [],
45
+ pendingOperations: [],
46
+ currencyId: "mina",
47
+ lastSyncDate: "",
48
+ balance: "1000000",
49
+ },
50
+ transactions: [
51
+ {
52
+ name: "not a valid address",
53
+ transaction: fromTransactionRaw({
54
+ family: "mina",
55
+ recipient: "novalidaddress",
56
+ fees: {
57
+ fee: new BigNumber(0).toString(),
58
+ accountCreationFee: new BigNumber(0).toString(),
59
+ },
60
+ amount: "1000",
61
+ memo: undefined,
62
+ nonce: 0,
63
+ }),
64
+ expectedStatus: {
65
+ errors: {
66
+ recipient: new InvalidAddress(),
67
+ },
68
+ warnings: {},
69
+ },
70
+ },
71
+ {
72
+ name: "not enough balance",
73
+ transaction: fromTransactionRaw({
74
+ family: "mina",
75
+ recipient: ACCOUNT_ADDRESS_1,
76
+ fees: {
77
+ fee: new BigNumber(0).toString(),
78
+ accountCreationFee: new BigNumber(0).toString(),
79
+ },
80
+ amount: (300 * 1e9).toString(),
81
+ memo: undefined,
82
+ nonce: 0,
83
+ }),
84
+ expectedStatus: {
85
+ errors: {
86
+ amount: new NotEnoughBalance(),
87
+ },
88
+ warnings: {},
89
+ },
90
+ },
91
+ {
92
+ name: "invalid Memo",
93
+ transaction: fromTransactionRaw({
94
+ family: "mina",
95
+ recipient: ACCOUNT_ADDRESS_1,
96
+ fees: {
97
+ fee: new BigNumber(0).toString(),
98
+ accountCreationFee: new BigNumber(0).toString(),
99
+ },
100
+ amount: "1000",
101
+ memo: "string greated than 32 chars is invalid",
102
+ nonce: 0,
103
+ }),
104
+ expectedStatus: {
105
+ errors: {
106
+ transaction: new InvalidMemoMina(),
107
+ },
108
+ warnings: {},
109
+ },
110
+ },
111
+ {
112
+ name: "amount Required",
113
+ transaction: fromTransactionRaw({
114
+ family: "mina",
115
+ recipient: ACCOUNT_ADDRESS_1,
116
+ memo: undefined,
117
+ amount: "0",
118
+ fees: {
119
+ fee: new BigNumber(0).toString(),
120
+ accountCreationFee: new BigNumber(0).toString(),
121
+ },
122
+ nonce: 0,
123
+ }),
124
+ expectedStatus: {
125
+ errors: {
126
+ amount: new AmountRequired(),
127
+ },
128
+ warnings: {},
129
+ },
130
+ },
131
+ {
132
+ name: "recipient same as source",
133
+ transaction: fromTransactionRaw({
134
+ family: "mina",
135
+ recipient: ACCOUNT_ADDRESS,
136
+ amount: "10",
137
+ fees: {
138
+ fee: new BigNumber(0).toString(),
139
+ accountCreationFee: new BigNumber(0).toString(),
140
+ },
141
+ memo: undefined,
142
+ nonce: 0,
143
+ }),
144
+ expectedStatus: {
145
+ errors: {
146
+ recipient: new InvalidAddressBecauseDestinationIsAlsoSource(),
147
+ },
148
+ warnings: {},
149
+ },
150
+ },
151
+ {
152
+ name: "new account and sufficient amount",
153
+ transaction: fromTransactionRaw({
154
+ family: "mina",
155
+ recipient: ACCOUNT_ADDRESS_1,
156
+ amount: "1000",
157
+ fees: {
158
+ fee: new BigNumber(0).toString(),
159
+ accountCreationFee: new BigNumber(0).toString(),
160
+ },
161
+ memo: undefined,
162
+ nonce: 0,
163
+ }),
164
+ expectedStatus: {
165
+ amount: new BigNumber("1000"),
166
+ errors: {},
167
+ warnings: {},
168
+ },
169
+ },
170
+ ],
171
+ },
172
+ ],
173
+ };
174
+
175
+ export const dataset: DatasetTest<Transaction> = {
176
+ implementations: ["js"],
177
+ currencies: {
178
+ mina,
179
+ },
180
+ };
@@ -0,0 +1,226 @@
1
+ import { Account } from "@ledgerhq/types-live";
2
+ import { AccountShapeInfo } from "@ledgerhq/coin-framework/bridge/jsHelpers";
3
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/lib/currencies";
4
+ import BigNumber from "bignumber.js";
5
+ import { RosettaBlockInfoResponse, RosettaTransaction } from "../api/rosetta/types";
6
+ import { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
7
+ import { MinaUnsignedTransaction } from "@ledgerhq/coin-mina/types";
8
+ import { DeviceId } from "@ledgerhq/types-live";
9
+ import { SignerContext } from "@ledgerhq/coin-framework/signer";
10
+ import { MinaSigner } from "@ledgerhq/coin-mina/types";
11
+ import { Transaction } from "../types";
12
+
13
+ // Mock account data
14
+ export const mockAccountData = {
15
+ blockHeight: 123,
16
+ balance: new BigNumber(1000),
17
+ spendableBalance: new BigNumber(900),
18
+ };
19
+
20
+ // Mock block info
21
+ export const mockBlockInfo: RosettaBlockInfoResponse = {
22
+ block: {
23
+ block_identifier: { index: 123, hash: "block_hash" },
24
+ parent_block_identifier: { index: 122, hash: "parent_block_hash" },
25
+ timestamp: 1672531200000,
26
+ },
27
+ };
28
+
29
+ /**
30
+ * Creates a mock Rosetta transaction for testing
31
+ */
32
+ export const createMockTxn = (options: {
33
+ type: string;
34
+ senderAddress: string;
35
+ receiverAddress: string;
36
+ status: "Success" | "Failed";
37
+ amount?: string;
38
+ fee?: string;
39
+ memo?: string;
40
+ }): RosettaTransaction => {
41
+ const {
42
+ type,
43
+ senderAddress,
44
+ receiverAddress,
45
+ amount = "1000",
46
+ fee = "100",
47
+ memo = "test memo",
48
+ status,
49
+ } = options;
50
+
51
+ const operations: RosettaTransaction["transaction"]["operations"] = [];
52
+
53
+ if (type !== "REDELEGATE") {
54
+ // Add fee operation for payment transactions
55
+ operations.push({
56
+ type: "fee_payment",
57
+ amount: { value: fee, currency: { symbol: "MINA", decimals: 9 } },
58
+ status,
59
+ account: { address: senderAddress, metadata: { token_id: "MINA" } },
60
+ operation_identifier: { index: 0 },
61
+ });
62
+
63
+ operations.push({
64
+ type: "payment_source_dec",
65
+ status,
66
+ account: { address: senderAddress, metadata: { token_id: "MINA" } },
67
+ operation_identifier: { index: 1 },
68
+ });
69
+
70
+ operations.push({
71
+ type: "payment_receiver_inc",
72
+ amount: { value: amount, currency: { symbol: "MINA", decimals: 9 } },
73
+ status,
74
+ account: { address: receiverAddress, metadata: { token_id: "MINA" } },
75
+ operation_identifier: { index: 2 },
76
+ });
77
+ } else {
78
+ // Delegate change operation
79
+ operations.push({
80
+ type: "delegate_change",
81
+ status,
82
+ account: { address: senderAddress, metadata: { token_id: "MINA" } },
83
+ operation_identifier: { index: 0 },
84
+ });
85
+ }
86
+
87
+ return {
88
+ transaction: {
89
+ transaction_identifier: { hash: "tx_hash" },
90
+ operations,
91
+ metadata: { memo },
92
+ },
93
+ block_identifier: { index: 123, hash: "block_hash" },
94
+ timestamp: 1672531200000,
95
+ };
96
+ };
97
+
98
+ /**
99
+ * Creates a mock account info object for testing
100
+ */
101
+ export const createMockAccountInfo = (): AccountShapeInfo<Account> => ({
102
+ address: "test_address",
103
+ index: 0,
104
+ derivationPath: "m/44'/12586'/0'/0/0",
105
+ initialAccount: {
106
+ operations: [],
107
+ type: "Account",
108
+ id: "account_id",
109
+ seedIdentifier: "seed_identifier",
110
+ derivationMode: "minabip44",
111
+ index: 0,
112
+ freshAddress: "fresh_address",
113
+ freshAddressPath: "fresh_address_path",
114
+ used: true,
115
+ balance: new BigNumber(1000),
116
+ spendableBalance: new BigNumber(900),
117
+ creationDate: new Date(),
118
+ blockHeight: 123,
119
+ currency: getCryptoCurrencyById("mina") as CryptoCurrency,
120
+ operationsCount: 0,
121
+ pendingOperations: [],
122
+ lastSyncDate: new Date(),
123
+ subAccounts: [],
124
+ balanceHistoryCache: {
125
+ HOUR: { latestDate: null, balances: [] },
126
+ DAY: { latestDate: null, balances: [] },
127
+ WEEK: { latestDate: null, balances: [] },
128
+ },
129
+ swapHistory: [],
130
+ syncHash: undefined,
131
+ nfts: [],
132
+ },
133
+ currency: getCryptoCurrencyById("mina") as CryptoCurrency,
134
+ derivationMode: "minabip44",
135
+ });
136
+
137
+ /**
138
+ * Creates a mock Mina account for testing
139
+ */
140
+ export const createMockAccount = (overrides?: Partial<Account>): Account => ({
141
+ id: "mock_account_id",
142
+ freshAddress: "B62qiVhtBtqakq8sNTHdCTXn6tETSK6gtsmNHRn1WdLqjGLpsHbw1xc",
143
+ freshAddressPath: "44'/12586'/0'/0/0",
144
+ type: "Account",
145
+ seedIdentifier: "seed_identifier",
146
+ derivationMode: "minabip44",
147
+ index: 0,
148
+ used: true,
149
+ balance: new BigNumber(1000),
150
+ spendableBalance: new BigNumber(900),
151
+ creationDate: new Date(),
152
+ blockHeight: 123,
153
+ currency: getCryptoCurrencyById("mina") as CryptoCurrency,
154
+ operationsCount: 0,
155
+ pendingOperations: [],
156
+ lastSyncDate: new Date(),
157
+ subAccounts: [],
158
+ balanceHistoryCache: {
159
+ HOUR: { latestDate: null, balances: [] },
160
+ DAY: { latestDate: null, balances: [] },
161
+ WEEK: { latestDate: null, balances: [] },
162
+ },
163
+ swapHistory: [],
164
+ syncHash: undefined,
165
+ nfts: [],
166
+ operations: [],
167
+ ...overrides,
168
+ });
169
+
170
+ /**
171
+ * Creates a mock Mina transaction for testing
172
+ */
173
+ export const createMockTransaction = (overrides?: Partial<Transaction>): Transaction => ({
174
+ family: "mina",
175
+ amount: new BigNumber(1000),
176
+ recipient: "B62qr5cXFjdnZXYxP5dEwRY7wENxcod4Q2oLxUDiq1QrBXZZyxMH8q4",
177
+ fees: {
178
+ fee: new BigNumber(10),
179
+ accountCreationFee: new BigNumber(0),
180
+ },
181
+ memo: "test memo",
182
+ nonce: 1,
183
+ ...overrides,
184
+ });
185
+
186
+ /**
187
+ * Creates a mock unsigned transaction for testing
188
+ */
189
+ export const createMockUnsignedTransaction = (
190
+ account: Partial<Account> = createMockAccount(),
191
+ transaction: Partial<Transaction> = createMockTransaction(),
192
+ ): MinaUnsignedTransaction => ({
193
+ txType: 0,
194
+ senderAccount: 0,
195
+ senderAddress: account.freshAddress!,
196
+ receiverAddress: transaction.recipient!,
197
+ amount: transaction.amount!.toNumber(),
198
+ fee: transaction.fees!.fee.toNumber(),
199
+ nonce: transaction.nonce!,
200
+ memo: transaction.memo!,
201
+ networkId: 1,
202
+ });
203
+
204
+ /**
205
+ * Creates a mock device ID for testing
206
+ */
207
+ export const mockDeviceId: DeviceId = "mock_device_id";
208
+
209
+ /**
210
+ * Creates a mock signer context for testing
211
+ */
212
+ export const createMockSignerContext = (
213
+ signatureResponse: { returnCode: string; signature: string } = {
214
+ returnCode: "0x9000",
215
+ signature: "mock_raw_signature",
216
+ },
217
+ ): SignerContext<MinaSigner> =>
218
+ jest.fn().mockImplementation((deviceId, cb) => {
219
+ const mockSigner: MinaSigner = {
220
+ getAddress: jest.fn(),
221
+ signTransaction: jest.fn().mockResolvedValue(signatureResponse),
222
+ };
223
+ return cb(mockSigner);
224
+ });
225
+
226
+ // ... existing code ...
@@ -0,0 +1,3 @@
1
+ export * from "./bridgeDatasetTest";
2
+ export * from "./bot-specs";
3
+ export * from "./bot-deviceActions";
@@ -0,0 +1,9 @@
1
+ import { getRandomTransferID } from "./testUtils";
2
+
3
+ describe("testUtils", () => {
4
+ it("getRandomTransferID", () => {
5
+ const id = getRandomTransferID();
6
+ expect(id).toBeDefined();
7
+ expect(id.length).toBeGreaterThan(0);
8
+ });
9
+ });
@@ -0,0 +1,3 @@
1
+ export const getRandomTransferID = () => {
2
+ return Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
3
+ };
@@ -0,0 +1,70 @@
1
+ import type { BigNumber } from "bignumber.js";
2
+ import {
3
+ Account,
4
+ AccountRaw,
5
+ Operation,
6
+ TransactionCommon,
7
+ TransactionCommonRaw,
8
+ TransactionStatusCommon,
9
+ TransactionStatusCommonRaw,
10
+ } from "@ledgerhq/types-live";
11
+
12
+ export type Transaction = TransactionCommon & {
13
+ family: "mina";
14
+ fees: {
15
+ fee: BigNumber;
16
+ accountCreationFee: BigNumber;
17
+ };
18
+ memo: string | undefined;
19
+ nonce: number;
20
+ };
21
+
22
+ export type TransactionRaw = TransactionCommonRaw & {
23
+ family: "mina";
24
+ fees: {
25
+ fee: string;
26
+ accountCreationFee: string;
27
+ };
28
+ memo: string | undefined;
29
+ nonce: number;
30
+ };
31
+
32
+ export type MinaAccount = Account;
33
+
34
+ export type MinaAPIAccount = {
35
+ blockHeight: number;
36
+ balance: BigNumber;
37
+ spendableBalance: BigNumber;
38
+ };
39
+
40
+ export type MinaAccountRaw = AccountRaw;
41
+
42
+ export type TransactionStatus = TransactionStatusCommon;
43
+
44
+ export type TransactionStatusRaw = TransactionStatusCommonRaw;
45
+
46
+ export type StatusErrorMap = {
47
+ recipient?: Error;
48
+ amount?: Error;
49
+ fees?: Error;
50
+ transaction?: Error;
51
+ };
52
+
53
+ export type MinaUnsignedTransaction = {
54
+ txType: number;
55
+ senderAccount: number;
56
+ senderAddress: string;
57
+ receiverAddress: string;
58
+ amount: number;
59
+ fee: number;
60
+ nonce: number;
61
+ memo: string;
62
+ networkId: number;
63
+ };
64
+
65
+ export interface MinaSignedTransaction {
66
+ signature: string;
67
+ transaction: MinaUnsignedTransaction;
68
+ }
69
+
70
+ export type MinaOperation = Operation<{ memo: string | undefined; accountCreationFee: string }>;
@@ -0,0 +1,2 @@
1
+ export * from "./common";
2
+ export * from "./signer";
@@ -0,0 +1,29 @@
1
+ interface SignTransactionArgs {
2
+ txType: number;
3
+ senderAccount: number;
4
+ senderAddress: string;
5
+ receiverAddress: string;
6
+ amount: number;
7
+ fee: number;
8
+ nonce: number;
9
+ validUntil?: number;
10
+ memo?: string;
11
+ networkId: number;
12
+ }
13
+ interface BaseLedgerResponse {
14
+ returnCode: string;
15
+ statusText?: string;
16
+ message?: string;
17
+ }
18
+ interface SignTransactionResponse extends BaseLedgerResponse {
19
+ signature?: string | null;
20
+ }
21
+
22
+ export interface GetAddressResponse extends BaseLedgerResponse {
23
+ publicKey?: string | null;
24
+ }
25
+ export type MinaSignature = { signature?: string };
26
+ export interface MinaSigner {
27
+ getAddress(account?: number, verify?: boolean): Promise<GetAddressResponse>;
28
+ signTransaction(transaction: SignTransactionArgs): Promise<SignTransactionResponse>;
29
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,13 @@
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
+ "rootDir": "./src"
11
+ },
12
+ "include": ["src/**/*"]
13
+ }