@aptos-labs/ts-sdk 1.36.0-zeta.0 → 1.37.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 (249) hide show
  1. package/dist/common/{accountAddress-C685VEzA.d.ts → accountAddress-DZH9Wn5l.d.ts} +28 -1
  2. package/dist/common/chunk-MVCKMP5U.js +4 -0
  3. package/dist/common/{chunk-5GUWOXQG.js.map → chunk-MVCKMP5U.js.map} +1 -1
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +221 -31
  8. package/dist/common/index.js +9 -9
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-6KGApCPu.d.mts → Ed25519Account-CDURCT1q.d.mts} +56 -0
  11. package/dist/esm/account/AbstractKeylessAccount.d.mts +2 -2
  12. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  13. package/dist/esm/account/AbstractedAccount.d.mts +1 -1
  14. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  15. package/dist/esm/account/Account.d.mts +3 -3
  16. package/dist/esm/account/Account.mjs +1 -1
  17. package/dist/esm/account/AccountUtils.d.mts +2 -2
  18. package/dist/esm/account/AccountUtils.mjs +1 -1
  19. package/dist/esm/account/Ed25519Account.d.mts +4 -4
  20. package/dist/esm/account/Ed25519Account.mjs +1 -1
  21. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  22. package/dist/esm/account/FederatedKeylessAccount.d.mts +2 -2
  23. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  24. package/dist/esm/account/KeylessAccount.d.mts +2 -2
  25. package/dist/esm/account/KeylessAccount.mjs +1 -1
  26. package/dist/esm/account/MultiEd25519Account.d.mts +35 -13
  27. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  28. package/dist/esm/account/MultiKeyAccount.d.mts +6 -2
  29. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  30. package/dist/esm/account/SingleKeyAccount.d.mts +4 -4
  31. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  32. package/dist/esm/account/index.d.mts +2 -2
  33. package/dist/esm/account/index.mjs +1 -1
  34. package/dist/esm/account/utils.mjs +1 -1
  35. package/dist/esm/api/account/abstraction.mjs +1 -1
  36. package/dist/esm/api/account.d.mts +85 -6
  37. package/dist/esm/api/account.mjs +1 -1
  38. package/dist/esm/api/ans.d.mts +1 -1
  39. package/dist/esm/api/ans.mjs +1 -1
  40. package/dist/esm/api/aptos.d.mts +2 -2
  41. package/dist/esm/api/aptos.mjs +1 -1
  42. package/dist/esm/api/coin.mjs +1 -1
  43. package/dist/esm/api/digitalAsset.d.mts +1 -1
  44. package/dist/esm/api/digitalAsset.mjs +1 -1
  45. package/dist/esm/api/event.mjs +1 -1
  46. package/dist/esm/api/experimental.mjs +1 -1
  47. package/dist/esm/api/faucet.mjs +1 -1
  48. package/dist/esm/api/fungibleAsset.d.mts +1 -1
  49. package/dist/esm/api/fungibleAsset.mjs +1 -1
  50. package/dist/esm/api/general.mjs +1 -1
  51. package/dist/esm/api/index.d.mts +2 -2
  52. package/dist/esm/api/index.mjs +1 -1
  53. package/dist/esm/api/keyless.d.mts +2 -2
  54. package/dist/esm/api/keyless.mjs +1 -1
  55. package/dist/esm/api/object.mjs +1 -1
  56. package/dist/esm/api/staking.mjs +1 -1
  57. package/dist/esm/api/table.mjs +1 -1
  58. package/dist/esm/api/transaction.d.mts +1 -1
  59. package/dist/esm/api/transaction.mjs +1 -1
  60. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/management.d.mts +1 -1
  62. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
  64. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  65. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  66. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  67. package/dist/esm/api/utils.mjs +1 -1
  68. package/dist/esm/bcs/index.mjs +1 -1
  69. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  70. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  71. package/dist/esm/{chunk-AIPHJFJL.mjs → chunk-3IGJ2IMB.mjs} +2 -2
  72. package/dist/esm/{chunk-CWL7ZA3P.mjs → chunk-5MMTP427.mjs} +2 -2
  73. package/dist/esm/chunk-6374Q7AG.mjs +2 -0
  74. package/dist/esm/{chunk-3RVAGHAA.mjs.map → chunk-6374Q7AG.mjs.map} +1 -1
  75. package/dist/esm/{chunk-AEGA5N2W.mjs → chunk-6J64BOS7.mjs} +2 -2
  76. package/dist/esm/chunk-7H44HTYE.mjs +4 -0
  77. package/dist/esm/chunk-7H44HTYE.mjs.map +1 -0
  78. package/dist/esm/{chunk-6KE4JZD6.mjs → chunk-7VEWPUCH.mjs} +2 -2
  79. package/dist/esm/chunk-ANTUWHYB.mjs +2 -0
  80. package/dist/esm/chunk-ANTUWHYB.mjs.map +1 -0
  81. package/dist/esm/{chunk-R6QCPXQG.mjs → chunk-B373VRCY.mjs} +2 -2
  82. package/dist/esm/chunk-B373VRCY.mjs.map +1 -0
  83. package/dist/esm/{chunk-TTY5GFMN.mjs → chunk-BSH7B2QT.mjs} +2 -2
  84. package/dist/esm/chunk-EYLZD4JU.mjs +4 -0
  85. package/dist/esm/chunk-EYLZD4JU.mjs.map +1 -0
  86. package/dist/esm/chunk-GPG64UZT.mjs +2 -0
  87. package/dist/esm/{chunk-X5YB74NB.mjs.map → chunk-GPG64UZT.mjs.map} +1 -1
  88. package/dist/esm/{chunk-PSZYS4RG.mjs → chunk-HRHICHDX.mjs} +2 -2
  89. package/dist/esm/{chunk-XLDMPCLF.mjs → chunk-JG4T5BDZ.mjs} +2 -2
  90. package/dist/esm/{chunk-35CO4BP4.mjs → chunk-LBA4CTUV.mjs} +2 -2
  91. package/dist/esm/{chunk-RXMLONF7.mjs → chunk-NZXPT44W.mjs} +2 -2
  92. package/dist/esm/{chunk-KXVD52Y6.mjs → chunk-POELQOLD.mjs} +2 -2
  93. package/dist/esm/chunk-PR72YXRK.mjs +2 -0
  94. package/dist/esm/chunk-PR72YXRK.mjs.map +1 -0
  95. package/dist/esm/{chunk-3EUHEZND.mjs → chunk-PXG3WJIU.mjs} +2 -2
  96. package/dist/esm/{chunk-TBY3VMMV.mjs → chunk-TTFYJM6A.mjs} +2 -2
  97. package/dist/esm/{chunk-EODSU3YN.mjs → chunk-VNUNIQAY.mjs} +2 -2
  98. package/dist/esm/{chunk-WB26DWOY.mjs → chunk-YHJHXLYS.mjs} +2 -2
  99. package/dist/esm/{chunk-7YTGBTWH.mjs → chunk-YHKWV7NV.mjs} +2 -2
  100. package/dist/esm/cli/index.mjs +1 -1
  101. package/dist/esm/cli/localNode.mjs +1 -1
  102. package/dist/esm/client/core.mjs +1 -1
  103. package/dist/esm/client/get.d.mts +5 -1
  104. package/dist/esm/client/get.mjs +1 -1
  105. package/dist/esm/client/index.d.mts +1 -1
  106. package/dist/esm/client/index.mjs +1 -1
  107. package/dist/esm/client/post.mjs +1 -1
  108. package/dist/esm/core/account/index.mjs +1 -1
  109. package/dist/esm/core/account/utils/address.mjs +1 -1
  110. package/dist/esm/core/account/utils/index.mjs +1 -1
  111. package/dist/esm/core/accountAddress.d.mts +18 -0
  112. package/dist/esm/core/accountAddress.mjs +1 -1
  113. package/dist/esm/core/authenticationKey.mjs +1 -1
  114. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  115. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  116. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  117. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
  118. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  119. package/dist/esm/core/crypto/index.d.mts +1 -1
  120. package/dist/esm/core/crypto/index.mjs +1 -1
  121. package/dist/esm/core/crypto/keyless.d.mts +1 -1
  122. package/dist/esm/core/crypto/keyless.mjs +1 -1
  123. package/dist/esm/core/crypto/multiEd25519.d.mts +2 -2
  124. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  125. package/dist/esm/core/crypto/multiKey.d.mts +4 -1
  126. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  127. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  128. package/dist/esm/core/crypto/proof.mjs +1 -1
  129. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  130. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  131. package/dist/esm/core/crypto/signature.mjs +1 -1
  132. package/dist/esm/core/crypto/singleKey.d.mts +4 -1
  133. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  134. package/dist/esm/core/index.d.mts +1 -1
  135. package/dist/esm/core/index.mjs +1 -1
  136. package/dist/esm/errors/index.mjs +1 -1
  137. package/dist/esm/{federatedKeyless-Qe_j8OqV.d.mts → federatedKeyless-J5bdbbLQ.d.mts} +20 -20
  138. package/dist/esm/index.d.mts +5 -5
  139. package/dist/esm/index.mjs +1 -1
  140. package/dist/esm/internal/abstraction.mjs +1 -1
  141. package/dist/esm/internal/account.d.mts +49 -6
  142. package/dist/esm/internal/account.mjs +1 -1
  143. package/dist/esm/internal/ans.d.mts +1 -1
  144. package/dist/esm/internal/ans.mjs +1 -1
  145. package/dist/esm/internal/coin.mjs +1 -1
  146. package/dist/esm/internal/digitalAsset.d.mts +1 -1
  147. package/dist/esm/internal/digitalAsset.mjs +1 -1
  148. package/dist/esm/internal/event.mjs +1 -1
  149. package/dist/esm/internal/experimental.mjs +1 -1
  150. package/dist/esm/internal/faucet.mjs +1 -1
  151. package/dist/esm/internal/fungibleAsset.d.mts +1 -1
  152. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  153. package/dist/esm/internal/general.mjs +1 -1
  154. package/dist/esm/internal/keyless.d.mts +2 -2
  155. package/dist/esm/internal/keyless.mjs +1 -1
  156. package/dist/esm/internal/object.mjs +1 -1
  157. package/dist/esm/internal/staking.mjs +1 -1
  158. package/dist/esm/internal/table.mjs +1 -1
  159. package/dist/esm/internal/transaction.mjs +1 -1
  160. package/dist/esm/internal/transactionSubmission.d.mts +1 -1
  161. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  162. package/dist/esm/internal/utils/index.d.mts +1 -1
  163. package/dist/esm/internal/utils/index.mjs +1 -1
  164. package/dist/esm/internal/utils/utils.d.mts +2 -19
  165. package/dist/esm/internal/utils/utils.mjs +1 -1
  166. package/dist/esm/internal/view.mjs +1 -1
  167. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  168. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  169. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  170. package/dist/esm/transactions/index.mjs +1 -1
  171. package/dist/esm/transactions/instances/index.mjs +1 -1
  172. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  173. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  174. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  175. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  176. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  177. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  178. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  179. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +1 -1
  180. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  181. package/dist/esm/transactions/management/index.d.mts +1 -1
  182. package/dist/esm/transactions/management/index.mjs +1 -1
  183. package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
  184. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  185. package/dist/esm/transactions/scriptComposer/index.mjs +1 -1
  186. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  187. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  188. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  189. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  190. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  191. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  192. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  193. package/dist/esm/types/index.d.mts +1 -1
  194. package/dist/esm/types/index.mjs +1 -1
  195. package/dist/esm/types/types.d.mts +10 -1
  196. package/dist/esm/types/types.mjs +1 -1
  197. package/dist/esm/utils/helpers.d.mts +27 -1
  198. package/dist/esm/utils/helpers.mjs +1 -1
  199. package/dist/esm/utils/index.d.mts +3 -1
  200. package/dist/esm/utils/index.mjs +1 -1
  201. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  202. package/dist/esm/version.d.mts +1 -1
  203. package/dist/esm/version.mjs +1 -1
  204. package/package.json +7 -1
  205. package/src/account/Account.ts +20 -0
  206. package/src/account/Ed25519Account.ts +26 -1
  207. package/src/account/MultiEd25519Account.ts +28 -1
  208. package/src/account/MultiKeyAccount.ts +2 -0
  209. package/src/account/SingleKeyAccount.ts +35 -1
  210. package/src/api/account.ts +84 -4
  211. package/src/client/get.ts +45 -18
  212. package/src/core/accountAddress.ts +25 -0
  213. package/src/core/crypto/federatedKeyless.ts +8 -2
  214. package/src/core/crypto/keyless.ts +93 -60
  215. package/src/core/crypto/multiEd25519.ts +2 -2
  216. package/src/core/crypto/multiKey.ts +24 -13
  217. package/src/core/crypto/singleKey.ts +12 -2
  218. package/src/internal/account.ts +84 -7
  219. package/src/internal/utils/utils.ts +2 -32
  220. package/src/types/types.ts +10 -0
  221. package/src/utils/helpers.ts +50 -0
  222. package/src/version.ts +1 -1
  223. package/dist/common/chunk-5GUWOXQG.js +0 -4
  224. package/dist/esm/chunk-3RVAGHAA.mjs +0 -2
  225. package/dist/esm/chunk-LQOSHBB7.mjs +0 -4
  226. package/dist/esm/chunk-LQOSHBB7.mjs.map +0 -1
  227. package/dist/esm/chunk-NFPNWY6Z.mjs +0 -4
  228. package/dist/esm/chunk-NFPNWY6Z.mjs.map +0 -1
  229. package/dist/esm/chunk-R6QCPXQG.mjs.map +0 -1
  230. package/dist/esm/chunk-TNWABITK.mjs +0 -2
  231. package/dist/esm/chunk-TNWABITK.mjs.map +0 -1
  232. package/dist/esm/chunk-X5YB74NB.mjs +0 -2
  233. package/dist/esm/chunk-ZELTLAUN.mjs +0 -2
  234. package/dist/esm/chunk-ZELTLAUN.mjs.map +0 -1
  235. /package/dist/esm/{chunk-AIPHJFJL.mjs.map → chunk-3IGJ2IMB.mjs.map} +0 -0
  236. /package/dist/esm/{chunk-CWL7ZA3P.mjs.map → chunk-5MMTP427.mjs.map} +0 -0
  237. /package/dist/esm/{chunk-AEGA5N2W.mjs.map → chunk-6J64BOS7.mjs.map} +0 -0
  238. /package/dist/esm/{chunk-6KE4JZD6.mjs.map → chunk-7VEWPUCH.mjs.map} +0 -0
  239. /package/dist/esm/{chunk-TTY5GFMN.mjs.map → chunk-BSH7B2QT.mjs.map} +0 -0
  240. /package/dist/esm/{chunk-PSZYS4RG.mjs.map → chunk-HRHICHDX.mjs.map} +0 -0
  241. /package/dist/esm/{chunk-XLDMPCLF.mjs.map → chunk-JG4T5BDZ.mjs.map} +0 -0
  242. /package/dist/esm/{chunk-35CO4BP4.mjs.map → chunk-LBA4CTUV.mjs.map} +0 -0
  243. /package/dist/esm/{chunk-RXMLONF7.mjs.map → chunk-NZXPT44W.mjs.map} +0 -0
  244. /package/dist/esm/{chunk-KXVD52Y6.mjs.map → chunk-POELQOLD.mjs.map} +0 -0
  245. /package/dist/esm/{chunk-3EUHEZND.mjs.map → chunk-PXG3WJIU.mjs.map} +0 -0
  246. /package/dist/esm/{chunk-TBY3VMMV.mjs.map → chunk-TTFYJM6A.mjs.map} +0 -0
  247. /package/dist/esm/{chunk-EODSU3YN.mjs.map → chunk-VNUNIQAY.mjs.map} +0 -0
  248. /package/dist/esm/{chunk-WB26DWOY.mjs.map → chunk-YHJHXLYS.mjs.map} +0 -0
  249. /package/dist/esm/{chunk-7YTGBTWH.mjs.map → chunk-YHKWV7NV.mjs.map} +0 -0
@@ -15,6 +15,7 @@ import {
15
15
  verifyKeylessSignatureWithJwkAndConfig,
16
16
  } from "./keyless";
17
17
  import { AptosConfig } from "../../api";
18
+ import { Signature } from "..";
18
19
 
19
20
  /**
20
21
  * Represents the FederatedKeylessPublicKey public key
@@ -76,11 +77,16 @@ export class FederatedKeylessPublicKey extends AccountPublicKey {
76
77
  */
77
78
  verifySignature(args: {
78
79
  message: HexInput;
79
- signature: KeylessSignature;
80
+ signature: Signature;
80
81
  jwk: MoveJWK;
81
82
  keylessConfig: KeylessConfiguration;
82
83
  }): boolean {
83
- return verifyKeylessSignatureWithJwkAndConfig({ ...args, publicKey: this });
84
+ try {
85
+ verifyKeylessSignatureWithJwkAndConfig({ ...args, publicKey: this });
86
+ return true;
87
+ } catch (error) {
88
+ return false;
89
+ }
84
90
  }
85
91
 
86
92
  serialize(serializer: Serializer): void {
@@ -171,29 +171,19 @@ export class KeylessPublicKey extends AccountPublicKey {
171
171
  */
172
172
  verifySignature(args: {
173
173
  message: HexInput;
174
- signature: KeylessSignature;
174
+ signature: Signature;
175
175
  jwk: MoveJWK;
176
176
  keylessConfig: KeylessConfiguration;
177
177
  }): boolean {
178
- return verifyKeylessSignatureWithJwkAndConfig({ ...args, publicKey: this });
179
- }
180
-
181
- /**
182
- * Serializes the current instance into a format suitable for transmission or storage.
183
- * This function ensures that all relevant fields are properly serialized, including the proof and optional fields.
184
- *
185
- * @param serializer - The serializer instance used to perform the serialization.
186
- * @param serializer.proof - The proof to be serialized.
187
- * @param serializer.expHorizonSecs - The expiration horizon in seconds.
188
- * @param serializer.extraField - An optional additional field for serialization.
189
- * @param serializer.overrideAudVal - An optional override value for auditing.
190
- * @param serializer.trainingWheelsSignature - An optional signature for training wheels.
191
- * @group Implementation
192
- * @category Serialization
193
- */
194
- serialize(serializer: Serializer): void {
195
- serializer.serializeStr(this.iss);
196
- serializer.serializeBytes(this.idCommitment);
178
+ try {
179
+ verifyKeylessSignatureWithJwkAndConfig({ ...args, publicKey: this });
180
+ return true;
181
+ } catch (error) {
182
+ if (error instanceof KeylessError) {
183
+ return false;
184
+ }
185
+ throw error;
186
+ }
197
187
  }
198
188
 
199
189
  /**
@@ -209,7 +199,7 @@ export class KeylessPublicKey extends AccountPublicKey {
209
199
  async verifySignatureAsync(args: {
210
200
  aptosConfig: AptosConfig;
211
201
  message: HexInput;
212
- signature: KeylessSignature;
202
+ signature: Signature;
213
203
  options?: { throwErrorWithReason?: boolean };
214
204
  }): Promise<boolean> {
215
205
  return verifyKeylessSignature({
@@ -218,6 +208,24 @@ export class KeylessPublicKey extends AccountPublicKey {
218
208
  });
219
209
  }
220
210
 
211
+ /**
212
+ * Serializes the current instance into a format suitable for transmission or storage.
213
+ * This function ensures that all relevant fields are properly serialized, including the proof and optional fields.
214
+ *
215
+ * @param serializer - The serializer instance used to perform the serialization.
216
+ * @param serializer.proof - The proof to be serialized.
217
+ * @param serializer.expHorizonSecs - The expiration horizon in seconds.
218
+ * @param serializer.extraField - An optional additional field for serialization.
219
+ * @param serializer.overrideAudVal - An optional override value for auditing.
220
+ * @param serializer.trainingWheelsSignature - An optional signature for training wheels.
221
+ * @group Implementation
222
+ * @category Serialization
223
+ */
224
+ serialize(serializer: Serializer): void {
225
+ serializer.serializeStr(this.iss);
226
+ serializer.serializeBytes(this.idCommitment);
227
+ }
228
+
221
229
  /**
222
230
  * Deserializes a ZeroKnowledgeSig object from the provided deserializer.
223
231
  * This function allows you to reconstruct a ZeroKnowledgeSig instance from its serialized form.
@@ -332,7 +340,7 @@ export async function verifyKeylessSignature(args: {
332
340
  publicKey: KeylessPublicKey | FederatedKeylessPublicKey;
333
341
  aptosConfig: AptosConfig;
334
342
  message: HexInput;
335
- signature: KeylessSignature;
343
+ signature: Signature;
336
344
  keylessConfig?: KeylessConfiguration;
337
345
  jwk?: MoveJWK;
338
346
  options?: { throwErrorWithReason?: boolean };
@@ -342,12 +350,24 @@ export async function verifyKeylessSignature(args: {
342
350
  publicKey,
343
351
  message,
344
352
  signature,
345
- jwk = await fetchJWK({ aptosConfig: args.aptosConfig, publicKey: args.publicKey, kid: signature.getJwkKid() }),
353
+ jwk,
346
354
  keylessConfig = await getKeylessConfig({ aptosConfig }),
347
355
  options,
348
356
  } = args;
349
357
  try {
350
- publicKey.verifySignature({ message, signature, jwk, keylessConfig });
358
+ if (!(signature instanceof KeylessSignature)) {
359
+ throw KeylessError.fromErrorType({
360
+ type: KeylessErrorType.SIGNATURE_TYPE_INVALID,
361
+ details: "Not a keyless signature",
362
+ });
363
+ }
364
+ verifyKeylessSignatureWithJwkAndConfig({
365
+ message,
366
+ publicKey,
367
+ signature,
368
+ jwk: jwk ? jwk : await fetchJWK({ aptosConfig, publicKey, kid: signature.getJwkKid() }),
369
+ keylessConfig,
370
+ });
351
371
  return true;
352
372
  } catch (error) {
353
373
  if (options?.throwErrorWithReason) {
@@ -371,12 +391,18 @@ export async function verifyKeylessSignature(args: {
371
391
  export function verifyKeylessSignatureWithJwkAndConfig(args: {
372
392
  publicKey: KeylessPublicKey | FederatedKeylessPublicKey;
373
393
  message: HexInput;
374
- signature: KeylessSignature;
394
+ signature: Signature;
375
395
  keylessConfig: KeylessConfiguration;
376
396
  jwk: MoveJWK;
377
- }): boolean {
397
+ }): void {
378
398
  const { publicKey, message, signature, keylessConfig, jwk } = args;
379
399
  const { verificationKey, maxExpHorizonSecs, trainingWheelsPubkey } = keylessConfig;
400
+ if (!(signature instanceof KeylessSignature)) {
401
+ throw KeylessError.fromErrorType({
402
+ type: KeylessErrorType.SIGNATURE_TYPE_INVALID,
403
+ details: "Not a keyless signature",
404
+ });
405
+ }
380
406
  if (!(signature.ephemeralCertificate.signature instanceof ZeroKnowledgeSig)) {
381
407
  throw KeylessError.fromErrorType({
382
408
  type: KeylessErrorType.SIGNATURE_TYPE_INVALID,
@@ -431,7 +457,6 @@ export function verifyKeylessSignatureWithJwkAndConfig(args: {
431
457
  });
432
458
  }
433
459
  }
434
- return true;
435
460
  }
436
461
 
437
462
  /**
@@ -1326,39 +1351,47 @@ export class Groth16VerificationKey {
1326
1351
  verifyProof(args: { publicInputsHash: bigint; groth16Proof: Groth16Zkp }): boolean {
1327
1352
  const { publicInputsHash, groth16Proof } = args;
1328
1353
 
1329
- // Get proof points
1330
- const proofA = groth16Proof.a.toProjectivePoint();
1331
- const proofB = groth16Proof.b.toProjectivePoint();
1332
- const proofC = groth16Proof.c.toProjectivePoint();
1333
-
1334
- // Get verification key points
1335
- const vkAlpha1 = this.alphaG1.toProjectivePoint();
1336
- const vkBeta2 = this.betaG2.toProjectivePoint();
1337
- const vkGamma2 = this.gammaG2.toProjectivePoint();
1338
- const vkDelta2 = this.deltaG2.toProjectivePoint();
1339
- const vkIC = this.gammaAbcG1.map((g1) => g1.toProjectivePoint());
1340
-
1341
- const { Fp12 } = bn254.fields;
1342
-
1343
- // Check that the following pairing equation holds:
1344
- // e(A_1, B_2) = e(\alpha_1, \beta_2) + e(\ic_0 + public_inputs_hash \ic_1, \gamma_2) + e(C_1, \delta_2)
1345
- // Where A_1, B_2, C_1 are the proof points and \alpha_1, \beta_2, \gamma_2, \delta_2, \ic_0, \ic_1
1346
- // are the verification key points
1347
-
1348
- // \ic_0 + public_inputs_hash \ic_1
1349
- let accum = vkIC[0].add(vkIC[1].multiply(publicInputsHash));
1350
- // e(\ic_0 + public_inputs_hash \ic_1, \gamma_2)
1351
- const pairingAccumGamma = bn254.pairing(accum, vkGamma2);
1352
- // e(A_1, B_2)
1353
- const pairingAB = bn254.pairing(proofA, proofB);
1354
- // e(\alpha_1, \beta_2)
1355
- const pairingAlphaBeta = bn254.pairing(vkAlpha1, vkBeta2);
1356
- // e(C_1, \delta_2)
1357
- const pairingCDelta = bn254.pairing(proofC, vkDelta2);
1358
- // Get the result of the right hand side of the pairing equation
1359
- const product = Fp12.mul(pairingAlphaBeta, Fp12.mul(pairingAccumGamma, pairingCDelta));
1360
- // Check if the left hand side equals the right hand side
1361
- return Fp12.eql(pairingAB, product);
1354
+ try {
1355
+ // Get proof points
1356
+ const proofA = groth16Proof.a.toProjectivePoint();
1357
+ const proofB = groth16Proof.b.toProjectivePoint();
1358
+ const proofC = groth16Proof.c.toProjectivePoint();
1359
+
1360
+ // Get verification key points
1361
+ const vkAlpha1 = this.alphaG1.toProjectivePoint();
1362
+ const vkBeta2 = this.betaG2.toProjectivePoint();
1363
+ const vkGamma2 = this.gammaG2.toProjectivePoint();
1364
+ const vkDelta2 = this.deltaG2.toProjectivePoint();
1365
+ const vkIC = this.gammaAbcG1.map((g1) => g1.toProjectivePoint());
1366
+
1367
+ const { Fp12 } = bn254.fields;
1368
+
1369
+ // Check that the following pairing equation holds:
1370
+ // e(A_1, B_2) = e(\alpha_1, \beta_2) + e(\ic_0 + public_inputs_hash \ic_1, \gamma_2) + e(C_1, \delta_2)
1371
+ // Where A_1, B_2, C_1 are the proof points and \alpha_1, \beta_2, \gamma_2, \delta_2, \ic_0, \ic_1
1372
+ // are the verification key points
1373
+
1374
+ // \ic_0 + public_inputs_hash \ic_1
1375
+ let accum = vkIC[0].add(vkIC[1].multiply(publicInputsHash));
1376
+ // e(\ic_0 + public_inputs_hash \ic_1, \gamma_2)
1377
+ const pairingAccumGamma = bn254.pairing(accum, vkGamma2);
1378
+ // e(A_1, B_2)
1379
+ const pairingAB = bn254.pairing(proofA, proofB);
1380
+ // e(\alpha_1, \beta_2)
1381
+ const pairingAlphaBeta = bn254.pairing(vkAlpha1, vkBeta2);
1382
+ // e(C_1, \delta_2)
1383
+ const pairingCDelta = bn254.pairing(proofC, vkDelta2);
1384
+ // Get the result of the right hand side of the pairing equation
1385
+ const product = Fp12.mul(pairingAlphaBeta, Fp12.mul(pairingAccumGamma, pairingCDelta));
1386
+ // Check if the left hand side equals the right hand side
1387
+ return Fp12.eql(pairingAB, product);
1388
+ } catch (error) {
1389
+ throw KeylessError.fromErrorType({
1390
+ type: KeylessErrorType.PROOF_VERIFICATION_FAILED,
1391
+ error,
1392
+ details: "Error encountered when checking zero knowledge relation",
1393
+ });
1394
+ }
1362
1395
  }
1363
1396
 
1364
1397
  /**
@@ -106,7 +106,7 @@ export class MultiEd25519PublicKey extends AbstractMultiKey {
106
106
  * @group Implementation
107
107
  * @category Serialization
108
108
  */
109
- verifySignature(args: { message: HexInput; signature: MultiEd25519Signature }): boolean {
109
+ verifySignature(args: { message: HexInput; signature: Signature }): boolean {
110
110
  const { message, signature } = args;
111
111
  if (!(signature instanceof MultiEd25519Signature)) {
112
112
  return false;
@@ -144,7 +144,7 @@ export class MultiEd25519PublicKey extends AbstractMultiKey {
144
144
  async verifySignatureAsync(args: {
145
145
  aptosConfig: AptosConfig;
146
146
  message: HexInput;
147
- signature: MultiEd25519Signature;
147
+ signature: Signature;
148
148
  }): Promise<boolean> {
149
149
  return this.verifySignature(args);
150
150
  }
@@ -2,7 +2,7 @@ import { SigningScheme as AuthenticationKeyScheme, HexInput } from "../../types"
2
2
  import { Deserializer } from "../../bcs/deserializer";
3
3
  import { Serializer } from "../../bcs/serializer";
4
4
  import { AuthenticationKey } from "../authenticationKey";
5
- import { AccountPublicKey, PublicKey, VerifySignatureArgs } from "./publicKey";
5
+ import { AccountPublicKey, PublicKey, VerifySignatureAsyncArgs } from "./publicKey";
6
6
  import { Signature } from "./signature";
7
7
  import { AnyPublicKey, AnySignature } from "./singleKey";
8
8
  import { AptosConfig } from "../../api";
@@ -208,21 +208,32 @@ export class MultiKey extends AbstractMultiKey {
208
208
  async verifySignatureAsync(args: {
209
209
  aptosConfig: AptosConfig;
210
210
  message: HexInput;
211
- signature: MultiKeySignature;
211
+ signature: Signature;
212
+ options?: { throwErrorWithReason?: boolean };
212
213
  }): Promise<boolean> {
213
- const { message, signature, aptosConfig } = args;
214
- if (signature.signatures.length !== this.signaturesRequired) {
215
- throw new Error("The number of signatures does not match the number of required signatures");
216
- }
217
- const signerIndices = signature.bitMapToSignerIndices();
218
- for (let i = 0; i < signature.signatures.length; i += 1) {
219
- const singleSignature = signature.signatures[i];
220
- const publicKey = this.publicKeys[signerIndices[i]];
221
- if (!(await publicKey.verifySignatureAsync({ aptosConfig, message, signature: singleSignature }))) {
222
- return false;
214
+ const { signature } = args;
215
+ try {
216
+ if (!(signature instanceof MultiKeySignature)) {
217
+ throw new Error("Signature is not a MultiKeySignature");
218
+ }
219
+ if (signature.signatures.length !== this.signaturesRequired) {
220
+ throw new Error("The number of signatures does not match the number of required signatures");
221
+ }
222
+ const signerIndices = signature.bitMapToSignerIndices();
223
+ for (let i = 0; i < signature.signatures.length; i += 1) {
224
+ const singleSignature = signature.signatures[i];
225
+ const publicKey = this.publicKeys[signerIndices[i]];
226
+ if (!(await publicKey.verifySignatureAsync({ ...args, signature: singleSignature }))) {
227
+ return false;
228
+ }
229
+ }
230
+ return true;
231
+ } catch (error) {
232
+ if (args.options?.throwErrorWithReason) {
233
+ throw error;
223
234
  }
235
+ return false;
224
236
  }
225
- return true;
226
237
  }
227
238
 
228
239
  /**
@@ -7,7 +7,7 @@ import {
7
7
  } from "../../types";
8
8
  import { AuthenticationKey } from "../authenticationKey";
9
9
  import { Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature } from "./ed25519";
10
- import { AccountPublicKey, PublicKey, VerifySignatureArgs, VerifySignatureAsyncArgs } from "./publicKey";
10
+ import { AccountPublicKey, PublicKey } from "./publicKey";
11
11
  import { Secp256k1PrivateKey, Secp256k1PublicKey, Secp256k1Signature } from "./secp256k1";
12
12
  import { KeylessPublicKey, KeylessSignature } from "./keyless";
13
13
  import { Signature } from "./signature";
@@ -85,6 +85,9 @@ export class AnyPublicKey extends AccountPublicKey {
85
85
  */
86
86
  verifySignature(args: { message: HexInput; signature: AnySignature }): boolean {
87
87
  const { message, signature } = args;
88
+ if (this.publicKey instanceof KeylessPublicKey) {
89
+ throw new Error("Use verifySignatureAsync to verify Keyless signatures");
90
+ }
88
91
  return this.publicKey.verifySignature({
89
92
  message,
90
93
  signature: signature.signature,
@@ -106,8 +109,15 @@ export class AnyPublicKey extends AccountPublicKey {
106
109
  async verifySignatureAsync(args: {
107
110
  aptosConfig: AptosConfig;
108
111
  message: HexInput;
109
- signature: AnySignature;
112
+ signature: Signature;
113
+ options?: { throwErrorWithReason?: boolean };
110
114
  }): Promise<boolean> {
115
+ if (!(args.signature instanceof AnySignature)) {
116
+ if (args.options?.throwErrorWithReason) {
117
+ throw new Error("Signature must be an instance of AnySignature");
118
+ }
119
+ return false;
120
+ }
111
121
  return await this.publicKey.verifySignatureAsync({
112
122
  ...args,
113
123
  signature: args.signature.signature,
@@ -9,9 +9,15 @@
9
9
  * @group Implementation
10
10
  */
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
- import { getAptosFullNode, paginateWithCursor, paginateWithObfuscatedCursor } from "../client";
12
+ import {
13
+ getAptosFullNode,
14
+ getPageWithObfuscatedCursor,
15
+ paginateWithCursor,
16
+ paginateWithObfuscatedCursor,
17
+ } from "../client";
13
18
  import {
14
19
  AccountData,
20
+ CursorPaginationArgs,
15
21
  GetAccountCoinsDataResponse,
16
22
  GetAccountCollectionsWithOwnedTokenResponse,
17
23
  GetAccountOwnedTokensFromCollectionResponse,
@@ -32,7 +38,7 @@ import { AccountAddress, AccountAddressInput } from "../core/accountAddress";
32
38
  import { Account, Ed25519Account, MultiEd25519Account } from "../account";
33
39
  import { AnyPublicKey, Ed25519PublicKey, PrivateKey } from "../core/crypto";
34
40
  import { queryIndexer } from "./general";
35
- import { getModules as getModulesUtil, getModule as getModuleUtil, getInfo as getInfoUtil } from "./utils";
41
+ import { getModule as getModuleUtil, getInfo as getInfoUtil } from "./utils";
36
42
  import {
37
43
  GetAccountCoinsCountQuery,
38
44
  GetAccountCoinsDataQuery,
@@ -93,9 +99,50 @@ export async function getInfo(args: {
93
99
  export async function getModules(args: {
94
100
  aptosConfig: AptosConfig;
95
101
  accountAddress: AccountAddressInput;
96
- options?: PaginationArgs & LedgerVersionArg;
102
+ options?: { limit?: number } & LedgerVersionArg;
97
103
  }): Promise<MoveModuleBytecode[]> {
98
- return getModulesUtil(args);
104
+ const { aptosConfig, accountAddress, options } = args;
105
+ return paginateWithObfuscatedCursor<{}, MoveModuleBytecode[]>({
106
+ aptosConfig,
107
+ originMethod: "getModules",
108
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
109
+ params: {
110
+ ledger_version: options?.ledgerVersion,
111
+ limit: options?.limit ?? 1000,
112
+ },
113
+ });
114
+ }
115
+
116
+ /**
117
+ * Retrieves the modules associated with a specified account address.
118
+ *
119
+ * @param args - The arguments for retrieving modules.
120
+ * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.
121
+ * @param args.accountAddress - The address of the account whose modules are to be retrieved.
122
+ * @param args.options - Optional parameters for pagination and ledger version.
123
+ * @param args.options.cursor - The starting point for pagination. Note, this is obfuscated and is not an index.
124
+ * @param args.options.limit - The maximum number of modules to retrieve (default is 100).
125
+ * @param args.options.ledgerVersion - The specific ledger version to query.
126
+ * @group Implementation
127
+ */
128
+ export async function getModulesPage(args: {
129
+ aptosConfig: AptosConfig;
130
+ accountAddress: AccountAddressInput;
131
+ options?: CursorPaginationArgs & LedgerVersionArg;
132
+ }): Promise<{ modules: MoveModuleBytecode[]; cursor: string | undefined }> {
133
+ const { aptosConfig, accountAddress, options } = args;
134
+ const { response, cursor } = await getPageWithObfuscatedCursor<{}, MoveModuleBytecode[]>({
135
+ aptosConfig,
136
+ originMethod: "getModulesPage",
137
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
138
+ params: {
139
+ ledger_version: options?.ledgerVersion,
140
+ cursor: options?.cursor,
141
+ limit: options?.limit ?? 100,
142
+ },
143
+ });
144
+
145
+ return { modules: response.data, cursor };
99
146
  }
100
147
 
101
148
  /**
@@ -153,7 +200,6 @@ export async function getTransactions(args: {
153
200
  * @param args.aptosConfig - The configuration settings for Aptos.
154
201
  * @param args.accountAddress - The address of the account to fetch resources for.
155
202
  * @param args.options - Optional pagination and ledger version parameters.
156
- * @param args.options.offset - The starting point for pagination. Note, this is obfuscated and is not an index.
157
203
  * @param args.options.limit - The maximum number of resources to retrieve (default is 999).
158
204
  * @param args.options.ledgerVersion - The specific ledger version to query.
159
205
  * @group Implementation
@@ -161,7 +207,7 @@ export async function getTransactions(args: {
161
207
  export async function getResources(args: {
162
208
  aptosConfig: AptosConfig;
163
209
  accountAddress: AccountAddressInput;
164
- options?: PaginationArgs & LedgerVersionArg;
210
+ options?: { limit?: number } & LedgerVersionArg;
165
211
  }): Promise<MoveResource[]> {
166
212
  const { aptosConfig, accountAddress, options } = args;
167
213
  return paginateWithObfuscatedCursor<{}, MoveResource[]>({
@@ -170,12 +216,43 @@ export async function getResources(args: {
170
216
  path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,
171
217
  params: {
172
218
  ledger_version: options?.ledgerVersion,
173
- offset: options?.offset,
174
219
  limit: options?.limit ?? 999,
175
220
  },
176
221
  });
177
222
  }
178
223
 
224
+ /**
225
+ * Retrieves a page of resources associated with a specific account address.
226
+ *
227
+ * @param args - The arguments for retrieving resources.
228
+ * @param args.aptosConfig - The configuration settings for Aptos.
229
+ * @param args.accountAddress - The address of the account to fetch resources for.
230
+ * @param args.options - Optional pagination and ledger version parameters.
231
+ * @param args.options.cursor - The starting point for pagination. Note, this is obfuscated and is not an index.
232
+ * @param args.options.limit - The maximum number of resources to retrieve (default is 100).
233
+ * @param args.options.ledgerVersion - The specific ledger version to query.
234
+ * @group Implementation
235
+ */
236
+ export async function getResourcesPage(args: {
237
+ aptosConfig: AptosConfig;
238
+ accountAddress: AccountAddressInput;
239
+ options?: CursorPaginationArgs & LedgerVersionArg;
240
+ }): Promise<{ resources: MoveResource[]; cursor: string | undefined }> {
241
+ const { aptosConfig, accountAddress, options } = args;
242
+ const { response, cursor } = await getPageWithObfuscatedCursor<{}, MoveResource[]>({
243
+ aptosConfig,
244
+ originMethod: "getResourcesPage",
245
+ path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,
246
+ params: {
247
+ ledger_version: options?.ledgerVersion,
248
+ cursor: options?.cursor,
249
+ limit: options?.limit ?? 100,
250
+ },
251
+ });
252
+
253
+ return { resources: response.data, cursor };
254
+ }
255
+
179
256
  /**
180
257
  * Retrieves a specific resource of a given type for the specified account address.
181
258
  *
@@ -1,39 +1,9 @@
1
1
  import { AccountAddress, AccountAddressInput } from "../../core/accountAddress";
2
- import { MoveModuleBytecode, LedgerVersionArg, PaginationArgs, AccountData } from "../../types/types";
2
+ import { MoveModuleBytecode, LedgerVersionArg, AccountData } from "../../types/types";
3
3
  import { AptosConfig } from "../../api/aptosConfig";
4
- import { getAptosFullNode, paginateWithObfuscatedCursor } from "../../client";
4
+ import { getAptosFullNode } from "../../client";
5
5
  import { memoizeAsync } from "../../utils/memoize";
6
6
 
7
- /**
8
- * Retrieves the modules associated with a specified account address.
9
- *
10
- * @param args - The arguments for retrieving modules.
11
- * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.
12
- * @param args.accountAddress - The address of the account whose modules are to be retrieved.
13
- * @param args.options - Optional parameters for pagination and ledger version.
14
- * @param args.options.limit - The maximum number of modules to retrieve (default is 1000).
15
- * @param args.options.offset - The starting point for pagination. Note, this is obfuscated and is not an index.
16
- * @param args.options.ledgerVersion - The specific ledger version to query.
17
- * @group Implementation
18
- */
19
- export async function getModules(args: {
20
- aptosConfig: AptosConfig;
21
- accountAddress: AccountAddressInput;
22
- options?: PaginationArgs & LedgerVersionArg;
23
- }): Promise<MoveModuleBytecode[]> {
24
- const { aptosConfig, accountAddress, options } = args;
25
- return paginateWithObfuscatedCursor<{}, MoveModuleBytecode[]>({
26
- aptosConfig,
27
- originMethod: "getModules",
28
- path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,
29
- params: {
30
- ledger_version: options?.ledgerVersion,
31
- offset: options?.offset,
32
- limit: options?.limit ?? 1000,
33
- },
34
- });
35
- }
36
-
37
7
  /**
38
8
  * Retrieves account information for a specified account address.
39
9
  *
@@ -237,6 +237,16 @@ export interface PaginationArgs {
237
237
  limit?: number;
238
238
  }
239
239
 
240
+ /**
241
+ * Defines the parameters for paginating query results, including the starting position and maximum number of items to return.
242
+ * @param cursor Specifies the starting position of the query result. Default is at the beginning if undefined. This is not a number and must come from the API.
243
+ * @param limit Specifies the maximum number of items to return. Default is 25.
244
+ */
245
+ export interface CursorPaginationArgs {
246
+ cursor?: string;
247
+ limit?: number;
248
+ }
249
+
240
250
  /**
241
251
  * Represents the arguments for specifying a token standard.
242
252
  *
@@ -4,6 +4,7 @@
4
4
  import { decode } from "js-base64";
5
5
  import { MoveFunctionId, MoveStructId } from "../types";
6
6
  import { AccountAddress } from "../core/accountAddress";
7
+ import { createObjectAddress } from "../core/account/utils/address";
7
8
 
8
9
  /**
9
10
  * Sleep for the specified amount of time in milliseconds.
@@ -235,3 +236,52 @@ export function isValidFunctionInfo(functionInfo: string): boolean {
235
236
  export function truncateAddress(address: string, start: number = 6, end: number = 5) {
236
237
  return `${address.slice(0, start)}...${address.slice(-end)}`;
237
238
  }
239
+
240
+ /**
241
+ * Constants for metadata address calculation
242
+ */
243
+ const APTOS_COIN_TYPE_STR = "0x1::aptos_coin::AptosCoin";
244
+ const APT_METADATA_ADDRESS_HEX = AccountAddress.A.toStringLong();
245
+
246
+ /**
247
+ * Helper function to standardize Move type string by converting all addresses to short form,
248
+ * including addresses within nested type parameters
249
+ */
250
+ function standardizeMoveTypeString(input: string): string {
251
+ // Regular expression to match addresses in the type string, including those within type parameters
252
+ // This regex matches "0x" followed by hex digits, handling both standalone addresses and those within <>
253
+ const addressRegex = /0x[0-9a-fA-F]+/g;
254
+
255
+ return input.replace(addressRegex, (match) => {
256
+ // Use AccountAddress to handle the address
257
+ return AccountAddress.from(match, { maxMissingChars: 63 }).toStringShort();
258
+ });
259
+ }
260
+
261
+ /**
262
+ * Calculates the paired FA metadata address for a given coin type.
263
+ * This function is tolerant of various address formats in the coin type string,
264
+ * including complex nested types.
265
+ *
266
+ * @example
267
+ * // All these formats are valid and will produce the same result:
268
+ * pairedFaMetadataAddress("0x1::aptos_coin::AptosCoin") // simple form
269
+ * pairedFaMetadataAddress("0x0000000000000000000000000000000000000000000000000000000000000001::aptos_coin::AptosCoin") // long form
270
+ * pairedFaMetadataAddress("0x00001::aptos_coin::AptosCoin") // with leading zeros
271
+ * pairedFaMetadataAddress("0x1::coin::Coin<0x1412::a::struct<0x0001::aptos_coin::AptosCoin>>") // nested type parameters
272
+ *
273
+ * @param coinType - The coin type string in any of these formats:
274
+ * - Short form address: "0x1::aptos_coin::AptosCoin"
275
+ * - Long form address: "0x0000000000000000000000000000000000000000000000000000000000000001::aptos_coin::AptosCoin"
276
+ * - With leading zeros: "0x00001::aptos_coin::AptosCoin"
277
+ * - With nested types: "0x1::coin::Coin<0x1412::a::struct<0x0001::aptos_coin::AptosCoin>>"
278
+ * @returns The calculated metadata address as an AccountAddress instance
279
+ */
280
+ export function pairedFaMetadataAddress(coinType: `0x${string}::${string}::${string}`): AccountAddress {
281
+ // Standardize the coin type string to handle any address format
282
+ const standardizedMoveTypeName = standardizeMoveTypeString(coinType);
283
+
284
+ return standardizedMoveTypeName === APTOS_COIN_TYPE_STR
285
+ ? AccountAddress.A
286
+ : createObjectAddress(AccountAddress.A, standardizedMoveTypeName);
287
+ }
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * hardcoded for now, we would want to have it injected dynamically
8
8
  */
9
- export const VERSION = "1.36.0";
9
+ export const VERSION = "1.37.0";