@ledgerhq/coin-aptos 3.4.0-nightly.7 → 3.4.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 (299) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +25 -66
  3. package/lib/__tests__/api/craftTransaction.unit.test.d.ts +2 -0
  4. package/lib/__tests__/api/craftTransaction.unit.test.d.ts.map +1 -0
  5. package/lib/__tests__/api/craftTransaction.unit.test.js +177 -0
  6. package/lib/__tests__/api/craftTransaction.unit.test.js.map +1 -0
  7. package/lib/__tests__/api/getBalance.unit.test.d.ts +2 -0
  8. package/lib/__tests__/api/getBalance.unit.test.d.ts.map +1 -0
  9. package/lib/__tests__/api/getBalance.unit.test.js +80 -0
  10. package/lib/__tests__/api/getBalance.unit.test.js.map +1 -0
  11. package/lib/__tests__/api/index.integ.test.d.ts +2 -0
  12. package/lib/__tests__/api/index.integ.test.d.ts.map +1 -0
  13. package/lib/__tests__/api/index.integ.test.js +340 -0
  14. package/lib/__tests__/api/index.integ.test.js.map +1 -0
  15. package/lib/__tests__/api/index.test.d.ts +2 -0
  16. package/lib/__tests__/api/index.test.d.ts.map +1 -0
  17. package/lib/__tests__/api/index.test.js +66 -0
  18. package/lib/__tests__/api/index.test.js.map +1 -0
  19. package/lib/__tests__/bridge/broadcast.test.d.ts +2 -0
  20. package/lib/__tests__/bridge/broadcast.test.d.ts.map +1 -0
  21. package/lib/__tests__/bridge/broadcast.test.js +92 -0
  22. package/lib/__tests__/bridge/broadcast.test.js.map +1 -0
  23. package/lib/__tests__/bridge/deviceTransactionConfig.test.d.ts +2 -0
  24. package/lib/__tests__/bridge/deviceTransactionConfig.test.d.ts.map +1 -0
  25. package/lib/__tests__/bridge/deviceTransactionConfig.test.js +128 -0
  26. package/lib/__tests__/bridge/deviceTransactionConfig.test.js.map +1 -0
  27. package/lib/__tests__/bridge/estimateMaxSpendable.test.d.ts +2 -0
  28. package/lib/__tests__/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
  29. package/lib/__tests__/bridge/estimateMaxSpendable.test.js +75 -0
  30. package/lib/__tests__/bridge/estimateMaxSpendable.test.js.map +1 -0
  31. package/lib/__tests__/bridge/getFeesForTransaction.test.d.ts +2 -0
  32. package/lib/__tests__/bridge/getFeesForTransaction.test.d.ts.map +1 -0
  33. package/lib/__tests__/bridge/getFeesForTransaction.test.js +280 -0
  34. package/lib/__tests__/bridge/getFeesForTransaction.test.js.map +1 -0
  35. package/lib/__tests__/bridge/getTransactionStatus.test.d.ts +2 -0
  36. package/lib/__tests__/bridge/getTransactionStatus.test.d.ts.map +1 -0
  37. package/lib/__tests__/bridge/getTransactionStatus.test.js +453 -0
  38. package/lib/__tests__/bridge/getTransactionStatus.test.js.map +1 -0
  39. package/lib/__tests__/bridge/index.test.d.ts +2 -0
  40. package/lib/__tests__/bridge/index.test.d.ts.map +1 -0
  41. package/lib/__tests__/bridge/index.test.js +110 -0
  42. package/lib/__tests__/bridge/index.test.js.map +1 -0
  43. package/lib/__tests__/bridge/logic.test.d.ts +2 -0
  44. package/lib/__tests__/bridge/logic.test.d.ts.map +1 -0
  45. package/lib/__tests__/bridge/logic.test.js +997 -0
  46. package/lib/__tests__/bridge/logic.test.js.map +1 -0
  47. package/lib/__tests__/bridge/prepareTransaction.test.d.ts +2 -0
  48. package/lib/__tests__/bridge/prepareTransaction.test.d.ts.map +1 -0
  49. package/lib/__tests__/bridge/prepareTransaction.test.js +109 -0
  50. package/lib/__tests__/bridge/prepareTransaction.test.js.map +1 -0
  51. package/lib/__tests__/bridge/serialization.d.ts +2 -0
  52. package/lib/__tests__/bridge/serialization.d.ts.map +1 -0
  53. package/lib/__tests__/bridge/serialization.js +91 -0
  54. package/lib/__tests__/bridge/serialization.js.map +1 -0
  55. package/lib/__tests__/bridge/signOperation.test.d.ts +2 -0
  56. package/lib/__tests__/bridge/signOperation.test.d.ts.map +1 -0
  57. package/lib/__tests__/bridge/signOperation.test.js +299 -0
  58. package/lib/__tests__/bridge/signOperation.test.js.map +1 -0
  59. package/lib/__tests__/bridge/synchronisation.test.d.ts +2 -0
  60. package/lib/__tests__/bridge/synchronisation.test.d.ts.map +1 -0
  61. package/lib/__tests__/bridge/synchronisation.test.js +2226 -0
  62. package/lib/__tests__/bridge/synchronisation.test.js.map +1 -0
  63. package/lib/__tests__/bridge/transaction.test.d.ts +2 -0
  64. package/lib/__tests__/bridge/transaction.test.d.ts.map +1 -0
  65. package/lib/__tests__/bridge/transaction.test.js +221 -0
  66. package/lib/__tests__/bridge/transaction.test.js.map +1 -0
  67. package/lib/__tests__/errors.test.d.ts +2 -0
  68. package/lib/__tests__/errors.test.d.ts.map +1 -0
  69. package/lib/__tests__/errors.test.js +18 -0
  70. package/lib/__tests__/errors.test.js.map +1 -0
  71. package/lib/__tests__/index.test.d.ts +2 -0
  72. package/lib/__tests__/index.test.d.ts.map +1 -0
  73. package/lib/__tests__/index.test.js +27 -0
  74. package/lib/__tests__/index.test.js.map +1 -0
  75. package/lib/__tests__/logic/buildTransaction.test.d.ts +2 -0
  76. package/lib/__tests__/logic/buildTransaction.test.d.ts.map +1 -0
  77. package/lib/__tests__/logic/buildTransaction.test.js +114 -0
  78. package/lib/__tests__/logic/buildTransaction.test.js.map +1 -0
  79. package/lib/__tests__/logic/calculateAmount.unit.test.d.ts +2 -0
  80. package/lib/__tests__/logic/calculateAmount.unit.test.d.ts.map +1 -0
  81. package/lib/__tests__/logic/calculateAmount.unit.test.js +45 -0
  82. package/lib/__tests__/logic/calculateAmount.unit.test.js.map +1 -0
  83. package/lib/__tests__/logic/combine.unit.test.d.ts +2 -0
  84. package/lib/__tests__/logic/combine.unit.test.d.ts.map +1 -0
  85. package/lib/__tests__/logic/combine.unit.test.js +47 -0
  86. package/lib/__tests__/logic/combine.unit.test.js.map +1 -0
  87. package/lib/__tests__/logic/compareAddress.unit.test.d.ts +2 -0
  88. package/lib/__tests__/logic/compareAddress.unit.test.d.ts.map +1 -0
  89. package/lib/__tests__/logic/compareAddress.unit.test.js +26 -0
  90. package/lib/__tests__/logic/compareAddress.unit.test.js.map +1 -0
  91. package/lib/__tests__/logic/createTransaction.test.d.ts +2 -0
  92. package/lib/__tests__/logic/createTransaction.test.d.ts.map +1 -0
  93. package/lib/__tests__/logic/createTransaction.test.js +29 -0
  94. package/lib/__tests__/logic/createTransaction.test.js.map +1 -0
  95. package/lib/__tests__/logic/getBalances.test.d.ts +2 -0
  96. package/lib/__tests__/logic/getBalances.test.d.ts.map +1 -0
  97. package/lib/__tests__/logic/getBalances.test.js +62 -0
  98. package/lib/__tests__/logic/getBalances.test.js.map +1 -0
  99. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.d.ts +2 -0
  100. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.d.ts.map +1 -0
  101. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.js +186 -0
  102. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.js.map +1 -0
  103. package/lib/__tests__/logic/getFunctionAddress.unit.test.d.ts +2 -0
  104. package/lib/__tests__/logic/getFunctionAddress.unit.test.d.ts.map +1 -0
  105. package/lib/__tests__/logic/getFunctionAddress.unit.test.js +29 -0
  106. package/lib/__tests__/logic/getFunctionAddress.unit.test.js.map +1 -0
  107. package/lib/__tests__/logic/getResourceAddress.unit.test.d.ts +2 -0
  108. package/lib/__tests__/logic/getResourceAddress.unit.test.d.ts.map +1 -0
  109. package/lib/__tests__/logic/getResourceAddress.unit.test.js +218 -0
  110. package/lib/__tests__/logic/getResourceAddress.unit.test.js.map +1 -0
  111. package/lib/__tests__/logic/isTestnet.unit.test.d.ts +2 -0
  112. package/lib/__tests__/logic/isTestnet.unit.test.d.ts.map +1 -0
  113. package/lib/__tests__/logic/isTestnet.unit.test.js +12 -0
  114. package/lib/__tests__/logic/isTestnet.unit.test.js.map +1 -0
  115. package/lib/__tests__/logic/normalizeAddress.unit.test.d.ts +2 -0
  116. package/lib/__tests__/logic/normalizeAddress.unit.test.d.ts.map +1 -0
  117. package/lib/__tests__/logic/normalizeAddress.unit.test.js +12 -0
  118. package/lib/__tests__/logic/normalizeAddress.unit.test.js.map +1 -0
  119. package/lib/__tests__/logic/processRecipients.unit.test.d.ts +2 -0
  120. package/lib/__tests__/logic/processRecipients.unit.test.d.ts.map +1 -0
  121. package/lib/__tests__/logic/processRecipients.unit.test.js +79 -0
  122. package/lib/__tests__/logic/processRecipients.unit.test.js.map +1 -0
  123. package/lib/__tests__/logic/staking.test.d.ts +2 -0
  124. package/lib/__tests__/logic/staking.test.d.ts.map +1 -0
  125. package/lib/__tests__/logic/staking.test.js +202 -0
  126. package/lib/__tests__/logic/staking.test.js.map +1 -0
  127. package/lib/__tests__/network/client.test.d.ts +2 -0
  128. package/lib/__tests__/network/client.test.d.ts.map +1 -0
  129. package/lib/__tests__/network/client.test.js +1179 -0
  130. package/lib/__tests__/network/client.test.js.map +1 -0
  131. package/lib/__tests__/network/index.test.d.ts +2 -0
  132. package/lib/__tests__/network/index.test.d.ts.map +1 -0
  133. package/lib/__tests__/network/index.test.js +51 -0
  134. package/lib/__tests__/network/index.test.js.map +1 -0
  135. package/lib/__tests__/network/validators.test.d.ts +2 -0
  136. package/lib/__tests__/network/validators.test.d.ts.map +1 -0
  137. package/lib/__tests__/network/validators.test.js +102 -0
  138. package/lib/__tests__/network/validators.test.js.map +1 -0
  139. package/lib/__tests__/signer/index.test.d.ts +2 -0
  140. package/lib/__tests__/signer/index.test.d.ts.map +1 -0
  141. package/lib/__tests__/signer/index.test.js +26 -0
  142. package/lib/__tests__/signer/index.test.js.map +1 -0
  143. package/lib/__tests__/utils/IconGenerator.test.d.ts +2 -0
  144. package/lib/__tests__/utils/IconGenerator.test.d.ts.map +1 -0
  145. package/lib/__tests__/utils/IconGenerator.test.js +14 -0
  146. package/lib/__tests__/utils/IconGenerator.test.js.map +1 -0
  147. package/lib/__tests__/utils/index.test.d.ts +2 -0
  148. package/lib/__tests__/utils/index.test.d.ts.map +1 -0
  149. package/lib/__tests__/utils/index.test.js +11 -0
  150. package/lib/__tests__/utils/index.test.js.map +1 -0
  151. package/lib-es/__tests__/api/craftTransaction.unit.test.d.ts +2 -0
  152. package/lib-es/__tests__/api/craftTransaction.unit.test.d.ts.map +1 -0
  153. package/lib-es/__tests__/api/craftTransaction.unit.test.js +175 -0
  154. package/lib-es/__tests__/api/craftTransaction.unit.test.js.map +1 -0
  155. package/lib-es/__tests__/api/getBalance.unit.test.d.ts +2 -0
  156. package/lib-es/__tests__/api/getBalance.unit.test.d.ts.map +1 -0
  157. package/lib-es/__tests__/api/getBalance.unit.test.js +78 -0
  158. package/lib-es/__tests__/api/getBalance.unit.test.js.map +1 -0
  159. package/lib-es/__tests__/api/index.integ.test.d.ts +2 -0
  160. package/lib-es/__tests__/api/index.integ.test.d.ts.map +1 -0
  161. package/lib-es/__tests__/api/index.integ.test.js +338 -0
  162. package/lib-es/__tests__/api/index.integ.test.js.map +1 -0
  163. package/lib-es/__tests__/api/index.test.d.ts +2 -0
  164. package/lib-es/__tests__/api/index.test.d.ts.map +1 -0
  165. package/lib-es/__tests__/api/index.test.js +61 -0
  166. package/lib-es/__tests__/api/index.test.js.map +1 -0
  167. package/lib-es/__tests__/bridge/broadcast.test.d.ts +2 -0
  168. package/lib-es/__tests__/bridge/broadcast.test.d.ts.map +1 -0
  169. package/lib-es/__tests__/bridge/broadcast.test.js +87 -0
  170. package/lib-es/__tests__/bridge/broadcast.test.js.map +1 -0
  171. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.d.ts +2 -0
  172. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.d.ts.map +1 -0
  173. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.js +123 -0
  174. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.js.map +1 -0
  175. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.d.ts +2 -0
  176. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.d.ts.map +1 -0
  177. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.js +70 -0
  178. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.js.map +1 -0
  179. package/lib-es/__tests__/bridge/getFeesForTransaction.test.d.ts +2 -0
  180. package/lib-es/__tests__/bridge/getFeesForTransaction.test.d.ts.map +1 -0
  181. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js +252 -0
  182. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js.map +1 -0
  183. package/lib-es/__tests__/bridge/getTransactionStatus.test.d.ts +2 -0
  184. package/lib-es/__tests__/bridge/getTransactionStatus.test.d.ts.map +1 -0
  185. package/lib-es/__tests__/bridge/getTransactionStatus.test.js +448 -0
  186. package/lib-es/__tests__/bridge/getTransactionStatus.test.js.map +1 -0
  187. package/lib-es/__tests__/bridge/index.test.d.ts +2 -0
  188. package/lib-es/__tests__/bridge/index.test.d.ts.map +1 -0
  189. package/lib-es/__tests__/bridge/index.test.js +105 -0
  190. package/lib-es/__tests__/bridge/index.test.js.map +1 -0
  191. package/lib-es/__tests__/bridge/logic.test.d.ts +2 -0
  192. package/lib-es/__tests__/bridge/logic.test.d.ts.map +1 -0
  193. package/lib-es/__tests__/bridge/logic.test.js +992 -0
  194. package/lib-es/__tests__/bridge/logic.test.js.map +1 -0
  195. package/lib-es/__tests__/bridge/prepareTransaction.test.d.ts +2 -0
  196. package/lib-es/__tests__/bridge/prepareTransaction.test.d.ts.map +1 -0
  197. package/lib-es/__tests__/bridge/prepareTransaction.test.js +104 -0
  198. package/lib-es/__tests__/bridge/prepareTransaction.test.js.map +1 -0
  199. package/lib-es/__tests__/bridge/serialization.d.ts +2 -0
  200. package/lib-es/__tests__/bridge/serialization.d.ts.map +1 -0
  201. package/lib-es/__tests__/bridge/serialization.js +86 -0
  202. package/lib-es/__tests__/bridge/serialization.js.map +1 -0
  203. package/lib-es/__tests__/bridge/signOperation.test.d.ts +2 -0
  204. package/lib-es/__tests__/bridge/signOperation.test.d.ts.map +1 -0
  205. package/lib-es/__tests__/bridge/signOperation.test.js +271 -0
  206. package/lib-es/__tests__/bridge/signOperation.test.js.map +1 -0
  207. package/lib-es/__tests__/bridge/synchronisation.test.d.ts +2 -0
  208. package/lib-es/__tests__/bridge/synchronisation.test.d.ts.map +1 -0
  209. package/lib-es/__tests__/bridge/synchronisation.test.js +2221 -0
  210. package/lib-es/__tests__/bridge/synchronisation.test.js.map +1 -0
  211. package/lib-es/__tests__/bridge/transaction.test.d.ts +2 -0
  212. package/lib-es/__tests__/bridge/transaction.test.d.ts.map +1 -0
  213. package/lib-es/__tests__/bridge/transaction.test.js +216 -0
  214. package/lib-es/__tests__/bridge/transaction.test.js.map +1 -0
  215. package/lib-es/__tests__/errors.test.d.ts +2 -0
  216. package/lib-es/__tests__/errors.test.d.ts.map +1 -0
  217. package/lib-es/__tests__/errors.test.js +16 -0
  218. package/lib-es/__tests__/errors.test.js.map +1 -0
  219. package/lib-es/__tests__/index.test.d.ts +2 -0
  220. package/lib-es/__tests__/index.test.d.ts.map +1 -0
  221. package/lib-es/__tests__/index.test.js +25 -0
  222. package/lib-es/__tests__/index.test.js.map +1 -0
  223. package/lib-es/__tests__/logic/buildTransaction.test.d.ts +2 -0
  224. package/lib-es/__tests__/logic/buildTransaction.test.d.ts.map +1 -0
  225. package/lib-es/__tests__/logic/buildTransaction.test.js +109 -0
  226. package/lib-es/__tests__/logic/buildTransaction.test.js.map +1 -0
  227. package/lib-es/__tests__/logic/calculateAmount.unit.test.d.ts +2 -0
  228. package/lib-es/__tests__/logic/calculateAmount.unit.test.d.ts.map +1 -0
  229. package/lib-es/__tests__/logic/calculateAmount.unit.test.js +40 -0
  230. package/lib-es/__tests__/logic/calculateAmount.unit.test.js.map +1 -0
  231. package/lib-es/__tests__/logic/combine.unit.test.d.ts +2 -0
  232. package/lib-es/__tests__/logic/combine.unit.test.d.ts.map +1 -0
  233. package/lib-es/__tests__/logic/combine.unit.test.js +45 -0
  234. package/lib-es/__tests__/logic/combine.unit.test.js.map +1 -0
  235. package/lib-es/__tests__/logic/compareAddress.unit.test.d.ts +2 -0
  236. package/lib-es/__tests__/logic/compareAddress.unit.test.d.ts.map +1 -0
  237. package/lib-es/__tests__/logic/compareAddress.unit.test.js +24 -0
  238. package/lib-es/__tests__/logic/compareAddress.unit.test.js.map +1 -0
  239. package/lib-es/__tests__/logic/createTransaction.test.d.ts +2 -0
  240. package/lib-es/__tests__/logic/createTransaction.test.d.ts.map +1 -0
  241. package/lib-es/__tests__/logic/createTransaction.test.js +24 -0
  242. package/lib-es/__tests__/logic/createTransaction.test.js.map +1 -0
  243. package/lib-es/__tests__/logic/getBalances.test.d.ts +2 -0
  244. package/lib-es/__tests__/logic/getBalances.test.d.ts.map +1 -0
  245. package/lib-es/__tests__/logic/getBalances.test.js +60 -0
  246. package/lib-es/__tests__/logic/getBalances.test.js.map +1 -0
  247. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.d.ts +2 -0
  248. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.d.ts.map +1 -0
  249. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.js +181 -0
  250. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.js.map +1 -0
  251. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.d.ts +2 -0
  252. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.d.ts.map +1 -0
  253. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.js +27 -0
  254. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.js.map +1 -0
  255. package/lib-es/__tests__/logic/getResourceAddress.unit.test.d.ts +2 -0
  256. package/lib-es/__tests__/logic/getResourceAddress.unit.test.d.ts.map +1 -0
  257. package/lib-es/__tests__/logic/getResourceAddress.unit.test.js +216 -0
  258. package/lib-es/__tests__/logic/getResourceAddress.unit.test.js.map +1 -0
  259. package/lib-es/__tests__/logic/isTestnet.unit.test.d.ts +2 -0
  260. package/lib-es/__tests__/logic/isTestnet.unit.test.d.ts.map +1 -0
  261. package/lib-es/__tests__/logic/isTestnet.unit.test.js +10 -0
  262. package/lib-es/__tests__/logic/isTestnet.unit.test.js.map +1 -0
  263. package/lib-es/__tests__/logic/normalizeAddress.unit.test.d.ts +2 -0
  264. package/lib-es/__tests__/logic/normalizeAddress.unit.test.d.ts.map +1 -0
  265. package/lib-es/__tests__/logic/normalizeAddress.unit.test.js +10 -0
  266. package/lib-es/__tests__/logic/normalizeAddress.unit.test.js.map +1 -0
  267. package/lib-es/__tests__/logic/processRecipients.unit.test.d.ts +2 -0
  268. package/lib-es/__tests__/logic/processRecipients.unit.test.d.ts.map +1 -0
  269. package/lib-es/__tests__/logic/processRecipients.unit.test.js +74 -0
  270. package/lib-es/__tests__/logic/processRecipients.unit.test.js.map +1 -0
  271. package/lib-es/__tests__/logic/staking.test.d.ts +2 -0
  272. package/lib-es/__tests__/logic/staking.test.d.ts.map +1 -0
  273. package/lib-es/__tests__/logic/staking.test.js +197 -0
  274. package/lib-es/__tests__/logic/staking.test.js.map +1 -0
  275. package/lib-es/__tests__/network/client.test.d.ts +2 -0
  276. package/lib-es/__tests__/network/client.test.d.ts.map +1 -0
  277. package/lib-es/__tests__/network/client.test.js +1174 -0
  278. package/lib-es/__tests__/network/client.test.js.map +1 -0
  279. package/lib-es/__tests__/network/index.test.d.ts +2 -0
  280. package/lib-es/__tests__/network/index.test.d.ts.map +1 -0
  281. package/lib-es/__tests__/network/index.test.js +49 -0
  282. package/lib-es/__tests__/network/index.test.js.map +1 -0
  283. package/lib-es/__tests__/network/validators.test.d.ts +2 -0
  284. package/lib-es/__tests__/network/validators.test.d.ts.map +1 -0
  285. package/lib-es/__tests__/network/validators.test.js +97 -0
  286. package/lib-es/__tests__/network/validators.test.js.map +1 -0
  287. package/lib-es/__tests__/signer/index.test.d.ts +2 -0
  288. package/lib-es/__tests__/signer/index.test.d.ts.map +1 -0
  289. package/lib-es/__tests__/signer/index.test.js +21 -0
  290. package/lib-es/__tests__/signer/index.test.js.map +1 -0
  291. package/lib-es/__tests__/utils/IconGenerator.test.d.ts +2 -0
  292. package/lib-es/__tests__/utils/IconGenerator.test.d.ts.map +1 -0
  293. package/lib-es/__tests__/utils/IconGenerator.test.js +12 -0
  294. package/lib-es/__tests__/utils/IconGenerator.test.js.map +1 -0
  295. package/lib-es/__tests__/utils/index.test.d.ts +2 -0
  296. package/lib-es/__tests__/utils/index.test.d.ts.map +1 -0
  297. package/lib-es/__tests__/utils/index.test.js +9 -0
  298. package/lib-es/__tests__/utils/index.test.js.map +1 -0
  299. package/package.json +10 -10
@@ -0,0 +1,997 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const bignumber_js_1 = __importDefault(require("bignumber.js"));
7
+ const constants_1 = require("../../constants");
8
+ const logic_1 = require("../../bridge/logic");
9
+ const bridge_fixture_1 = require("../../bridge/bridge.fixture");
10
+ const cryptoassets_1 = require("@ledgerhq/cryptoassets");
11
+ const index_1 = require("@ledgerhq/coin-framework/account/index");
12
+ const normalizeTransactionOptions_1 = require("../../logic/normalizeTransactionOptions");
13
+ jest.mock("@ledgerhq/cryptoassets");
14
+ jest.mock("@ledgerhq/coin-framework/account/index");
15
+ describe("Aptos logic ", () => {
16
+ describe("getMaxSendBalance", () => {
17
+ it("should return the correct max send balance when amount is greater than total gas", () => {
18
+ const amount = new bignumber_js_1.default(1000000);
19
+ const account = (0, bridge_fixture_1.createFixtureAccount)({ balance: amount, spendableBalance: amount });
20
+ const transaction = (0, bridge_fixture_1.createFixtureTransaction)();
21
+ const gas = new bignumber_js_1.default(200);
22
+ const gasPrice = new bignumber_js_1.default(100);
23
+ const result = (0, logic_1.getMaxSendBalance)(account, transaction, gas, gasPrice);
24
+ expect(result.isEqualTo(amount.minus(gas.multipliedBy(gasPrice)))).toBe(true);
25
+ });
26
+ it("should return zero when amount is less than total gas", () => {
27
+ const account = (0, bridge_fixture_1.createFixtureAccount)();
28
+ const transaction = (0, bridge_fixture_1.createFixtureTransaction)();
29
+ const gas = new bignumber_js_1.default(200);
30
+ const gasPrice = new bignumber_js_1.default(100);
31
+ const result = (0, logic_1.getMaxSendBalance)(account, transaction, gas, gasPrice);
32
+ expect(result.isEqualTo(new bignumber_js_1.default(0))).toBe(true);
33
+ });
34
+ it("should return zero when amount is equal to total gas", () => {
35
+ const account = (0, bridge_fixture_1.createFixtureAccount)();
36
+ const transaction = (0, bridge_fixture_1.createFixtureTransaction)();
37
+ const gas = new bignumber_js_1.default(200);
38
+ const gasPrice = new bignumber_js_1.default(100);
39
+ const result = (0, logic_1.getMaxSendBalance)(account, transaction, gas, gasPrice);
40
+ expect(result.isEqualTo(new bignumber_js_1.default(0))).toBe(true);
41
+ });
42
+ it("should handle zero amount", () => {
43
+ const account = (0, bridge_fixture_1.createFixtureAccount)();
44
+ const transaction = (0, bridge_fixture_1.createFixtureTransaction)();
45
+ const gas = new bignumber_js_1.default(200);
46
+ const gasPrice = new bignumber_js_1.default(100);
47
+ const result = (0, logic_1.getMaxSendBalance)(account, transaction, gas, gasPrice);
48
+ expect(result.isEqualTo(new bignumber_js_1.default(0))).toBe(true);
49
+ });
50
+ it("should handle zero gas and gas price", () => {
51
+ const amount = new bignumber_js_1.default(1000000);
52
+ const account = (0, bridge_fixture_1.createFixtureAccount)({ balance: amount, spendableBalance: amount });
53
+ const transaction = (0, bridge_fixture_1.createFixtureTransaction)();
54
+ const gas = new bignumber_js_1.default(0);
55
+ const gasPrice = new bignumber_js_1.default(0);
56
+ const result = (0, logic_1.getMaxSendBalance)(account, transaction, gas, gasPrice);
57
+ expect(result.isEqualTo(amount)).toBe(true);
58
+ });
59
+ });
60
+ describe("normalizeTransactionOptions", () => {
61
+ it("should normalize transaction options", () => {
62
+ const options = {
63
+ maxGasAmount: "1000",
64
+ gasUnitPrice: "10",
65
+ };
66
+ const result = (0, normalizeTransactionOptions_1.normalizeTransactionOptions)(options);
67
+ expect(result).toEqual(options);
68
+ });
69
+ it("should return undefined for empty values", () => {
70
+ const options = {
71
+ maxGasAmount: "",
72
+ gasUnitPrice: "",
73
+ };
74
+ const result = (0, normalizeTransactionOptions_1.normalizeTransactionOptions)(options);
75
+ expect(result).toEqual({
76
+ maxGasAmount: undefined,
77
+ gasUnitPrice: undefined,
78
+ });
79
+ });
80
+ });
81
+ describe("getBlankOperation", () => {
82
+ it("should return a blank operation", () => {
83
+ const tx = {
84
+ hash: "0x123",
85
+ block: { hash: "0xabc", height: 1 },
86
+ timestamp: "1000000",
87
+ sequence_number: "1",
88
+ version: "1",
89
+ };
90
+ const id = "test_id";
91
+ const result = (0, logic_1.getBlankOperation)(tx, id);
92
+ expect(result).toEqual({
93
+ id: "",
94
+ hash: "0x123",
95
+ type: "",
96
+ value: new bignumber_js_1.default(0),
97
+ fee: new bignumber_js_1.default(0),
98
+ blockHash: "0xabc",
99
+ blockHeight: 1,
100
+ senders: [],
101
+ recipients: [],
102
+ accountId: id,
103
+ date: new Date(1000),
104
+ extra: { version: "1" },
105
+ transactionSequenceNumber: 1,
106
+ hasFailed: false,
107
+ });
108
+ });
109
+ it("should return a blank operation even when some transaction fields are missing", () => {
110
+ const tx = {
111
+ hash: "0x123",
112
+ timestamp: "1000000",
113
+ sequence_number: "1",
114
+ };
115
+ const id = "test_id";
116
+ const result = (0, logic_1.getBlankOperation)(tx, id);
117
+ expect(result).toEqual({
118
+ id: "",
119
+ hash: "0x123",
120
+ type: "",
121
+ value: new bignumber_js_1.default(0),
122
+ fee: new bignumber_js_1.default(0),
123
+ blockHash: undefined,
124
+ blockHeight: undefined,
125
+ senders: [],
126
+ recipients: [],
127
+ accountId: id,
128
+ date: new Date(1000),
129
+ extra: { version: undefined },
130
+ transactionSequenceNumber: 1,
131
+ hasFailed: false,
132
+ });
133
+ });
134
+ });
135
+ });
136
+ describe("Aptos sync logic ", () => {
137
+ describe("txsToOps", () => {
138
+ it("should convert Aptos transactions to operations correctly", () => {
139
+ const address = "0x11";
140
+ const id = "test_id";
141
+ const txs = [
142
+ {
143
+ hash: "0x123",
144
+ sender: "0x11",
145
+ gas_used: "200",
146
+ gas_unit_price: "100",
147
+ success: true,
148
+ payload: {
149
+ type: "entry_function_payload",
150
+ function: "0x1::coin::transfer",
151
+ type_arguments: [],
152
+ arguments: ["0x12", 100],
153
+ },
154
+ events: [
155
+ {
156
+ type: "0x1::coin::WithdrawEvent",
157
+ guid: {
158
+ account_address: "0x11",
159
+ creation_number: "1",
160
+ },
161
+ data: {
162
+ amount: "100",
163
+ },
164
+ },
165
+ {
166
+ type: "0x1::coin::DepositEvent",
167
+ guid: {
168
+ account_address: "0x12",
169
+ creation_number: "2",
170
+ },
171
+ data: {
172
+ amount: "100",
173
+ },
174
+ },
175
+ ],
176
+ changes: [
177
+ {
178
+ type: "write_resource",
179
+ data: {
180
+ type: constants_1.APTOS_COIN_CHANGE,
181
+ data: {
182
+ withdraw_events: {
183
+ guid: {
184
+ id: {
185
+ addr: "0x11",
186
+ creation_num: "1",
187
+ },
188
+ },
189
+ },
190
+ deposit_events: {
191
+ guid: {
192
+ id: {
193
+ addr: "0x12",
194
+ creation_num: "2",
195
+ },
196
+ },
197
+ },
198
+ },
199
+ },
200
+ },
201
+ ],
202
+ block: { hash: "0xabc", height: 1 },
203
+ timestamp: "1000000",
204
+ sequence_number: "1",
205
+ },
206
+ ];
207
+ const [result] = (0, logic_1.txsToOps)({ address }, id, txs);
208
+ expect(result).toHaveLength(1);
209
+ expect(result[0]).toEqual({
210
+ id: expect.any(String),
211
+ hash: "0x123",
212
+ type: constants_1.OP_TYPE.OUT,
213
+ value: new bignumber_js_1.default(100),
214
+ fee: new bignumber_js_1.default(20000),
215
+ blockHash: "0xabc",
216
+ blockHeight: 1,
217
+ senders: ["0x11"],
218
+ recipients: ["0x0000000000000000000000000000000000000000000000000000000000000012"],
219
+ accountId: id,
220
+ date: new Date(1000),
221
+ extra: { version: undefined },
222
+ transactionSequenceNumber: 1,
223
+ hasFailed: false,
224
+ });
225
+ });
226
+ it("should skip transactions without functions in payload", () => {
227
+ const address = "0x11";
228
+ const id = "test_id";
229
+ const txs = [
230
+ {
231
+ hash: "0x123",
232
+ sender: "0x11",
233
+ gas_used: "200",
234
+ gas_unit_price: "100",
235
+ success: true,
236
+ payload: {},
237
+ events: [],
238
+ changes: [],
239
+ block: { hash: "0xabc", height: 1 },
240
+ timestamp: "1000000",
241
+ sequence_number: "1",
242
+ },
243
+ ];
244
+ const [result] = (0, logic_1.txsToOps)({ address }, id, txs);
245
+ expect(result).toHaveLength(0);
246
+ });
247
+ it("should skip transactions that result in no Aptos change", () => {
248
+ const address = "0x11";
249
+ const id = "test_id";
250
+ const txs = [
251
+ {
252
+ hash: "0x123",
253
+ sender: "0x12",
254
+ gas_used: "200",
255
+ gas_unit_price: "100",
256
+ success: true,
257
+ payload: {
258
+ type: "entry_function_payload",
259
+ function: "0x1::coin::transfer",
260
+ type_arguments: [],
261
+ arguments: ["0x11", 100],
262
+ },
263
+ events: [],
264
+ changes: [],
265
+ block: { hash: "0xabc", height: 1 },
266
+ timestamp: "1000000",
267
+ sequence_number: "1",
268
+ },
269
+ ];
270
+ const [result] = (0, logic_1.txsToOps)({ address }, id, txs);
271
+ expect(result).toHaveLength(0);
272
+ });
273
+ it("should handle failed transactions", () => {
274
+ const address = "0xa0d8";
275
+ const id = "test_id";
276
+ const txs = [
277
+ {
278
+ hash: "0x0189",
279
+ sender: "0xa0d8",
280
+ gas_used: "200",
281
+ gas_unit_price: "100",
282
+ success: false,
283
+ payload: {
284
+ function: "0x1::coin::transfer",
285
+ type_arguments: ["0xd111::staked_coin::StakedAptos"],
286
+ arguments: ["0x4e5e", "50000000"],
287
+ type: "entry_function_payload",
288
+ },
289
+ events: [
290
+ {
291
+ guid: {
292
+ creation_number: "0",
293
+ account_address: "0x0",
294
+ },
295
+ sequence_number: "0",
296
+ type: "0x1::transaction_fee::FeeStatement",
297
+ data: {
298
+ execution_gas_units: "5",
299
+ io_gas_units: "4",
300
+ storage_fee_octas: "0",
301
+ storage_fee_refund_octas: "0",
302
+ total_charge_gas_units: "8",
303
+ },
304
+ },
305
+ ],
306
+ changes: [
307
+ {
308
+ address: "0xa0d8",
309
+ state_key_hash: "0x1709",
310
+ data: {
311
+ type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
312
+ data: {
313
+ coin: {
314
+ value: "573163341",
315
+ },
316
+ deposit_events: {
317
+ counter: "45",
318
+ guid: {
319
+ id: {
320
+ addr: "0xa0d8",
321
+ creation_num: "2",
322
+ },
323
+ },
324
+ },
325
+ frozen: false,
326
+ withdraw_events: {
327
+ counter: "82",
328
+ guid: {
329
+ id: {
330
+ addr: "0xa0d8",
331
+ creation_num: "3",
332
+ },
333
+ },
334
+ },
335
+ },
336
+ },
337
+ type: "write_resource",
338
+ },
339
+ {
340
+ address: "0xa0d8",
341
+ state_key_hash: "0x6f1e",
342
+ data: {
343
+ type: "0x1::account::Account",
344
+ data: {
345
+ authentication_key: "0xa0d8",
346
+ coin_register_events: {
347
+ counter: "5",
348
+ guid: {
349
+ id: {
350
+ addr: "0xa0d8",
351
+ creation_num: "0",
352
+ },
353
+ },
354
+ },
355
+ guid_creation_num: "12",
356
+ key_rotation_events: {
357
+ counter: "0",
358
+ guid: {
359
+ id: {
360
+ addr: "0xa0d8",
361
+ creation_num: "1",
362
+ },
363
+ },
364
+ },
365
+ rotation_capability_offer: {
366
+ for: {
367
+ vec: [],
368
+ },
369
+ },
370
+ sequence_number: "83",
371
+ signer_capability_offer: {
372
+ for: {
373
+ vec: [],
374
+ },
375
+ },
376
+ },
377
+ },
378
+ type: "write_resource",
379
+ },
380
+ {
381
+ state_key_hash: "0x6e4b",
382
+ handle: "0x1b85",
383
+ key: "0x0619",
384
+ value: "0x72c5e483c25c96010000000000000000",
385
+ data: null,
386
+ type: "write_table_item",
387
+ },
388
+ ],
389
+ block: {
390
+ hash: "0xc496",
391
+ height: 1,
392
+ },
393
+ timestamp: "1000000",
394
+ sequence_number: "1",
395
+ },
396
+ ];
397
+ const [result] = (0, logic_1.txsToOps)({ address }, id, txs);
398
+ expect(result).toHaveLength(1);
399
+ expect(result[0]).toEqual({
400
+ id: expect.any(String),
401
+ hash: "0x0189",
402
+ type: constants_1.OP_TYPE.OUT,
403
+ value: new bignumber_js_1.default(20000),
404
+ fee: new bignumber_js_1.default(20000),
405
+ blockHash: "0xc496",
406
+ blockHeight: 1,
407
+ senders: ["0xa0d8"],
408
+ recipients: ["0x0000000000000000000000000000000000000000000000000000000000004e5e"],
409
+ accountId: id,
410
+ date: new Date(1000),
411
+ extra: { version: undefined },
412
+ transactionSequenceNumber: 1,
413
+ hasFailed: true,
414
+ });
415
+ });
416
+ it("should convert Aptos token transactions to operations correctly", () => {
417
+ cryptoassets_1.findTokenByAddressInCurrency.mockReturnValue({
418
+ type: "TokenCurrency",
419
+ id: "aptos/coin/dstapt::staked_coin::stakedaptos",
420
+ contractAddress: "0xd111::staked_coin::StakedAptos",
421
+ parentCurrency: {
422
+ type: "CryptoCurrency",
423
+ id: "aptos",
424
+ coinType: 637,
425
+ name: "Aptos",
426
+ managerAppName: "Aptos",
427
+ ticker: "APT",
428
+ scheme: "aptos",
429
+ color: "#231F20",
430
+ family: "aptos",
431
+ units: [
432
+ {
433
+ name: "APT",
434
+ code: "APT",
435
+ magnitude: 8,
436
+ },
437
+ ],
438
+ explorerViews: [
439
+ {
440
+ address: "https://explorer.aptoslabs.com/account/$address?network=mainnet",
441
+ tx: "https://explorer.aptoslabs.com/txn/$hash?network=mainnet",
442
+ },
443
+ ],
444
+ },
445
+ name: "dstAPT",
446
+ tokenType: "coin",
447
+ ticker: "dstAPT",
448
+ disableCountervalue: false,
449
+ delisted: false,
450
+ units: [
451
+ {
452
+ name: "dstAPT",
453
+ code: "dstAPT",
454
+ magnitude: 8,
455
+ },
456
+ ],
457
+ });
458
+ jest.mock("../../bridge/logic", () => ({
459
+ ...jest.requireActual("../../bridge/logic"),
460
+ getResourceAddress: jest.fn().mockReturnValue("0xd111::staked_coin::StakedAptos"),
461
+ }));
462
+ index_1.decodeTokenAccountId.mockReturnValue({
463
+ accountId: "token_account_id",
464
+ });
465
+ const address = "0xa0d";
466
+ const id = "test_id";
467
+ const txs = [
468
+ {
469
+ hash: "0x123",
470
+ sender: address,
471
+ gas_used: "200",
472
+ gas_unit_price: "100",
473
+ success: true,
474
+ payload: {
475
+ function: "0x1::aptos_account::transfer_coins",
476
+ type_arguments: ["0xd111::staked_coin::StakedAptos"],
477
+ arguments: ["0x4e5", "1500000"],
478
+ type: "entry_function_payload",
479
+ },
480
+ events: [
481
+ {
482
+ guid: {
483
+ creation_number: "11",
484
+ account_address: "0xa0d",
485
+ },
486
+ sequence_number: "12",
487
+ type: "0x1::coin::WithdrawEvent",
488
+ data: {
489
+ amount: "1500000",
490
+ },
491
+ },
492
+ {
493
+ guid: {
494
+ creation_number: "4",
495
+ account_address: "0x4e5",
496
+ },
497
+ sequence_number: "8",
498
+ type: "0x1::coin::DepositEvent",
499
+ data: {
500
+ amount: "1500000",
501
+ },
502
+ },
503
+ {
504
+ guid: {
505
+ creation_number: "0",
506
+ account_address: "0x0",
507
+ },
508
+ sequence_number: "0",
509
+ type: "0x1::transaction_fee::FeeStatement",
510
+ data: {
511
+ execution_gas_units: "6",
512
+ io_gas_units: "6",
513
+ storage_fee_octas: "0",
514
+ storage_fee_refund_octas: "0",
515
+ total_charge_gas_units: "12",
516
+ },
517
+ },
518
+ ],
519
+ changes: [
520
+ {
521
+ address: "0x4e5",
522
+ state_key_hash: "0x3c0",
523
+ data: {
524
+ type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
525
+ data: {
526
+ coin: {
527
+ value: "4000000",
528
+ },
529
+ deposit_events: {
530
+ counter: "9",
531
+ guid: {
532
+ id: {
533
+ addr: "0x4e5",
534
+ creation_num: "4",
535
+ },
536
+ },
537
+ },
538
+ frozen: false,
539
+ withdraw_events: {
540
+ counter: "6",
541
+ guid: {
542
+ id: {
543
+ addr: "0x4e5",
544
+ creation_num: "5",
545
+ },
546
+ },
547
+ },
548
+ },
549
+ },
550
+ type: "write_resource",
551
+ },
552
+ {
553
+ address: "0xa0d",
554
+ state_key_hash: "0x1709",
555
+ data: {
556
+ type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
557
+ data: {
558
+ coin: {
559
+ value: "68254118",
560
+ },
561
+ deposit_events: {
562
+ counter: "46",
563
+ guid: {
564
+ id: {
565
+ addr: "0xa0d",
566
+ creation_num: "2",
567
+ },
568
+ },
569
+ },
570
+ frozen: false,
571
+ withdraw_events: {
572
+ counter: "89",
573
+ guid: {
574
+ id: {
575
+ addr: "0xa0d",
576
+ creation_num: "3",
577
+ },
578
+ },
579
+ },
580
+ },
581
+ },
582
+ type: "write_resource",
583
+ },
584
+ {
585
+ address: "0xa0d",
586
+ state_key_hash: "0x5520",
587
+ data: {
588
+ type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
589
+ data: {
590
+ coin: {
591
+ value: "1000000",
592
+ },
593
+ deposit_events: {
594
+ counter: "7",
595
+ guid: {
596
+ id: {
597
+ addr: "0xa0d",
598
+ creation_num: "10",
599
+ },
600
+ },
601
+ },
602
+ frozen: false,
603
+ withdraw_events: {
604
+ counter: "13",
605
+ guid: {
606
+ id: {
607
+ addr: "0xa0d",
608
+ creation_num: "11",
609
+ },
610
+ },
611
+ },
612
+ },
613
+ },
614
+ type: "write_resource",
615
+ },
616
+ {
617
+ address: "0xa0d",
618
+ state_key_hash: "0x6f1e",
619
+ data: {
620
+ type: "0x1::account::Account",
621
+ data: {
622
+ authentication_key: "0xa0d",
623
+ coin_register_events: {
624
+ counter: "5",
625
+ guid: {
626
+ id: {
627
+ addr: "0xa0d",
628
+ creation_num: "0",
629
+ },
630
+ },
631
+ },
632
+ guid_creation_num: "12",
633
+ key_rotation_events: {
634
+ counter: "0",
635
+ guid: {
636
+ id: {
637
+ addr: "0xa0d",
638
+ creation_num: "1",
639
+ },
640
+ },
641
+ },
642
+ rotation_capability_offer: {
643
+ for: {
644
+ vec: [],
645
+ },
646
+ },
647
+ sequence_number: "122",
648
+ signer_capability_offer: {
649
+ for: {
650
+ vec: [],
651
+ },
652
+ },
653
+ },
654
+ },
655
+ type: "write_resource",
656
+ },
657
+ {
658
+ state_key_hash: "0x6e4b",
659
+ handle: "0x1b85",
660
+ key: "0x0619",
661
+ value: "0x1ddaf8da3b1497010000000000000000",
662
+ data: null,
663
+ type: "write_table_item",
664
+ },
665
+ ],
666
+ block: { hash: "0xabc", height: 1 },
667
+ timestamp: "1000000",
668
+ sequence_number: "1",
669
+ },
670
+ ];
671
+ const [ops, tokenOps] = (0, logic_1.txsToOps)({ address }, id, txs);
672
+ expect(ops).toHaveLength(1);
673
+ expect(ops[0]).toEqual({
674
+ id: expect.any(String),
675
+ hash: "0x123",
676
+ type: "FEES",
677
+ value: new bignumber_js_1.default(20000),
678
+ fee: new bignumber_js_1.default(20000),
679
+ blockHash: "0xabc",
680
+ blockHeight: 1,
681
+ senders: ["0xa0d"],
682
+ recipients: ["0x00000000000000000000000000000000000000000000000000000000000004e5"],
683
+ accountId: "token_account_id",
684
+ date: new Date(1000),
685
+ extra: { version: undefined },
686
+ transactionSequenceNumber: 1,
687
+ hasFailed: false,
688
+ });
689
+ expect(tokenOps).toHaveLength(1);
690
+ expect(tokenOps[0]).toEqual({
691
+ id: expect.any(String),
692
+ hash: "0x123",
693
+ type: constants_1.OP_TYPE.OUT,
694
+ value: new bignumber_js_1.default(1500000),
695
+ fee: new bignumber_js_1.default(20000),
696
+ blockHash: "0xabc",
697
+ blockHeight: 1,
698
+ senders: ["0xa0d"],
699
+ recipients: ["0x00000000000000000000000000000000000000000000000000000000000004e5"],
700
+ date: new Date(1000),
701
+ extra: { version: undefined },
702
+ transactionSequenceNumber: 1,
703
+ hasFailed: false,
704
+ });
705
+ });
706
+ it("should convert Aptos token transactions to operations correctly", () => {
707
+ cryptoassets_1.findTokenByAddressInCurrency.mockReturnValue({
708
+ type: "TokenCurrency",
709
+ id: "aptos/fungible_asset/cellana_0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12",
710
+ contractAddress: "0x2ebb",
711
+ parentCurrency: {
712
+ type: "CryptoCurrency",
713
+ id: "aptos",
714
+ coinType: 637,
715
+ name: "Aptos",
716
+ managerAppName: "Aptos",
717
+ ticker: "APT",
718
+ scheme: "aptos",
719
+ color: "#231F20",
720
+ family: "aptos",
721
+ units: [
722
+ {
723
+ name: "APT",
724
+ code: "APT",
725
+ magnitude: 8,
726
+ },
727
+ ],
728
+ explorerViews: [
729
+ {
730
+ address: "https://explorer.aptoslabs.com/account/$address?network=mainnet",
731
+ tx: "https://explorer.aptoslabs.com/txn/$hash?network=mainnet",
732
+ },
733
+ ],
734
+ },
735
+ name: "CELLANA",
736
+ tokenType: "fungible_asset",
737
+ ticker: "CELL",
738
+ disableCountervalue: false,
739
+ delisted: false,
740
+ units: [
741
+ {
742
+ name: "CELLANA",
743
+ code: "CELL",
744
+ magnitude: 8,
745
+ },
746
+ ],
747
+ });
748
+ jest.mock("../../bridge/logic", () => ({
749
+ ...jest.requireActual("../../bridge/logic"),
750
+ getResourceAddress: jest.fn().mockReturnValue("0x2ebb"),
751
+ }));
752
+ index_1.encodeTokenAccountId.mockReturnValue("token_account_id");
753
+ const txs = [
754
+ {
755
+ hash: "0x10c9",
756
+ sender: "0xa0d8",
757
+ gas_used: "200",
758
+ gas_unit_price: "100",
759
+ success: true,
760
+ payload: {
761
+ function: "0x1::primary_fungible_store::transfer",
762
+ type_arguments: ["0x1::fungible_asset::Metadata"],
763
+ arguments: [
764
+ {
765
+ inner: "0x2ebb",
766
+ },
767
+ "0x6b8c",
768
+ "193",
769
+ ],
770
+ type: "entry_function_payload",
771
+ },
772
+ events: [
773
+ {
774
+ guid: {
775
+ creation_number: "0",
776
+ account_address: "0x0",
777
+ },
778
+ sequence_number: "0",
779
+ type: "0x1::fungible_asset::Withdraw",
780
+ data: {
781
+ amount: "193",
782
+ store: "0xd475",
783
+ },
784
+ },
785
+ {
786
+ guid: {
787
+ creation_number: "0",
788
+ account_address: "0x0",
789
+ },
790
+ sequence_number: "0",
791
+ type: "0x1::fungible_asset::Deposit",
792
+ data: {
793
+ amount: "193",
794
+ store: "0xaaa9",
795
+ },
796
+ },
797
+ {
798
+ guid: {
799
+ creation_number: "0",
800
+ account_address: "0x0",
801
+ },
802
+ sequence_number: "0",
803
+ type: "0x1::transaction_fee::FeeStatement",
804
+ data: {
805
+ execution_gas_units: "4",
806
+ io_gas_units: "6",
807
+ storage_fee_octas: "0",
808
+ storage_fee_refund_octas: "0",
809
+ total_charge_gas_units: "10",
810
+ },
811
+ },
812
+ ],
813
+ changes: [
814
+ {
815
+ address: "0xaaa9",
816
+ state_key_hash: "0x9a17",
817
+ data: {
818
+ type: "0x1::fungible_asset::FungibleStore",
819
+ data: {
820
+ balance: "10044959",
821
+ frozen: false,
822
+ metadata: {
823
+ inner: "0x2ebb",
824
+ },
825
+ },
826
+ },
827
+ type: "write_resource",
828
+ },
829
+ {
830
+ address: "0xaaa9",
831
+ state_key_hash: "0x9a17",
832
+ data: {
833
+ type: "0x1::object::ObjectCore",
834
+ data: {
835
+ allow_ungated_transfer: false,
836
+ guid_creation_num: "1125899906842625",
837
+ owner: "0x6b8c",
838
+ transfer_events: {
839
+ counter: "0",
840
+ guid: {
841
+ id: {
842
+ addr: "0xaaa9",
843
+ creation_num: "1125899906842624",
844
+ },
845
+ },
846
+ },
847
+ },
848
+ },
849
+ type: "write_resource",
850
+ },
851
+ {
852
+ address: "0xa0d8",
853
+ state_key_hash: "0x1709",
854
+ data: {
855
+ type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
856
+ data: {
857
+ coin: {
858
+ value: "98423118",
859
+ },
860
+ deposit_events: {
861
+ counter: "46",
862
+ guid: {
863
+ id: {
864
+ addr: "0xa0d8",
865
+ creation_num: "2",
866
+ },
867
+ },
868
+ },
869
+ frozen: false,
870
+ withdraw_events: {
871
+ counter: "88",
872
+ guid: {
873
+ id: {
874
+ addr: "0xa0d8",
875
+ creation_num: "3",
876
+ },
877
+ },
878
+ },
879
+ },
880
+ },
881
+ type: "write_resource",
882
+ },
883
+ {
884
+ address: "0xa0d8",
885
+ state_key_hash: "0x6f1e",
886
+ data: {
887
+ type: "0x1::account::Account",
888
+ data: {
889
+ authentication_key: "0xa0d8",
890
+ coin_register_events: {
891
+ counter: "5",
892
+ guid: {
893
+ id: {
894
+ addr: "0xa0d8",
895
+ creation_num: "0",
896
+ },
897
+ },
898
+ },
899
+ guid_creation_num: "12",
900
+ key_rotation_events: {
901
+ counter: "0",
902
+ guid: {
903
+ id: {
904
+ addr: "0xa0d8",
905
+ creation_num: "1",
906
+ },
907
+ },
908
+ },
909
+ rotation_capability_offer: {
910
+ for: {
911
+ vec: [],
912
+ },
913
+ },
914
+ sequence_number: "108",
915
+ signer_capability_offer: {
916
+ for: {
917
+ vec: [],
918
+ },
919
+ },
920
+ },
921
+ },
922
+ type: "write_resource",
923
+ },
924
+ {
925
+ address: "0xd475",
926
+ state_key_hash: "0x7567",
927
+ data: {
928
+ type: "0x1::fungible_asset::FungibleStore",
929
+ data: {
930
+ balance: "14000",
931
+ frozen: false,
932
+ metadata: {
933
+ inner: "0x2ebb",
934
+ },
935
+ },
936
+ },
937
+ type: "write_resource",
938
+ },
939
+ {
940
+ address: "0xd475",
941
+ state_key_hash: "0x7567",
942
+ data: {
943
+ type: "0x1::object::ObjectCore",
944
+ data: {
945
+ allow_ungated_transfer: false,
946
+ guid_creation_num: "1125899906842625",
947
+ owner: "0xa0d8",
948
+ transfer_events: {
949
+ counter: "0",
950
+ guid: {
951
+ id: {
952
+ addr: "0xd475",
953
+ creation_num: "1125899906842624",
954
+ },
955
+ },
956
+ },
957
+ },
958
+ },
959
+ type: "write_resource",
960
+ },
961
+ {
962
+ state_key_hash: "0x6e4b",
963
+ handle: "0x1b85",
964
+ key: "0x0619",
965
+ value: "0xad4388dc7daf96010000000000000000",
966
+ data: null,
967
+ type: "write_table_item",
968
+ },
969
+ ],
970
+ block: { hash: "0xabc", height: 1 },
971
+ timestamp: "1000000",
972
+ sequence_number: "1",
973
+ },
974
+ ];
975
+ const [ops, tokenOps] = (0, logic_1.txsToOps)({ address: "0x6b8c" }, "test_id", txs);
976
+ expect(ops).toHaveLength(0);
977
+ expect(tokenOps).toHaveLength(1);
978
+ expect(tokenOps[0]).toEqual({
979
+ id: expect.any(String),
980
+ accountId: "token_account_id",
981
+ hash: "0x10c9",
982
+ type: constants_1.OP_TYPE.IN,
983
+ value: new bignumber_js_1.default(193),
984
+ fee: new bignumber_js_1.default(20000),
985
+ blockHash: "0xabc",
986
+ blockHeight: 1,
987
+ senders: ["0xa0d8"],
988
+ recipients: ["0x0000000000000000000000000000000000000000000000000000000000006b8c"],
989
+ date: new Date(1000),
990
+ extra: { version: undefined },
991
+ transactionSequenceNumber: 1,
992
+ hasFailed: false,
993
+ });
994
+ });
995
+ });
996
+ });
997
+ //# sourceMappingURL=logic.test.js.map