@wormhole-foundation/wormhole-connect 1.0.0-beta.4-development → 1.0.0-beta.5-development
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.
- package/dist/assets/{ccip-Dn5z57Cx.js → ccip-B-OK94pJ.js} +1 -1
- package/dist/assets/{evm-Ci-t-8ei.js → evm-CPj7oFVL.js} +4 -4
- package/dist/assets/{index-DlyJ6Tua.js → index-BWMdho2w.js} +2 -2
- package/dist/assets/{index-Da59NFoY.js → index-DGFWhjyA.js} +1 -1
- package/dist/assets/{index-yInQCZK6.js → index-Ddso83Ti.js} +1 -1
- package/dist/assets/{index.es-DUffrgf3.js → index.es-VchQxXD4.js} +2 -2
- package/dist/main.js +41 -41
- package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/{algorand-BZfir-Gt.js → algorand-DFJZIdnH.js} +1 -1
- package/lib/{algorand-B9ai7AKk.mjs → algorand-qEY4HHOc.mjs} +3 -3
- package/lib/{aptos-ZpPdNMHJ.mjs → aptos-BCuZuiBG.mjs} +1 -1
- package/lib/{aptos-CX7jOv1y.js → aptos-BHw0JlTE.js} +1 -1
- package/lib/{aptos-D_w5IEUK.js → aptos-D-S8DXGs.js} +2 -2
- package/lib/{aptos-BiWZASIH.mjs → aptos-DoqExVYR.mjs} +3 -3
- package/lib/{ccip-CLMQ2RsP.js → ccip-CXJ3nCk_.js} +1 -1
- package/lib/{ccip-lVzudYcQ.mjs → ccip-_0LmpQds.mjs} +1 -1
- package/lib/{cosmos-B3YMB-qs.mjs → cosmos-0un-E2-0.mjs} +6 -6
- package/lib/{cosmos-6rjmrhY_.js → cosmos-DCgWSBll.js} +1 -1
- package/lib/{cosmwasm-DMVssDjU.js → cosmwasm-BsEhYnuw.js} +2 -2
- package/lib/{cosmwasm-SnVdtN68.mjs → cosmwasm-DvwgrLe6.mjs} +7 -7
- package/lib/{events-pgsgrP1S.mjs → events-BL2eUG60.mjs} +1 -1
- package/lib/{events-t6i_QSEn.js → events-wpqGOay9.js} +1 -1
- package/lib/{evm-DFJuxSg1.js → evm-B46tP5Ah.js} +1 -1
- package/lib/{evm-D7GRIPdg.js → evm-BOrFw20j.js} +4 -4
- package/lib/{evm-Bd3DzKCY.mjs → evm-CkxKsuQ-.mjs} +7 -7
- package/lib/{evm-DiQodX72.mjs → evm-kynWl8-i.mjs} +5 -5
- package/lib/{index-C_JBf5AE.js → index-6gwCyfQU.js} +1 -1
- package/lib/{index-DG5KwGj7.mjs → index-BHOu1oLq.mjs} +3 -3
- package/lib/{index-CcKxlhe-.js → index-BNWJG0G4.js} +1 -1
- package/lib/{index-hiGmsL0b.mjs → index-BOppeFAI.mjs} +1 -1
- package/lib/{index-B64jLBfI.mjs → index-BTBmklHJ.mjs} +2 -2
- package/lib/{index-EPcXyhD3.js → index-BVz1aMw3.js} +1 -1
- package/lib/{index-BjpzXqrL.js → index-BWNh4wvK.js} +1 -1
- package/lib/{index-DllSkb9h.js → index-BwCIDEBK.js} +1 -1
- package/lib/{index-D4-zCm-j.js → index-C4ri6eMC.js} +1 -1
- package/lib/{index-CvRFH7pa.js → index-C7amSMG9.js} +1 -1
- package/lib/{index-CE4mRmPN.js → index-CAkX47d8.js} +1 -1
- package/lib/{index-BZ7LatAr.js → index-CDGktAjP.js} +3 -3
- package/lib/{index-BAqClXT6.js → index-CFVm1KSi.js} +1 -1
- package/lib/{index-DJgWkkqj.mjs → index-CLH7U4rp.mjs} +2 -2
- package/lib/{index-B_FxM4qi.js → index-CNIDBiCc.js} +1 -1
- package/lib/{index-DLXjX60f.js → index-CPgdgK8L.js} +1 -1
- package/lib/{index-0YCaekiF.mjs → index-CTwzW64I.mjs} +2 -2
- package/lib/{index-B5TmFc4M.js → index-CUInBQd6.js} +1 -1
- package/lib/{index-mAuqp4GD.js → index-CaFGZvKm.js} +1 -1
- package/lib/{index-DZbeM9gY.mjs → index-Cb47usqO.mjs} +2 -2
- package/lib/{index-EhUlCH18.mjs → index-CjwA7HmM.mjs} +23 -33
- package/lib/{index-BT7_dDgl.mjs → index-CkPaHAgJ.mjs} +3 -3
- package/lib/{index-B2aC_g_3.js → index-ClLbfY74.js} +1 -1
- package/lib/{index-CFVJznfe.js → index-ClRkhvNK.js} +1 -1
- package/lib/{index-C4NKqUWK.mjs → index-Cm3iq-IJ.mjs} +1 -1
- package/lib/{index-DWmEAYa2.js → index-CtJdy4GW.js} +1 -1
- package/lib/{index-CkyGUP8I.mjs → index-D0W1ZmqN.mjs} +2 -2
- package/lib/{index-0QJFchou.mjs → index-D5SPCl8N.mjs} +2 -2
- package/lib/{index-CpM8O4af.mjs → index-D6Sqxs9J.mjs} +4 -4
- package/lib/{index-fD6yeQDw.mjs → index-DC65dQZI.mjs} +7 -7
- package/lib/{index-BkyCouQJ.js → index-DICIR39L.js} +1 -1
- package/lib/{index-DVnPDtFx.mjs → index-DIddLRbN.mjs} +1 -1
- package/lib/{index-bpVbPzFG.mjs → index-DSSXLwpv.mjs} +1 -1
- package/lib/{index-Cl110Yt1.js → index-DVKptZW_.js} +1 -1
- package/lib/{index-Dk2OkATw.js → index-DcbhKZoU.js} +1 -1
- package/lib/{index-DPq8nS1b.mjs → index-DojwGTf0.mjs} +1 -1
- package/lib/{index-C9xfXphF.mjs → index-DrQrqu4U.mjs} +2 -2
- package/lib/{index-Bd6ExIDW.mjs → index-DvQkOUhD.mjs} +4 -4
- package/lib/{index-fPs98C_X.mjs → index-Dw4gUoPq.mjs} +2 -2
- package/lib/{index-DUn9bDrk.mjs → index-IypSUdxl.mjs} +2 -2
- package/lib/{index-2LZtNZ5P.js → index-QfqpopxL.js} +1 -1
- package/lib/{index-BhrO8yNx.mjs → index-SiA6wvOM.mjs} +2 -2
- package/lib/{index-VI9qDjx0.js → index-dZuWNqUJ.js} +1 -1
- package/lib/{index-BYv5Tbwe.mjs → index-fzN-meRd.mjs} +1 -1
- package/lib/{index-QqzqKjF9.js → index-hWgZ0Dfs.js} +1 -1
- package/lib/{index-048e7Uvl.js → index-tKKMDrTV.js} +1 -1
- package/lib/{index-BcbPoWss.mjs → index-tKooq_Tx.mjs} +3 -3
- package/lib/{index-CdFX-OBR.mjs → index-yd8RiLQo.mjs} +4 -4
- package/lib/{index.es-WCp4WrVw.js → index.es-BfpZO8dT.js} +2 -2
- package/lib/{index.es-B4wQLKJO.mjs → index.es-P5wvRtJq.mjs} +5 -5
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{libsodium-wrappers-DnY3rBzj.mjs → libsodium-wrappers-BB6-Iffd.mjs} +1 -1
- package/lib/{libsodium-wrappers-BdZeVEOK.js → libsodium-wrappers-BvMpC4vD.js} +1 -1
- package/lib/{pako.esm-doGHPq3v.mjs → pako.esm-C7QrkxRd.mjs} +3 -3
- package/lib/{pako.esm-CpOVp0Fg.js → pako.esm-DlDLS2rv.js} +1 -1
- package/lib/{pbkdf2-CR1mMO6P.mjs → pbkdf2-DMV4l9Li.mjs} +1 -1
- package/lib/{pbkdf2-DRrUaAek.js → pbkdf2-Di1EjoiV.js} +1 -1
- package/lib/{sei-ReMraEM4.mjs → sei-CnR3Aw9g.mjs} +4 -4
- package/lib/{sei-BHskcl2R.js → sei-RTyi_UJs.js} +1 -1
- package/lib/{signer-BwkEV8NR.mjs → signer-BAztlcE7.mjs} +1 -1
- package/lib/{signer-C5udfQih.js → signer-CbhSUdvo.js} +1 -1
- package/lib/solana-Bkh_veaR.mjs +16 -0
- package/lib/solana-CKipdoh2.js +1 -0
- package/lib/{solana-kr2Et-_M.mjs → solana-CP3uz3z9.mjs} +4 -4
- package/lib/{solana-BWRzXH9-.js → solana-Cglhypga.js} +1 -1
- package/lib/{solanaEmbed.esm-8hegnauD.js → solanaEmbed.esm-8VvaQIYa.js} +1 -1
- package/lib/{solanaEmbed.esm-HLygiesN.mjs → solanaEmbed.esm-DfSXcnar.mjs} +4 -4
- package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/{sui-BWRqoTdl.js → sui-BLA0P5P1.js} +2 -2
- package/lib/{sui-BocrppL0.js → sui-BMLSVXBy.js} +1 -1
- package/lib/{sui-B6XCpe1d.mjs → sui-C73zQuHR.mjs} +1 -1
- package/lib/{sui-BuZPAcI0.mjs → sui-WPdV6u03.mjs} +4 -4
- package/lib/{unsignedTransaction-oXk8lD5s.mjs → unsignedTransaction-BWLDqwPd.mjs} +2 -2
- package/lib/{unsignedTransaction-DSuqsGgb.js → unsignedTransaction-Cl0WbHFW.js} +1 -1
- package/lib/{utils-SML27G4C.js → utils-CA5brb9u.js} +1 -1
- package/lib/{utils-fI-uXUZk.mjs → utils-Cd5O9nI7.mjs} +2 -2
- package/package.json +1 -1
- package/lib/solana-ci1dqiv5.mjs +0 -16
- package/lib/solana-gFEm46ZS.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var ni=Object.defineProperty;var si=(n,e,t)=>e in n?ni(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var re=(n,e,t)=>si(n,typeof e!="symbol"?e+"":e,t);const U=require("./index-BZ7LatAr.js");function te(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function ii(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function mt(n,...e){if(!ii(n))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function un(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");te(n.outputLen),te(n.blockLen)}function ue(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function dn(n,e){mt(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ri=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));function hn(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}const Me=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),D=(n,e)=>n<<32-e|n>>>e,oi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!oi)throw new Error("Non little-endian hardware is not supported");const ai=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function fn(n){if(!hn(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=ai[n[t]];return e}const R={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Jt(n){if(n>=R._0&&n<=R._9)return n-R._0;if(n>=R._A&&n<=R._F)return n-(R._A-10);if(n>=R._a&&n<=R._f)return n-(R._a-10)}function _n(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const s=new Uint8Array(t);for(let i=0,r=0;i<t;i++,r+=2){const o=Jt(n.charCodeAt(r)),a=Jt(n.charCodeAt(r+1));if(o===void 0||a===void 0){const c=n[r]+n[r+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+r)}s[i]=o*16+a}return s}function ci(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function de(n){if(typeof n=="string"&&(n=ci(n)),!hn(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}class Tt{clone(){return this._cloneInto()}}const li={}.toString;function ui(n,e){if(e!==void 0&&li.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(n,e)}function Ut(n){const e=s=>n().update(de(s)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}class pn extends Tt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,un(e);const s=de(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,r=new Uint8Array(i);r.set(s.length>i?e.create().update(s).digest():s);for(let o=0;o<r.length;o++)r[o]^=54;this.iHash.update(r),this.oHash=e.create();for(let o=0;o<r.length;o++)r[o]^=106;this.oHash.update(r),r.fill(0)}update(e){return ue(this),this.iHash.update(e),this}digestInto(e){ue(this),mt(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:s,finished:i,destroyed:r,blockLen:o,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=r,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=s._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ve=(n,e,t)=>new pn(n,e).update(t).digest();Ve.create=(n,e)=>new pn(n,e);function di(n,e,t,s){un(n);const i=ui({dkLen:32,asyncTick:10},s),{c:r,dkLen:o,asyncTick:a}=i;if(te(r),te(o),te(a),r<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=de(e),l=de(t),d=new Uint8Array(o),u=Ve.create(n,c),h=u._cloneInto().update(l);return{c:r,dkLen:o,asyncTick:a,DK:d,PRF:u,PRFSalt:h}}function hi(n,e,t,s,i){return n.destroy(),e.destroy(),s&&s.destroy(),i.fill(0),t}function fi(n,e,t,s){const{c:i,dkLen:r,DK:o,PRF:a,PRFSalt:c}=di(n,e,t,s);let l;const d=new Uint8Array(4),u=Me(d),h=new Uint8Array(a.outputLen);for(let f=1,y=0;y<r;f++,y+=a.outputLen){const b=o.subarray(y,y+a.outputLen);u.setInt32(0,f,!1),(l=c._cloneInto(l)).update(d).digestInto(h),b.set(h.subarray(0,b.length));for(let p=1;p<i;p++){a._cloneInto(l).update(h).digestInto(h);for(let x=0;x<b.length;x++)b[x]^=h[x]}}return hi(a,c,o,l,h)}function _i(n,e,t,s){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,s);const i=BigInt(32),r=BigInt(4294967295),o=Number(t>>i&r),a=Number(t&r),c=s?4:0,l=s?0:4;n.setUint32(e+c,o,s),n.setUint32(e+l,a,s)}class gn extends Tt{constructor(e,t,s,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=s,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Me(this.buffer)}update(e){ue(this);const{view:t,buffer:s,blockLen:i}=this;e=de(e);const r=e.length;for(let o=0;o<r;){const a=Math.min(i-this.pos,r-o);if(a===i){const c=Me(e);for(;i<=r-o;o+=i)this.process(c,o);continue}s.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ue(this),dn(e,this),this.finished=!0;const{buffer:t,view:s,blockLen:i,isLE:r}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(s,0),o=0);for(let u=o;u<i;u++)t[u]=0;_i(s,i-8,BigInt(this.length*8),r),this.process(s,0);const a=Me(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,d[u],r)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const s=e.slice(0,t);return this.destroy(),s}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:s,length:i,finished:r,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=r,e.destroyed=o,i%t&&e.buffer.set(s),e}}const pi=(n,e,t)=>n&e^~n&t,gi=(n,e,t)=>n&e^n&t^e&t,yi=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),W=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),j=new Uint32Array(64);class wi extends gn{constructor(){super(64,32,8,!1),this.A=W[0]|0,this.B=W[1]|0,this.C=W[2]|0,this.D=W[3]|0,this.E=W[4]|0,this.F=W[5]|0,this.G=W[6]|0,this.H=W[7]|0}get(){const{A:e,B:t,C:s,D:i,E:r,F:o,G:a,H:c}=this;return[e,t,s,i,r,o,a,c]}set(e,t,s,i,r,o,a,c){this.A=e|0,this.B=t|0,this.C=s|0,this.D=i|0,this.E=r|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,t){for(let u=0;u<16;u++,t+=4)j[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const h=j[u-15],f=j[u-2],y=D(h,7)^D(h,18)^h>>>3,b=D(f,17)^D(f,19)^f>>>10;j[u]=b+j[u-7]+y+j[u-16]|0}let{A:s,B:i,C:r,D:o,E:a,F:c,G:l,H:d}=this;for(let u=0;u<64;u++){const h=D(a,6)^D(a,11)^D(a,25),f=d+h+pi(a,c,l)+yi[u]+j[u]|0,b=(D(s,2)^D(s,13)^D(s,22))+gi(s,i,r)|0;d=l,l=c,c=a,a=o+f|0,o=r,r=i,i=s,s=f+b|0}s=s+this.A|0,i=i+this.B|0,r=r+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(s,i,r,o,a,c,l,d)}roundClean(){j.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const bi=Ut(()=>new wi),He=BigInt(2**32-1),ht=BigInt(32);function yn(n,e=!1){return e?{h:Number(n&He),l:Number(n>>ht&He)}:{h:Number(n>>ht&He)|0,l:Number(n&He)|0}}function wn(n,e=!1){let t=new Uint32Array(n.length),s=new Uint32Array(n.length);for(let i=0;i<n.length;i++){const{h:r,l:o}=yn(n[i],e);[t[i],s[i]]=[r,o]}return[t,s]}const vi=(n,e)=>BigInt(n>>>0)<<ht|BigInt(e>>>0),mi=(n,e,t)=>n>>>t,Ti=(n,e,t)=>n<<32-t|e>>>t,Ui=(n,e,t)=>n>>>t|e<<32-t,Ai=(n,e,t)=>n<<32-t|e>>>t,xi=(n,e,t)=>n<<64-t|e>>>t-32,Si=(n,e,t)=>n>>>t-32|e<<64-t,Bi=(n,e)=>e,Ei=(n,e)=>n,bn=(n,e,t)=>n<<t|e>>>32-t,vn=(n,e,t)=>e<<t|n>>>32-t,mn=(n,e,t)=>e<<t-32|n>>>64-t,Tn=(n,e,t)=>n<<t-32|e>>>64-t;function Ii(n,e,t,s){const i=(e>>>0)+(s>>>0);return{h:n+t+(i/2**32|0)|0,l:i|0}}const ki=(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),zi=(n,e,t,s)=>e+t+s+(n/2**32|0)|0,Ci=(n,e,t,s)=>(n>>>0)+(e>>>0)+(t>>>0)+(s>>>0),$i=(n,e,t,s,i)=>e+t+s+i+(n/2**32|0)|0,Ni=(n,e,t,s,i)=>(n>>>0)+(e>>>0)+(t>>>0)+(s>>>0)+(i>>>0),Pi=(n,e,t,s,i,r)=>e+t+s+i+r+(n/2**32|0)|0,w={fromBig:yn,split:wn,toBig:vi,shrSH:mi,shrSL:Ti,rotrSH:Ui,rotrSL:Ai,rotrBH:xi,rotrBL:Si,rotr32H:Bi,rotr32L:Ei,rotlSH:bn,rotlSL:vn,rotlBH:mn,rotlBL:Tn,add:Ii,add3L:ki,add3H:zi,add4L:Ci,add4H:$i,add5H:Pi,add5L:Ni},[Oi,Hi]=w.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Q=new Uint32Array(80),V=new Uint32Array(80);class Li extends gn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:s,Bl:i,Ch:r,Cl:o,Dh:a,Dl:c,Eh:l,El:d,Fh:u,Fl:h,Gh:f,Gl:y,Hh:b,Hl:p}=this;return[e,t,s,i,r,o,a,c,l,d,u,h,f,y,b,p]}set(e,t,s,i,r,o,a,c,l,d,u,h,f,y,b,p){this.Ah=e|0,this.Al=t|0,this.Bh=s|0,this.Bl=i|0,this.Ch=r|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=d|0,this.Fh=u|0,this.Fl=h|0,this.Gh=f|0,this.Gl=y|0,this.Hh=b|0,this.Hl=p|0}process(e,t){for(let g=0;g<16;g++,t+=4)Q[g]=e.getUint32(t),V[g]=e.getUint32(t+=4);for(let g=16;g<80;g++){const N=Q[g-15]|0,P=V[g-15]|0,at=w.rotrSH(N,P,1)^w.rotrSH(N,P,8)^w.shrSH(N,P,7),ct=w.rotrSL(N,P,1)^w.rotrSL(N,P,8)^w.shrSL(N,P,7),F=Q[g-2]|0,q=V[g-2]|0,Pe=w.rotrSH(F,q,19)^w.rotrBH(F,q,61)^w.shrSH(F,q,6),lt=w.rotrSL(F,q,19)^w.rotrBL(F,q,61)^w.shrSL(F,q,6),Oe=w.add4L(ct,lt,V[g-7],V[g-16]),ut=w.add4H(Oe,at,Pe,Q[g-7],Q[g-16]);Q[g]=ut|0,V[g]=Oe|0}let{Ah:s,Al:i,Bh:r,Bl:o,Ch:a,Cl:c,Dh:l,Dl:d,Eh:u,El:h,Fh:f,Fl:y,Gh:b,Gl:p,Hh:x,Hl:$}=this;for(let g=0;g<80;g++){const N=w.rotrSH(u,h,14)^w.rotrSH(u,h,18)^w.rotrBH(u,h,41),P=w.rotrSL(u,h,14)^w.rotrSL(u,h,18)^w.rotrBL(u,h,41),at=u&f^~u&b,ct=h&y^~h&p,F=w.add5L($,P,ct,Hi[g],V[g]),q=w.add5H(F,x,N,at,Oi[g],Q[g]),Pe=F|0,lt=w.rotrSH(s,i,28)^w.rotrBH(s,i,34)^w.rotrBH(s,i,39),Oe=w.rotrSL(s,i,28)^w.rotrBL(s,i,34)^w.rotrBL(s,i,39),ut=s&r^s&a^r&a,ti=i&o^i&c^o&c;x=b|0,$=p|0,b=f|0,p=y|0,f=u|0,y=h|0,{h:u,l:h}=w.add(l|0,d|0,q|0,Pe|0),l=a|0,d=c|0,a=r|0,c=o|0,r=s|0,o=i|0;const Xt=w.add3L(Pe,Oe,ti);s=w.add3H(Xt,q,lt,ut),i=Xt|0}({h:s,l:i}=w.add(this.Ah|0,this.Al|0,s|0,i|0)),{h:r,l:o}=w.add(this.Bh|0,this.Bl|0,r|0,o|0),{h:a,l:c}=w.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:d}=w.add(this.Dh|0,this.Dl|0,l|0,d|0),{h:u,l:h}=w.add(this.Eh|0,this.El|0,u|0,h|0),{h:f,l:y}=w.add(this.Fh|0,this.Fl|0,f|0,y|0),{h:b,l:p}=w.add(this.Gh|0,this.Gl|0,b|0,p|0),{h:x,l:$}=w.add(this.Hh|0,this.Hl|0,x|0,$|0),this.set(s,i,r,o,a,c,l,d,u,h,f,y,b,p,x,$)}roundClean(){Q.fill(0),V.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const At=Ut(()=>new Li);function Un(n){if(typeof n!="string")throw new TypeError(`Invalid mnemonic type: ${typeof n}`);return n.normalize("NFKD")}function Mi(n){const e=Un(n),t=e.split(" ");if(![12,15,18,21,24].includes(t.length))throw new Error("Invalid mnemonic");return{nfkd:e,words:t}}const Di=n=>Un(`mnemonic${n}`);function Fi(n,e=""){return fi(At,Mi(n).nfkd,Di(e),{c:2048,dkLen:64})}const[An,xn,Sn]=[[],[],[]],qi=BigInt(0),ve=BigInt(1),Ri=BigInt(2),Gi=BigInt(7),Ki=BigInt(256),Wi=BigInt(113);for(let n=0,e=ve,t=1,s=0;n<24;n++){[t,s]=[s,(2*t+3*s)%5],An.push(2*(5*s+t)),xn.push((n+1)*(n+2)/2%64);let i=qi;for(let r=0;r<7;r++)e=(e<<ve^(e>>Gi)*Wi)%Ki,e&Ri&&(i^=ve<<(ve<<BigInt(r))-ve);Sn.push(i)}const[ji,Qi]=wn(Sn,!0),Yt=(n,e,t)=>t>32?mn(n,e,t):bn(n,e,t),Zt=(n,e,t)=>t>32?Tn(n,e,t):vn(n,e,t);function Vi(n,e=24){const t=new Uint32Array(10);for(let s=24-e;s<24;s++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=t[c],d=t[c+1],u=Yt(l,d,1)^t[a],h=Zt(l,d,1)^t[a+1];for(let f=0;f<50;f+=10)n[o+f]^=u,n[o+f+1]^=h}let i=n[2],r=n[3];for(let o=0;o<24;o++){const a=xn[o],c=Yt(i,r,a),l=Zt(i,r,a),d=An[o];i=n[d],r=n[d+1],n[d]=c,n[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=ji[s],n[1]^=Qi[s]}t.fill(0)}class xt extends Tt{constructor(e,t,s,i=!1,r=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=s,this.enableXOF=i,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,te(s),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ri(this.state)}keccak(){Vi(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){ue(this);const{blockLen:t,state:s}=this;e=de(e);const i=e.length;for(let r=0;r<i;){const o=Math.min(t-this.pos,i-r);for(let a=0;a<o;a++)s[this.pos++]^=e[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:s,blockLen:i}=this;e[s]^=t,t&128&&s===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){ue(this,!1),mt(e),this.finish();const t=this.state,{blockLen:s}=this;for(let i=0,r=e.length;i<r;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,r-i);e.set(t.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return te(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(dn(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:s,outputLen:i,rounds:r,enableXOF:o}=this;return e||(e=new xt(t,s,i,o,r)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=r,e.suffix=s,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Xi=(n,e,t)=>Ut(()=>new xt(e,n,t)),he=Xi(6,136,256/8);async function Ji(n){var e;const{params:t,method:s,url:i,headers:r,body:o,overrides:a}=n,c={headers:r,method:s,url:i,params:t,data:o,withCredentials:(e=a==null?void 0:a.WITH_CREDENTIALS)!=null?e:!0};try{const l=await U.axios(c);return{status:l.status,statusText:l.statusText,data:l.data,headers:l.headers,config:l.config}}catch(l){const d=l;if(d.response)return d.response;throw l}}var Yi={exports:{}};(function(n){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function i(c,l,d){this.fn=c,this.context=l,this.once=d||!1}function r(c,l,d,u,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new i(d,u||c,h),y=t?t+l:l;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],f]:c._events[y].push(f):(c._events[y]=f,c._eventsCount++),c}function o(c,l){--c._eventsCount===0?c._events=new s:delete c._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,u;if(this._eventsCount===0)return l;for(u in d=this._events)e.call(d,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=t?t+l:l,u=this._events[d];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,f=u.length,y=new Array(f);h<f;h++)y[h]=u[h].fn;return y},a.prototype.listenerCount=function(l){var d=t?t+l:l,u=this._events[d];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,d,u,h,f,y){var b=t?t+l:l;if(!this._events[b])return!1;var p=this._events[b],x=arguments.length,$,g;if(p.fn){switch(p.once&&this.removeListener(l,p.fn,void 0,!0),x){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,d),!0;case 3:return p.fn.call(p.context,d,u),!0;case 4:return p.fn.call(p.context,d,u,h),!0;case 5:return p.fn.call(p.context,d,u,h,f),!0;case 6:return p.fn.call(p.context,d,u,h,f,y),!0}for(g=1,$=new Array(x-1);g<x;g++)$[g-1]=arguments[g];p.fn.apply(p.context,$)}else{var N=p.length,P;for(g=0;g<N;g++)switch(p[g].once&&this.removeListener(l,p[g].fn,void 0,!0),x){case 1:p[g].fn.call(p[g].context);break;case 2:p[g].fn.call(p[g].context,d);break;case 3:p[g].fn.call(p[g].context,d,u);break;case 4:p[g].fn.call(p[g].context,d,u,h);break;default:if(!$)for(P=1,$=new Array(x-1);P<x;P++)$[P-1]=arguments[P];p[g].fn.apply(p[g].context,$)}}return!0},a.prototype.on=function(l,d,u){return r(this,l,d,u,!1)},a.prototype.once=function(l,d,u){return r(this,l,d,u,!0)},a.prototype.removeListener=function(l,d,u,h){var f=t?t+l:l;if(!this._events[f])return this;if(!d)return o(this,f),this;var y=this._events[f];if(y.fn)y.fn===d&&(!h||y.once)&&(!u||y.context===u)&&o(this,f);else{for(var b=0,p=[],x=y.length;b<x;b++)(y[b].fn!==d||h&&!y[b].once||u&&y[b].context!==u)&&p.push(y[b]);p.length?this._events[f]=p.length===1?p[0]:p:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var d;return l?(d=t?t+l:l,this._events[d]&&o(this,d)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,n.exports=a})(Yi);var Bn=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,Xe=(n,e)=>{for(var t in e)Bn(n,t,{get:e[t],enumerable:!0})},m=(n,e,t,s)=>{for(var i=Zi(e,t),r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=o(e,t,i)||i);return i&&Bn(e,t,i),i},er=/^m(\/[0-9]+')+$/,En=n=>n.replace("'",""),tr="ed25519 seed",nr=2147483648,sr=n=>{const t=Ve.create(At,tr).update(_n(n)).digest(),s=t.slice(0,32),i=t.slice(32);return{key:s,chainCode:i}},ir=({key:n,chainCode:e},t)=>{const s=new ArrayBuffer(4);new DataView(s).setUint32(0,t);const i=new Uint8Array(s),r=new Uint8Array([0]),o=new Uint8Array([...r,...n,...i]),a=Ve.create(At,e).update(o).digest(),c=a.slice(0,32),l=a.slice(32);return{key:c,chainCode:l}},rr=n=>er.test(n)?!n.split("/").slice(1).map(En).some(Number.isNaN):!1,or=(n,e,t=nr)=>{if(!rr(n))throw new Error("Invalid derivation path");const{key:s,chainCode:i}=sr(e);return n.split("/").slice(1).map(En).map(o=>parseInt(o,10)).reduce((o,a)=>ir(o,a+t),{key:s,chainCode:i})},ar="1.21.0";async function cr(n){return new Promise(e=>{setTimeout(e,n)})}var en="/v1";function lr(n){let e=`${n}`;return e.endsWith("/")&&(e=e.substring(0,e.length-1)),e.endsWith(en)||(e=`${e}${en}`),e}var In=2e5,kn=20,ur=20,ft="0x1::aptos_coin::AptosCoin";function Je(n){let e,t,s;return typeof n=="object"?(e=n.hashFunction,t=n.ttlMs,s=n.tags):e=n,(i,r,o)=>{if(o.value!=null)o.value=tn(o.value,e,t,s);else if(o.get!=null)o.get=tn(o.get,e,t,s);else throw new Error("Only put a Memoize() decorator on a method or get accessor.")}}function zn(n,e){return Je({ttlMs:n,hashFunction:e})}var De=new Map;function dr(n){const e=new Set;for(const t of n){const s=De.get(t);if(s)for(const i of s)e.has(i)||(i.clear(),e.add(i))}return e.size}function tn(n,e,t=0,s){const i=Symbol("__memoized_map__");return function(...r){let o;const a=this;a.hasOwnProperty(i)||Object.defineProperty(a,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});const c=a[i];if(Array.isArray(s))for(const l of s)De.has(l)?De.get(l).push(c):De.set(l,[c]);if(e||r.length>0||t>0){let l;e===!0?l=r.map(h=>h.toString()).join("!"):e?l=e.apply(a,r):l=r[0];const d=`${l}__timestamp`;let u=!1;if(t>0)if(!c.has(d))u=!0;else{const h=c.get(d);u=Date.now()-h>t}c.has(l)&&!u?o=c.get(l):(o=n.apply(a,r),c.set(l,o),t>0&&c.set(d,Date.now()))}else{const l=a;c.has(l)?o=c.get(l):(o=n.apply(a,r),c.set(l,o))}return o}}var Cn=class extends Error{constructor(n,e,t){super(t),this.name="AptosApiError",this.url=e.url,this.status=e.status,this.statusText=e.statusText,this.data=e.data,this.request=n}},hr={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 fr(n,e,t,s,i,r){const o={...r==null?void 0:r.HEADERS,"x-aptos-client":`aptos-ts-sdk/${ar}`,"content-type":s??"application/json"};return r!=null&&r.TOKEN&&(o.Authorization=`Bearer ${r==null?void 0:r.TOKEN}`),await Ji({url:n,method:e,body:t,params:i,headers:o,overrides:r})}async function $n(n){const{url:e,endpoint:t,method:s,body:i,contentType:r,params:o,overrides:a}=n,c=`${e}/${t??""}`,l=await fr(c,s,i,r,o,a),d={status:l.status,statusText:l.statusText,data:l.data,headers:l.headers,config:l.config,url:c};if(d.status>=200&&d.status<300)return d;const u=hr[d.status];throw new Cn(n,d,u??"Generic Error")}async function O(n){return await $n({...n,method:"GET"})}async function me(n){return await $n({...n,method:"POST"})}async function nn(n){const e=[];let t;const s=n.params;for(;;){s.start=t;const i=await O({url:n.url,endpoint:n.endpoint,params:s,originMethod:n.originMethod,overrides:n.overrides});if(t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),t==null)break}return e}var _t={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},_r={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},sn={"https://fullnode.mainnet.aptoslabs.com/v1":"mainnet","https://fullnode.testnet.aptoslabs.com/v1":"testnet","https://fullnode.devnet.aptoslabs.com/v1":"devnet","http://127.0.0.1:8080/v1":"local"},_=class Fe{static fromBuffer(e){return Fe.fromUint8Array(e)}static fromUint8Array(e){return new Fe(fn(e))}static ensure(e){return typeof e=="string"?new Fe(e):e}constructor(e){e.startsWith("0x")?this.hexString=e:this.hexString=`0x${e}`}hex(){return this.hexString}noPrefix(){return this.hexString.slice(2)}toString(){return this.hex()}toShortString(){return`0x${this.hexString.replace(/^0x0*/,"")}`}toUint8Array(){return Uint8Array.from(_n(this.noPrefix()))}},T={};Xe(T,{AccountAddress:()=>v,AccountAuthenticator:()=>Y,AccountAuthenticatorEd25519:()=>Wn,AccountAuthenticatorMultiEd25519:()=>Qn,ArgumentABI:()=>nt,AuthenticationKey:()=>bt,ChainId:()=>Ht,ChangeSet:()=>Nr,Ed25519PublicKey:()=>L,Ed25519Signature:()=>G,EntryFunction:()=>Ze,EntryFunctionABI:()=>xe,FeePayerRawTransaction:()=>Nt,Identifier:()=>z,Module:()=>$r,ModuleId:()=>Ae,MultiAgentRawTransaction:()=>$t,MultiEd25519PublicKey:()=>Ye,MultiEd25519Signature:()=>Bt,MultiSig:()=>ps,MultiSigTransactionPayload:()=>fs,RawTransaction:()=>be,RawTransactionWithData:()=>Ct,RotationProofChallenge:()=>Or,Script:()=>zt,ScriptABI:()=>st,SignedTransaction:()=>et,StructTag:()=>we,Transaction:()=>Ps,TransactionArgument:()=>M,TransactionArgumentAddress:()=>Gt,TransactionArgumentBool:()=>Wt,TransactionArgumentU128:()=>qt,TransactionArgumentU16:()=>Mt,TransactionArgumentU256:()=>Rt,TransactionArgumentU32:()=>Dt,TransactionArgumentU64:()=>Ft,TransactionArgumentU8:()=>Lt,TransactionArgumentU8Vector:()=>Kt,TransactionAuthenticator:()=>_e,TransactionAuthenticatorEd25519:()=>Et,TransactionAuthenticatorFeePayer:()=>Gn,TransactionAuthenticatorMultiAgent:()=>qn,TransactionAuthenticatorMultiEd25519:()=>It,TransactionPayload:()=>Ce,TransactionPayloadEntryFunction:()=>Ot,TransactionPayloadMultisig:()=>Us,TransactionPayloadScript:()=>Pt,TransactionScriptABI:()=>jt,TypeArgumentABI:()=>tt,TypeTag:()=>k,TypeTagAddress:()=>ne,TypeTagBool:()=>pe,TypeTagParser:()=>ze,TypeTagParserError:()=>us,TypeTagSigner:()=>rs,TypeTagStruct:()=>se,TypeTagU128:()=>ye,TypeTagU16:()=>Be,TypeTagU256:()=>Ie,TypeTagU32:()=>Ee,TypeTagU64:()=>ge,TypeTagU8:()=>Z,TypeTagVector:()=>ke,UserTransaction:()=>Os,WriteSet:()=>Pr,objectStructTag:()=>Ir,optionStructTag:()=>Er,stringStructTag:()=>kt});var pr={};Xe(pr,{Deserializer:()=>St,Serializer:()=>A,bcsSerializeBool:()=>xr,bcsSerializeBytes:()=>X,bcsSerializeFixedBytes:()=>Br,bcsSerializeStr:()=>Sr,bcsSerializeU128:()=>Ur,bcsSerializeU16:()=>mr,bcsSerializeU256:()=>Ar,bcsSerializeU32:()=>Tr,bcsSerializeU8:()=>pt,bcsSerializeUint64:()=>vr,bcsToBytes:()=>K,deserializeVector:()=>C,serializeVector:()=>I,serializeVectorWithFunc:()=>br});var gr=2**8-1,yr=2**16-1,Ue=2**32-1,Nn=BigInt(2**64)-BigInt(1),Pn=BigInt(2**128)-BigInt(1),wr=BigInt(2**256)-BigInt(1),A=class{constructor(){this.buffer=new ArrayBuffer(64),this.offset=0}ensureBufferWillHandleSize(n){for(;this.buffer.byteLength<this.offset+n;){const e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}serialize(n){this.ensureBufferWillHandleSize(n.length),new Uint8Array(this.buffer,this.offset).set(n),this.offset+=n.length}serializeWithFunction(n,e,t){this.ensureBufferWillHandleSize(e);const s=new DataView(this.buffer,this.offset);n.apply(s,[0,t,!0]),this.offset+=e}serializeStr(n){const e=new TextEncoder;this.serializeBytes(e.encode(n))}serializeBytes(n){this.serializeU32AsUleb128(n.length),this.serialize(n)}serializeFixedBytes(n){this.serialize(n)}serializeBool(n){if(typeof n!="boolean")throw new Error("Value needs to be a boolean");const e=n?1:0;this.serialize(new Uint8Array([e]))}serializeU8(n){this.serialize(new Uint8Array([n]))}serializeU16(n){this.serializeWithFunction(DataView.prototype.setUint16,2,n)}serializeU32(n){this.serializeWithFunction(DataView.prototype.setUint32,4,n)}serializeU64(n){const e=BigInt(n.toString())&BigInt(Ue),t=BigInt(n.toString())>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(t))}serializeU128(n){const e=BigInt(n.toString())&Nn,t=BigInt(n.toString())>>BigInt(64);this.serializeU64(e),this.serializeU64(t)}serializeU256(n){const e=BigInt(n.toString())&Pn,t=BigInt(n.toString())>>BigInt(128);this.serializeU128(e),this.serializeU128(t)}serializeU32AsUleb128(n){let e=n;const t=[];for(;e>>>7;)t.push(e&127|128),e>>>=7;t.push(e),this.serialize(new Uint8Array(t))}getBytes(){return new Uint8Array(this.buffer).slice(0,this.offset)}};m([ie(0,gr)],A.prototype,"serializeU8");m([ie(0,yr)],A.prototype,"serializeU16");m([ie(0,Ue)],A.prototype,"serializeU32");m([ie(BigInt(0),Nn)],A.prototype,"serializeU64");m([ie(BigInt(0),Pn)],A.prototype,"serializeU128");m([ie(BigInt(0),wr)],A.prototype,"serializeU256");m([ie(0,Ue)],A.prototype,"serializeU32AsUleb128");function ie(n,e,t){return(s,i,r)=>{const o=r.value;return r.value=function(c){const l=BigInt(c.toString());if(l>BigInt(e.toString())||l<BigInt(n.toString()))throw new Error("Value is out of range");o.apply(this,[c])},r}}var St=class{constructor(n){this.buffer=new ArrayBuffer(n.length),new Uint8Array(this.buffer).set(n,0),this.offset=0}read(n){if(this.offset+n>this.buffer.byteLength)throw new Error("Reached to the end of buffer");const e=this.buffer.slice(this.offset,this.offset+n);return this.offset+=n,e}deserializeStr(){const n=this.deserializeBytes();return new TextDecoder().decode(n)}deserializeBytes(){const n=this.deserializeUleb128AsU32();return new Uint8Array(this.read(n))}deserializeFixedBytes(n){return new Uint8Array(this.read(n))}deserializeBool(){const n=new Uint8Array(this.read(1))[0];if(n!==1&&n!==0)throw new Error("Invalid boolean value");return n===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){const n=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(n))}deserializeU128(){const n=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|n)}deserializeU256(){const n=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|n)}deserializeUleb128AsU32(){let n=BigInt(0),e=0;for(;n<Ue;){const t=this.deserializeU8();if(n|=BigInt(t&127)<<BigInt(e),!(t&128))break;e+=7}if(n>Ue)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(n)}};function I(n,e){e.serializeU32AsUleb128(n.length),n.forEach(t=>{t.serialize(e)})}function br(n,e){const t=new A;t.serializeU32AsUleb128(n.length);const s=t[e];return n.forEach(i=>{s.call(t,i)}),t.getBytes()}function C(n,e){const t=n.deserializeUleb128AsU32(),s=[];for(let i=0;i<t;i+=1)s.push(e.deserialize(n));return s}function K(n){const e=new A;return n.serialize(e),e.getBytes()}function vr(n){const e=new A;return e.serializeU64(n),e.getBytes()}function pt(n){const e=new A;return e.serializeU8(n),e.getBytes()}function mr(n){const e=new A;return e.serializeU16(n),e.getBytes()}function Tr(n){const e=new A;return e.serializeU32(n),e.getBytes()}function Ur(n){const e=new A;return e.serializeU128(n),e.getBytes()}function Ar(n){const e=new A;return e.serializeU256(n),e.getBytes()}function xr(n){const e=new A;return e.serializeBool(n),e.getBytes()}function Sr(n){const e=new A;return e.serializeStr(n),e.getBytes()}function X(n){const e=new A;return e.serializeBytes(n),e.getBytes()}function Br(n){const e=new A;return e.serializeFixedBytes(n),e.getBytes()}var We=class H{constructor(e){if(e.length!==H.LENGTH)throw new Error("Expected address of length 32");this.address=e}static fromHex(e){let t=_.ensure(e);t.noPrefix().length%2!==0&&(t=new _(`0${t.noPrefix()}`));const s=t.toUint8Array();if(s.length>H.LENGTH)throw new Error("Hex string is too long. Address's length is 32 bytes.");if(s.length===H.LENGTH)return new H(s);const i=new Uint8Array(H.LENGTH);return i.set(s,H.LENGTH-s.length),new H(i)}static isValid(e){if(e==="")return!1;let t=_.ensure(e);return t.noPrefix().length%2!==0&&(t=new _(`0${t.noPrefix()}`)),t.toUint8Array().length<=H.LENGTH}toHexString(){return _.fromUint8Array(this.address).hex()}serialize(e){e.serializeFixedBytes(this.address)}static deserialize(e){return new H(e.deserializeFixedBytes(H.LENGTH))}static standardizeAddress(e){const t=e.toLowerCase();return`0x${(t.startsWith("0x")?t.slice(2):t).padStart(64,"0")}`}};We.LENGTH=32;We.CORE_CODE_ADDRESS=We.fromHex("0x1");var v=We,On=class qe{constructor(e){if(e.length!==qe.LENGTH)throw new Error(`Ed25519PublicKey length should be ${qe.LENGTH}`);this.value=e}toBytes(){return this.value}serialize(e){e.serializeBytes(this.value)}static deserialize(e){const t=e.deserializeBytes();return new qe(t)}};On.LENGTH=32;var L=On,Hn=class Re{constructor(e){if(this.value=e,e.length!==Re.LENGTH)throw new Error(`Ed25519Signature length should be ${Re.LENGTH}`)}serialize(e){e.serializeBytes(this.value)}static deserialize(e){const t=e.deserializeBytes();return new Re(t)}};Hn.LENGTH=64;var G=Hn,gt=32,Ye=class Ln{constructor(e,t){if(this.public_keys=e,this.threshold=t,t>gt)throw new Error(`"threshold" cannot be larger than ${gt}`)}toBytes(){const e=new Uint8Array(this.public_keys.length*L.LENGTH+1);return this.public_keys.forEach((t,s)=>{e.set(t.value,s*L.LENGTH)}),e[this.public_keys.length*L.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toBytes())}static deserialize(e){const t=e.deserializeBytes(),s=t[t.length-1],i=[];for(let r=0;r<t.length-1;r+=L.LENGTH){const o=r;i.push(new L(t.subarray(o,o+L.LENGTH)))}return new Ln(i,s)}},Mn=class Te{constructor(e,t){if(this.signatures=e,this.bitmap=t,t.length!==Te.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Te.BITMAP_LEN}`)}toBytes(){const e=new Uint8Array(this.signatures.length*G.LENGTH+Te.BITMAP_LEN);return this.signatures.forEach((t,s)=>{e.set(t.value,s*G.LENGTH)}),e.set(this.bitmap,this.signatures.length*G.LENGTH),e}static createBitmap(e){const s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach(r=>{if(r>=gt)throw new Error(`Invalid bit value ${r}.`);if(i.has(r))throw new Error("Duplicated bits detected.");i.add(r);const o=Math.floor(r/8);let a=s[o];a|=128>>r%8,s[o]=a}),s}serialize(e){e.serializeBytes(this.toBytes())}static deserialize(e){const t=e.deserializeBytes(),s=t.subarray(t.length-4),i=[];for(let r=0;r<t.length-s.length;r+=G.LENGTH){const o=r;i.push(new G(t.subarray(o,o+G.LENGTH)))}return new Te(i,s)}};Mn.BITMAP_LEN=4;var Bt=Mn,_e=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Et.load(n);case 1:return It.load(n);case 2:return qn.load(n);case 3:return Gn.load(n);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Et=class Dn extends _e{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=L.deserialize(e),s=G.deserialize(e);return new Dn(t,s)}},It=class Fn extends _e{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=Ye.deserialize(e),s=Bt.deserialize(e);return new Fn(t,s)}},qn=class Rn extends _e{constructor(e,t,s){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=s}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),I(this.secondary_signer_addresses,e),I(this.secondary_signers,e)}static load(e){const t=Y.deserialize(e),s=C(e,v),i=C(e,Y);return new Rn(t,s,i)}},Gn=class Kn extends _e{constructor(e,t,s,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=s,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),I(this.secondary_signer_addresses,e),I(this.secondary_signers,e),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){const t=Y.deserialize(e),s=C(e,v),i=C(e,Y),r=v.deserialize(e),o=Y.deserialize(e),a={address:r,authenticator:o};return new Kn(t,s,i,a)}},Y=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Wn.load(n);case 1:return Qn.load(n);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},Wn=class jn extends Y{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=L.deserialize(e),s=G.deserialize(e);return new jn(t,s)}},Qn=class Vn extends Y{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=Ye.deserialize(e),s=Bt.deserialize(e);return new Vn(t,s)}},z=class Xn{constructor(e){this.value=e}serialize(e){e.serializeStr(this.value)}static deserialize(e){const t=e.deserializeStr();return new Xn(t)}},k=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return pe.load(n);case 1:return Z.load(n);case 2:return ge.load(n);case 3:return ye.load(n);case 4:return ne.load(n);case 5:return rs.load(n);case 6:return ke.load(n);case 7:return se.load(n);case 8:return Be.load(n);case 9:return Ee.load(n);case 10:return Ie.load(n);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}},pe=class Jn extends k{serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new Jn}},Z=class Yn extends k{serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new Yn}},Be=class Zn extends k{serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new Zn}},Ee=class es extends k{serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new es}},ge=class ts extends k{serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new ts}},ye=class ns extends k{serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new ns}},Ie=class ss extends k{serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new ss}},ne=class is extends k{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new is}},rs=class os extends k{serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new os}},ke=class as extends k{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){const t=k.deserialize(e);return new as(t)}},se=class cs extends k{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){const t=we.deserialize(e);return new cs(t)}isStringTypeTag(){return this.value.module_name.value==="string"&&this.value.name.value==="String"&&this.value.address.toHexString()===v.CORE_CODE_ADDRESS.toHexString()}},we=class yt{constructor(e,t,s,i){this.address=e,this.module_name=t,this.name=s,this.type_args=i}static fromString(e){const t=new ze(e).parseTypeTag();return new yt(t.value.address,t.value.module_name,t.value.name,t.value.type_args)}serialize(e){this.address.serialize(e),this.module_name.serialize(e),this.name.serialize(e),I(this.type_args,e)}static deserialize(e){const t=v.deserialize(e),s=z.deserialize(e),i=z.deserialize(e),r=C(e,k);return new yt(t,s,i,r)}},kt=new we(v.fromHex("0x1"),new z("string"),new z("String"),[]);function Er(n){return new we(v.fromHex("0x1"),new z("option"),new z("Option"),[n])}function Ir(n){return new we(v.fromHex("0x1"),new z("object"),new z("Object"),[n])}function J(n){throw new us(n)}function rn(n){return!!n.match(/\s/)}function on(n){return!!n.match(/[_A-Za-z0-9]/g)}function kr(n){return!!n.match(/T\d+/g)}function zr(n,e){const t=n[e];if(t===":"){if(n.slice(e,e+2)==="::")return[["COLON","::"],2];J("Unrecognized token.")}else{if(t==="<")return[["LT","<"],1];if(t===">")return[["GT",">"],1];if(t===",")return[["COMMA",","],1];if(rn(t)){let s="";for(let i=e;i<n.length;i+=1){const r=n[i];if(rn(r))s=`${s}${r}`;else break}return[["SPACE",s],s.length]}else if(on(t)){let s="";for(let i=e;i<n.length;i+=1){const r=n[i];if(on(r))s=`${s}${r}`;else break}return kr(s)?[["GENERIC",s],s.length]:[["IDENT",s],s.length]}}throw new Error("Unrecognized token.")}function Cr(n){let e=0;const t=[];for(;e<n.length;){const[s,i]=zr(n,e);s[0]!=="SPACE"&&t.push(s),e+=i}return t}var ze=class ls{constructor(e,t){this.typeTags=[],this.tokens=Cr(e),this.typeTags=t||[]}consume(e){const t=this.tokens.shift();(!t||t[1]!==e)&&J("Invalid type tag.")}consumeWholeGeneric(){for(this.consume("<");this.tokens[0][1]!==">";)this.tokens[0][1]==="<"?this.consumeWholeGeneric():this.tokens.shift();this.consume(">")}parseCommaList(e,t){const s=[];for(this.tokens.length<=0&&J("Invalid type tag.");this.tokens[0][1]!==e&&(s.push(this.parseTypeTag()),!(this.tokens.length>0&&this.tokens[0][1]===e||(this.consume(","),this.tokens.length>0&&this.tokens[0][1]===e&&t)));)this.tokens.length<=0&&J("Invalid type tag.");return s}parseTypeTag(){this.tokens.length===0&&J("Invalid type tag.");const[e,t]=this.tokens.shift();if(t==="u8")return new Z;if(t==="u16")return new Be;if(t==="u32")return new Ee;if(t==="u64")return new ge;if(t==="u128")return new ye;if(t==="u256")return new Ie;if(t==="bool")return new pe;if(t==="address")return new ne;if(t==="vector"){this.consume("<");const s=this.parseTypeTag();return this.consume(">"),new ke(s)}if(t==="string")return new se(kt);if(e==="IDENT"&&(t.startsWith("0x")||t.startsWith("0X"))){const s=v.fromHex(t);this.consume("::");const[i,r]=this.tokens.shift();i!=="IDENT"&&J("Invalid type tag."),this.consume("::");const[o,a]=this.tokens.shift();if(o!=="IDENT"&&J("Invalid type tag."),v.CORE_CODE_ADDRESS.toHexString()===s.toHexString()&&r==="object"&&a==="Object")return this.consumeWholeGeneric(),new ne;let c=[];this.tokens.length>0&&this.tokens[0][1]==="<"&&(this.consume("<"),c=this.parseCommaList(">",!0),this.consume(">"));const l=new we(s,new z(r),new z(a),c);return new se(l)}if(e==="GENERIC"){this.typeTags.length===0&&J("Can't convert generic type since no typeTags were specified.");const s=parseInt(t.substring(1),10);return new ls(this.typeTags[s]).parseTypeTag()}throw new Error("Invalid type tag.")}},us=class extends Error{constructor(n){super(n),this.name="TypeTagParserError"}},be=class ds{constructor(e,t,s,i,r,o,a){this.sender=e,this.sequence_number=t,this.payload=s,this.max_gas_amount=i,this.gas_unit_price=r,this.expiration_timestamp_secs=o,this.chain_id=a}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){const t=v.deserialize(e),s=e.deserializeU64(),i=Ce.deserialize(e),r=e.deserializeU64(),o=e.deserializeU64(),a=e.deserializeU64(),c=Ht.deserialize(e);return new ds(t,s,i,r,o,a,c)}},zt=class hs{constructor(e,t,s){this.code=e,this.ty_args=t,this.args=s}serialize(e){e.serializeBytes(this.code),I(this.ty_args,e),I(this.args,e)}static deserialize(e){const t=e.deserializeBytes(),s=C(e,k),i=C(e,M);return new hs(t,s,i)}},Ze=class Ge{constructor(e,t,s,i){this.module_name=e,this.function_name=t,this.ty_args=s,this.args=i}static natural(e,t,s,i){return new Ge(Ae.fromStr(e),new z(t),s,i)}static natual(e,t,s,i){return Ge.natural(e,t,s,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),I(this.ty_args,e),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{e.serializeBytes(t)})}static deserialize(e){const t=Ae.deserialize(e),s=z.deserialize(e),i=C(e,k),r=e.deserializeUleb128AsU32(),o=[];for(let c=0;c<r;c+=1)o.push(e.deserializeBytes());const a=o;return new Ge(t,s,i,a)}},fs=class _s{constructor(e){this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new _s(Ze.deserialize(e))}},ps=class gs{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){const t=v.deserialize(e),s=e.deserializeBool();let i;return s&&(i=fs.deserialize(e)),new gs(t,i)}},$r=class ys{constructor(e){this.code=e}serialize(e){e.serializeBytes(this.code)}static deserialize(e){const t=e.deserializeBytes();return new ys(t)}},Ae=class wt{constructor(e,t){this.address=e,this.name=t}static fromStr(e){const t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new wt(v.fromHex(new _(t[0])),new z(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){const t=v.deserialize(e),s=z.deserialize(e);return new wt(t,s)}},Nr=class{serialize(n){throw new Error("Not implemented.")}static deserialize(n){throw new Error("Not implemented.")}},Pr=class{serialize(n){throw new Error("Not implmented.")}static deserialize(n){throw new Error("Not implmented.")}},et=class ws{constructor(e,t){this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){const t=be.deserialize(e),s=_e.deserialize(e);return new ws(t,s)}},Ct=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return $t.load(n);case 1:return Nt.load(n);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},$t=class bs extends Ct{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),I(this.secondary_signer_addresses,e)}static load(e){const t=be.deserialize(e),s=C(e,v);return new bs(t,s)}},Nt=class vs extends Ct{constructor(e,t,s){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=s}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),I(this.secondary_signer_addresses,e),this.fee_payer_address.serialize(e)}static load(e){const t=be.deserialize(e),s=C(e,v),i=v.deserialize(e);return new vs(t,s,i)}},Ce=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Pt.load(n);case 2:return Ot.load(n);case 3:return Us.load(n);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Pt=class ms extends Ce{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(0),this.value.serialize(e)}static load(e){const t=zt.deserialize(e);return new ms(t)}},Ot=class Ts extends Ce{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(2),this.value.serialize(e)}static load(e){const t=Ze.deserialize(e);return new Ts(t)}},Us=class As extends Ce{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(3),this.value.serialize(e)}static load(e){const t=ps.deserialize(e);return new As(t)}},Ht=class xs{constructor(e){this.value=e}serialize(e){e.serializeU8(this.value)}static deserialize(e){const t=e.deserializeU8();return new xs(t)}},M=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Lt.load(n);case 1:return Ft.load(n);case 2:return qt.load(n);case 3:return Gt.load(n);case 4:return Kt.load(n);case 5:return Wt.load(n);case 6:return Mt.load(n);case 7:return Dt.load(n);case 8:return Rt.load(n);default:throw new Error(`Unknown variant index for TransactionArgument: ${e}`)}}},Lt=class Ss extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(0),e.serializeU8(this.value)}static load(e){const t=e.deserializeU8();return new Ss(t)}},Mt=class Bs extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(6),e.serializeU16(this.value)}static load(e){const t=e.deserializeU16();return new Bs(t)}},Dt=class Es extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(7),e.serializeU32(this.value)}static load(e){const t=e.deserializeU32();return new Es(t)}},Ft=class Is extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(1),e.serializeU64(this.value)}static load(e){const t=e.deserializeU64();return new Is(t)}},qt=class ks extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(2),e.serializeU128(this.value)}static load(e){const t=e.deserializeU128();return new ks(t)}},Rt=class zs extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(8),e.serializeU256(this.value)}static load(e){const t=e.deserializeU256();return new zs(t)}},Gt=class Cs extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(3),this.value.serialize(e)}static load(e){const t=v.deserialize(e);return new Cs(t)}},Kt=class $s extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(4),e.serializeBytes(this.value)}static load(e){const t=e.deserializeBytes();return new $s(t)}},Wt=class Ns extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(5),e.serializeBool(this.value)}static load(e){const t=e.deserializeBool();return new Ns(t)}},Ps=class{getHashSalt(){const n=he.create();return n.update("APTOS::Transaction"),n.digest()}static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Os.load(n);default:throw new Error(`Unknown variant index for Transaction: ${e}`)}}},Os=class Hs extends Ps{constructor(e){super(),this.value=e}hash(){const e=he.create();return e.update(this.getHashSalt()),e.update(K(this)),e.digest()}serialize(e){e.serializeU32AsUleb128(0),this.value.serialize(e)}static load(e){return new Hs(et.deserialize(e))}},tt=class Ls{constructor(e){this.name=e}serialize(e){e.serializeStr(this.name)}static deserialize(e){const t=e.deserializeStr();return new Ls(t)}},nt=class Ms{constructor(e,t){this.name=e,this.type_tag=t}serialize(e){e.serializeStr(this.name),this.type_tag.serialize(e)}static deserialize(e){const t=e.deserializeStr(),s=k.deserialize(e);return new Ms(t,s)}},st=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return jt.load(n);case 1:return xe.load(n);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},jt=class Ds extends st{constructor(e,t,s,i,r){super(),this.name=e,this.doc=t,this.code=s,this.ty_args=i,this.args=r}serialize(e){e.serializeU32AsUleb128(0),e.serializeStr(this.name),e.serializeStr(this.doc),e.serializeBytes(this.code),I(this.ty_args,e),I(this.args,e)}static load(e){const t=e.deserializeStr(),s=e.deserializeStr(),i=e.deserializeBytes(),r=C(e,tt),o=C(e,nt);return new Ds(t,s,i,r,o)}},xe=class Fs extends st{constructor(e,t,s,i,r){super(),this.name=e,this.module_name=t,this.doc=s,this.ty_args=i,this.args=r}serialize(e){e.serializeU32AsUleb128(1),e.serializeStr(this.name),this.module_name.serialize(e),e.serializeStr(this.doc),I(this.ty_args,e),I(this.args,e)}static load(e){const t=e.deserializeStr(),s=Ae.deserialize(e),i=e.deserializeStr(),r=C(e,tt),o=C(e,nt);return new Fs(t,s,i,r,o)}},$e=class oe{constructor(e){if(e.length!==oe.LENGTH)throw new Error("Expected a byte array of length 32");this.bytes=e}static fromMultiEd25519PublicKey(e){const t=e.toBytes(),s=new Uint8Array(t.length+1);s.set(t),s.set([oe.MULTI_ED25519_SCHEME],t.length);const i=he.create();return i.update(s),new oe(i.digest())}static fromEd25519PublicKey(e){const t=e.value,s=new Uint8Array(t.length+1);s.set(t),s.set([oe.ED25519_SCHEME],t.length);const i=he.create();return i.update(s),new oe(i.digest())}derivedAddress(){return _.fromUint8Array(this.bytes)}};$e.LENGTH=32;$e.MULTI_ED25519_SCHEME=1;$e.ED25519_SCHEME=0;$e.DERIVE_RESOURCE_ACCOUNT_SCHEME=255;var bt=$e,Or=class{constructor(n,e,t,s,i,r,o){this.accountAddress=n,this.moduleName=e,this.structName=t,this.sequenceNumber=s,this.originator=i,this.currentAuthKey=r,this.newPublicKey=o}serialize(n){this.accountAddress.serialize(n),n.serializeStr(this.moduleName),n.serializeStr(this.structName),n.serializeU64(this.sequenceNumber),this.originator.serialize(n),this.currentAuthKey.serialize(n),n.serializeBytes(this.newPublicKey)}},qs=class Ke{static fromAptosAccountObject(e){return new Ke(_.ensure(e.privateKeyHex).toUint8Array(),e.address)}static isValidPath(e){return/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'+$/.test(e)}static fromDerivePath(e,t){if(!Ke.isValidPath(e))throw new Error("Invalid derivation path");const s=t.trim().split(/\s+/).map(r=>r.toLowerCase()).join(" "),{key:i}=or(e,fn(Fi(s)));return new Ke(i)}constructor(e,t){e?this.signingKey=U.nacl2.sign.keyPair.fromSeed(e.slice(0,32)):this.signingKey=U.nacl2.sign.keyPair(),this.accountAddress=_.ensure(t||this.authKey().hex())}address(){return this.accountAddress}authKey(){const e=new L(this.signingKey.publicKey);return bt.fromEd25519PublicKey(e).derivedAddress()}static getResourceAccountAddress(e,t){const s=K(v.fromHex(e)),i=new Uint8Array([...s,...t,bt.DERIVE_RESOURCE_ACCOUNT_SCHEME]),r=he.create();return r.update(i),_.fromUint8Array(r.digest())}static getCollectionID(e,t){const s=new TextEncoder().encode(`${e}::${t}`),i=bi.create();return i.update(s),_.fromUint8Array(i.digest())}pubKey(){return _.fromUint8Array(this.signingKey.publicKey)}signBuffer(e){const t=U.nacl2.sign.detached(e,this.signingKey.secretKey);return _.fromUint8Array(t)}signHexString(e){const t=_.ensure(e).toUint8Array();return this.signBuffer(t)}verifySignature(e,t){const s=_.ensure(e).toUint8Array(),i=_.ensure(t).toUint8Array();return U.nacl2.sign.detached.verify(s,i,this.signingKey.publicKey)}toPrivateKeyObject(){return{address:this.address().hex(),publicKeyHex:this.pubKey().hex(),privateKeyHex:_.fromUint8Array(this.signingKey.secretKey.slice(0,32)).hex()}}};m([Je()],qs.prototype,"authKey");var je=qs;function Le(n){return n instanceof je?n.address():_.ensure(n)}var Ne=`
|
|
1
|
+
"use strict";var ni=Object.defineProperty;var si=(n,e,t)=>e in n?ni(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var re=(n,e,t)=>si(n,typeof e!="symbol"?e+"":e,t);const U=require("./index-CDGktAjP.js");function te(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function ii(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function mt(n,...e){if(!ii(n))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(n.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${n.length}`)}function un(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");te(n.outputLen),te(n.blockLen)}function ue(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function dn(n,e){mt(n);const t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ri=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));function hn(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}const Me=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),D=(n,e)=>n<<32-e|n>>>e,oi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!oi)throw new Error("Non little-endian hardware is not supported");const ai=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function fn(n){if(!hn(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=ai[n[t]];return e}const R={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Jt(n){if(n>=R._0&&n<=R._9)return n-R._0;if(n>=R._A&&n<=R._F)return n-(R._A-10);if(n>=R._a&&n<=R._f)return n-(R._a-10)}function _n(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);const e=n.length,t=e/2;if(e%2)throw new Error("padded hex string expected, got unpadded hex of length "+e);const s=new Uint8Array(t);for(let i=0,r=0;i<t;i++,r+=2){const o=Jt(n.charCodeAt(r)),a=Jt(n.charCodeAt(r+1));if(o===void 0||a===void 0){const c=n[r]+n[r+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+r)}s[i]=o*16+a}return s}function ci(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function de(n){if(typeof n=="string"&&(n=ci(n)),!hn(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}class Tt{clone(){return this._cloneInto()}}const li={}.toString;function ui(n,e){if(e!==void 0&&li.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(n,e)}function Ut(n){const e=s=>n().update(de(s)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}class pn extends Tt{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,un(e);const s=de(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,r=new Uint8Array(i);r.set(s.length>i?e.create().update(s).digest():s);for(let o=0;o<r.length;o++)r[o]^=54;this.iHash.update(r),this.oHash=e.create();for(let o=0;o<r.length;o++)r[o]^=106;this.oHash.update(r),r.fill(0)}update(e){return ue(this),this.iHash.update(e),this}digestInto(e){ue(this),mt(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:s,finished:i,destroyed:r,blockLen:o,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=r,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=s._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Ve=(n,e,t)=>new pn(n,e).update(t).digest();Ve.create=(n,e)=>new pn(n,e);function di(n,e,t,s){un(n);const i=ui({dkLen:32,asyncTick:10},s),{c:r,dkLen:o,asyncTick:a}=i;if(te(r),te(o),te(a),r<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const c=de(e),l=de(t),d=new Uint8Array(o),u=Ve.create(n,c),h=u._cloneInto().update(l);return{c:r,dkLen:o,asyncTick:a,DK:d,PRF:u,PRFSalt:h}}function hi(n,e,t,s,i){return n.destroy(),e.destroy(),s&&s.destroy(),i.fill(0),t}function fi(n,e,t,s){const{c:i,dkLen:r,DK:o,PRF:a,PRFSalt:c}=di(n,e,t,s);let l;const d=new Uint8Array(4),u=Me(d),h=new Uint8Array(a.outputLen);for(let f=1,y=0;y<r;f++,y+=a.outputLen){const b=o.subarray(y,y+a.outputLen);u.setInt32(0,f,!1),(l=c._cloneInto(l)).update(d).digestInto(h),b.set(h.subarray(0,b.length));for(let p=1;p<i;p++){a._cloneInto(l).update(h).digestInto(h);for(let x=0;x<b.length;x++)b[x]^=h[x]}}return hi(a,c,o,l,h)}function _i(n,e,t,s){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,s);const i=BigInt(32),r=BigInt(4294967295),o=Number(t>>i&r),a=Number(t&r),c=s?4:0,l=s?0:4;n.setUint32(e+c,o,s),n.setUint32(e+l,a,s)}class gn extends Tt{constructor(e,t,s,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=s,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Me(this.buffer)}update(e){ue(this);const{view:t,buffer:s,blockLen:i}=this;e=de(e);const r=e.length;for(let o=0;o<r;){const a=Math.min(i-this.pos,r-o);if(a===i){const c=Me(e);for(;i<=r-o;o+=i)this.process(c,o);continue}s.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ue(this),dn(e,this),this.finished=!0;const{buffer:t,view:s,blockLen:i,isLE:r}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(s,0),o=0);for(let u=o;u<i;u++)t[u]=0;_i(s,i-8,BigInt(this.length*8),r),this.process(s,0);const a=Me(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,d=this.get();if(l>d.length)throw new Error("_sha2: outputLen bigger than state");for(let u=0;u<l;u++)a.setUint32(4*u,d[u],r)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const s=e.slice(0,t);return this.destroy(),s}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:s,length:i,finished:r,destroyed:o,pos:a}=this;return e.length=i,e.pos=a,e.finished=r,e.destroyed=o,i%t&&e.buffer.set(s),e}}const pi=(n,e,t)=>n&e^~n&t,gi=(n,e,t)=>n&e^n&t^e&t,yi=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),W=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),j=new Uint32Array(64);class wi extends gn{constructor(){super(64,32,8,!1),this.A=W[0]|0,this.B=W[1]|0,this.C=W[2]|0,this.D=W[3]|0,this.E=W[4]|0,this.F=W[5]|0,this.G=W[6]|0,this.H=W[7]|0}get(){const{A:e,B:t,C:s,D:i,E:r,F:o,G:a,H:c}=this;return[e,t,s,i,r,o,a,c]}set(e,t,s,i,r,o,a,c){this.A=e|0,this.B=t|0,this.C=s|0,this.D=i|0,this.E=r|0,this.F=o|0,this.G=a|0,this.H=c|0}process(e,t){for(let u=0;u<16;u++,t+=4)j[u]=e.getUint32(t,!1);for(let u=16;u<64;u++){const h=j[u-15],f=j[u-2],y=D(h,7)^D(h,18)^h>>>3,b=D(f,17)^D(f,19)^f>>>10;j[u]=b+j[u-7]+y+j[u-16]|0}let{A:s,B:i,C:r,D:o,E:a,F:c,G:l,H:d}=this;for(let u=0;u<64;u++){const h=D(a,6)^D(a,11)^D(a,25),f=d+h+pi(a,c,l)+yi[u]+j[u]|0,b=(D(s,2)^D(s,13)^D(s,22))+gi(s,i,r)|0;d=l,l=c,c=a,a=o+f|0,o=r,r=i,i=s,s=f+b|0}s=s+this.A|0,i=i+this.B|0,r=r+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,l=l+this.G|0,d=d+this.H|0,this.set(s,i,r,o,a,c,l,d)}roundClean(){j.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const bi=Ut(()=>new wi),He=BigInt(2**32-1),ht=BigInt(32);function yn(n,e=!1){return e?{h:Number(n&He),l:Number(n>>ht&He)}:{h:Number(n>>ht&He)|0,l:Number(n&He)|0}}function wn(n,e=!1){let t=new Uint32Array(n.length),s=new Uint32Array(n.length);for(let i=0;i<n.length;i++){const{h:r,l:o}=yn(n[i],e);[t[i],s[i]]=[r,o]}return[t,s]}const vi=(n,e)=>BigInt(n>>>0)<<ht|BigInt(e>>>0),mi=(n,e,t)=>n>>>t,Ti=(n,e,t)=>n<<32-t|e>>>t,Ui=(n,e,t)=>n>>>t|e<<32-t,Ai=(n,e,t)=>n<<32-t|e>>>t,xi=(n,e,t)=>n<<64-t|e>>>t-32,Si=(n,e,t)=>n>>>t-32|e<<64-t,Bi=(n,e)=>e,Ei=(n,e)=>n,bn=(n,e,t)=>n<<t|e>>>32-t,vn=(n,e,t)=>e<<t|n>>>32-t,mn=(n,e,t)=>e<<t-32|n>>>64-t,Tn=(n,e,t)=>n<<t-32|e>>>64-t;function Ii(n,e,t,s){const i=(e>>>0)+(s>>>0);return{h:n+t+(i/2**32|0)|0,l:i|0}}const ki=(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),zi=(n,e,t,s)=>e+t+s+(n/2**32|0)|0,Ci=(n,e,t,s)=>(n>>>0)+(e>>>0)+(t>>>0)+(s>>>0),$i=(n,e,t,s,i)=>e+t+s+i+(n/2**32|0)|0,Ni=(n,e,t,s,i)=>(n>>>0)+(e>>>0)+(t>>>0)+(s>>>0)+(i>>>0),Pi=(n,e,t,s,i,r)=>e+t+s+i+r+(n/2**32|0)|0,w={fromBig:yn,split:wn,toBig:vi,shrSH:mi,shrSL:Ti,rotrSH:Ui,rotrSL:Ai,rotrBH:xi,rotrBL:Si,rotr32H:Bi,rotr32L:Ei,rotlSH:bn,rotlSL:vn,rotlBH:mn,rotlBL:Tn,add:Ii,add3L:ki,add3H:zi,add4L:Ci,add4H:$i,add5H:Pi,add5L:Ni},[Oi,Hi]=w.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Q=new Uint32Array(80),V=new Uint32Array(80);class Li extends gn{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:s,Bl:i,Ch:r,Cl:o,Dh:a,Dl:c,Eh:l,El:d,Fh:u,Fl:h,Gh:f,Gl:y,Hh:b,Hl:p}=this;return[e,t,s,i,r,o,a,c,l,d,u,h,f,y,b,p]}set(e,t,s,i,r,o,a,c,l,d,u,h,f,y,b,p){this.Ah=e|0,this.Al=t|0,this.Bh=s|0,this.Bl=i|0,this.Ch=r|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=l|0,this.El=d|0,this.Fh=u|0,this.Fl=h|0,this.Gh=f|0,this.Gl=y|0,this.Hh=b|0,this.Hl=p|0}process(e,t){for(let g=0;g<16;g++,t+=4)Q[g]=e.getUint32(t),V[g]=e.getUint32(t+=4);for(let g=16;g<80;g++){const N=Q[g-15]|0,P=V[g-15]|0,at=w.rotrSH(N,P,1)^w.rotrSH(N,P,8)^w.shrSH(N,P,7),ct=w.rotrSL(N,P,1)^w.rotrSL(N,P,8)^w.shrSL(N,P,7),F=Q[g-2]|0,q=V[g-2]|0,Pe=w.rotrSH(F,q,19)^w.rotrBH(F,q,61)^w.shrSH(F,q,6),lt=w.rotrSL(F,q,19)^w.rotrBL(F,q,61)^w.shrSL(F,q,6),Oe=w.add4L(ct,lt,V[g-7],V[g-16]),ut=w.add4H(Oe,at,Pe,Q[g-7],Q[g-16]);Q[g]=ut|0,V[g]=Oe|0}let{Ah:s,Al:i,Bh:r,Bl:o,Ch:a,Cl:c,Dh:l,Dl:d,Eh:u,El:h,Fh:f,Fl:y,Gh:b,Gl:p,Hh:x,Hl:$}=this;for(let g=0;g<80;g++){const N=w.rotrSH(u,h,14)^w.rotrSH(u,h,18)^w.rotrBH(u,h,41),P=w.rotrSL(u,h,14)^w.rotrSL(u,h,18)^w.rotrBL(u,h,41),at=u&f^~u&b,ct=h&y^~h&p,F=w.add5L($,P,ct,Hi[g],V[g]),q=w.add5H(F,x,N,at,Oi[g],Q[g]),Pe=F|0,lt=w.rotrSH(s,i,28)^w.rotrBH(s,i,34)^w.rotrBH(s,i,39),Oe=w.rotrSL(s,i,28)^w.rotrBL(s,i,34)^w.rotrBL(s,i,39),ut=s&r^s&a^r&a,ti=i&o^i&c^o&c;x=b|0,$=p|0,b=f|0,p=y|0,f=u|0,y=h|0,{h:u,l:h}=w.add(l|0,d|0,q|0,Pe|0),l=a|0,d=c|0,a=r|0,c=o|0,r=s|0,o=i|0;const Xt=w.add3L(Pe,Oe,ti);s=w.add3H(Xt,q,lt,ut),i=Xt|0}({h:s,l:i}=w.add(this.Ah|0,this.Al|0,s|0,i|0)),{h:r,l:o}=w.add(this.Bh|0,this.Bl|0,r|0,o|0),{h:a,l:c}=w.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:l,l:d}=w.add(this.Dh|0,this.Dl|0,l|0,d|0),{h:u,l:h}=w.add(this.Eh|0,this.El|0,u|0,h|0),{h:f,l:y}=w.add(this.Fh|0,this.Fl|0,f|0,y|0),{h:b,l:p}=w.add(this.Gh|0,this.Gl|0,b|0,p|0),{h:x,l:$}=w.add(this.Hh|0,this.Hl|0,x|0,$|0),this.set(s,i,r,o,a,c,l,d,u,h,f,y,b,p,x,$)}roundClean(){Q.fill(0),V.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const At=Ut(()=>new Li);function Un(n){if(typeof n!="string")throw new TypeError(`Invalid mnemonic type: ${typeof n}`);return n.normalize("NFKD")}function Mi(n){const e=Un(n),t=e.split(" ");if(![12,15,18,21,24].includes(t.length))throw new Error("Invalid mnemonic");return{nfkd:e,words:t}}const Di=n=>Un(`mnemonic${n}`);function Fi(n,e=""){return fi(At,Mi(n).nfkd,Di(e),{c:2048,dkLen:64})}const[An,xn,Sn]=[[],[],[]],qi=BigInt(0),ve=BigInt(1),Ri=BigInt(2),Gi=BigInt(7),Ki=BigInt(256),Wi=BigInt(113);for(let n=0,e=ve,t=1,s=0;n<24;n++){[t,s]=[s,(2*t+3*s)%5],An.push(2*(5*s+t)),xn.push((n+1)*(n+2)/2%64);let i=qi;for(let r=0;r<7;r++)e=(e<<ve^(e>>Gi)*Wi)%Ki,e&Ri&&(i^=ve<<(ve<<BigInt(r))-ve);Sn.push(i)}const[ji,Qi]=wn(Sn,!0),Yt=(n,e,t)=>t>32?mn(n,e,t):bn(n,e,t),Zt=(n,e,t)=>t>32?Tn(n,e,t):vn(n,e,t);function Vi(n,e=24){const t=new Uint32Array(10);for(let s=24-e;s<24;s++){for(let o=0;o<10;o++)t[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=t[c],d=t[c+1],u=Yt(l,d,1)^t[a],h=Zt(l,d,1)^t[a+1];for(let f=0;f<50;f+=10)n[o+f]^=u,n[o+f+1]^=h}let i=n[2],r=n[3];for(let o=0;o<24;o++){const a=xn[o],c=Yt(i,r,a),l=Zt(i,r,a),d=An[o];i=n[d],r=n[d+1],n[d]=c,n[d+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)t[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~t[(a+2)%10]&t[(a+4)%10]}n[0]^=ji[s],n[1]^=Qi[s]}t.fill(0)}class xt extends Tt{constructor(e,t,s,i=!1,r=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=s,this.enableXOF=i,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,te(s),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ri(this.state)}keccak(){Vi(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){ue(this);const{blockLen:t,state:s}=this;e=de(e);const i=e.length;for(let r=0;r<i;){const o=Math.min(t-this.pos,i-r);for(let a=0;a<o;a++)s[this.pos++]^=e[r++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:s,blockLen:i}=this;e[s]^=t,t&128&&s===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){ue(this,!1),mt(e),this.finish();const t=this.state,{blockLen:s}=this;for(let i=0,r=e.length;i<r;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,r-i);e.set(t.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return te(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(dn(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:s,outputLen:i,rounds:r,enableXOF:o}=this;return e||(e=new xt(t,s,i,o,r)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=r,e.suffix=s,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Xi=(n,e,t)=>Ut(()=>new xt(e,n,t)),he=Xi(6,136,256/8);async function Ji(n){var e;const{params:t,method:s,url:i,headers:r,body:o,overrides:a}=n,c={headers:r,method:s,url:i,params:t,data:o,withCredentials:(e=a==null?void 0:a.WITH_CREDENTIALS)!=null?e:!0};try{const l=await U.axios(c);return{status:l.status,statusText:l.statusText,data:l.data,headers:l.headers,config:l.config}}catch(l){const d=l;if(d.response)return d.response;throw l}}var Yi={exports:{}};(function(n){var e=Object.prototype.hasOwnProperty,t="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(t=!1));function i(c,l,d){this.fn=c,this.context=l,this.once=d||!1}function r(c,l,d,u,h){if(typeof d!="function")throw new TypeError("The listener must be a function");var f=new i(d,u||c,h),y=t?t+l:l;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],f]:c._events[y].push(f):(c._events[y]=f,c._eventsCount++),c}function o(c,l){--c._eventsCount===0?c._events=new s:delete c._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],d,u;if(this._eventsCount===0)return l;for(u in d=this._events)e.call(d,u)&&l.push(t?u.slice(1):u);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(d)):l},a.prototype.listeners=function(l){var d=t?t+l:l,u=this._events[d];if(!u)return[];if(u.fn)return[u.fn];for(var h=0,f=u.length,y=new Array(f);h<f;h++)y[h]=u[h].fn;return y},a.prototype.listenerCount=function(l){var d=t?t+l:l,u=this._events[d];return u?u.fn?1:u.length:0},a.prototype.emit=function(l,d,u,h,f,y){var b=t?t+l:l;if(!this._events[b])return!1;var p=this._events[b],x=arguments.length,$,g;if(p.fn){switch(p.once&&this.removeListener(l,p.fn,void 0,!0),x){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,d),!0;case 3:return p.fn.call(p.context,d,u),!0;case 4:return p.fn.call(p.context,d,u,h),!0;case 5:return p.fn.call(p.context,d,u,h,f),!0;case 6:return p.fn.call(p.context,d,u,h,f,y),!0}for(g=1,$=new Array(x-1);g<x;g++)$[g-1]=arguments[g];p.fn.apply(p.context,$)}else{var N=p.length,P;for(g=0;g<N;g++)switch(p[g].once&&this.removeListener(l,p[g].fn,void 0,!0),x){case 1:p[g].fn.call(p[g].context);break;case 2:p[g].fn.call(p[g].context,d);break;case 3:p[g].fn.call(p[g].context,d,u);break;case 4:p[g].fn.call(p[g].context,d,u,h);break;default:if(!$)for(P=1,$=new Array(x-1);P<x;P++)$[P-1]=arguments[P];p[g].fn.apply(p[g].context,$)}}return!0},a.prototype.on=function(l,d,u){return r(this,l,d,u,!1)},a.prototype.once=function(l,d,u){return r(this,l,d,u,!0)},a.prototype.removeListener=function(l,d,u,h){var f=t?t+l:l;if(!this._events[f])return this;if(!d)return o(this,f),this;var y=this._events[f];if(y.fn)y.fn===d&&(!h||y.once)&&(!u||y.context===u)&&o(this,f);else{for(var b=0,p=[],x=y.length;b<x;b++)(y[b].fn!==d||h&&!y[b].once||u&&y[b].context!==u)&&p.push(y[b]);p.length?this._events[f]=p.length===1?p[0]:p:o(this,f)}return this},a.prototype.removeAllListeners=function(l){var d;return l?(d=t?t+l:l,this._events[d]&&o(this,d)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=t,a.EventEmitter=a,n.exports=a})(Yi);var Bn=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,Xe=(n,e)=>{for(var t in e)Bn(n,t,{get:e[t],enumerable:!0})},m=(n,e,t,s)=>{for(var i=Zi(e,t),r=n.length-1,o;r>=0;r--)(o=n[r])&&(i=o(e,t,i)||i);return i&&Bn(e,t,i),i},er=/^m(\/[0-9]+')+$/,En=n=>n.replace("'",""),tr="ed25519 seed",nr=2147483648,sr=n=>{const t=Ve.create(At,tr).update(_n(n)).digest(),s=t.slice(0,32),i=t.slice(32);return{key:s,chainCode:i}},ir=({key:n,chainCode:e},t)=>{const s=new ArrayBuffer(4);new DataView(s).setUint32(0,t);const i=new Uint8Array(s),r=new Uint8Array([0]),o=new Uint8Array([...r,...n,...i]),a=Ve.create(At,e).update(o).digest(),c=a.slice(0,32),l=a.slice(32);return{key:c,chainCode:l}},rr=n=>er.test(n)?!n.split("/").slice(1).map(En).some(Number.isNaN):!1,or=(n,e,t=nr)=>{if(!rr(n))throw new Error("Invalid derivation path");const{key:s,chainCode:i}=sr(e);return n.split("/").slice(1).map(En).map(o=>parseInt(o,10)).reduce((o,a)=>ir(o,a+t),{key:s,chainCode:i})},ar="1.21.0";async function cr(n){return new Promise(e=>{setTimeout(e,n)})}var en="/v1";function lr(n){let e=`${n}`;return e.endsWith("/")&&(e=e.substring(0,e.length-1)),e.endsWith(en)||(e=`${e}${en}`),e}var In=2e5,kn=20,ur=20,ft="0x1::aptos_coin::AptosCoin";function Je(n){let e,t,s;return typeof n=="object"?(e=n.hashFunction,t=n.ttlMs,s=n.tags):e=n,(i,r,o)=>{if(o.value!=null)o.value=tn(o.value,e,t,s);else if(o.get!=null)o.get=tn(o.get,e,t,s);else throw new Error("Only put a Memoize() decorator on a method or get accessor.")}}function zn(n,e){return Je({ttlMs:n,hashFunction:e})}var De=new Map;function dr(n){const e=new Set;for(const t of n){const s=De.get(t);if(s)for(const i of s)e.has(i)||(i.clear(),e.add(i))}return e.size}function tn(n,e,t=0,s){const i=Symbol("__memoized_map__");return function(...r){let o;const a=this;a.hasOwnProperty(i)||Object.defineProperty(a,i,{configurable:!1,enumerable:!1,writable:!1,value:new Map});const c=a[i];if(Array.isArray(s))for(const l of s)De.has(l)?De.get(l).push(c):De.set(l,[c]);if(e||r.length>0||t>0){let l;e===!0?l=r.map(h=>h.toString()).join("!"):e?l=e.apply(a,r):l=r[0];const d=`${l}__timestamp`;let u=!1;if(t>0)if(!c.has(d))u=!0;else{const h=c.get(d);u=Date.now()-h>t}c.has(l)&&!u?o=c.get(l):(o=n.apply(a,r),c.set(l,o),t>0&&c.set(d,Date.now()))}else{const l=a;c.has(l)?o=c.get(l):(o=n.apply(a,r),c.set(l,o))}return o}}var Cn=class extends Error{constructor(n,e,t){super(t),this.name="AptosApiError",this.url=e.url,this.status=e.status,this.statusText=e.statusText,this.data=e.data,this.request=n}},hr={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 fr(n,e,t,s,i,r){const o={...r==null?void 0:r.HEADERS,"x-aptos-client":`aptos-ts-sdk/${ar}`,"content-type":s??"application/json"};return r!=null&&r.TOKEN&&(o.Authorization=`Bearer ${r==null?void 0:r.TOKEN}`),await Ji({url:n,method:e,body:t,params:i,headers:o,overrides:r})}async function $n(n){const{url:e,endpoint:t,method:s,body:i,contentType:r,params:o,overrides:a}=n,c=`${e}/${t??""}`,l=await fr(c,s,i,r,o,a),d={status:l.status,statusText:l.statusText,data:l.data,headers:l.headers,config:l.config,url:c};if(d.status>=200&&d.status<300)return d;const u=hr[d.status];throw new Cn(n,d,u??"Generic Error")}async function O(n){return await $n({...n,method:"GET"})}async function me(n){return await $n({...n,method:"POST"})}async function nn(n){const e=[];let t;const s=n.params;for(;;){s.start=t;const i=await O({url:n.url,endpoint:n.endpoint,params:s,originMethod:n.originMethod,overrides:n.overrides});if(t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),t==null)break}return e}var _t={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},_r={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},sn={"https://fullnode.mainnet.aptoslabs.com/v1":"mainnet","https://fullnode.testnet.aptoslabs.com/v1":"testnet","https://fullnode.devnet.aptoslabs.com/v1":"devnet","http://127.0.0.1:8080/v1":"local"},_=class Fe{static fromBuffer(e){return Fe.fromUint8Array(e)}static fromUint8Array(e){return new Fe(fn(e))}static ensure(e){return typeof e=="string"?new Fe(e):e}constructor(e){e.startsWith("0x")?this.hexString=e:this.hexString=`0x${e}`}hex(){return this.hexString}noPrefix(){return this.hexString.slice(2)}toString(){return this.hex()}toShortString(){return`0x${this.hexString.replace(/^0x0*/,"")}`}toUint8Array(){return Uint8Array.from(_n(this.noPrefix()))}},T={};Xe(T,{AccountAddress:()=>v,AccountAuthenticator:()=>Y,AccountAuthenticatorEd25519:()=>Wn,AccountAuthenticatorMultiEd25519:()=>Qn,ArgumentABI:()=>nt,AuthenticationKey:()=>bt,ChainId:()=>Ht,ChangeSet:()=>Nr,Ed25519PublicKey:()=>L,Ed25519Signature:()=>G,EntryFunction:()=>Ze,EntryFunctionABI:()=>xe,FeePayerRawTransaction:()=>Nt,Identifier:()=>z,Module:()=>$r,ModuleId:()=>Ae,MultiAgentRawTransaction:()=>$t,MultiEd25519PublicKey:()=>Ye,MultiEd25519Signature:()=>Bt,MultiSig:()=>ps,MultiSigTransactionPayload:()=>fs,RawTransaction:()=>be,RawTransactionWithData:()=>Ct,RotationProofChallenge:()=>Or,Script:()=>zt,ScriptABI:()=>st,SignedTransaction:()=>et,StructTag:()=>we,Transaction:()=>Ps,TransactionArgument:()=>M,TransactionArgumentAddress:()=>Gt,TransactionArgumentBool:()=>Wt,TransactionArgumentU128:()=>qt,TransactionArgumentU16:()=>Mt,TransactionArgumentU256:()=>Rt,TransactionArgumentU32:()=>Dt,TransactionArgumentU64:()=>Ft,TransactionArgumentU8:()=>Lt,TransactionArgumentU8Vector:()=>Kt,TransactionAuthenticator:()=>_e,TransactionAuthenticatorEd25519:()=>Et,TransactionAuthenticatorFeePayer:()=>Gn,TransactionAuthenticatorMultiAgent:()=>qn,TransactionAuthenticatorMultiEd25519:()=>It,TransactionPayload:()=>Ce,TransactionPayloadEntryFunction:()=>Ot,TransactionPayloadMultisig:()=>Us,TransactionPayloadScript:()=>Pt,TransactionScriptABI:()=>jt,TypeArgumentABI:()=>tt,TypeTag:()=>k,TypeTagAddress:()=>ne,TypeTagBool:()=>pe,TypeTagParser:()=>ze,TypeTagParserError:()=>us,TypeTagSigner:()=>rs,TypeTagStruct:()=>se,TypeTagU128:()=>ye,TypeTagU16:()=>Be,TypeTagU256:()=>Ie,TypeTagU32:()=>Ee,TypeTagU64:()=>ge,TypeTagU8:()=>Z,TypeTagVector:()=>ke,UserTransaction:()=>Os,WriteSet:()=>Pr,objectStructTag:()=>Ir,optionStructTag:()=>Er,stringStructTag:()=>kt});var pr={};Xe(pr,{Deserializer:()=>St,Serializer:()=>A,bcsSerializeBool:()=>xr,bcsSerializeBytes:()=>X,bcsSerializeFixedBytes:()=>Br,bcsSerializeStr:()=>Sr,bcsSerializeU128:()=>Ur,bcsSerializeU16:()=>mr,bcsSerializeU256:()=>Ar,bcsSerializeU32:()=>Tr,bcsSerializeU8:()=>pt,bcsSerializeUint64:()=>vr,bcsToBytes:()=>K,deserializeVector:()=>C,serializeVector:()=>I,serializeVectorWithFunc:()=>br});var gr=2**8-1,yr=2**16-1,Ue=2**32-1,Nn=BigInt(2**64)-BigInt(1),Pn=BigInt(2**128)-BigInt(1),wr=BigInt(2**256)-BigInt(1),A=class{constructor(){this.buffer=new ArrayBuffer(64),this.offset=0}ensureBufferWillHandleSize(n){for(;this.buffer.byteLength<this.offset+n;){const e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}serialize(n){this.ensureBufferWillHandleSize(n.length),new Uint8Array(this.buffer,this.offset).set(n),this.offset+=n.length}serializeWithFunction(n,e,t){this.ensureBufferWillHandleSize(e);const s=new DataView(this.buffer,this.offset);n.apply(s,[0,t,!0]),this.offset+=e}serializeStr(n){const e=new TextEncoder;this.serializeBytes(e.encode(n))}serializeBytes(n){this.serializeU32AsUleb128(n.length),this.serialize(n)}serializeFixedBytes(n){this.serialize(n)}serializeBool(n){if(typeof n!="boolean")throw new Error("Value needs to be a boolean");const e=n?1:0;this.serialize(new Uint8Array([e]))}serializeU8(n){this.serialize(new Uint8Array([n]))}serializeU16(n){this.serializeWithFunction(DataView.prototype.setUint16,2,n)}serializeU32(n){this.serializeWithFunction(DataView.prototype.setUint32,4,n)}serializeU64(n){const e=BigInt(n.toString())&BigInt(Ue),t=BigInt(n.toString())>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(t))}serializeU128(n){const e=BigInt(n.toString())&Nn,t=BigInt(n.toString())>>BigInt(64);this.serializeU64(e),this.serializeU64(t)}serializeU256(n){const e=BigInt(n.toString())&Pn,t=BigInt(n.toString())>>BigInt(128);this.serializeU128(e),this.serializeU128(t)}serializeU32AsUleb128(n){let e=n;const t=[];for(;e>>>7;)t.push(e&127|128),e>>>=7;t.push(e),this.serialize(new Uint8Array(t))}getBytes(){return new Uint8Array(this.buffer).slice(0,this.offset)}};m([ie(0,gr)],A.prototype,"serializeU8");m([ie(0,yr)],A.prototype,"serializeU16");m([ie(0,Ue)],A.prototype,"serializeU32");m([ie(BigInt(0),Nn)],A.prototype,"serializeU64");m([ie(BigInt(0),Pn)],A.prototype,"serializeU128");m([ie(BigInt(0),wr)],A.prototype,"serializeU256");m([ie(0,Ue)],A.prototype,"serializeU32AsUleb128");function ie(n,e,t){return(s,i,r)=>{const o=r.value;return r.value=function(c){const l=BigInt(c.toString());if(l>BigInt(e.toString())||l<BigInt(n.toString()))throw new Error("Value is out of range");o.apply(this,[c])},r}}var St=class{constructor(n){this.buffer=new ArrayBuffer(n.length),new Uint8Array(this.buffer).set(n,0),this.offset=0}read(n){if(this.offset+n>this.buffer.byteLength)throw new Error("Reached to the end of buffer");const e=this.buffer.slice(this.offset,this.offset+n);return this.offset+=n,e}deserializeStr(){const n=this.deserializeBytes();return new TextDecoder().decode(n)}deserializeBytes(){const n=this.deserializeUleb128AsU32();return new Uint8Array(this.read(n))}deserializeFixedBytes(n){return new Uint8Array(this.read(n))}deserializeBool(){const n=new Uint8Array(this.read(1))[0];if(n!==1&&n!==0)throw new Error("Invalid boolean value");return n===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){const n=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(n))}deserializeU128(){const n=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|n)}deserializeU256(){const n=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|n)}deserializeUleb128AsU32(){let n=BigInt(0),e=0;for(;n<Ue;){const t=this.deserializeU8();if(n|=BigInt(t&127)<<BigInt(e),!(t&128))break;e+=7}if(n>Ue)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(n)}};function I(n,e){e.serializeU32AsUleb128(n.length),n.forEach(t=>{t.serialize(e)})}function br(n,e){const t=new A;t.serializeU32AsUleb128(n.length);const s=t[e];return n.forEach(i=>{s.call(t,i)}),t.getBytes()}function C(n,e){const t=n.deserializeUleb128AsU32(),s=[];for(let i=0;i<t;i+=1)s.push(e.deserialize(n));return s}function K(n){const e=new A;return n.serialize(e),e.getBytes()}function vr(n){const e=new A;return e.serializeU64(n),e.getBytes()}function pt(n){const e=new A;return e.serializeU8(n),e.getBytes()}function mr(n){const e=new A;return e.serializeU16(n),e.getBytes()}function Tr(n){const e=new A;return e.serializeU32(n),e.getBytes()}function Ur(n){const e=new A;return e.serializeU128(n),e.getBytes()}function Ar(n){const e=new A;return e.serializeU256(n),e.getBytes()}function xr(n){const e=new A;return e.serializeBool(n),e.getBytes()}function Sr(n){const e=new A;return e.serializeStr(n),e.getBytes()}function X(n){const e=new A;return e.serializeBytes(n),e.getBytes()}function Br(n){const e=new A;return e.serializeFixedBytes(n),e.getBytes()}var We=class H{constructor(e){if(e.length!==H.LENGTH)throw new Error("Expected address of length 32");this.address=e}static fromHex(e){let t=_.ensure(e);t.noPrefix().length%2!==0&&(t=new _(`0${t.noPrefix()}`));const s=t.toUint8Array();if(s.length>H.LENGTH)throw new Error("Hex string is too long. Address's length is 32 bytes.");if(s.length===H.LENGTH)return new H(s);const i=new Uint8Array(H.LENGTH);return i.set(s,H.LENGTH-s.length),new H(i)}static isValid(e){if(e==="")return!1;let t=_.ensure(e);return t.noPrefix().length%2!==0&&(t=new _(`0${t.noPrefix()}`)),t.toUint8Array().length<=H.LENGTH}toHexString(){return _.fromUint8Array(this.address).hex()}serialize(e){e.serializeFixedBytes(this.address)}static deserialize(e){return new H(e.deserializeFixedBytes(H.LENGTH))}static standardizeAddress(e){const t=e.toLowerCase();return`0x${(t.startsWith("0x")?t.slice(2):t).padStart(64,"0")}`}};We.LENGTH=32;We.CORE_CODE_ADDRESS=We.fromHex("0x1");var v=We,On=class qe{constructor(e){if(e.length!==qe.LENGTH)throw new Error(`Ed25519PublicKey length should be ${qe.LENGTH}`);this.value=e}toBytes(){return this.value}serialize(e){e.serializeBytes(this.value)}static deserialize(e){const t=e.deserializeBytes();return new qe(t)}};On.LENGTH=32;var L=On,Hn=class Re{constructor(e){if(this.value=e,e.length!==Re.LENGTH)throw new Error(`Ed25519Signature length should be ${Re.LENGTH}`)}serialize(e){e.serializeBytes(this.value)}static deserialize(e){const t=e.deserializeBytes();return new Re(t)}};Hn.LENGTH=64;var G=Hn,gt=32,Ye=class Ln{constructor(e,t){if(this.public_keys=e,this.threshold=t,t>gt)throw new Error(`"threshold" cannot be larger than ${gt}`)}toBytes(){const e=new Uint8Array(this.public_keys.length*L.LENGTH+1);return this.public_keys.forEach((t,s)=>{e.set(t.value,s*L.LENGTH)}),e[this.public_keys.length*L.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toBytes())}static deserialize(e){const t=e.deserializeBytes(),s=t[t.length-1],i=[];for(let r=0;r<t.length-1;r+=L.LENGTH){const o=r;i.push(new L(t.subarray(o,o+L.LENGTH)))}return new Ln(i,s)}},Mn=class Te{constructor(e,t){if(this.signatures=e,this.bitmap=t,t.length!==Te.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Te.BITMAP_LEN}`)}toBytes(){const e=new Uint8Array(this.signatures.length*G.LENGTH+Te.BITMAP_LEN);return this.signatures.forEach((t,s)=>{e.set(t.value,s*G.LENGTH)}),e.set(this.bitmap,this.signatures.length*G.LENGTH),e}static createBitmap(e){const s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach(r=>{if(r>=gt)throw new Error(`Invalid bit value ${r}.`);if(i.has(r))throw new Error("Duplicated bits detected.");i.add(r);const o=Math.floor(r/8);let a=s[o];a|=128>>r%8,s[o]=a}),s}serialize(e){e.serializeBytes(this.toBytes())}static deserialize(e){const t=e.deserializeBytes(),s=t.subarray(t.length-4),i=[];for(let r=0;r<t.length-s.length;r+=G.LENGTH){const o=r;i.push(new G(t.subarray(o,o+G.LENGTH)))}return new Te(i,s)}};Mn.BITMAP_LEN=4;var Bt=Mn,_e=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Et.load(n);case 1:return It.load(n);case 2:return qn.load(n);case 3:return Gn.load(n);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Et=class Dn extends _e{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=L.deserialize(e),s=G.deserialize(e);return new Dn(t,s)}},It=class Fn extends _e{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=Ye.deserialize(e),s=Bt.deserialize(e);return new Fn(t,s)}},qn=class Rn extends _e{constructor(e,t,s){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=s}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),I(this.secondary_signer_addresses,e),I(this.secondary_signers,e)}static load(e){const t=Y.deserialize(e),s=C(e,v),i=C(e,Y);return new Rn(t,s,i)}},Gn=class Kn extends _e{constructor(e,t,s,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=s,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),I(this.secondary_signer_addresses,e),I(this.secondary_signers,e),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){const t=Y.deserialize(e),s=C(e,v),i=C(e,Y),r=v.deserialize(e),o=Y.deserialize(e),a={address:r,authenticator:o};return new Kn(t,s,i,a)}},Y=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Wn.load(n);case 1:return Qn.load(n);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},Wn=class jn extends Y{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=L.deserialize(e),s=G.deserialize(e);return new jn(t,s)}},Qn=class Vn extends Y{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){const t=Ye.deserialize(e),s=Bt.deserialize(e);return new Vn(t,s)}},z=class Xn{constructor(e){this.value=e}serialize(e){e.serializeStr(this.value)}static deserialize(e){const t=e.deserializeStr();return new Xn(t)}},k=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return pe.load(n);case 1:return Z.load(n);case 2:return ge.load(n);case 3:return ye.load(n);case 4:return ne.load(n);case 5:return rs.load(n);case 6:return ke.load(n);case 7:return se.load(n);case 8:return Be.load(n);case 9:return Ee.load(n);case 10:return Ie.load(n);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}},pe=class Jn extends k{serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new Jn}},Z=class Yn extends k{serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new Yn}},Be=class Zn extends k{serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new Zn}},Ee=class es extends k{serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new es}},ge=class ts extends k{serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new ts}},ye=class ns extends k{serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new ns}},Ie=class ss extends k{serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new ss}},ne=class is extends k{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new is}},rs=class os extends k{serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new os}},ke=class as extends k{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){const t=k.deserialize(e);return new as(t)}},se=class cs extends k{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){const t=we.deserialize(e);return new cs(t)}isStringTypeTag(){return this.value.module_name.value==="string"&&this.value.name.value==="String"&&this.value.address.toHexString()===v.CORE_CODE_ADDRESS.toHexString()}},we=class yt{constructor(e,t,s,i){this.address=e,this.module_name=t,this.name=s,this.type_args=i}static fromString(e){const t=new ze(e).parseTypeTag();return new yt(t.value.address,t.value.module_name,t.value.name,t.value.type_args)}serialize(e){this.address.serialize(e),this.module_name.serialize(e),this.name.serialize(e),I(this.type_args,e)}static deserialize(e){const t=v.deserialize(e),s=z.deserialize(e),i=z.deserialize(e),r=C(e,k);return new yt(t,s,i,r)}},kt=new we(v.fromHex("0x1"),new z("string"),new z("String"),[]);function Er(n){return new we(v.fromHex("0x1"),new z("option"),new z("Option"),[n])}function Ir(n){return new we(v.fromHex("0x1"),new z("object"),new z("Object"),[n])}function J(n){throw new us(n)}function rn(n){return!!n.match(/\s/)}function on(n){return!!n.match(/[_A-Za-z0-9]/g)}function kr(n){return!!n.match(/T\d+/g)}function zr(n,e){const t=n[e];if(t===":"){if(n.slice(e,e+2)==="::")return[["COLON","::"],2];J("Unrecognized token.")}else{if(t==="<")return[["LT","<"],1];if(t===">")return[["GT",">"],1];if(t===",")return[["COMMA",","],1];if(rn(t)){let s="";for(let i=e;i<n.length;i+=1){const r=n[i];if(rn(r))s=`${s}${r}`;else break}return[["SPACE",s],s.length]}else if(on(t)){let s="";for(let i=e;i<n.length;i+=1){const r=n[i];if(on(r))s=`${s}${r}`;else break}return kr(s)?[["GENERIC",s],s.length]:[["IDENT",s],s.length]}}throw new Error("Unrecognized token.")}function Cr(n){let e=0;const t=[];for(;e<n.length;){const[s,i]=zr(n,e);s[0]!=="SPACE"&&t.push(s),e+=i}return t}var ze=class ls{constructor(e,t){this.typeTags=[],this.tokens=Cr(e),this.typeTags=t||[]}consume(e){const t=this.tokens.shift();(!t||t[1]!==e)&&J("Invalid type tag.")}consumeWholeGeneric(){for(this.consume("<");this.tokens[0][1]!==">";)this.tokens[0][1]==="<"?this.consumeWholeGeneric():this.tokens.shift();this.consume(">")}parseCommaList(e,t){const s=[];for(this.tokens.length<=0&&J("Invalid type tag.");this.tokens[0][1]!==e&&(s.push(this.parseTypeTag()),!(this.tokens.length>0&&this.tokens[0][1]===e||(this.consume(","),this.tokens.length>0&&this.tokens[0][1]===e&&t)));)this.tokens.length<=0&&J("Invalid type tag.");return s}parseTypeTag(){this.tokens.length===0&&J("Invalid type tag.");const[e,t]=this.tokens.shift();if(t==="u8")return new Z;if(t==="u16")return new Be;if(t==="u32")return new Ee;if(t==="u64")return new ge;if(t==="u128")return new ye;if(t==="u256")return new Ie;if(t==="bool")return new pe;if(t==="address")return new ne;if(t==="vector"){this.consume("<");const s=this.parseTypeTag();return this.consume(">"),new ke(s)}if(t==="string")return new se(kt);if(e==="IDENT"&&(t.startsWith("0x")||t.startsWith("0X"))){const s=v.fromHex(t);this.consume("::");const[i,r]=this.tokens.shift();i!=="IDENT"&&J("Invalid type tag."),this.consume("::");const[o,a]=this.tokens.shift();if(o!=="IDENT"&&J("Invalid type tag."),v.CORE_CODE_ADDRESS.toHexString()===s.toHexString()&&r==="object"&&a==="Object")return this.consumeWholeGeneric(),new ne;let c=[];this.tokens.length>0&&this.tokens[0][1]==="<"&&(this.consume("<"),c=this.parseCommaList(">",!0),this.consume(">"));const l=new we(s,new z(r),new z(a),c);return new se(l)}if(e==="GENERIC"){this.typeTags.length===0&&J("Can't convert generic type since no typeTags were specified.");const s=parseInt(t.substring(1),10);return new ls(this.typeTags[s]).parseTypeTag()}throw new Error("Invalid type tag.")}},us=class extends Error{constructor(n){super(n),this.name="TypeTagParserError"}},be=class ds{constructor(e,t,s,i,r,o,a){this.sender=e,this.sequence_number=t,this.payload=s,this.max_gas_amount=i,this.gas_unit_price=r,this.expiration_timestamp_secs=o,this.chain_id=a}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){const t=v.deserialize(e),s=e.deserializeU64(),i=Ce.deserialize(e),r=e.deserializeU64(),o=e.deserializeU64(),a=e.deserializeU64(),c=Ht.deserialize(e);return new ds(t,s,i,r,o,a,c)}},zt=class hs{constructor(e,t,s){this.code=e,this.ty_args=t,this.args=s}serialize(e){e.serializeBytes(this.code),I(this.ty_args,e),I(this.args,e)}static deserialize(e){const t=e.deserializeBytes(),s=C(e,k),i=C(e,M);return new hs(t,s,i)}},Ze=class Ge{constructor(e,t,s,i){this.module_name=e,this.function_name=t,this.ty_args=s,this.args=i}static natural(e,t,s,i){return new Ge(Ae.fromStr(e),new z(t),s,i)}static natual(e,t,s,i){return Ge.natural(e,t,s,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),I(this.ty_args,e),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{e.serializeBytes(t)})}static deserialize(e){const t=Ae.deserialize(e),s=z.deserialize(e),i=C(e,k),r=e.deserializeUleb128AsU32(),o=[];for(let c=0;c<r;c+=1)o.push(e.deserializeBytes());const a=o;return new Ge(t,s,i,a)}},fs=class _s{constructor(e){this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new _s(Ze.deserialize(e))}},ps=class gs{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){const t=v.deserialize(e),s=e.deserializeBool();let i;return s&&(i=fs.deserialize(e)),new gs(t,i)}},$r=class ys{constructor(e){this.code=e}serialize(e){e.serializeBytes(this.code)}static deserialize(e){const t=e.deserializeBytes();return new ys(t)}},Ae=class wt{constructor(e,t){this.address=e,this.name=t}static fromStr(e){const t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new wt(v.fromHex(new _(t[0])),new z(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){const t=v.deserialize(e),s=z.deserialize(e);return new wt(t,s)}},Nr=class{serialize(n){throw new Error("Not implemented.")}static deserialize(n){throw new Error("Not implemented.")}},Pr=class{serialize(n){throw new Error("Not implmented.")}static deserialize(n){throw new Error("Not implmented.")}},et=class ws{constructor(e,t){this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){const t=be.deserialize(e),s=_e.deserialize(e);return new ws(t,s)}},Ct=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return $t.load(n);case 1:return Nt.load(n);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},$t=class bs extends Ct{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),I(this.secondary_signer_addresses,e)}static load(e){const t=be.deserialize(e),s=C(e,v);return new bs(t,s)}},Nt=class vs extends Ct{constructor(e,t,s){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=s}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),I(this.secondary_signer_addresses,e),this.fee_payer_address.serialize(e)}static load(e){const t=be.deserialize(e),s=C(e,v),i=v.deserialize(e);return new vs(t,s,i)}},Ce=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Pt.load(n);case 2:return Ot.load(n);case 3:return Us.load(n);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Pt=class ms extends Ce{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(0),this.value.serialize(e)}static load(e){const t=zt.deserialize(e);return new ms(t)}},Ot=class Ts extends Ce{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(2),this.value.serialize(e)}static load(e){const t=Ze.deserialize(e);return new Ts(t)}},Us=class As extends Ce{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(3),this.value.serialize(e)}static load(e){const t=ps.deserialize(e);return new As(t)}},Ht=class xs{constructor(e){this.value=e}serialize(e){e.serializeU8(this.value)}static deserialize(e){const t=e.deserializeU8();return new xs(t)}},M=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Lt.load(n);case 1:return Ft.load(n);case 2:return qt.load(n);case 3:return Gt.load(n);case 4:return Kt.load(n);case 5:return Wt.load(n);case 6:return Mt.load(n);case 7:return Dt.load(n);case 8:return Rt.load(n);default:throw new Error(`Unknown variant index for TransactionArgument: ${e}`)}}},Lt=class Ss extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(0),e.serializeU8(this.value)}static load(e){const t=e.deserializeU8();return new Ss(t)}},Mt=class Bs extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(6),e.serializeU16(this.value)}static load(e){const t=e.deserializeU16();return new Bs(t)}},Dt=class Es extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(7),e.serializeU32(this.value)}static load(e){const t=e.deserializeU32();return new Es(t)}},Ft=class Is extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(1),e.serializeU64(this.value)}static load(e){const t=e.deserializeU64();return new Is(t)}},qt=class ks extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(2),e.serializeU128(this.value)}static load(e){const t=e.deserializeU128();return new ks(t)}},Rt=class zs extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(8),e.serializeU256(this.value)}static load(e){const t=e.deserializeU256();return new zs(t)}},Gt=class Cs extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(3),this.value.serialize(e)}static load(e){const t=v.deserialize(e);return new Cs(t)}},Kt=class $s extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(4),e.serializeBytes(this.value)}static load(e){const t=e.deserializeBytes();return new $s(t)}},Wt=class Ns extends M{constructor(e){super(),this.value=e}serialize(e){e.serializeU32AsUleb128(5),e.serializeBool(this.value)}static load(e){const t=e.deserializeBool();return new Ns(t)}},Ps=class{getHashSalt(){const n=he.create();return n.update("APTOS::Transaction"),n.digest()}static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return Os.load(n);default:throw new Error(`Unknown variant index for Transaction: ${e}`)}}},Os=class Hs extends Ps{constructor(e){super(),this.value=e}hash(){const e=he.create();return e.update(this.getHashSalt()),e.update(K(this)),e.digest()}serialize(e){e.serializeU32AsUleb128(0),this.value.serialize(e)}static load(e){return new Hs(et.deserialize(e))}},tt=class Ls{constructor(e){this.name=e}serialize(e){e.serializeStr(this.name)}static deserialize(e){const t=e.deserializeStr();return new Ls(t)}},nt=class Ms{constructor(e,t){this.name=e,this.type_tag=t}serialize(e){e.serializeStr(this.name),this.type_tag.serialize(e)}static deserialize(e){const t=e.deserializeStr(),s=k.deserialize(e);return new Ms(t,s)}},st=class{static deserialize(n){const e=n.deserializeUleb128AsU32();switch(e){case 0:return jt.load(n);case 1:return xe.load(n);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},jt=class Ds extends st{constructor(e,t,s,i,r){super(),this.name=e,this.doc=t,this.code=s,this.ty_args=i,this.args=r}serialize(e){e.serializeU32AsUleb128(0),e.serializeStr(this.name),e.serializeStr(this.doc),e.serializeBytes(this.code),I(this.ty_args,e),I(this.args,e)}static load(e){const t=e.deserializeStr(),s=e.deserializeStr(),i=e.deserializeBytes(),r=C(e,tt),o=C(e,nt);return new Ds(t,s,i,r,o)}},xe=class Fs extends st{constructor(e,t,s,i,r){super(),this.name=e,this.module_name=t,this.doc=s,this.ty_args=i,this.args=r}serialize(e){e.serializeU32AsUleb128(1),e.serializeStr(this.name),this.module_name.serialize(e),e.serializeStr(this.doc),I(this.ty_args,e),I(this.args,e)}static load(e){const t=e.deserializeStr(),s=Ae.deserialize(e),i=e.deserializeStr(),r=C(e,tt),o=C(e,nt);return new Fs(t,s,i,r,o)}},$e=class oe{constructor(e){if(e.length!==oe.LENGTH)throw new Error("Expected a byte array of length 32");this.bytes=e}static fromMultiEd25519PublicKey(e){const t=e.toBytes(),s=new Uint8Array(t.length+1);s.set(t),s.set([oe.MULTI_ED25519_SCHEME],t.length);const i=he.create();return i.update(s),new oe(i.digest())}static fromEd25519PublicKey(e){const t=e.value,s=new Uint8Array(t.length+1);s.set(t),s.set([oe.ED25519_SCHEME],t.length);const i=he.create();return i.update(s),new oe(i.digest())}derivedAddress(){return _.fromUint8Array(this.bytes)}};$e.LENGTH=32;$e.MULTI_ED25519_SCHEME=1;$e.ED25519_SCHEME=0;$e.DERIVE_RESOURCE_ACCOUNT_SCHEME=255;var bt=$e,Or=class{constructor(n,e,t,s,i,r,o){this.accountAddress=n,this.moduleName=e,this.structName=t,this.sequenceNumber=s,this.originator=i,this.currentAuthKey=r,this.newPublicKey=o}serialize(n){this.accountAddress.serialize(n),n.serializeStr(this.moduleName),n.serializeStr(this.structName),n.serializeU64(this.sequenceNumber),this.originator.serialize(n),this.currentAuthKey.serialize(n),n.serializeBytes(this.newPublicKey)}},qs=class Ke{static fromAptosAccountObject(e){return new Ke(_.ensure(e.privateKeyHex).toUint8Array(),e.address)}static isValidPath(e){return/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'+$/.test(e)}static fromDerivePath(e,t){if(!Ke.isValidPath(e))throw new Error("Invalid derivation path");const s=t.trim().split(/\s+/).map(r=>r.toLowerCase()).join(" "),{key:i}=or(e,fn(Fi(s)));return new Ke(i)}constructor(e,t){e?this.signingKey=U.nacl2.sign.keyPair.fromSeed(e.slice(0,32)):this.signingKey=U.nacl2.sign.keyPair(),this.accountAddress=_.ensure(t||this.authKey().hex())}address(){return this.accountAddress}authKey(){const e=new L(this.signingKey.publicKey);return bt.fromEd25519PublicKey(e).derivedAddress()}static getResourceAccountAddress(e,t){const s=K(v.fromHex(e)),i=new Uint8Array([...s,...t,bt.DERIVE_RESOURCE_ACCOUNT_SCHEME]),r=he.create();return r.update(i),_.fromUint8Array(r.digest())}static getCollectionID(e,t){const s=new TextEncoder().encode(`${e}::${t}`),i=bi.create();return i.update(s),_.fromUint8Array(i.digest())}pubKey(){return _.fromUint8Array(this.signingKey.publicKey)}signBuffer(e){const t=U.nacl2.sign.detached(e,this.signingKey.secretKey);return _.fromUint8Array(t)}signHexString(e){const t=_.ensure(e).toUint8Array();return this.signBuffer(t)}verifySignature(e,t){const s=_.ensure(e).toUint8Array(),i=_.ensure(t).toUint8Array();return U.nacl2.sign.detached.verify(s,i,this.signingKey.publicKey)}toPrivateKeyObject(){return{address:this.address().hex(),publicKeyHex:this.pubKey().hex(),privateKeyHex:_.fromUint8Array(this.signingKey.secretKey.slice(0,32)).hex()}}};m([Je()],qs.prototype,"authKey");var je=qs;function Le(n){return n instanceof je?n.address():_.ensure(n)}var Ne=`
|
|
2
2
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
3
3
|
token_standard
|
|
4
4
|
token_properties_mutated_v1
|
|
@@ -415,4 +415,4 @@ ${Lr}`,qr=`
|
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
417
|
`;function it(n,e,t){if(!(e!=null&&e.includes(typeof n)))throw new Error(`Invalid arg: ${n} type should be ${e instanceof Array?e.join(" or "):e}`)}function Gs(n){if(it(n,["boolean","string"]),typeof n=="boolean")return n;if(n==="true")return!0;if(n==="false")return!1;throw new Error("Invalid boolean string.")}function ce(n){if(it(n,["number","string"]),typeof n=="number")return n;const e=Number.parseInt(n,10);if(Number.isNaN(e))throw new Error("Invalid number string.");return e}function le(n){return it(n,["number","bigint","string"]),BigInt(n)}function ao(n,e,t){Qt(n,e,t)}function Qt(n,e,t,s){if(e instanceof pe)t.serializeBool(Gs(n));else if(e instanceof Z)t.serializeU8(ce(n));else if(e instanceof Be)t.serializeU16(ce(n));else if(e instanceof Ee)t.serializeU32(ce(n));else if(e instanceof ge)t.serializeU64(le(n));else if(e instanceof ye)t.serializeU128(le(n));else if(e instanceof Ie)t.serializeU256(le(n));else if(e instanceof ne)Ks(n,t);else if(e instanceof ke)co(n,e,t);else if(e instanceof se)lo(n,e,t);else throw new Error("Unsupported arg type.")}function Ks(n,e){let t;if(typeof n=="string"||n instanceof _)t=v.fromHex(n);else if(n instanceof v)t=n;else throw new Error("Invalid account address.");t.serialize(e)}function co(n,e,t,s){if(e.value instanceof Z){if(n instanceof Uint8Array){t.serializeBytes(n);return}if(n instanceof _){t.serializeBytes(n.toUint8Array());return}if(typeof n=="string"){t.serializeStr(n);return}}if(!Array.isArray(n))throw new Error("Invalid vector args.");t.serializeU32AsUleb128(n.length),n.forEach(i=>Qt(i,e.value,t))}function lo(n,e,t,s){const{address:i,module_name:r,name:o,type_args:a}=e.value,c=`${_.fromUint8Array(i.address).toShortString()}::${r.value}::${o.value}`;if(c==="0x1::string::String")it(n,["string"]),t.serializeStr(n);else if(c==="0x1::object::Object")Ks(n,t);else if(c==="0x1::option::Option"){if(a.length!==1)throw new Error(`Option has the wrong number of type arguments ${a.length}`);uo(n,a[0],t)}else throw new Error("Unsupported struct type in function argument")}function uo(n,e,t,s){n==null?t.serializeU32AsUleb128(0):(t.serializeU32AsUleb128(1),Qt(n,e,t))}function ho(n,e){if(e instanceof pe)return new Wt(Gs(n));if(e instanceof Z)return new Lt(ce(n));if(e instanceof Be)return new Mt(ce(n));if(e instanceof Ee)return new Dt(ce(n));if(e instanceof ge)return new Ft(le(n));if(e instanceof ye)return new qt(le(n));if(e instanceof Ie)return new Rt(le(n));if(e instanceof ne){let t;if(typeof n=="string"||n instanceof _)t=v.fromHex(n);else if(n instanceof v)t=n;else throw new Error("Invalid account address.");return new Gt(t)}if(e instanceof ke&&e.value instanceof Z){if(!(n instanceof Uint8Array))throw new Error(`${n} should be an instance of Uint8Array`);return new Kt(n)}throw new Error("Unknown type for TransactionArgument.")}var fo="APTOS::RawTransaction",an="APTOS::RawTransactionWithData",Se=class{constructor(n,e){this.rawTxnBuilder=e,this.signingFunction=n}build(n,e,t){if(!this.rawTxnBuilder)throw new Error("this.rawTxnBuilder doesn't exist.");return this.rawTxnBuilder.build(n,e,t)}static getSigningMessage(n){const e=he.create();if(n instanceof be)e.update(fo);else if(n instanceof $t)e.update(an);else if(n instanceof Nt)e.update(an);else throw new Error("Unknown transaction type.");const t=e.digest(),s=K(n),i=new Uint8Array(t.length+s.length);return i.set(t),i.set(s,t.length),i}},dt=class extends Se{constructor(n,e,t){super(n,t),this.publicKey=e}rawToSigned(n){const e=Se.getSigningMessage(n),t=this.signingFunction(e),s=new Et(new L(this.publicKey),t);return new et(n,s)}sign(n){return K(this.rawToSigned(n))}},_o=class extends Se{constructor(n,e){super(n),this.publicKey=e}rawToSigned(n){const e=Se.getSigningMessage(n),t=this.signingFunction(e),s=new It(this.publicKey,t);return new et(n,s)}sign(n){return K(this.rawToSigned(n))}},po=class vt{constructor(e,t){this.abiMap=new Map,e.forEach(s=>{const i=new St(s),r=st.deserialize(i);let o;if(r instanceof xe){const a=r,{address:c,name:l}=a.module_name;o=`${_.fromUint8Array(c.address).toShortString()}::${l.value}::${a.name}`}else o=r.name;if(this.abiMap.has(o))throw new Error("Found conflicting ABI interfaces");this.abiMap.set(o,r)}),this.builderConfig={maxGasAmount:BigInt(In),expSecFromNow:kn,...t}}static toBCSArgs(e,t){if(e.length!==t.length)throw new Error("Wrong number of args provided.");return t.map((s,i)=>{const r=new A;return ao(s,e[i].type_tag,r),r.getBytes()})}static toTransactionArguments(e,t){if(e.length!==t.length)throw new Error("Wrong number of args provided.");return t.map((s,i)=>ho(s,e[i].type_tag))}setSequenceNumber(e){this.builderConfig.sequenceNumber=BigInt(e)}buildTransactionPayload(e,t,s){const i=t.map(a=>new ze(a).parseTypeTag());let r;if(!this.abiMap.has(e))throw new Error(`Cannot find function: ${e}`);const o=this.abiMap.get(e);if(o instanceof xe){const a=o,c=vt.toBCSArgs(a.args,s);r=new Ot(new Ze(a.module_name,new z(a.name),i,c))}else if(o instanceof jt){const a=o,c=vt.toTransactionArguments(a.args,s);r=new Pt(new zt(a.code,i,c))}else throw new Error("Unknown ABI format.");return r}build(e,t,s){const{sender:i,sequenceNumber:r,gasUnitPrice:o,maxGasAmount:a,expSecFromNow:c,chainId:l}=this.builderConfig;if(!o)throw new Error("No gasUnitPrice provided.");const d=i instanceof v?i:v.fromHex(i),u=BigInt(Math.floor(Date.now()/1e3)+Number(c)),h=this.buildTransactionPayload(e,t,s);if(h)return new be(d,BigInt(r),h,BigInt(a),BigInt(o),u,new Ht(Number(l)));throw new Error("Invalid ABI.")}},rt=class{constructor(n,e){this.aptosClient=n,this.builderConfig=e}async fetchABI(n){const t=(await this.aptosClient.getAccountModules(n)).map(i=>i.abi).flatMap(i=>i.exposed_functions.filter(r=>r.is_entry).map(r=>({fullName:`${i.address}::${i.name}::${r.name}`,...r}))),s=new Map;return t.forEach(i=>{s.set(i.fullName,i)}),s}async build(n,e,t){if(n=(g=>g.replace(/^0[xX]0*/g,"0x"))(n),n.split("::").length!==3)throw new Error("'func' needs to be a fully qualified function name in format <address>::<module>::<function>, e.g. 0x1::coin::transfer");const[r,o]=n.split("::"),a=await this.fetchABI(r);if(!a.has(n))throw new Error(`${n} doesn't exist.`);const c=a.get(n),d=c.params.filter(g=>g!=="signer"&&g!=="&signer").map((g,N)=>new nt(`var${N}`,new ze(g,e).parseTypeTag())),u=new xe(c.name,Ae.fromStr(`${r}::${o}`),"",c.generic_type_params.map((g,N)=>new tt(`${N}`)),d),{sender:h,...f}=this.builderConfig,y=h instanceof v?_.fromUint8Array(h.address):h,[{sequence_number:b},p,{gas_estimate:x}]=await Promise.all([f!=null&&f.sequenceNumber?Promise.resolve({sequence_number:f==null?void 0:f.sequenceNumber}):this.aptosClient.getAccount(y),f!=null&&f.chainId?Promise.resolve(f==null?void 0:f.chainId):this.aptosClient.getChainId(),f!=null&&f.gasUnitPrice?Promise.resolve({gas_estimate:f==null?void 0:f.gasUnitPrice}):this.aptosClient.estimateGasPrice()]);return new po([K(u)],{sender:h,sequenceNumber:b,chainId:p,gasUnitPrice:BigInt(x),...f}).build(n,e,t)}};m([zn(10*60*1e3)],rt.prototype,"fetchABI");var S=class ae{constructor(e,t,s=!1){if(!e)throw new Error("Node URL cannot be empty.");s?this.nodeUrl=e:this.nodeUrl=lr(e),this.config=t==null?{}:{...t}}async getAccount(e){const{data:t}=await O({url:this.nodeUrl,endpoint:`accounts/${_.ensure(e).hex()}`,originMethod:"getAccount",overrides:{...this.config}});return t}async getAccountTransactions(e,t){const{data:s}=await O({url:this.nodeUrl,endpoint:`accounts/${_.ensure(e).hex()}/transactions`,originMethod:"getAccountTransactions",params:{start:t==null?void 0:t.start,limit:t==null?void 0:t.limit},overrides:{...this.config}});return s}async getAccountModules(e,t){return await nn({url:this.nodeUrl,endpoint:`accounts/${e}/modules`,params:{ledger_version:t==null?void 0:t.ledgerVersion,limit:1e3},originMethod:"getAccountModules",overrides:{...this.config}})}async getAccountModule(e,t,s){const{data:i}=await O({url:this.nodeUrl,endpoint:`accounts/${_.ensure(e).hex()}/module/${t}`,originMethod:"getAccountModule",params:{ledger_version:s==null?void 0:s.ledgerVersion},overrides:{...this.config}});return i}async getAccountResources(e,t){return await nn({url:this.nodeUrl,endpoint:`accounts/${e}/resources`,params:{ledger_version:t==null?void 0:t.ledgerVersion,limit:9999},originMethod:"getAccountResources",overrides:{...this.config}})}async getAccountResource(e,t,s){const{data:i}=await O({url:this.nodeUrl,endpoint:`accounts/${_.ensure(e).hex()}/resource/${t}`,originMethod:"getAccountResource",params:{ledger_version:s==null?void 0:s.ledgerVersion},overrides:{...this.config}});return i}static generateBCSTransaction(e,t){return new dt(i=>{const r=e.signBuffer(i);return new T.Ed25519Signature(r.toUint8Array())},e.pubKey().toUint8Array()).sign(t)}static generateBCSSimulation(e,t){return new dt(i=>{const r=new Uint8Array(64);return new T.Ed25519Signature(r)},e.pubKey().toUint8Array()).sign(t)}async generateTransaction(e,t,s){const i={sender:e};if(s!=null&&s.sequence_number&&(i.sequenceNumber=s.sequence_number),s!=null&&s.gas_unit_price&&(i.gasUnitPrice=s.gas_unit_price),s!=null&&s.max_gas_amount&&(i.maxGasAmount=s.max_gas_amount),s!=null&&s.expiration_timestamp_secs){const o=Number.parseInt(s.expiration_timestamp_secs,10);i.expSecFromNow=o-Math.floor(Date.now()/1e3)}return new rt(this,i).build(t.function,t.type_arguments,t.arguments)}async generateFeePayerTransaction(e,t,s,i=[],r){const o=await this.generateTransaction(e,t,r),a=i.map(l=>v.fromHex(l));return new T.FeePayerRawTransaction(o,a,v.fromHex(s))}async submitFeePayerTransaction(e,t,s,i=[]){const r=new T.TransactionAuthenticatorFeePayer(t,e.secondary_signer_addresses,i,{address:e.fee_payer_address,authenticator:s}),o=K(new T.SignedTransaction(e.raw_txn,r));return await this.submitSignedBCSTransaction(o)}async signMultiTransaction(e,t){const s=new T.Ed25519Signature(e.signBuffer(Se.getSigningMessage(t)).toUint8Array()),i=new T.AccountAuthenticatorEd25519(new T.Ed25519PublicKey(e.signingKey.publicKey),s);return Promise.resolve(i)}async signTransaction(e,t){return Promise.resolve(ae.generateBCSTransaction(e,t))}async getEventsByCreationNumber(e,t,s){const{data:i}=await O({url:this.nodeUrl,endpoint:`accounts/${_.ensure(e).hex()}/events/${t}`,originMethod:"getEventsByCreationNumber",params:{start:s==null?void 0:s.start,limit:s==null?void 0:s.limit},overrides:{...this.config}});return i}async getEventsByEventHandle(e,t,s,i){const{data:r}=await O({url:this.nodeUrl,endpoint:`accounts/${_.ensure(e).hex()}/events/${t}/${s}`,originMethod:"getEventsByEventHandle",params:{start:i==null?void 0:i.start,limit:i==null?void 0:i.limit},overrides:{...this.config}});return r}async submitTransaction(e){return this.submitSignedBCSTransaction(e)}async simulateTransaction(e,t,s){let i;return e instanceof je?i=ae.generateBCSSimulation(e,t):e instanceof Ye?i=new _o(()=>{const{threshold:o}=e,a=[],c=[];for(let d=0;d<o;d+=1)a.push(d),c.push(new T.Ed25519Signature(new Uint8Array(64)));const l=T.MultiEd25519Signature.createBitmap(a);return new T.MultiEd25519Signature(c,l)},e).sign(t):i=new dt(()=>{const o=new Uint8Array(64);return new T.Ed25519Signature(o)},e.toBytes()).sign(t),this.submitBCSSimulation(i,s)}async submitSignedBCSTransaction(e){const{data:t}=await me({url:this.nodeUrl,body:e,endpoint:"transactions",originMethod:"submitSignedBCSTransaction",contentType:"application/x.aptos.signed_transaction+bcs",overrides:{...this.config}});return t}async submitBCSSimulation(e,t){var s,i,r;const o={estimate_gas_unit_price:(s=t==null?void 0:t.estimateGasUnitPrice)!=null?s:!1,estimate_max_gas_amount:(i=t==null?void 0:t.estimateMaxGasAmount)!=null?i:!1,estimate_prioritized_gas_unit_price:(r=t==null?void 0:t.estimatePrioritizedGasUnitPrice)!=null?r:!1},{data:a}=await me({url:this.nodeUrl,body:e,endpoint:"transactions/simulate",params:o,originMethod:"submitBCSSimulation",contentType:"application/x.aptos.signed_transaction+bcs",overrides:{...this.config}});return a}async getTransactions(e){var t;const{data:s}=await O({url:this.nodeUrl,endpoint:"transactions",originMethod:"getTransactions",params:{start:(t=e==null?void 0:e.start)==null?void 0:t.toString(),limit:e==null?void 0:e.limit},overrides:{...this.config}});return s}async getTransactionByHash(e){const{data:t}=await O({url:this.nodeUrl,endpoint:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash",overrides:{...this.config}});return t}async getTransactionByVersion(e){const{data:t}=await O({url:this.nodeUrl,endpoint:`transactions/by_version/${e}`,originMethod:"getTransactionByVersion",overrides:{...this.config}});return t}async transactionPending(e){try{return(await this.getTransactionByHash(e)).type==="pending_transaction"}catch(t){if((t==null?void 0:t.status)===404)return!0;throw t}}async waitForTransactionWithResult(e,t){var s,i;const r=(s=t==null?void 0:t.timeoutSecs)!=null?s:ur,o=(i=t==null?void 0:t.checkSuccess)!=null?i:!1;let a=!0,c=0,l;for(;a&&!(c>=r);){try{if(l=await this.getTransactionByHash(e),a=l.type==="pending_transaction",!a)break}catch(d){const u=d instanceof Vt,h=u&&d.status!==404&&d.status>=400&&d.status<500;if(!u||h)throw d}await cr(1e3),c+=1}if(l===void 0)throw new Error(`Waiting for transaction ${e} failed`);if(a)throw new go(`Waiting for transaction ${e} timed out after ${r} seconds`,l);if(!o)return l;if(!(l!=null&&l.success))throw new yo(`Transaction ${e} failed with an error: ${l.vm_status}`,l);return l}async waitForTransaction(e,t){await this.waitForTransactionWithResult(e,t)}async getLedgerInfo(){const{data:e}=await O({url:this.nodeUrl,originMethod:"getLedgerInfo",overrides:{...this.config}});return e}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getTableItem(e,t,s){var i;return(await me({url:this.nodeUrl,body:t,endpoint:`tables/${e}/item`,originMethod:"getTableItem",params:{ledger_version:(i=s==null?void 0:s.ledgerVersion)==null?void 0:i.toString()},overrides:{...this.config}})).data}async generateRawTransaction(e,t,s){const[{sequence_number:i},r,{gas_estimate:o}]=await Promise.all([s!=null&&s.providedSequenceNumber?Promise.resolve({sequence_number:s.providedSequenceNumber}):this.getAccount(e),this.getChainId(),s!=null&&s.gasUnitPrice?Promise.resolve({gas_estimate:s.gasUnitPrice}):this.estimateGasPrice()]),{maxGasAmount:a,gasUnitPrice:c,expireTimestamp:l}={maxGasAmount:BigInt(In),gasUnitPrice:BigInt(o),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+kn),...s};return new T.RawTransaction(T.AccountAddress.fromHex(e),BigInt(i),t,a,c,l,new T.ChainId(r))}async generateSignSubmitTransaction(e,t,s){const i=await this.generateRawTransaction(e.address(),t,s),r=ae.generateBCSTransaction(e,i);return(await this.submitSignedBCSTransaction(r)).hash}async signAndSubmitTransaction(e,t){const s=ae.generateBCSTransaction(e,t);return(await this.submitSignedBCSTransaction(s)).hash}async publishPackage(e,t,s,i){const r=new A;I(s,r);const o=new T.TransactionPayloadEntryFunction(T.EntryFunction.natural("0x1::code","publish_package_txn",[],[X(t),r.getBytes()]));return this.generateSignSubmitTransaction(e,o,i)}async createResourceAccountAndPublishPackage(e,t,s,i,r){const o=new A;I(i,o);const a=new T.TransactionPayloadEntryFunction(T.EntryFunction.natural("0x1::resource_account","create_resource_account_and_publish_package",[],[X(t),X(s),o.getBytes()]));return this.generateSignSubmitTransaction(e,a,r)}async generateSignSubmitWaitForTransaction(e,t,s){const i=await this.generateSignSubmitTransaction(e,t,s);return this.waitForTransactionWithResult(i,s)}async estimateGasPrice(){const{data:e}=await O({url:this.nodeUrl,endpoint:"estimate_gas_price",originMethod:"estimateGasPrice",overrides:{...this.config}});return e}async estimateMaxGasAmount(e){const t=`0x1::coin::CoinStore<${ft}>`,[{gas_estimate:s},i]=await Promise.all([this.estimateGasPrice(),this.getAccountResources(e)]),r=i.find(a=>a.type===t);return BigInt(r.data.coin.value)/BigInt(s)}async rotateAuthKeyEd25519(e,t,s){const{sequence_number:i,authentication_key:r}=await this.getAccount(e.address()),o=new je(t),a=new T.RotationProofChallenge(T.AccountAddress.CORE_CODE_ADDRESS,"account","RotationProofChallenge",BigInt(i),T.AccountAddress.fromHex(e.address()),new T.AccountAddress(new _(r).toUint8Array()),o.pubKey().toUint8Array()),c=_.fromUint8Array(K(a)),l=e.signHexString(c),d=o.signHexString(c),u=new T.TransactionPayloadEntryFunction(T.EntryFunction.natural("0x1::account","rotate_authentication_key",[],[pt(0),X(e.pubKey().toUint8Array()),pt(0),X(o.pubKey().toUint8Array()),X(l.toUint8Array()),X(d.toUint8Array())])),h=await this.generateRawTransaction(e.address(),u,s),f=ae.generateBCSTransaction(e,h);return this.submitSignedBCSTransaction(f)}async lookupOriginalAddress(e){const t=await this.getAccountResource("0x1","0x1::account::OriginatingAddress"),{address_map:{handle:s}}=t.data,i=await this.getTableItem(s,{key_type:"address",value_type:"address",key:_.ensure(e).hex()});return new _(i)}async getBlockByHeight(e,t){const{data:s}=await O({url:this.nodeUrl,endpoint:`blocks/by_height/${e}`,originMethod:"getBlockByHeight",params:{with_transactions:t},overrides:{...this.config}});return s}async getBlockByVersion(e,t){const{data:s}=await O({url:this.nodeUrl,endpoint:`blocks/by_version/${e}`,originMethod:"getBlockByVersion",params:{with_transactions:t},overrides:{...this.config}});return s}async view(e,t){const{data:s}=await me({url:this.nodeUrl,body:e,endpoint:"view",originMethod:"getTableItem",params:{ledger_version:t},overrides:{...this.config}});return s}clearCache(e){dr(e)}};m([E],S.prototype,"getAccount");m([E],S.prototype,"getAccountTransactions");m([E,zn(10*60*1e3)],S.prototype,"getAccountModules");m([E],S.prototype,"getAccountModule");m([E],S.prototype,"getAccountResources");m([E],S.prototype,"getAccountResource");m([E],S.prototype,"getEventsByCreationNumber");m([E],S.prototype,"getEventsByEventHandle");m([E],S.prototype,"submitSignedBCSTransaction");m([E],S.prototype,"submitBCSSimulation");m([E],S.prototype,"getTransactions");m([E],S.prototype,"getTransactionByHash");m([E],S.prototype,"getTransactionByVersion");m([E],S.prototype,"getLedgerInfo");m([Je()],S.prototype,"getChainId");m([E],S.prototype,"getTableItem");m([E,Je({ttlMs:5*60*1e3,tags:["gas_estimates"]})],S.prototype,"estimateGasPrice");m([E],S.prototype,"estimateMaxGasAmount");m([E],S.prototype,"getBlockByHeight");m([E],S.prototype,"getBlockByVersion");m([E],S.prototype,"view");var ot=S,go=class extends Error{constructor(n,e){super(n),this.lastSubmittedTransaction=e}},yo=class extends Error{constructor(n,e){super(n),this.transaction=e}},Vt=class extends Error{constructor(n,e,t,s){super(e),this.status=n,this.message=e,this.errorCode=t,this.vmErrorCode=s}};function E(n,e,t){const s=t.value;return t.value=async function(...r){var o,a;try{return await s.apply(this,[...r])}catch(c){throw c instanceof Cn?new Vt(c.status,JSON.stringify({message:c.message,...c.data}),(o=c.data)==null?void 0:o.error_code,(a=c.data)==null?void 0:a.vm_error_code):c}},t}var Ws=class B{constructor(e,t){this.endpoint=e,this.config=t}static validateAddress(e){if(e.length<66)throw new Error(`${e} is less than 66 chars long.`)}async queryIndexer(e){const t=await me({url:this.endpoint,body:e,overrides:{WITH_CREDENTIALS:!1,...this.config}});if(t.data.errors)throw new Vt(t.data.errors[0].extensions.code,JSON.stringify({message:t.data.errors[0].message,error_code:t.data.errors[0].extensions.code}));return t.data.data}async getIndexerLedgerInfo(){const e={query:Vr};return this.queryIndexer(e)}async getAccountNFTs(e,t){const s=_.ensure(e).hex();B.validateAddress(s);const i={query:Fr,variables:{address:s,offset:t==null?void 0:t.offset,limit:t==null?void 0:t.limit}};return this.queryIndexer(i)}async getTokenActivities(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const o={token_data_id:{_eq:r}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:Zr,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTokenActivitiesCount(e){const t={query:eo,variables:{token_id:e}};return this.queryIndexer(t)}async getAccountTokensCount(e,t){var s,i;const r={owner_address:{_eq:e},amount:{_gt:"0"}};t!=null&&t.tokenStandard&&(r.token_standard={_eq:t==null?void 0:t.tokenStandard});const o=_.ensure(e).hex();B.validateAddress(o);const a={query:qr,variables:{where_condition:r,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit}};return this.queryIndexer(a)}async getTokenData(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const o={token_data_id:{_eq:r}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:no,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTokenOwnersData(e,t,s){var i,r;const o=_.ensure(e).hex();B.validateAddress(o);const a={token_data_id:{_eq:o},amount:{_gt:"0"}};t&&(a.property_version_v1={_eq:t}),s!=null&&s.tokenStandard&&(a.token_standard={_eq:s==null?void 0:s.tokenStandard});const c={query:io,variables:{where_condition:a,offset:(i=s==null?void 0:s.options)==null?void 0:i.offset,limit:(r=s==null?void 0:s.options)==null?void 0:r.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(c)}async getTokenCurrentOwnerData(e,t,s){var i,r;const o=_.ensure(e).hex();B.validateAddress(o);const a={token_data_id:{_eq:o},amount:{_gt:"0"}};t&&(a.property_version_v1={_eq:t}),s!=null&&s.tokenStandard&&(a.token_standard={_eq:s==null?void 0:s.tokenStandard});const c={query:to,variables:{where_condition:a,offset:(i=s==null?void 0:s.options)==null?void 0:i.offset,limit:(r=s==null?void 0:s.options)==null?void 0:r.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(c)}async getOwnedTokens(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const o={owner_address:{_eq:r},amount:{_gt:0}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:Jr,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getOwnedTokensByTokenData(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const o={token_data_id:{_eq:r},amount:{_gt:0}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:Yr,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTokenOwnedFromCollectionAddress(e,t,s){var i,r;const o=_.ensure(e).hex();B.validateAddress(o);const a=_.ensure(t).hex();B.validateAddress(a);const c={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};s!=null&&s.tokenStandard&&(c.token_standard={_eq:s==null?void 0:s.tokenStandard});const l={query:so,variables:{where_condition:c,offset:(i=s==null?void 0:s.options)==null?void 0:i.offset,limit:(r=s==null?void 0:s.options)==null?void 0:r.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(l)}async getTokenOwnedFromCollectionNameAndCreatorAddress(e,t,s,i){const r=await this.getCollectionAddress(s,t,i);return await this.getTokenOwnedFromCollectionAddress(e,r,i)}async getCollectionData(e,t,s){var i,r;const o=_.ensure(e).hex();B.validateAddress(o);const a={collection_name:{_eq:t},creator_address:{_eq:o}};s!=null&&s.tokenStandard&&(a.token_standard={_eq:s==null?void 0:s.tokenStandard});const c={query:Kr,variables:{where_condition:a,offset:(i=s==null?void 0:s.options)==null?void 0:i.offset,limit:(r=s==null?void 0:s.options)==null?void 0:r.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(c)}async getCollectionAddress(e,t,s){return(await this.getCollectionData(e,t,s)).current_collections_v2[0].collection_id}async getCollectionsWithOwnedTokens(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const o={owner_address:{_eq:r}};t!=null&&t.tokenStandard&&(o.current_collection={token_standard:{_eq:t==null?void 0:t.tokenStandard}});const a={query:Wr,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getAccountTransactionsCount(e){const t=_.ensure(e).hex();B.validateAddress(t);const s={query:Rr,variables:{address:t}};return this.queryIndexer(s)}async getAccountTransactionsData(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const a={query:Gr,variables:{where_condition:{account_address:{_eq:r}},offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTopUserTransactions(e){const t={query:ro,variables:{limit:e}};return this.queryIndexer(t)}async getUserTransactions(e){var t,s;const i={version:{_lte:e==null?void 0:e.startVersion}},r={query:oo,variables:{where_condition:i,offset:(t=e==null?void 0:e.options)==null?void 0:t.offset,limit:(s=e==null?void 0:e.options)==null?void 0:s.limit,order_by:e==null?void 0:e.orderBy}};return this.queryIndexer(r)}async getDelegatedStakingActivities(e,t){const s=_.ensure(e).hex(),i=_.ensure(t).hex();B.validateAddress(s),B.validateAddress(i);const r={query:Qr,variables:{delegatorAddress:s,poolAddress:i}};return this.queryIndexer(r)}async getNumberOfDelegators(e){const t=_.ensure(e).hex();B.validateAddress(t);const s={query:Xr,variables:{poolAddress:t}};return this.queryIndexer(s)}async getAccountCoinsData(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const a={query:Dr,variables:{where_condition:{owner_address:{_eq:r}},offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getAccountCoinsDataCount(e){const t=_.ensure(e).hex();B.validateAddress(t);const s={query:Mr,variables:{address:t}};return this.queryIndexer(s)}async getAccountOwnedObjects(e,t){var s,i;const r=_.ensure(e).hex();B.validateAddress(r);const a={query:jr,variables:{where_condition:{owner_address:{_eq:r}},offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(i=t==null?void 0:t.options)==null?void 0:i.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}},Qe=class{constructor(n,e,t=!1){let s=null,i=null;if(typeof n=="object"&&wo(n)?(s=n.fullnodeUrl,i=n.indexerUrl,this.network="CUSTOM"):(s=_r[n],i=_t[n],this.network=n),this.network==="CUSTOM"&&!s)throw new Error("fullnode url is not provided");i&&(this.indexerClient=new Ws(i,e)),this.aptosClient=new ot(s,e,t)}};function js(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(s=>{const i=Object.getOwnPropertyDescriptor(e.prototype,s);i&&(i.value=function(...r){return this[t][s](...r)},Object.defineProperty(n.prototype,s,i))}),Object.getOwnPropertyNames(e).forEach(s=>{const i=Object.getOwnPropertyDescriptor(e,s);i&&(i.value=function(...r){return this[t][s](...r)},!n.hasOwnProperty.call(n,s)&&Object.defineProperty(n,s,i))})}js(Qe,ot,"aptosClient");js(Qe,Ws,"indexerClient");function wo(n){return n.fullnodeUrl!==void 0&&typeof n.fullnodeUrl=="string"}var Qs=class{constructor(n,e){this.type=n,this.value=e}},Vs=class{constructor(){this.data={}}setProperty(n,e){this.data[n]=e}};function bo(n){let e;return n==="string"||n==="String"?e=new se(kt):e=new ze(n).parseTypeTag(),e}function Xs(n){const e=n.map.data,t=new Vs;return e.forEach(s=>{const{key:i}=s,r=s.value.value,o=s.value.type,a=bo(o),c=vo(a,r),l=new Qs(o,c);t.setProperty(i,l)}),t}function vo(n,e){const t=new St(new _(e).toUint8Array());let s="";return n instanceof Z?s=t.deserializeU8().toString():n instanceof ge?s=t.deserializeU64().toString():n instanceof ye?s=t.deserializeU128().toString():n instanceof pe?s=t.deserializeBool()?"true":"false":n instanceof ne?s=_.fromUint8Array(t.deserializeFixedBytes(32)).hex():n instanceof se&&n.isStringTypeTag()?s=t.deserializeStr():s=e,s}var mo={};Xe(mo,{PropertyMap:()=>Vs,PropertyValue:()=>Qs,Token:()=>Uo,TokenData:()=>To});var To=class{constructor(n,e,t,s,i,r,o,a){this.collection=n,this.description=e,this.name=t,this.maximum=s,this.supply=i,this.uri=r,this.default_properties=Xs(o),this.mutability_config=a}},Uo=class{constructor(n,e,t){this.id=n,this.amount=e,this.token_properties=Xs(t)}},cn=class{constructor(n){this.assetType="0x1::fungible_asset::Metadata",this.provider=n}async transfer(n,e,t,s,i){const r=await this.generateTransfer(n,e,t,s,i);return await this.provider.signAndSubmitTransaction(n,r)}async getPrimaryBalance(n,e){const t={function:"0x1::primary_fungible_store::balance",type_arguments:[this.assetType],arguments:[_.ensure(n).hex(),_.ensure(e).hex()]},s=await this.provider.view(t);return BigInt(s[0])}async generateTransfer(n,e,t,s,i){return await new rt(this.provider,{sender:n.address(),...i}).build("0x1::primary_fungible_store::transfer",[this.assetType],[_.ensure(e).hex(),_.ensure(t).hex(),s])}},ln="0x1::aptos_account::transfer_coins",Ao="0x1::coin::transfer",xo=class{constructor(n){this.aptosClient=n}async transfer(n,e,t,s){var i,r,o;const a=((i=s==null?void 0:s.coinType)!=null?i:"").toString().includes("::");if(s!=null&&s.coinType&&!a&&v.isValid(s.coinType)){console.warn("to transfer a fungible asset, use `FungibleAssetClient()` class for better support");const b=new Qe({fullnodeUrl:this.aptosClient.nodeUrl,indexerUrl:(r=_t[sn[this.aptosClient.nodeUrl]])!=null?r:this.aptosClient.nodeUrl});return await new cn(b).transfer(n,s==null?void 0:s.coinType,Le(e),t)}const c=(o=s==null?void 0:s.coinType)!=null?o:ft;let l;(s==null?void 0:s.createReceiverIfMissing)===void 0?l=ln:l=s!=null&&s.createReceiverIfMissing?ln:Ao;const d=Le(e),h=await new rt(this.aptosClient,{sender:n.address(),...s}).build(l,[c],[d,t]),f=ot.generateBCSTransaction(n,h);return(await this.aptosClient.submitSignedBCSTransaction(f)).hash}async checkBalance(n,e){var t,s,i;const r=((t=e==null?void 0:e.coinType)!=null?t:"").toString().includes("::");if(e!=null&&e.coinType&&!r&&v.isValid(e.coinType)){console.warn("to check balance of a fungible asset, use `FungibleAssetClient()` class for better support");const d=new Qe({fullnodeUrl:this.aptosClient.nodeUrl,indexerUrl:(s=_t[sn[this.aptosClient.nodeUrl]])!=null?s:this.aptosClient.nodeUrl});return await new cn(d).getPrimaryBalance(Le(n),e==null?void 0:e.coinType)}const a=`0x1::coin::CoinStore<${(i=e==null?void 0:e.coinType)!=null?i:ft}>`,c=Le(n),l=await this.aptosClient.getAccountResource(c,a);return BigInt(l.data.coin.value)}},So={};Xe(So,{AptosErrorCode:()=>Js,MoveFunctionVisibility:()=>Ys,RoleType:()=>Zs});var Js=(n=>(n.ACCOUNT_NOT_FOUND="account_not_found",n.RESOURCE_NOT_FOUND="resource_not_found",n.MODULE_NOT_FOUND="module_not_found",n.STRUCT_FIELD_NOT_FOUND="struct_field_not_found",n.VERSION_NOT_FOUND="version_not_found",n.TRANSACTION_NOT_FOUND="transaction_not_found",n.TABLE_ITEM_NOT_FOUND="table_item_not_found",n.BLOCK_NOT_FOUND="block_not_found",n.STATE_VALUE_NOT_FOUND="state_value_not_found",n.VERSION_PRUNED="version_pruned",n.BLOCK_PRUNED="block_pruned",n.INVALID_INPUT="invalid_input",n.INVALID_TRANSACTION_UPDATE="invalid_transaction_update",n.SEQUENCE_NUMBER_TOO_OLD="sequence_number_too_old",n.VM_ERROR="vm_error",n.HEALTH_CHECK_FAILED="health_check_failed",n.MEMPOOL_IS_FULL="mempool_is_full",n.INTERNAL_ERROR="internal_error",n.WEB_FRAMEWORK_ERROR="web_framework_error",n.BCS_NOT_SUPPORTED="bcs_not_supported",n.API_DISABLED="api_disabled",n))(Js||{}),Ys=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(Ys||{}),Zs=(n=>(n.VALIDATOR="validator",n.FULL_NODE="full_node",n))(Zs||{});class ei extends U.ChainContext{}const ee=class ee extends U.PlatformContext{constructor(e,t){super(e,t??U.networkPlatformConfigs(e,ee._platform))}getRpc(e){if(e in this.config)return new ot(this.config[e].rpc);throw new Error("No configuration available for chain: "+e)}getChain(e,t){if(e in this.config)return new ei(e,this);throw new Error("No configuration available for chain: "+e)}static nativeTokenId(e,t){if(!this.isSupportedChain(t))throw new Error(`invalid chain: ${t}`);return U.Wormhole.tokenId(t,U.APTOS_COIN)}static isNativeTokenId(e,t,s){return!this.isSupportedChain(t)||s.chain!==t?!1:this.nativeTokenId(e,t)==s}static isSupportedChain(e){return U.chainToPlatform(e)===ee._platform}static async getDecimals(e,t,s){if(U.isNative(s))return U.nativeDecimals(ee._platform);const i=s.toString(),r=`0x1::coin::CoinInfo<${i}>`;return(await t.getAccountResource(i.split(U.APTOS_SEPARATOR)[0],r)).data.decimals}static async getBalance(e,t,s,i){const r=U.isNative(i)?U.APTOS_COIN:i.toString(),o=new xo(t);try{return await o.checkBalance(s,{coinType:r})}catch(a){if(a.errorCode==="resource_not_found"&&a.status===404)return null;throw a}}static async getBalances(e,t,s,i){return(await Promise.all(i.map(async o=>{const a=await this.getBalance(e,t,s,o);return{[U.isNative(o)?"native":new U.AptosAddress(o).toString()]:a}}))).reduce((o,a)=>Object.assign(o,a),{})}static async sendWait(e,t,s){const i=[];for(const r of s){const o=await t.submitTransaction(r),a=await t.waitForTransactionWithResult(o.hash);i.push(a.hash)}return i}static async getLatestBlock(e){const t=await e.getLedgerInfo();return Number(t.block_height)}static async getLatestFinalizedBlock(e){const t=await e.getLedgerInfo();return Number(t.block_height)}static chainFromChainId(e){const t=U.platformNativeChainIdToNetworkChain(ee._platform,BigInt(e));if(!t)throw new Error(`No matching chainId to determine network and chain: ${e}`);const[s,i]=t;return[s,i]}static async chainFromRpc(e){const s=await e.getChainId();return this.chainFromChainId(s.toString())}};re(ee,"_platform",U._platform$2);let fe=ee;async function Bo(n,e){const[t,s]=await fe.chainFromRpc(n);return new Eo(s,new je(U.hex.decode(e)),n)}class Eo{constructor(e,t,s,i){re(this,"_chain");re(this,"_account");re(this,"_rpc");re(this,"_debug");this._chain=e,this._account=t,this._rpc=s,this._debug=i}chain(){return this._chain}address(){return this._account.address().hex()}async signAndSend(e){const t=[];for(const s of e){const{description:i,transaction:r}=s;this._debug&&console.log(`Signing: ${i} for ${this.address()}`);const o={gas_unit_price:"100",max_gas_amount:"30000",expiration_timestamp_secs:(BigInt(Date.now()+8*60*60*1e3)/1000n).toString()},a=await this._rpc.generateTransaction(this._account.address(),r,o),{hash:c}=await this._simSignSend(a);t.push(c)}return t}async _simSignSend(e){return await this._rpc.simulateTransaction(this._account,e).then(t=>t.forEach(s=>{if(!s.success)throw new Error(`Transaction failed: ${s.vm_status}
|
|
418
|
-
${JSON.stringify(s,null,2)}`)})),this._rpc.signTransaction(this._account,e).then(t=>this._rpc.submitTransaction(t)).then(t=>this._rpc.waitForTransactionWithResult(t.hash))}}const Io={Address:U.AptosAddress,Platform:fe,getSigner:Bo,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-
|
|
418
|
+
${JSON.stringify(s,null,2)}`)})),this._rpc.signTransaction(this._account,e).then(t=>this._rpc.submitTransaction(t)).then(t=>this._rpc.waitForTransactionWithResult(t.hash))}}const Io={Address:U.AptosAddress,Platform:fe,getSigner:Bo,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-CPgdgK8L.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-tKKMDrTV.js"))},getChain:(n,e,t)=>new ei(e,new fe(n,U.applyChainsConfigConfigOverrides(n,U._platform$2,{[e]:t})))},ko=Object.freeze(Object.defineProperty({__proto__:null,default:Io},Symbol.toStringTag,{value:"Module"}));exports.AptosPlatform=fe;exports.aptos=ko;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var oi = Object.defineProperty;
|
|
2
2
|
var ai = (n, e, t) => e in n ? oi(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
|
|
3
3
|
var ie = (n, e, t) => ai(n, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
-
import { h as ci, n as Pe, C as li, i as ui, j as hn, k as di, l as hi, m as Yt, o as fi, p as dt, q as _i, r as pi, s as fn, t as gi, u as yi, c as wi } from "./index-
|
|
4
|
+
import { h as ci, n as Pe, C as li, i as ui, j as hn, k as di, l as hi, m as Yt, o as fi, p as dt, q as _i, r as pi, s as fn, t as gi, u as yi, c as wi } from "./index-CjwA7HmM.mjs";
|
|
5
5
|
function ee(n) {
|
|
6
6
|
if (!Number.isSafeInteger(n) || n < 0)
|
|
7
7
|
throw new Error(`Wrong positive integer: ${n}`);
|
|
@@ -5166,8 +5166,8 @@ const Go = {
|
|
|
5166
5166
|
Platform: xe,
|
|
5167
5167
|
getSigner: qo,
|
|
5168
5168
|
protocols: {
|
|
5169
|
-
WormholeCore: () => import("./index-
|
|
5170
|
-
TokenBridge: () => import("./index-
|
|
5169
|
+
WormholeCore: () => import("./index-IypSUdxl.mjs"),
|
|
5170
|
+
TokenBridge: () => import("./index-BTBmklHJ.mjs")
|
|
5171
5171
|
},
|
|
5172
5172
|
getChain: (n, e, t) => new ii(e, new xe(n, wi(n, hn, {
|
|
5173
5173
|
[e]: t
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./evm-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./evm-BOrFw20j.js");class y extends e.BaseError{constructor({callbackSelector:r,cause:t,data:c,extraData:i,sender:u,urls:a}){var d;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(d=t.metaMessages)!=null&&d.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(f=>` ${e.getUrl(f)}`)],` Sender: ${u}`,` Data: ${c}`,` Callback selector: ${r}`,` Extra data: ${i}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class w extends e.BaseError{constructor({result:r,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(t)}`,`Response: ${e.stringify(r)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class b extends e.BaseError{constructor({sender:r,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${r}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function g(n,r){if(!e.isAddress(n))throw new e.InvalidAddressError({address:n});if(!e.isAddress(r))throw new e.InvalidAddressError({address:r});return n.toLowerCase()===r.toLowerCase()}const k="0x556f1830",p={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function E(n,{blockNumber:r,blockTag:t,data:c,to:i}){const{args:u}=e.decodeErrorResult({data:c,abi:[p]}),[a,d,f,s,o]=u;try{if(!g(i,a))throw new b({sender:a,to:i});const l=await h({data:f,sender:a,urls:d}),{data:m}=await e.call(n,{blockNumber:r,blockTag:t,data:e.concat([s,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[l,o])]),to:i});return m}catch(l){throw new y({callbackSelector:s,cause:l,data:c,extraData:o,sender:a,urls:d})}}async function h({data:n,sender:r,urls:t}){var i;let c=new Error("An unknown error occurred.");for(let u=0;u<t.length;u++){const a=t[u],d=a.includes("{data}")?"GET":"POST",f=d==="POST"?{data:n,sender:r}:void 0;try{const s=await fetch(a.replace("{sender}",r).replace("{data}",n),{body:JSON.stringify(f),method:d});let o;if((i=s.headers.get("Content-Type"))!=null&&i.startsWith("application/json")?o=(await s.json()).data:o=await s.text(),!s.ok){c=new e.HttpRequestError({body:f,details:o!=null&&o.error?e.stringify(o.error):s.statusText,headers:s.headers,status:s.status,url:a});continue}if(!e.isHex(o)){c=new w({result:o,url:a});continue}return o}catch(s){c=new e.HttpRequestError({body:f,details:s.message,url:a})}}throw c}exports.ccipFetch=h;exports.offchainLookup=E;exports.offchainLookupAbiItem=p;exports.offchainLookupSignature=k;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as l, g as w, s as y, i as p, I as h, d as g, c as k, a as O, b as L, H as m, f as E } from "./evm-
|
|
1
|
+
import { B as l, g as w, s as y, i as p, I as h, d as g, c as k, a as O, b as L, H as m, f as E } from "./evm-CkxKsuQ-.mjs";
|
|
2
2
|
class x extends l {
|
|
3
3
|
constructor({ callbackSelector: e, cause: a, data: o, extraData: c, sender: d, urls: r }) {
|
|
4
4
|
var i;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
var Av = Object.defineProperty;
|
|
2
2
|
var Ev = (e, n, a) => n in e ? Av(e, n, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[n] = a;
|
|
3
3
|
var G5 = (e, n, a) => Ev(e, typeof n != "symbol" ? n + "" : n, a);
|
|
4
|
-
import { V as $, Y as gx, X as Bd, Z as j, $ as Bf, a0 as If, au as vv, aI as Cv, ax as Ws, az as u3, aE as Ov, aJ as Pv, ac as W2, aK as wv, aL as kv, aM as Rv, aN as T4, aG as xx, aO as Fv, aP as yx, aQ as _v, aH as f3, aR as Bv } from "./index-
|
|
5
|
-
import { b as Iv, m as ie, r as Dx, a as Z2, c as Sx, x as Fi, d as Nv, e as Tv, f as Uv, g as G2, h as Q2, i as z2, j as K2, k as Y2, u as X2, p as j2 } from "./pako.esm-
|
|
6
|
-
import { l as en, a as Mv } from "./libsodium-wrappers-
|
|
7
|
-
import { r as Ax, a as Ex } from "./index-
|
|
8
|
-
import { l as Jv, t as Lv, z as i9, A as xf, G as yo, R as Hv, V as Vv, W as vx, L as qv, S as $v, F as Wv, M as Zv, B as Gv, N as Cx, J as Id, Q as Qv, x as zv } from "./index-
|
|
9
|
-
import { p as Kv } from "./utils-
|
|
4
|
+
import { V as $, Y as gx, X as Bd, Z as j, $ as Bf, a0 as If, au as vv, aI as Cv, ax as Ws, az as u3, aE as Ov, aJ as Pv, ac as W2, aK as wv, aL as kv, aM as Rv, aN as T4, aG as xx, aO as Fv, aP as yx, aQ as _v, aH as f3, aR as Bv } from "./index-CjwA7HmM.mjs";
|
|
5
|
+
import { b as Iv, m as ie, r as Dx, a as Z2, c as Sx, x as Fi, d as Nv, e as Tv, f as Uv, g as G2, h as Q2, i as z2, j as K2, k as Y2, u as X2, p as j2 } from "./pako.esm-C7QrkxRd.mjs";
|
|
6
|
+
import { l as en, a as Mv } from "./libsodium-wrappers-BB6-Iffd.mjs";
|
|
7
|
+
import { r as Ax, a as Ex } from "./index-Cm3iq-IJ.mjs";
|
|
8
|
+
import { l as Jv, t as Lv, z as i9, A as xf, G as yo, R as Hv, V as Vv, W as vx, L as qv, S as $v, F as Wv, M as Zv, B as Gv, N as Cx, J as Id, Q as Qv, x as zv } from "./index-D6Sqxs9J.mjs";
|
|
9
|
+
import { p as Kv } from "./utils-Cd5O9nI7.mjs";
|
|
10
10
|
var ve;
|
|
11
11
|
(function(e) {
|
|
12
12
|
e.MainnetK8s = "mainnetK8s", e.MainnetLB = "mainnetLB", e.Mainnet = "mainnet", e.MainnetSentry = "mainnetSentry", e.MainnetOld = "mainnetOld", e.Staging = "staging", e.Internal = "internal", e.TestnetK8s = "testnetK8s", e.TestnetOld = "testnetOld", e.TestnetSentry = "testnetSentry", e.Testnet = "testnet", e.Devnet1 = "devnet1", e.Devnet2 = "devnet2", e.Devnet = "devnet", e.Local = "local";
|