@ledgerhq/coin-aptos 2.0.0 → 2.1.0-nightly.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 (390) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/lib/__tests__/api/craftTransaction.unit.test.d.ts +2 -0
  3. package/lib/__tests__/api/craftTransaction.unit.test.d.ts.map +1 -0
  4. package/lib/__tests__/api/craftTransaction.unit.test.js +187 -0
  5. package/lib/__tests__/api/craftTransaction.unit.test.js.map +1 -0
  6. package/lib/__tests__/api/getBalance.unit.test.d.ts +2 -0
  7. package/lib/__tests__/api/getBalance.unit.test.d.ts.map +1 -0
  8. package/lib/__tests__/api/getBalance.unit.test.js +41 -0
  9. package/lib/__tests__/api/getBalance.unit.test.js.map +1 -0
  10. package/lib/__tests__/api/index.integ.test.js +276 -9
  11. package/lib/__tests__/api/index.integ.test.js.map +1 -1
  12. package/lib/__tests__/api/index.test.js +1 -1
  13. package/lib/__tests__/api/index.test.js.map +1 -1
  14. package/lib/__tests__/bridge/logic.test.js +8 -558
  15. package/lib/__tests__/bridge/logic.test.js.map +1 -1
  16. package/lib/__tests__/bridge/signOperation.test.js +7 -11
  17. package/lib/__tests__/bridge/signOperation.test.js.map +1 -1
  18. package/lib/__tests__/index.test.js +1 -1
  19. package/lib/__tests__/index.test.js.map +1 -1
  20. package/lib/__tests__/logic/buildTransaction.test.d.ts.map +1 -0
  21. package/lib/__tests__/{bridge → logic}/buildTransaction.test.js +14 -8
  22. package/lib/__tests__/logic/buildTransaction.test.js.map +1 -0
  23. package/lib/__tests__/logic/calculateAmount.unit.test.d.ts +2 -0
  24. package/lib/__tests__/logic/calculateAmount.unit.test.d.ts.map +1 -0
  25. package/lib/__tests__/logic/calculateAmount.unit.test.js +45 -0
  26. package/lib/__tests__/logic/calculateAmount.unit.test.js.map +1 -0
  27. package/lib/__tests__/logic/combine.unit.test.d.ts +2 -0
  28. package/lib/__tests__/logic/combine.unit.test.d.ts.map +1 -0
  29. package/lib/__tests__/logic/combine.unit.test.js +47 -0
  30. package/lib/__tests__/logic/combine.unit.test.js.map +1 -0
  31. package/lib/__tests__/logic/compareAddress.unit.test.d.ts +2 -0
  32. package/lib/__tests__/logic/compareAddress.unit.test.d.ts.map +1 -0
  33. package/lib/__tests__/logic/compareAddress.unit.test.js +26 -0
  34. package/lib/__tests__/logic/compareAddress.unit.test.js.map +1 -0
  35. package/lib/__tests__/logic/createTransaction.test.d.ts.map +1 -0
  36. package/lib/__tests__/{bridge → logic}/createTransaction.test.js +1 -1
  37. package/lib/__tests__/logic/createTransaction.test.js.map +1 -0
  38. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.d.ts +2 -0
  39. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.d.ts.map +1 -0
  40. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.js +186 -0
  41. package/lib/__tests__/logic/getCoinAndAmounts.unit.test.js.map +1 -0
  42. package/lib/__tests__/logic/getFunctionAddress.unit.test.d.ts +2 -0
  43. package/lib/__tests__/logic/getFunctionAddress.unit.test.d.ts.map +1 -0
  44. package/lib/__tests__/logic/getFunctionAddress.unit.test.js +29 -0
  45. package/lib/__tests__/logic/getFunctionAddress.unit.test.js.map +1 -0
  46. package/lib/__tests__/logic/getResourceAddress.unit.test.d.ts +2 -0
  47. package/lib/__tests__/logic/getResourceAddress.unit.test.d.ts.map +1 -0
  48. package/lib/__tests__/logic/getResourceAddress.unit.test.js +218 -0
  49. package/lib/__tests__/logic/getResourceAddress.unit.test.js.map +1 -0
  50. package/lib/__tests__/logic/isTestnet.unit.test.d.ts +2 -0
  51. package/lib/__tests__/logic/isTestnet.unit.test.d.ts.map +1 -0
  52. package/lib/__tests__/logic/isTestnet.unit.test.js +12 -0
  53. package/lib/__tests__/logic/isTestnet.unit.test.js.map +1 -0
  54. package/lib/__tests__/logic/normalizeAddress.unit.test.d.ts +2 -0
  55. package/lib/__tests__/logic/normalizeAddress.unit.test.d.ts.map +1 -0
  56. package/lib/__tests__/logic/normalizeAddress.unit.test.js +12 -0
  57. package/lib/__tests__/logic/normalizeAddress.unit.test.js.map +1 -0
  58. package/lib/__tests__/logic/processRecipients.unit.test.d.ts +2 -0
  59. package/lib/__tests__/logic/processRecipients.unit.test.d.ts.map +1 -0
  60. package/lib/__tests__/logic/processRecipients.unit.test.js +79 -0
  61. package/lib/__tests__/logic/processRecipients.unit.test.js.map +1 -0
  62. package/lib/__tests__/network/client.test.js +613 -9
  63. package/lib/__tests__/network/client.test.js.map +1 -1
  64. package/lib/api/index.d.ts.map +1 -1
  65. package/lib/api/index.js +7 -12
  66. package/lib/api/index.js.map +1 -1
  67. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -1
  68. package/lib/bridge/estimateMaxSpendable.js.map +1 -1
  69. package/lib/bridge/getFeesForTransaction.d.ts.map +1 -1
  70. package/lib/bridge/getFeesForTransaction.js +1 -1
  71. package/lib/bridge/getFeesForTransaction.js.map +1 -1
  72. package/lib/bridge/index.js +1 -1
  73. package/lib/bridge/index.js.map +1 -1
  74. package/lib/bridge/logic.d.ts +1 -17
  75. package/lib/bridge/logic.d.ts.map +1 -1
  76. package/lib/bridge/logic.js +12 -204
  77. package/lib/bridge/logic.js.map +1 -1
  78. package/lib/bridge/prepareTransaction.js +1 -1
  79. package/lib/bridge/prepareTransaction.js.map +1 -1
  80. package/lib/bridge/signOperation.d.ts.map +1 -1
  81. package/lib/bridge/signOperation.js +1 -1
  82. package/lib/bridge/signOperation.js.map +1 -1
  83. package/lib/config.d.ts +1 -1
  84. package/lib/config.d.ts.map +1 -1
  85. package/lib/constants.d.ts +7 -4
  86. package/lib/constants.d.ts.map +1 -1
  87. package/lib/constants.js +8 -4
  88. package/lib/constants.js.map +1 -1
  89. package/lib/logic/buildTransaction.d.ts +9 -0
  90. package/lib/logic/buildTransaction.d.ts.map +1 -0
  91. package/lib/logic/buildTransaction.js +47 -0
  92. package/lib/logic/buildTransaction.js.map +1 -0
  93. package/lib/logic/calculateAmount.d.ts +3 -0
  94. package/lib/logic/calculateAmount.d.ts.map +1 -0
  95. package/lib/logic/calculateAmount.js +13 -0
  96. package/lib/logic/calculateAmount.js.map +1 -0
  97. package/lib/logic/combine.d.ts +4 -0
  98. package/lib/logic/combine.d.ts.map +1 -0
  99. package/lib/logic/combine.js +34 -0
  100. package/lib/logic/combine.js.map +1 -0
  101. package/lib/logic/craftTransaction.d.ts +5 -0
  102. package/lib/logic/craftTransaction.d.ts.map +1 -0
  103. package/lib/logic/craftTransaction.js +68 -0
  104. package/lib/logic/craftTransaction.js.map +1 -0
  105. package/lib/logic/createTransaction.d.ts.map +1 -0
  106. package/lib/logic/createTransaction.js.map +1 -0
  107. package/lib/logic/getBalance.d.ts +5 -0
  108. package/lib/logic/getBalance.d.ts.map +1 -0
  109. package/lib/logic/getBalance.js +12 -0
  110. package/lib/logic/getBalance.js.map +1 -0
  111. package/lib/logic/getCoinAndAmounts.d.ts +13 -0
  112. package/lib/logic/getCoinAndAmounts.d.ts.map +1 -0
  113. package/lib/logic/getCoinAndAmounts.js +112 -0
  114. package/lib/logic/getCoinAndAmounts.js.map +1 -0
  115. package/lib/logic/getFunctionAddress.d.ts +3 -0
  116. package/lib/logic/getFunctionAddress.d.ts.map +1 -0
  117. package/lib/logic/getFunctionAddress.js +12 -0
  118. package/lib/logic/getFunctionAddress.js.map +1 -0
  119. package/lib/logic/getResourceAddress.d.ts +4 -0
  120. package/lib/logic/getResourceAddress.d.ts.map +1 -0
  121. package/lib/logic/getResourceAddress.js +17 -0
  122. package/lib/logic/getResourceAddress.js.map +1 -0
  123. package/lib/logic/isTestnet.d.ts +2 -0
  124. package/lib/logic/isTestnet.d.ts.map +1 -0
  125. package/lib/logic/isTestnet.js +9 -0
  126. package/lib/logic/isTestnet.js.map +1 -0
  127. package/lib/logic/isWriteSetChangeWriteResource.d.ts +3 -0
  128. package/lib/logic/isWriteSetChangeWriteResource.d.ts.map +1 -0
  129. package/lib/logic/isWriteSetChangeWriteResource.js +8 -0
  130. package/lib/logic/isWriteSetChangeWriteResource.js.map +1 -0
  131. package/lib/logic/normalizeAddress.d.ts +2 -0
  132. package/lib/logic/normalizeAddress.d.ts.map +1 -0
  133. package/lib/logic/normalizeAddress.js +12 -0
  134. package/lib/logic/normalizeAddress.js.map +1 -0
  135. package/lib/logic/normalizeTransactionOptions.d.ts +3 -0
  136. package/lib/logic/normalizeTransactionOptions.d.ts.map +1 -0
  137. package/lib/logic/normalizeTransactionOptions.js +21 -0
  138. package/lib/logic/normalizeTransactionOptions.js.map +1 -0
  139. package/lib/logic/processRecipients.d.ts +6 -0
  140. package/lib/logic/processRecipients.d.ts.map +1 -0
  141. package/lib/logic/processRecipients.js +58 -0
  142. package/lib/logic/processRecipients.js.map +1 -0
  143. package/lib/logic/transactionsToOperations.d.ts +7 -0
  144. package/lib/logic/transactionsToOperations.d.ts.map +1 -0
  145. package/lib/logic/transactionsToOperations.js +89 -0
  146. package/lib/logic/transactionsToOperations.js.map +1 -0
  147. package/lib/network/client.d.ts +6 -4
  148. package/lib/network/client.d.ts.map +1 -1
  149. package/lib/network/client.js +50 -14
  150. package/lib/network/client.js.map +1 -1
  151. package/lib/network/index.d.ts.map +1 -1
  152. package/lib/network/index.js +4 -7
  153. package/lib/network/index.js.map +1 -1
  154. package/lib/types/assets.d.ts +5 -1
  155. package/lib/types/assets.d.ts.map +1 -1
  156. package/lib/types/index.d.ts +4 -0
  157. package/lib/types/index.d.ts.map +1 -1
  158. package/lib-es/__tests__/api/craftTransaction.unit.test.d.ts +2 -0
  159. package/lib-es/__tests__/api/craftTransaction.unit.test.d.ts.map +1 -0
  160. package/lib-es/__tests__/api/craftTransaction.unit.test.js +185 -0
  161. package/lib-es/__tests__/api/craftTransaction.unit.test.js.map +1 -0
  162. package/lib-es/__tests__/api/getBalance.unit.test.d.ts +2 -0
  163. package/lib-es/__tests__/api/getBalance.unit.test.d.ts.map +1 -0
  164. package/lib-es/__tests__/api/getBalance.unit.test.js +36 -0
  165. package/lib-es/__tests__/api/getBalance.unit.test.js.map +1 -0
  166. package/lib-es/__tests__/api/index.integ.test.js +277 -10
  167. package/lib-es/__tests__/api/index.integ.test.js.map +1 -1
  168. package/lib-es/__tests__/api/index.test.js +1 -1
  169. package/lib-es/__tests__/api/index.test.js.map +1 -1
  170. package/lib-es/__tests__/bridge/logic.test.js +8 -558
  171. package/lib-es/__tests__/bridge/logic.test.js.map +1 -1
  172. package/lib-es/__tests__/bridge/signOperation.test.js +7 -11
  173. package/lib-es/__tests__/bridge/signOperation.test.js.map +1 -1
  174. package/lib-es/__tests__/index.test.js +1 -1
  175. package/lib-es/__tests__/index.test.js.map +1 -1
  176. package/lib-es/__tests__/logic/buildTransaction.test.d.ts.map +1 -0
  177. package/lib-es/__tests__/{bridge → logic}/buildTransaction.test.js +11 -5
  178. package/lib-es/__tests__/logic/buildTransaction.test.js.map +1 -0
  179. package/lib-es/__tests__/logic/calculateAmount.unit.test.d.ts +2 -0
  180. package/lib-es/__tests__/logic/calculateAmount.unit.test.d.ts.map +1 -0
  181. package/lib-es/__tests__/logic/calculateAmount.unit.test.js +40 -0
  182. package/lib-es/__tests__/logic/calculateAmount.unit.test.js.map +1 -0
  183. package/lib-es/__tests__/logic/combine.unit.test.d.ts +2 -0
  184. package/lib-es/__tests__/logic/combine.unit.test.d.ts.map +1 -0
  185. package/lib-es/__tests__/logic/combine.unit.test.js +45 -0
  186. package/lib-es/__tests__/logic/combine.unit.test.js.map +1 -0
  187. package/lib-es/__tests__/logic/compareAddress.unit.test.d.ts +2 -0
  188. package/lib-es/__tests__/logic/compareAddress.unit.test.d.ts.map +1 -0
  189. package/lib-es/__tests__/logic/compareAddress.unit.test.js +24 -0
  190. package/lib-es/__tests__/logic/compareAddress.unit.test.js.map +1 -0
  191. package/lib-es/__tests__/logic/createTransaction.test.d.ts.map +1 -0
  192. package/lib-es/__tests__/{bridge → logic}/createTransaction.test.js +1 -1
  193. package/lib-es/__tests__/logic/createTransaction.test.js.map +1 -0
  194. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.d.ts +2 -0
  195. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.d.ts.map +1 -0
  196. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.js +181 -0
  197. package/lib-es/__tests__/logic/getCoinAndAmounts.unit.test.js.map +1 -0
  198. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.d.ts +2 -0
  199. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.d.ts.map +1 -0
  200. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.js +27 -0
  201. package/lib-es/__tests__/logic/getFunctionAddress.unit.test.js.map +1 -0
  202. package/lib-es/__tests__/logic/getResourceAddress.unit.test.d.ts +2 -0
  203. package/lib-es/__tests__/logic/getResourceAddress.unit.test.d.ts.map +1 -0
  204. package/lib-es/__tests__/logic/getResourceAddress.unit.test.js +216 -0
  205. package/lib-es/__tests__/logic/getResourceAddress.unit.test.js.map +1 -0
  206. package/lib-es/__tests__/logic/isTestnet.unit.test.d.ts +2 -0
  207. package/lib-es/__tests__/logic/isTestnet.unit.test.d.ts.map +1 -0
  208. package/lib-es/__tests__/logic/isTestnet.unit.test.js +10 -0
  209. package/lib-es/__tests__/logic/isTestnet.unit.test.js.map +1 -0
  210. package/lib-es/__tests__/logic/normalizeAddress.unit.test.d.ts +2 -0
  211. package/lib-es/__tests__/logic/normalizeAddress.unit.test.d.ts.map +1 -0
  212. package/lib-es/__tests__/logic/normalizeAddress.unit.test.js +10 -0
  213. package/lib-es/__tests__/logic/normalizeAddress.unit.test.js.map +1 -0
  214. package/lib-es/__tests__/logic/processRecipients.unit.test.d.ts +2 -0
  215. package/lib-es/__tests__/logic/processRecipients.unit.test.d.ts.map +1 -0
  216. package/lib-es/__tests__/logic/processRecipients.unit.test.js +74 -0
  217. package/lib-es/__tests__/logic/processRecipients.unit.test.js.map +1 -0
  218. package/lib-es/__tests__/network/client.test.js +614 -10
  219. package/lib-es/__tests__/network/client.test.js.map +1 -1
  220. package/lib-es/api/index.d.ts.map +1 -1
  221. package/lib-es/api/index.js +7 -12
  222. package/lib-es/api/index.js.map +1 -1
  223. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -1
  224. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
  225. package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -1
  226. package/lib-es/bridge/getFeesForTransaction.js +1 -1
  227. package/lib-es/bridge/getFeesForTransaction.js.map +1 -1
  228. package/lib-es/bridge/index.js +1 -1
  229. package/lib-es/bridge/index.js.map +1 -1
  230. package/lib-es/bridge/logic.d.ts +1 -17
  231. package/lib-es/bridge/logic.d.ts.map +1 -1
  232. package/lib-es/bridge/logic.js +6 -187
  233. package/lib-es/bridge/logic.js.map +1 -1
  234. package/lib-es/bridge/prepareTransaction.js +1 -1
  235. package/lib-es/bridge/prepareTransaction.js.map +1 -1
  236. package/lib-es/bridge/signOperation.d.ts.map +1 -1
  237. package/lib-es/bridge/signOperation.js +1 -1
  238. package/lib-es/bridge/signOperation.js.map +1 -1
  239. package/lib-es/config.d.ts +1 -1
  240. package/lib-es/config.d.ts.map +1 -1
  241. package/lib-es/constants.d.ts +7 -4
  242. package/lib-es/constants.d.ts.map +1 -1
  243. package/lib-es/constants.js +7 -3
  244. package/lib-es/constants.js.map +1 -1
  245. package/lib-es/logic/buildTransaction.d.ts +9 -0
  246. package/lib-es/logic/buildTransaction.d.ts.map +1 -0
  247. package/lib-es/logic/buildTransaction.js +43 -0
  248. package/lib-es/logic/buildTransaction.js.map +1 -0
  249. package/lib-es/logic/calculateAmount.d.ts +3 -0
  250. package/lib-es/logic/calculateAmount.d.ts.map +1 -0
  251. package/lib-es/logic/calculateAmount.js +9 -0
  252. package/lib-es/logic/calculateAmount.js.map +1 -0
  253. package/lib-es/logic/combine.d.ts +4 -0
  254. package/lib-es/logic/combine.d.ts.map +1 -0
  255. package/lib-es/logic/combine.js +29 -0
  256. package/lib-es/logic/combine.js.map +1 -0
  257. package/lib-es/logic/craftTransaction.d.ts +5 -0
  258. package/lib-es/logic/craftTransaction.d.ts.map +1 -0
  259. package/lib-es/logic/craftTransaction.js +38 -0
  260. package/lib-es/logic/craftTransaction.js.map +1 -0
  261. package/lib-es/logic/createTransaction.d.ts.map +1 -0
  262. package/lib-es/logic/createTransaction.js.map +1 -0
  263. package/lib-es/logic/getBalance.d.ts +5 -0
  264. package/lib-es/logic/getBalance.d.ts.map +1 -0
  265. package/lib-es/logic/getBalance.js +8 -0
  266. package/lib-es/logic/getBalance.js.map +1 -0
  267. package/lib-es/logic/getCoinAndAmounts.d.ts +13 -0
  268. package/lib-es/logic/getCoinAndAmounts.d.ts.map +1 -0
  269. package/lib-es/logic/getCoinAndAmounts.js +101 -0
  270. package/lib-es/logic/getCoinAndAmounts.js.map +1 -0
  271. package/lib-es/logic/getFunctionAddress.d.ts +3 -0
  272. package/lib-es/logic/getFunctionAddress.d.ts.map +1 -0
  273. package/lib-es/logic/getFunctionAddress.js +8 -0
  274. package/lib-es/logic/getFunctionAddress.js.map +1 -0
  275. package/lib-es/logic/getResourceAddress.d.ts +4 -0
  276. package/lib-es/logic/getResourceAddress.d.ts.map +1 -0
  277. package/lib-es/logic/getResourceAddress.js +13 -0
  278. package/lib-es/logic/getResourceAddress.js.map +1 -0
  279. package/lib-es/logic/isTestnet.d.ts +2 -0
  280. package/lib-es/logic/isTestnet.d.ts.map +1 -0
  281. package/lib-es/logic/isTestnet.js +5 -0
  282. package/lib-es/logic/isTestnet.js.map +1 -0
  283. package/lib-es/logic/isWriteSetChangeWriteResource.d.ts +3 -0
  284. package/lib-es/logic/isWriteSetChangeWriteResource.d.ts.map +1 -0
  285. package/lib-es/logic/isWriteSetChangeWriteResource.js +4 -0
  286. package/lib-es/logic/isWriteSetChangeWriteResource.js.map +1 -0
  287. package/lib-es/logic/normalizeAddress.d.ts +2 -0
  288. package/lib-es/logic/normalizeAddress.d.ts.map +1 -0
  289. package/lib-es/logic/normalizeAddress.js +8 -0
  290. package/lib-es/logic/normalizeAddress.js.map +1 -0
  291. package/lib-es/logic/normalizeTransactionOptions.d.ts +3 -0
  292. package/lib-es/logic/normalizeTransactionOptions.d.ts.map +1 -0
  293. package/lib-es/logic/normalizeTransactionOptions.js +17 -0
  294. package/lib-es/logic/normalizeTransactionOptions.js.map +1 -0
  295. package/lib-es/logic/processRecipients.d.ts +6 -0
  296. package/lib-es/logic/processRecipients.d.ts.map +1 -0
  297. package/lib-es/logic/processRecipients.js +54 -0
  298. package/lib-es/logic/processRecipients.js.map +1 -0
  299. package/lib-es/logic/transactionsToOperations.d.ts +7 -0
  300. package/lib-es/logic/transactionsToOperations.d.ts.map +1 -0
  301. package/lib-es/logic/transactionsToOperations.js +81 -0
  302. package/lib-es/logic/transactionsToOperations.js.map +1 -0
  303. package/lib-es/network/client.d.ts +6 -4
  304. package/lib-es/network/client.d.ts.map +1 -1
  305. package/lib-es/network/client.js +50 -14
  306. package/lib-es/network/client.js.map +1 -1
  307. package/lib-es/network/index.d.ts.map +1 -1
  308. package/lib-es/network/index.js +5 -8
  309. package/lib-es/network/index.js.map +1 -1
  310. package/lib-es/types/assets.d.ts +5 -1
  311. package/lib-es/types/assets.d.ts.map +1 -1
  312. package/lib-es/types/index.d.ts +4 -0
  313. package/lib-es/types/index.d.ts.map +1 -1
  314. package/package.json +10 -10
  315. package/src/__tests__/api/craftTransaction.unit.test.ts +243 -0
  316. package/src/__tests__/api/getBalance.unit.test.ts +44 -0
  317. package/src/__tests__/api/index.integ.test.ts +355 -12
  318. package/src/__tests__/api/index.test.ts +1 -1
  319. package/src/__tests__/bridge/logic.test.ts +9 -654
  320. package/src/__tests__/bridge/signOperation.test.ts +7 -11
  321. package/src/__tests__/index.test.ts +1 -1
  322. package/src/__tests__/{bridge → logic}/buildTransaction.test.ts +14 -7
  323. package/src/__tests__/logic/calculateAmount.unit.test.ts +51 -0
  324. package/src/__tests__/logic/combine.unit.test.ts +65 -0
  325. package/src/__tests__/logic/compareAddress.unit.test.ts +27 -0
  326. package/src/__tests__/{bridge → logic}/createTransaction.test.ts +1 -1
  327. package/src/__tests__/logic/getCoinAndAmounts.unit.test.ts +195 -0
  328. package/src/__tests__/logic/getFunctionAddress.unit.test.ts +33 -0
  329. package/src/__tests__/logic/getResourceAddress.unit.test.ts +241 -0
  330. package/src/__tests__/logic/isTestnet.unit.test.ts +11 -0
  331. package/src/__tests__/logic/normalizeAddress.unit.test.ts +15 -0
  332. package/src/__tests__/logic/processRecipients.unit.test.ts +95 -0
  333. package/src/__tests__/network/client.test.ts +650 -11
  334. package/src/api/index.ts +10 -13
  335. package/src/bridge/estimateMaxSpendable.ts +1 -1
  336. package/src/bridge/getFeesForTransaction.ts +1 -1
  337. package/src/bridge/index.ts +1 -1
  338. package/src/bridge/logic.ts +8 -279
  339. package/src/bridge/prepareTransaction.ts +1 -1
  340. package/src/bridge/signOperation.ts +1 -1
  341. package/src/config.ts +1 -1
  342. package/src/constants.ts +8 -4
  343. package/src/logic/buildTransaction.ts +70 -0
  344. package/src/logic/calculateAmount.ts +15 -0
  345. package/src/logic/combine.ts +51 -0
  346. package/src/logic/craftTransaction.ts +65 -0
  347. package/src/logic/getBalance.ts +15 -0
  348. package/src/logic/getCoinAndAmounts.ts +141 -0
  349. package/src/logic/getFunctionAddress.ts +9 -0
  350. package/src/logic/getResourceAddress.ts +24 -0
  351. package/src/logic/isTestnet.ts +5 -0
  352. package/src/logic/isWriteSetChangeWriteResource.ts +7 -0
  353. package/src/logic/normalizeAddress.ts +8 -0
  354. package/src/logic/normalizeTransactionOptions.ts +18 -0
  355. package/src/logic/processRecipients.ts +88 -0
  356. package/src/logic/transactionsToOperations.ts +106 -0
  357. package/src/network/client.ts +88 -29
  358. package/src/network/index.ts +4 -13
  359. package/src/types/assets.ts +6 -1
  360. package/src/types/index.ts +5 -0
  361. package/lib/__tests__/bridge/buildTransaction.test.d.ts.map +0 -1
  362. package/lib/__tests__/bridge/buildTransaction.test.js.map +0 -1
  363. package/lib/__tests__/bridge/createTransaction.test.d.ts.map +0 -1
  364. package/lib/__tests__/bridge/createTransaction.test.js.map +0 -1
  365. package/lib/bridge/buildTransaction.d.ts +0 -7
  366. package/lib/bridge/buildTransaction.d.ts.map +0 -1
  367. package/lib/bridge/buildTransaction.js +0 -45
  368. package/lib/bridge/buildTransaction.js.map +0 -1
  369. package/lib/bridge/createTransaction.d.ts.map +0 -1
  370. package/lib/bridge/createTransaction.js.map +0 -1
  371. package/lib-es/__tests__/bridge/buildTransaction.test.d.ts.map +0 -1
  372. package/lib-es/__tests__/bridge/buildTransaction.test.js.map +0 -1
  373. package/lib-es/__tests__/bridge/createTransaction.test.d.ts.map +0 -1
  374. package/lib-es/__tests__/bridge/createTransaction.test.js.map +0 -1
  375. package/lib-es/bridge/buildTransaction.d.ts +0 -7
  376. package/lib-es/bridge/buildTransaction.d.ts.map +0 -1
  377. package/lib-es/bridge/buildTransaction.js +0 -43
  378. package/lib-es/bridge/buildTransaction.js.map +0 -1
  379. package/lib-es/bridge/createTransaction.d.ts.map +0 -1
  380. package/lib-es/bridge/createTransaction.js.map +0 -1
  381. package/src/bridge/buildTransaction.ts +0 -62
  382. /package/lib/__tests__/{bridge → logic}/buildTransaction.test.d.ts +0 -0
  383. /package/lib/__tests__/{bridge → logic}/createTransaction.test.d.ts +0 -0
  384. /package/lib/{bridge → logic}/createTransaction.d.ts +0 -0
  385. /package/lib/{bridge → logic}/createTransaction.js +0 -0
  386. /package/lib-es/__tests__/{bridge → logic}/buildTransaction.test.d.ts +0 -0
  387. /package/lib-es/__tests__/{bridge → logic}/createTransaction.test.d.ts +0 -0
  388. /package/lib-es/{bridge → logic}/createTransaction.d.ts +0 -0
  389. /package/lib-es/{bridge → logic}/createTransaction.js +0 -0
  390. /package/src/{bridge → logic}/createTransaction.ts +0 -0
@@ -1,52 +1,17 @@
1
- import {
2
- EntryFunctionPayloadResponse,
3
- Event,
4
- InputEntryFunctionData,
5
- WriteSetChange,
6
- } from "@aptos-labs/ts-sdk";
7
- import type { Operation, OperationType } from "@ledgerhq/types-live";
1
+ import { EntryFunctionPayloadResponse } from "@aptos-labs/ts-sdk";
8
2
  import BigNumber from "bignumber.js";
9
- import {
10
- APTOS_ASSET_ID,
11
- APTOS_COIN_CHANGE,
12
- APTOS_FUNGIBLE_STORE,
13
- APTOS_OBJECT_CORE,
14
- DIRECTION,
15
- } from "../../constants";
16
- import {
17
- calculateAmount,
18
- compareAddress,
19
- getCoinAndAmounts,
20
- getFunctionAddress,
21
- getResourceAddress,
22
- isTestnet,
23
- processRecipients,
24
- getMaxSendBalance,
25
- normalizeTransactionOptions,
26
- getBlankOperation,
27
- txsToOps,
28
- getEventCoinAddress,
29
- getEventFAAddress,
30
- } from "../../bridge/logic";
3
+ import { APTOS_COIN_CHANGE, DIRECTION } from "../../constants";
4
+ import { getMaxSendBalance, getBlankOperation, txsToOps } from "../../bridge/logic";
31
5
  import type { AptosTransaction, TransactionOptions } from "../../types";
32
6
  import { createFixtureAccount, createFixtureTransaction } from "../../bridge/bridge.fixture";
33
7
  import { findTokenByAddressInCurrency } from "@ledgerhq/cryptoassets";
34
8
  import { decodeTokenAccountId, encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
9
+ import { normalizeTransactionOptions } from "../../logic/normalizeTransactionOptions";
35
10
 
36
11
  jest.mock("@ledgerhq/cryptoassets");
37
12
  jest.mock("@ledgerhq/coin-framework/account/index");
38
13
 
39
14
  describe("Aptos logic ", () => {
40
- describe("isTestnet", () => {
41
- it("should return true for testnet currencies", () => {
42
- expect(isTestnet("aptos_testnet")).toBe(true);
43
- });
44
-
45
- it("should return false for mainnet currencies", () => {
46
- expect(isTestnet("aptos")).toBe(false);
47
- });
48
- });
49
-
50
15
  describe("getMaxSendBalance", () => {
51
16
  it("should return the correct max send balance when amount is greater than total gas", () => {
52
17
  const amount = new BigNumber(1000000);
@@ -183,616 +148,6 @@ describe("Aptos logic ", () => {
183
148
  });
184
149
 
185
150
  describe("Aptos sync logic ", () => {
186
- describe("compareAddress", () => {
187
- it("should return true for identical addresses", () => {
188
- const addressA = "0x1234567890abcdef";
189
- const addressB = "0x1234567890abcdef";
190
- expect(compareAddress(addressA, addressB)).toBe(true);
191
- });
192
-
193
- it("should return true for addresses with different cases", () => {
194
- const addressA = "0x1234567890abcdef";
195
- const addressB = "0x1234567890ABCDEF";
196
- expect(compareAddress(addressA, addressB)).toBe(true);
197
- });
198
-
199
- it("should return true for addresses with different hex formats", () => {
200
- const addressA = "0x1234567890abcdef";
201
- const addressB = "1234567890abcdef";
202
- expect(compareAddress(addressA, addressB)).toBe(true);
203
- });
204
-
205
- it("should return false for different addresses", () => {
206
- const addressA = "0x1234567890abcdef";
207
- const addressB = "0xfedcba0987654321";
208
- expect(compareAddress(addressA, addressB)).toBe(false);
209
- });
210
- });
211
-
212
- describe("getFunctionAddress", () => {
213
- it("should return the function address when payload contains a function", () => {
214
- const payload: InputEntryFunctionData = {
215
- function: "0x1::coin::transfer",
216
- typeArguments: [],
217
- functionArguments: [],
218
- };
219
-
220
- const result = getFunctionAddress(payload);
221
- expect(result).toBe("0x1");
222
- });
223
-
224
- it("should return undefined when payload does not contain a function", () => {
225
- const payload = {
226
- function: "::::",
227
- typeArguments: [],
228
- functionArguments: [],
229
- } as InputEntryFunctionData;
230
-
231
- const result = getFunctionAddress(payload);
232
- expect(result).toBeUndefined();
233
- });
234
-
235
- it("should return undefined when payload is empty", () => {
236
- const payload = {} as InputEntryFunctionData;
237
-
238
- const result = getFunctionAddress(payload);
239
- expect(result).toBeUndefined();
240
- });
241
- });
242
-
243
- describe("processRecipients", () => {
244
- let op: Operation;
245
-
246
- beforeEach(() => {
247
- op = {
248
- id: "",
249
- hash: "",
250
- type: "" as OperationType,
251
- value: new BigNumber(0),
252
- fee: new BigNumber(0),
253
- blockHash: "",
254
- blockHeight: 0,
255
- senders: [],
256
- recipients: [],
257
- accountId: "",
258
- date: new Date(),
259
- extra: {},
260
- transactionSequenceNumber: 0,
261
- hasFailed: false,
262
- };
263
- });
264
-
265
- it("should add recipient for transfer-like functions from LL account", () => {
266
- const payload: InputEntryFunctionData = {
267
- function: "0x1::coin::transfer",
268
- typeArguments: [],
269
- functionArguments: ["0x13", 1], // from: &signer, to: address, amount: u64
270
- };
271
-
272
- processRecipients(payload, "0x13", op, "0x1");
273
- expect(op.recipients).toContain("0x13");
274
- });
275
-
276
- it("should add recipient for transfer-like functions from external account", () => {
277
- const payload: InputEntryFunctionData = {
278
- function: "0x1::coin::transfer",
279
- typeArguments: [],
280
- functionArguments: ["0x12", 1], // from: &signer, to: address, amount: u64
281
- };
282
-
283
- processRecipients(payload, "0x13", op, "0x1");
284
- expect(op.recipients).toContain("0x12");
285
- });
286
-
287
- it("should add recipients for batch transfer functions", () => {
288
- const payload: InputEntryFunctionData = {
289
- function: "0x1::aptos_account::batch_transfer_coins",
290
- typeArguments: [APTOS_ASSET_ID],
291
- functionArguments: [
292
- ["0x12", "0x13"],
293
- [1, 2],
294
- ],
295
- };
296
-
297
- op.senders.push("0x11");
298
- processRecipients(payload, "0x12", op, "0x1");
299
- expect(op.recipients).toContain("0x12");
300
- });
301
-
302
- it("should add function address as recipient for other smart contracts", () => {
303
- const payload: InputEntryFunctionData = {
304
- function: "0x2::other::contract",
305
- typeArguments: [],
306
- functionArguments: [["0x12"], [1]],
307
- };
308
-
309
- processRecipients(payload, "0x11", op, "0x2");
310
- expect(op.recipients).toContain("0x2");
311
- });
312
-
313
- it("should add recipient for fungible assets transfer-like functions", () => {
314
- const payload: InputEntryFunctionData = {
315
- function: "0x1::primary_fungible_store::transfer",
316
- typeArguments: [],
317
- functionArguments: [["0xfff"], "0x13"],
318
- };
319
-
320
- processRecipients(payload, "0x13", op, "0x1");
321
- expect(op.recipients).toContain("0x13");
322
- });
323
- });
324
-
325
- describe("getResourceAddress", () => {
326
- it("should return coin name from the change", () => {
327
- const change = {
328
- type: "write_resource",
329
- data: {
330
- type: APTOS_COIN_CHANGE,
331
- data: {
332
- withdraw_events: {
333
- guid: {
334
- id: {
335
- addr: "0x11",
336
- creation_num: "2",
337
- },
338
- },
339
- },
340
- },
341
- },
342
- } as unknown as WriteSetChange;
343
-
344
- const tx: AptosTransaction = {
345
- hash: "0x123",
346
- block: { hash: "0xabc", height: 1 },
347
- timestamp: "1000000",
348
- sequence_number: "1",
349
- version: "1",
350
- changes: [change],
351
- } as unknown as AptosTransaction;
352
-
353
- const event = {
354
- guid: {
355
- account_address: "0x11",
356
- creation_number: "2",
357
- },
358
- type: "0x1::coin::WithdrawEvent",
359
- } as Event;
360
-
361
- const result = getResourceAddress(tx, event, "withdraw_events", getEventCoinAddress);
362
- expect(result).toEqual(APTOS_ASSET_ID);
363
- });
364
-
365
- it("should return null for not finding the valid coin in change", () => {
366
- const change = {
367
- type: "write_resource",
368
- data: {
369
- type: APTOS_COIN_CHANGE,
370
- data: {
371
- withdraw_events: {
372
- guid: {
373
- id: {
374
- addr: "0x12",
375
- creation_num: "2",
376
- },
377
- },
378
- },
379
- },
380
- },
381
- } as unknown as WriteSetChange;
382
-
383
- const tx: AptosTransaction = {
384
- hash: "0x123",
385
- block: { hash: "0xabc", height: 1 },
386
- timestamp: "1000000",
387
- sequence_number: "1",
388
- version: "1",
389
- changes: [change],
390
- } as unknown as AptosTransaction;
391
-
392
- const event = {
393
- guid: {
394
- account_address: "0x11",
395
- creation_number: "1",
396
- },
397
- type: "0x1::coin::WithdrawEvent",
398
- } as Event;
399
-
400
- const result = getResourceAddress(tx, event, "withdraw_events", getEventCoinAddress);
401
- expect(result).toBe(null);
402
- });
403
-
404
- it("should return null for not finding the event name in change", () => {
405
- const change = {
406
- type: "write_resource",
407
- data: {
408
- type: APTOS_COIN_CHANGE,
409
- data: {
410
- other_events: {
411
- guid: {
412
- id: {
413
- addr: "0x12",
414
- creation_num: "2",
415
- },
416
- },
417
- },
418
- },
419
- },
420
- } as unknown as WriteSetChange;
421
-
422
- const tx: AptosTransaction = {
423
- hash: "0x123",
424
- block: { hash: "0xabc", height: 1 },
425
- timestamp: "1000000",
426
- sequence_number: "1",
427
- version: "1",
428
- changes: [change],
429
- } as unknown as AptosTransaction;
430
-
431
- const event = {
432
- guid: {
433
- account_address: "0x11",
434
- creation_number: "1",
435
- },
436
- type: "0x1::coin::WithdrawEvent",
437
- } as Event;
438
-
439
- const result = getResourceAddress(tx, event, "withdraw_events", getEventCoinAddress);
440
- expect(result).toBe(null);
441
- });
442
-
443
- it("should return fungible asset address", () => {
444
- const change = {
445
- type: "write_resource",
446
- address: "0xsomeaddress",
447
- data: {
448
- type: APTOS_FUNGIBLE_STORE,
449
- data: {
450
- metadata: {
451
- inner: "0xassetaddress",
452
- },
453
- },
454
- },
455
- } as unknown as WriteSetChange;
456
-
457
- const tx: AptosTransaction = {
458
- hash: "0x123",
459
- block: { hash: "0xabc", height: 1 },
460
- timestamp: "1000000",
461
- sequence_number: "1",
462
- version: "1",
463
- changes: [change],
464
- } as unknown as AptosTransaction;
465
-
466
- const event = {
467
- guid: {
468
- account_address: "0x0",
469
- creation_number: "0",
470
- },
471
- type: "0x1::fungible_asset::Deposit",
472
- data: {
473
- amount: "100",
474
- store: "0xsomeaddress",
475
- },
476
- } as Event;
477
-
478
- const result = getResourceAddress(tx, event, "withdraw_events", getEventFAAddress);
479
- expect(result).toEqual("0xassetaddress");
480
- });
481
-
482
- it("should return null address instead of fungible asset when wrong type", () => {
483
- const change = {
484
- type: "write_resource",
485
- address: "0xsomeaddress",
486
- data: {
487
- type: APTOS_COIN_CHANGE,
488
- data: {
489
- metadata: {
490
- inner: "0xassetaddress",
491
- },
492
- },
493
- },
494
- } as unknown as WriteSetChange;
495
-
496
- const tx: AptosTransaction = {
497
- hash: "0x123",
498
- block: { hash: "0xabc", height: 1 },
499
- timestamp: "1000000",
500
- sequence_number: "1",
501
- version: "1",
502
- changes: [change],
503
- } as unknown as AptosTransaction;
504
-
505
- const event = {
506
- guid: {
507
- account_address: "0x0",
508
- creation_number: "0",
509
- },
510
- type: "0x1::fungible_asset::Deposit",
511
- data: {
512
- amount: "100",
513
- store: "0xsomeaddress",
514
- },
515
- } as Event;
516
-
517
- const result = getResourceAddress(tx, event, "withdraw_events", getEventFAAddress);
518
- expect(result).toEqual(null);
519
- });
520
-
521
- it("should return null address instead of fungible asset when wrong event address", () => {
522
- const change = {
523
- type: "write_resource",
524
- address: "0xsomeaddress",
525
- data: {
526
- type: APTOS_FUNGIBLE_STORE,
527
- data: {
528
- metadata: {
529
- inner: "0xassetaddress",
530
- },
531
- },
532
- },
533
- } as unknown as WriteSetChange;
534
-
535
- const tx: AptosTransaction = {
536
- hash: "0x123",
537
- block: { hash: "0xabc", height: 1 },
538
- timestamp: "1000000",
539
- sequence_number: "1",
540
- version: "1",
541
- changes: [change],
542
- } as unknown as AptosTransaction;
543
-
544
- const event = {
545
- guid: {
546
- account_address: "0x0",
547
- creation_number: "0",
548
- },
549
- type: "0x1::fungible_asset::Deposit",
550
- data: {
551
- amount: "100",
552
- store: "0xwrongaddress",
553
- },
554
- } as Event;
555
-
556
- const result = getResourceAddress(tx, event, "withdraw_events", getEventFAAddress);
557
- expect(result).toEqual(null);
558
- });
559
- });
560
-
561
- describe("getCoinAndAmounts", () => {
562
- it("should calculate the correct legacy coins amounts for withdraw and deposit events", () => {
563
- const tx = {
564
- events: [
565
- {
566
- type: "0x1::coin::WithdrawEvent",
567
- guid: {
568
- account_address: "0x11",
569
- creation_number: "1",
570
- },
571
- data: {
572
- amount: "100",
573
- },
574
- },
575
- {
576
- type: "0x1::coin::DepositEvent",
577
- guid: {
578
- account_address: "0x11",
579
- creation_number: "2",
580
- },
581
- data: {
582
- amount: "50",
583
- },
584
- },
585
- ],
586
- changes: [
587
- {
588
- type: "write_resource",
589
- data: {
590
- type: APTOS_COIN_CHANGE,
591
- data: {
592
- withdraw_events: {
593
- guid: {
594
- id: {
595
- addr: "0x11",
596
- creation_num: "1",
597
- },
598
- },
599
- },
600
- deposit_events: {
601
- guid: {
602
- id: {
603
- addr: "0x11",
604
- creation_num: "2",
605
- },
606
- },
607
- },
608
- },
609
- },
610
- },
611
- ],
612
- } as unknown as AptosTransaction;
613
-
614
- const address = "0x11";
615
- const result = getCoinAndAmounts(tx, address);
616
-
617
- expect(result.amount_in).toEqual(new BigNumber(50));
618
- expect(result.amount_out).toEqual(new BigNumber(100));
619
- expect(result.coin_id).toEqual(APTOS_ASSET_ID);
620
- });
621
-
622
- it("should calculate the correct fungible asset amounts for withdraw and deposit events", () => {
623
- const tx = {
624
- events: [
625
- {
626
- type: "0x1::fungible_asset::Withdraw",
627
- guid: {
628
- account_address: "0x11",
629
- creation_number: "1",
630
- },
631
- data: {
632
- amount: "100",
633
- store: "0x22",
634
- },
635
- },
636
- {
637
- type: "0x1::fungible_asset::Deposit",
638
- guid: {
639
- account_address: "0x11",
640
- creation_number: "2",
641
- },
642
- data: {
643
- amount: "50",
644
- store: "0x33",
645
- },
646
- },
647
- ],
648
- changes: [
649
- {
650
- type: "write_resource",
651
- address: "0x22",
652
- data: {
653
- type: APTOS_FUNGIBLE_STORE,
654
- data: {
655
- metadata: {
656
- inner: "0x44",
657
- },
658
- transfer_events: {
659
- guid: {
660
- id: {
661
- addr: "0x11",
662
- creation_num: "2",
663
- },
664
- },
665
- },
666
- },
667
- },
668
- },
669
- {
670
- type: "write_resource",
671
- address: "0x22",
672
- data: {
673
- type: APTOS_OBJECT_CORE,
674
- data: {
675
- owner: "0x11",
676
- transfer_events: {
677
- guid: {
678
- id: {
679
- addr: "0x22",
680
- creation_num: "2",
681
- },
682
- },
683
- },
684
- },
685
- },
686
- },
687
- {
688
- type: "write_resource",
689
- data: {
690
- type: APTOS_COIN_CHANGE,
691
- data: {
692
- withdraw_events: {
693
- guid: {
694
- id: {
695
- addr: "0x11",
696
- creation_num: "1",
697
- },
698
- },
699
- },
700
- deposit_events: {
701
- guid: {
702
- id: {
703
- addr: "0x11",
704
- creation_num: "2",
705
- },
706
- },
707
- },
708
- },
709
- },
710
- },
711
- ],
712
- } as unknown as AptosTransaction;
713
-
714
- const address = "0x11";
715
- const result = getCoinAndAmounts(tx, address);
716
-
717
- expect(result.amount_in).toEqual(new BigNumber(0));
718
- expect(result.amount_out).toEqual(new BigNumber(100));
719
- expect(result.coin_id).toEqual("0x44");
720
- });
721
-
722
- it("should handle transactions with other events", () => {
723
- const tx = {
724
- events: [
725
- {
726
- type: "0x1::coin::OtherEvent",
727
- guid: {
728
- account_address: "0x11",
729
- creation_number: "1",
730
- },
731
- data: {
732
- amount: "100",
733
- },
734
- },
735
- ],
736
- } as unknown as AptosTransaction;
737
-
738
- const address = "0x1";
739
- const result = getCoinAndAmounts(tx, address);
740
-
741
- expect(result.amount_in).toEqual(new BigNumber(0));
742
- expect(result.amount_out).toEqual(new BigNumber(0));
743
- expect(result.coin_id).toEqual(null);
744
- });
745
- });
746
-
747
- describe("calculateAmount", () => {
748
- it("should calculate the correct amount when the address is the sender", () => {
749
- const address = "0x11";
750
- const sender = "0x11";
751
- const amount_in = new BigNumber(50);
752
- const amount_out = new BigNumber(100);
753
-
754
- const result = calculateAmount(sender, address, amount_in, amount_out);
755
-
756
- // LL negates the amount for SEND transactions during output
757
- expect(result).toEqual(new BigNumber(50)); // -(50 - 100 - 10)
758
- });
759
-
760
- it("should calculate the correct amount when the address is not the sender", () => {
761
- const address = "0x11";
762
- const sender = "0x12";
763
- const amount_in = new BigNumber(100);
764
- const amount_out = new BigNumber(50);
765
-
766
- const result = calculateAmount(sender, address, amount_in, amount_out);
767
-
768
- expect(result).toEqual(new BigNumber(50)); // 100 - 50
769
- });
770
-
771
- it("should handle transactions with zero amounts", () => {
772
- const address = "0x11";
773
- const sender = "0x11";
774
- const amount_in = new BigNumber(0);
775
- const amount_out = new BigNumber(0);
776
-
777
- const result = calculateAmount(sender, address, amount_in, amount_out);
778
-
779
- // LL negates the amount for SEND transactions during output
780
- expect(result).toEqual(new BigNumber(0)); // -(0 - 0 - 10)
781
- });
782
-
783
- it("should get negative numbers (for send tx with deposit to account)", () => {
784
- const address = "0x11";
785
- const sender = "0x11";
786
- const amount_in = new BigNumber(100);
787
- const amount_out = new BigNumber(0);
788
-
789
- const result = calculateAmount(sender, address, amount_in, amount_out);
790
-
791
- // LL negates the amount for SEND transactions during output
792
- expect(result).toEqual(new BigNumber(100).negated()); // 100 - 10
793
- });
794
- });
795
-
796
151
  describe("txsToOps", () => {
797
152
  it("should convert Aptos transactions to operations correctly", () => {
798
153
  const address = "0x11";
@@ -876,7 +231,7 @@ describe("Aptos sync logic ", () => {
876
231
  blockHash: "0xabc",
877
232
  blockHeight: 1,
878
233
  senders: ["0x11"],
879
- recipients: ["0x12"],
234
+ recipients: ["0x0000000000000000000000000000000000000000000000000000000000000012"],
880
235
  accountId: id,
881
236
  date: new Date(1000),
882
237
  extra: { version: undefined },
@@ -1075,7 +430,7 @@ describe("Aptos sync logic ", () => {
1075
430
  blockHash: "0xc496",
1076
431
  blockHeight: 1,
1077
432
  senders: ["0xa0d8"],
1078
- recipients: ["0x4e5e"],
433
+ recipients: ["0x0000000000000000000000000000000000000000000000000000000000004e5e"],
1079
434
  accountId: id,
1080
435
  date: new Date(1000),
1081
436
  extra: { version: undefined },
@@ -1355,7 +710,7 @@ describe("Aptos sync logic ", () => {
1355
710
  blockHash: "0xabc",
1356
711
  blockHeight: 1,
1357
712
  senders: ["0xa0d"],
1358
- recipients: ["0x4e5"],
713
+ recipients: ["0x00000000000000000000000000000000000000000000000000000000000004e5"],
1359
714
  accountId: "token_account_id",
1360
715
  date: new Date(1000),
1361
716
  extra: { version: undefined },
@@ -1373,7 +728,7 @@ describe("Aptos sync logic ", () => {
1373
728
  blockHash: "0xabc",
1374
729
  blockHeight: 1,
1375
730
  senders: ["0xa0d"],
1376
- recipients: ["0x4e5"],
731
+ recipients: ["0x00000000000000000000000000000000000000000000000000000000000004e5"],
1377
732
  date: new Date(1000),
1378
733
  extra: { version: undefined },
1379
734
  transactionSequenceNumber: 1,
@@ -1669,7 +1024,7 @@ describe("Aptos sync logic ", () => {
1669
1024
  blockHash: "0xabc",
1670
1025
  blockHeight: 1,
1671
1026
  senders: ["0xa0d8"],
1672
- recipients: ["0x6b8c"],
1027
+ recipients: ["0x0000000000000000000000000000000000000000000000000000000000006b8c"],
1673
1028
  date: new Date(1000),
1674
1029
  extra: { version: undefined },
1675
1030
  transactionSequenceNumber: 1,