@ledgerhq/coin-aptos 1.4.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 (439) hide show
  1. package/.turbo/turbo-build.log +4 -0
  2. package/.unimportedrc.json +16 -0
  3. package/CHANGELOG.md +18 -0
  4. package/LICENSE.txt +21 -0
  5. package/jest.config.js +8 -0
  6. package/lib/__tests__/api/index.test.d.ts +2 -0
  7. package/lib/__tests__/api/index.test.d.ts.map +1 -0
  8. package/lib/__tests__/api/index.test.js +447 -0
  9. package/lib/__tests__/api/index.test.js.map +1 -0
  10. package/lib/__tests__/bridge/broadcast.test.d.ts +2 -0
  11. package/lib/__tests__/bridge/broadcast.test.d.ts.map +1 -0
  12. package/lib/__tests__/bridge/broadcast.test.js +98 -0
  13. package/lib/__tests__/bridge/broadcast.test.js.map +1 -0
  14. package/lib/__tests__/bridge/buildTransaction.test.d.ts +2 -0
  15. package/lib/__tests__/bridge/buildTransaction.test.d.ts.map +1 -0
  16. package/lib/__tests__/bridge/buildTransaction.test.js +62 -0
  17. package/lib/__tests__/bridge/buildTransaction.test.js.map +1 -0
  18. package/lib/__tests__/bridge/createTransaction.test.d.ts +2 -0
  19. package/lib/__tests__/bridge/createTransaction.test.d.ts.map +1 -0
  20. package/lib/__tests__/bridge/createTransaction.test.js +38 -0
  21. package/lib/__tests__/bridge/createTransaction.test.js.map +1 -0
  22. package/lib/__tests__/bridge/deviceTransactionConfig.test.d.ts +2 -0
  23. package/lib/__tests__/bridge/deviceTransactionConfig.test.d.ts.map +1 -0
  24. package/lib/__tests__/bridge/deviceTransactionConfig.test.js +43 -0
  25. package/lib/__tests__/bridge/deviceTransactionConfig.test.js.map +1 -0
  26. package/lib/__tests__/bridge/estimateMaxSpendable.test.d.ts +2 -0
  27. package/lib/__tests__/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
  28. package/lib/__tests__/bridge/estimateMaxSpendable.test.js +84 -0
  29. package/lib/__tests__/bridge/estimateMaxSpendable.test.js.map +1 -0
  30. package/lib/__tests__/bridge/getFeesForTransaction.test.d.ts +2 -0
  31. package/lib/__tests__/bridge/getFeesForTransaction.test.d.ts.map +1 -0
  32. package/lib/__tests__/bridge/getFeesForTransaction.test.js +188 -0
  33. package/lib/__tests__/bridge/getFeesForTransaction.test.js.map +1 -0
  34. package/lib/__tests__/bridge/getTransactionStatus.test.d.ts +2 -0
  35. package/lib/__tests__/bridge/getTransactionStatus.test.d.ts.map +1 -0
  36. package/lib/__tests__/bridge/getTransactionStatus.test.js +133 -0
  37. package/lib/__tests__/bridge/getTransactionStatus.test.js.map +1 -0
  38. package/lib/__tests__/bridge/index.test.d.ts +2 -0
  39. package/lib/__tests__/bridge/index.test.d.ts.map +1 -0
  40. package/lib/__tests__/bridge/index.test.js +116 -0
  41. package/lib/__tests__/bridge/index.test.js.map +1 -0
  42. package/lib/__tests__/bridge/logic.test.d.ts +2 -0
  43. package/lib/__tests__/bridge/logic.test.d.ts.map +1 -0
  44. package/lib/__tests__/bridge/logic.test.js +773 -0
  45. package/lib/__tests__/bridge/logic.test.js.map +1 -0
  46. package/lib/__tests__/bridge/prepareTransaction.test.d.ts +2 -0
  47. package/lib/__tests__/bridge/prepareTransaction.test.d.ts.map +1 -0
  48. package/lib/__tests__/bridge/prepareTransaction.test.js +121 -0
  49. package/lib/__tests__/bridge/prepareTransaction.test.js.map +1 -0
  50. package/lib/__tests__/bridge/signOperation.test.d.ts +2 -0
  51. package/lib/__tests__/bridge/signOperation.test.d.ts.map +1 -0
  52. package/lib/__tests__/bridge/signOperation.test.js +185 -0
  53. package/lib/__tests__/bridge/signOperation.test.js.map +1 -0
  54. package/lib/__tests__/bridge/synchronisation.test.d.ts +2 -0
  55. package/lib/__tests__/bridge/synchronisation.test.d.ts.map +1 -0
  56. package/lib/__tests__/bridge/synchronisation.test.js +349 -0
  57. package/lib/__tests__/bridge/synchronisation.test.js.map +1 -0
  58. package/lib/__tests__/bridge/transaction.test.d.ts +2 -0
  59. package/lib/__tests__/bridge/transaction.test.d.ts.map +1 -0
  60. package/lib/__tests__/bridge/transaction.test.js +231 -0
  61. package/lib/__tests__/bridge/transaction.test.js.map +1 -0
  62. package/lib/__tests__/errors.test.d.ts +2 -0
  63. package/lib/__tests__/errors.test.d.ts.map +1 -0
  64. package/lib/__tests__/errors.test.js +18 -0
  65. package/lib/__tests__/errors.test.js.map +1 -0
  66. package/lib/__tests__/index.test.d.ts +2 -0
  67. package/lib/__tests__/index.test.d.ts.map +1 -0
  68. package/lib/__tests__/index.test.js +27 -0
  69. package/lib/__tests__/index.test.js.map +1 -0
  70. package/lib/__tests__/network/index.test.d.ts +2 -0
  71. package/lib/__tests__/network/index.test.d.ts.map +1 -0
  72. package/lib/__tests__/network/index.test.js +57 -0
  73. package/lib/__tests__/network/index.test.js.map +1 -0
  74. package/lib/__tests__/signer/index.test.d.ts +2 -0
  75. package/lib/__tests__/signer/index.test.d.ts.map +1 -0
  76. package/lib/__tests__/signer/index.test.js +37 -0
  77. package/lib/__tests__/signer/index.test.js.map +1 -0
  78. package/lib/api/graphql/queries.d.ts +5 -0
  79. package/lib/api/graphql/queries.d.ts.map +1 -0
  80. package/lib/api/graphql/queries.js +56 -0
  81. package/lib/api/graphql/queries.js.map +1 -0
  82. package/lib/api/graphql/types.d.ts +79 -0
  83. package/lib/api/graphql/types.d.ts.map +1 -0
  84. package/lib/api/graphql/types.js +3 -0
  85. package/lib/api/graphql/types.js.map +1 -0
  86. package/lib/api/index.d.ts +31 -0
  87. package/lib/api/index.d.ts.map +1 -0
  88. package/lib/api/index.js +200 -0
  89. package/lib/api/index.js.map +1 -0
  90. package/lib/bridge/bridge.fixture.d.ts +4 -0
  91. package/lib/bridge/bridge.fixture.d.ts.map +1 -0
  92. package/lib/bridge/bridge.fixture.js +56 -0
  93. package/lib/bridge/bridge.fixture.js.map +1 -0
  94. package/lib/bridge/broadcast.d.ts +7 -0
  95. package/lib/bridge/broadcast.d.ts.map +1 -0
  96. package/lib/bridge/broadcast.js +20 -0
  97. package/lib/bridge/broadcast.js.map +1 -0
  98. package/lib/bridge/buildTransaction.d.ts +7 -0
  99. package/lib/bridge/buildTransaction.d.ts.map +1 -0
  100. package/lib/bridge/buildTransaction.js +28 -0
  101. package/lib/bridge/buildTransaction.js.map +1 -0
  102. package/lib/bridge/createTransaction.d.ts +4 -0
  103. package/lib/bridge/createTransaction.d.ts.map +1 -0
  104. package/lib/bridge/createTransaction.js +20 -0
  105. package/lib/bridge/createTransaction.js.map +1 -0
  106. package/lib/bridge/deviceTransactionConfig.d.ts +11 -0
  107. package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
  108. package/lib/bridge/deviceTransactionConfig.js +23 -0
  109. package/lib/bridge/deviceTransactionConfig.js.map +1 -0
  110. package/lib/bridge/estimateMaxSpendable.d.ts +10 -0
  111. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
  112. package/lib/bridge/estimateMaxSpendable.js +30 -0
  113. package/lib/bridge/estimateMaxSpendable.js.map +1 -0
  114. package/lib/bridge/getFeesForTransaction.d.ts +16 -0
  115. package/lib/bridge/getFeesForTransaction.d.ts.map +1 -0
  116. package/lib/bridge/getFeesForTransaction.js +74 -0
  117. package/lib/bridge/getFeesForTransaction.js.map +1 -0
  118. package/lib/bridge/getTransactionStatus.d.ts +5 -0
  119. package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
  120. package/lib/bridge/getTransactionStatus.js +48 -0
  121. package/lib/bridge/getTransactionStatus.js.map +1 -0
  122. package/lib/bridge/index.d.ts +8 -0
  123. package/lib/bridge/index.d.ts.map +1 -0
  124. package/lib/bridge/index.js +54 -0
  125. package/lib/bridge/index.js.map +1 -0
  126. package/lib/bridge/logic.d.ts +24 -0
  127. package/lib/bridge/logic.d.ts.map +1 -0
  128. package/lib/bridge/logic.js +200 -0
  129. package/lib/bridge/logic.js.map +1 -0
  130. package/lib/bridge/prepareTransaction.d.ts +5 -0
  131. package/lib/bridge/prepareTransaction.d.ts.map +1 -0
  132. package/lib/bridge/prepareTransaction.js +44 -0
  133. package/lib/bridge/prepareTransaction.js.map +1 -0
  134. package/lib/bridge/signOperation.d.ts +11 -0
  135. package/lib/bridge/signOperation.d.ts.map +1 -0
  136. package/lib/bridge/signOperation.js +77 -0
  137. package/lib/bridge/signOperation.js.map +1 -0
  138. package/lib/bridge/synchronisation.d.ts +3 -0
  139. package/lib/bridge/synchronisation.d.ts.map +1 -0
  140. package/lib/bridge/synchronisation.js +53 -0
  141. package/lib/bridge/synchronisation.js.map +1 -0
  142. package/lib/bridge/transaction.d.ts +15 -0
  143. package/lib/bridge/transaction.d.ts.map +1 -0
  144. package/lib/bridge/transaction.js +37 -0
  145. package/lib/bridge/transaction.js.map +1 -0
  146. package/lib/constants.d.ts +19 -0
  147. package/lib/constants.d.ts.map +1 -0
  148. package/lib/constants.js +33 -0
  149. package/lib/constants.js.map +1 -0
  150. package/lib/errors.d.ts +10 -0
  151. package/lib/errors.d.ts.map +1 -0
  152. package/lib/errors.js +8 -0
  153. package/lib/errors.js.map +1 -0
  154. package/lib/index.d.ts +3 -0
  155. package/lib/index.d.ts.map +1 -0
  156. package/lib/index.js +21 -0
  157. package/lib/index.js.map +1 -0
  158. package/lib/network/index.d.ts +6 -0
  159. package/lib/network/index.d.ts.map +1 -0
  160. package/lib/network/index.js +39 -0
  161. package/lib/network/index.js.map +1 -0
  162. package/lib/signer/index.d.ts +6 -0
  163. package/lib/signer/index.d.ts.map +1 -0
  164. package/lib/signer/index.js +23 -0
  165. package/lib/signer/index.js.map +1 -0
  166. package/lib/test/bot-specs.d.ts +7 -0
  167. package/lib/test/bot-specs.d.ts.map +1 -0
  168. package/lib/test/bot-specs.js +77 -0
  169. package/lib/test/bot-specs.js.map +1 -0
  170. package/lib/test/bridgeDatasetTest.d.ts +4 -0
  171. package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
  172. package/lib/test/bridgeDatasetTest.js +85 -0
  173. package/lib/test/bridgeDatasetTest.js.map +1 -0
  174. package/lib/test/cli.d.ts +19 -0
  175. package/lib/test/cli.d.ts.map +1 -0
  176. package/lib/test/cli.js +59 -0
  177. package/lib/test/cli.js.map +1 -0
  178. package/lib/test/index.d.ts +4 -0
  179. package/lib/test/index.d.ts.map +1 -0
  180. package/lib/test/index.js +20 -0
  181. package/lib/test/index.js.map +1 -0
  182. package/lib/test/speculos-deviceActions.d.ts +5 -0
  183. package/lib/test/speculos-deviceActions.d.ts.map +1 -0
  184. package/lib/test/speculos-deviceActions.js +46 -0
  185. package/lib/test/speculos-deviceActions.js.map +1 -0
  186. package/lib/types/bridge.d.ts +5 -0
  187. package/lib/types/bridge.d.ts.map +1 -0
  188. package/lib/types/bridge.js +9 -0
  189. package/lib/types/bridge.js.map +1 -0
  190. package/lib/types/index.d.ts +62 -0
  191. package/lib/types/index.d.ts.map +1 -0
  192. package/lib/types/index.js +19 -0
  193. package/lib/types/index.js.map +1 -0
  194. package/lib/types/signer.d.ts +27 -0
  195. package/lib/types/signer.d.ts.map +1 -0
  196. package/lib/types/signer.js +3 -0
  197. package/lib/types/signer.js.map +1 -0
  198. package/lib-es/__tests__/api/index.test.d.ts +2 -0
  199. package/lib-es/__tests__/api/index.test.d.ts.map +1 -0
  200. package/lib-es/__tests__/api/index.test.js +442 -0
  201. package/lib-es/__tests__/api/index.test.js.map +1 -0
  202. package/lib-es/__tests__/bridge/broadcast.test.d.ts +2 -0
  203. package/lib-es/__tests__/bridge/broadcast.test.d.ts.map +1 -0
  204. package/lib-es/__tests__/bridge/broadcast.test.js +93 -0
  205. package/lib-es/__tests__/bridge/broadcast.test.js.map +1 -0
  206. package/lib-es/__tests__/bridge/buildTransaction.test.d.ts +2 -0
  207. package/lib-es/__tests__/bridge/buildTransaction.test.d.ts.map +1 -0
  208. package/lib-es/__tests__/bridge/buildTransaction.test.js +57 -0
  209. package/lib-es/__tests__/bridge/buildTransaction.test.js.map +1 -0
  210. package/lib-es/__tests__/bridge/createTransaction.test.d.ts +2 -0
  211. package/lib-es/__tests__/bridge/createTransaction.test.d.ts.map +1 -0
  212. package/lib-es/__tests__/bridge/createTransaction.test.js +33 -0
  213. package/lib-es/__tests__/bridge/createTransaction.test.js.map +1 -0
  214. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.d.ts +2 -0
  215. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.d.ts.map +1 -0
  216. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.js +18 -0
  217. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.js.map +1 -0
  218. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.d.ts +2 -0
  219. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
  220. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.js +79 -0
  221. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.js.map +1 -0
  222. package/lib-es/__tests__/bridge/getFeesForTransaction.test.d.ts +2 -0
  223. package/lib-es/__tests__/bridge/getFeesForTransaction.test.d.ts.map +1 -0
  224. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js +160 -0
  225. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js.map +1 -0
  226. package/lib-es/__tests__/bridge/getTransactionStatus.test.d.ts +2 -0
  227. package/lib-es/__tests__/bridge/getTransactionStatus.test.d.ts.map +1 -0
  228. package/lib-es/__tests__/bridge/getTransactionStatus.test.js +128 -0
  229. package/lib-es/__tests__/bridge/getTransactionStatus.test.js.map +1 -0
  230. package/lib-es/__tests__/bridge/index.test.d.ts +2 -0
  231. package/lib-es/__tests__/bridge/index.test.d.ts.map +1 -0
  232. package/lib-es/__tests__/bridge/index.test.js +111 -0
  233. package/lib-es/__tests__/bridge/index.test.js.map +1 -0
  234. package/lib-es/__tests__/bridge/logic.test.d.ts +2 -0
  235. package/lib-es/__tests__/bridge/logic.test.d.ts.map +1 -0
  236. package/lib-es/__tests__/bridge/logic.test.js +768 -0
  237. package/lib-es/__tests__/bridge/logic.test.js.map +1 -0
  238. package/lib-es/__tests__/bridge/prepareTransaction.test.d.ts +2 -0
  239. package/lib-es/__tests__/bridge/prepareTransaction.test.d.ts.map +1 -0
  240. package/lib-es/__tests__/bridge/prepareTransaction.test.js +116 -0
  241. package/lib-es/__tests__/bridge/prepareTransaction.test.js.map +1 -0
  242. package/lib-es/__tests__/bridge/signOperation.test.d.ts +2 -0
  243. package/lib-es/__tests__/bridge/signOperation.test.d.ts.map +1 -0
  244. package/lib-es/__tests__/bridge/signOperation.test.js +157 -0
  245. package/lib-es/__tests__/bridge/signOperation.test.js.map +1 -0
  246. package/lib-es/__tests__/bridge/synchronisation.test.d.ts +2 -0
  247. package/lib-es/__tests__/bridge/synchronisation.test.d.ts.map +1 -0
  248. package/lib-es/__tests__/bridge/synchronisation.test.js +347 -0
  249. package/lib-es/__tests__/bridge/synchronisation.test.js.map +1 -0
  250. package/lib-es/__tests__/bridge/transaction.test.d.ts +2 -0
  251. package/lib-es/__tests__/bridge/transaction.test.d.ts.map +1 -0
  252. package/lib-es/__tests__/bridge/transaction.test.js +226 -0
  253. package/lib-es/__tests__/bridge/transaction.test.js.map +1 -0
  254. package/lib-es/__tests__/errors.test.d.ts +2 -0
  255. package/lib-es/__tests__/errors.test.d.ts.map +1 -0
  256. package/lib-es/__tests__/errors.test.js +16 -0
  257. package/lib-es/__tests__/errors.test.js.map +1 -0
  258. package/lib-es/__tests__/index.test.d.ts +2 -0
  259. package/lib-es/__tests__/index.test.d.ts.map +1 -0
  260. package/lib-es/__tests__/index.test.js +25 -0
  261. package/lib-es/__tests__/index.test.js.map +1 -0
  262. package/lib-es/__tests__/network/index.test.d.ts +2 -0
  263. package/lib-es/__tests__/network/index.test.d.ts.map +1 -0
  264. package/lib-es/__tests__/network/index.test.js +55 -0
  265. package/lib-es/__tests__/network/index.test.js.map +1 -0
  266. package/lib-es/__tests__/signer/index.test.d.ts +2 -0
  267. package/lib-es/__tests__/signer/index.test.d.ts.map +1 -0
  268. package/lib-es/__tests__/signer/index.test.js +32 -0
  269. package/lib-es/__tests__/signer/index.test.js.map +1 -0
  270. package/lib-es/api/graphql/queries.d.ts +5 -0
  271. package/lib-es/api/graphql/queries.d.ts.map +1 -0
  272. package/lib-es/api/graphql/queries.js +53 -0
  273. package/lib-es/api/graphql/queries.js.map +1 -0
  274. package/lib-es/api/graphql/types.d.ts +79 -0
  275. package/lib-es/api/graphql/types.d.ts.map +1 -0
  276. package/lib-es/api/graphql/types.js +2 -0
  277. package/lib-es/api/graphql/types.js.map +1 -0
  278. package/lib-es/api/index.d.ts +31 -0
  279. package/lib-es/api/index.d.ts.map +1 -0
  280. package/lib-es/api/index.js +193 -0
  281. package/lib-es/api/index.js.map +1 -0
  282. package/lib-es/bridge/bridge.fixture.d.ts +4 -0
  283. package/lib-es/bridge/bridge.fixture.d.ts.map +1 -0
  284. package/lib-es/bridge/bridge.fixture.js +48 -0
  285. package/lib-es/bridge/bridge.fixture.js.map +1 -0
  286. package/lib-es/bridge/broadcast.d.ts +7 -0
  287. package/lib-es/bridge/broadcast.d.ts.map +1 -0
  288. package/lib-es/bridge/broadcast.js +18 -0
  289. package/lib-es/bridge/broadcast.js.map +1 -0
  290. package/lib-es/bridge/buildTransaction.d.ts +7 -0
  291. package/lib-es/bridge/buildTransaction.d.ts.map +1 -0
  292. package/lib-es/bridge/buildTransaction.js +26 -0
  293. package/lib-es/bridge/buildTransaction.js.map +1 -0
  294. package/lib-es/bridge/createTransaction.d.ts +4 -0
  295. package/lib-es/bridge/createTransaction.d.ts.map +1 -0
  296. package/lib-es/bridge/createTransaction.js +15 -0
  297. package/lib-es/bridge/createTransaction.js.map +1 -0
  298. package/lib-es/bridge/deviceTransactionConfig.d.ts +11 -0
  299. package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
  300. package/lib-es/bridge/deviceTransactionConfig.js +19 -0
  301. package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
  302. package/lib-es/bridge/estimateMaxSpendable.d.ts +10 -0
  303. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
  304. package/lib-es/bridge/estimateMaxSpendable.js +28 -0
  305. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
  306. package/lib-es/bridge/getFeesForTransaction.d.ts +16 -0
  307. package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -0
  308. package/lib-es/bridge/getFeesForTransaction.js +66 -0
  309. package/lib-es/bridge/getFeesForTransaction.js.map +1 -0
  310. package/lib-es/bridge/getTransactionStatus.d.ts +5 -0
  311. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
  312. package/lib-es/bridge/getTransactionStatus.js +46 -0
  313. package/lib-es/bridge/getTransactionStatus.js.map +1 -0
  314. package/lib-es/bridge/index.d.ts +8 -0
  315. package/lib-es/bridge/index.d.ts.map +1 -0
  316. package/lib-es/bridge/index.js +47 -0
  317. package/lib-es/bridge/index.js.map +1 -0
  318. package/lib-es/bridge/logic.d.ts +24 -0
  319. package/lib-es/bridge/logic.d.ts.map +1 -0
  320. package/lib-es/bridge/logic.js +183 -0
  321. package/lib-es/bridge/logic.js.map +1 -0
  322. package/lib-es/bridge/prepareTransaction.d.ts +5 -0
  323. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
  324. package/lib-es/bridge/prepareTransaction.js +39 -0
  325. package/lib-es/bridge/prepareTransaction.js.map +1 -0
  326. package/lib-es/bridge/signOperation.d.ts +11 -0
  327. package/lib-es/bridge/signOperation.d.ts.map +1 -0
  328. package/lib-es/bridge/signOperation.js +70 -0
  329. package/lib-es/bridge/signOperation.js.map +1 -0
  330. package/lib-es/bridge/synchronisation.d.ts +3 -0
  331. package/lib-es/bridge/synchronisation.d.ts.map +1 -0
  332. package/lib-es/bridge/synchronisation.js +49 -0
  333. package/lib-es/bridge/synchronisation.js.map +1 -0
  334. package/lib-es/bridge/transaction.d.ts +15 -0
  335. package/lib-es/bridge/transaction.d.ts.map +1 -0
  336. package/lib-es/bridge/transaction.js +31 -0
  337. package/lib-es/bridge/transaction.js.map +1 -0
  338. package/lib-es/constants.d.ts +19 -0
  339. package/lib-es/constants.d.ts.map +1 -0
  340. package/lib-es/constants.js +30 -0
  341. package/lib-es/constants.js.map +1 -0
  342. package/lib-es/errors.d.ts +10 -0
  343. package/lib-es/errors.d.ts.map +1 -0
  344. package/lib-es/errors.js +5 -0
  345. package/lib-es/errors.js.map +1 -0
  346. package/lib-es/index.d.ts +3 -0
  347. package/lib-es/index.d.ts.map +1 -0
  348. package/lib-es/index.js +3 -0
  349. package/lib-es/index.js.map +1 -0
  350. package/lib-es/network/index.d.ts +6 -0
  351. package/lib-es/network/index.d.ts.map +1 -0
  352. package/lib-es/network/index.js +35 -0
  353. package/lib-es/network/index.js.map +1 -0
  354. package/lib-es/signer/index.d.ts +6 -0
  355. package/lib-es/signer/index.d.ts.map +1 -0
  356. package/lib-es/signer/index.js +21 -0
  357. package/lib-es/signer/index.js.map +1 -0
  358. package/lib-es/test/bot-specs.d.ts +7 -0
  359. package/lib-es/test/bot-specs.d.ts.map +1 -0
  360. package/lib-es/test/bot-specs.js +72 -0
  361. package/lib-es/test/bot-specs.js.map +1 -0
  362. package/lib-es/test/bridgeDatasetTest.d.ts +4 -0
  363. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
  364. package/lib-es/test/bridgeDatasetTest.js +79 -0
  365. package/lib-es/test/bridgeDatasetTest.js.map +1 -0
  366. package/lib-es/test/cli.d.ts +19 -0
  367. package/lib-es/test/cli.d.ts.map +1 -0
  368. package/lib-es/test/cli.js +53 -0
  369. package/lib-es/test/cli.js.map +1 -0
  370. package/lib-es/test/index.d.ts +4 -0
  371. package/lib-es/test/index.d.ts.map +1 -0
  372. package/lib-es/test/index.js +4 -0
  373. package/lib-es/test/index.js.map +1 -0
  374. package/lib-es/test/speculos-deviceActions.d.ts +5 -0
  375. package/lib-es/test/speculos-deviceActions.d.ts.map +1 -0
  376. package/lib-es/test/speculos-deviceActions.js +43 -0
  377. package/lib-es/test/speculos-deviceActions.js.map +1 -0
  378. package/lib-es/types/bridge.d.ts +5 -0
  379. package/lib-es/types/bridge.d.ts.map +1 -0
  380. package/lib-es/types/bridge.js +6 -0
  381. package/lib-es/types/bridge.js.map +1 -0
  382. package/lib-es/types/index.d.ts +62 -0
  383. package/lib-es/types/index.d.ts.map +1 -0
  384. package/lib-es/types/index.js +3 -0
  385. package/lib-es/types/index.js.map +1 -0
  386. package/lib-es/types/signer.d.ts +27 -0
  387. package/lib-es/types/signer.d.ts.map +1 -0
  388. package/lib-es/types/signer.js +2 -0
  389. package/lib-es/types/signer.js.map +1 -0
  390. package/package.json +124 -0
  391. package/src/__tests__/api/index.test.ts +499 -0
  392. package/src/__tests__/bridge/broadcast.test.ts +98 -0
  393. package/src/__tests__/bridge/buildTransaction.test.ts +61 -0
  394. package/src/__tests__/bridge/createTransaction.test.ts +27 -0
  395. package/src/__tests__/bridge/deviceTransactionConfig.test.ts +19 -0
  396. package/src/__tests__/bridge/estimateMaxSpendable.test.ts +94 -0
  397. package/src/__tests__/bridge/getFeesForTransaction.test.ts +189 -0
  398. package/src/__tests__/bridge/getTransactionStatus.test.ts +155 -0
  399. package/src/__tests__/bridge/index.test.ts +108 -0
  400. package/src/__tests__/bridge/logic.test.ts +876 -0
  401. package/src/__tests__/bridge/prepareTransaction.test.ts +118 -0
  402. package/src/__tests__/bridge/signOperation.test.ts +178 -0
  403. package/src/__tests__/bridge/synchronisation.test.ts +374 -0
  404. package/src/__tests__/bridge/transaction.test.ts +261 -0
  405. package/src/__tests__/errors.test.ts +25 -0
  406. package/src/__tests__/index.test.ts +26 -0
  407. package/src/__tests__/network/index.test.ts +95 -0
  408. package/src/__tests__/signer/index.test.ts +24 -0
  409. package/src/api/graphql/queries.ts +53 -0
  410. package/src/api/graphql/types.ts +85 -0
  411. package/src/api/index.ts +224 -0
  412. package/src/bridge/bridge.fixture.ts +53 -0
  413. package/src/bridge/broadcast.ts +17 -0
  414. package/src/bridge/buildTransaction.ts +29 -0
  415. package/src/bridge/createTransaction.ts +17 -0
  416. package/src/bridge/deviceTransactionConfig.ts +30 -0
  417. package/src/bridge/estimateMaxSpendable.ts +35 -0
  418. package/src/bridge/getFeesForTransaction.ts +87 -0
  419. package/src/bridge/getTransactionStatus.ts +54 -0
  420. package/src/bridge/index.ts +65 -0
  421. package/src/bridge/logic.ts +265 -0
  422. package/src/bridge/prepareTransaction.ts +55 -0
  423. package/src/bridge/signOperation.ts +82 -0
  424. package/src/bridge/synchronisation.ts +50 -0
  425. package/src/bridge/transaction.ts +61 -0
  426. package/src/constants.ts +34 -0
  427. package/src/errors.ts +7 -0
  428. package/src/index.ts +3 -0
  429. package/src/network/index.ts +54 -0
  430. package/src/signer/index.ts +17 -0
  431. package/src/test/bot-specs.ts +86 -0
  432. package/src/test/bridgeDatasetTest.ts +82 -0
  433. package/src/test/cli.ts +80 -0
  434. package/src/test/index.ts +3 -0
  435. package/src/test/speculos-deviceActions.ts +52 -0
  436. package/src/types/bridge.ts +4 -0
  437. package/src/types/index.ts +74 -0
  438. package/src/types/signer.ts +26 -0
  439. package/tsconfig.json +14 -0
@@ -0,0 +1,86 @@
1
+ import invariant from "invariant";
2
+ import { DeviceModelId } from "@ledgerhq/devices";
3
+ import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
4
+ import { parseCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
5
+ import { botTest, genericTestDestination, pickSiblings } from "@ledgerhq/coin-framework/bot/specs";
6
+ import type { AppSpec } from "@ledgerhq/coin-framework/bot/types";
7
+ import { acceptTransaction } from "./speculos-deviceActions";
8
+ import type { Transaction } from "../types";
9
+
10
+ const currency = getCryptoCurrencyById("aptos");
11
+ const minBalanceNewAccount = parseCurrencyUnit(currency.units[0], "0.0001");
12
+ const maxAccountSiblings = 4;
13
+
14
+ const aptos: AppSpec<Transaction> = {
15
+ name: "Aptos",
16
+ currency,
17
+ appQuery: {
18
+ model: DeviceModelId.nanoSP,
19
+ appName: "Aptos",
20
+ },
21
+ genericDeviceAction: acceptTransaction,
22
+ testTimeout: 5 * 60 * 1000,
23
+ minViableAmount: minBalanceNewAccount,
24
+ transactionCheck: ({ maxSpendable }) => {
25
+ invariant(maxSpendable.gt(minBalanceNewAccount), "balance is too low");
26
+ },
27
+ mutations: [
28
+ {
29
+ name: "Send ~50%",
30
+ feature: "send",
31
+ maxRun: 1,
32
+ testDestination: genericTestDestination,
33
+ transaction: ({ account, siblings, bridge, maxSpendable }) => {
34
+ invariant(maxSpendable.gt(minBalanceNewAccount), "balance is too low");
35
+
36
+ const sibling = pickSiblings(siblings, maxAccountSiblings);
37
+ const recipient = sibling.freshAddress;
38
+ const amount = maxSpendable.div(2).integerValue();
39
+
40
+ const transaction = bridge.createTransaction(account);
41
+ const updates: Array<Partial<Transaction>> = [
42
+ {
43
+ recipient,
44
+ },
45
+ { amount },
46
+ ];
47
+
48
+ return {
49
+ transaction,
50
+ updates,
51
+ };
52
+ },
53
+ test: ({ account, accountBeforeTransaction, operation }) => {
54
+ botTest("account balance moved with operation.value", () =>
55
+ expect(account.balance.toString()).toBe(
56
+ accountBeforeTransaction.balance.minus(operation.value).toString(),
57
+ ),
58
+ );
59
+ },
60
+ },
61
+ {
62
+ name: "Send max",
63
+ maxRun: 2,
64
+ testDestination: genericTestDestination,
65
+ transaction: ({ account, siblings, bridge }) => {
66
+ const sibling = pickSiblings(siblings, 4);
67
+ const recipient = sibling.freshAddress;
68
+ const transaction = bridge.createTransaction(account);
69
+
70
+ return {
71
+ transaction,
72
+ updates: [{ recipient }, { useAllAmount: true }],
73
+ };
74
+ },
75
+ test: ({ account, accountBeforeTransaction, operation }) => {
76
+ botTest("Account balance should have decreased", () => {
77
+ expect(account.balance.toNumber()).toEqual(
78
+ accountBeforeTransaction.balance.minus(operation.value).toNumber(),
79
+ );
80
+ });
81
+ },
82
+ },
83
+ ],
84
+ };
85
+
86
+ export default { aptos };
@@ -0,0 +1,82 @@
1
+ import { CurrenciesData, DatasetTest } from "@ledgerhq/types-live";
2
+ import BigNumber from "bignumber.js";
3
+ import { fromTransactionRaw } from "../bridge/transaction";
4
+ import { Transaction } from "../types";
5
+
6
+ const aptos: CurrenciesData<Transaction> = {
7
+ scanAccounts: [
8
+ {
9
+ name: "aptos seed 1",
10
+ apdus: `
11
+ => 5b0500000d038000002c8000027d80000000
12
+ <= 210430cfd94a543eca9ba9d26eafe07f6c28e1e43e4768f3c0bad32efeced8662f8720b44227ab88ddefa2ff5deb5e366c70e8b703aec381de39b103dd50eabf8d9d119000
13
+ => 5b05000015058000002c8000027d800000008000000080000000
14
+ <= 21044b16bdc2f72ea4502a8c4879c72e71d4d1a8ec46c43620e00a6f46e0b7569c6b20ba21e074c2bd6b307a35c85afd6ad40dc8319af9ec11660c588ffd3e413773259000
15
+ => 5b05000015058000002c8000027d800000018000000080000000
16
+ <= 21049aec773c4b645bba274924e2e8aeea525ba37051c94bfd922b60c87b1692091e207fa1d1caa1209d35fafe59393bc820bb7b0b81f3a808dd3728e0b1347bfff40e9000
17
+ => 5b05000015058000002c8000027d800000028000000080000000
18
+ <= 21041fb77263c646810574525025561e4559c338b571f57f1b513d75b1609d5fa5f6205e9117d152b467fac631d742ddbc31ea3cbcaac51273c1e931058a56e983d9f59000
19
+ `,
20
+ },
21
+ ],
22
+ accounts: [
23
+ {
24
+ raw: {
25
+ id: "js:2:aptos:d1a8c6a1cdd52dd40c7ea61ee4571fb51fcae440a594c1eca18636928f1d3956:",
26
+ seedIdentifier: "d6816f4f22f867b56cf9304b776f452a16d107835d73ee8a33c4ced210300583",
27
+ used: true,
28
+ derivationMode: "",
29
+ index: 0,
30
+ freshAddress: "0x445fa0013887abd1a0c14acdec6e48090e0ad3fed3e08202aac15ca14f3be26b",
31
+ freshAddressPath: "44'/637'/0'/0/0",
32
+ blockHeight: 266360751,
33
+ creationDate: "2024-12-18T12:26:31.070Z",
34
+ operationsCount: 5,
35
+ operations: [],
36
+ pendingOperations: [],
37
+ currencyId: "aptos",
38
+ lastSyncDate: "2024-12-18T15:20:55.097Z",
39
+ balance: "30100",
40
+ spendableBalance: "30100",
41
+ balanceHistoryCache: {
42
+ HOUR: { balances: [0, 50000, 50000, 30100], latestDate: 1734534000000 },
43
+ DAY: { balances: [0], latestDate: 1734480000000 },
44
+ WEEK: { balances: [0], latestDate: 1734220800000 },
45
+ },
46
+ xpub: "d1a8c6a1cdd52dd40c7ea61ee4571fb51fcae440a594c1eca18636928f1d3956",
47
+ swapHistory: [],
48
+ },
49
+ transactions: [
50
+ {
51
+ name: "NO_NAME",
52
+ transaction: fromTransactionRaw({
53
+ amount: "20000",
54
+ recipient: "0xd20fa44192f94ba086ab16bfdf57e43ff118ada69b4c66fa9b9a9223cbc068c1",
55
+ useAllAmount: false,
56
+ family: "aptos",
57
+ mode: "send",
58
+ fees: "1100",
59
+ options: '{ "maxGasAmount": "11", "gasUnitPrice": "100" }',
60
+ errors: "{}",
61
+ }),
62
+ expectedStatus: () =>
63
+ // you can use account and transaction for smart logic. drop the =>fn otherwise
64
+ ({
65
+ errors: {},
66
+ warnings: {},
67
+ estimatedFees: BigNumber("900"),
68
+ amount: BigNumber("20000"),
69
+ totalSpent: BigNumber("20900"),
70
+ }),
71
+ },
72
+ ],
73
+ },
74
+ ],
75
+ };
76
+
77
+ export const dataset: DatasetTest<Transaction> = {
78
+ implementations: ["js"],
79
+ currencies: {
80
+ aptos,
81
+ },
82
+ };
@@ -0,0 +1,80 @@
1
+ import type { Account, AccountLike, AccountLikeArray } from "@ledgerhq/types-live";
2
+ import invariant from "invariant";
3
+ import flatMap from "lodash/flatMap";
4
+ import type { Transaction } from "../types";
5
+ import { getAccountCurrency } from "@ledgerhq/coin-framework/account/index";
6
+ import { AccountType } from "../types";
7
+
8
+ const options = [
9
+ {
10
+ name: "token",
11
+ alias: "t",
12
+ type: String,
13
+ desc: "use an token account children of the account",
14
+ },
15
+ ];
16
+
17
+ function inferAccounts(account: Account, opts: Record<string, any>): AccountLikeArray {
18
+ invariant(account.currency.family === "aptos", "aptos family");
19
+
20
+ if (!opts.token) {
21
+ const accounts: Account[] = [account];
22
+ return accounts;
23
+ }
24
+
25
+ const token = opts.token;
26
+
27
+ const subAccounts = account.subAccounts || [];
28
+
29
+ if (token) {
30
+ const subAccount = subAccounts.find(t => {
31
+ const currency = getAccountCurrency(t);
32
+ return (
33
+ token.toLowerCase() === currency.ticker.toLowerCase() || token.toLowerCase() === currency.id
34
+ );
35
+ });
36
+
37
+ if (!subAccount) {
38
+ throw new Error(
39
+ "token account '" +
40
+ token +
41
+ "' not found. Available: " +
42
+ subAccounts.map(t => getAccountCurrency(t).ticker).join(", "),
43
+ );
44
+ }
45
+
46
+ return [subAccount];
47
+ }
48
+
49
+ return [];
50
+ }
51
+
52
+ function inferTransactions(
53
+ transactions: Array<{
54
+ account: AccountLike;
55
+ transaction: Transaction;
56
+ }>,
57
+ ): Transaction[] {
58
+ return flatMap(transactions, ({ transaction, account }) => {
59
+ invariant(transaction.family === "aptos", "aptos family");
60
+
61
+ if (account.type === AccountType.TokenAccount) {
62
+ const isDelisted = account.token.delisted === true;
63
+ invariant(!isDelisted, "token is delisted");
64
+ }
65
+
66
+ return {
67
+ ...transaction,
68
+ family: "aptos",
69
+ subAccountId: account.type === AccountType.TokenAccount ? account.id : null,
70
+ } as Transaction;
71
+ });
72
+ }
73
+
74
+ export default function makeCliTools() {
75
+ return {
76
+ options,
77
+ inferAccounts,
78
+ inferTransactions,
79
+ };
80
+ }
@@ -0,0 +1,3 @@
1
+ export * from "./bridgeDatasetTest";
2
+ export * from "./bot-specs";
3
+ export * from "./speculos-deviceActions";
@@ -0,0 +1,52 @@
1
+ import type { DeviceAction } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../types";
3
+ import {
4
+ deviceActionFlow,
5
+ formatDeviceAmount,
6
+ SpeculosButton,
7
+ } from "@ledgerhq/coin-framework/bot/specs";
8
+ import { State } from "@ledgerhq/coin-framework/bot/types";
9
+
10
+ const typeWording = {
11
+ send: "Send",
12
+ lock: "Lock",
13
+ unlock: "Unlock",
14
+ withdraw: "Withdraw",
15
+ vote: "Vote",
16
+ revoke: "Revoke",
17
+ activate: "Activate",
18
+ register: "Create Account",
19
+ };
20
+
21
+ export const acceptTransaction: DeviceAction<Transaction, State<Transaction>> = deviceActionFlow({
22
+ steps: [
23
+ {
24
+ title: "Review",
25
+ button: SpeculosButton.RIGHT,
26
+ },
27
+ {
28
+ title: "Type",
29
+ button: SpeculosButton.RIGHT,
30
+ expectedValue: ({ transaction }) => {
31
+ return typeWording[transaction.mode as keyof typeof typeWording];
32
+ },
33
+ },
34
+ {
35
+ title: "Amount",
36
+ button: SpeculosButton.RIGHT,
37
+ expectedValue: ({ account, status }) =>
38
+ formatDeviceAmount(account.currency, status.amount, {
39
+ forceFloating: true,
40
+ }),
41
+ },
42
+ {
43
+ title: "Address",
44
+ button: SpeculosButton.RIGHT,
45
+ expectedValue: ({ transaction }) => transaction.recipient,
46
+ },
47
+ {
48
+ title: "Accept",
49
+ button: SpeculosButton.BOTH,
50
+ },
51
+ ],
52
+ });
@@ -0,0 +1,4 @@
1
+ export enum AccountType {
2
+ Account = "Account",
3
+ TokenAccount = "TokenAccount",
4
+ }
@@ -0,0 +1,74 @@
1
+ import type { UserTransactionResponse } from "@aptos-labs/ts-sdk";
2
+ import type {
3
+ Account,
4
+ Operation,
5
+ TransactionCommon,
6
+ TransactionCommonRaw,
7
+ TransactionStatusCommon,
8
+ TransactionStatusCommonRaw,
9
+ } from "@ledgerhq/types-live";
10
+ import type { BigNumber } from "bignumber.js";
11
+ export * from "./signer";
12
+ export * from "./bridge";
13
+
14
+ export type AptosTransaction = UserTransactionResponse & {
15
+ block: {
16
+ height: number;
17
+ hash: string;
18
+ };
19
+ };
20
+
21
+ export type AptosOperation = Operation;
22
+
23
+ export type AptosAccount = Account;
24
+
25
+ export type TransactionStatus = TransactionStatusCommon;
26
+
27
+ export type TransactionStatusRaw = TransactionStatusCommonRaw;
28
+
29
+ export type AptosCoinStoreResource = {
30
+ coin: {
31
+ value: string;
32
+ };
33
+ };
34
+
35
+ export type AptosResource<T extends Record<string, any> = any> = {
36
+ data: T;
37
+ type: string;
38
+ };
39
+
40
+ export type AptosAddress = {
41
+ address: string;
42
+ publicKey: string;
43
+ path: string;
44
+ };
45
+
46
+ export interface TransactionOptions {
47
+ maxGasAmount: string;
48
+ gasUnitPrice: string;
49
+ }
50
+
51
+ export type TransactionErrors = {
52
+ maxGasAmount?: string;
53
+ gasUnitPrice?: string;
54
+ };
55
+
56
+ export type Transaction = TransactionCommon & {
57
+ mode: string;
58
+ family: "aptos";
59
+ fees?: BigNumber | null;
60
+ options: TransactionOptions;
61
+ errors?: TransactionErrors;
62
+ };
63
+
64
+ export type TransactionRaw = TransactionCommonRaw & {
65
+ family: "aptos";
66
+ mode: string;
67
+ fees?: string | null;
68
+ options: string;
69
+ errors?: string;
70
+ };
71
+
72
+ export type AptosMoveResource = {
73
+ [key: string]: { guid: { id: { addr: string; creation_num: string } } };
74
+ };
@@ -0,0 +1,26 @@
1
+ export interface AptosAddress {
2
+ publicKey: Buffer;
3
+ chainCode: Buffer;
4
+ address: string;
5
+ }
6
+
7
+ export interface AptosSigner {
8
+ getAddress(path: string, display: boolean): Promise<AptosAddress>;
9
+ signTransaction(path: string, txBuffer: Buffer): Promise<{ signature: Buffer }>;
10
+ }
11
+
12
+ export type AptosSignature = {
13
+ signature: null | Buffer;
14
+ return_code: number;
15
+ error_message: string;
16
+ signature_der: Uint8Array;
17
+ signature_compact: Uint8Array;
18
+ };
19
+
20
+ export type AptosGetAddrResponse = {
21
+ addrByte: Uint8Array;
22
+ addrString: string;
23
+ compressed_pk: Uint8Array;
24
+ return_code: number;
25
+ error_message: string;
26
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "../../../tsconfig.base",
3
+ "compilerOptions": {
4
+ "declaration": true,
5
+ "declarationMap": true,
6
+ "module": "commonjs",
7
+ "downlevelIteration": true,
8
+ "lib": ["es2020", "dom"],
9
+ "rootDir": "./src",
10
+ "outDir": "lib",
11
+ "exactOptionalPropertyTypes": true
12
+ },
13
+ "include": ["src/**/*", "deviceTransactionConfig.ts", "transaction.ts"]
14
+ }