@ledgerhq/coin-celo 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 (387) hide show
  1. package/.eslintrc.js +22 -0
  2. package/.turbo/turbo-build.log +4 -0
  3. package/.unimportedrc.json +56 -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/bridge/broadcast.d.ts +5 -0
  9. package/lib/bridge/broadcast.d.ts.map +1 -0
  10. package/lib/bridge/broadcast.js +13 -0
  11. package/lib/bridge/broadcast.js.map +1 -0
  12. package/lib/bridge/buildOptimisticOperation.d.ts +4 -0
  13. package/lib/bridge/buildOptimisticOperation.d.ts.map +1 -0
  14. package/lib/bridge/buildOptimisticOperation.js +49 -0
  15. package/lib/bridge/buildOptimisticOperation.js.map +1 -0
  16. package/lib/bridge/buildTransaction.d.ts +5 -0
  17. package/lib/bridge/buildTransaction.d.ts.map +1 -0
  18. package/lib/bridge/buildTransaction.js +142 -0
  19. package/lib/bridge/buildTransaction.js.map +1 -0
  20. package/lib/bridge/createTransaction.d.ts +5 -0
  21. package/lib/bridge/createTransaction.d.ts.map +1 -0
  22. package/lib/bridge/createTransaction.js +16 -0
  23. package/lib/bridge/createTransaction.js.map +1 -0
  24. package/lib/bridge/deviceTransactionConfig.d.ts +4 -0
  25. package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
  26. package/lib/bridge/deviceTransactionConfig.js +16 -0
  27. package/lib/bridge/deviceTransactionConfig.js.map +1 -0
  28. package/lib/bridge/estimateMaxSpendable.d.ts +5 -0
  29. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
  30. package/lib/bridge/estimateMaxSpendable.js +23 -0
  31. package/lib/bridge/estimateMaxSpendable.js.map +1 -0
  32. package/lib/bridge/getFeesForTransaction.d.ts +8 -0
  33. package/lib/bridge/getFeesForTransaction.d.ts.map +1 -0
  34. package/lib/bridge/getFeesForTransaction.js +93 -0
  35. package/lib/bridge/getFeesForTransaction.js.map +1 -0
  36. package/lib/bridge/getTransactionStatus.d.ts +5 -0
  37. package/lib/bridge/getTransactionStatus.d.ts.map +1 -0
  38. package/lib/bridge/getTransactionStatus.js +98 -0
  39. package/lib/bridge/getTransactionStatus.js.map +1 -0
  40. package/lib/bridge/index.d.ts +11 -0
  41. package/lib/bridge/index.d.ts.map +1 -0
  42. package/lib/bridge/index.js +62 -0
  43. package/lib/bridge/index.js.map +1 -0
  44. package/lib/bridge/preload.d.ts +10 -0
  45. package/lib/bridge/preload.d.ts.map +1 -0
  46. package/lib/bridge/preload.js +72 -0
  47. package/lib/bridge/preload.js.map +1 -0
  48. package/lib/bridge/prepareTransaction.d.ts +5 -0
  49. package/lib/bridge/prepareTransaction.d.ts.map +1 -0
  50. package/lib/bridge/prepareTransaction.js +28 -0
  51. package/lib/bridge/prepareTransaction.js.map +1 -0
  52. package/lib/bridge/serialization.d.ts +9 -0
  53. package/lib/bridge/serialization.d.ts.map +1 -0
  54. package/lib/bridge/serialization.js +92 -0
  55. package/lib/bridge/serialization.js.map +1 -0
  56. package/lib/bridge/signOperation.d.ts +10 -0
  57. package/lib/bridge/signOperation.d.ts.map +1 -0
  58. package/lib/bridge/signOperation.js +77 -0
  59. package/lib/bridge/signOperation.js.map +1 -0
  60. package/lib/bridge/synchronisation.d.ts +5 -0
  61. package/lib/bridge/synchronisation.d.ts.map +1 -0
  62. package/lib/bridge/synchronisation.js +49 -0
  63. package/lib/bridge/synchronisation.js.map +1 -0
  64. package/lib/bridge/transaction.d.ts +14 -0
  65. package/lib/bridge/transaction.d.ts.map +1 -0
  66. package/lib/bridge/transaction.js +47 -0
  67. package/lib/bridge/transaction.js.map +1 -0
  68. package/lib/config.d.ts +3 -0
  69. package/lib/config.d.ts.map +1 -0
  70. package/lib/config.js +14 -0
  71. package/lib/config.js.map +1 -0
  72. package/lib/datasets/celo.scanAccounts.1.d.ts +5 -0
  73. package/lib/datasets/celo.scanAccounts.1.d.ts.map +1 -0
  74. package/lib/datasets/celo.scanAccounts.1.js +364 -0
  75. package/lib/datasets/celo.scanAccounts.1.js.map +1 -0
  76. package/lib/errors.d.ts +4 -0
  77. package/lib/errors.d.ts.map +1 -0
  78. package/lib/errors.js +6 -0
  79. package/lib/errors.js.map +1 -0
  80. package/lib/logic.d.ts +21 -0
  81. package/lib/logic.d.ts.map +1 -0
  82. package/lib/logic.js +97 -0
  83. package/lib/logic.js.map +1 -0
  84. package/lib/network/hubble.d.ts +12 -0
  85. package/lib/network/hubble.d.ts.map +1 -0
  86. package/lib/network/hubble.js +141 -0
  87. package/lib/network/hubble.js.map +1 -0
  88. package/lib/network/index.d.ts +4 -0
  89. package/lib/network/index.d.ts.map +1 -0
  90. package/lib/network/index.js +23 -0
  91. package/lib/network/index.js.map +1 -0
  92. package/lib/network/sdk.d.ts +27 -0
  93. package/lib/network/sdk.d.ts.map +1 -0
  94. package/lib/network/sdk.js +93 -0
  95. package/lib/network/sdk.js.map +1 -0
  96. package/lib/network/validators.d.ts +2 -0
  97. package/lib/network/validators.d.ts.map +1 -0
  98. package/lib/network/validators.js +6 -0
  99. package/lib/network/validators.js.map +1 -0
  100. package/lib/signer/hw-getAddress.d.ts +6 -0
  101. package/lib/signer/hw-getAddress.d.ts.map +1 -0
  102. package/lib/signer/hw-getAddress.js +26 -0
  103. package/lib/signer/hw-getAddress.js.map +1 -0
  104. package/lib/signer/index.d.ts +2 -0
  105. package/lib/signer/index.d.ts.map +1 -0
  106. package/lib/signer/index.js +18 -0
  107. package/lib/signer/index.js.map +1 -0
  108. package/lib/signer/signer.d.ts +16 -0
  109. package/lib/signer/signer.d.ts.map +1 -0
  110. package/lib/signer/signer.js +3 -0
  111. package/lib/signer/signer.js.map +1 -0
  112. package/lib/test/bot-specs.d.ts +7 -0
  113. package/lib/test/bot-specs.d.ts.map +1 -0
  114. package/lib/test/bot-specs.js +42 -0
  115. package/lib/test/bot-specs.js.map +1 -0
  116. package/lib/test/bridgeDatasetTest.d.ts +4 -0
  117. package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
  118. package/lib/test/bridgeDatasetTest.js +14 -0
  119. package/lib/test/bridgeDatasetTest.js.map +1 -0
  120. package/lib/test/cli-transaction.d.ts +25 -0
  121. package/lib/test/cli-transaction.d.ts.map +1 -0
  122. package/lib/test/cli-transaction.js +56 -0
  123. package/lib/test/cli-transaction.js.map +1 -0
  124. package/lib/test/please-add-coverage.test.d.ts +2 -0
  125. package/lib/test/please-add-coverage.test.d.ts.map +1 -0
  126. package/lib/test/please-add-coverage.test.js +6 -0
  127. package/lib/test/please-add-coverage.test.js.map +1 -0
  128. package/lib/test/specs/createActivateVoteMutation.d.ts +4 -0
  129. package/lib/test/specs/createActivateVoteMutation.d.ts.map +1 -0
  130. package/lib/test/specs/createActivateVoteMutation.js +37 -0
  131. package/lib/test/specs/createActivateVoteMutation.js.map +1 -0
  132. package/lib/test/specs/createLockMutation.d.ts +4 -0
  133. package/lib/test/specs/createLockMutation.d.ts.map +1 -0
  134. package/lib/test/specs/createLockMutation.js +37 -0
  135. package/lib/test/specs/createLockMutation.js.map +1 -0
  136. package/lib/test/specs/createRegisterAccountMutation.d.ts +4 -0
  137. package/lib/test/specs/createRegisterAccountMutation.d.ts.map +1 -0
  138. package/lib/test/specs/createRegisterAccountMutation.js +31 -0
  139. package/lib/test/specs/createRegisterAccountMutation.js.map +1 -0
  140. package/lib/test/specs/createRevokeVoteMutation.d.ts +4 -0
  141. package/lib/test/specs/createRevokeVoteMutation.d.ts.map +1 -0
  142. package/lib/test/specs/createRevokeVoteMutation.js +38 -0
  143. package/lib/test/specs/createRevokeVoteMutation.js.map +1 -0
  144. package/lib/test/specs/createSendMutation.d.ts +6 -0
  145. package/lib/test/specs/createSendMutation.d.ts.map +1 -0
  146. package/lib/test/specs/createSendMutation.js +45 -0
  147. package/lib/test/specs/createSendMutation.js.map +1 -0
  148. package/lib/test/specs/createUnlockMutation.d.ts +4 -0
  149. package/lib/test/specs/createUnlockMutation.d.ts.map +1 -0
  150. package/lib/test/specs/createUnlockMutation.js +37 -0
  151. package/lib/test/specs/createUnlockMutation.js.map +1 -0
  152. package/lib/test/specs/createVoteMutation.d.ts +4 -0
  153. package/lib/test/specs/createVoteMutation.d.ts.map +1 -0
  154. package/lib/test/specs/createVoteMutation.js +48 -0
  155. package/lib/test/specs/createVoteMutation.js.map +1 -0
  156. package/lib/test/specs/createWithdrawMutation.d.ts +4 -0
  157. package/lib/test/specs/createWithdrawMutation.d.ts.map +1 -0
  158. package/lib/test/specs/createWithdrawMutation.js +37 -0
  159. package/lib/test/specs/createWithdrawMutation.js.map +1 -0
  160. package/lib/test/specs/index.d.ts +9 -0
  161. package/lib/test/specs/index.d.ts.map +1 -0
  162. package/lib/test/specs/index.js +25 -0
  163. package/lib/test/specs/index.js.map +1 -0
  164. package/lib/test/speculos-deviceActions.d.ts +4 -0
  165. package/lib/test/speculos-deviceActions.d.ts.map +1 -0
  166. package/lib/test/speculos-deviceActions.js +58 -0
  167. package/lib/test/speculos-deviceActions.js.map +1 -0
  168. package/lib/types/index.d.ts +4 -0
  169. package/lib/types/index.d.ts.map +1 -0
  170. package/lib/types/index.js +19 -0
  171. package/lib/types/index.js.map +1 -0
  172. package/lib/types/types.d.ts +126 -0
  173. package/lib/types/types.d.ts.map +1 -0
  174. package/lib/types/types.js +11 -0
  175. package/lib/types/types.js.map +1 -0
  176. package/lib-es/bridge/broadcast.d.ts +5 -0
  177. package/lib-es/bridge/broadcast.d.ts.map +1 -0
  178. package/lib-es/bridge/broadcast.js +9 -0
  179. package/lib-es/bridge/broadcast.js.map +1 -0
  180. package/lib-es/bridge/buildOptimisticOperation.d.ts +4 -0
  181. package/lib-es/bridge/buildOptimisticOperation.d.ts.map +1 -0
  182. package/lib-es/bridge/buildOptimisticOperation.js +42 -0
  183. package/lib-es/bridge/buildOptimisticOperation.js.map +1 -0
  184. package/lib-es/bridge/buildTransaction.d.ts +5 -0
  185. package/lib-es/bridge/buildTransaction.d.ts.map +1 -0
  186. package/lib-es/bridge/buildTransaction.js +140 -0
  187. package/lib-es/bridge/buildTransaction.js.map +1 -0
  188. package/lib-es/bridge/createTransaction.d.ts +5 -0
  189. package/lib-es/bridge/createTransaction.d.ts.map +1 -0
  190. package/lib-es/bridge/createTransaction.js +12 -0
  191. package/lib-es/bridge/createTransaction.js.map +1 -0
  192. package/lib-es/bridge/deviceTransactionConfig.d.ts +4 -0
  193. package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
  194. package/lib-es/bridge/deviceTransactionConfig.js +14 -0
  195. package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
  196. package/lib-es/bridge/estimateMaxSpendable.d.ts +5 -0
  197. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
  198. package/lib-es/bridge/estimateMaxSpendable.js +16 -0
  199. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
  200. package/lib-es/bridge/getFeesForTransaction.d.ts +8 -0
  201. package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -0
  202. package/lib-es/bridge/getFeesForTransaction.js +91 -0
  203. package/lib-es/bridge/getFeesForTransaction.js.map +1 -0
  204. package/lib-es/bridge/getTransactionStatus.d.ts +5 -0
  205. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -0
  206. package/lib-es/bridge/getTransactionStatus.js +94 -0
  207. package/lib-es/bridge/getTransactionStatus.js.map +1 -0
  208. package/lib-es/bridge/index.d.ts +11 -0
  209. package/lib-es/bridge/index.d.ts.map +1 -0
  210. package/lib-es/bridge/index.js +54 -0
  211. package/lib-es/bridge/index.js.map +1 -0
  212. package/lib-es/bridge/preload.d.ts +10 -0
  213. package/lib-es/bridge/preload.d.ts.map +1 -0
  214. package/lib-es/bridge/preload.js +64 -0
  215. package/lib-es/bridge/preload.js.map +1 -0
  216. package/lib-es/bridge/prepareTransaction.d.ts +5 -0
  217. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
  218. package/lib-es/bridge/prepareTransaction.js +21 -0
  219. package/lib-es/bridge/prepareTransaction.js.map +1 -0
  220. package/lib-es/bridge/serialization.d.ts +9 -0
  221. package/lib-es/bridge/serialization.d.ts.map +1 -0
  222. package/lib-es/bridge/serialization.js +84 -0
  223. package/lib-es/bridge/serialization.js.map +1 -0
  224. package/lib-es/bridge/signOperation.d.ts +10 -0
  225. package/lib-es/bridge/signOperation.d.ts.map +1 -0
  226. package/lib-es/bridge/signOperation.js +70 -0
  227. package/lib-es/bridge/signOperation.js.map +1 -0
  228. package/lib-es/bridge/synchronisation.d.ts +5 -0
  229. package/lib-es/bridge/synchronisation.d.ts.map +1 -0
  230. package/lib-es/bridge/synchronisation.js +45 -0
  231. package/lib-es/bridge/synchronisation.js.map +1 -0
  232. package/lib-es/bridge/transaction.d.ts +14 -0
  233. package/lib-es/bridge/transaction.d.ts.map +1 -0
  234. package/lib-es/bridge/transaction.js +42 -0
  235. package/lib-es/bridge/transaction.js.map +1 -0
  236. package/lib-es/config.d.ts +3 -0
  237. package/lib-es/config.d.ts.map +1 -0
  238. package/lib-es/config.js +11 -0
  239. package/lib-es/config.js.map +1 -0
  240. package/lib-es/datasets/celo.scanAccounts.1.d.ts +5 -0
  241. package/lib-es/datasets/celo.scanAccounts.1.d.ts.map +1 -0
  242. package/lib-es/datasets/celo.scanAccounts.1.js +359 -0
  243. package/lib-es/datasets/celo.scanAccounts.1.js.map +1 -0
  244. package/lib-es/errors.d.ts +4 -0
  245. package/lib-es/errors.d.ts.map +1 -0
  246. package/lib-es/errors.js +3 -0
  247. package/lib-es/errors.js.map +1 -0
  248. package/lib-es/logic.d.ts +21 -0
  249. package/lib-es/logic.d.ts.map +1 -0
  250. package/lib-es/logic.js +77 -0
  251. package/lib-es/logic.js.map +1 -0
  252. package/lib-es/network/hubble.d.ts +12 -0
  253. package/lib-es/network/hubble.d.ts.map +1 -0
  254. package/lib-es/network/hubble.js +133 -0
  255. package/lib-es/network/hubble.js.map +1 -0
  256. package/lib-es/network/index.d.ts +4 -0
  257. package/lib-es/network/index.d.ts.map +1 -0
  258. package/lib-es/network/index.js +4 -0
  259. package/lib-es/network/index.js.map +1 -0
  260. package/lib-es/network/sdk.d.ts +27 -0
  261. package/lib-es/network/sdk.d.ts.map +1 -0
  262. package/lib-es/network/sdk.js +85 -0
  263. package/lib-es/network/sdk.js.map +1 -0
  264. package/lib-es/network/validators.d.ts +2 -0
  265. package/lib-es/network/validators.d.ts.map +1 -0
  266. package/lib-es/network/validators.js +2 -0
  267. package/lib-es/network/validators.js.map +1 -0
  268. package/lib-es/signer/hw-getAddress.d.ts +6 -0
  269. package/lib-es/signer/hw-getAddress.d.ts.map +1 -0
  270. package/lib-es/signer/hw-getAddress.js +21 -0
  271. package/lib-es/signer/hw-getAddress.js.map +1 -0
  272. package/lib-es/signer/index.d.ts +2 -0
  273. package/lib-es/signer/index.d.ts.map +1 -0
  274. package/lib-es/signer/index.js +2 -0
  275. package/lib-es/signer/index.js.map +1 -0
  276. package/lib-es/signer/signer.d.ts +16 -0
  277. package/lib-es/signer/signer.d.ts.map +1 -0
  278. package/lib-es/signer/signer.js +2 -0
  279. package/lib-es/signer/signer.js.map +1 -0
  280. package/lib-es/test/bot-specs.d.ts +7 -0
  281. package/lib-es/test/bot-specs.d.ts.map +1 -0
  282. package/lib-es/test/bot-specs.js +40 -0
  283. package/lib-es/test/bot-specs.js.map +1 -0
  284. package/lib-es/test/bridgeDatasetTest.d.ts +4 -0
  285. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
  286. package/lib-es/test/bridgeDatasetTest.js +8 -0
  287. package/lib-es/test/bridgeDatasetTest.js.map +1 -0
  288. package/lib-es/test/cli-transaction.d.ts +25 -0
  289. package/lib-es/test/cli-transaction.d.ts.map +1 -0
  290. package/lib-es/test/cli-transaction.js +50 -0
  291. package/lib-es/test/cli-transaction.js.map +1 -0
  292. package/lib-es/test/please-add-coverage.test.d.ts +1 -0
  293. package/lib-es/test/please-add-coverage.test.d.ts.map +1 -0
  294. package/lib-es/test/please-add-coverage.test.js +5 -0
  295. package/lib-es/test/please-add-coverage.test.js.map +1 -0
  296. package/lib-es/test/specs/createActivateVoteMutation.d.ts +4 -0
  297. package/lib-es/test/specs/createActivateVoteMutation.d.ts.map +1 -0
  298. package/lib-es/test/specs/createActivateVoteMutation.js +30 -0
  299. package/lib-es/test/specs/createActivateVoteMutation.js.map +1 -0
  300. package/lib-es/test/specs/createLockMutation.d.ts +4 -0
  301. package/lib-es/test/specs/createLockMutation.d.ts.map +1 -0
  302. package/lib-es/test/specs/createLockMutation.js +30 -0
  303. package/lib-es/test/specs/createLockMutation.js.map +1 -0
  304. package/lib-es/test/specs/createRegisterAccountMutation.d.ts +4 -0
  305. package/lib-es/test/specs/createRegisterAccountMutation.d.ts.map +1 -0
  306. package/lib-es/test/specs/createRegisterAccountMutation.js +24 -0
  307. package/lib-es/test/specs/createRegisterAccountMutation.js.map +1 -0
  308. package/lib-es/test/specs/createRevokeVoteMutation.d.ts +4 -0
  309. package/lib-es/test/specs/createRevokeVoteMutation.d.ts.map +1 -0
  310. package/lib-es/test/specs/createRevokeVoteMutation.js +31 -0
  311. package/lib-es/test/specs/createRevokeVoteMutation.js.map +1 -0
  312. package/lib-es/test/specs/createSendMutation.d.ts +6 -0
  313. package/lib-es/test/specs/createSendMutation.d.ts.map +1 -0
  314. package/lib-es/test/specs/createSendMutation.js +37 -0
  315. package/lib-es/test/specs/createSendMutation.js.map +1 -0
  316. package/lib-es/test/specs/createUnlockMutation.d.ts +4 -0
  317. package/lib-es/test/specs/createUnlockMutation.d.ts.map +1 -0
  318. package/lib-es/test/specs/createUnlockMutation.js +30 -0
  319. package/lib-es/test/specs/createUnlockMutation.js.map +1 -0
  320. package/lib-es/test/specs/createVoteMutation.d.ts +4 -0
  321. package/lib-es/test/specs/createVoteMutation.d.ts.map +1 -0
  322. package/lib-es/test/specs/createVoteMutation.js +41 -0
  323. package/lib-es/test/specs/createVoteMutation.js.map +1 -0
  324. package/lib-es/test/specs/createWithdrawMutation.d.ts +4 -0
  325. package/lib-es/test/specs/createWithdrawMutation.d.ts.map +1 -0
  326. package/lib-es/test/specs/createWithdrawMutation.js +30 -0
  327. package/lib-es/test/specs/createWithdrawMutation.js.map +1 -0
  328. package/lib-es/test/specs/index.d.ts +9 -0
  329. package/lib-es/test/specs/index.d.ts.map +1 -0
  330. package/lib-es/test/specs/index.js +9 -0
  331. package/lib-es/test/specs/index.js.map +1 -0
  332. package/lib-es/test/speculos-deviceActions.d.ts +4 -0
  333. package/lib-es/test/speculos-deviceActions.d.ts.map +1 -0
  334. package/lib-es/test/speculos-deviceActions.js +55 -0
  335. package/lib-es/test/speculos-deviceActions.js.map +1 -0
  336. package/lib-es/types/index.d.ts +4 -0
  337. package/lib-es/types/index.d.ts.map +1 -0
  338. package/lib-es/types/index.js +3 -0
  339. package/lib-es/types/index.js.map +1 -0
  340. package/lib-es/types/types.d.ts +126 -0
  341. package/lib-es/types/types.d.ts.map +1 -0
  342. package/lib-es/types/types.js +7 -0
  343. package/lib-es/types/types.js.map +1 -0
  344. package/package.json +156 -0
  345. package/src/bridge/broadcast.ts +14 -0
  346. package/src/bridge/buildOptimisticOperation.ts +53 -0
  347. package/src/bridge/buildTransaction.ts +154 -0
  348. package/src/bridge/createTransaction.ts +15 -0
  349. package/src/bridge/deviceTransactionConfig.ts +19 -0
  350. package/src/bridge/estimateMaxSpendable.ts +22 -0
  351. package/src/bridge/getFeesForTransaction.ts +115 -0
  352. package/src/bridge/getTransactionStatus.ts +120 -0
  353. package/src/bridge/index.ts +77 -0
  354. package/src/bridge/preload.ts +75 -0
  355. package/src/bridge/prepareTransaction.ts +33 -0
  356. package/src/bridge/serialization.ts +114 -0
  357. package/src/bridge/signOperation.ts +121 -0
  358. package/src/bridge/synchronisation.ts +60 -0
  359. package/src/bridge/transaction.ts +53 -0
  360. package/src/config.ts +12 -0
  361. package/src/datasets/celo.scanAccounts.1.ts +370 -0
  362. package/src/errors.ts +3 -0
  363. package/src/logic.ts +146 -0
  364. package/src/network/hubble.ts +183 -0
  365. package/src/network/index.ts +3 -0
  366. package/src/network/sdk.ts +101 -0
  367. package/src/network/validators.ts +1 -0
  368. package/src/signer/hw-getAddress.ts +27 -0
  369. package/src/signer/index.ts +1 -0
  370. package/src/signer/signer.ts +36 -0
  371. package/src/test/bot-specs.ts +55 -0
  372. package/src/test/bridgeDatasetTest.ts +10 -0
  373. package/src/test/cli-transaction.ts +70 -0
  374. package/src/test/please-add-coverage.test.ts +3 -0
  375. package/src/test/specs/createActivateVoteMutation.ts +37 -0
  376. package/src/test/specs/createLockMutation.ts +38 -0
  377. package/src/test/specs/createRegisterAccountMutation.ts +35 -0
  378. package/src/test/specs/createRevokeVoteMutation.ts +38 -0
  379. package/src/test/specs/createSendMutation.ts +41 -0
  380. package/src/test/specs/createUnlockMutation.ts +35 -0
  381. package/src/test/specs/createVoteMutation.ts +55 -0
  382. package/src/test/specs/createWithdrawMutation.ts +37 -0
  383. package/src/test/specs/index.ts +8 -0
  384. package/src/test/speculos-deviceActions.ts +63 -0
  385. package/src/types/index.ts +3 -0
  386. package/src/types/types.ts +155 -0
  387. package/tsconfig.json +12 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"please-add-coverage.test.d.ts","sourceRoot":"","sources":["../../src/test/please-add-coverage.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ describe("Celo", () => {
4
+ it.todo("should be tested");
5
+ });
6
+ //# sourceMappingURL=please-add-coverage.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"please-add-coverage.test.js","sourceRoot":"","sources":["../../src/test/please-add-coverage.test.ts"],"names":[],"mappings":";;AAAA,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;IACpB,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AAC9B,CAAC,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const createActivateVoteMutation: () => MutationSpec<Transaction>;
4
+ //# sourceMappingURL=createActivateVoteMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createActivateVoteMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createActivateVoteMutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAK5D,eAAO,MAAM,0BAA0B,QAAO,YAAY,CAAC,WAAW,CA2BpE,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createActivateVoteMutation = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const index_1 = require("@ledgerhq/cryptoassets/index");
9
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
10
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
11
+ const minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.001");
12
+ const createActivateVoteMutation = () => ({
13
+ name: "Celo: Activate Vote",
14
+ feature: "staking",
15
+ maxRun: 1,
16
+ transaction: ({ account, bridge, maxSpendable }) => {
17
+ const { celoResources } = account;
18
+ (0, invariant_1.default)(celoResources?.registrationStatus, "Celo: Activate Vote | Account is not registered");
19
+ (0, invariant_1.default)(maxSpendable.gt(minimalAmount), "Celo: Activate Vote | balance is too low");
20
+ const activatableVote = celoResources?.votes?.find(vote => vote.activatable);
21
+ (0, invariant_1.default)(!!activatableVote, "Celo: Activate Vote | No activatable votes");
22
+ const transaction = {
23
+ recipient: activatableVote.validatorGroup,
24
+ };
25
+ return {
26
+ transaction: bridge.createTransaction(account),
27
+ updates: [
28
+ {
29
+ mode: "activate",
30
+ },
31
+ transaction,
32
+ ],
33
+ };
34
+ },
35
+ });
36
+ exports.createActivateVoteMutation = createActivateVoteMutation;
37
+ //# sourceMappingURL=createActivateVoteMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createActivateVoteMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createActivateVoteMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,wDAAqE;AACrE,6FAA0F;AAI1F,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,0BAA0B,GAAG,GAA8B,EAAE,CAAC,CAAC;IAC1E,IAAI,EAAE,qBAAqB;IAC3B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACjD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAsB,CAAC;QACjD,IAAA,mBAAS,EAAC,aAAa,EAAE,kBAAkB,EAAE,iDAAiD,CAAC,CAAC;QAChG,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,2CAA2C,CAAC,CAAC;QAEvF,MAAM,eAAe,GAAG,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAE7E,IAAA,mBAAS,EAAC,CAAC,CAAC,eAAe,EAAE,4CAA4C,CAAC,CAAC;QAE3E,MAAM,WAAW,GAAG;YAClB,SAAS,EAAE,eAAgB,CAAC,cAAc;SAC3C,CAAC;QAEF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,UAAU;iBACjB;gBACD,WAAW;aACZ;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AA3BU,QAAA,0BAA0B,8BA2BpC"}
@@ -0,0 +1,4 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const createLockMutation: () => MutationSpec<Transaction>;
4
+ //# sourceMappingURL=createLockMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLockMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createLockMutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAK5D,eAAO,MAAM,kBAAkB,QAAO,YAAY,CAAC,WAAW,CA4B5D,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createLockMutation = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const index_1 = require("@ledgerhq/cryptoassets/index");
9
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
10
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
11
+ const minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.005");
12
+ const createLockMutation = () => ({
13
+ name: "Celo: Lock",
14
+ feature: "staking",
15
+ maxRun: 1,
16
+ transaction: ({ account, bridge, maxSpendable }) => {
17
+ const { celoResources } = account;
18
+ (0, invariant_1.default)(celoResources?.registrationStatus, "Celo: Lock Vote | Account is not registered");
19
+ (0, invariant_1.default)(maxSpendable.gt(minimalAmount), "Celo: Lock | balance is too low");
20
+ const amount = minimalAmount.times(Math.random()).integerValue().precision(8);
21
+ (0, invariant_1.default)(amount.gt(0), "Celo: Lock | Not enough funds to lock tokens");
22
+ const transaction = {
23
+ amount,
24
+ };
25
+ return {
26
+ transaction: bridge.createTransaction(account),
27
+ updates: [
28
+ {
29
+ mode: "lock",
30
+ },
31
+ transaction,
32
+ ],
33
+ };
34
+ },
35
+ });
36
+ exports.createLockMutation = createLockMutation;
37
+ //# sourceMappingURL=createLockMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createLockMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createLockMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,wDAAqE;AACrE,6FAA0F;AAI1F,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,kBAAkB,GAAG,GAA8B,EAAE,CAAC,CAAC;IAClE,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACjD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAsB,CAAC;QACjD,IAAA,mBAAS,EAAC,aAAa,EAAE,kBAAkB,EAAE,6CAA6C,CAAC,CAAC;QAE5F,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,kCAAkC,CAAC,CAAC;QAE9E,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAE9E,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,8CAA8C,CAAC,CAAC;QAExE,MAAM,WAAW,GAAG;YAClB,MAAM;SACP,CAAC;QAEF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;iBACb;gBACD,WAAW;aACZ;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AA5BU,QAAA,kBAAkB,sBA4B5B"}
@@ -0,0 +1,4 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const createRegisterAccountMutation: () => MutationSpec<Transaction>;
4
+ //# sourceMappingURL=createRegisterAccountMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRegisterAccountMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createRegisterAccountMutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAK5D,eAAO,MAAM,6BAA6B,QAAO,YAAY,CAAC,WAAW,CAyBvE,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createRegisterAccountMutation = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const index_1 = require("@ledgerhq/cryptoassets/index");
9
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
10
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
11
+ const minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.001");
12
+ const createRegisterAccountMutation = () => ({
13
+ name: "Celo: Register Account",
14
+ feature: "staking",
15
+ maxRun: 1,
16
+ transaction: ({ account, bridge, maxSpendable }) => {
17
+ const { celoResources } = account;
18
+ (0, invariant_1.default)(!celoResources?.registrationStatus, "Celo: Register Account | Celo account is already registered");
19
+ (0, invariant_1.default)(maxSpendable.gt(minimalAmount), "Celo: Register Account | Celo account balance is too low to register account");
20
+ return {
21
+ transaction: bridge.createTransaction(account),
22
+ updates: [
23
+ {
24
+ mode: "register",
25
+ },
26
+ ],
27
+ };
28
+ },
29
+ });
30
+ exports.createRegisterAccountMutation = createRegisterAccountMutation;
31
+ //# sourceMappingURL=createRegisterAccountMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRegisterAccountMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createRegisterAccountMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,wDAAqE;AACrE,6FAA0F;AAI1F,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,6BAA6B,GAAG,GAA8B,EAAE,CAAC,CAAC;IAC7E,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACjD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAsB,CAAC;QAEjD,IAAA,mBAAS,EACP,CAAC,aAAa,EAAE,kBAAkB,EAClC,6DAA6D,CAC9D,CAAC;QACF,IAAA,mBAAS,EACP,YAAY,CAAC,EAAE,CAAC,aAAa,CAAC,EAC9B,8EAA8E,CAC/E,CAAC;QAEF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,UAAU;iBACjB;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAzBU,QAAA,6BAA6B,iCAyBvC"}
@@ -0,0 +1,4 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const createRevokeVoteMutation: () => MutationSpec<Transaction>;
4
+ //# sourceMappingURL=createRevokeVoteMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRevokeVoteMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createRevokeVoteMutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAK5D,eAAO,MAAM,wBAAwB,QAAO,YAAY,CAAC,WAAW,CA4BlE,CAAC"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createRevokeVoteMutation = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const index_1 = require("@ledgerhq/cryptoassets/index");
9
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
10
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
11
+ const minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.001");
12
+ const createRevokeVoteMutation = () => ({
13
+ name: "Celo: RevokeVote",
14
+ feature: "staking",
15
+ maxRun: 1,
16
+ transaction: ({ account, bridge, maxSpendable }) => {
17
+ (0, invariant_1.default)(maxSpendable.gt(minimalAmount), "Celo: Revoke Vote | balance is too low");
18
+ const { celoResources } = account;
19
+ (0, invariant_1.default)(celoResources?.registrationStatus, "Celo: RevokeVote | Account is not registered");
20
+ const revokableVote = celoResources?.votes?.find(vote => vote.revokable);
21
+ (0, invariant_1.default)(!!revokableVote, "Celo: RevokeVote | Revokable vote not found");
22
+ return {
23
+ transaction: bridge.createTransaction(account),
24
+ updates: [
25
+ {
26
+ mode: "revoke",
27
+ recipient: revokableVote.validatorGroup,
28
+ group: revokableVote.validatorGroup,
29
+ address: account.celoResources?.electionAddress,
30
+ index: revokableVote.index,
31
+ amount: revokableVote.amount,
32
+ },
33
+ ],
34
+ };
35
+ },
36
+ });
37
+ exports.createRevokeVoteMutation = createRevokeVoteMutation;
38
+ //# sourceMappingURL=createRevokeVoteMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRevokeVoteMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createRevokeVoteMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,wDAAqE;AACrE,6FAA0F;AAI1F,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,wBAAwB,GAAG,GAA8B,EAAE,CAAC,CAAC;IACxE,IAAI,EAAE,kBAAkB;IACxB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACjD,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,yCAAyC,CAAC,CAAC;QAErF,MAAM,EAAE,aAAa,EAAE,GAAG,OAAsB,CAAC;QACjD,IAAA,mBAAS,EAAC,aAAa,EAAE,kBAAkB,EAAE,8CAA8C,CAAC,CAAC;QAE7F,MAAM,aAAa,GAAG,aAAa,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEzE,IAAA,mBAAS,EAAC,CAAC,CAAC,aAAa,EAAE,8CAA8C,CAAC,CAAC;QAE3E,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,aAAc,CAAC,cAAc;oBACxC,KAAK,EAAE,aAAc,CAAC,cAAc;oBACpC,OAAO,EAAG,OAAuB,CAAC,aAAa,EAAE,eAAe;oBAChE,KAAK,EAAE,aAAc,CAAC,KAAK;oBAC3B,MAAM,EAAE,aAAc,CAAC,MAAM;iBAC9B;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AA5BU,QAAA,wBAAwB,4BA4BlC"}
@@ -0,0 +1,6 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const minimalAmount: import("bignumber.js").BigNumber;
4
+ export declare const createSend50PercentMutation: () => MutationSpec<Transaction>;
5
+ export declare const createSendMaxMutation: () => MutationSpec<Transaction>;
6
+ //# sourceMappingURL=createSendMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSendMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createSendMutation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C,eAAO,MAAM,aAAa,kCAA+C,CAAC;AAE1E,eAAO,MAAM,2BAA2B,QAAO,YAAY,CAAC,WAAW,CAcrE,CAAC;AAEH,eAAO,MAAM,qBAAqB,QAAO,YAAY,CAAC,WAAW,CAa/D,CAAC"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createSendMaxMutation = exports.createSend50PercentMutation = exports.minimalAmount = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const index_1 = require("@ledgerhq/cryptoassets/index");
9
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
10
+ const specs_1 = require("@ledgerhq/coin-framework/bot/specs");
11
+ const maxAccount = 10;
12
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
13
+ exports.minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.01");
14
+ const createSend50PercentMutation = () => ({
15
+ name: "Celo: Move 50% to another account",
16
+ feature: "send",
17
+ maxRun: 1,
18
+ transaction: ({ account, siblings, bridge, maxSpendable }) => {
19
+ (0, invariant_1.default)(maxSpendable.gt(exports.minimalAmount), "Celo: Move 50% | balance is too low");
20
+ const sibling = (0, specs_1.pickSiblings)(siblings, maxAccount);
21
+ const recipient = sibling.freshAddress;
22
+ const amount = maxSpendable.div(2).integerValue();
23
+ return {
24
+ transaction: bridge.createTransaction(account),
25
+ updates: [{ recipient }, { amount }],
26
+ };
27
+ },
28
+ });
29
+ exports.createSend50PercentMutation = createSend50PercentMutation;
30
+ const createSendMaxMutation = () => ({
31
+ name: "Celo: Send max to another account",
32
+ feature: "sendMax",
33
+ maxRun: 1,
34
+ transaction: ({ account, siblings, bridge, maxSpendable }) => {
35
+ (0, invariant_1.default)(maxSpendable.gt(exports.minimalAmount), "Celo: Send Max | Balance is too low");
36
+ const sibling = (0, specs_1.pickSiblings)(siblings, maxAccount);
37
+ const recipient = sibling.freshAddress;
38
+ return {
39
+ transaction: bridge.createTransaction(account),
40
+ updates: [{ recipient }, { useAllAmount: true }],
41
+ };
42
+ },
43
+ });
44
+ exports.createSendMaxMutation = createSendMaxMutation;
45
+ //# sourceMappingURL=createSendMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSendMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createSendMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,wDAAqE;AACrE,6FAA0F;AAC1F,8DAAkE;AAIlE,MAAM,UAAU,GAAG,EAAE,CAAC;AACtB,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAClC,QAAA,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAEnE,MAAM,2BAA2B,GAAG,GAA8B,EAAE,CAAC,CAAC;IAC3E,IAAI,EAAE,mCAAmC;IACzC,OAAO,EAAE,MAAM;IACf,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QAC3D,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,qBAAa,CAAC,EAAE,sCAAsC,CAAC,CAAC;QAClF,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;QACvC,MAAM,MAAM,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;QAClD,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;SACrC,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAdU,QAAA,2BAA2B,+BAcrC;AAEI,MAAM,qBAAqB,GAAG,GAA8B,EAAE,CAAC,CAAC;IACrE,IAAI,EAAE,mCAAmC;IACzC,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QAC3D,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,qBAAa,CAAC,EAAE,qCAAqC,CAAC,CAAC;QACjF,MAAM,OAAO,GAAG,IAAA,oBAAY,EAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;QACvC,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;SACjD,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAbU,QAAA,qBAAqB,yBAa/B"}
@@ -0,0 +1,4 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/lib-es/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const createUnlockMutation: () => MutationSpec<Transaction>;
4
+ //# sourceMappingURL=createUnlockMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUnlockMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createUnlockMutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,2CAA2C,CAAC;AACzE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAM5D,eAAO,MAAM,oBAAoB,QAAO,YAAY,CAAC,WAAW,CAwB9D,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createUnlockMutation = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const index_1 = require("@ledgerhq/cryptoassets/index");
9
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
10
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
11
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
12
+ const minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.001");
13
+ const createUnlockMutation = () => ({
14
+ name: "Celo: Unlock",
15
+ feature: "staking",
16
+ maxRun: 1,
17
+ transaction: ({ account, bridge, maxSpendable }) => {
18
+ (0, invariant_1.default)(maxSpendable.gt(minimalAmount), "Celo: Unlock | balance is too low");
19
+ const { celoResources } = account;
20
+ (0, invariant_1.default)(celoResources?.registrationStatus, "Celo: Unlock | Account is not registered");
21
+ const nonvotingLockedBalance = celoResources?.nonvotingLockedBalance || new bignumber_js_1.default(0);
22
+ (0, invariant_1.default)(nonvotingLockedBalance.gt(0), "Celo: Unlock | No non voting locked balance");
23
+ return {
24
+ transaction: bridge.createTransaction(account),
25
+ updates: [
26
+ {
27
+ mode: "unlock",
28
+ },
29
+ {
30
+ amount: nonvotingLockedBalance.dividedBy(2).integerValue(),
31
+ },
32
+ ],
33
+ };
34
+ },
35
+ });
36
+ exports.createUnlockMutation = createUnlockMutation;
37
+ //# sourceMappingURL=createUnlockMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createUnlockMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createUnlockMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,wDAAqE;AACrE,6FAA0F;AAG1F,gEAAqC;AAErC,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,oBAAoB,GAAG,GAA8B,EAAE,CAAC,CAAC;IACpE,IAAI,EAAE,cAAc;IACpB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACjD,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,oCAAoC,CAAC,CAAC;QAEhF,MAAM,EAAE,aAAa,EAAE,GAAG,OAAsB,CAAC;QACjD,IAAA,mBAAS,EAAC,aAAa,EAAE,kBAAkB,EAAE,0CAA0C,CAAC,CAAC;QACzF,MAAM,sBAAsB,GAAG,aAAa,EAAE,sBAAsB,IAAI,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;QACzF,IAAA,mBAAS,EAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,6CAA6C,CAAC,CAAC;QAEvF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,QAAQ;iBACf;gBACD;oBACE,MAAM,EAAE,sBAAsB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE;iBAC3D;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAxBU,QAAA,oBAAoB,wBAwB9B"}
@@ -0,0 +1,4 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const createVoteMutation: () => MutationSpec<Transaction>;
4
+ //# sourceMappingURL=createVoteMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVoteMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createVoteMutation.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAKlE,OAAO,KAAK,EAA8B,WAAW,EAAE,MAAM,aAAa,CAAC;AAK3E,eAAO,MAAM,kBAAkB,QAAO,YAAY,CAAC,WAAW,CAyC5D,CAAC"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createVoteMutation = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
9
+ const sampleSize_1 = __importDefault(require("lodash/sampleSize"));
10
+ const index_1 = require("@ledgerhq/cryptoassets/index");
11
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
12
+ const preload_1 = require("../../bridge/preload");
13
+ const logic_1 = require("../../logic");
14
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
15
+ const minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.001");
16
+ const createVoteMutation = () => ({
17
+ name: "Celo: Vote",
18
+ feature: "staking",
19
+ maxRun: 1,
20
+ transaction: ({ account, bridge, maxSpendable }) => {
21
+ (0, invariant_1.default)(maxSpendable.gt(minimalAmount), "Celo: Vote | balance is too low");
22
+ const { celoResources } = account;
23
+ (0, invariant_1.default)(celoResources?.registrationStatus, "Celo: Vote | Account is not registered");
24
+ const nonvotingLockedBalance = celoResources?.nonvotingLockedBalance || new bignumber_js_1.default(0);
25
+ (0, invariant_1.default)(nonvotingLockedBalance.gt(0), "Celo: Vote | No non voting locked balance");
26
+ const votes = celoResources.votes || [];
27
+ const { validatorGroups } = (0, preload_1.getCurrentCeloPreloadData)();
28
+ // Get a random validator group that the account does not have locked tokens for.
29
+ const validatorGroupWithoutVotes = (0, sampleSize_1.default)((0, logic_1.getValidatorGroupsWithoutVotes)(validatorGroups, votes), 1)[0];
30
+ const amount = nonvotingLockedBalance.times(0.5).precision(8).integerValue();
31
+ (0, invariant_1.default)(amount.gt(0), "Celo: Vote | Not enough funds to vote");
32
+ const transaction = {
33
+ recipient: validatorGroupWithoutVotes.address,
34
+ amount,
35
+ };
36
+ return {
37
+ transaction: bridge.createTransaction(account),
38
+ updates: [
39
+ {
40
+ mode: "vote",
41
+ },
42
+ transaction,
43
+ ],
44
+ };
45
+ },
46
+ });
47
+ exports.createVoteMutation = createVoteMutation;
48
+ //# sourceMappingURL=createVoteMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createVoteMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createVoteMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAClC,gEAAqC;AACrC,mEAA2C;AAE3C,wDAAqE;AACrE,6FAA0F;AAC1F,kDAAiE;AACjE,uCAA6D;AAG7D,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,kBAAkB,GAAG,GAA8B,EAAE,CAAC,CAAC;IAClE,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACjD,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,kCAAkC,CAAC,CAAC;QAE9E,MAAM,EAAE,aAAa,EAAE,GAAG,OAAsB,CAAC;QACjD,IAAA,mBAAS,EAAC,aAAa,EAAE,kBAAkB,EAAE,wCAAwC,CAAC,CAAC;QAEvF,MAAM,sBAAsB,GAAG,aAAa,EAAE,sBAAsB,IAAI,IAAI,sBAAS,CAAC,CAAC,CAAC,CAAC;QACzF,IAAA,mBAAS,EAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,2CAA2C,CAAC,CAAC;QAErF,MAAM,KAAK,GAAI,aAA+B,CAAC,KAAK,IAAI,EAAE,CAAC;QAC3D,MAAM,EAAE,eAAe,EAAE,GAAG,IAAA,mCAAyB,GAAE,CAAC;QAExD,iFAAiF;QACjF,MAAM,0BAA0B,GAAG,IAAA,oBAAU,EAC3C,IAAA,sCAA8B,EAAC,eAAe,EAAE,KAAK,CAAC,EACtD,CAAC,CACF,CAAC,CAAC,CAAC,CAAC;QAEL,MAAM,MAAM,GAAG,sBAAsB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;QAE7E,IAAA,mBAAS,EAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,uCAAuC,CAAC,CAAC;QAEjE,MAAM,WAAW,GAAG;YAClB,SAAS,EAAE,0BAA0B,CAAC,OAAO;YAC7C,MAAM;SACP,CAAC;QAEF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC;YAC9C,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;iBACb;gBACD,WAAW;aACZ;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAzCU,QAAA,kBAAkB,sBAyC5B"}
@@ -0,0 +1,4 @@
1
+ import { MutationSpec } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../../types";
3
+ export declare const createWithdrawMutation: () => MutationSpec<Transaction>;
4
+ //# sourceMappingURL=createWithdrawMutation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWithdrawMutation.d.ts","sourceRoot":"","sources":["../../../src/test/specs/createWithdrawMutation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAIlE,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,aAAa,CAAC;AAK5D,eAAO,MAAM,sBAAsB,QAAO,YAAY,CAAC,WAAW,CA0BhE,CAAC"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.createWithdrawMutation = void 0;
7
+ const invariant_1 = __importDefault(require("invariant"));
8
+ const index_1 = require("@ledgerhq/cryptoassets/index");
9
+ const parseCurrencyUnit_1 = require("@ledgerhq/coin-framework/currencies/parseCurrencyUnit");
10
+ const logic_1 = require("../../logic");
11
+ const currency = (0, index_1.getCryptoCurrencyById)("celo");
12
+ const minimalAmount = (0, parseCurrencyUnit_1.parseCurrencyUnit)(currency.units[0], "0.001");
13
+ const createWithdrawMutation = () => ({
14
+ name: "Celo: Withdraw",
15
+ feature: "staking",
16
+ maxRun: 1,
17
+ transaction: ({ account, bridge, maxSpendable }) => {
18
+ const celoAccount = account;
19
+ const { celoResources } = celoAccount;
20
+ (0, invariant_1.default)(celoResources?.registrationStatus, "Celo: Withdraw | Account is not registered");
21
+ const pendingWithdrawals = (0, logic_1.availablePendingWithdrawals)(celoAccount);
22
+ (0, invariant_1.default)(pendingWithdrawals.length > 0, "Celo: Withdraw | No withdrawable balance");
23
+ (0, invariant_1.default)(maxSpendable.gt(minimalAmount), "Celo: Withdraw Vote | balance is too low");
24
+ return {
25
+ transaction: bridge.createTransaction(celoAccount),
26
+ updates: [
27
+ {
28
+ mode: "withdraw",
29
+ recipient: celoAccount.celoResources.lockedGoldAddress,
30
+ index: pendingWithdrawals[0].index,
31
+ },
32
+ ],
33
+ };
34
+ },
35
+ });
36
+ exports.createWithdrawMutation = createWithdrawMutation;
37
+ //# sourceMappingURL=createWithdrawMutation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createWithdrawMutation.js","sourceRoot":"","sources":["../../../src/test/specs/createWithdrawMutation.ts"],"names":[],"mappings":";;;;;;AAAA,0DAAkC;AAElC,wDAAqE;AACrE,6FAA0F;AAC1F,uCAA0D;AAG1D,MAAM,QAAQ,GAAG,IAAA,6BAAqB,EAAC,MAAM,CAAC,CAAC;AAC/C,MAAM,aAAa,GAAG,IAAA,qCAAiB,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;AAE7D,MAAM,sBAAsB,GAAG,GAA8B,EAAE,CAAC,CAAC;IACtE,IAAI,EAAE,gBAAgB;IACtB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QACjD,MAAM,WAAW,GAAG,OAAsB,CAAC;QAC3C,MAAM,EAAE,aAAa,EAAE,GAAG,WAAW,CAAC;QACtC,IAAA,mBAAS,EAAC,aAAa,EAAE,kBAAkB,EAAE,4CAA4C,CAAC,CAAC;QAE3F,MAAM,kBAAkB,GAAG,IAAA,mCAA2B,EAAC,WAAW,CAAC,CAAC;QAEpE,IAAA,mBAAS,EAAC,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,0CAA0C,CAAC,CAAC;QAErF,IAAA,mBAAS,EAAC,YAAY,CAAC,EAAE,CAAC,aAAa,CAAC,EAAE,2CAA2C,CAAC,CAAC;QAEvF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,iBAAiB,CAAC,WAAW,CAAC;YAClD,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,UAAU;oBAChB,SAAS,EAAE,WAAW,CAAC,aAAc,CAAC,iBAAkB;oBACxD,KAAK,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC,KAAK;iBACnC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AA1BU,QAAA,sBAAsB,0BA0BhC"}
@@ -0,0 +1,9 @@
1
+ export * from "./createSendMutation";
2
+ export * from "./createLockMutation";
3
+ export * from "./createUnlockMutation";
4
+ export * from "./createRegisterAccountMutation";
5
+ export * from "./createVoteMutation";
6
+ export * from "./createActivateVoteMutation";
7
+ export * from "./createRevokeVoteMutation";
8
+ export * from "./createWithdrawMutation";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/test/specs/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,iCAAiC,CAAC;AAChD,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./createSendMutation"), exports);
18
+ __exportStar(require("./createLockMutation"), exports);
19
+ __exportStar(require("./createUnlockMutation"), exports);
20
+ __exportStar(require("./createRegisterAccountMutation"), exports);
21
+ __exportStar(require("./createVoteMutation"), exports);
22
+ __exportStar(require("./createActivateVoteMutation"), exports);
23
+ __exportStar(require("./createRevokeVoteMutation"), exports);
24
+ __exportStar(require("./createWithdrawMutation"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/test/specs/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,uDAAqC;AACrC,yDAAuC;AACvC,kEAAgD;AAChD,uDAAqC;AACrC,+DAA6C;AAC7C,6DAA2C;AAC3C,2DAAyC"}
@@ -0,0 +1,4 @@
1
+ import type { DeviceAction } from "@ledgerhq/coin-framework/bot/types";
2
+ import type { Transaction } from "../types";
3
+ export declare const acceptTransaction: DeviceAction<Transaction, any>;
4
+ //# sourceMappingURL=speculos-deviceActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speculos-deviceActions.d.ts","sourceRoot":"","sources":["../../src/test/speculos-deviceActions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAkB5C,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,WAAW,EAAE,GAAG,CA2C3D,CAAC"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.acceptTransaction = void 0;
4
+ const specs_1 = require("@ledgerhq/coin-framework/bot/specs");
5
+ const typeWording = {
6
+ send: "Send",
7
+ lock: "Lock",
8
+ unlock: "Unlock",
9
+ withdraw: "Withdraw",
10
+ vote: "Vote",
11
+ revoke: "Revoke",
12
+ activate: "Activate",
13
+ register: "Create Account",
14
+ };
15
+ exports.acceptTransaction = (0, specs_1.deviceActionFlow)({
16
+ steps: [
17
+ {
18
+ title: "Review",
19
+ button: specs_1.SpeculosButton.RIGHT,
20
+ },
21
+ {
22
+ title: "Amount",
23
+ button: specs_1.SpeculosButton.RIGHT,
24
+ expectedValue: ({ account, status }) => (0, specs_1.formatDeviceAmount)(account.currency, status.amount, {
25
+ forceFloating: true,
26
+ }),
27
+ },
28
+ {
29
+ title: "Address",
30
+ button: specs_1.SpeculosButton.RIGHT,
31
+ expectedValue: ({ transaction }) => transaction.recipient,
32
+ },
33
+ {
34
+ title: "Max Fees",
35
+ button: specs_1.SpeculosButton.RIGHT,
36
+ },
37
+ {
38
+ title: "No Gateway Fee",
39
+ button: specs_1.SpeculosButton.RIGHT,
40
+ },
41
+ {
42
+ title: "Validator",
43
+ button: specs_1.SpeculosButton.RIGHT,
44
+ },
45
+ {
46
+ title: "Type",
47
+ button: specs_1.SpeculosButton.RIGHT,
48
+ expectedValue: ({ transaction }) => {
49
+ return typeWording[transaction.mode];
50
+ },
51
+ },
52
+ {
53
+ title: "Accept",
54
+ button: specs_1.SpeculosButton.BOTH,
55
+ },
56
+ ],
57
+ });
58
+ //# sourceMappingURL=speculos-deviceActions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"speculos-deviceActions.js","sourceRoot":"","sources":["../../src/test/speculos-deviceActions.ts"],"names":[],"mappings":";;;AAEA,8DAI4C;AAE5C,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,gBAAgB;CAC3B,CAAC;AAEW,QAAA,iBAAiB,GAAmC,IAAA,wBAAgB,EAAC;IAChF,KAAK,EAAE;QACL;YACE,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,sBAAc,CAAC,KAAK;SAC7B;QACD;YACE,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,aAAa,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,CACrC,IAAA,0BAAkB,EAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;gBAClD,aAAa,EAAE,IAAI;aACpB,CAAC;SACL;QACD;YACE,KAAK,EAAE,SAAS;YAChB,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,aAAa,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,WAAW,CAAC,SAAS;SAC1D;QACD;YACE,KAAK,EAAE,UAAU;YACjB,MAAM,EAAE,sBAAc,CAAC,KAAK;SAC7B;QACD;YACE,KAAK,EAAE,gBAAgB;YACvB,MAAM,EAAE,sBAAc,CAAC,KAAK;SAC7B;QACD;YACE,KAAK,EAAE,WAAW;YAClB,MAAM,EAAE,sBAAc,CAAC,KAAK;SAC7B;QACD;YACE,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,sBAAc,CAAC,KAAK;YAC5B,aAAa,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE;gBACjC,OAAO,WAAW,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACvC,CAAC;SACF;QACD;YACE,KAAK,EAAE,QAAQ;YACf,MAAM,EAAE,sBAAc,CAAC,IAAI;SAC5B;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from "./types";
2
+ export type { CeloTx, RLPEncodedTx } from "@celo/connect";
3
+ export * from "@celo/wallet-base";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,YAAY,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC1D,cAAc,mBAAmB,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./types"), exports);
18
+ __exportStar(require("@celo/wallet-base"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AAExB,oDAAkC"}