@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,20 +1,26 @@
1
1
  import { ApolloClient } from "@apollo/client";
2
- import { AccountAddress, Aptos, Ed25519PublicKey, RawTransaction, post, } from "@aptos-labs/ts-sdk";
2
+ import { AccountAddress, Aptos, Ed25519PublicKey, Hex, RawTransaction, postAptosFullNode, TransactionResponseType, } from "@aptos-labs/ts-sdk";
3
3
  import network from "@ledgerhq/live-network";
4
4
  import BigNumber from "bignumber.js";
5
5
  import { AptosAPI } from "../../network";
6
+ import { APTOS_ASSET_ID } from "../../constants";
6
7
  jest.mock("@aptos-labs/ts-sdk");
7
8
  jest.mock("@apollo/client");
8
9
  let mockedAptos;
9
10
  let mockedApolloClient;
10
11
  let mockedPost = jest.fn();
12
+ let mockedHex;
11
13
  jest.mock("@ledgerhq/live-network/network");
12
14
  const mockedNetwork = jest.mocked(network);
15
+ jest.mock("@ledgerhq/cryptoassets/tokens", () => ({
16
+ findTokenByAddressInCurrency: jest.fn().mockReturnValue("token-name"),
17
+ }));
13
18
  describe("Aptos API", () => {
14
19
  beforeEach(() => {
15
20
  mockedAptos = jest.mocked(Aptos);
21
+ mockedHex = jest.mocked(Hex);
16
22
  mockedApolloClient = jest.mocked(ApolloClient);
17
- mockedPost = jest.mocked(post);
23
+ mockedPost = jest.mocked(postAptosFullNode);
18
24
  });
19
25
  afterEach(() => jest.clearAllMocks());
20
26
  it("builds the client properly for mainnet", () => {
@@ -453,32 +459,36 @@ describe("Aptos API", () => {
453
459
  describe("broadcast", () => {
454
460
  it("broadcasts the transaction", async () => {
455
461
  mockedPost.mockImplementation(async () => ({ data: { hash: "ok" } }));
456
- const mockedPostSpy = jest.spyOn({ post: mockedPost }, "post");
462
+ const mockedPostSpy = jest.spyOn({ postAptosFullNode: mockedPost }, "postAptosFullNode");
463
+ // const txBytes = Hex.fromHexString(tx).toUint8Array();
457
464
  mockedAptos.mockImplementation(() => ({
458
465
  config: "config",
459
466
  }));
467
+ mockedHex.fromHexString = jest.fn().mockReturnValue({ toUint8Array: () => "123" });
460
468
  const api = new AptosAPI("aptos");
461
- await api.broadcast("signature");
469
+ await api.broadcast("signed transaction");
462
470
  expect(mockedPostSpy).toHaveBeenCalledWith({
463
- contentType: "application/x.aptos.signed_transaction+bcs",
464
471
  aptosConfig: "config",
465
- body: Uint8Array.from(Buffer.from("signature", "hex")),
472
+ body: "123",
466
473
  path: "transactions",
467
- type: "Fullnode",
468
474
  originMethod: "",
475
+ contentType: "application/x.aptos.signed_transaction+bcs",
469
476
  });
470
477
  });
471
478
  });
472
479
  describe("estimateFees", () => {
473
- it("estimates the fees", async () => {
480
+ it("estimates the fees for native asset", async () => {
474
481
  const gasEstimation = { gas_estimate: 100 };
482
+ const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
483
+ const time = new Date("2025-05-29");
484
+ jest.useFakeTimers().setSystemTime(time);
475
485
  mockedAptos.mockImplementation(() => ({
476
486
  getLedgerInfo: jest.fn().mockResolvedValue({
477
- ledger_timestamp: Date.now(),
487
+ ledger_timestamp: time,
478
488
  }),
479
489
  transaction: {
480
490
  build: {
481
- simple: jest.fn().mockResolvedValue({ rawTransaction: {} }),
491
+ simple: buildSimple,
482
492
  },
483
493
  simulate: {
484
494
  simple: jest.fn().mockResolvedValue([
@@ -508,8 +518,602 @@ describe("Aptos API", () => {
508
518
  recipient,
509
519
  };
510
520
  const fees = await api.estimateFees(transactionIntent);
521
+ expect(buildSimple.mock.calls[0][0]).toEqual({
522
+ sender: "address1",
523
+ data: {
524
+ function: "0x1::aptos_account::transfer_coins",
525
+ typeArguments: ["0x1::aptos_coin::AptosCoin"],
526
+ functionArguments: ["address2", 100n],
527
+ },
528
+ options: {
529
+ maxGasAmount: 200,
530
+ gasUnitPrice: 100,
531
+ expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
532
+ },
533
+ });
511
534
  expect(fees.value.toString()).toEqual("40");
512
535
  });
536
+ it("estimates the fees for token coin", async () => {
537
+ const gasEstimation = { gas_estimate: 100 };
538
+ const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
539
+ const time = new Date("2025-05-29");
540
+ jest.useFakeTimers().setSystemTime(time);
541
+ mockedAptos.mockImplementation(() => ({
542
+ getLedgerInfo: jest.fn().mockResolvedValue({
543
+ ledger_timestamp: time,
544
+ }),
545
+ transaction: {
546
+ build: {
547
+ simple: buildSimple,
548
+ },
549
+ simulate: {
550
+ simple: jest.fn().mockResolvedValue([
551
+ {
552
+ gas_used: 10,
553
+ gas_unit_price: 2,
554
+ },
555
+ ]),
556
+ },
557
+ },
558
+ getGasPriceEstimation: jest.fn().mockReturnValue(gasEstimation),
559
+ }));
560
+ const amount = BigInt(100);
561
+ const sender = {
562
+ xpub: "xpub",
563
+ freshAddress: "address1",
564
+ };
565
+ const recipient = "address2";
566
+ const api = new AptosAPI("aptos");
567
+ const transactionIntent = {
568
+ asset: {
569
+ type: "token",
570
+ standard: "coin",
571
+ contractAddress: "0x111",
572
+ },
573
+ type: "send",
574
+ sender,
575
+ amount,
576
+ recipient,
577
+ };
578
+ const fees = await api.estimateFees(transactionIntent);
579
+ expect(buildSimple.mock.calls[0][0]).toEqual({
580
+ sender: "address1",
581
+ data: {
582
+ function: "0x1::aptos_account::transfer_coins",
583
+ typeArguments: ["0x111"],
584
+ functionArguments: ["address2", 100n],
585
+ },
586
+ options: {
587
+ maxGasAmount: 200,
588
+ gasUnitPrice: 100,
589
+ expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
590
+ },
591
+ });
592
+ expect(fees.value.toString()).toEqual("20");
593
+ });
594
+ it("estimates the fees for token FA", async () => {
595
+ const gasEstimation = { gas_estimate: 100 };
596
+ const buildSimple = jest.fn().mockResolvedValue({ rawTransaction: {} });
597
+ const time = new Date("2025-05-29");
598
+ jest.useFakeTimers().setSystemTime(time);
599
+ mockedAptos.mockImplementation(() => ({
600
+ getLedgerInfo: jest.fn().mockResolvedValue({
601
+ ledger_timestamp: time,
602
+ }),
603
+ transaction: {
604
+ build: {
605
+ simple: buildSimple,
606
+ },
607
+ simulate: {
608
+ simple: jest.fn().mockResolvedValue([
609
+ {
610
+ gas_used: 10,
611
+ gas_unit_price: 3,
612
+ },
613
+ ]),
614
+ },
615
+ },
616
+ getGasPriceEstimation: jest.fn().mockReturnValue(gasEstimation),
617
+ }));
618
+ const amount = BigInt(100);
619
+ const sender = {
620
+ xpub: "xpub",
621
+ freshAddress: "address1",
622
+ };
623
+ const recipient = "address2";
624
+ const api = new AptosAPI("aptos");
625
+ const transactionIntent = {
626
+ asset: {
627
+ type: "token",
628
+ standard: "fungible_asset",
629
+ contractAddress: "0x111",
630
+ },
631
+ type: "send",
632
+ sender,
633
+ amount,
634
+ recipient,
635
+ };
636
+ const fees = await api.estimateFees(transactionIntent);
637
+ expect(buildSimple.mock.calls[0][0]).toEqual({
638
+ sender: "address1",
639
+ data: {
640
+ function: "0x1::primary_fungible_store::transfer",
641
+ typeArguments: ["0x1::fungible_asset::Metadata"],
642
+ functionArguments: ["0x111", "address2", 100n],
643
+ },
644
+ options: {
645
+ maxGasAmount: 200,
646
+ gasUnitPrice: 100,
647
+ expireTimestamp: Number(Math.ceil(+time / 1_000_000 + 2 * 60)),
648
+ },
649
+ });
650
+ expect(fees.value.toString()).toEqual("30");
651
+ });
652
+ });
653
+ describe("getBalances", () => {
654
+ it("returns an array of AptosBalances objects", async () => {
655
+ const assets = [{ asset_type: APTOS_ASSET_ID, amount: 200 }];
656
+ const mockGetCurrentFungibleAssetBalances = jest.fn().mockResolvedValue(assets);
657
+ mockedAptos.mockImplementation(() => ({
658
+ getCurrentFungibleAssetBalances: mockGetCurrentFungibleAssetBalances,
659
+ }));
660
+ const address = "0x42";
661
+ const api = new AptosAPI("aptos");
662
+ const balances = await api.getBalances(address);
663
+ expect(mockGetCurrentFungibleAssetBalances).toHaveBeenCalledWith({
664
+ options: {
665
+ offset: 0,
666
+ limit: 1000,
667
+ where: {
668
+ asset_type: { _eq: APTOS_ASSET_ID },
669
+ owner_address: { _eq: address },
670
+ },
671
+ },
672
+ });
673
+ expect(balances).toHaveLength(1);
674
+ expect(balances[0].contractAddress).toBe(assets[0].asset_type);
675
+ expect(balances[0].amount).toStrictEqual(BigNumber(assets[0].amount));
676
+ });
677
+ });
678
+ describe("listOperations", () => {
679
+ it("list of operations", async () => {
680
+ const api = new AptosAPI("aptos");
681
+ const address = "0x12345";
682
+ const pagination = { minHeight: 0 };
683
+ const txs = [
684
+ {
685
+ version: "2532591427",
686
+ hash: "0x3f35",
687
+ state_change_hash: "0xb480",
688
+ event_root_hash: "0x3fa1",
689
+ state_checkpoint_hash: null,
690
+ gas_used: "12",
691
+ success: true,
692
+ vm_status: "Executed successfully",
693
+ accumulator_root_hash: "0x319f",
694
+ changes: [
695
+ {
696
+ address: "0x4e5e",
697
+ state_key_hash: "0x3c0c",
698
+ data: {
699
+ type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
700
+ data: {
701
+ coin: {
702
+ value: "4000000",
703
+ },
704
+ deposit_events: {
705
+ counter: "9",
706
+ guid: {
707
+ id: {
708
+ addr: "0x4e5e",
709
+ creation_num: "4",
710
+ },
711
+ },
712
+ },
713
+ frozen: false,
714
+ withdraw_events: {
715
+ counter: "6",
716
+ guid: {
717
+ id: {
718
+ addr: "0x4e5e",
719
+ creation_num: "5",
720
+ },
721
+ },
722
+ },
723
+ },
724
+ },
725
+ type: "write_resource",
726
+ },
727
+ {
728
+ address: address,
729
+ state_key_hash: "0x1709",
730
+ data: {
731
+ type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
732
+ data: {
733
+ coin: {
734
+ value: "68254118",
735
+ },
736
+ deposit_events: {
737
+ counter: "46",
738
+ guid: {
739
+ id: {
740
+ addr: address,
741
+ creation_num: "2",
742
+ },
743
+ },
744
+ },
745
+ frozen: false,
746
+ withdraw_events: {
747
+ counter: "89",
748
+ guid: {
749
+ id: {
750
+ addr: address,
751
+ creation_num: "3",
752
+ },
753
+ },
754
+ },
755
+ },
756
+ },
757
+ type: "write_resource",
758
+ },
759
+ {
760
+ address: address,
761
+ state_key_hash: "0x5520",
762
+ data: {
763
+ type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
764
+ data: {
765
+ coin: {
766
+ value: "1000000",
767
+ },
768
+ deposit_events: {
769
+ counter: "7",
770
+ guid: {
771
+ id: {
772
+ addr: address,
773
+ creation_num: "10",
774
+ },
775
+ },
776
+ },
777
+ frozen: false,
778
+ withdraw_events: {
779
+ counter: "13",
780
+ guid: {
781
+ id: {
782
+ addr: address,
783
+ creation_num: "11",
784
+ },
785
+ },
786
+ },
787
+ },
788
+ },
789
+ type: "write_resource",
790
+ },
791
+ {
792
+ address: address,
793
+ state_key_hash: "0x6f1e",
794
+ data: {
795
+ type: "0x1::account::Account",
796
+ data: {
797
+ authentication_key: address,
798
+ coin_register_events: {
799
+ counter: "5",
800
+ guid: {
801
+ id: {
802
+ addr: address,
803
+ creation_num: "0",
804
+ },
805
+ },
806
+ },
807
+ guid_creation_num: "12",
808
+ key_rotation_events: {
809
+ counter: "0",
810
+ guid: {
811
+ id: {
812
+ addr: address,
813
+ creation_num: "1",
814
+ },
815
+ },
816
+ },
817
+ rotation_capability_offer: {
818
+ for: {
819
+ vec: [],
820
+ },
821
+ },
822
+ sequence_number: "122",
823
+ signer_capability_offer: {
824
+ for: {
825
+ vec: [],
826
+ },
827
+ },
828
+ },
829
+ },
830
+ type: "write_resource",
831
+ },
832
+ {
833
+ state_key_hash: "0x6e4b",
834
+ handle: "0x1b85",
835
+ key: "0x0619",
836
+ value: "0x1ddaf8da3b1497010000000000000000",
837
+ type: "write_table_item",
838
+ },
839
+ ],
840
+ sender: address,
841
+ sequence_number: "121",
842
+ max_gas_amount: "12",
843
+ gas_unit_price: "100",
844
+ expiration_timestamp_secs: "1743177404",
845
+ payload: {
846
+ function: "0x1::aptos_account::transfer_coins",
847
+ type_arguments: ["0xd111::staked_coin::StakedAptos"],
848
+ arguments: ["0x4e5e", "1500000"],
849
+ type: "entry_function_payload",
850
+ },
851
+ events: [
852
+ {
853
+ guid: {
854
+ creation_number: "11",
855
+ account_address: address,
856
+ },
857
+ sequence_number: "12",
858
+ type: "0x1::coin::WithdrawEvent",
859
+ data: {
860
+ amount: "1500000",
861
+ },
862
+ },
863
+ {
864
+ guid: {
865
+ creation_number: "4",
866
+ account_address: "0x4e5e",
867
+ },
868
+ sequence_number: "8",
869
+ type: "0x1::coin::DepositEvent",
870
+ data: {
871
+ amount: "1500000",
872
+ },
873
+ },
874
+ {
875
+ guid: {
876
+ creation_number: "0",
877
+ account_address: "0x0",
878
+ },
879
+ sequence_number: "0",
880
+ type: "0x1::transaction_fee::FeeStatement",
881
+ data: {
882
+ execution_gas_units: "6",
883
+ io_gas_units: "6",
884
+ storage_fee_octas: "0",
885
+ storage_fee_refund_octas: "0",
886
+ total_charge_gas_units: "12",
887
+ },
888
+ },
889
+ ],
890
+ timestamp: "1743177360481259",
891
+ type: TransactionResponseType.User,
892
+ block: {
893
+ height: 311948147,
894
+ hash: "0x6d02",
895
+ },
896
+ },
897
+ {
898
+ version: "2532549325",
899
+ hash: "0x9a6b",
900
+ state_change_hash: "0xa424",
901
+ event_root_hash: "0x0321",
902
+ state_checkpoint_hash: null,
903
+ gas_used: "12",
904
+ success: true,
905
+ vm_status: "Executed successfully",
906
+ accumulator_root_hash: "0xede9",
907
+ changes: [
908
+ {
909
+ address: "0x4e5e",
910
+ state_key_hash: "0x3c0c",
911
+ data: {
912
+ type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
913
+ data: {
914
+ coin: {
915
+ value: "2500000",
916
+ },
917
+ deposit_events: {
918
+ counter: "8",
919
+ guid: {
920
+ id: {
921
+ addr: "0x4e5e",
922
+ creation_num: "4",
923
+ },
924
+ },
925
+ },
926
+ frozen: false,
927
+ withdraw_events: {
928
+ counter: "6",
929
+ guid: {
930
+ id: {
931
+ addr: "0x4e5e",
932
+ creation_num: "5",
933
+ },
934
+ },
935
+ },
936
+ },
937
+ },
938
+ type: "write_resource",
939
+ },
940
+ {
941
+ address: address,
942
+ state_key_hash: "0x1709",
943
+ data: {
944
+ type: "0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>",
945
+ data: {
946
+ coin: {
947
+ value: "68255318",
948
+ },
949
+ deposit_events: {
950
+ counter: "46",
951
+ guid: {
952
+ id: {
953
+ addr: address,
954
+ creation_num: "2",
955
+ },
956
+ },
957
+ },
958
+ frozen: false,
959
+ withdraw_events: {
960
+ counter: "89",
961
+ guid: {
962
+ id: {
963
+ addr: address,
964
+ creation_num: "3",
965
+ },
966
+ },
967
+ },
968
+ },
969
+ },
970
+ type: "write_resource",
971
+ },
972
+ {
973
+ address: address,
974
+ state_key_hash: "0x5520",
975
+ data: {
976
+ type: "0x1::coin::CoinStore<0xd111::staked_coin::StakedAptos>",
977
+ data: {
978
+ coin: {
979
+ value: "2500000",
980
+ },
981
+ deposit_events: {
982
+ counter: "7",
983
+ guid: {
984
+ id: {
985
+ addr: address,
986
+ creation_num: "10",
987
+ },
988
+ },
989
+ },
990
+ frozen: false,
991
+ withdraw_events: {
992
+ counter: "12",
993
+ guid: {
994
+ id: {
995
+ addr: address,
996
+ creation_num: "11",
997
+ },
998
+ },
999
+ },
1000
+ },
1001
+ },
1002
+ type: "write_resource",
1003
+ },
1004
+ {
1005
+ address: address,
1006
+ state_key_hash: "0x6f1e",
1007
+ data: {
1008
+ type: "0x1::account::Account",
1009
+ data: {
1010
+ authentication_key: address,
1011
+ coin_register_events: {
1012
+ counter: "5",
1013
+ guid: {
1014
+ id: {
1015
+ addr: address,
1016
+ creation_num: "0",
1017
+ },
1018
+ },
1019
+ },
1020
+ guid_creation_num: "12",
1021
+ key_rotation_events: {
1022
+ counter: "0",
1023
+ guid: {
1024
+ id: {
1025
+ addr: address,
1026
+ creation_num: "1",
1027
+ },
1028
+ },
1029
+ },
1030
+ rotation_capability_offer: {
1031
+ for: {
1032
+ vec: [],
1033
+ },
1034
+ },
1035
+ sequence_number: "121",
1036
+ signer_capability_offer: {
1037
+ for: {
1038
+ vec: [],
1039
+ },
1040
+ },
1041
+ },
1042
+ },
1043
+ type: "write_resource",
1044
+ },
1045
+ {
1046
+ state_key_hash: "0x6e4b",
1047
+ handle: "0x1b85",
1048
+ key: "0x0619",
1049
+ value: "0xe86e0039581497010000000000000000",
1050
+ type: "write_table_item",
1051
+ },
1052
+ ],
1053
+ sender: address,
1054
+ sequence_number: "120",
1055
+ max_gas_amount: "12",
1056
+ gas_unit_price: "100",
1057
+ expiration_timestamp_secs: "1743176706",
1058
+ payload: {
1059
+ function: "0x1::aptos_account::transfer_coins",
1060
+ type_arguments: ["0xd111::staked_coin::StakedAptos"],
1061
+ arguments: ["0x4e5e", "2500000"],
1062
+ type: "entry_function_payload",
1063
+ },
1064
+ events: [
1065
+ {
1066
+ guid: {
1067
+ creation_number: "11",
1068
+ account_address: address,
1069
+ },
1070
+ sequence_number: "11",
1071
+ type: "0x1::coin::WithdrawEvent",
1072
+ data: {
1073
+ amount: "2500000",
1074
+ },
1075
+ },
1076
+ {
1077
+ guid: {
1078
+ creation_number: "4",
1079
+ account_address: "0x4e5e",
1080
+ },
1081
+ sequence_number: "7",
1082
+ type: "0x1::coin::DepositEvent",
1083
+ data: {
1084
+ amount: "2500000",
1085
+ },
1086
+ },
1087
+ {
1088
+ guid: {
1089
+ creation_number: "0",
1090
+ account_address: "0x0",
1091
+ },
1092
+ sequence_number: "0",
1093
+ type: "0x1::transaction_fee::FeeStatement",
1094
+ data: {
1095
+ execution_gas_units: "6",
1096
+ io_gas_units: "6",
1097
+ storage_fee_octas: "0",
1098
+ storage_fee_refund_octas: "0",
1099
+ total_charge_gas_units: "12",
1100
+ },
1101
+ },
1102
+ ],
1103
+ timestamp: "1743176594693251",
1104
+ type: TransactionResponseType.User,
1105
+ block: {
1106
+ height: 311942427,
1107
+ hash: "0x8655",
1108
+ },
1109
+ },
1110
+ ];
1111
+ const transactions = txs;
1112
+ api.getAccountInfo = jest.fn().mockResolvedValue({ transactions });
1113
+ const ops = await api.listOperations(address, pagination);
1114
+ expect(ops[0]).toHaveLength(2);
1115
+ expect(ops[1]).toBe("");
1116
+ });
513
1117
  });
514
1118
  });
515
1119
  //# sourceMappingURL=client.test.js.map