@aptos-labs/ts-sdk 1.0.0 → 1.1.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 (232) hide show
  1. package/README.md +3 -3
  2. package/dist/browser/index.d.ts +513 -214
  3. package/dist/browser/index.global.js +25 -25
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +513 -214
  6. package/dist/common/index.js +26 -26
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/api/account.mjs +1 -1
  9. package/dist/esm/api/ans.d.mts +9 -9
  10. package/dist/esm/api/ans.mjs +1 -1
  11. package/dist/esm/api/aptos.d.mts +4 -11
  12. package/dist/esm/api/aptos.mjs +1 -1
  13. package/dist/esm/api/coin.d.mts +3 -3
  14. package/dist/esm/api/coin.mjs +1 -1
  15. package/dist/esm/api/digitalAsset.d.mts +300 -76
  16. package/dist/esm/api/digitalAsset.mjs +1 -1
  17. package/dist/esm/api/event.mjs +1 -1
  18. package/dist/esm/api/faucet.mjs +1 -1
  19. package/dist/esm/api/fungibleAsset.d.mts +3 -3
  20. package/dist/esm/api/fungibleAsset.mjs +1 -1
  21. package/dist/esm/api/general.mjs +1 -1
  22. package/dist/esm/api/index.d.mts +0 -2
  23. package/dist/esm/api/index.mjs +1 -1
  24. package/dist/esm/api/staking.mjs +1 -1
  25. package/dist/esm/api/transaction.d.mts +118 -13
  26. package/dist/esm/api/transaction.mjs +1 -1
  27. package/dist/esm/api/transactionSubmission/build.d.mts +25 -4
  28. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/helpers.d.mts +4 -0
  30. package/dist/esm/api/transactionSubmission/helpers.mjs +2 -0
  31. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  32. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  33. package/dist/esm/api/transactionSubmission/simulate.d.mts +23 -2
  34. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  35. package/dist/esm/api/transactionSubmission/submit.d.mts +21 -2
  36. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  37. package/dist/esm/api/utils.mjs +1 -1
  38. package/dist/esm/bcs/index.mjs +1 -1
  39. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  40. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  41. package/dist/esm/{chunk-ZKFDLJ2F.mjs → chunk-2HBIGMDV.mjs} +2 -2
  42. package/dist/esm/{chunk-MNFGMNYS.mjs → chunk-3O4GKLXA.mjs} +2 -2
  43. package/dist/esm/chunk-3O4GKLXA.mjs.map +1 -0
  44. package/dist/esm/{chunk-GMOHGD73.mjs → chunk-4TIQQKXV.mjs} +2 -2
  45. package/dist/esm/{chunk-DBJTMCAG.mjs → chunk-4VG7DV6F.mjs} +2 -2
  46. package/dist/esm/{chunk-XKINEFAA.mjs → chunk-4ZYW3BPF.mjs} +2 -2
  47. package/dist/esm/chunk-4ZYW3BPF.mjs.map +1 -0
  48. package/dist/esm/chunk-6EMN3BOV.mjs +2 -0
  49. package/dist/esm/chunk-6EMN3BOV.mjs.map +1 -0
  50. package/dist/esm/chunk-6MKBROIC.mjs +2 -0
  51. package/dist/esm/chunk-6MKBROIC.mjs.map +1 -0
  52. package/dist/esm/{chunk-DYJVDOBH.mjs → chunk-AS7RX4RK.mjs} +2 -2
  53. package/dist/esm/chunk-AS7RX4RK.mjs.map +1 -0
  54. package/dist/esm/{chunk-X7QBDRQR.mjs → chunk-BUM2FIHF.mjs} +2 -2
  55. package/dist/esm/chunk-BV6SCEXY.mjs +2 -0
  56. package/dist/esm/chunk-BV6SCEXY.mjs.map +1 -0
  57. package/dist/esm/{chunk-CBAVJ5EN.mjs → chunk-D2XLC3KK.mjs} +2 -2
  58. package/dist/esm/chunk-EMQWD6KP.mjs +2 -0
  59. package/dist/esm/chunk-EMQWD6KP.mjs.map +1 -0
  60. package/dist/esm/chunk-HDNJ4JK4.mjs +2 -0
  61. package/dist/esm/chunk-HDNJ4JK4.mjs.map +1 -0
  62. package/dist/esm/{chunk-BA4TDBYB.mjs → chunk-IEL6J6Z3.mjs} +2 -2
  63. package/dist/esm/{chunk-Q3R3KKKP.mjs → chunk-IPW2YTRD.mjs} +2 -2
  64. package/dist/esm/{chunk-BDTDWLGO.mjs → chunk-KH3M3YPI.mjs} +2 -2
  65. package/dist/esm/chunk-KSWQZKMQ.mjs +2 -0
  66. package/dist/esm/chunk-KSWQZKMQ.mjs.map +1 -0
  67. package/dist/esm/{chunk-ELWWME6B.mjs → chunk-LUCDRB52.mjs} +2 -2
  68. package/dist/esm/chunk-LUCDRB52.mjs.map +1 -0
  69. package/dist/esm/chunk-NZ6RYGJQ.mjs +2 -0
  70. package/dist/esm/chunk-NZ6RYGJQ.mjs.map +1 -0
  71. package/dist/esm/chunk-OU4MEM5F.mjs +2 -0
  72. package/dist/esm/chunk-OU4MEM5F.mjs.map +1 -0
  73. package/dist/esm/{chunk-PLY7MQKE.mjs → chunk-PJMRQLJ5.mjs} +2 -2
  74. package/dist/esm/chunk-PJMRQLJ5.mjs.map +1 -0
  75. package/dist/esm/{chunk-Y5RQOXZH.mjs → chunk-R3SAAJ2N.mjs} +2 -2
  76. package/dist/esm/{chunk-32A35CPU.mjs → chunk-R4APGSSC.mjs} +2 -2
  77. package/dist/esm/chunk-SI6QMT4N.mjs +2 -0
  78. package/dist/esm/chunk-SI6QMT4N.mjs.map +1 -0
  79. package/dist/esm/{chunk-PZ5JKQSP.mjs → chunk-SMN2QQ4Q.mjs} +1 -1
  80. package/dist/esm/chunk-SMN2QQ4Q.mjs.map +1 -0
  81. package/dist/esm/chunk-SODP7NAK.mjs +2 -0
  82. package/dist/esm/{chunk-W4JEP5GW.mjs.map → chunk-SODP7NAK.mjs.map} +1 -1
  83. package/dist/esm/{chunk-5IVRKK5V.mjs → chunk-SR7XLV76.mjs} +2 -2
  84. package/dist/esm/{chunk-LBNMY7EM.mjs → chunk-T3ID6KFN.mjs} +2 -2
  85. package/dist/esm/{chunk-2AMFCGJ3.mjs → chunk-TCSN7PYL.mjs} +2 -2
  86. package/dist/esm/chunk-TCSN7PYL.mjs.map +1 -0
  87. package/dist/esm/chunk-TTDCRLRD.mjs +2 -0
  88. package/dist/esm/chunk-TTDCRLRD.mjs.map +1 -0
  89. package/dist/esm/{chunk-NFGAZSSK.mjs → chunk-UZB7CTLX.mjs} +2 -2
  90. package/dist/esm/chunk-VA4K6DEK.mjs +2 -0
  91. package/dist/esm/chunk-VA4K6DEK.mjs.map +1 -0
  92. package/dist/esm/{chunk-7IY2Y73Q.mjs → chunk-VBUKPN4Q.mjs} +2 -2
  93. package/dist/esm/chunk-VBUKPN4Q.mjs.map +1 -0
  94. package/dist/esm/{chunk-5SRMD5C6.mjs → chunk-YLI6J47P.mjs} +2 -2
  95. package/dist/esm/{chunk-4FDIPWVB.mjs → chunk-YLPG6XMH.mjs} +2 -2
  96. package/dist/esm/{chunk-KR5JAN32.mjs → chunk-ZLYSA7JR.mjs} +2 -2
  97. package/dist/esm/client/core.mjs +1 -1
  98. package/dist/esm/client/get.mjs +1 -1
  99. package/dist/esm/client/index.mjs +1 -1
  100. package/dist/esm/client/post.mjs +1 -1
  101. package/dist/esm/core/account.d.mts +2 -2
  102. package/dist/esm/core/account.mjs +1 -1
  103. package/dist/esm/core/accountAddress.mjs +1 -1
  104. package/dist/esm/core/authenticationKey.mjs +1 -1
  105. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  106. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  107. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  108. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  109. package/dist/esm/core/crypto/index.mjs +1 -1
  110. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  111. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  112. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  113. package/dist/esm/core/index.mjs +1 -1
  114. package/dist/esm/index.d.mts +1 -3
  115. package/dist/esm/index.mjs +1 -1
  116. package/dist/esm/internal/account.d.mts +1 -1
  117. package/dist/esm/internal/account.mjs +1 -1
  118. package/dist/esm/internal/ans.d.mts +5 -5
  119. package/dist/esm/internal/ans.mjs +1 -1
  120. package/dist/esm/internal/coin.d.mts +2 -2
  121. package/dist/esm/internal/coin.mjs +1 -1
  122. package/dist/esm/internal/digitalAsset.d.mts +144 -27
  123. package/dist/esm/internal/digitalAsset.mjs +1 -1
  124. package/dist/esm/internal/event.mjs +1 -1
  125. package/dist/esm/internal/faucet.mjs +1 -1
  126. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  127. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  128. package/dist/esm/internal/general.mjs +1 -1
  129. package/dist/esm/internal/staking.mjs +1 -1
  130. package/dist/esm/internal/transaction.mjs +1 -1
  131. package/dist/esm/internal/transactionSubmission.d.mts +6 -6
  132. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  133. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  134. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  135. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  136. package/dist/esm/transactions/index.d.mts +1 -1
  137. package/dist/esm/transactions/index.mjs +1 -1
  138. package/dist/esm/transactions/instances/index.mjs +1 -1
  139. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  140. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  141. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  142. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  143. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  144. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  145. package/dist/esm/transactions/management/index.mjs +1 -1
  146. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  147. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  148. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  149. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  150. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  151. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  152. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  153. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  154. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  155. package/dist/esm/transactions/types.d.mts +3 -3
  156. package/dist/esm/version.d.mts +1 -1
  157. package/dist/esm/version.mjs +1 -1
  158. package/package.json +4 -2
  159. package/src/api/ans.ts +9 -9
  160. package/src/api/aptos.ts +3 -28
  161. package/src/api/coin.ts +3 -3
  162. package/src/api/digitalAsset.ts +368 -94
  163. package/src/api/fungibleAsset.ts +3 -3
  164. package/src/api/transaction.ts +172 -2
  165. package/src/api/transactionSubmission/build.ts +25 -4
  166. package/src/api/transactionSubmission/helpers.ts +31 -0
  167. package/src/api/transactionSubmission/simulate.ts +26 -20
  168. package/src/api/transactionSubmission/submit.ts +24 -20
  169. package/src/client/core.ts +1 -1
  170. package/src/core/account.ts +2 -2
  171. package/src/internal/ans.ts +5 -5
  172. package/src/internal/coin.ts +2 -2
  173. package/src/internal/digitalAsset.ts +461 -61
  174. package/src/internal/fungibleAsset.ts +2 -2
  175. package/src/internal/transactionSubmission.ts +6 -6
  176. package/src/transactions/management/transactionWorker.ts +2 -9
  177. package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -4
  178. package/src/transactions/types.ts +2 -2
  179. package/src/version.ts +1 -1
  180. package/dist/esm/api/transactionSubmission.d.mts +0 -113
  181. package/dist/esm/api/transactionSubmission.mjs +0 -2
  182. package/dist/esm/chunk-26GRNGPL.mjs +0 -2
  183. package/dist/esm/chunk-26GRNGPL.mjs.map +0 -1
  184. package/dist/esm/chunk-2AMFCGJ3.mjs.map +0 -1
  185. package/dist/esm/chunk-2X3FRUKX.mjs +0 -2
  186. package/dist/esm/chunk-2X3FRUKX.mjs.map +0 -1
  187. package/dist/esm/chunk-4XQ5IV6C.mjs +0 -2
  188. package/dist/esm/chunk-4XQ5IV6C.mjs.map +0 -1
  189. package/dist/esm/chunk-5X46HDCI.mjs +0 -2
  190. package/dist/esm/chunk-5X46HDCI.mjs.map +0 -1
  191. package/dist/esm/chunk-7IY2Y73Q.mjs.map +0 -1
  192. package/dist/esm/chunk-DYJVDOBH.mjs.map +0 -1
  193. package/dist/esm/chunk-ELWWME6B.mjs.map +0 -1
  194. package/dist/esm/chunk-MNFGMNYS.mjs.map +0 -1
  195. package/dist/esm/chunk-NBSXZKMQ.mjs +0 -2
  196. package/dist/esm/chunk-NBSXZKMQ.mjs.map +0 -1
  197. package/dist/esm/chunk-NZ36UN4C.mjs +0 -2
  198. package/dist/esm/chunk-NZ36UN4C.mjs.map +0 -1
  199. package/dist/esm/chunk-PEBXSNMJ.mjs +0 -2
  200. package/dist/esm/chunk-PEBXSNMJ.mjs.map +0 -1
  201. package/dist/esm/chunk-PLY7MQKE.mjs.map +0 -1
  202. package/dist/esm/chunk-PZ5JKQSP.mjs.map +0 -1
  203. package/dist/esm/chunk-TNUGIBLO.mjs +0 -2
  204. package/dist/esm/chunk-TNUGIBLO.mjs.map +0 -1
  205. package/dist/esm/chunk-TTICPGX6.mjs +0 -2
  206. package/dist/esm/chunk-TTICPGX6.mjs.map +0 -1
  207. package/dist/esm/chunk-UES76WF2.mjs +0 -2
  208. package/dist/esm/chunk-UES76WF2.mjs.map +0 -1
  209. package/dist/esm/chunk-W44E6YAW.mjs +0 -2
  210. package/dist/esm/chunk-W44E6YAW.mjs.map +0 -1
  211. package/dist/esm/chunk-W4JEP5GW.mjs +0 -2
  212. package/dist/esm/chunk-WXISFVRU.mjs +0 -2
  213. package/dist/esm/chunk-WXISFVRU.mjs.map +0 -1
  214. package/dist/esm/chunk-XKINEFAA.mjs.map +0 -1
  215. package/src/api/transactionSubmission.ts +0 -121
  216. /package/dist/esm/api/{transactionSubmission.mjs.map → transactionSubmission/helpers.mjs.map} +0 -0
  217. /package/dist/esm/{chunk-ZKFDLJ2F.mjs.map → chunk-2HBIGMDV.mjs.map} +0 -0
  218. /package/dist/esm/{chunk-GMOHGD73.mjs.map → chunk-4TIQQKXV.mjs.map} +0 -0
  219. /package/dist/esm/{chunk-DBJTMCAG.mjs.map → chunk-4VG7DV6F.mjs.map} +0 -0
  220. /package/dist/esm/{chunk-X7QBDRQR.mjs.map → chunk-BUM2FIHF.mjs.map} +0 -0
  221. /package/dist/esm/{chunk-CBAVJ5EN.mjs.map → chunk-D2XLC3KK.mjs.map} +0 -0
  222. /package/dist/esm/{chunk-BA4TDBYB.mjs.map → chunk-IEL6J6Z3.mjs.map} +0 -0
  223. /package/dist/esm/{chunk-Q3R3KKKP.mjs.map → chunk-IPW2YTRD.mjs.map} +0 -0
  224. /package/dist/esm/{chunk-BDTDWLGO.mjs.map → chunk-KH3M3YPI.mjs.map} +0 -0
  225. /package/dist/esm/{chunk-Y5RQOXZH.mjs.map → chunk-R3SAAJ2N.mjs.map} +0 -0
  226. /package/dist/esm/{chunk-32A35CPU.mjs.map → chunk-R4APGSSC.mjs.map} +0 -0
  227. /package/dist/esm/{chunk-5IVRKK5V.mjs.map → chunk-SR7XLV76.mjs.map} +0 -0
  228. /package/dist/esm/{chunk-LBNMY7EM.mjs.map → chunk-T3ID6KFN.mjs.map} +0 -0
  229. /package/dist/esm/{chunk-NFGAZSSK.mjs.map → chunk-UZB7CTLX.mjs.map} +0 -0
  230. /package/dist/esm/{chunk-5SRMD5C6.mjs.map → chunk-YLI6J47P.mjs.map} +0 -0
  231. /package/dist/esm/{chunk-4FDIPWVB.mjs.map → chunk-YLPG6XMH.mjs.map} +0 -0
  232. /package/dist/esm/{chunk-KR5JAN32.mjs.map → chunk-ZLYSA7JR.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as V,b as Y,c as Z}from"./chunk-4FDIPWVB.mjs";import{q as F,t as M}from"./chunk-7QJYTQSU.mjs";import{a as u}from"./chunk-OXO3Z2MF.mjs";import{a as l,c as g,d as m}from"./chunk-3QS3MFWJ.mjs";import{c as L,d as H,e as X,f as z,g as j,h as J,i as Q}from"./chunk-PANYJULW.mjs";import{a as q}from"./chunk-FGTQT7Q5.mjs";import{b as E,d as _,e as R,f as B}from"./chunk-GQI3HWOB.mjs";import{b as f,d as y,e as O}from"./chunk-6F4ACCCZ.mjs";import{a as k}from"./chunk-Y5RQOXZH.mjs";import{b as v}from"./chunk-X7QBDRQR.mjs";import{a as K}from"./chunk-AH44UPM4.mjs";import{a as h}from"./chunk-KVJ2KGMW.mjs";import{a as x}from"./chunk-OWP2MKTX.mjs";import{a as C,c as N}from"./chunk-RCYWJZR4.mjs";import{a as w,c as T}from"./chunk-5HZKDT5C.mjs";import{b as A}from"./chunk-UR5E2UDO.mjs";import{a as W}from"./chunk-5IVRKK5V.mjs";import{b as $}from"./chunk-NL72WE3E.mjs";import{c as D,d as U,g as G,h as b}from"./chunk-EOC4UI5B.mjs";import{e as I}from"./chunk-LV33NV4J.mjs";import{sha3_256 as an}from"@noble/hashes/sha3";async function Un(n){if(F(n))return nn(n);let{moduleAddress:e,moduleName:t,functionName:o}=M(n.function),r=await K(async()=>Y(e,t,o,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${e}-${t}-${o}`,1e3*60*5)();return on(n,r)}function on(n,e){if(F(n))return nn(n);let{moduleAddress:t,moduleName:o,functionName:r}=M(n.function),a=V(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let i=n.functionArguments.map((s,d)=>Z(n.function,e,s,d,a));if(i.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${o}::${r}', expected ${e.parameters.length} but got ${i.length}`);let c=z.build(`${t}::${o}`,r,a,i);if("multisigAddress"in n){let s=A.from(n.multisigAddress);return new X(new J(s,new Q(c)))}return new H(c)}function nn(n){return new L(new j($.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function sn(n){let{aptosConfig:e,sender:t,payload:o,options:r}=n,a=r?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:r.accountSequenceNumber}):k({aptosConfig:e,accountAddress:t}),i=I[e.network]?Promise.resolve({chain_id:I[e.network]}):W({aptosConfig:e}),c=r?.gasUnitPrice?Promise.resolve({gas_estimate:r.gasUnitPrice}):v({aptosConfig:e}),[{sequence_number:s},{chain_id:d},{gas_estimate:p}]=await Promise.all([a,i,c]),{maxGasAmount:S,gasUnitPrice:en,expireTimestamp:rn}={maxGasAmount:r?.maxGasAmount?BigInt(r.maxGasAmount):BigInt(D),gasUnitPrice:BigInt(p),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+U),...r};return new l(A.from(t),BigInt(s),o,BigInt(S),BigInt(en),BigInt(rn),new q(d))}async function Gn(n){let{aptosConfig:e,sender:t,payload:o,options:r}=n,a=await sn({aptosConfig:e,sender:t,payload:o,options:r});if("secondarySignerAddresses"in n){let i=n.secondarySignerAddresses?.map(c=>A.from(c))??[];return{rawTransaction:a,secondarySignerAddresses:i,feePayerAddress:n.feePayerAddress?A.from(n.feePayerAddress):void 0}}return{rawTransaction:a,feePayerAddress:n.feePayerAddress?A.from(n.feePayerAddress):void 0}}function $n(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:o,feePayerPublicKey:r}=n,a=P(e);if(t.feePayerAddress){let c=new m(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),s=[];o&&(s=o.map(S=>P(S)));let d=P(r),p=new R(a,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:d});return new u(c.raw_txn,p).bcsToBytes()}if(t.secondarySignerAddresses){let c=new g(t.rawTransaction,t.secondarySignerAddresses),s=[];s=o.map(p=>P(p));let d=new _(a,t.secondarySignerAddresses,s);return new u(c.raw_txn,d).bcsToBytes()}let i;if(a instanceof f)i=new E(a.public_key,a.signature);else if(a instanceof y)i=new B(a);else throw new Error("Invalid public key");return new u(t.rawTransaction,i).bcsToBytes()}function P(n){if(n instanceof x){if(n.publicKey instanceof w)return new y(n,new h(new T(new Uint8Array(64))));if(n.publicKey instanceof C)return new y(n,new h(new N(new Uint8Array(64))))}return new f(new w(n.toUint8Array()),new T(new Uint8Array(64)))}function Cn(n){let{signer:e,transaction:t}=n,o=un(t),r=e.sign(o);switch(e.signingScheme){case 0:return new f(new w(e.publicKey.toUint8Array()),new T(r.toUint8Array()));case 2:if(!x.isPublicKey(e.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${e.signingScheme}`);return new y(e.publicKey,new h(r));default:throw new Error(`Cannot sign transaction, signing scheme ${e.signingScheme} not supported`)}}function Nn(n){let{transaction:e,senderAuthenticator:t,feePayerAuthenticator:o,additionalSignersAuthenticators:r}=n,a=tn(e);if((o||r)&&(a instanceof g||a instanceof m))return cn(a,t,o,r);if(t instanceof f&&a instanceof l){let i=new E(t.public_key,t.signature);return new u(a,i).bcsToBytes()}if((t instanceof y||t instanceof O)&&a instanceof l){let i=new B(t);return new u(a,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${t} is not a supported account authentication scheme`)}function tn(n){return n.feePayerAddress?new m(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new g(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function cn(n,e,t,o){if(n instanceof m){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let r=new R(e,n.secondary_signer_addresses,o??[],{address:n.fee_payer_address,authenticator:t});return new u(n.raw_txn,r).bcsToBytes()}if(n instanceof g){if(!o)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let r=new _(e,n.secondary_signer_addresses,o??[]);return new u(n.raw_txn,r).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function un(n){let e=tn(n),t=an.create();if(e instanceof l)t.update(G);else if(e instanceof g)t.update(b);else if(e instanceof m)t.update(b);else throw new Error(`Unknown transaction type to sign on: ${e}`);let o=t.digest(),r=e.bcsToBytes(),a=new Uint8Array(o.length+r.length);return a.set(o),a.set(r,o.length),a}export{Un as a,on as b,sn as c,Gn as d,$n as e,P as f,Cn as g,Nn as h,tn as i,cn as j,un as k};
2
- //# sourceMappingURL=chunk-MNFGMNYS.mjs.map
1
+ import{a as V,b as Y,c as Z}from"./chunk-YLPG6XMH.mjs";import{q as F,t as M}from"./chunk-7QJYTQSU.mjs";import{a as u}from"./chunk-OXO3Z2MF.mjs";import{a as l,c as g,d as m}from"./chunk-3QS3MFWJ.mjs";import{c as L,d as H,e as X,f as z,g as j,h as J,i as Q}from"./chunk-PANYJULW.mjs";import{b as E,d as _,e as R,f as B}from"./chunk-GQI3HWOB.mjs";import{b as f,d as y,e as O}from"./chunk-6F4ACCCZ.mjs";import{a as q}from"./chunk-FGTQT7Q5.mjs";import{a as k}from"./chunk-R3SAAJ2N.mjs";import{a as h}from"./chunk-KVJ2KGMW.mjs";import{a as x}from"./chunk-OWP2MKTX.mjs";import{a as C,c as N}from"./chunk-RCYWJZR4.mjs";import{a as w,c as T}from"./chunk-5HZKDT5C.mjs";import{b as A}from"./chunk-UR5E2UDO.mjs";import{b as $}from"./chunk-NL72WE3E.mjs";import{b as v}from"./chunk-BUM2FIHF.mjs";import{a as K}from"./chunk-AH44UPM4.mjs";import{a as W}from"./chunk-SR7XLV76.mjs";import{c as D,d as U,g as G,h as b}from"./chunk-EOC4UI5B.mjs";import{e as I}from"./chunk-LV33NV4J.mjs";import{sha3_256 as an}from"@noble/hashes/sha3";async function Un(n){if(F(n))return nn(n);let{moduleAddress:e,moduleName:t,functionName:o}=M(n.function),r=await K(async()=>Y(e,t,o,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${e}-${t}-${o}`,1e3*60*5)();return on(n,r)}function on(n,e){if(F(n))return nn(n);let{moduleAddress:t,moduleName:o,functionName:r}=M(n.function),a=V(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let i=n.functionArguments.map((s,d)=>Z(n.function,e,s,d,a));if(i.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${o}::${r}', expected ${e.parameters.length} but got ${i.length}`);let c=z.build(`${t}::${o}`,r,a,i);if("multisigAddress"in n){let s=A.from(n.multisigAddress);return new X(new J(s,new Q(c)))}return new H(c)}function nn(n){return new L(new j($.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function sn(n){let{aptosConfig:e,sender:t,payload:o,options:r}=n,a=r?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:r.accountSequenceNumber}):k({aptosConfig:e,accountAddress:t}),i=I[e.network]?Promise.resolve({chain_id:I[e.network]}):W({aptosConfig:e}),c=r?.gasUnitPrice?Promise.resolve({gas_estimate:r.gasUnitPrice}):v({aptosConfig:e}),[{sequence_number:s},{chain_id:d},{gas_estimate:p}]=await Promise.all([a,i,c]),{maxGasAmount:S,gasUnitPrice:en,expireTimestamp:rn}={maxGasAmount:r?.maxGasAmount?BigInt(r.maxGasAmount):BigInt(D),gasUnitPrice:BigInt(p),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+U),...r};return new l(A.from(t),BigInt(s),o,BigInt(S),BigInt(en),BigInt(rn),new q(d))}async function Gn(n){let{aptosConfig:e,sender:t,payload:o,options:r}=n,a=await sn({aptosConfig:e,sender:t,payload:o,options:r});if("secondarySignerAddresses"in n){let i=n.secondarySignerAddresses?.map(c=>A.from(c))??[];return{rawTransaction:a,secondarySignerAddresses:i,feePayerAddress:n.feePayerAddress?A.from(n.feePayerAddress):void 0}}return{rawTransaction:a,feePayerAddress:n.feePayerAddress?A.from(n.feePayerAddress):void 0}}function $n(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:o,feePayerPublicKey:r}=n,a=P(e);if(t.feePayerAddress){let c=new m(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),s=[];o&&(s=o.map(S=>P(S)));let d=P(r),p=new R(a,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:d});return new u(c.raw_txn,p).bcsToBytes()}if(t.secondarySignerAddresses){let c=new g(t.rawTransaction,t.secondarySignerAddresses),s=[];s=o.map(p=>P(p));let d=new _(a,t.secondarySignerAddresses,s);return new u(c.raw_txn,d).bcsToBytes()}let i;if(a instanceof f)i=new E(a.public_key,a.signature);else if(a instanceof y)i=new B(a);else throw new Error("Invalid public key");return new u(t.rawTransaction,i).bcsToBytes()}function P(n){if(n instanceof x){if(n.publicKey instanceof w)return new y(n,new h(new T(new Uint8Array(64))));if(n.publicKey instanceof C)return new y(n,new h(new N(new Uint8Array(64))))}return new f(new w(n.toUint8Array()),new T(new Uint8Array(64)))}function Cn(n){let{signer:e,transaction:t}=n,o=un(t),r=e.sign(o);switch(e.signingScheme){case 0:return new f(new w(e.publicKey.toUint8Array()),new T(r.toUint8Array()));case 2:if(!x.isPublicKey(e.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${e.signingScheme}`);return new y(e.publicKey,new h(r));default:throw new Error(`Cannot sign transaction, signing scheme ${e.signingScheme} not supported`)}}function Nn(n){let{transaction:e,senderAuthenticator:t,feePayerAuthenticator:o,additionalSignersAuthenticators:r}=n,a=tn(e);if((o||r)&&(a instanceof g||a instanceof m))return cn(a,t,o,r);if(t instanceof f&&a instanceof l){let i=new E(t.public_key,t.signature);return new u(a,i).bcsToBytes()}if((t instanceof y||t instanceof O)&&a instanceof l){let i=new B(t);return new u(a,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${t} is not a supported account authentication scheme`)}function tn(n){return n.feePayerAddress?new m(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new g(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function cn(n,e,t,o){if(n instanceof m){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let r=new R(e,n.secondary_signer_addresses,o??[],{address:n.fee_payer_address,authenticator:t});return new u(n.raw_txn,r).bcsToBytes()}if(n instanceof g){if(!o)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let r=new _(e,n.secondary_signer_addresses,o??[]);return new u(n.raw_txn,r).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function un(n){let e=tn(n),t=an.create();if(e instanceof l)t.update(G);else if(e instanceof g)t.update(b);else if(e instanceof m)t.update(b);else throw new Error(`Unknown transaction type to sign on: ${e}`);let o=t.digest(),r=e.bcsToBytes(),a=new Uint8Array(o.length+r.length);return a.set(o),a.set(r,o.length),a}export{Un as a,on as b,sn as c,Gn as d,$n as e,P as f,Cn as g,Nn as h,tn as i,cn as j,un as k};
2
+ //# sourceMappingURL=chunk-3O4GKLXA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/transactionBuilder/transactionBuilder.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file handles the transaction creation lifecycle.\n * It holds different operations to generate a transaction payload, a raw transaction,\n * and a signed transaction that can be simulated, signed and submitted to chain.\n */\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput, Hex, PublicKey } from \"../../core\";\nimport { Account } from \"../../core/account\";\nimport { AnyPublicKey } from \"../../core/crypto/anyPublicKey\";\nimport { AnySignature } from \"../../core/crypto/anySignature\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { Secp256k1PublicKey, Secp256k1Signature } from \"../../core/crypto/secp256k1\";\nimport { getInfo } from \"../../internal/account\";\nimport { getLedgerInfo } from \"../../internal/general\";\nimport { getGasPriceEstimation } from \"../../internal/transaction\";\nimport { NetworkToChainId } from \"../../utils/apiEndpoints\";\nimport {\n DEFAULT_MAX_GAS_AMOUNT,\n DEFAULT_TXN_EXP_SEC_FROM_NOW,\n RAW_TRANSACTION_SALT,\n RAW_TRANSACTION_WITH_DATA_SALT,\n} from \"../../utils/const\";\nimport {\n AccountAuthenticator,\n AccountAuthenticatorEd25519,\n AccountAuthenticatorMultiKey,\n AccountAuthenticatorSingleKey,\n} from \"../authenticator/account\";\nimport {\n TransactionAuthenticatorEd25519,\n TransactionAuthenticatorFeePayer,\n TransactionAuthenticatorMultiAgent,\n TransactionAuthenticatorSingleSender,\n} from \"../authenticator/transaction\";\nimport {\n ChainId,\n EntryFunction,\n FeePayerRawTransaction,\n MultiAgentRawTransaction,\n MultiSig,\n MultisigTransactionPayload,\n RawTransaction,\n Script,\n TransactionPayloadEntryFunction,\n TransactionPayloadMultisig,\n TransactionPayloadScript,\n} from \"../instances\";\nimport { SignedTransaction } from \"../instances/signedTransaction\";\nimport {\n AnyRawTransaction,\n AnyTransactionPayloadInstance,\n AnyRawTransactionInstance,\n EntryFunctionArgumentTypes,\n EntryFunctionABI,\n InputGenerateMultiAgentRawTransactionArgs,\n InputGenerateRawTransactionArgs,\n InputGenerateSingleSignerRawTransactionArgs,\n SimpleTransaction,\n InputGenerateTransactionOptions,\n MultiAgentTransaction,\n InputScriptData,\n InputSimulateTransactionData,\n InputGenerateTransactionPayloadData,\n InputEntryFunctionData,\n InputMultiSigData,\n InputMultiSigDataWithRemoteABI,\n InputEntryFunctionDataWithRemoteABI,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputSubmitTransactionData,\n} from \"../types\";\nimport { convertArgument, fetchEntryFunctionAbi, standardizeTypeTags } from \"./remoteAbi\";\nimport { memoizeAsync } from \"../../utils/memoize\";\nimport { SigningScheme } from \"../../types\";\nimport { getFunctionParts, isScriptDataInput } from \"./helpers\";\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransactionPayload` function.\n * When we call our `generateTransactionPayload` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function generateTransactionPayload(args: InputScriptData): Promise<TransactionPayloadScript>;\nexport async function generateTransactionPayload(\n args: InputEntryFunctionDataWithRemoteABI,\n): Promise<TransactionPayloadEntryFunction>;\nexport async function generateTransactionPayload(\n args: InputMultiSigDataWithRemoteABI,\n): Promise<TransactionPayloadMultisig>;\n\n/**\n * Builds a transaction payload based on the data argument and returns\n * a transaction payload - TransactionPayloadScript | TransactionPayloadMultisig | TransactionPayloadEntryFunction\n *\n * This uses the RemoteABI by default, and the remote ABI can be skipped by using generateTransactionPayloadWithABI\n *\n * @param args.data GenerateTransactionPayloadData\n *\n * @return TransactionPayload\n */\nexport async function generateTransactionPayload(\n args: InputGenerateTransactionPayloadDataWithRemoteABI,\n): Promise<AnyTransactionPayloadInstance> {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // We fetch the entry function ABI, and then pretend that we already had the ABI\n const functionAbi = await memoizeAsync(\n async () => fetchEntryFunctionAbi(moduleAddress, moduleName, functionName, args.aptosConfig),\n `entry-function-${args.aptosConfig.network}-${moduleAddress}-${moduleName}-${functionName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n\n return generateTransactionPayloadWithABI(args, functionAbi);\n}\n\nexport function generateTransactionPayloadWithABI(\n args: InputEntryFunctionData,\n functionAbi: EntryFunctionABI,\n): TransactionPayloadEntryFunction;\nexport function generateTransactionPayloadWithABI(\n args: InputMultiSigData,\n functionAbi: EntryFunctionABI,\n): TransactionPayloadMultisig;\nexport function generateTransactionPayloadWithABI(\n args: InputGenerateTransactionPayloadData,\n functionAbi: EntryFunctionABI,\n): AnyTransactionPayloadInstance {\n if (isScriptDataInput(args)) {\n return generateTransactionPayloadScript(args);\n }\n\n const { moduleAddress, moduleName, functionName } = getFunctionParts(args.function);\n\n // Ensure that all type arguments are typed properly\n const typeArguments = standardizeTypeTags(args.typeArguments);\n\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n // Check all BCS types, and convert any non-BCS types\n const functionArguments: Array<EntryFunctionArgumentTypes> = args.functionArguments.map((arg, i) =>\n convertArgument(args.function, functionAbi, arg, i, typeArguments),\n );\n\n // Check that all arguments are accounted for\n if (functionArguments.length !== functionAbi.parameters.length) {\n throw new Error(\n // eslint-disable-next-line max-len\n `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,\n );\n }\n\n // Generate entry function payload\n const entryFunctionPayload = EntryFunction.build(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments,\n functionArguments,\n );\n\n // Send it as multi sig if it's a multisig payload\n if (\"multisigAddress\" in args) {\n const multisigAddress = AccountAddress.from(args.multisigAddress);\n return new TransactionPayloadMultisig(\n new MultiSig(multisigAddress, new MultisigTransactionPayload(entryFunctionPayload)),\n );\n }\n\n // Otherwise send as an entry function\n return new TransactionPayloadEntryFunction(entryFunctionPayload);\n}\n\nfunction generateTransactionPayloadScript(args: InputScriptData) {\n return new TransactionPayloadScript(\n new Script(Hex.fromHexInput(args.bytecode).toUint8Array(), args.typeArguments ?? [], args.functionArguments),\n );\n}\n\n/**\n * Generates a raw transaction\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n *\n * @returns RawTransaction\n */\nexport async function generateRawTransaction(args: {\n aptosConfig: AptosConfig;\n sender: AccountAddressInput;\n payload: AnyTransactionPayloadInstance;\n options?: InputGenerateTransactionOptions;\n}): Promise<RawTransaction> {\n const { aptosConfig, sender, payload, options } = args;\n\n const getSequenceNumber =\n options?.accountSequenceNumber !== undefined\n ? Promise.resolve({ sequence_number: options.accountSequenceNumber })\n : getInfo({ aptosConfig, accountAddress: sender });\n\n const getChainId = NetworkToChainId[aptosConfig.network]\n ? Promise.resolve({ chain_id: NetworkToChainId[aptosConfig.network] })\n : getLedgerInfo({ aptosConfig });\n\n const getGasUnitPrice = options?.gasUnitPrice\n ? Promise.resolve({ gas_estimate: options.gasUnitPrice })\n : getGasPriceEstimation({ aptosConfig });\n\n const [{ sequence_number: sequenceNumber }, { chain_id: chainId }, { gas_estimate: gasEstimate }] = await Promise.all(\n [getSequenceNumber, getChainId, getGasUnitPrice],\n );\n\n const { maxGasAmount, gasUnitPrice, expireTimestamp } = {\n maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(DEFAULT_MAX_GAS_AMOUNT),\n gasUnitPrice: BigInt(gasEstimate),\n expireTimestamp: BigInt(Math.floor(Date.now() / 1000) + DEFAULT_TXN_EXP_SEC_FROM_NOW),\n ...options,\n };\n\n return new RawTransaction(\n AccountAddress.from(sender),\n BigInt(sequenceNumber),\n payload,\n BigInt(maxGasAmount),\n BigInt(gasUnitPrice),\n BigInt(expireTimestamp),\n new ChainId(chainId),\n );\n}\n\n/**\n * We are defining function signatures, each with its specific input and output.\n * These are the possible function signature for our `generateTransaction` function.\n * When we call our `generateTransaction` function with the relevant type properties,\n * Typescript can infer the return type based on the appropriate function overload.\n */\nexport async function buildTransaction(args: InputGenerateSingleSignerRawTransactionArgs): Promise<SimpleTransaction>;\nexport async function buildTransaction(args: InputGenerateMultiAgentRawTransactionArgs): Promise<MultiAgentTransaction>;\n\n/**\n * Generates a transaction based on the provided arguments\n *\n * Note: we can start with one function to support all different payload/transaction types,\n * and if to complex to use, we could have function for each type\n *\n * @param args.aptosConfig AptosConfig\n * @param args.sender The transaction's sender account address as a hex input\n * @param args.payload The transaction payload - can create by using generateTransactionPayload()\n * @param args.options optional. Transaction options object\n * @param args.secondarySignerAddresses optional. For when want to create a multi signers transaction\n * @param args.feePayerAddress optional. For when want to create a fee payer (aka sponsored) transaction\n *\n * @return An instance of a RawTransaction, plus optional secondary/fee payer addresses\n * ```\n * {\n * rawTransaction: RawTransaction,\n * secondarySignerAddresses? : Array<AccountAddress>,\n * feePayerAddress?: AccountAddress\n * }\n * ```\n */\nexport async function buildTransaction(args: InputGenerateRawTransactionArgs): Promise<AnyRawTransaction> {\n const { aptosConfig, sender, payload, options } = args;\n // generate raw transaction\n const rawTxn = await generateRawTransaction({\n aptosConfig,\n sender,\n payload,\n options,\n });\n\n // if multi agent transaction\n if (\"secondarySignerAddresses\" in args) {\n const signers: Array<AccountAddress> =\n args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];\n\n return {\n rawTransaction: rawTxn,\n secondarySignerAddresses: signers,\n feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n };\n }\n // return the raw transaction\n return {\n rawTransaction: rawTxn,\n feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,\n };\n}\n\n/**\n * Simulate a transaction before signing and submit to chain\n *\n * @param args.transaction A aptos transaction type to sign\n * @param args.signerPublicKey The signer public key\n * @param args.secondarySignersPublicKeys optional. The secondary signers public keys if multi signers transaction\n * @param args.feePayerPublicKey optional. The fee payer public key is a fee payer (aka sponsored) transaction\n * @param args.options optional. SimulateTransactionOptions\n *\n * @returns A signed serialized transaction that can be simulated\n */\nexport function generateSignedTransactionForSimulation(args: InputSimulateTransactionData): Uint8Array {\n const { signerPublicKey, transaction, secondarySignersPublicKeys, feePayerPublicKey } = args;\n\n const accountAuthenticator = getAuthenticatorForSimulation(signerPublicKey);\n\n // fee payer transaction\n if (transaction.feePayerAddress) {\n const transactionToSign = new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n if (secondarySignersPublicKeys) {\n secondaryAccountAuthenticators = secondarySignersPublicKeys.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n }\n const feePayerAuthenticator = getAuthenticatorForSimulation(feePayerPublicKey!);\n\n const transactionAuthenticator = new TransactionAuthenticatorFeePayer(\n accountAuthenticator,\n transaction.secondarySignerAddresses ?? [],\n secondaryAccountAuthenticators,\n {\n address: transaction.feePayerAddress,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // multi agent transaction\n if (transaction.secondarySignerAddresses) {\n const transactionToSign = new MultiAgentRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses,\n );\n\n let secondaryAccountAuthenticators: Array<AccountAuthenticator> = [];\n\n secondaryAccountAuthenticators = secondarySignersPublicKeys!.map((publicKey) =>\n getAuthenticatorForSimulation(publicKey),\n );\n\n const transactionAuthenticator = new TransactionAuthenticatorMultiAgent(\n accountAuthenticator,\n transaction.secondarySignerAddresses,\n secondaryAccountAuthenticators,\n );\n\n return new SignedTransaction(transactionToSign.raw_txn, transactionAuthenticator).bcsToBytes();\n }\n\n // single signer raw transaction\n let transactionAuthenticator;\n if (accountAuthenticator instanceof AccountAuthenticatorEd25519) {\n transactionAuthenticator = new TransactionAuthenticatorEd25519(\n accountAuthenticator.public_key,\n accountAuthenticator.signature,\n );\n } else if (accountAuthenticator instanceof AccountAuthenticatorSingleKey) {\n transactionAuthenticator = new TransactionAuthenticatorSingleSender(accountAuthenticator);\n } else {\n throw new Error(\"Invalid public key\");\n }\n return new SignedTransaction(transaction.rawTransaction, transactionAuthenticator).bcsToBytes();\n}\n\nexport function getAuthenticatorForSimulation(publicKey: PublicKey) {\n // TODO add support for AnyMultiKey\n if (publicKey instanceof AnyPublicKey) {\n if (publicKey.publicKey instanceof Ed25519PublicKey) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Ed25519Signature(new Uint8Array(64))));\n }\n if (publicKey.publicKey instanceof Secp256k1PublicKey) {\n return new AccountAuthenticatorSingleKey(publicKey, new AnySignature(new Secp256k1Signature(new Uint8Array(64))));\n }\n }\n\n // legacy code\n return new AccountAuthenticatorEd25519(\n new Ed25519PublicKey(publicKey.toUint8Array()),\n new Ed25519Signature(new Uint8Array(64)),\n );\n}\n\n/**\n * Sign a transaction that can later be submitted to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction A aptos transaction type to sign\n *\n * @return The signer AccountAuthenticator\n */\nexport function sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // get the signing message\n const message = generateSigningMessage(transaction);\n\n // account.signMessage\n const signerSignature = signer.sign(message);\n\n // return account authentication\n switch (signer.signingScheme) {\n case SigningScheme.Ed25519:\n return new AccountAuthenticatorEd25519(\n new Ed25519PublicKey(signer.publicKey.toUint8Array()),\n new Ed25519Signature(signerSignature.toUint8Array()),\n );\n case SigningScheme.SingleKey:\n if (!AnyPublicKey.isPublicKey(signer.publicKey)) {\n throw new Error(`Cannot sign transaction, public key does not match ${signer.signingScheme}`);\n }\n return new AccountAuthenticatorSingleKey(signer.publicKey, new AnySignature(signerSignature));\n // TODO support MultiEd25519\n default:\n throw new Error(`Cannot sign transaction, signing scheme ${signer.signingScheme} not supported`);\n }\n}\n\n/**\n * Prepare a transaction to be submitted to chain\n *\n * @param args.transaction A aptos transaction type\n * @param args.senderAuthenticator The account authenticator of the transaction sender\n * @param args.secondarySignerAuthenticators optional. For when the transaction is a multi signers transaction\n *\n * @returns A SignedTransaction\n */\nexport function generateSignedTransaction(args: InputSubmitTransactionData): Uint8Array {\n const { transaction, senderAuthenticator, feePayerAuthenticator, additionalSignersAuthenticators } = args;\n\n const transactionToSubmit = deriveTransactionType(transaction);\n\n if (\n (feePayerAuthenticator || additionalSignersAuthenticators) &&\n (transactionToSubmit instanceof MultiAgentRawTransaction || transactionToSubmit instanceof FeePayerRawTransaction)\n ) {\n return generateMultiSignersSignedTransaction(\n transactionToSubmit,\n senderAuthenticator,\n feePayerAuthenticator,\n additionalSignersAuthenticators,\n );\n }\n\n // submit single signer transaction\n\n // check what instance is accountAuthenticator\n if (senderAuthenticator instanceof AccountAuthenticatorEd25519 && transactionToSubmit instanceof RawTransaction) {\n const transactionAuthenticator = new TransactionAuthenticatorEd25519(\n senderAuthenticator.public_key,\n senderAuthenticator.signature,\n );\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n if (\n (senderAuthenticator instanceof AccountAuthenticatorSingleKey ||\n senderAuthenticator instanceof AccountAuthenticatorMultiKey) &&\n transactionToSubmit instanceof RawTransaction\n ) {\n const transactionAuthenticator = new TransactionAuthenticatorSingleSender(senderAuthenticator);\n return new SignedTransaction(transactionToSubmit, transactionAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot generate a signed transaction, ${senderAuthenticator} is not a supported account authentication scheme`,\n );\n}\n\n/**\n * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction\n *\n * @param transaction A aptos transaction type\n *\n * @returns FeePayerRawTransaction | MultiAgentRawTransaction | RawTransaction\n */\nexport function deriveTransactionType(transaction: AnyRawTransaction): AnyRawTransactionInstance {\n if (transaction.feePayerAddress) {\n return new FeePayerRawTransaction(\n transaction.rawTransaction,\n transaction.secondarySignerAddresses ?? [],\n transaction.feePayerAddress,\n );\n }\n if (transaction.secondarySignerAddresses) {\n return new MultiAgentRawTransaction(transaction.rawTransaction, transaction.secondarySignerAddresses);\n }\n\n return transaction.rawTransaction;\n}\n\n/**\n * Generate a multi signers signed transaction that can be submitted to chain\n *\n * @param transaction MultiAgentRawTransaction | FeePayerRawTransaction\n * @param senderAuthenticator The account authenticator of the transaction sender\n * @param secondarySignerAuthenticators The extra signers account Authenticators\n *\n * @returns A SignedTransaction\n */\nexport function generateMultiSignersSignedTransaction(\n transaction: MultiAgentRawTransaction | FeePayerRawTransaction,\n senderAuthenticator: AccountAuthenticator,\n feePayerAuthenticator?: AccountAuthenticator,\n additionalSignersAuthenticators?: Array<AccountAuthenticator>,\n) {\n if (transaction instanceof FeePayerRawTransaction) {\n if (!feePayerAuthenticator) {\n throw new Error(\"Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction\");\n }\n const txAuthenticatorFeePayer = new TransactionAuthenticatorFeePayer(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n {\n address: transaction.fee_payer_address,\n authenticator: feePayerAuthenticator,\n },\n );\n return new SignedTransaction(transaction.raw_txn, txAuthenticatorFeePayer).bcsToBytes();\n }\n if (transaction instanceof MultiAgentRawTransaction) {\n if (!additionalSignersAuthenticators) {\n throw new Error(\n \"Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction\",\n );\n }\n const multiAgentAuthenticator = new TransactionAuthenticatorMultiAgent(\n senderAuthenticator,\n transaction.secondary_signer_addresses,\n additionalSignersAuthenticators ?? [],\n );\n return new SignedTransaction(transaction.raw_txn, multiAgentAuthenticator).bcsToBytes();\n }\n\n throw new Error(\n `Cannot prepare multi signers transaction to submission, ${typeof transaction} transaction is not supported`,\n );\n}\n\nexport function generateSigningMessage(transaction: AnyRawTransaction): Uint8Array {\n const rawTxn = deriveTransactionType(transaction);\n const hash = sha3Hash.create();\n\n if (rawTxn instanceof RawTransaction) {\n hash.update(RAW_TRANSACTION_SALT);\n } else if (rawTxn instanceof MultiAgentRawTransaction) {\n hash.update(RAW_TRANSACTION_WITH_DATA_SALT);\n } else if (rawTxn instanceof FeePayerRawTransaction) {\n hash.update(RAW_TRANSACTION_WITH_DATA_SALT);\n } else {\n throw new Error(`Unknown transaction type to sign on: ${rawTxn}`);\n }\n\n const prefix = hash.digest();\n\n const body = rawTxn.bcsToBytes();\n\n const mergedArray = new Uint8Array(prefix.length + body.length);\n mergedArray.set(prefix);\n mergedArray.set(body, prefix.length);\n\n return mergedArray;\n}\n"],"mappings":"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","names":["sha3Hash","generateTransactionPayload","args","isScriptDataInput","generateTransactionPayloadScript","moduleAddress","moduleName","functionName","getFunctionParts","functionAbi","memoizeAsync","fetchEntryFunctionAbi","generateTransactionPayloadWithABI","typeArguments","standardizeTypeTags","functionArguments","arg","i","convertArgument","entryFunctionPayload","EntryFunction","multisigAddress","AccountAddress","TransactionPayloadMultisig","MultiSig","MultisigTransactionPayload","TransactionPayloadEntryFunction","TransactionPayloadScript","Script","Hex","generateRawTransaction","aptosConfig","sender","payload","options","getSequenceNumber","getInfo","getChainId","NetworkToChainId","getLedgerInfo","getGasUnitPrice","getGasPriceEstimation","sequenceNumber","chainId","gasEstimate","maxGasAmount","gasUnitPrice","expireTimestamp","DEFAULT_MAX_GAS_AMOUNT","DEFAULT_TXN_EXP_SEC_FROM_NOW","RawTransaction","ChainId","buildTransaction","rawTxn","signers","signer","generateSignedTransactionForSimulation","signerPublicKey","transaction","secondarySignersPublicKeys","feePayerPublicKey","accountAuthenticator","getAuthenticatorForSimulation","transactionToSign","FeePayerRawTransaction","secondaryAccountAuthenticators","publicKey","feePayerAuthenticator","transactionAuthenticator","TransactionAuthenticatorFeePayer","SignedTransaction","MultiAgentRawTransaction","TransactionAuthenticatorMultiAgent","AccountAuthenticatorEd25519","TransactionAuthenticatorEd25519","AccountAuthenticatorSingleKey","TransactionAuthenticatorSingleSender","AnyPublicKey","Ed25519PublicKey","AnySignature","Ed25519Signature","Secp256k1PublicKey","Secp256k1Signature","sign","message","generateSigningMessage","signerSignature","generateSignedTransaction","senderAuthenticator","additionalSignersAuthenticators","transactionToSubmit","deriveTransactionType","generateMultiSignersSignedTransaction","AccountAuthenticatorMultiKey","txAuthenticatorFeePayer","multiAgentAuthenticator","hash","sha3Hash","RAW_TRANSACTION_SALT","RAW_TRANSACTION_WITH_DATA_SALT","prefix","body","mergedArray"]}
@@ -1,2 +1,2 @@
1
- import{a as o,b as r,c as t}from"./chunk-CBAVJ5EN.mjs";import{a as n}from"./chunk-LBNMY7EM.mjs";var s=class{constructor(e){this.config=e}async getAccountEventsByCreationNumber(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["events_processor"]}),o({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["events_processor"]}),r({aptosConfig:this.config,...e})}async getEvents(e){return await n({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["events_processor"]}),t({aptosConfig:this.config,...e})}};export{s as a};
2
- //# sourceMappingURL=chunk-GMOHGD73.mjs.map
1
+ import{a as o,b as r,c as t}from"./chunk-D2XLC3KK.mjs";import{a as n}from"./chunk-T3ID6KFN.mjs";var s=class{constructor(e){this.config=e}async getAccountEventsByCreationNumber(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["events_processor"]}),o({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["events_processor"]}),r({aptosConfig:this.config,...e})}async getEvents(e){return await n({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["events_processor"]}),t({aptosConfig:this.config,...e})}};export{s as a};
2
+ //# sourceMappingURL=chunk-4TIQQKXV.mjs.map
@@ -1,2 +1,2 @@
1
- import{f as e}from"./chunk-X7QBDRQR.mjs";import{b as c}from"./chunk-UR5E2UDO.mjs";import{d as r}from"./chunk-KR5JAN32.mjs";import{e as s}from"./chunk-EOC4UI5B.mjs";async function x(a){let{aptosConfig:t,accountAddress:i,amount:p,options:n}=a,u=n?.timeoutSecs||s,{data:d}=await r({aptosConfig:t,path:"fund",body:{address:c.from(i).toString(),amount:p},originMethod:"fundAccount"}),m=d.txn_hashes[0],o=await e({aptosConfig:t,transactionHash:m,options:{timeoutSecs:u,checkSuccess:n?.checkSuccess}});if(o.type==="user_transaction")return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{x as a};
2
- //# sourceMappingURL=chunk-DBJTMCAG.mjs.map
1
+ import{b as c}from"./chunk-UR5E2UDO.mjs";import{f as e}from"./chunk-BUM2FIHF.mjs";import{d as r}from"./chunk-ZLYSA7JR.mjs";import{e as s}from"./chunk-EOC4UI5B.mjs";async function x(a){let{aptosConfig:t,accountAddress:i,amount:p,options:n}=a,u=n?.timeoutSecs||s,{data:d}=await r({aptosConfig:t,path:"fund",body:{address:c.from(i).toString(),amount:p},originMethod:"fundAccount"}),m=d.txn_hashes[0],o=await e({aptosConfig:t,transactionHash:m,options:{timeoutSecs:u,checkSuccess:n?.checkSuccess}});if(o.type==="user_transaction")return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{x as a};
2
+ //# sourceMappingURL=chunk-4VG7DV6F.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-7IY2Y73Q.mjs";import{g as o}from"./chunk-5IVRKK5V.mjs";import{o as a,r,s as u}from"./chunk-BQSE5HHW.mjs";async function b(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function m(t){let{aptosConfig:s,options:e}=t,n={query:r,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function F(t){let{aptosConfig:s,options:e}=t,n={query:a,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function y(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:A,options:c}=t;return await g({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,A]},options:c})}export{b as a,m as b,F as c,y as d};
2
- //# sourceMappingURL=chunk-XKINEFAA.mjs.map
1
+ import{a as g}from"./chunk-VBUKPN4Q.mjs";import{g as o}from"./chunk-SR7XLV76.mjs";import{o as a,r,s as u}from"./chunk-BQSE5HHW.mjs";async function b(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function m(t){let{aptosConfig:s,options:e}=t,n={query:r,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function F(t){let{aptosConfig:s,options:e}=t,n={query:a,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function y(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:A,options:c}=t;return await g({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,A]},options:c})}export{b as a,m as b,F as c,y as d};
2
+ //# sourceMappingURL=chunk-4ZYW3BPF.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/fungibleAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/fungible_asset}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * fungible_asset namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport { queryIndexer } from \"./general\";\nimport {\n GetCurrentFungibleAssetBalances,\n GetFungibleAssetActivities,\n GetFungibleAssetMetadata,\n} from \"../types/generated/queries\";\nimport {\n GetCurrentFungibleAssetBalancesQuery,\n GetFungibleAssetActivitiesQuery,\n GetFungibleAssetMetadataQuery,\n} from \"../types/generated/operations\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { Account, AccountAddress } from \"../core\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { generateTransaction } from \"./transactionSubmission\";\n\nexport async function getFungibleAssetMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n}): Promise<GetFungibleAssetMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetMetadata,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetMetadata\",\n });\n\n return data.fungible_asset_metadata;\n}\n\nexport async function getFungibleAssetActivities(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n}): Promise<GetFungibleAssetActivitiesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetActivities,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetActivitiesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetActivities\",\n });\n\n return data.fungible_asset_activities;\n}\n\nexport async function getCurrentFungibleAssetBalances(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetCurrentFungibleAssetBalancesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetCurrentFungibleAssetBalances,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetCurrentFungibleAssetBalancesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCurrentFungibleAssetBalances\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nexport async function transferFungibleAsset(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddress;\n recipient: AccountAddress;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::primary_fungible_store::transfer\",\n typeArguments: [\"0x1::fungible_asset::Metadata\"],\n functionArguments: [fungibleAssetMetadataAddress, recipient, amount],\n },\n options,\n });\n return transaction;\n}\n"],"mappings":"oIAuCA,eAAsBA,EAAyBC,EAGD,CAC5C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBF,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA4C,CAC7D,YAAAJ,EACA,MAAOE,EACP,aAAc,0BAChB,CAAC,GAEW,uBACd,CAEA,eAAsBG,EAA2BN,EAGD,CAC9C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOI,EACP,UAAW,CACT,gBAAiBL,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA8C,CAC/D,YAAAJ,EACA,MAAOE,EACP,aAAc,4BAChB,CAAC,GAEW,yBACd,CAEA,eAAsBK,EAAgCR,EAGD,CACnD,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOM,EACP,UAAW,CACT,gBAAiBP,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAAmD,CACpE,YAAAJ,EACA,MAAOE,EACP,aAAc,iCAChB,CAAC,GAEW,+BACd,CAEA,eAAsBO,EAAsBV,EAOb,CAC7B,GAAM,CAAE,YAAAC,EAAa,OAAAU,EAAQ,6BAAAC,EAA8B,UAAAC,EAAW,OAAAC,EAAQ,QAAAZ,CAAQ,EAAIF,EAW1F,OAVoB,MAAMe,EAAoB,CAC5C,YAAAd,EACA,OAAQU,EAAO,eACf,KAAM,CACJ,SAAU,wCACV,cAAe,CAAC,+BAA+B,EAC/C,kBAAmB,CAACC,EAA8BC,EAAWC,CAAM,CACrE,EACA,QAAAZ,CACF,CAAC,CAEH","names":["getFungibleAssetMetadata","args","aptosConfig","options","graphqlQuery","GetFungibleAssetMetadata","queryIndexer","getFungibleAssetActivities","GetFungibleAssetActivities","getCurrentFungibleAssetBalances","GetCurrentFungibleAssetBalances","transferFungibleAsset","sender","fungibleAssetMetadataAddress","recipient","amount","generateTransaction"]}
@@ -0,0 +1,2 @@
1
+ function o(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,t)},e}function u(a,i,e){let r=e.value;return e.value=async function(...t){let[n]=t;if(n.transaction.feePayerAddress&&!n.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,t)},e}export{o as a,u as b};
2
+ //# sourceMappingURL=chunk-6EMN3BOV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/helpers.ts"],"sourcesContent":["export function ValidateFeePayerDataOnSubmission(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n const [methodArgs] = args;\n\n if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerAuthenticator) {\n throw new Error(\"You are submitting a Fee Payer transaction but missing the feePayerAuthenticator\");\n }\n\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n\nexport function ValidateFeePayerDataOnSimulation(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n const [methodArgs] = args;\n\n if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerPublicKey) {\n throw new Error(\"You are simulating a Fee Payer transaction but missing the feePayerPublicKey\");\n }\n\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n"],"mappings":"AAAO,SAASA,EAAiCC,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,GAAM,CAACC,CAAU,EAAID,EAErB,GAAIC,EAAW,YAAY,iBAAmB,CAACA,EAAW,sBACxD,MAAM,IAAI,MAAM,kFAAkF,EAGpG,OAAOF,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT,CAEO,SAASI,EAAiCN,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,GAAM,CAACC,CAAU,EAAID,EAErB,GAAIC,EAAW,YAAY,iBAAmB,CAACA,EAAW,kBACxD,MAAM,IAAI,MAAM,8EAA8E,EAGhG,OAAOF,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT","names":["ValidateFeePayerDataOnSubmission","target","propertyKey","descriptor","originalMethod","args","methodArgs","ValidateFeePayerDataOnSimulation"]}
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-6EMN3BOV.mjs";import{g as a}from"./chunk-VBUKPN4Q.mjs";import{a as o}from"./chunk-ZWH2ESXT.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
2
+ //# sourceMappingURL=chunk-6MKBROIC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/submit.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { submitTransaction } from \"../../internal/transactionSubmission\";\nimport { AccountAuthenticator, AnyRawTransaction } from \"../../transactions\";\nimport { PendingTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSubmission } from \"./helpers\";\n\n/**\n * A class to handle all `Submit` transaction operations\n */\nexport class Submit {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Submit a simple transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async simple(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Submit a multi agent transaction\n *\n * @param args.transaction An instance of a raw transaction\n * @param args.senderAuthenticator optional. The sender account authenticator\n * @param args.additionalSignersAuthenticators An array of the secondary signers account authenticators\n * @param args.feePayerAuthenticator optional. The fee payer account authenticator if it is a fee payer transaction\n *\n * @returns PendingTransactionResponse\n */\n @ValidateFeePayerDataOnSubmission\n async multiAgent(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n additionalSignersAuthenticators: Array<AccountAuthenticator>;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2HAYO,IAAMA,EAAN,KAAa,CAGlB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAYA,MAAM,OAAOC,EAI2B,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CAaA,MAAM,WAAWA,EAKuB,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CACF,EA3BQE,EAAA,CADLC,GAhBUL,EAiBL,sBAmBAI,EAAA,CADLC,GAnCUL,EAoCL","names":["Submit","config","args","submitTransaction","__decorateClass","ValidateFeePayerDataOnSubmission"]}
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-BDTDWLGO.mjs";import{a as o,b as c}from"./chunk-U6Z4FNB7.mjs";import{a as h,h as d}from"./chunk-7IY2Y73Q.mjs";import{f as u}from"./chunk-X7QBDRQR.mjs";var p="fulfilled",f=class{constructor(t,n,e=30,s=100,r=10){this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=n,this.started=!1,this.accountSequnceNumber=new l(t,n,e,s,r)}async submitNextTransaction(){try{for(;;){if(this.transactionsQueue.isEmpty())return;let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let n=await this.generateNextTransaction(this.account,t);if(!n)return;let e=d({aptosConfig:this.aptosConfig,transaction:n,signer:this.account});await this.outstandingTransactions.enqueue([e,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],n=[],[e,s]=await this.outstandingTransactions.dequeue();for(t.push(e),n.push(s);!this.outstandingTransactions.isEmpty();)[e,s]=await this.outstandingTransactions.dequeue(),t.push(e),n.push(s);let r=await Promise.allSettled(t);for(let a=0;a<r.length&&a<n.length;a+=1){let i=r[a];s=n[a],i.status===p?(this.sentTransactions.push([i.value.hash,s,null]),await this.checkTransaction(i,s)):this.sentTransactions.push([i.status,s,i.reason])}}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,n){try{let e=[];e.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let s=await Promise.allSettled(e);for(let r=0;r<s.length;r+=1){let a=s[r];a.status===p?this.executedTransactions.push([a.value.hash,n,null]):this.executedTransactions.push([a.status,n,a.reason])}}catch(e){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async push(t,n){await this.transactionsQueue.enqueue([t,n])}async generateNextTransaction(t,n){if(this.transactionsQueue.isEmpty())return;let[e,s]=await this.transactionsQueue.dequeue();return await h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:e,options:{...s,accountSequenceNumber:n}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{f as a};
2
- //# sourceMappingURL=chunk-DYJVDOBH.mjs.map
1
+ import{a as l}from"./chunk-KH3M3YPI.mjs";import{a as o,b as c}from"./chunk-U6Z4FNB7.mjs";import{a as h,h as d}from"./chunk-VBUKPN4Q.mjs";import{f as u}from"./chunk-BUM2FIHF.mjs";var p="fulfilled",f=class{constructor(t,n,e=30,s=100,r=10){this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=n,this.started=!1,this.accountSequnceNumber=new l(t,n,e,s,r)}async submitNextTransaction(){try{for(;;){if(this.transactionsQueue.isEmpty())return;let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let n=await this.generateNextTransaction(this.account,t);if(!n)return;let e=d({aptosConfig:this.aptosConfig,transaction:n,signer:this.account});await this.outstandingTransactions.enqueue([e,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],n=[],[e,s]=await this.outstandingTransactions.dequeue();for(t.push(e),n.push(s);!this.outstandingTransactions.isEmpty();)[e,s]=await this.outstandingTransactions.dequeue(),t.push(e),n.push(s);let r=await Promise.allSettled(t);for(let a=0;a<r.length&&a<n.length;a+=1){let i=r[a];s=n[a],i.status===p?(this.sentTransactions.push([i.value.hash,s,null]),await this.checkTransaction(i,s)):this.sentTransactions.push([i.status,s,i.reason])}}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,n){try{let e=[];e.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let s=await Promise.allSettled(e);for(let r=0;r<s.length;r+=1){let a=s[r];a.status===p?this.executedTransactions.push([a.value.hash,n,null]):this.executedTransactions.push([a.status,n,a.reason])}}catch(e){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async push(t,n){await this.transactionsQueue.enqueue([t,n])}async generateNextTransaction(t,n){if(this.transactionsQueue.isEmpty())return;let[e,s]=await this.transactionsQueue.dequeue();return await h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:e,options:{...s,accountSequenceNumber:n}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{f as a};
2
+ //# sourceMappingURL=chunk-AS7RX4RK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/management/transactionWorker.ts"],"sourcesContent":["/* eslint-disable no-await-in-loop */\n\n/**\n * TransactionWorker provides a simple framework for receiving payloads to be processed.\n *\n * Once one `start()` the process and pushes a new transaction, the worker acquires\n * the current account's next sequence number (by using the AccountSequenceNumber class),\n * generates a signed transaction and pushes an async submission process into the `outstandingTransactions` queue.\n * At the same time, the worker processes transactions by reading the `outstandingTransactions` queue\n * and submits the next transaction to chain, it\n * 1) waits for resolution of the submission process or get pre-execution validation error\n * and 2) waits for the resolution of the execution process or get an execution error.\n * The worker fires events for any submission and/or execution success and/or failure.\n */\n\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { Account } from \"../../core\";\nimport { waitForTransaction } from \"../../internal/transaction\";\nimport { generateTransaction, signAndSubmitTransaction } from \"../../internal/transactionSubmission\";\nimport { PendingTransactionResponse, TransactionResponse } from \"../../types\";\nimport { InputGenerateTransactionOptions, InputGenerateTransactionPayloadData, SimpleTransaction } from \"../types\";\nimport { AccountSequenceNumber } from \"./accountSequenceNumber\";\nimport { AsyncQueue, AsyncQueueCancelledError } from \"./asyncQueue\";\n\nconst promiseFulfilledStatus = \"fulfilled\";\n\nexport class TransactionWorker {\n readonly aptosConfig: AptosConfig;\n\n readonly account: Account;\n\n // current account sequence number\n readonly accountSequnceNumber: AccountSequenceNumber;\n\n readonly taskQueue: AsyncQueue<() => Promise<void>> = new AsyncQueue<() => Promise<void>>();\n\n // process has started\n started: boolean;\n\n /**\n * transactions payloads waiting to be generated and signed\n *\n * TODO support entry function payload from ABI builder\n */\n transactionsQueue = new AsyncQueue<\n [InputGenerateTransactionPayloadData, InputGenerateTransactionOptions | undefined]\n >();\n\n /**\n * signed transactions waiting to be submitted\n */\n outstandingTransactions = new AsyncQueue<[Promise<PendingTransactionResponse>, bigint]>();\n\n /**\n * transactions that have been submitted to chain\n */\n sentTransactions: Array<[string, bigint, any]> = [];\n\n /**\n * transactions that have been committed to chain\n */\n executedTransactions: Array<[string, bigint, any]> = [];\n\n /**\n * Provides a simple framework for receiving payloads to be processed.\n *\n * @param aptosConfig - a config object\n * @param sender - a sender as Account\n * @param maxWaitTime - the max wait time to wait before resyncing the sequence number\n * to the current on-chain state, default to 30\n * @param maximumInFlight - submit up to `maximumInFlight` transactions per account.\n * Mempool limits the number of transactions per account to 100, hence why we default to 100.\n * @param sleepTime - If `maximumInFlight` are in flight, wait `sleepTime` seconds before re-evaluating, default to 10\n */\n constructor(\n aptosConfig: AptosConfig,\n account: Account,\n maxWaitTime: number = 30,\n maximumInFlight: number = 100,\n sleepTime: number = 10,\n ) {\n this.aptosConfig = aptosConfig;\n this.account = account;\n this.started = false;\n this.accountSequnceNumber = new AccountSequenceNumber(\n aptosConfig,\n account,\n maxWaitTime,\n maximumInFlight,\n sleepTime,\n );\n }\n\n /**\n * Gets the current account sequence number,\n * generates the transaction with the account sequence number,\n * adds the transaction to the outstanding transaction queue\n * to be processed later.\n */\n async submitNextTransaction() {\n try {\n /* eslint-disable no-constant-condition */\n while (true) {\n if (this.transactionsQueue.isEmpty()) return;\n const sequenceNumber = await this.accountSequnceNumber.nextSequenceNumber();\n if (sequenceNumber === null) return;\n const transaction = await this.generateNextTransaction(this.account, sequenceNumber);\n if (!transaction) return;\n const pendingTransaction = signAndSubmitTransaction({\n aptosConfig: this.aptosConfig,\n transaction,\n signer: this.account,\n });\n await this.outstandingTransactions.enqueue([pendingTransaction, sequenceNumber]);\n }\n } catch (error: any) {\n if (error instanceof AsyncQueueCancelledError) {\n return;\n }\n throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Reads the outstanding transaction queue and submits the transaction to chain.\n *\n * If the transaction has fulfilled, it pushes the transaction to the processed\n * transactions queue and fires a transactionsFulfilled event.\n *\n * If the transaction has failed, it pushes the transaction to the processed\n * transactions queue with the failure reason and fires a transactionsFailed event.\n */\n async processTransactions() {\n try {\n /* eslint-disable no-constant-condition */\n while (true) {\n const awaitingTransactions = [];\n const sequenceNumbers = [];\n let [pendingTransaction, sequenceNumber] = await this.outstandingTransactions.dequeue();\n\n awaitingTransactions.push(pendingTransaction);\n sequenceNumbers.push(sequenceNumber);\n\n while (!this.outstandingTransactions.isEmpty()) {\n [pendingTransaction, sequenceNumber] = await this.outstandingTransactions.dequeue();\n\n awaitingTransactions.push(pendingTransaction);\n sequenceNumbers.push(sequenceNumber);\n }\n // send awaiting transactions to chain\n const sentTransactions = await Promise.allSettled(awaitingTransactions);\n for (let i = 0; i < sentTransactions.length && i < sequenceNumbers.length; i += 1) {\n // check sent transaction status\n const sentTransaction = sentTransactions[i];\n sequenceNumber = sequenceNumbers[i];\n if (sentTransaction.status === promiseFulfilledStatus) {\n // transaction sent to chain\n this.sentTransactions.push([sentTransaction.value.hash, sequenceNumber, null]);\n // check sent transaction execution\n await this.checkTransaction(sentTransaction, sequenceNumber);\n } else {\n // send transaction failed\n this.sentTransactions.push([sentTransaction.status, sequenceNumber, sentTransaction.reason]);\n }\n }\n }\n } catch (error: any) {\n if (error instanceof AsyncQueueCancelledError) {\n return;\n }\n throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Once transaction has been sent to chain, we check for its execution status.\n * @param sentTransaction transactions that were sent to chain and are now waiting to be executed\n * @param sequenceNumber the account's sequence number that was sent with the transaction\n */\n async checkTransaction(sentTransaction: PromiseFulfilledResult<PendingTransactionResponse>, sequenceNumber: bigint) {\n try {\n const waitFor: Array<Promise<TransactionResponse>> = [];\n waitFor.push(waitForTransaction({ aptosConfig: this.aptosConfig, transactionHash: sentTransaction.value.hash }));\n const sentTransactions = await Promise.allSettled(waitFor);\n\n for (let i = 0; i < sentTransactions.length; i += 1) {\n const executedTransaction = sentTransactions[i];\n if (executedTransaction.status === promiseFulfilledStatus) {\n // transaction executed to chain\n this.executedTransactions.push([executedTransaction.value.hash, sequenceNumber, null]);\n } else {\n // transaction execution failed\n this.executedTransactions.push([executedTransaction.status, sequenceNumber, executedTransaction.reason]);\n }\n }\n } catch (error: any) {\n throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${error}`);\n }\n }\n\n /**\n * Push transaction to the transactions queue\n * @param payload Transaction payload\n */\n async push(\n transactionData: InputGenerateTransactionPayloadData,\n options?: InputGenerateTransactionOptions,\n ): Promise<void> {\n await this.transactionsQueue.enqueue([transactionData, options]);\n }\n\n /**\n * Generates a signed transaction that can be submitted to chain\n * @param account an Aptos account\n * @param sequenceNumber a sequence number the transaction will be generated with\n * @returns\n */\n async generateNextTransaction(account: Account, sequenceNumber: bigint): Promise<SimpleTransaction | undefined> {\n if (this.transactionsQueue.isEmpty()) return undefined;\n const [transactionData, options] = await this.transactionsQueue.dequeue();\n const transaction = await generateTransaction({\n aptosConfig: this.aptosConfig,\n sender: account.accountAddress,\n data: transactionData,\n options: { ...options, accountSequenceNumber: sequenceNumber },\n });\n\n return transaction;\n }\n\n /**\n * Starts transaction submission and transaction processing.\n */\n async run() {\n try {\n while (!this.taskQueue.isCancelled()) {\n const task = await this.taskQueue.dequeue();\n await task();\n }\n } catch (error: any) {\n throw new Error(`Unable to start transaction batching: ${error}`);\n }\n }\n\n /**\n * Starts the transaction management process.\n */\n start() {\n if (this.started) {\n throw new Error(\"worker has already started\");\n }\n this.started = true;\n this.taskQueue.enqueue(() => this.submitNextTransaction());\n this.taskQueue.enqueue(() => this.processTransactions());\n this.run();\n }\n\n /**\n * Stops the the transaction management process.\n */\n stop() {\n if (this.taskQueue.isCancelled()) {\n throw new Error(\"worker has already stopped\");\n }\n this.started = false;\n this.taskQueue.cancel();\n }\n}\n"],"mappings":"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","names":["promiseFulfilledStatus","TransactionWorker","aptosConfig","account","maxWaitTime","maximumInFlight","sleepTime","AsyncQueue","AccountSequenceNumber","sequenceNumber","transaction","pendingTransaction","signAndSubmitTransaction","error","AsyncQueueCancelledError","awaitingTransactions","sequenceNumbers","sentTransactions","i","sentTransaction","waitFor","waitForTransaction","executedTransaction","transactionData","options","generateTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a as d}from"./chunk-3JPVQHOR.mjs";import{a as A}from"./chunk-AH44UPM4.mjs";import{i as w,j as C}from"./chunk-5IVRKK5V.mjs";import{b as c,c as l}from"./chunk-NFGAZSSK.mjs";import{e as y}from"./chunk-EOC4UI5B.mjs";import{a as h}from"./chunk-6FBKUTGF.mjs";async function L(o){let{aptosConfig:n,options:t}=o;return l({aptosConfig:n,originMethod:"getTransactions",path:"transactions",params:{start:t?.offset,limit:t?.limit}})}async function v(o){let{aptosConfig:n}=o;return A(async()=>{let{data:t}=await c({aptosConfig:n,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${n.network}`,1e3*60*5)()}async function B(o){let{aptosConfig:n,ledgerVersion:t}=o,{data:s}=await c({aptosConfig:n,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return s}async function x(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await c({aptosConfig:n,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return s}async function N(o){let{aptosConfig:n,transactionHash:t}=o;try{return(await x({aptosConfig:n,transactionHash:t})).type==="pending_transaction"}catch(s){if(s?.status===404)return!0;throw s}}async function G(o){let{aptosConfig:n,transactionHash:t,options:s}=o,r=s?.timeoutSecs??y,f=s?.checkSuccess??!0,i=!0,u=0,e,g,m=200,P=1.5;for(;i&&!(u>=r);){try{if(e=await x({aptosConfig:n,transactionHash:t}),i=e.type==="pending_transaction",!i)break}catch(a){if(!(a instanceof h)||(g=a,a.status!==404&&a.status>=400&&a.status<500))throw a}await d(m),u+=m/1e3,m*=P}if(e===void 0)throw g||new p(`Fetching transaction ${t} failed and timed out after ${r} seconds`,e);if(e.type==="pending_transaction")throw new p(`Transaction ${t} timed out in pending state after ${r} seconds`,e);if(!f)return e;if(!e.success)throw new T(`Transaction ${t} failed with an error: ${e.vm_status}`,e);return e}async function D(o){let{aptosConfig:n,processorType:t}=o,s=BigInt(o.minimumLedgerVersion),r=3e3,f=new Date().getTime(),i=-1;for(;i<s;){if(new Date().getTime()-f>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?i=await w({aptosConfig:n}):i=(await C({aptosConfig:n,processorType:t})).last_success_version,i>=s)break;await d(200)}}var p=class extends Error{constructor(t,s){super(t);this.lastSubmittedTransaction=s}},T=class extends Error{constructor(t,s){super(t);this.transaction=s}};export{L as a,v as b,B as c,x as d,N as e,G as f,D as g,p as h,T as i};
2
- //# sourceMappingURL=chunk-X7QBDRQR.mjs.map
1
+ import{a as d}from"./chunk-3JPVQHOR.mjs";import{a as A}from"./chunk-AH44UPM4.mjs";import{i as w,j as C}from"./chunk-SR7XLV76.mjs";import{b as c,c as l}from"./chunk-UZB7CTLX.mjs";import{a as h}from"./chunk-6FBKUTGF.mjs";import{e as y}from"./chunk-EOC4UI5B.mjs";async function L(o){let{aptosConfig:n,options:t}=o;return l({aptosConfig:n,originMethod:"getTransactions",path:"transactions",params:{start:t?.offset,limit:t?.limit}})}async function v(o){let{aptosConfig:n}=o;return A(async()=>{let{data:t}=await c({aptosConfig:n,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${n.network}`,1e3*60*5)()}async function B(o){let{aptosConfig:n,ledgerVersion:t}=o,{data:s}=await c({aptosConfig:n,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return s}async function x(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await c({aptosConfig:n,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return s}async function N(o){let{aptosConfig:n,transactionHash:t}=o;try{return(await x({aptosConfig:n,transactionHash:t})).type==="pending_transaction"}catch(s){if(s?.status===404)return!0;throw s}}async function G(o){let{aptosConfig:n,transactionHash:t,options:s}=o,r=s?.timeoutSecs??y,f=s?.checkSuccess??!0,i=!0,u=0,e,g,m=200,P=1.5;for(;i&&!(u>=r);){try{if(e=await x({aptosConfig:n,transactionHash:t}),i=e.type==="pending_transaction",!i)break}catch(a){if(!(a instanceof h)||(g=a,a.status!==404&&a.status>=400&&a.status<500))throw a}await d(m),u+=m/1e3,m*=P}if(e===void 0)throw g||new p(`Fetching transaction ${t} failed and timed out after ${r} seconds`,e);if(e.type==="pending_transaction")throw new p(`Transaction ${t} timed out in pending state after ${r} seconds`,e);if(!f)return e;if(!e.success)throw new T(`Transaction ${t} failed with an error: ${e.vm_status}`,e);return e}async function D(o){let{aptosConfig:n,processorType:t}=o,s=BigInt(o.minimumLedgerVersion),r=3e3,f=new Date().getTime(),i=-1;for(;i<s;){if(new Date().getTime()-f>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?i=await w({aptosConfig:n}):i=(await C({aptosConfig:n,processorType:t})).last_success_version,i>=s)break;await d(200)}}var p=class extends Error{constructor(t,s){super(t);this.lastSubmittedTransaction=s}},T=class extends Error{constructor(t,s){super(t);this.transaction=s}};export{L as a,v as b,B as c,x as d,N as e,G as f,D as g,p as h,T as i};
2
+ //# sourceMappingURL=chunk-BUM2FIHF.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as t}from"./chunk-VBUKPN4Q.mjs";var o=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{o as a};
2
+ //# sourceMappingURL=chunk-BV6SCEXY.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/build.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddressInput } from \"../../core\";\nimport { generateTransaction } from \"../../internal/transactionSubmission\";\nimport {\n InputGenerateTransactionPayloadData,\n InputGenerateTransactionOptions,\n SimpleTransaction,\n MultiAgentTransaction,\n} from \"../../transactions\";\nimport { AptosConfig } from \"../aptosConfig\";\n\n/**\n * A class to handle all `Build` transaction operations\n */\nexport class Build {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Build a simple transaction\n *\n * @param args.sender The sender account address\n * @param args.data The transaction data\n * @param args.options optional. Optional transaction configurations\n * @param args.withFeePayer optional. Whether there is a fee payer for the transaction\n *\n * @returns SimpleTransaction\n */\n async simple(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Build a multi agent transaction\n *\n * @param args.sender The sender account address\n * @param args.data The transaction data\n * @param args.secondarySignerAddresses An array of the secondary signers account addresses\n * @param args.options optional. Optional transaction configurations\n * @param args.withFeePayer optional. Whether there is a fee payer for the transaction\n *\n * @returns MultiAgentTransaction\n */\n async multiAgent(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n secondarySignerAddresses: AccountAddressInput[];\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<MultiAgentTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"yCAgBO,IAAMA,EAAN,KAAY,CAGjB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAYA,MAAM,OAAOC,EAKkB,CAC7B,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CAaA,MAAM,WAAWA,EAMkB,CACjC,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF","names":["Build","config","args","generateTransaction"]}
@@ -1,2 +1,2 @@
1
- import{b as r}from"./chunk-UR5E2UDO.mjs";import{g as d}from"./chunk-5IVRKK5V.mjs";import{q as c}from"./chunk-BQSE5HHW.mjs";async function v(o){let{accountAddress:t,aptosConfig:e,creationNumber:n}=o,i={account_address:{_eq:r.from(t).toStringLong()},creation_number:{_eq:n}};return p({aptosConfig:e,options:{where:i}})}async function y(o){let{accountAddress:t,aptosConfig:e,eventType:n,options:s}=o,a={where:{account_address:{_eq:r.from(t).toStringLong()},indexed_type:{_eq:n}},pagination:s,orderBy:s?.orderBy};return p({aptosConfig:e,options:a})}async function p(o){let{aptosConfig:t,options:e}=o,n={query:c,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:t,query:n,originMethod:"getEvents"})).events}export{v as a,y as b,p as c};
2
- //# sourceMappingURL=chunk-CBAVJ5EN.mjs.map
1
+ import{b as r}from"./chunk-UR5E2UDO.mjs";import{g as d}from"./chunk-SR7XLV76.mjs";import{q as c}from"./chunk-BQSE5HHW.mjs";async function v(o){let{accountAddress:t,aptosConfig:e,creationNumber:n}=o,i={account_address:{_eq:r.from(t).toStringLong()},creation_number:{_eq:n}};return p({aptosConfig:e,options:{where:i}})}async function y(o){let{accountAddress:t,aptosConfig:e,eventType:n,options:s}=o,a={where:{account_address:{_eq:r.from(t).toStringLong()},indexed_type:{_eq:n}},pagination:s,orderBy:s?.orderBy};return p({aptosConfig:e,options:a})}async function p(o){let{aptosConfig:t,options:e}=o,n={query:c,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:t,query:n,originMethod:"getEvents"})).events}export{v as a,y as b,p as c};
2
+ //# sourceMappingURL=chunk-D2XLC3KK.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as r,b as i,c as o,d as a,e as c,f as p,g as d,h as u,i as g,j as A,k as y,l as T,m as l,n as m,o as f,p as I,q as P,r as C,s as D,t as O,u as V}from"./chunk-VA4K6DEK.mjs";import{a as e}from"./chunk-T3ID6KFN.mjs";var S=class{constructor(t){this.config=t}async getCollectionData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:n(t.options?.tokenStandard)}),p({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:n(t.options?.tokenStandard)}),d({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:n(void 0)}),r({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:n(void 0)}),i({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:n(void 0)}),o({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:n(void 0)}),a({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return c({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return u({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return g({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return A({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return y({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return T({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return l({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return m({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return f({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return I({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return P({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return C({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return D({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return O({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return V({aptosConfig:this.config,...t})}};function n(s){switch(s){case"v1":return["token_processor"];case"v2":return["token_v2_processor"];default:return["token_processor","token_v2_processor"]}}export{S as a};
2
+ //# sourceMappingURL=chunk-EMQWD6KP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/digitalAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AnyNumber,\n GetCollectionDataResponse,\n GetCurrentTokenOwnershipResponse,\n GetOwnedTokensResponse,\n GetTokenActivityResponse,\n GetTokenDataResponse,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandard,\n TokenStandardArg,\n} from \"../types\";\nimport { Account, AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions/types\";\nimport {\n addDigitalAssetPropertyTransaction,\n addDigitalAssetTypedPropertyTransaction,\n burnDigitalAssetTransaction,\n CreateCollectionOptions,\n createCollectionTransaction,\n freezeDigitalAssetTransaferTransaction,\n getCollectionData,\n getCollectionId,\n getCurrentDigitalAssetOwnership,\n getDigitalAssetActivity,\n getDigitalAssetData,\n getOwnedDigitalAssets,\n mintDigitalAssetTransaction,\n mintSoulBoundTransaction,\n PropertyType,\n PropertyValue,\n removeDigitalAssetPropertyTransaction,\n setDigitalAssetDescriptionTransaction,\n setDigitalAssetNameTransaction,\n setDigitalAssetURITransaction,\n transferDigitalAssetTransaction,\n unfreezeDigitalAssetTransaferTransaction,\n updateDigitalAssetPropertyTransaction,\n updateDigitalAssetTypedPropertyTransaction,\n} from \"../internal/digitalAsset\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\n\n/**\n * A class to query all `DigitalAsset` related queries on Aptos.\n */\nexport class DigitalAsset {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries data of a specific collection by the collection creator address and the collection name.\n *\n * If, for some reason, a creator account has 2 collections with the same name in v1 and v2,\n * can pass an optional `tokenStandard` parameter to query a specific standard\n *\n * @param args.creatorAddress the address of the collection's creator\n * @param args.collectionName the name of the collection\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard the token standard to query\n * @returns GetCollectionDataResponse response type\n */\n async getCollectionData(args: {\n creatorAddress: AccountAddressInput;\n collectionName: string;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg;\n }): Promise<GetCollectionDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorTypes: getTokenProcessorTypes(args.options?.tokenStandard),\n });\n return getCollectionData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a collection's ID.\n *\n * This is the same as the collection's object address in V2, but V1 does\n * not use objects, and does not have an address\n *\n * @param args.creatorAddress the address of the collection's creator\n * @param args.collectionName the name of the collection\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard the token standard to query\n * @returns the collection id\n */\n async getCollectionId(args: {\n creatorAddress: AccountAddressInput;\n collectionName: string;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg;\n }): Promise<string> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorTypes: getTokenProcessorTypes(args.options?.tokenStandard),\n });\n return getCollectionId({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets digital asset data given the address of a digital asset.\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns GetTokenDataResponse containing relevant data to the digital asset.\n */\n async getDigitalAssetData(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetTokenDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n // TODO(greg): Should take in a consistent input for token queries\n processorTypes: getTokenProcessorTypes(undefined),\n });\n return getDigitalAssetData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets digital asset ownership data given the address of a digital asset.\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset.\n */\n async getCurrentDigitalAssetOwnership(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetCurrentTokenOwnershipResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n // TODO(greg): Should take in a consistent input for token queries\n processorTypes: getTokenProcessorTypes(undefined),\n });\n return getCurrentDigitalAssetOwnership({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets the digital assets that the given address owns.\n *\n * @param args.ownerAddress The address of the owner\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddresss.\n */\n async getOwnedDigitalAssets(args: {\n ownerAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetOwnedTokensResponse[0]>;\n }): Promise<GetOwnedTokensResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n // TODO(greg): Should take in a consistent input for token queries\n processorTypes: getTokenProcessorTypes(undefined),\n });\n return getOwnedDigitalAssets({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets the activity data given the address of a digital asset.\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetTokenActivityResponse containing relevant activity data to the digital asset.\n */\n async getDigitalAssetActivity(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;\n }): Promise<GetTokenActivityResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n // TODO(greg): Should take in a consistent input for token queries\n processorTypes: getTokenProcessorTypes(undefined),\n });\n return getDigitalAssetActivity({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Creates a new collection within the specified account\n *\n * @param args.creator the account of the collection's creator\n * @param args.description the description of the collection\n * @param args.name the name of the collection\n * @param args.uri the URI to additional info about the collection\n *\n * The parameters below are optional.\n * @param args.maxSupply controls the max supply of the digital assets - defaults MAX_U64_BIG_INT\n * @param args.mutableDescription controls mutability of the collection's description - defaults true\n * @param args.mutableRoyalty controls mutability of the collection's description - defaults true\n * @param args.mutableUri controls mutability of the collection's URI - defaults true\n * @param args.mutableTokenDescription controls mutability of the digital asset's description - defaults true\n * @param args.mutableTokenName controls mutability of the digital asset's name - defaults true\n * @param args.mutableTokenProperties controls mutability of digital asset's properties - defaults true\n * @param args.mutableTokenUri controls mutability of the digital asset's URI - defaults true\n * @param args.tokensBurnableByCreator controls whether digital assets can be burnable by the creator - defaults true\n * @param args.tokensFreezableByCreator controls whether digital assets can be frozen by the creator - defaults true\n * @param args.royaltyNumerator the numerator of the royalty to be paid to the creator when\n * a digital asset is transferred - defaults 0\n * @param args.royaltyDenominator the denominator of the royalty to be paid to the creator\n * when a digital asset is transferred - defaults 1\n *\n * @returns A SimpleTransaction that when submitted will create the collection.\n */\n async createCollectionTransaction(\n args: {\n creator: Account;\n description: string;\n name: string;\n uri: string;\n options?: InputGenerateTransactionOptions;\n } & CreateCollectionOptions,\n ): Promise<SimpleTransaction> {\n return createCollectionTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Create a transaction to mint a digital asset into the creators account within an existing collection.\n *\n * @param args.creator the creator of the collection\n * @param args.collection the name of the collection the digital asset belongs to\n * @param args.description the description of the digital asset\n * @param args.name the name of the digital asset\n * @param args.uri the URI to additional info about the digital asset\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async mintDigitalAssetTransaction(args: {\n creator: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return mintDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Transfer a digital asset (non fungible digital asset) ownership.\n *\n * We can transfer a digital asset only when the digital asset is not frozen\n * (i.e. owner transfer is not disabled such as for soul bound digital assets)\n *\n * @param args.sender The sender account of the current digital asset owner\n * @param args.digitalAssetAddress The digital asset address\n * @param args.recipient The recipient account address\n * @param args.digitalAssetType optional. The digital asset type, default to \"0x4::token::Token\"\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async transferDigitalAssetTransaction(args: {\n sender: Account;\n digitalAssetAddress: AccountAddressInput;\n recipient: AccountAddress;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Mint a soul bound digital asset into a recipient's account\n *\n * @param args.account The account that mints the digital asset\n * @param args.collection The collection name that the digital asset belongs to\n * @param args.description The digital asset description\n * @param args.name The digital asset name\n * @param args.uri The digital asset URL\n * @param args.recipient The account address where the digital asset will be created\n * @param args.propertyKeys The property keys for storing on-chain properties\n * @param args.propertyTypes The type of property values\n * @param args.propertyValues The property values to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async mintSoulBoundTransaction(args: {\n account: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n recipient: AccountAddress;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return mintSoulBoundTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Burn a digital asset by its creator\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async burnDigitalAssetTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return burnDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Freeze digital asset transfer ability\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async freezeDigitalAssetTransaferTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return freezeDigitalAssetTransaferTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Unfreeze digital asset transfer ability\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async unfreezeDigitalAssetTransaferTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return unfreezeDigitalAssetTransaferTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset description\n *\n * @param args.creator The creator account\n * @param args.description The digital asset description\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetDescriptionTransaction(args: {\n creator: Account;\n description: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetDescriptionTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset name\n *\n * @param args.creator The creator account\n * @param args.name The digital asset name\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetNameTransaction(args: {\n creator: Account;\n name: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetNameTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset name\n *\n * @param args.creator The creator account\n * @param args.uri The digital asset uri\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetURITransaction(args: {\n creator: Account;\n uri: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetURITransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Add a digital asset property\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async addDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return addDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Remove a digital asset property\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async removeDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return removeDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Update a digital asset property\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async updateDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return updateDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Add a typed digital asset property\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async addDigitalAssetTypedPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return addDigitalAssetTypedPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Update a typed digital asset property\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async updateDigitalAssetTypedPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return updateDigitalAssetTypedPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n}\n\nfunction getTokenProcessorTypes(tokenStandard?: TokenStandard) {\n switch (tokenStandard) {\n case \"v1\":\n return [ProcessorType.TOKEN_PROCESSOR];\n case \"v2\":\n return [ProcessorType.TOKEN_V2_PROCESSOR];\n default:\n // If it's something we don't recognize, or undefined, just do both\n return [ProcessorType.TOKEN_PROCESSOR, ProcessorType.TOKEN_V2_PROCESSOR];\n }\n}\n"],"mappings":"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","names":["DigitalAsset","config","args","waitForIndexerOnVersion","getTokenProcessorTypes","getCollectionData","getCollectionId","getDigitalAssetData","getCurrentDigitalAssetOwnership","getOwnedDigitalAssets","getDigitalAssetActivity","createCollectionTransaction","mintDigitalAssetTransaction","transferDigitalAssetTransaction","mintSoulBoundTransaction","burnDigitalAssetTransaction","freezeDigitalAssetTransaferTransaction","unfreezeDigitalAssetTransaferTransaction","setDigitalAssetDescriptionTransaction","setDigitalAssetNameTransaction","setDigitalAssetURITransaction","addDigitalAssetPropertyTransaction","removeDigitalAssetPropertyTransaction","updateDigitalAssetPropertyTransaction","addDigitalAssetTypedPropertyTransaction","updateDigitalAssetTypedPropertyTransaction","tokenStandard"]}
@@ -0,0 +1,2 @@
1
+ import{f as n,g as s,h as t,i as o,j as r,k as i,l as a,m,n as c,o as g,p as u,q as p,r as d}from"./chunk-TTDCRLRD.mjs";var A=class{constructor(e){this.config=e}async getOwnerAddress(e){return n({aptosConfig:this.config,...e})}async getExpiration(e){return t({aptosConfig:this.config,...e})}async getTargetAddress(e){return i({aptosConfig:this.config,...e})}async setTargetAddress(e){return a({aptosConfig:this.config,...e})}async getPrimaryName(e){return o({aptosConfig:this.config,...e})}async setPrimaryName(e){return r({aptosConfig:this.config,...e})}async registerName(e){return s({aptosConfig:this.config,...e})}async renewDomain(e){return d({aptosConfig:this.config,...e})}async getName(e){return m({aptosConfig:this.config,...e})}async getAccountNames(e){return c({aptosConfig:this.config,...e})}async getAccountDomains(e){return g({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return u({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return p({aptosConfig:this.config,...e})}};export{A as a};
2
+ //# sourceMappingURL=chunk-HDNJ4JK4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/ans.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account, AccountAddressInput } from \"../core\";\nimport {\n RegisterNameParameters,\n getExpiration,\n getOwnerAddress,\n registerName,\n getPrimaryName,\n setPrimaryName,\n getTargetAddress,\n setTargetAddress,\n renewDomain,\n getName,\n getAccountDomains,\n GetAccountDomainsArgs,\n GetAccountSubdomainsArgs,\n getAccountSubdomains,\n getAccountNames,\n GetAccountNamesArgs,\n getDomainSubdomains,\n GetDomainSubdomainsArgs,\n} from \"../internal/ans\";\nimport { GetANSNameResponse, MoveAddressType } from \"../types\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions/types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to handle all `ANS` operations\n */\nexport class ANS {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Retrieve the owner address of a domain name or subdomain name from the contract.\n *\n * ```ts\n * // Will return the owner address of \"test.aptos.apt\" or undefined\n * const owner = await aptos.getOwnerAddress({name: \"test.aptos\"})\n * // owner = 0x123...\n * ```\n *\n * @param args.name - A string of the name to retrieve\n *\n * @returns MoveAddressType if the name is owned, undefined otherwise\n */\n async getOwnerAddress(args: { name: string }): Promise<MoveAddressType | undefined> {\n return getOwnerAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the expiration time of a domain name or subdomain name from the contract.\n *\n * ```ts\n * // Will return the expiration of \"test.aptos.apt\" or undefined\n * const exp = await aptos.getExpiration({name: \"test.aptos\"})\n * // new Date(exp) would give you the date in question: 2021-01-01T00:00:00.000Z\n * ```\n *\n * @param args.name - A string of the name to retrieve\n *\n * @returns number as a unix timestamp in milliseconds.\n */\n async getExpiration(args: { name: string }): Promise<number | undefined> {\n return getExpiration({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the target address of a domain or subdomain name. This is the\n * address the name points to for use on chain. Note, the target address can\n * point to addresses that are not the owner of the name\n *\n * ```ts\n * const targetAddr = await aptos.getTargetAddress({name: \"test.aptos\"})\n * // targetAddr = 0x123...\n * ```\n *\n * @param args.name - A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc.\n *\n * @returns MoveAddressType if the name has a target, undefined otherwise\n */\n async getTargetAddress(args: { name: string }): Promise<MoveAddressType | undefined> {\n return getTargetAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sets the target address of a domain or subdomain name. This is the\n * address the name points to for use on chain. Note, the target address can\n * point to addresses that are not the owner of the name\n *\n * ```ts\n * await aptos.setTargetAddress({sender: alice, name: \"test.aptos\", address: bob.accountAddress})\n * const address = await aptos.getTargetAddress({name: \"test.aptos\"})\n * // address = bob.accountAddress\n * ```\n *\n * @param args.name - A string of the name: test.aptos.apt, test.apt, test, test.aptos, etc.\n * @param args.address - A AccountAddressInput of the address to set the domain or subdomain to\n *\n * @returns SimpleTransaction\n */\n async setTargetAddress(args: {\n sender: Account;\n name: string;\n address: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return setTargetAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve the primary name for an account. An account can have\n * multiple names that target it, but only a single name that is primary. An\n * account also may not have a primary name.\n *\n * ```ts\n * const name = await aptos.getPrimaryName({address: alice.accountAddress})\n * // name = test.aptos\n * ```\n *\n * @param args.address - A AccountAddressInput (address) of the account\n *\n * @returns a string if the account has a primary name, undefined otherwise\n */\n async getPrimaryName(args: { address: AccountAddressInput }): Promise<string | undefined> {\n return getPrimaryName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sets the primary name for the sender. An account can have\n * multiple names that target it, but only a single name that is primary. An\n * account also may not have a primary name.\n *\n * ```ts\n * await aptos.setPrimaryName({sender: alice, name: \"test.aptos\"})\n * const primaryName = await aptos.getPrimaryName({address: alice.accountAddress})\n * // primaryName = test.aptos\n * ```\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the name: test, test.apt, test.aptos, test.aptos.apt, etc.\n *\n * @returns SimpleTransaction\n */\n async setPrimaryName(args: {\n sender: Account;\n name?: string;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return setPrimaryName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Registers a new name\n *\n * ```ts\n * // An example of registering a subdomain name assuming def.apt is already registered\n * // and belongs to the sender alice.\n * const txn = aptos.registerName({\n * sender: alice,\n * name: \"test.aptos.apt\",\n * expiration: {\n * policy: \"subdomain:independent\",\n * expirationDate: Date.now() + 30 * 24 * 60 * 60 * 1000,\n * },\n * });\n * ```\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the name to register. This can be inclusive or exclusive of the .apt suffix.\n * Examples include: \"test\", \"test.apt\", \"test.aptos.apt\", etc.\n * @param args.expiration - An object with the expiration policy of the name.\n * @param args.expiration.policy - 'domain' | 'subdomain:follow-domain' | 'subdomain:independent'\n * - domain: Years is required and the name will expire after the given number of years.\n * - subdomain:follow-domain: The name will expire at the same time as the domain name.\n * - subdomain:independent: The name will expire at the given date.\n * @param args.expiration.expirationDate - An epoch number in milliseconds of\n * the date when the subdomain will expire. Only applicable when the policy is\n * set to 'subdomain:independent'.\n * @param args.transferable - Determines if the subdomain being minted is soul-bound. Applicable only to subdomains.\n * @param args.targetAddress optional - The address the domain name will resolve to. If not provided,\n * the sender's address will be used.\n * @param args.toAddress optional - The address to send the domain name to. If not provided,\n * the transaction will be sent to the router.\n *\n * @returns SimpleTransaction\n */\n async registerName(args: Omit<RegisterNameParameters, \"aptosConfig\">): Promise<SimpleTransaction> {\n return registerName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Renews a domain name\n *\n * Note: If a domain name was minted with V1 of the contract, it will automatically be upgraded to V2 via this transaction.\n *\n * ```ts\n * await aptos.renewDomain({sender: alice, name: \"test\"})\n * // test.apt will be renewed for one year\n * ```\n *\n * @param args.sender - The sender account\n * @param args.name - A string of the domain the subdomain will be under. The signer must be the domain owner.\n * Subdomains cannot be renewed.\n * @param args.years - The number of years to renew the name. Currently only one year is permitted.\n *\n * @returns SimpleTransaction\n */\n async renewDomain(args: {\n sender: Account;\n name: string;\n years?: 1;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return renewDomain({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches a single name from the indexer\n * @param args.name - A string of the name to retrieve, e.g. \"test.aptos.apt\"\n * or \"test.apt\" or \"test\". Can be inclusive or exclusive of the .apt suffix.\n * Can be a subdomain.\n *\n * @returns A promise of an ANSName or undefined\n */\n async getName(args: { name: string }): Promise<GetANSNameResponse[0] | undefined> {\n return getName({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all names for an account (both top level domains and subdomains)\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountNames(args: GetAccountNamesArgs): Promise<GetANSNameResponse> {\n return getAccountNames({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all top level domain names for an account\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve domain names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountDomains(args: GetAccountDomainsArgs): Promise<GetANSNameResponse> {\n return getAccountDomains({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all subdomains names for an account\n *\n * @param args\n * @param args.accountAddress - A AccountAddressInput of the address to retrieve subdomains names for.\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getAccountSubdomains(args: GetAccountSubdomainsArgs): Promise<GetANSNameResponse> {\n return getAccountSubdomains({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches all subdomains names for a given domain. Note, this will not return the domain itself.\n *\n * @param args\n * @param args.domain - A string of the domain name: eg. \"test.apt\" or \"test\" (without the suffix of .apt)\n * @param args.options.offset - Optional, the offset to start from when fetching names\n * @param args.options.limit - Optional, A number of the names to fetch per request\n * @param args.options.orderBy - The order to sort the names by\n * @param args.options.where - Additional filters to apply to the query\n *\n * @returns a promise of an array of ANSName\n */\n async getDomainSubdomains(args: GetDomainSubdomainsArgs): Promise<GetANSNameResponse> {\n return getDomainSubdomains({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"wHA+BO,IAAMA,EAAN,KAAU,CACf,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAe3C,MAAM,gBAAgBC,EAA8D,CAClF,OAAOC,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAC9D,CAeA,MAAM,cAAcA,EAAqD,CACvE,OAAOE,EAAc,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC5D,CAgBA,MAAM,iBAAiBA,EAA8D,CACnF,OAAOG,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC/D,CAkBA,MAAM,iBAAiBA,EAKQ,CAC7B,OAAOI,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC/D,CAgBA,MAAM,eAAeA,EAAqE,CACxF,OAAOK,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC7D,CAkBA,MAAM,eAAeA,EAIU,CAC7B,OAAOM,EAAe,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CAC7D,CAqCA,MAAM,aAAaA,EAA+E,CAChG,OAAOO,EAAa,CAAE,YAAa,KAAK,OAAQ,GAAGP,CAAK,CAAC,CAC3D,CAmBA,MAAM,YAAYA,EAKa,CAC7B,OAAOQ,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGR,CAAK,CAAC,CAC1D,CAUA,MAAM,QAAQA,EAAoE,CAChF,OAAOS,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGT,CAAK,CAAC,CACtD,CAcA,MAAM,gBAAgBA,EAAwD,CAC5E,OAAOU,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGV,CAAK,CAAC,CAC9D,CAcA,MAAM,kBAAkBA,EAA0D,CAChF,OAAOW,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGX,CAAK,CAAC,CAChE,CAcA,MAAM,qBAAqBA,EAA6D,CACtF,OAAOY,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGZ,CAAK,CAAC,CACnE,CAcA,MAAM,oBAAoBA,EAA4D,CACpF,OAAOa,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGb,CAAK,CAAC,CAClE,CACF","names":["ANS","config","args","getOwnerAddress","getExpiration","getTargetAddress","setTargetAddress","getPrimaryName","setPrimaryName","registerName","renewDomain","getName","getAccountNames","getAccountDomains","getAccountSubdomains","getDomainSubdomains"]}
@@ -1,2 +1,2 @@
1
- import{a as r,b as i,c as s}from"./chunk-ZKFDLJ2F.mjs";import{a as o}from"./chunk-LBNMY7EM.mjs";var t=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),r({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),i({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),s({aptosConfig:this.config,...e})}};export{t as a};
2
- //# sourceMappingURL=chunk-BA4TDBYB.mjs.map
1
+ import{a as r,b as i,c as s}from"./chunk-2HBIGMDV.mjs";import{a as o}from"./chunk-T3ID6KFN.mjs";var t=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),r({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),i({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await o({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["stake_processor"]}),s({aptosConfig:this.config,...e})}};export{t as a};
2
+ //# sourceMappingURL=chunk-IEL6J6Z3.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-LBNMY7EM.mjs";import{a as t,b as i,c as r,d as c,e as u,f as A,g as d,h as g,i as m,j as a,k as p,l as C,m as o,n as O,o as T,p as f,q as y}from"./chunk-Y5RQOXZH.mjs";import{f as s}from"./chunk-EOC4UI5B.mjs";var R=class{constructor(e){this.config=e}async getAccountInfo(e){return t({aptosConfig:this.config,...e})}async getAccountModules(e){return i({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return c({aptosConfig:this.config,...e})}async getAccountResources(e){return u({aptosConfig:this.config,...e})}async getAccountResource(e){return A({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),m({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),a({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),p({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),C({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),O({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),T({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,coinType:s,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),f({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return y({aptosConfig:this.config,...e})}};export{R as a};
2
- //# sourceMappingURL=chunk-Q3R3KKKP.mjs.map
1
+ import{a as n}from"./chunk-T3ID6KFN.mjs";import{a as t,b as i,c as r,d as c,e as u,f as A,g as d,h as g,i as m,j as a,k as p,l as C,m as o,n as O,o as T,p as f,q as y}from"./chunk-R3SAAJ2N.mjs";import{f as s}from"./chunk-EOC4UI5B.mjs";var R=class{constructor(e){this.config=e}async getAccountInfo(e){return t({aptosConfig:this.config,...e})}async getAccountModules(e){return i({aptosConfig:this.config,...e})}async getAccountModule(e){return r({aptosConfig:this.config,...e})}async getAccountTransactions(e){return c({aptosConfig:this.config,...e})}async getAccountResources(e){return u({aptosConfig:this.config,...e})}async getAccountResource(e){return A({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),d({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),g({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),m({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),a({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),p({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),C({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),O({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),T({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,coinType:s,...e})}async getAccountCoinAmount(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),o({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),f({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return y({aptosConfig:this.config,...e})}};export{R as a};
2
+ //# sourceMappingURL=chunk-IPW2YTRD.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-Y5RQOXZH.mjs";import{a as e}from"./chunk-3JPVQHOR.mjs";var n=()=>Math.floor(Date.now()/1e3),r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
2
- //# sourceMappingURL=chunk-BDTDWLGO.mjs.map
1
+ import{a as s}from"./chunk-R3SAAJ2N.mjs";import{a as e}from"./chunk-3JPVQHOR.mjs";var n=()=>Math.floor(Date.now()/1e3),r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
2
+ //# sourceMappingURL=chunk-KH3M3YPI.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as c}from"./chunk-4TIQQKXV.mjs";import{a as g}from"./chunk-YLI6J47P.mjs";import{a as f}from"./chunk-PJMRQLJ5.mjs";import{a as l}from"./chunk-R4APGSSC.mjs";import{a as u}from"./chunk-IEL6J6Z3.mjs";import{a as h}from"./chunk-SI6QMT4N.mjs";import{a as s}from"./chunk-IPW2YTRD.mjs";import{a as p}from"./chunk-HDNJ4JK4.mjs";import{a as y}from"./chunk-3RMXGSHK.mjs";import{a as r}from"./chunk-TCSN7PYL.mjs";import{a}from"./chunk-EMQWD6KP.mjs";var t=class{constructor(i){this.config=new y(i),this.account=new s(this.config),this.ans=new p(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new g(this.config),this.fungibleAsset=new f(this.config),this.general=new l(this.config),this.staking=new u(this.config),this.transaction=new h(this.config)}};function n(m,i,A){Object.getOwnPropertyNames(i.prototype).forEach(e=>{let o=Object.getOwnPropertyDescriptor(i.prototype,e);o&&(o.value=function(...d){return this[A][e](...d)},Object.defineProperty(m.prototype,e,o))})}n(t,s,"account");n(t,p,"ans");n(t,r,"coin");n(t,a,"digitalAsset");n(t,c,"event");n(t,g,"faucet");n(t,f,"fungibleAsset");n(t,l,"general");n(t,u,"staking");n(t,h,"transaction");export{t as a};
2
+ //# sourceMappingURL=chunk-KSWQZKMQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/aptos.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./account\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { Coin } from \"./coin\";\nimport { DigitalAsset } from \"./digitalAsset\";\nimport { Event } from \"./event\";\nimport { Faucet } from \"./faucet\";\nimport { FungibleAsset } from \"./fungibleAsset\";\nimport { General } from \"./general\";\nimport { ANS } from \"./ans\";\nimport { Staking } from \"./staking\";\nimport { Transaction } from \"./transaction\";\n\n/**\n * This class is the main entry point into Aptos's\n * APIs and separates functionality into different namespaces.\n *\n * To use the SDK, create a new Aptos instance to get access\n * to all the sdk functionality.\n */\nexport class Aptos {\n readonly config: AptosConfig;\n\n readonly account: Account;\n\n readonly ans: ANS;\n\n readonly coin: Coin;\n\n readonly digitalAsset: DigitalAsset;\n\n readonly event: Event;\n\n readonly faucet: Faucet;\n\n readonly fungibleAsset: FungibleAsset;\n\n readonly general: General;\n\n readonly staking: Staking;\n\n readonly transaction: Transaction;\n\n constructor(settings?: AptosConfig) {\n this.config = new AptosConfig(settings);\n this.account = new Account(this.config);\n this.ans = new ANS(this.config);\n this.coin = new Coin(this.config);\n this.digitalAsset = new DigitalAsset(this.config);\n this.event = new Event(this.config);\n this.faucet = new Faucet(this.config);\n this.fungibleAsset = new FungibleAsset(this.config);\n this.general = new General(this.config);\n this.staking = new Staking(this.config);\n this.transaction = new Transaction(this.config);\n }\n}\n\n// extends Aptos interface so all the methods and properties from the other classes will be recognized by typescript.\nexport interface Aptos\n extends Account,\n ANS,\n Coin,\n DigitalAsset,\n Event,\n Faucet,\n FungibleAsset,\n General,\n Staking,\n Transaction {}\n\n/**\nIn TypeScript, we can’t inherit or extend from more than one class,\nMixins helps us to get around that by creating a partial classes\nthat we can combine to form a single class that contains all the methods and properties from the partial classes.\n{@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n\nHere, we combine any subclass and the Aptos class.\n*/\nfunction applyMixin(targetClass: any, baseClass: any, baseClassProp: string) {\n // Mixin instance methods\n Object.getOwnPropertyNames(baseClass.prototype).forEach((propertyName) => {\n const propertyDescriptor = Object.getOwnPropertyDescriptor(baseClass.prototype, propertyName);\n if (!propertyDescriptor) return;\n // eslint-disable-next-line func-names\n propertyDescriptor.value = function (...args: any) {\n return (this as any)[baseClassProp][propertyName](...args);\n };\n Object.defineProperty(targetClass.prototype, propertyName, propertyDescriptor);\n });\n}\n\napplyMixin(Aptos, Account, \"account\");\napplyMixin(Aptos, ANS, \"ans\");\napplyMixin(Aptos, Coin, \"coin\");\napplyMixin(Aptos, DigitalAsset, \"digitalAsset\");\napplyMixin(Aptos, Event, \"event\");\napplyMixin(Aptos, Faucet, \"faucet\");\napplyMixin(Aptos, FungibleAsset, \"fungibleAsset\");\napplyMixin(Aptos, General, \"general\");\napplyMixin(Aptos, Staking, \"staking\");\napplyMixin(Aptos, Transaction, \"transaction\");\n"],"mappings":"8bAsBO,IAAMA,EAAN,KAAY,CAuBjB,YAAYC,EAAwB,CAClC,KAAK,OAAS,IAAIC,EAAYD,CAAQ,EACtC,KAAK,QAAU,IAAIE,EAAQ,KAAK,MAAM,EACtC,KAAK,IAAM,IAAIC,EAAI,KAAK,MAAM,EAC9B,KAAK,KAAO,IAAIC,EAAK,KAAK,MAAM,EAChC,KAAK,aAAe,IAAIC,EAAa,KAAK,MAAM,EAChD,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,cAAgB,IAAIC,EAAc,KAAK,MAAM,EAClD,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,YAAc,IAAIC,EAAY,KAAK,MAAM,CAChD,CACF,EAuBA,SAASC,EAAWC,EAAkBC,EAAgBC,EAAuB,CAE3E,OAAO,oBAAoBD,EAAU,SAAS,EAAE,QAASE,GAAiB,CACxE,IAAMC,EAAqB,OAAO,yBAAyBH,EAAU,UAAWE,CAAY,EACvFC,IAELA,EAAmB,MAAQ,YAAaC,EAAW,CACjD,OAAQ,KAAaH,CAAa,EAAEC,CAAY,EAAE,GAAGE,CAAI,CAC3D,EACA,OAAO,eAAeL,EAAY,UAAWG,EAAcC,CAAkB,EAC/E,CAAC,CACH,CAEAL,EAAWb,EAAOG,EAAS,SAAS,EACpCU,EAAWb,EAAOI,EAAK,KAAK,EAC5BS,EAAWb,EAAOK,EAAM,MAAM,EAC9BQ,EAAWb,EAAOM,EAAc,cAAc,EAC9CO,EAAWb,EAAOO,EAAO,OAAO,EAChCM,EAAWb,EAAOQ,EAAQ,QAAQ,EAClCK,EAAWb,EAAOS,EAAe,eAAe,EAChDI,EAAWb,EAAOU,EAAS,SAAS,EACpCG,EAAWb,EAAOW,EAAS,SAAS,EACpCE,EAAWb,EAAOY,EAAa,aAAa","names":["Aptos","settings","AptosConfig","Account","ANS","Coin","DigitalAsset","Event","Faucet","FungibleAsset","General","Staking","Transaction","applyMixin","targetClass","baseClass","baseClassProp","propertyName","propertyDescriptor","args"]}
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-7IY2Y73Q.mjs";import{f as n}from"./chunk-EOC4UI5B.mjs";async function A(o){let{aptosConfig:r,sender:e,recipient:i,amount:c,coinType:s,options:a}=o,p=s??n;return await t({aptosConfig:r,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[p],functionArguments:[i,c]},options:a})}export{A as a};
2
- //# sourceMappingURL=chunk-ELWWME6B.mjs.map
1
+ import{a as t}from"./chunk-VBUKPN4Q.mjs";import{f as n}from"./chunk-EOC4UI5B.mjs";async function A(o){let{aptosConfig:r,sender:e,recipient:i,amount:c,coinType:s,options:a}=o,p=s??n;return await t({aptosConfig:r,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[p],functionArguments:[i,c]},options:a})}export{A as a};
2
+ //# sourceMappingURL=chunk-LUCDRB52.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/coin.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { Account, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\nimport { APTOS_COIN } from \"../utils/const\";\nimport { generateTransaction } from \"./transactionSubmission\";\n\nexport async function transferCoinTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, recipient, amount, coinType, options } = args;\n const coinStructType = coinType ?? APTOS_COIN;\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::aptos_account::transfer_coins\",\n typeArguments: [coinStructType],\n functionArguments: [recipient, amount],\n },\n options,\n });\n\n return transaction;\n}\n"],"mappings":"kFAOA,eAAsBA,EAAwBC,EAOf,CAC7B,GAAM,CAAE,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,EAAW,OAAAC,EAAQ,SAAAC,EAAU,QAAAC,CAAQ,EAAIN,EAChEO,EAAiBF,GAAYG,EAYnC,OAXoB,MAAMC,EAAoB,CAC5C,YAAAR,EACA,OAAQC,EAAO,eACf,KAAM,CACJ,SAAU,qCACV,cAAe,CAACK,CAAc,EAC9B,kBAAmB,CAACJ,EAAWC,CAAM,CACvC,EACA,QAAAE,CACF,CAAC,CAGH","names":["transferCoinTransaction","args","aptosConfig","sender","recipient","amount","coinType","options","coinStructType","APTOS_COIN","generateTransaction"]}
@@ -0,0 +1,2 @@
1
+ import{a as d}from"./chunk-6FBKUTGF.mjs";import{a as R}from"./chunk-SODP7NAK.mjs";var p={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function c(n,a){let{url:o,method:u,body:i,contentType:s,params:e,overrides:t}=n,r={...t?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${R}`,"content-type":s??"application/json"};return t?.AUTH_TOKEN&&o.includes("faucet")&&(r.Authorization=`Bearer ${t?.AUTH_TOKEN}`),t?.API_KEY&&!o.includes("faucet")&&(r.Authorization=`Bearer ${t?.API_KEY}`),a.provider({url:o,method:u,body:i,params:e,headers:r,overrides:t})}async function T(n,a){let{url:o,path:u}=n,i=`${o}/${u??""}`,s=await c({...n,url:i},a.client),e={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:i};if(a.isIndexerRequest(o)){let r=e.data;if(r.errors)throw new d(n,e,r.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);e.data=r.data}if(e.status>=200&&e.status<300)return e;let t;throw e&&e.data&&"message"in e.data&&"error_code"in e.data?t=JSON.stringify(e.data):e.status in p?t=p[e.status]:t=`Unhandled Error ${e.status} : ${e.statusText}`,new d(n,e,t)}export{c as a,T as b};
2
+ //# sourceMappingURL=chunk-NZ6RYGJQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, AptosResponse } from \"./types\";\nimport { VERSION } from \"../version\";\nimport { AptosRequest, MimeType, ClientRequest, ClientResponse, Client, AnyNumber } from \"../types\";\n\n/**\n * Meaningful errors map\n */\nconst errors: Record<number, string> = {\n 400: \"Bad Request\",\n 401: \"Unauthorized\",\n 403: \"Forbidden\",\n 404: \"Not Found\",\n 429: \"Too Many Requests\",\n 500: \"Internal Server Error\",\n 502: \"Bad Gateway\",\n 503: \"Service Unavailable\",\n};\n\n/**\n * Given a url and method, sends the request with axios and\n * returns the response.\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n };\n\n // TODO - auth token is being used only for faucet, it breaks full node requests.\n // Find a more sophisticated way than that but without the need to add the\n // auth_token on every `aptos.fundAccount()` call\n if (overrides?.AUTH_TOKEN && url.includes(\"faucet\")) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY && !url.includes(\"faucet\")) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when doing an API request.\n *\n * @param options AptosRequest\n * @param aptosConfig The config information for the SDK client instance\n * @returns the response or AptosApiError\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n options: AptosRequest,\n aptosConfig: AptosConfig,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = options;\n const fullUrl = `${url}/${path ?? \"\"}`;\n const response = await request<Req, Res>({ ...options, url: fullUrl }, aptosConfig.client);\n\n const result: AptosResponse<Req, Res> = {\n status: response.status,\n statusText: response.statusText!,\n data: response.data,\n headers: response.headers,\n config: response.config,\n request: response.request,\n url: fullUrl,\n };\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (aptosConfig.isIndexerRequest(url)) {\n const indexerResponse = result.data as any;\n // errors from indexer\n if (indexerResponse.errors) {\n throw new AptosApiError(\n options,\n result,\n indexerResponse.errors[0].message ?? `Unhandled Error ${response.status} : ${response.statusText}`,\n );\n }\n result.data = indexerResponse.data as Res;\n }\n\n if (result.status >= 200 && result.status < 300) {\n return result;\n }\n\n let errorMessage: string;\n\n if (result && result.data && \"message\" in result.data && \"error_code\" in result.data) {\n errorMessage = JSON.stringify(result.data);\n } else if (result.status in errors) {\n // If it's not an API type, it must come form infra, these are prehandled\n errorMessage = errors[result.status];\n } else {\n // Everything else is unhandled\n errorMessage = `Unhandled Error ${result.status} : ${result.statusText}`;\n }\n\n throw new AptosApiError(options, result, errorMessage);\n}\n"],"mappings":"kFAWA,IAAMA,EAAiC,CACrC,IAAK,cACL,IAAK,eACL,IAAK,YACL,IAAK,YACL,IAAK,oBACL,IAAK,wBACL,IAAK,cACL,IAAK,qBACP,EAMA,eAAsBC,EAAkBC,EAA6BC,EAA8C,CACjH,GAAM,CAAE,IAAAC,EAAK,OAAAC,EAAQ,KAAAC,EAAM,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,CAAU,EAAIP,EACxDQ,EAAoE,CACxE,GAAGD,GAAW,QACd,iBAAkB,wBAAwBE,CAAO,GACjD,eAAgBJ,qBAClB,EAKA,OAAIE,GAAW,YAAcL,EAAI,SAAS,QAAQ,IAChDM,EAAQ,cAAgB,UAAUD,GAAW,UAAU,IAErDA,GAAW,SAAW,CAACL,EAAI,SAAS,QAAQ,IAC9CM,EAAQ,cAAgB,UAAUD,GAAW,OAAO,IAO/CN,EAAO,SAAmB,CAC/B,IAAAC,EACA,OAAAC,EACA,KAAAC,EACA,OAAAE,EACA,QAAAE,EACA,UAAAD,CACF,CAAC,CACH,CASA,eAAsBG,EACpBV,EACAW,EACkC,CAClC,GAAM,CAAE,IAAAT,EAAK,KAAAU,CAAK,EAAIZ,EAChBa,EAAU,GAAGX,CAAG,IAAIU,GAAQ,EAAE,GAC9BE,EAAW,MAAMf,EAAkB,CAAE,GAAGC,EAAS,IAAKa,CAAQ,EAAGF,EAAY,MAAM,EAEnFI,EAAkC,CACtC,OAAQD,EAAS,OACjB,WAAYA,EAAS,WACrB,KAAMA,EAAS,KACf,QAASA,EAAS,QAClB,OAAQA,EAAS,OACjB,QAASA,EAAS,QAClB,IAAKD,CACP,EAIA,GAAIF,EAAY,iBAAiBT,CAAG,EAAG,CACrC,IAAMc,EAAkBD,EAAO,KAE/B,GAAIC,EAAgB,OAClB,MAAM,IAAIC,EACRjB,EACAe,EACAC,EAAgB,OAAO,CAAC,EAAE,SAAW,mBAAmBF,EAAS,MAAM,MAAMA,EAAS,UAAU,EAClG,EAEFC,EAAO,KAAOC,EAAgB,IAChC,CAEA,GAAID,EAAO,QAAU,KAAOA,EAAO,OAAS,IAC1C,OAAOA,EAGT,IAAIG,EAEJ,MAAIH,GAAUA,EAAO,MAAQ,YAAaA,EAAO,MAAQ,eAAgBA,EAAO,KAC9EG,EAAe,KAAK,UAAUH,EAAO,IAAI,EAChCA,EAAO,UAAUjB,EAE1BoB,EAAepB,EAAOiB,EAAO,MAAM,EAGnCG,EAAe,mBAAmBH,EAAO,MAAM,MAAMA,EAAO,UAAU,GAGlE,IAAIE,EAAcjB,EAASe,EAAQG,CAAY,CACvD","names":["errors","request","options","client","url","method","body","contentType","params","overrides","headers","VERSION","aptosRequest","aptosConfig","path","fullUrl","response","result","indexerResponse","AptosApiError","errorMessage"]}
@@ -0,0 +1,2 @@
1
+ import{b as s}from"./chunk-6EMN3BOV.mjs";import{f as r}from"./chunk-VBUKPN4Q.mjs";import{a as o}from"./chunk-ZWH2ESXT.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
2
+ //# sourceMappingURL=chunk-OU4MEM5F.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/simulate.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PublicKey } from \"../../core\";\nimport { simulateTransaction } from \"../../internal/transactionSubmission\";\nimport { AnyRawTransaction, InputSimulateTransactionOptions } from \"../../transactions\";\nimport { UserTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSimulation } from \"./helpers\";\n\n/**\n * A class to handle all `Simulate` transaction operations\n */\nexport class Simulate {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Simulate a simple transaction\n *\n * @param args.signerPublicKey The signer public key\n * @param args.transaction An instance of a raw transaction\n * @param args.options optional. Optional transaction configurations\n * @param args.feePayerPublicKey optional. The fee payer public key if it is a fee payer transaction\n *\n * @returns Array<UserTransactionResponse>\n */\n @ValidateFeePayerDataOnSimulation\n async simple(args: {\n signerPublicKey: PublicKey;\n transaction: AnyRawTransaction;\n feePayerPublicKey?: PublicKey;\n options?: InputSimulateTransactionOptions;\n }): Promise<Array<UserTransactionResponse>> {\n return simulateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Simulate a multi agent transaction\n *\n * @param args.signerPublicKey The signer public key\n * @param args.transaction An instance of a raw transaction\n * @param args.secondarySignersPublicKeys An array of the secondary signers public keys\n * @param args.options optional. Optional transaction configurations\n * @param args.feePayerPublicKey optional. The fee payer public key if it is a fee payer transaction\n *\n * @returns Array<UserTransactionResponse>\n */\n @ValidateFeePayerDataOnSimulation\n async multiAgent(args: {\n signerPublicKey: PublicKey;\n transaction: AnyRawTransaction;\n secondarySignersPublicKeys: Array<PublicKey>;\n feePayerPublicKey?: PublicKey;\n options?: InputSimulateTransactionOptions;\n }): Promise<Array<UserTransactionResponse>> {\n return simulateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2HAaO,IAAMA,EAAN,KAAe,CAGpB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAaA,MAAM,OAAOC,EAK+B,CAC1C,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CAcA,MAAM,WAAWA,EAM2B,CAC1C,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF,EA9BQE,EAAA,CADLC,GAjBUL,EAkBL,sBAqBAI,EAAA,CADLC,GAtCUL,EAuCL","names":["Simulate","config","args","simulateTransaction","__decorateClass","ValidateFeePayerDataOnSimulation"]}
@@ -1,2 +1,2 @@
1
- import{a as i,b as n,c as t,d as o}from"./chunk-XKINEFAA.mjs";import{a as s}from"./chunk-LBNMY7EM.mjs";var r=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),i({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),(await i({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),t({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return o({aptosConfig:this.config,...e})}};export{r as a};
2
- //# sourceMappingURL=chunk-PLY7MQKE.mjs.map
1
+ import{a as i,b as t,c as n,d as o}from"./chunk-4ZYW3BPF.mjs";import{a as s}from"./chunk-T3ID6KFN.mjs";var r=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),i({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),(await i({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),t({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),n({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return o({aptosConfig:this.config,...e})}};export{r as a};
2
+ //# sourceMappingURL=chunk-PJMRQLJ5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/fungibleAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport {\n getCurrentFungibleAssetBalances,\n getFungibleAssetActivities,\n getFungibleAssetMetadata,\n transferFungibleAsset,\n} from \"../internal/fungibleAsset\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { Account, AccountAddress } from \"../core\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\n\n/**\n * A class to query all `FungibleAsset` related queries on Aptos.\n */\nexport class FungibleAsset {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries all fungible asset metadata.\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns A list of fungible asset metadata\n */\n async getFungibleAssetMetadata(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n }): Promise<GetFungibleAssetMetadataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],\n });\n return getFungibleAssetMetadata({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a fungible asset metadata\n *\n * This query returns the fungible asset metadata for a specific fungible asset.\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.assetType The asset type of the fungible asset.\n * e.g\n * \"0x1::aptos_coin::AptosCoin\" for Aptos Coin\n * \"0xc2948283c2ce03aafbb294821de7ee684b06116bb378ab614fa2de07a99355a8\" - address format if this is fungible asset\n *\n * @returns A fungible asset metadata item\n */\n async getFungibleAssetMetadataByAssetType(args: {\n assetType: string;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetFungibleAssetMetadataResponse[0]> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],\n });\n const data = await getFungibleAssetMetadata({\n aptosConfig: this.config,\n options: {\n where: {\n asset_type: { _eq: args.assetType },\n },\n },\n });\n\n return data[0];\n }\n\n /**\n * Queries all fungible asset activities\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns A list of fungible asset metadata\n */\n async getFungibleAssetActivities(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n }): Promise<GetFungibleAssetActivitiesResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],\n });\n return getFungibleAssetActivities({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries all fungible asset balances\n *\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns A list of fungible asset metadata\n */\n async getCurrentFungibleAssetBalances(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetCurrentFungibleAssetBalancesResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorTypes: [ProcessorType.FUNGIBLE_ASSET_PROCESSOR],\n });\n return getCurrentFungibleAssetBalances({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Transfer `amount` of fungible asset from sender's primary store to recipient's primary store.\n *\n * Use this method to transfer any fungible asset including fungible token.\n *\n * @param sender The sender account\n * @param fungibleAssetMetadataAddress The fungible asset account address.\n * For example if you’re transferring USDT this would be the USDT address\n * @param recipient The recipient account address\n * @param amount Number of assets to transfer\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain.\n */\n async transferFungibleAsset(args: {\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddress;\n recipient: AccountAddress;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferFungibleAsset({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"uGA+BO,IAAMA,EAAN,KAAoB,CACzB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAS3C,MAAM,yBAAyBC,EAGe,CAC5C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,EACME,EAAyB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACvE,CAeA,MAAM,oCAAoCA,EAGO,CAC/C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,GACY,MAAME,EAAyB,CAC1C,YAAa,KAAK,OAClB,QAAS,CACP,MAAO,CACL,WAAY,CAAE,IAAKF,EAAK,SAAU,CACpC,CACF,CACF,CAAC,GAEW,CAAC,CACf,CASA,MAAM,2BAA2BA,EAGe,CAC9C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,EACMG,EAA2B,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACzE,CASA,MAAM,gCAAgCA,EAGe,CACnD,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,eAAgB,2BAAuC,CACzD,CAAC,EACMI,EAAgC,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC9E,CAeA,MAAM,sBAAsBA,EAMG,CAC7B,OAAOK,EAAsB,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CACpE,CACF","names":["FungibleAsset","config","args","waitForIndexerOnVersion","getFungibleAssetMetadata","getFungibleAssetActivities","getCurrentFungibleAssetBalances","transferFungibleAsset"]}