@aptos-labs/ts-sdk 0.0.3 → 0.0.5

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 (476) hide show
  1. package/README.md +1 -0
  2. package/dist/{cjs → browser}/index.d.ts +431 -237
  3. package/dist/browser/index.global.js +44 -42
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +5831 -0
  6. package/dist/common/index.js +406 -0
  7. package/dist/common/index.js.map +1 -0
  8. package/dist/esm/api/account.d.ts +292 -0
  9. package/dist/esm/api/account.mjs +2 -0
  10. package/dist/esm/api/account.mjs.map +1 -0
  11. package/dist/esm/api/ans.d.ts +79 -0
  12. package/dist/esm/api/ans.mjs +2 -0
  13. package/dist/esm/api/ans.mjs.map +1 -0
  14. package/dist/esm/api/aptos.d.ts +72 -0
  15. package/dist/esm/api/aptos.mjs +2 -0
  16. package/dist/esm/api/aptos.mjs.map +1 -0
  17. package/dist/esm/api/aptosConfig.d.ts +51 -0
  18. package/dist/esm/api/aptosConfig.mjs +2 -0
  19. package/dist/esm/api/aptosConfig.mjs.map +1 -0
  20. package/dist/esm/api/coin.d.ts +59 -0
  21. package/dist/esm/api/coin.mjs +2 -0
  22. package/dist/esm/api/coin.mjs.map +1 -0
  23. package/dist/esm/api/digitalAsset.d.ts +174 -0
  24. package/dist/esm/api/digitalAsset.mjs +2 -0
  25. package/dist/esm/api/digitalAsset.mjs.map +1 -0
  26. package/dist/esm/api/event.d.ts +74 -0
  27. package/dist/esm/api/event.mjs +2 -0
  28. package/dist/esm/api/event.mjs.map +1 -0
  29. package/dist/esm/api/faucet.d.ts +37 -0
  30. package/dist/esm/api/faucet.mjs +2 -0
  31. package/dist/esm/api/faucet.mjs.map +1 -0
  32. package/dist/esm/api/fungibleAsset.d.ts +72 -0
  33. package/dist/esm/api/fungibleAsset.mjs +2 -0
  34. package/dist/esm/api/fungibleAsset.mjs.map +1 -0
  35. package/dist/esm/api/general.d.ts +150 -0
  36. package/dist/esm/api/general.mjs +2 -0
  37. package/dist/esm/api/general.mjs.map +1 -0
  38. package/dist/esm/api/index.d.ts +46 -0
  39. package/dist/esm/api/index.mjs +2 -0
  40. package/dist/esm/api/index.mjs.map +1 -0
  41. package/dist/esm/api/staking.d.ts +53 -0
  42. package/dist/esm/api/staking.mjs +2 -0
  43. package/dist/esm/api/staking.mjs.map +1 -0
  44. package/dist/esm/api/transaction.d.ts +101 -0
  45. package/dist/esm/api/transaction.mjs +2 -0
  46. package/dist/esm/api/transaction.mjs.map +1 -0
  47. package/dist/esm/api/transactionSubmission.d.ts +142 -0
  48. package/dist/esm/api/transactionSubmission.mjs +2 -0
  49. package/dist/esm/api/transactionSubmission.mjs.map +1 -0
  50. package/dist/esm/bcs/consts.d.ts +14 -0
  51. package/dist/esm/bcs/consts.mjs +2 -0
  52. package/dist/esm/bcs/consts.mjs.map +1 -0
  53. package/dist/esm/bcs/deserializer.d.ts +150 -0
  54. package/dist/esm/bcs/deserializer.mjs +2 -0
  55. package/dist/esm/bcs/deserializer.mjs.map +1 -0
  56. package/dist/esm/bcs/index.d.ts +14 -0
  57. package/dist/esm/bcs/index.mjs +2 -0
  58. package/dist/esm/bcs/index.mjs.map +1 -0
  59. package/dist/esm/bcs/serializable/entryFunctionBytes.d.ts +40 -0
  60. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +2 -0
  61. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -0
  62. package/dist/esm/bcs/serializable/fixedBytes.d.ts +52 -0
  63. package/dist/esm/bcs/serializable/fixedBytes.mjs +2 -0
  64. package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -0
  65. package/dist/esm/bcs/serializable/movePrimitives.d.ts +69 -0
  66. package/dist/esm/bcs/serializable/movePrimitives.mjs +2 -0
  67. package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -0
  68. package/dist/esm/bcs/serializable/moveStructs.d.ts +284 -0
  69. package/dist/esm/bcs/serializable/moveStructs.mjs +2 -0
  70. package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -0
  71. package/dist/esm/bcs/serializer.d.ts +192 -0
  72. package/dist/esm/bcs/serializer.mjs +2 -0
  73. package/dist/esm/bcs/serializer.mjs.map +1 -0
  74. package/dist/esm/chunk-2444YR3Y.mjs +2 -0
  75. package/dist/esm/chunk-2444YR3Y.mjs.map +1 -0
  76. package/dist/esm/chunk-27P7PELS.mjs +2 -0
  77. package/dist/esm/chunk-27P7PELS.mjs.map +1 -0
  78. package/dist/esm/chunk-2B5QXKPU.mjs +2 -0
  79. package/dist/esm/chunk-2B5QXKPU.mjs.map +1 -0
  80. package/dist/esm/chunk-2MQZUGO6.mjs +2 -0
  81. package/dist/esm/chunk-2MQZUGO6.mjs.map +1 -0
  82. package/dist/esm/chunk-3JPVQHOR.mjs +2 -0
  83. package/dist/esm/chunk-3JPVQHOR.mjs.map +1 -0
  84. package/dist/esm/chunk-3OJN4I42.mjs +2 -0
  85. package/dist/esm/chunk-3OJN4I42.mjs.map +1 -0
  86. package/dist/esm/chunk-3YOV42H5.mjs +2 -0
  87. package/dist/esm/chunk-3YOV42H5.mjs.map +1 -0
  88. package/dist/esm/chunk-4WPQQPUF.mjs +1 -0
  89. package/dist/esm/chunk-4WPQQPUF.mjs.map +1 -0
  90. package/dist/esm/chunk-6FBKUTGF.mjs +2 -0
  91. package/dist/esm/chunk-6FBKUTGF.mjs.map +1 -0
  92. package/dist/esm/chunk-7AIV5FEN.mjs +2 -0
  93. package/dist/esm/chunk-7AIV5FEN.mjs.map +1 -0
  94. package/dist/esm/chunk-7AQXAH6Q.mjs +2 -0
  95. package/dist/esm/chunk-7AQXAH6Q.mjs.map +1 -0
  96. package/dist/esm/chunk-7TL2MY2B.mjs +2 -0
  97. package/dist/esm/chunk-7TL2MY2B.mjs.map +1 -0
  98. package/dist/esm/chunk-ADR4XQPR.mjs +2 -0
  99. package/dist/esm/chunk-ADR4XQPR.mjs.map +1 -0
  100. package/dist/esm/chunk-AH44UPM4.mjs +2 -0
  101. package/dist/esm/chunk-AH44UPM4.mjs.map +1 -0
  102. package/dist/esm/chunk-AY2HWVDO.mjs +2 -0
  103. package/dist/esm/chunk-AY2HWVDO.mjs.map +1 -0
  104. package/dist/esm/chunk-BC2NOUYT.mjs +2 -0
  105. package/dist/esm/chunk-BC2NOUYT.mjs.map +1 -0
  106. package/dist/esm/chunk-BIUGRAMO.mjs +2 -0
  107. package/dist/esm/chunk-BIUGRAMO.mjs.map +1 -0
  108. package/dist/esm/chunk-BREUBEPM.mjs +2 -0
  109. package/dist/esm/chunk-BREUBEPM.mjs.map +1 -0
  110. package/dist/esm/chunk-BSCOVLWS.mjs +1 -0
  111. package/dist/esm/chunk-BSCOVLWS.mjs.map +1 -0
  112. package/dist/esm/chunk-BTK34A5U.mjs +406 -0
  113. package/dist/esm/chunk-BTK34A5U.mjs.map +1 -0
  114. package/dist/esm/chunk-CZZJAR3B.mjs +2 -0
  115. package/dist/esm/chunk-CZZJAR3B.mjs.map +1 -0
  116. package/dist/esm/chunk-DNDWTM7A.mjs +2 -0
  117. package/dist/esm/chunk-DNDWTM7A.mjs.map +1 -0
  118. package/dist/esm/chunk-DNYVUM3K.mjs +2 -0
  119. package/dist/esm/chunk-DNYVUM3K.mjs.map +1 -0
  120. package/dist/esm/chunk-DXUIJ6KA.mjs +2 -0
  121. package/dist/esm/chunk-DXUIJ6KA.mjs.map +1 -0
  122. package/dist/esm/chunk-E72CFUU4.mjs +2 -0
  123. package/dist/esm/chunk-E72CFUU4.mjs.map +1 -0
  124. package/dist/esm/chunk-E7FWVXGX.mjs +1 -0
  125. package/dist/esm/chunk-E7FWVXGX.mjs.map +1 -0
  126. package/dist/esm/chunk-EKAOAGNQ.mjs +2 -0
  127. package/dist/esm/chunk-EKAOAGNQ.mjs.map +1 -0
  128. package/dist/esm/chunk-FBPNHF54.mjs +2 -0
  129. package/dist/esm/chunk-FBPNHF54.mjs.map +1 -0
  130. package/dist/esm/chunk-FHJ7F7Z6.mjs +2 -0
  131. package/dist/esm/chunk-FHJ7F7Z6.mjs.map +1 -0
  132. package/dist/esm/chunk-FNB6CFQR.mjs +2 -0
  133. package/dist/esm/chunk-FNB6CFQR.mjs.map +1 -0
  134. package/dist/esm/chunk-FYIFBLHU.mjs +2 -0
  135. package/dist/esm/chunk-FYIFBLHU.mjs.map +1 -0
  136. package/dist/esm/chunk-FZY4PMEE.mjs +1 -0
  137. package/dist/esm/chunk-FZY4PMEE.mjs.map +1 -0
  138. package/dist/esm/chunk-GUT3G5CG.mjs +2 -0
  139. package/dist/esm/chunk-GUT3G5CG.mjs.map +1 -0
  140. package/dist/esm/chunk-HH5RSP2H.mjs +2 -0
  141. package/dist/esm/chunk-HH5RSP2H.mjs.map +1 -0
  142. package/dist/esm/chunk-HTZTTZQJ.mjs +1 -0
  143. package/dist/esm/chunk-HTZTTZQJ.mjs.map +1 -0
  144. package/dist/esm/chunk-I5OYNCZS.mjs +1 -0
  145. package/dist/esm/chunk-I5OYNCZS.mjs.map +1 -0
  146. package/dist/esm/chunk-IPJKGHQY.mjs +2 -0
  147. package/dist/esm/chunk-IPJKGHQY.mjs.map +1 -0
  148. package/dist/esm/chunk-IXMH6AXJ.mjs +2 -0
  149. package/dist/esm/chunk-IXMH6AXJ.mjs.map +1 -0
  150. package/dist/esm/chunk-IZHPCZE3.mjs +2 -0
  151. package/dist/esm/chunk-IZHPCZE3.mjs.map +1 -0
  152. package/dist/esm/chunk-J3QOSJFP.mjs +2 -0
  153. package/dist/esm/chunk-J3QOSJFP.mjs.map +1 -0
  154. package/dist/esm/chunk-J5OKXARS.mjs +2 -0
  155. package/dist/esm/chunk-J5OKXARS.mjs.map +1 -0
  156. package/dist/esm/chunk-JTGGMXB7.mjs +2 -0
  157. package/dist/esm/chunk-JTGGMXB7.mjs.map +1 -0
  158. package/dist/esm/chunk-KC64ESLO.mjs +2 -0
  159. package/dist/esm/chunk-KC64ESLO.mjs.map +1 -0
  160. package/dist/esm/chunk-KFP7MDSD.mjs +2 -0
  161. package/dist/esm/chunk-KFP7MDSD.mjs.map +1 -0
  162. package/dist/esm/chunk-KJDY66XF.mjs +2 -0
  163. package/dist/esm/chunk-KJDY66XF.mjs.map +1 -0
  164. package/dist/esm/chunk-KNLMUSIO.mjs +2 -0
  165. package/dist/esm/chunk-KNLMUSIO.mjs.map +1 -0
  166. package/dist/esm/chunk-KPESAXVI.mjs +2 -0
  167. package/dist/esm/chunk-KPESAXVI.mjs.map +1 -0
  168. package/dist/esm/chunk-KWJ6XKNF.mjs +2 -0
  169. package/dist/esm/chunk-KWJ6XKNF.mjs.map +1 -0
  170. package/dist/esm/chunk-KYWYIK5P.mjs +2 -0
  171. package/dist/esm/chunk-KYWYIK5P.mjs.map +1 -0
  172. package/dist/esm/chunk-LAXIJRYU.mjs +2 -0
  173. package/dist/esm/chunk-LAXIJRYU.mjs.map +1 -0
  174. package/dist/esm/chunk-LR65XHSF.mjs +2 -0
  175. package/dist/esm/chunk-LR65XHSF.mjs.map +1 -0
  176. package/dist/esm/chunk-LU6VS7PJ.mjs +2 -0
  177. package/dist/esm/chunk-LU6VS7PJ.mjs.map +1 -0
  178. package/dist/esm/chunk-LV33NV4J.mjs +2 -0
  179. package/dist/esm/chunk-LV33NV4J.mjs.map +1 -0
  180. package/dist/esm/chunk-MIBLZSNS.mjs +2 -0
  181. package/dist/esm/chunk-MIBLZSNS.mjs.map +1 -0
  182. package/dist/esm/chunk-N2FKVZ4D.mjs +1 -0
  183. package/dist/esm/chunk-N2FKVZ4D.mjs.map +1 -0
  184. package/dist/esm/chunk-N6XWY4UT.mjs +2 -0
  185. package/dist/esm/chunk-N6XWY4UT.mjs.map +1 -0
  186. package/dist/esm/chunk-NKTKHC3Z.mjs +2 -0
  187. package/dist/esm/chunk-NKTKHC3Z.mjs.map +1 -0
  188. package/dist/esm/chunk-O243HOP3.mjs +2 -0
  189. package/dist/esm/chunk-O243HOP3.mjs.map +1 -0
  190. package/dist/esm/chunk-PDLUCVJB.mjs +2 -0
  191. package/dist/esm/chunk-PDLUCVJB.mjs.map +1 -0
  192. package/dist/esm/chunk-PJDVHU7X.mjs +2 -0
  193. package/dist/esm/chunk-PJDVHU7X.mjs.map +1 -0
  194. package/dist/esm/chunk-R7G3CLRI.mjs +1 -0
  195. package/dist/esm/chunk-R7G3CLRI.mjs.map +1 -0
  196. package/dist/esm/chunk-RMMOF53Q.mjs +1 -0
  197. package/dist/esm/chunk-RMMOF53Q.mjs.map +1 -0
  198. package/dist/esm/chunk-SJLO3JIH.mjs +2 -0
  199. package/dist/esm/chunk-SJLO3JIH.mjs.map +1 -0
  200. package/dist/esm/chunk-TCTZCPQ6.mjs +1 -0
  201. package/dist/esm/chunk-TCTZCPQ6.mjs.map +1 -0
  202. package/dist/esm/chunk-TXUMB5ZO.mjs +2 -0
  203. package/dist/esm/chunk-TXUMB5ZO.mjs.map +1 -0
  204. package/dist/esm/chunk-TYHBYRUA.mjs +2 -0
  205. package/dist/esm/chunk-TYHBYRUA.mjs.map +1 -0
  206. package/dist/esm/chunk-UQIOMAXE.mjs +2 -0
  207. package/dist/esm/chunk-UQIOMAXE.mjs.map +1 -0
  208. package/dist/esm/chunk-UVGCVCNG.mjs +2 -0
  209. package/dist/esm/chunk-UVGCVCNG.mjs.map +1 -0
  210. package/dist/esm/chunk-UYVPNUH3.mjs +1 -0
  211. package/dist/esm/chunk-UYVPNUH3.mjs.map +1 -0
  212. package/dist/esm/chunk-V3MBJJTL.mjs +1 -0
  213. package/dist/esm/chunk-V3MBJJTL.mjs.map +1 -0
  214. package/dist/esm/chunk-V6AAQLLJ.mjs +2 -0
  215. package/dist/esm/chunk-V6AAQLLJ.mjs.map +1 -0
  216. package/dist/esm/chunk-VAGYTPSI.mjs +2 -0
  217. package/dist/esm/chunk-VAGYTPSI.mjs.map +1 -0
  218. package/dist/esm/chunk-WGXAIQ7K.mjs +2 -0
  219. package/dist/esm/chunk-WGXAIQ7K.mjs.map +1 -0
  220. package/dist/esm/chunk-WNEZCERQ.mjs +2 -0
  221. package/dist/esm/chunk-WNEZCERQ.mjs.map +1 -0
  222. package/dist/esm/chunk-WVMDCC4V.mjs +2 -0
  223. package/dist/esm/chunk-WVMDCC4V.mjs.map +1 -0
  224. package/dist/esm/chunk-XFS5O5GJ.mjs +2 -0
  225. package/dist/esm/chunk-XFS5O5GJ.mjs.map +1 -0
  226. package/dist/esm/chunk-XFSL7O6Q.mjs +2 -0
  227. package/dist/esm/chunk-XFSL7O6Q.mjs.map +1 -0
  228. package/dist/esm/chunk-XNFEUXDS.mjs +2 -0
  229. package/dist/esm/chunk-XNFEUXDS.mjs.map +1 -0
  230. package/dist/esm/chunk-YS2OX7AB.mjs +2 -0
  231. package/dist/esm/chunk-YS2OX7AB.mjs.map +1 -0
  232. package/dist/esm/chunk-Z56AKXJ7.mjs +2 -0
  233. package/dist/esm/chunk-Z56AKXJ7.mjs.map +1 -0
  234. package/dist/esm/chunk-ZT2A5ABR.mjs +2 -0
  235. package/dist/esm/chunk-ZT2A5ABR.mjs.map +1 -0
  236. package/dist/esm/chunk-ZXJ5ZBTL.mjs +2 -0
  237. package/dist/esm/chunk-ZXJ5ZBTL.mjs.map +1 -0
  238. package/dist/esm/client/core.d.ts +24 -0
  239. package/dist/esm/client/core.mjs +2 -0
  240. package/dist/esm/client/core.mjs.map +1 -0
  241. package/dist/esm/client/get.d.ts +55 -0
  242. package/dist/esm/client/get.mjs +2 -0
  243. package/dist/esm/client/get.mjs.map +1 -0
  244. package/dist/esm/client/index.d.ts +11 -0
  245. package/dist/esm/client/index.mjs +2 -0
  246. package/dist/esm/client/index.mjs.map +1 -0
  247. package/dist/esm/client/post.d.ts +60 -0
  248. package/dist/esm/client/post.mjs +2 -0
  249. package/dist/esm/client/post.mjs.map +1 -0
  250. package/dist/esm/client/types.d.ts +46 -0
  251. package/dist/esm/client/types.mjs +2 -0
  252. package/dist/esm/client/types.mjs.map +1 -0
  253. package/dist/esm/core/account.d.ts +184 -0
  254. package/dist/esm/core/account.mjs +2 -0
  255. package/dist/esm/core/account.mjs.map +1 -0
  256. package/dist/esm/core/accountAddress.d.ts +244 -0
  257. package/dist/esm/core/accountAddress.mjs +2 -0
  258. package/dist/esm/core/accountAddress.mjs.map +1 -0
  259. package/dist/esm/core/authenticationKey.d.ts +74 -0
  260. package/dist/esm/core/authenticationKey.mjs +2 -0
  261. package/dist/esm/core/authenticationKey.mjs.map +1 -0
  262. package/dist/esm/core/common.d.ts +32 -0
  263. package/dist/esm/core/common.mjs +2 -0
  264. package/dist/esm/core/common.mjs.map +1 -0
  265. package/dist/esm/core/crypto/anyPublicKey.d.ts +54 -0
  266. package/dist/esm/core/crypto/anyPublicKey.mjs +2 -0
  267. package/dist/esm/core/crypto/anyPublicKey.mjs.map +1 -0
  268. package/dist/esm/core/crypto/anySignature.d.ts +31 -0
  269. package/dist/esm/core/crypto/anySignature.mjs +2 -0
  270. package/dist/esm/core/crypto/anySignature.mjs.map +1 -0
  271. package/dist/esm/core/crypto/asymmetricCrypto.d.ts +74 -0
  272. package/dist/esm/core/crypto/asymmetricCrypto.mjs +2 -0
  273. package/dist/esm/core/crypto/asymmetricCrypto.mjs.map +1 -0
  274. package/dist/esm/core/crypto/ed25519.d.ts +173 -0
  275. package/dist/esm/core/crypto/ed25519.mjs +2 -0
  276. package/dist/esm/core/crypto/ed25519.mjs.map +1 -0
  277. package/dist/esm/core/crypto/hdKey.d.ts +65 -0
  278. package/dist/esm/core/crypto/hdKey.mjs +2 -0
  279. package/dist/esm/core/crypto/hdKey.mjs.map +1 -0
  280. package/dist/esm/core/crypto/index.d.ts +17 -0
  281. package/dist/esm/core/crypto/index.mjs +2 -0
  282. package/dist/esm/core/crypto/index.mjs.map +1 -0
  283. package/dist/esm/core/crypto/multiEd25519.d.ts +126 -0
  284. package/dist/esm/core/crypto/multiEd25519.mjs +2 -0
  285. package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -0
  286. package/dist/esm/core/crypto/multiKey.d.ts +52 -0
  287. package/dist/esm/core/crypto/multiKey.mjs +2 -0
  288. package/dist/esm/core/crypto/multiKey.mjs.map +1 -0
  289. package/dist/esm/core/crypto/secp256k1.d.ts +161 -0
  290. package/dist/esm/core/crypto/secp256k1.mjs +2 -0
  291. package/dist/esm/core/crypto/secp256k1.mjs.map +1 -0
  292. package/dist/esm/core/hex.d.ts +105 -0
  293. package/dist/esm/core/hex.mjs +2 -0
  294. package/dist/esm/core/hex.mjs.map +1 -0
  295. package/dist/esm/core/index.d.ts +21 -0
  296. package/dist/esm/core/index.mjs +2 -0
  297. package/dist/esm/core/index.mjs.map +1 -0
  298. package/dist/esm/index.d.ts +60 -5637
  299. package/dist/esm/index.mjs +1 -5444
  300. package/dist/esm/index.mjs.map +1 -1
  301. package/dist/esm/internal/account.d.ts +143 -0
  302. package/dist/esm/internal/account.mjs +2 -0
  303. package/dist/esm/internal/account.mjs.map +1 -0
  304. package/dist/esm/internal/ans.d.ts +83 -0
  305. package/dist/esm/internal/ans.mjs +2 -0
  306. package/dist/esm/internal/ans.mjs.map +1 -0
  307. package/dist/esm/internal/coin.d.ts +43 -0
  308. package/dist/esm/internal/coin.mjs +2 -0
  309. package/dist/esm/internal/coin.mjs.map +1 -0
  310. package/dist/esm/internal/digitalAsset.d.ts +118 -0
  311. package/dist/esm/internal/digitalAsset.mjs +2 -0
  312. package/dist/esm/internal/digitalAsset.mjs.map +1 -0
  313. package/dist/esm/internal/event.d.ts +45 -0
  314. package/dist/esm/internal/event.mjs +2 -0
  315. package/dist/esm/internal/event.mjs.map +1 -0
  316. package/dist/esm/internal/faucet.d.ts +29 -0
  317. package/dist/esm/internal/faucet.mjs +2 -0
  318. package/dist/esm/internal/faucet.mjs.map +1 -0
  319. package/dist/esm/internal/fungibleAsset.d.ts +38 -0
  320. package/dist/esm/internal/fungibleAsset.mjs +2 -0
  321. package/dist/esm/internal/fungibleAsset.mjs.map +1 -0
  322. package/dist/esm/internal/general.d.ts +60 -0
  323. package/dist/esm/internal/general.mjs +2 -0
  324. package/dist/esm/internal/general.mjs.map +1 -0
  325. package/dist/esm/internal/staking.d.ts +38 -0
  326. package/dist/esm/internal/staking.mjs +2 -0
  327. package/dist/esm/internal/staking.mjs.map +1 -0
  328. package/dist/esm/internal/transaction.d.ts +57 -0
  329. package/dist/esm/internal/transaction.mjs +2 -0
  330. package/dist/esm/internal/transaction.mjs.map +1 -0
  331. package/dist/esm/internal/transactionSubmission.d.ts +148 -0
  332. package/dist/esm/internal/transactionSubmission.mjs +2 -0
  333. package/dist/esm/internal/transactionSubmission.mjs.map +1 -0
  334. package/dist/esm/transactions/authenticator/account.d.ts +79 -0
  335. package/dist/esm/transactions/authenticator/account.mjs +2 -0
  336. package/dist/esm/transactions/authenticator/account.mjs.map +1 -0
  337. package/dist/esm/transactions/authenticator/index.d.ts +19 -0
  338. package/dist/esm/transactions/authenticator/index.mjs +2 -0
  339. package/dist/esm/transactions/authenticator/index.mjs.map +1 -0
  340. package/dist/esm/transactions/authenticator/transaction.d.ts +105 -0
  341. package/dist/esm/transactions/authenticator/transaction.mjs +2 -0
  342. package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -0
  343. package/dist/esm/transactions/index.d.ts +39 -0
  344. package/dist/esm/transactions/index.mjs +2 -0
  345. package/dist/esm/transactions/index.mjs.map +1 -0
  346. package/dist/esm/transactions/instances/chainId.d.ts +21 -0
  347. package/dist/esm/transactions/instances/chainId.mjs +2 -0
  348. package/dist/esm/transactions/instances/chainId.mjs.map +1 -0
  349. package/dist/esm/transactions/instances/identifier.d.ts +23 -0
  350. package/dist/esm/transactions/instances/identifier.mjs +2 -0
  351. package/dist/esm/transactions/instances/identifier.mjs.map +1 -0
  352. package/dist/esm/transactions/instances/index.d.ts +29 -0
  353. package/dist/esm/transactions/instances/index.mjs +2 -0
  354. package/dist/esm/transactions/instances/index.mjs.map +1 -0
  355. package/dist/esm/transactions/instances/moduleId.d.ts +37 -0
  356. package/dist/esm/transactions/instances/moduleId.mjs +2 -0
  357. package/dist/esm/transactions/instances/moduleId.mjs.map +1 -0
  358. package/dist/esm/transactions/instances/rawTransaction.d.ts +98 -0
  359. package/dist/esm/transactions/instances/rawTransaction.mjs +2 -0
  360. package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -0
  361. package/dist/esm/transactions/instances/rotationProofChallenge.d.ts +37 -0
  362. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +2 -0
  363. package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -0
  364. package/dist/esm/transactions/instances/signedTransaction.d.ts +46 -0
  365. package/dist/esm/transactions/instances/signedTransaction.mjs +2 -0
  366. package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -0
  367. package/dist/esm/transactions/instances/transactionArgument.d.ts +40 -0
  368. package/dist/esm/transactions/instances/transactionArgument.mjs +2 -0
  369. package/dist/esm/transactions/instances/transactionArgument.mjs.map +1 -0
  370. package/dist/esm/transactions/instances/transactionPayload.d.ts +211 -0
  371. package/dist/esm/transactions/instances/transactionPayload.mjs +2 -0
  372. package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -0
  373. package/dist/esm/transactions/transactionBuilder/helpers.d.ts +63 -0
  374. package/dist/esm/transactions/transactionBuilder/helpers.mjs +2 -0
  375. package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -0
  376. package/dist/esm/transactions/transactionBuilder/index.d.ts +35 -0
  377. package/dist/esm/transactions/transactionBuilder/index.mjs +2 -0
  378. package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -0
  379. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.ts +54 -0
  380. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +2 -0
  381. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -0
  382. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.ts +128 -0
  383. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +2 -0
  384. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -0
  385. package/dist/esm/transactions/typeTag/index.d.ts +127 -0
  386. package/dist/esm/transactions/typeTag/index.mjs +2 -0
  387. package/dist/esm/transactions/typeTag/index.mjs.map +1 -0
  388. package/dist/esm/transactions/typeTag/parser.d.ts +47 -0
  389. package/dist/esm/transactions/typeTag/parser.mjs +2 -0
  390. package/dist/esm/transactions/typeTag/parser.mjs.map +1 -0
  391. package/dist/esm/transactions/types.d.ts +253 -0
  392. package/dist/esm/transactions/types.mjs +2 -0
  393. package/dist/esm/transactions/types.mjs.map +1 -0
  394. package/dist/esm/types/generated/operations.d.ts +604 -0
  395. package/dist/esm/types/generated/operations.mjs +1 -0
  396. package/dist/esm/types/generated/operations.mjs.map +1 -0
  397. package/dist/esm/types/generated/queries.d.ts +55 -0
  398. package/dist/esm/types/generated/queries.mjs +2 -0
  399. package/dist/esm/types/generated/queries.mjs.map +1 -0
  400. package/dist/esm/types/generated/types.d.ts +9458 -0
  401. package/dist/esm/types/generated/types.mjs +2 -0
  402. package/dist/esm/types/generated/types.mjs.map +1 -0
  403. package/dist/{types → esm/types}/index.d.ts +19 -451
  404. package/dist/esm/types/index.mjs +2 -0
  405. package/dist/esm/types/index.mjs.map +1 -0
  406. package/dist/esm/types/indexer.d.ts +62 -0
  407. package/dist/esm/types/indexer.mjs +2 -0
  408. package/dist/esm/types/indexer.mjs.map +1 -0
  409. package/dist/esm/utils/apiEndpoints.d.ts +14 -0
  410. package/dist/esm/utils/apiEndpoints.mjs +2 -0
  411. package/dist/esm/utils/apiEndpoints.mjs.map +1 -0
  412. package/dist/esm/utils/const.d.ts +42 -0
  413. package/dist/esm/utils/const.mjs +2 -0
  414. package/dist/esm/utils/const.mjs.map +1 -0
  415. package/dist/esm/utils/helpers.d.ts +7 -0
  416. package/dist/esm/utils/helpers.mjs +2 -0
  417. package/dist/esm/utils/helpers.mjs.map +1 -0
  418. package/dist/esm/utils/memoize.d.ts +20 -0
  419. package/dist/esm/utils/memoize.mjs +2 -0
  420. package/dist/esm/utils/memoize.mjs.map +1 -0
  421. package/dist/esm/version.d.ts +8 -0
  422. package/dist/esm/version.mjs +2 -0
  423. package/dist/esm/version.mjs.map +1 -0
  424. package/package.json +17 -13
  425. package/src/api/account.ts +17 -18
  426. package/src/api/ans.ts +58 -0
  427. package/src/api/aptos.ts +7 -1
  428. package/src/api/coin.ts +3 -3
  429. package/src/api/digitalAsset.ts +9 -8
  430. package/src/api/event.ts +4 -3
  431. package/src/api/faucet.ts +3 -2
  432. package/src/api/general.ts +2 -2
  433. package/src/api/staking.ts +5 -4
  434. package/src/api/transactionSubmission.ts +41 -20
  435. package/src/bcs/deserializer.ts +4 -4
  436. package/src/bcs/serializable/moveStructs.ts +13 -13
  437. package/src/bcs/serializer.ts +4 -4
  438. package/src/client/core.ts +18 -8
  439. package/src/core/account.ts +90 -33
  440. package/src/core/accountAddress.ts +34 -30
  441. package/src/core/authenticationKey.ts +11 -9
  442. package/src/core/crypto/ed25519.ts +48 -1
  443. package/src/core/crypto/hdKey.ts +105 -0
  444. package/src/core/crypto/index.ts +1 -0
  445. package/src/core/crypto/secp256k1.ts +36 -0
  446. package/src/index.ts +0 -1
  447. package/src/internal/account.ts +80 -58
  448. package/src/internal/ans.ts +175 -0
  449. package/src/internal/coin.ts +5 -5
  450. package/src/internal/digitalAsset.ts +16 -17
  451. package/src/internal/event.ts +8 -8
  452. package/src/internal/faucet.ts +4 -4
  453. package/src/internal/general.ts +3 -3
  454. package/src/internal/queries/getEvents.graphql +1 -0
  455. package/src/internal/staking.ts +8 -8
  456. package/src/internal/transactionSubmission.ts +78 -19
  457. package/src/transactions/instances/index.ts +1 -0
  458. package/src/transactions/instances/moduleId.ts +1 -1
  459. package/src/transactions/instances/rotationProofChallenge.ts +58 -0
  460. package/src/transactions/transactionBuilder/helpers.ts +5 -1
  461. package/src/transactions/transactionBuilder/remoteAbi.ts +4 -4
  462. package/src/transactions/transactionBuilder/transactionBuilder.ts +31 -49
  463. package/src/transactions/typeTag/index.ts +10 -10
  464. package/src/transactions/typeTag/parser.ts +1 -1
  465. package/src/transactions/types.ts +31 -20
  466. package/src/types/generated/operations.ts +19 -18
  467. package/src/types/generated/queries.ts +20 -19
  468. package/src/types/generated/types.ts +6 -0
  469. package/src/types/index.ts +15 -18
  470. package/src/utils/apiEndpoints.ts +8 -0
  471. package/src/version.ts +1 -1
  472. package/dist/cjs/index.js +0 -5631
  473. package/dist/cjs/index.js.map +0 -1
  474. package/dist/types/index.js +0 -176
  475. package/dist/types/index.js.map +0 -1
  476. package/src/utils/hdKey.ts +0 -113
@@ -7,6 +7,7 @@ import { Deserializer } from "../../bcs/deserializer";
7
7
  import { Serializer } from "../../bcs/serializer";
8
8
  import { Hex } from "../hex";
9
9
  import { HexInput } from "../../types";
10
+ import { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from "./hdKey";
10
11
 
11
12
  /**
12
13
  * Represents the public key of an Ed25519 key pair.
@@ -70,7 +71,7 @@ export class Ed25519PublicKey extends PublicKey {
70
71
  verifySignature(args: { message: HexInput; signature: Ed25519Signature }): boolean {
71
72
  const { message, signature } = args;
72
73
  const rawMessage = Hex.fromHexInput(message).toUint8Array();
73
- const rawSignature = Hex.fromHexInput(signature.toUint8Array()).toUint8Array();
74
+ const rawSignature = signature.toUint8Array();
74
75
  return nacl.sign.detached.verify(rawMessage, rawSignature, this.key.toUint8Array());
75
76
  }
76
77
 
@@ -98,6 +99,12 @@ export class Ed25519PrivateKey extends PrivateKey {
98
99
  */
99
100
  static readonly LENGTH: number = 32;
100
101
 
102
+ /**
103
+ * The Ed25519 key seed to use for BIP-32 compatibility
104
+ * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}
105
+ */
106
+ static readonly SLIP_0010_SEED = "ed25519 seed";
107
+
101
108
  /**
102
109
  * The Ed25519 signing key
103
110
  * @private
@@ -179,6 +186,46 @@ export class Ed25519PrivateKey extends PrivateKey {
179
186
  const bytes = this.signingKeyPair.publicKey;
180
187
  return new Ed25519PublicKey(bytes);
181
188
  }
189
+
190
+ /**
191
+ * Derives a private key from a mnemonic seed phrase.
192
+ *
193
+ * To derive multiple keys from the same phrase, change the path
194
+ *
195
+ * IMPORTANT: Ed25519 supports hardened derivation only (since it lacks a key homomorphism,
196
+ * so non-hardened derivation cannot work)
197
+ *
198
+ * @param path the BIP44 path
199
+ * @param mnemonics the mnemonic seed phrase
200
+ */
201
+ static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {
202
+ if (!isValidHardenedPath(path)) {
203
+ throw new Error(`Invalid derivation path ${path}`);
204
+ }
205
+ return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
206
+ }
207
+
208
+ /**
209
+ * A private inner function so we can separate from the main fromDerivationPath() method
210
+ * to add tests to verify we create the keys correctly.
211
+ *
212
+ * @param path the BIP44 path
213
+ * @param seed the seed phrase created by the mnemonics
214
+ * @param offset the offset used for key derivation, defaults to 0x80000000
215
+ * @returns
216
+ */
217
+ private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {
218
+ const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);
219
+
220
+ const segments = splitPath(path).map((el) => parseInt(el, 10));
221
+
222
+ // Derive the child key based on the path
223
+ const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {
224
+ key,
225
+ chainCode,
226
+ });
227
+ return new Ed25519PrivateKey(privateKey);
228
+ }
182
229
  }
183
230
 
184
231
  /**
@@ -0,0 +1,105 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { hmac } from "@noble/hashes/hmac";
5
+ import { sha512 } from "@noble/hashes/sha512";
6
+ import * as bip39 from "@scure/bip39";
7
+
8
+ export type DerivedKeys = {
9
+ key: Uint8Array;
10
+ chainCode: Uint8Array;
11
+ };
12
+
13
+ /**
14
+ * Aptos derive path is 637
15
+ */
16
+ export const APTOS_HARDENED_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/;
17
+ export const APTOS_BIP44_REGEX = /^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/;
18
+
19
+ /**
20
+ * A list of supported key types and associated seeds
21
+ */
22
+ export enum KeyType {
23
+ ED25519 = "ed25519 seed",
24
+ }
25
+
26
+ export const HARDENED_OFFSET = 0x80000000;
27
+
28
+ /**
29
+ * Aptos derive path is 637
30
+ *
31
+ * Parse and validate a path that is compliant to BIP-44 in form m/44'/637'/{account_index}'/{change_index}/{address_index}
32
+ * for Secp256k1
33
+ *
34
+ * Note that for secp256k1, last two components must be non-hardened.
35
+ *
36
+ * @param path path string (e.g. `m/44'/637'/0'/0/0`).
37
+ */
38
+ export function isValidBIP44Path(path: string): boolean {
39
+ return APTOS_BIP44_REGEX.test(path);
40
+ }
41
+
42
+ /**
43
+ * Aptos derive path is 637
44
+ *
45
+ * Parse and validate a path that is compliant to SLIP-0010 and BIP-44
46
+ * in form m/44'/637'/{account_index}'/{change_index}'/{address_index}'.
47
+ * See SLIP-0010 {@link https://github.com/satoshilabs/slips/blob/master/slip-0044.md}
48
+ * See BIP-44 {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}
49
+ *
50
+ * Note that for Ed25519, all components must be hardened.
51
+ * This is because non-hardened [PK] derivation would not work due to Ed25519's lack of a key homomorphism.
52
+ * Specifically, you cannot derive the PK associated with derivation path a/b/c given the PK of a/b.
53
+ * This is because the PK in Ed25519 is, more or less, computed as 𝑔𝐻(𝑠𝑘),
54
+ * with the hash function breaking the homomorphism.
55
+ *
56
+ * @param path path string (e.g. `m/44'/637'/0'/0'/0'`).
57
+ */
58
+ export function isValidHardenedPath(path: string): boolean {
59
+ return APTOS_HARDENED_REGEX.test(path);
60
+ }
61
+
62
+ export const deriveKey = (hashSeed: Uint8Array | string, data: Uint8Array | string): DerivedKeys => {
63
+ const digest = hmac.create(sha512, hashSeed).update(data).digest();
64
+ return {
65
+ key: digest.slice(0, 32),
66
+ chainCode: digest.slice(32),
67
+ };
68
+ };
69
+
70
+ /**
71
+ * Derive a child key from the private key
72
+ * @param key
73
+ * @param chainCode
74
+ * @param index
75
+ * @constructor
76
+ */
77
+ export const CKDPriv = ({ key, chainCode }: DerivedKeys, index: number): DerivedKeys => {
78
+ const buffer = new ArrayBuffer(4);
79
+ new DataView(buffer).setUint32(0, index);
80
+ const indexBytes = new Uint8Array(buffer);
81
+ const zero = new Uint8Array([0]);
82
+ const data = new Uint8Array([...zero, ...key, ...indexBytes]);
83
+ return deriveKey(chainCode, data);
84
+ };
85
+
86
+ const removeApostrophes = (val: string): string => val.replace("'", "");
87
+
88
+ /**
89
+ * Splits derive path into segments
90
+ * @param path
91
+ */
92
+ export const splitPath = (path: string): Array<string> => path.split("/").slice(1).map(removeApostrophes);
93
+
94
+ /**
95
+ * Normalizes the mnemonic by removing extra whitespace and making it lowercase
96
+ * @param mnemonic the mnemonic seed phrase
97
+ */
98
+ export const mnemonicToSeed = (mnemonic: string): Uint8Array => {
99
+ const normalizedMnemonic = mnemonic
100
+ .trim()
101
+ .split(/\s+/)
102
+ .map((part) => part.toLowerCase())
103
+ .join(" ");
104
+ return bip39.mnemonicToSeedSync(normalizedMnemonic);
105
+ };
@@ -6,3 +6,4 @@ export * from "./ed25519";
6
6
  export * from "./multiEd25519";
7
7
  export * from "./secp256k1";
8
8
  export * from "./multiKey";
9
+ export * from "./hdKey";
@@ -3,10 +3,12 @@
3
3
 
4
4
  import { sha3_256 } from "@noble/hashes/sha3";
5
5
  import { secp256k1 } from "@noble/curves/secp256k1";
6
+ import { HDKey } from "@scure/bip32";
6
7
  import { PrivateKey, PublicKey, Signature } from "./asymmetricCrypto";
7
8
  import { Deserializer, Serializer } from "../../bcs";
8
9
  import { Hex } from "../hex";
9
10
  import { HexInput } from "../../types";
11
+ import { isValidBIP44Path, mnemonicToSeed } from "./hdKey";
10
12
 
11
13
  /**
12
14
  * Represents the Secp256k1 ecdsa public key
@@ -173,6 +175,40 @@ export class Secp256k1PrivateKey extends PrivateKey {
173
175
  const bytes = secp256k1.getPublicKey(this.key.toUint8Array(), false);
174
176
  return new Secp256k1PublicKey(bytes);
175
177
  }
178
+
179
+ /**
180
+ * Derives a private key from a mnemonic seed phrase.
181
+ *
182
+ * @param path the BIP44 path
183
+ * @param mnemonics the mnemonic seed phrase
184
+ *
185
+ * @returns The generated key
186
+ */
187
+ static fromDerivationPath(path: string, mnemonics: string): Secp256k1PrivateKey {
188
+ if (!isValidBIP44Path(path)) {
189
+ throw new Error(`Invalid derivation path ${path}`);
190
+ }
191
+ return Secp256k1PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));
192
+ }
193
+
194
+ /**
195
+ * A private inner function so we can separate from the main fromDerivationPath() method
196
+ * to add tests to verify we create the keys correctly.
197
+ *
198
+ * @param path the BIP44 path
199
+ * @param seed the seed phrase created by the mnemonics
200
+ *
201
+ * @returns The generated key
202
+ */
203
+ private static fromDerivationPathInner(path: string, seed: Uint8Array): Secp256k1PrivateKey {
204
+ const { privateKey } = HDKey.fromMasterSeed(seed).derive(path);
205
+ // library returns privateKey as Uint8Array | null
206
+ if (privateKey === null) {
207
+ throw new Error("Invalid key");
208
+ }
209
+
210
+ return new Secp256k1PrivateKey(privateKey);
211
+ }
176
212
  }
177
213
 
178
214
  /**
package/src/index.ts CHANGED
@@ -8,4 +8,3 @@ export * from "./core";
8
8
  export * from "./transactions";
9
9
  export * from "./types";
10
10
  export * from "./utils/apiEndpoints";
11
- export * from "./utils/hdKey";
@@ -10,10 +10,9 @@
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { AptosApiError, getAptosFullNode, paginateWithCursor } from "../client";
13
- import { AccountAddress } from "../core/accountAddress";
13
+ import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
14
14
  import { Account } from "../core/account";
15
15
  import { PrivateKey } from "../core/crypto/asymmetricCrypto";
16
- import { Hex } from "../core/hex";
17
16
  import { getTableItem, queryIndexer } from "./general";
18
17
  import {
19
18
  AccountData,
@@ -22,7 +21,6 @@ import {
22
21
  GetAccountOwnedObjectsResponse,
23
22
  GetAccountOwnedTokensFromCollectionResponse,
24
23
  GetAccountOwnedTokensQueryResponse,
25
- HexInput,
26
24
  LedgerVersion,
27
25
  MoveModuleBytecode,
28
26
  MoveResource,
@@ -57,26 +55,29 @@ import { memoizeAsync } from "../utils/memoize";
57
55
  import { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey } from "../core";
58
56
  import { AnyPublicKey } from "../core/crypto/anyPublicKey";
59
57
 
60
- export async function getInfo(args: { aptosConfig: AptosConfig; accountAddress: HexInput }): Promise<AccountData> {
58
+ export async function getInfo(args: {
59
+ aptosConfig: AptosConfig;
60
+ accountAddress: AccountAddressInput;
61
+ }): Promise<AccountData> {
61
62
  const { aptosConfig, accountAddress } = args;
62
63
  const { data } = await getAptosFullNode<{}, AccountData>({
63
64
  aptosConfig,
64
65
  originMethod: "getInfo",
65
- path: `accounts/${AccountAddress.fromHexInput(accountAddress).toString()}`,
66
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}`,
66
67
  });
67
68
  return data;
68
69
  }
69
70
 
70
71
  export async function getModules(args: {
71
72
  aptosConfig: AptosConfig;
72
- accountAddress: HexInput;
73
+ accountAddress: AccountAddressInput;
73
74
  options?: PaginationArgs & LedgerVersion;
74
75
  }): Promise<MoveModuleBytecode[]> {
75
76
  const { aptosConfig, accountAddress, options } = args;
76
77
  return paginateWithCursor<{}, MoveModuleBytecode[]>({
77
78
  aptosConfig,
78
79
  originMethod: "getModules",
79
- path: `accounts/${AccountAddress.fromHexInput(accountAddress).toString()}/modules`,
80
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
80
81
  params: {
81
82
  ledger_version: options?.ledgerVersion,
82
83
  start: options?.offset,
@@ -95,7 +96,7 @@ export async function getModules(args: {
95
96
  */
96
97
  export async function getModule(args: {
97
98
  aptosConfig: AptosConfig;
98
- accountAddress: HexInput;
99
+ accountAddress: AccountAddressInput;
99
100
  moduleName: string;
100
101
  options?: LedgerVersion;
101
102
  }): Promise<MoveModuleBytecode> {
@@ -114,7 +115,7 @@ export async function getModule(args: {
114
115
 
115
116
  async function getModuleInner(args: {
116
117
  aptosConfig: AptosConfig;
117
- accountAddress: HexInput;
118
+ accountAddress: AccountAddressInput;
118
119
  moduleName: string;
119
120
  options?: LedgerVersion;
120
121
  }): Promise<MoveModuleBytecode> {
@@ -123,7 +124,7 @@ async function getModuleInner(args: {
123
124
  const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({
124
125
  aptosConfig,
125
126
  originMethod: "getModule",
126
- path: `accounts/${AccountAddress.fromHexInput(accountAddress).toString()}/module/${moduleName}`,
127
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,
127
128
  params: { ledger_version: options?.ledgerVersion },
128
129
  });
129
130
  return data;
@@ -131,28 +132,28 @@ async function getModuleInner(args: {
131
132
 
132
133
  export async function getTransactions(args: {
133
134
  aptosConfig: AptosConfig;
134
- accountAddress: HexInput;
135
+ accountAddress: AccountAddressInput;
135
136
  options?: PaginationArgs;
136
137
  }): Promise<TransactionResponse[]> {
137
138
  const { aptosConfig, accountAddress, options } = args;
138
139
  return paginateWithCursor<{}, TransactionResponse[]>({
139
140
  aptosConfig,
140
141
  originMethod: "getTransactions",
141
- path: `accounts/${AccountAddress.fromHexInput(accountAddress).toString()}/transactions`,
142
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,
142
143
  params: { start: options?.offset, limit: options?.limit },
143
144
  });
144
145
  }
145
146
 
146
147
  export async function getResources(args: {
147
148
  aptosConfig: AptosConfig;
148
- accountAddress: HexInput;
149
+ accountAddress: AccountAddressInput;
149
150
  options?: PaginationArgs & LedgerVersion;
150
151
  }): Promise<MoveResource[]> {
151
152
  const { aptosConfig, accountAddress, options } = args;
152
153
  return paginateWithCursor<{}, MoveResource[]>({
153
154
  aptosConfig,
154
155
  originMethod: "getResources",
155
- path: `accounts/${AccountAddress.fromHexInput(accountAddress).toString()}/resources`,
156
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,
156
157
  params: {
157
158
  ledger_version: options?.ledgerVersion,
158
159
  start: options?.offset,
@@ -163,7 +164,7 @@ export async function getResources(args: {
163
164
 
164
165
  export async function getResource<T extends {}>(args: {
165
166
  aptosConfig: AptosConfig;
166
- accountAddress: HexInput;
167
+ accountAddress: AccountAddressInput;
167
168
  resourceType: MoveStructType;
168
169
  options?: LedgerVersion;
169
170
  }): Promise<T> {
@@ -171,7 +172,7 @@ export async function getResource<T extends {}>(args: {
171
172
  const { data } = await getAptosFullNode<{}, MoveResource>({
172
173
  aptosConfig,
173
174
  originMethod: "getResource",
174
- path: `accounts/${AccountAddress.fromHexInput(accountAddress).toString()}/resource/${resourceType}`,
175
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,
175
176
  params: { ledger_version: options?.ledgerVersion },
176
177
  });
177
178
  return data.data as T;
@@ -179,7 +180,7 @@ export async function getResource<T extends {}>(args: {
179
180
 
180
181
  export async function lookupOriginalAccountAddress(args: {
181
182
  aptosConfig: AptosConfig;
182
- authenticationKey: HexInput;
183
+ authenticationKey: AccountAddressInput;
183
184
  options?: LedgerVersion;
184
185
  }): Promise<AccountAddress> {
185
186
  const { aptosConfig, authenticationKey, options } = args;
@@ -197,24 +198,26 @@ export async function lookupOriginalAccountAddress(args: {
197
198
  address_map: { handle },
198
199
  } = resource;
199
200
 
201
+ const authKeyAddress = AccountAddress.from(authenticationKey);
202
+
200
203
  // If the address is not found in the address map, which means its not rotated
201
204
  // then return the address as is
202
205
  try {
203
- const originalAddress = await getTableItem({
206
+ const originalAddress = await getTableItem<string>({
204
207
  aptosConfig,
205
208
  handle,
206
209
  data: {
207
- key: Hex.fromHexInput(authenticationKey).toString(),
210
+ key: authKeyAddress.toString(),
208
211
  key_type: "address",
209
212
  value_type: "address",
210
213
  },
211
214
  options,
212
215
  });
213
216
 
214
- return AccountAddress.fromHexInput(originalAddress);
217
+ return AccountAddress.from(originalAddress);
215
218
  } catch (err) {
216
219
  if (err instanceof AptosApiError && err.data.error_code === "table_item_not_found") {
217
- return AccountAddress.fromHexInput(authenticationKey);
220
+ return authKeyAddress;
218
221
  }
219
222
 
220
223
  throw err;
@@ -223,15 +226,15 @@ export async function lookupOriginalAccountAddress(args: {
223
226
 
224
227
  export async function getAccountTokensCount(args: {
225
228
  aptosConfig: AptosConfig;
226
- accountAddress: HexInput;
229
+ accountAddress: AccountAddressInput;
227
230
  }): Promise<number> {
228
231
  const { aptosConfig, accountAddress } = args;
229
232
 
230
- const address = AccountAddress.fromHexInput(accountAddress).toString();
233
+ const address = AccountAddress.from(accountAddress).toStringLong();
231
234
 
232
- const whereCondition: any = {
235
+ const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {
233
236
  owner_address: { _eq: address },
234
- amount: { _gt: "0" },
237
+ amount: { _gt: 0 },
235
238
  };
236
239
 
237
240
  const graphqlQuery = {
@@ -252,7 +255,7 @@ export async function getAccountTokensCount(args: {
252
255
 
253
256
  export async function getAccountOwnedTokens(args: {
254
257
  aptosConfig: AptosConfig;
255
- accountAddress: HexInput;
258
+ accountAddress: AccountAddressInput;
256
259
  options?: {
257
260
  tokenStandard?: TokenStandard;
258
261
  pagination?: PaginationArgs;
@@ -260,12 +263,13 @@ export async function getAccountOwnedTokens(args: {
260
263
  };
261
264
  }): Promise<GetAccountOwnedTokensQueryResponse> {
262
265
  const { aptosConfig, accountAddress, options } = args;
263
- const address = AccountAddress.fromHexInput(accountAddress).toString();
266
+ const address = AccountAddress.from(accountAddress).toStringLong();
264
267
 
265
- const whereCondition: any = {
266
- owner_address: { _eq: address },
267
- amount: { _gt: 0 },
268
- };
268
+ const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =
269
+ {
270
+ owner_address: { _eq: address },
271
+ amount: { _gt: 0 },
272
+ };
269
273
 
270
274
  if (options?.tokenStandard) {
271
275
  whereCondition.token_standard = { _eq: options?.tokenStandard };
@@ -292,8 +296,8 @@ export async function getAccountOwnedTokens(args: {
292
296
 
293
297
  export async function getAccountOwnedTokensFromCollectionAddress(args: {
294
298
  aptosConfig: AptosConfig;
295
- accountAddress: HexInput;
296
- collectionAddress: HexInput;
299
+ accountAddress: AccountAddressInput;
300
+ collectionAddress: AccountAddressInput;
297
301
  options?: {
298
302
  tokenStandard?: TokenStandard;
299
303
  pagination?: PaginationArgs;
@@ -301,10 +305,15 @@ export async function getAccountOwnedTokensFromCollectionAddress(args: {
301
305
  };
302
306
  }): Promise<GetAccountOwnedTokensFromCollectionResponse> {
303
307
  const { aptosConfig, accountAddress, collectionAddress, options } = args;
304
- const ownerAddress = AccountAddress.fromHexInput(accountAddress).toString();
305
- const collAddress = Hex.fromHexInput(collectionAddress).toString();
306
-
307
- const whereCondition: any = {
308
+ const ownerAddress = AccountAddress.from(accountAddress).toStringLong();
309
+ const collAddress = AccountAddress.from(collectionAddress).toStringLong();
310
+
311
+ const whereCondition: {
312
+ owner_address: { _eq: string };
313
+ current_token_data: { collection_id: { _eq: string } };
314
+ amount: { _gt: number };
315
+ token_standard?: { _eq: string };
316
+ } = {
308
317
  owner_address: { _eq: ownerAddress },
309
318
  current_token_data: { collection_id: { _eq: collAddress } },
310
319
  amount: { _gt: 0 },
@@ -335,7 +344,7 @@ export async function getAccountOwnedTokensFromCollectionAddress(args: {
335
344
 
336
345
  export async function getAccountCollectionsWithOwnedTokens(args: {
337
346
  aptosConfig: AptosConfig;
338
- accountAddress: HexInput;
347
+ accountAddress: AccountAddressInput;
339
348
  options?: {
340
349
  tokenStandard?: TokenStandard;
341
350
  pagination?: PaginationArgs;
@@ -343,9 +352,13 @@ export async function getAccountCollectionsWithOwnedTokens(args: {
343
352
  };
344
353
  }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {
345
354
  const { aptosConfig, accountAddress, options } = args;
346
- const address = AccountAddress.fromHexInput(accountAddress).toString();
355
+ const address = AccountAddress.from(accountAddress).toStringLong();
347
356
 
348
- const whereCondition: any = {
357
+ const whereCondition: {
358
+ owner_address: { _eq: string };
359
+ amount: { _gt: number };
360
+ current_collection?: { token_standard: { _eq: string } };
361
+ } = {
349
362
  owner_address: { _eq: address },
350
363
  amount: { _gt: 0 },
351
364
  };
@@ -377,11 +390,11 @@ export async function getAccountCollectionsWithOwnedTokens(args: {
377
390
 
378
391
  export async function getAccountTransactionsCount(args: {
379
392
  aptosConfig: AptosConfig;
380
- accountAddress: HexInput;
393
+ accountAddress: AccountAddressInput;
381
394
  }): Promise<number> {
382
395
  const { aptosConfig, accountAddress } = args;
383
396
 
384
- const address = AccountAddress.fromHexInput(accountAddress).toString();
397
+ const address = AccountAddress.from(accountAddress).toStringLong();
385
398
 
386
399
  const graphqlQuery = {
387
400
  query: GetAccountTransactionsCount,
@@ -403,16 +416,16 @@ export async function getAccountTransactionsCount(args: {
403
416
 
404
417
  export async function getAccountCoinsData(args: {
405
418
  aptosConfig: AptosConfig;
406
- accountAddress: HexInput;
419
+ accountAddress: AccountAddressInput;
407
420
  options?: {
408
421
  pagination?: PaginationArgs;
409
422
  orderBy?: OrderBy<GetAccountCoinsDataResponse[0]>;
410
423
  };
411
424
  }): Promise<GetAccountCoinsDataResponse> {
412
425
  const { aptosConfig, accountAddress, options } = args;
413
- const address = AccountAddress.fromHexInput(accountAddress).toString();
426
+ const address = AccountAddress.from(accountAddress).toStringLong();
414
427
 
415
- const whereCondition: any = {
428
+ const whereCondition: { owner_address: { _eq: string } } = {
416
429
  owner_address: { _eq: address },
417
430
  };
418
431
 
@@ -437,10 +450,10 @@ export async function getAccountCoinsData(args: {
437
450
 
438
451
  export async function getAccountCoinsCount(args: {
439
452
  aptosConfig: AptosConfig;
440
- accountAddress: HexInput;
453
+ accountAddress: AccountAddressInput;
441
454
  }): Promise<number> {
442
455
  const { aptosConfig, accountAddress } = args;
443
- const address = AccountAddress.fromHexInput(accountAddress).toString();
456
+ const address = AccountAddress.from(accountAddress).toStringLong();
444
457
 
445
458
  const graphqlQuery = {
446
459
  query: GetAccountCoinsCount,
@@ -462,16 +475,16 @@ export async function getAccountCoinsCount(args: {
462
475
 
463
476
  export async function getAccountOwnedObjects(args: {
464
477
  aptosConfig: AptosConfig;
465
- accountAddress: HexInput;
478
+ accountAddress: AccountAddressInput;
466
479
  options?: {
467
480
  pagination?: PaginationArgs;
468
481
  orderBy?: OrderBy<GetAccountOwnedObjectsResponse[0]>;
469
482
  };
470
483
  }): Promise<GetAccountOwnedObjectsResponse> {
471
484
  const { aptosConfig, accountAddress, options } = args;
472
- const address = AccountAddress.fromHexInput(accountAddress).toString();
485
+ const address = AccountAddress.from(accountAddress).toStringLong();
473
486
 
474
- const whereCondition: any = {
487
+ const whereCondition: { owner_address: { _eq: string } } = {
475
488
  owner_address: { _eq: address },
476
489
  };
477
490
  const graphqlQuery = {
@@ -492,6 +505,15 @@ export async function getAccountOwnedObjects(args: {
492
505
  return data.current_objects;
493
506
  }
494
507
 
508
+ /**
509
+ * NOTE: There is a potential issue once unified single signer scheme will be adopted
510
+ * by the community.
511
+ *
512
+ * Becuase on could create 2 accounts with the same private key with this new authenticator type,
513
+ * we’ll need to determine the order in which we lookup the accounts. First unified
514
+ * scheme and then legacy scheme vs first legacy scheme and then unified scheme.
515
+ *
516
+ */
495
517
  export async function deriveAccountFromPrivateKey(args: {
496
518
  aptosConfig: AptosConfig;
497
519
  privateKey: PrivateKey;
@@ -502,29 +524,29 @@ export async function deriveAccountFromPrivateKey(args: {
502
524
  if (privateKey instanceof Secp256k1PrivateKey) {
503
525
  // private key is secp256k1, therefore we know it for sure uses a single signer key
504
526
  const authKey = AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme: SigningScheme.SingleKey });
505
- const address = new AccountAddress({ data: authKey.toUint8Array() });
527
+ const address = authKey.derivedAddress();
506
528
  return Account.fromPrivateKeyAndAddress({ privateKey, address });
507
529
  }
508
530
 
509
531
  if (privateKey instanceof Ed25519PrivateKey) {
510
532
  // lookup single sender ed25519
511
- const SingleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKeyAndScheme({
533
+ const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKeyAndScheme({
512
534
  publicKey,
513
535
  scheme: SigningScheme.SingleKey,
514
536
  });
515
537
  const isSingleSenderTransactionAuthenticator = await isAccountExist({
516
- authKey: SingleSenderTransactionAuthenticatorAuthKey,
538
+ authKey: singleSenderTransactionAuthenticatorAuthKey,
517
539
  aptosConfig,
518
540
  });
519
541
  if (isSingleSenderTransactionAuthenticator) {
520
- const address = new AccountAddress({ data: SingleSenderTransactionAuthenticatorAuthKey.toUint8Array() });
521
- return Account.fromPrivateKeyAndAddress({ privateKey, address });
542
+ const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();
543
+ return Account.fromPrivateKeyAndAddress({ privateKey, address, legacy: false });
522
544
  }
523
545
  // lookup legacy ed25519
524
546
  const legacyAuthKey = AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme: SigningScheme.Ed25519 });
525
547
  const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });
526
548
  if (isLegacyEd25519) {
527
- const address = new AccountAddress({ data: legacyAuthKey.toUint8Array() });
549
+ const address = legacyAuthKey.derivedAddress();
528
550
  return Account.fromPrivateKeyAndAddress({ privateKey, address, legacy: true });
529
551
  }
530
552
  }
@@ -537,13 +559,13 @@ export async function isAccountExist(args: { aptosConfig: AptosConfig; authKey:
537
559
  const { aptosConfig, authKey } = args;
538
560
  const accountAddress = await lookupOriginalAccountAddress({
539
561
  aptosConfig,
540
- authenticationKey: authKey.toString(),
562
+ authenticationKey: authKey.derivedAddress(),
541
563
  });
542
564
 
543
565
  try {
544
566
  await getInfo({
545
567
  aptosConfig,
546
- accountAddress: accountAddress.toString(),
568
+ accountAddress,
547
569
  });
548
570
  return true;
549
571
  } catch (error: any) {