@wormhole-foundation/wormhole-connect 1.1.4-beta.1-development → 1.1.4-beta.2-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/{algorand-CL9E7qV4.js → algorand-CyJRjYjt.js} +2 -2
- package/dist/assets/{aptos-CYfJ6QKV.js → aptos-k14Q8oIC.js} +2 -2
- package/dist/assets/{ccip-Cfs6IR2H.js → ccip-BNTHR_fq.js} +1 -1
- package/dist/assets/{cosmwasm-B8f9g9-e.js → cosmwasm-Bb55TeV-.js} +3 -3
- package/dist/assets/{evm-BeHPA-N8.js → evm-BxXdWj24.js} +5 -5
- package/dist/assets/{evm-DsaBFKKm.js → evm-C-buBtRY.js} +2 -2
- package/dist/assets/{index-DzWKLl_i.js → index-BAmVCbB-.js} +1 -1
- package/dist/assets/{index-C0jKBHol.js → index-BEc0YFBn.js} +1 -1
- package/dist/assets/{index-DW2PHjzW.js → index-BLMTT3rM.js} +1 -1
- package/dist/assets/{index-CVz7Lfsa.js → index-BY0kgWx8.js} +1 -1
- package/dist/assets/{index-BtIDaBGl.js → index-BfDApobA.js} +1 -1
- package/dist/assets/{index-Cka3pqB6.js → index-BwBQHmYt.js} +1 -1
- package/dist/assets/{index-B1Zd6Tbj.js → index-C0psfra-.js} +1 -1
- package/dist/assets/{index-Dmt4H-sz.js → index-C2FPBPlV.js} +1 -1
- package/dist/assets/{index-DyOk_vKo.js → index-C3Sky6pw.js} +1 -1
- package/dist/assets/{index-DEXJQ6UW.js → index-C87qdc5P.js} +1 -1
- package/dist/assets/{index-QCp2fK6U.js → index-D2LZykJf.js} +2 -2
- package/dist/assets/{index-DSNr6Aeg.js → index-DoWu6bTw.js} +1 -1
- package/dist/assets/{index-DkQt9fOR.js → index-Dqm3REGN.js} +1 -1
- package/dist/assets/{index-BQIi8F3e.js → index-FQGd6qGV.js} +1 -1
- package/dist/assets/{index-QJ2zlRk3.js → index-IlqLhD3I.js} +1 -1
- package/dist/assets/{index-q0W2SHor.js → index-YIP9QK2L.js} +1 -1
- package/dist/assets/{index-TrUYBc0F.js → index-nosdUF9i.js} +1 -1
- package/dist/assets/{index-CFYbGyvs.js → index-xo-ROtuF.js} +1 -1
- package/dist/assets/{index-CZCNUCD6.js → index-yAX3aWkW.js} +1 -1
- package/dist/assets/{index.es-xWGpyzms.js → index.es--WISYjTj.js} +3 -3
- package/dist/assets/{keccak-Dh1-j093.js → keccak-DYzglTc3.js} +1 -1
- package/dist/assets/{solana-FuO6ds45.js → solana-BmGIyTEt.js} +2 -2
- package/dist/assets/{solana-HXT1gH4s.js → solana-D5RkygmT.js} +2 -2
- package/dist/assets/{solanaEmbed.esm-CmWxi_NO.js → solanaEmbed.esm-CFdxIRQj.js} +1 -1
- package/dist/assets/{sui-CQYR74Ws.js → sui-CW05lm4n.js} +2 -2
- package/dist/assets/{unsignedTransaction-YIv7ff3U.js → unsignedTransaction-DAYPmfUj.js} +1 -1
- package/dist/main.js +69 -69
- package/lib/{algorand-DMWnCGDD.js → algorand-B9Pcx34H.js} +1 -1
- package/lib/{algorand-CKeviXZg.mjs → algorand-BfdC8LMm.mjs} +3 -3
- package/lib/{aptos-LGyhejg2.mjs → aptos-CuQYjxz4.mjs} +1 -1
- package/lib/{aptos-DBFfVz6j.js → aptos-D8msRZYc.js} +1 -1
- package/lib/{aptos-DNei2Fw9.mjs → aptos-DISEuAM4.mjs} +3 -3
- package/lib/{aptos-CAJat9Bn.js → aptos-DlboPucS.js} +2 -2
- package/lib/{ccip-E64BZKbj.js → ccip-BqkngZ6V.js} +1 -1
- package/lib/{ccip-gtLK9yzS.mjs → ccip-DV1T5CQz.mjs} +1 -1
- package/lib/{cosmwasm-CnK43h4P.mjs → cosmwasm-BFPK6deV.mjs} +111 -7
- package/lib/{cosmwasm-CmkeZSLD.js → cosmwasm-D3ZKcsjq.js} +2 -2
- package/lib/{events-dBi7i6gd.mjs → events-CaIL5tL1.mjs} +1 -1
- package/lib/{events-D5Nem7a2.js → events-Cxw8aBUy.js} +1 -1
- package/lib/{evm-DyPy8X4q.mjs → evm-7idwo4la.mjs} +5 -5
- package/lib/{evm-Bsq-lyhx.mjs → evm-D11YbeC_.mjs} +7 -7
- package/lib/{evm-BEkpevR1.js → evm-D12EHZXD.js} +4 -4
- package/lib/{evm-JR5REYuq.js → evm-UrRoO3lT.js} +1 -1
- package/lib/{index-DWFG3ux-.js → index-B-m7_r9W.js} +1 -1
- package/lib/{index-BZTaoymt.mjs → index-BEfsEC8g.mjs} +3 -3
- package/lib/{index-Cc_mraT5.mjs → index-BKeG3u48.mjs} +2 -2
- package/lib/{index-FW1hHPsY.js → index-BMLK3kVY.js} +1 -1
- package/lib/{index-CrVV6hQ2.js → index-BMsGsrRe.js} +1 -1
- package/lib/{index-xr-_5YwS.mjs → index-BPD6tZ5I.mjs} +7575 -5146
- package/lib/{index-CL3ekJSh.js → index-BQI2oZiv.js} +1 -1
- package/lib/{index-CeksQZJ0.mjs → index-BUGIe9Q0.mjs} +4 -4
- package/lib/{index-CvX8wxOG.mjs → index-BkUc_QzZ.mjs} +2 -2
- package/lib/{index-DE7BjSqw.js → index-Br_1eyUd.js} +1 -1
- package/lib/{index-C8MkGmi-.mjs → index-C1KUJpQh.mjs} +1 -1
- package/lib/{index-B_wAMidq.js → index-C6ww0FoG.js} +1 -1
- package/lib/{index-YigUyjDr.mjs → index-CBnSdTOm.mjs} +1 -1
- package/lib/{index-DD4g5WJB.mjs → index-CDGkVXf1.mjs} +2 -2
- package/lib/{index-D5un17aL.mjs → index-CG2dc9k1.mjs} +13 -13
- package/lib/{index-CsYGJh8i.js → index-CGqBKzB5.js} +1 -1
- package/lib/{index-TidzojcT.js → index-CHGr1Xo0.js} +1 -1
- package/lib/{index-BHnHO_u8.js → index-CJ8hOjdz.js} +1 -1
- package/lib/{index-BlRWSvuT.js → index-COW9BRyV.js} +1 -1
- package/lib/{index-jnHYrj-0.mjs → index-CeK6G0Jr.mjs} +2 -2
- package/lib/{index-u9NHndtJ.mjs → index-Cfupv0rQ.mjs} +4 -4
- package/lib/{index-C-MpEmke.mjs → index-Cg19mcso.mjs} +1 -1
- package/lib/{index-DhJzyV8c.js → index-Cg6LDJti.js} +1 -1
- package/lib/{index-Cwf7_SpM.js → index-CkHXWtPG.js} +1 -1
- package/lib/{index-B9YINx-j.mjs → index-ClI_55nW.mjs} +7 -7
- package/lib/{index-BSXkcZeB.mjs → index-ClbyJuae.mjs} +2 -2
- package/lib/{index-DRTJX6NI.mjs → index-Cs8OaRdq.mjs} +2 -2
- package/lib/{index-B6Yxe_gd.mjs → index-D4FfgE9k.mjs} +2 -2
- package/lib/{index-PebPsVgf.js → index-D9Ezmk4f.js} +1 -1
- package/lib/{index-BIhEJqD8.js → index-DgKyQSTc.js} +1 -1
- package/lib/{index-BxaWYSOO.js → index-Dh6mkRtz.js} +74 -74
- package/lib/{index-w88sWpdI.js → index-DjZ438HP.js} +1 -1
- package/lib/{index-DSJ41rGf.mjs → index-DlXF_HRr.mjs} +2 -2
- package/lib/{index-DRDlsqLC.js → index-DsMw6BFg.js} +1 -1
- package/lib/{index-CtuM0Nhj.mjs → index-GKdJmpc9.mjs} +2 -2
- package/lib/{index-CAOx_2w0.mjs → index-IwSEAKjs.mjs} +3 -3
- package/lib/{index-CvLvO-ub.mjs → index-VO5jvtPN.mjs} +1 -1
- package/lib/{index-fpX08H1Q.js → index-Vouac_sN.js} +1 -1
- package/lib/{index-snvFYwLU.mjs → index-f6MztC_k.mjs} +2 -2
- package/lib/{index-BrZMeh8Y.js → index-hb33T1qT.js} +1 -1
- package/lib/{index-D9LNItFN.js → index-s_6sncui.js} +1 -1
- package/lib/{index-CN4S3GOd.mjs → index-vmVyLCAM.mjs} +3 -3
- package/lib/{index-CLImffCI.js → index-xTifobUX.js} +1 -1
- package/lib/{index-Brws-ttZ.js → index-yYbCizsj.js} +1 -1
- package/lib/{index.es-BgIY-CJP.mjs → index.es-Bld6bvmZ.mjs} +5 -5
- package/lib/{index.es-DA6xjT-p.js → index.es-DWCjm6mS.js} +2 -2
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{keccak-D3kXYcOs.mjs → keccak-BwFcIiaM.mjs} +1 -1
- package/lib/{keccak-xKB7Kino.js → keccak-C8mX3bFz.js} +1 -1
- package/lib/{pbkdf2-DCnqfxZR.js → pbkdf2-Bk-3RPXm.js} +1 -1
- package/lib/{pbkdf2-Dg0HWbq4.mjs → pbkdf2-CeHVjwwG.mjs} +1 -1
- package/lib/{signer-DIzVzPl8.mjs → signer-DXNU3KLz.mjs} +1 -1
- package/lib/{signer-CbcYYMJ7.js → signer-LadskxdY.js} +1 -1
- package/lib/solana-B15fGx9S.js +1 -0
- package/lib/{solana-BVgObkcE.mjs → solana-BasjNE9K.mjs} +4 -4
- package/lib/{solana-DmCHygOA.js → solana-C9iEiCkx.js} +1 -1
- package/lib/{solana-HKO9jNRD.mjs → solana-CfCGAR-_.mjs} +5 -5
- package/lib/{solanaEmbed.esm-DqNfqaxI.js → solanaEmbed.esm-CJdWWBYT.js} +1 -1
- package/lib/{solanaEmbed.esm-DEAHXGVn.mjs → solanaEmbed.esm-pwzJ8Zc0.mjs} +3 -3
- package/lib/{sui-DN8E0m68.mjs → sui-B9B-EQyp.mjs} +4 -4
- package/lib/{sui-BDoIBdRb.js → sui-BJBxQjSI.js} +2 -2
- package/lib/{sui-Bp2zLhA_.mjs → sui-HC466JTC.mjs} +1 -1
- package/lib/{sui-W_WW-YXK.js → sui-iJeaGeqF.js} +1 -1
- package/lib/{unsignedTransaction-Dkfjd5_o.js → unsignedTransaction-CmgkSLIX.js} +1 -1
- package/lib/unsignedTransaction-Di5zQIK0.mjs +35 -0
- package/package.json +3 -3
- package/lib/solana-BYXqKgjy.js +0 -1
- package/lib/unsignedTransaction-C32EJDkZ.mjs +0 -35
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
2
|
-
var A=Object.defineProperty;var x=(e,n,t)=>n in e?A(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>x(e,typeof n!="symbol"?n+"":n,t);import{ae as C,af as R,bl as w,ah as S,bm as i,ai as T,bn as y,ak as E,al as p,bo as h,am as j,ap as k,bp as N,bq as B,_,a3 as D}from"../main.js";class I extends C{}const g=class g extends R{constructor(n,t){super(n,t??S(n,g._platform))}getRpc(n){if(n in this.config)return new i.Algodv2("",this.config[n].rpc);throw new Error("No configuration available for chain: "+n)}getChain(n){if(n in this.config)return new I(n,this);throw new Error("No configuration available for chain: "+n)}static nativeTokenId(n,t){if(!g.isSupportedChain(t))throw new Error(`invalid chain for Algorand: ${t}`);return T.chainAddress(t,y)}static isNativeTokenId(n,t,o){return!g.isSupportedChain(t)||o.chain!==t?!1:this.nativeTokenId(n,t)==o}static isSupportedChain(n){return E(n)===g._platform}static async getDecimals(n,t,o){const a=p(o)?0:new h(o).toInt();if(a===0)return j(g._platform);const d=await t.getAssetByID(a).do(),r=i.modelsv2.Asset.from_obj_for_encoding(d);if(!r.params||!r.params.decimals)throw new Error("Could not fetch token details");return Number(r.params.decimals)}static async getBalance(n,t,o,a){const d=p(a)?0:new h(a).toInt();if(d===0){const c=await t.accountInformation(o).do(),u=i.modelsv2.Account.from_obj_for_encoding(c);return BigInt(u.amount)}const r=await t.accountAssetInformation(o,d).do(),s=i.modelsv2.AssetHolding.from_obj_for_encoding(r);return BigInt(s.amount)}static async getBalances(n,t,o,a){let d;if(a.includes("native")){const s=await t.accountInformation(o).do(),c=i.modelsv2.Account.from_obj_for_encoding(s);d=BigInt(c.amount)}return a.map(async s=>{if(p(s))return{native:d};const c=new h(s).toInt(),u=await t.accountAssetInformation(o,c).do(),f=i.modelsv2.AssetHolding.from_obj_for_encoding(u);return BigInt(f.amount)}).reduce((s,c)=>Object.assign(s,c),{})}static async sendWait(n,t,o){const r=o.map((f,b)=>i.decodeSignedTransaction(f)).map((f,b)=>f.txn.txID()),{txId:s}=await t.sendRawTransaction(o).do();if(!s)throw new Error("Transaction(s) failed to send");const c=await i.waitForConfirmation(t,s,4);if(!i.modelsv2.PendingTransactionResponse.from_obj_for_encoding(c).confirmedRound)throw new Error("Transaction(s) could not be confirmed in 4 rounds");return r}static async getLatestBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static async getLatestFinalizedBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static chainFromChainId(n){const t=k(g._platform,n);if(t===void 0)throw new Error(`Unknown native chain id ${n}`);const[o,a]=t;return[o,a]}static async chainFromRpc(n){const t=await n.versionsCheck().do(),o=i.modelsv2.Version.from_obj_for_encoding(t);return this.chainFromChainId(o.genesisId)}};l(g,"_platform",w);let m=g;async function $(e,n){const[t,o]=await m.chainFromRpc(e);return new P(o,e,n)}class P{constructor(n,t,o,a=!1){l(this,"_chain");l(this,"_debug");l(this,"_account");this._chain=n,this._debug=a,this._account=N(o)}chain(){return this._chain}address(){return this._account.addr}async sign(n){const t=[],o=n.map((r,s)=>r.transaction.tx),a=B(o),d=n.map((r,s)=>(r.transaction.tx=a[s],r));for(const r of d){const{description:s,transaction:c}=r,{tx:u,signer:f}=c;this._debug&&(console.log(u._getDictForDisplay()),console.log(u.txID())),f?(this._debug&&console.log(`Signing: ${s} with signer ${f.address} for address ${this.address()}`),t.push(await f.signTxn(u))):(this._debug&&console.log(`Signing: ${s} without signer for address ${this.address()}`),t.push(u.signTxn(this._account.sk)))}return t}}const F={Address:h,Platform:m,getSigner:$,protocols:{WormholeCore:()=>_(()=>import("./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C0psfra-.js","main.js","main.css","assets/index-yAX3aWkW.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var A=Object.defineProperty;var x=(e,n,t)=>n in e?A(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var l=(e,n,t)=>x(e,typeof n!="symbol"?n+"":n,t);import{ae as C,af as R,bl as w,ah as S,bm as i,ai as T,bn as y,ak as E,al as p,bo as h,am as j,ap as k,bp as N,bq as B,_,a3 as D}from"../main.js";class I extends C{}const g=class g extends R{constructor(n,t){super(n,t??S(n,g._platform))}getRpc(n){if(n in this.config)return new i.Algodv2("",this.config[n].rpc);throw new Error("No configuration available for chain: "+n)}getChain(n){if(n in this.config)return new I(n,this);throw new Error("No configuration available for chain: "+n)}static nativeTokenId(n,t){if(!g.isSupportedChain(t))throw new Error(`invalid chain for Algorand: ${t}`);return T.chainAddress(t,y)}static isNativeTokenId(n,t,o){return!g.isSupportedChain(t)||o.chain!==t?!1:this.nativeTokenId(n,t)==o}static isSupportedChain(n){return E(n)===g._platform}static async getDecimals(n,t,o){const a=p(o)?0:new h(o).toInt();if(a===0)return j(g._platform);const d=await t.getAssetByID(a).do(),r=i.modelsv2.Asset.from_obj_for_encoding(d);if(!r.params||!r.params.decimals)throw new Error("Could not fetch token details");return Number(r.params.decimals)}static async getBalance(n,t,o,a){const d=p(a)?0:new h(a).toInt();if(d===0){const c=await t.accountInformation(o).do(),u=i.modelsv2.Account.from_obj_for_encoding(c);return BigInt(u.amount)}const r=await t.accountAssetInformation(o,d).do(),s=i.modelsv2.AssetHolding.from_obj_for_encoding(r);return BigInt(s.amount)}static async getBalances(n,t,o,a){let d;if(a.includes("native")){const s=await t.accountInformation(o).do(),c=i.modelsv2.Account.from_obj_for_encoding(s);d=BigInt(c.amount)}return a.map(async s=>{if(p(s))return{native:d};const c=new h(s).toInt(),u=await t.accountAssetInformation(o,c).do(),f=i.modelsv2.AssetHolding.from_obj_for_encoding(u);return BigInt(f.amount)}).reduce((s,c)=>Object.assign(s,c),{})}static async sendWait(n,t,o){const r=o.map((f,b)=>i.decodeSignedTransaction(f)).map((f,b)=>f.txn.txID()),{txId:s}=await t.sendRawTransaction(o).do();if(!s)throw new Error("Transaction(s) failed to send");const c=await i.waitForConfirmation(t,s,4);if(!i.modelsv2.PendingTransactionResponse.from_obj_for_encoding(c).confirmedRound)throw new Error("Transaction(s) could not be confirmed in 4 rounds");return r}static async getLatestBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static async getLatestFinalizedBlock(n){const t=await n.status().do(),o=i.modelsv2.NodeStatusResponse.from_obj_for_encoding(t);if(!o.lastRound)throw new Error("Error getting status from node");return Number(o.lastRound)}static chainFromChainId(n){const t=k(g._platform,n);if(t===void 0)throw new Error(`Unknown native chain id ${n}`);const[o,a]=t;return[o,a]}static async chainFromRpc(n){const t=await n.versionsCheck().do(),o=i.modelsv2.Version.from_obj_for_encoding(t);return this.chainFromChainId(o.genesisId)}};l(g,"_platform",w);let m=g;async function $(e,n){const[t,o]=await m.chainFromRpc(e);return new P(o,e,n)}class P{constructor(n,t,o,a=!1){l(this,"_chain");l(this,"_debug");l(this,"_account");this._chain=n,this._debug=a,this._account=N(o)}chain(){return this._chain}address(){return this._account.addr}async sign(n){const t=[],o=n.map((r,s)=>r.transaction.tx),a=B(o),d=n.map((r,s)=>(r.transaction.tx=a[s],r));for(const r of d){const{description:s,transaction:c}=r,{tx:u,signer:f}=c;this._debug&&(console.log(u._getDictForDisplay()),console.log(u.txID())),f?(this._debug&&console.log(`Signing: ${s} with signer ${f.address} for address ${this.address()}`),t.push(await f.signTxn(u))):(this._debug&&console.log(`Signing: ${s} without signer for address ${this.address()}`),t.push(u.signTxn(this._account.sk)))}return t}}const F={Address:h,Platform:m,getSigner:$,protocols:{WormholeCore:()=>_(()=>import("./index-C0psfra-.js").then(e=>e.i),__vite__mapDeps([0,1,2])),TokenBridge:()=>_(()=>import("./index-yAX3aWkW.js"),__vite__mapDeps([3,0,1,2]))},getChain:(e,n,t)=>new I(n,new m(e,D(e,w,{[n]:t})))},U=Object.freeze(Object.defineProperty({__proto__:null,default:F},Symbol.toStringTag,{value:"Module"}));export{m as A,U as a};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BY0kgWx8.js","main.js","main.css","assets/index-BEc0YFBn.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var Ri=Object.defineProperty;var Ni=(n,e,t)=>e in n?Ri(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var me=(n,e,t)=>Ni(n,typeof e!="symbol"?e+"":e,t);import{i as ft,R as tt,ae as Pi,af as Li,ag as ys,ah as $i,ai as Di,aj as Mn,ak as Fi,al as $t,am as Hi,an as Mi,ao as gs,ap as qi,ad as ji,_ as qn,a3 as Gi}from"../main.js";function he(n){if(!Number.isSafeInteger(n)||n<0)throw new Error(`Wrong positive integer: ${n}`)}function Ki(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function an(n,...e){if(!Ki(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 ms(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");he(n.outputLen),he(n.blockLen)}function Ae(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 ws(n,e){an(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 Wi=n=>new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4));function bs(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}const rt=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),X=(n,e)=>n<<32-e|n>>>e,Vi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Vi)throw new Error("Non little-endian hardware is not supported");const Ji=Array.from({length:256},(n,e)=>e.toString(16).padStart(2,"0"));function vs(n){if(!bs(n))throw new Error("Uint8Array expected");let e="";for(let t=0;t<n.length;t++)e+=Ji[n[t]];return e}const Q={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function jn(n){if(n>=Q._0&&n<=Q._9)return n-Q._0;if(n>=Q._A&&n<=Q._F)return n-(Q._A-10);if(n>=Q._a&&n<=Q._f)return n-(Q._a-10)}function Ts(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 r=0,i=0;r<t;r++,i+=2){const o=jn(n.charCodeAt(i)),a=jn(n.charCodeAt(i+1));if(o===void 0||a===void 0){const l=n[i]+n[i+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+i)}s[r]=o*16+a}return s}function Xi(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function Se(n){if(typeof n=="string"&&(n=Xi(n)),!bs(n))throw new Error(`expected Uint8Array, got ${typeof n}`);return n}class cn{clone(){return this._cloneInto()}}const Qi={}.toString;function Zi(n,e){if(e!==void 0&&Qi.call(e)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(n,e)}function ln(n){const e=s=>n().update(Se(s)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}class As extends cn{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ms(e);const s=Se(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 r=this.blockLen,i=new Uint8Array(r);i.set(s.length>r?e.create().update(s).digest():s);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),i.fill(0)}update(e){return Ae(this),this.iHash.update(e),this}digestInto(e){Ae(this),an(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:r,destroyed:i,blockLen:o,outputLen:a}=this;return e=e,e.finished=r,e.destroyed=i,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 wt=(n,e,t)=>new As(n,e).update(t).digest();wt.create=(n,e)=>new As(n,e);function Yi(n,e,t,s){ms(n);const r=Zi({dkLen:32,asyncTick:10},s),{c:i,dkLen:o,asyncTick:a}=r;if(he(i),he(o),he(a),i<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=Se(e),c=Se(t),u=new Uint8Array(o),d=wt.create(n,l),_=d._cloneInto().update(c);return{c:i,dkLen:o,asyncTick:a,DK:u,PRF:d,PRFSalt:_}}function eo(n,e,t,s,r){return n.destroy(),e.destroy(),s&&s.destroy(),r.fill(0),t}function to(n,e,t,s){const{c:r,dkLen:i,DK:o,PRF:a,PRFSalt:l}=Yi(n,e,t,s);let c;const u=new Uint8Array(4),d=rt(u),_=new Uint8Array(a.outputLen);for(let g=1,p=0;p<i;g++,p+=a.outputLen){const m=o.subarray(p,p+a.outputLen);d.setInt32(0,g,!1),(c=l._cloneInto(c)).update(u).digestInto(_),m.set(_.subarray(0,m.length));for(let f=1;f<r;f++){a._cloneInto(c).update(_).digestInto(_);for(let T=0;T<m.length;T++)m[T]^=_[T]}}return eo(a,l,o,c,_)}function no(n,e,t,s){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,s);const r=BigInt(32),i=BigInt(4294967295),o=Number(t>>r&i),a=Number(t&i),l=s?4:0,c=s?0:4;n.setUint32(e+l,o,s),n.setUint32(e+c,a,s)}class Ss extends cn{constructor(e,t,s,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=s,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=rt(this.buffer)}update(e){Ae(this);const{view:t,buffer:s,blockLen:r}=this;e=Se(e);const i=e.length;for(let o=0;o<i;){const a=Math.min(r-this.pos,i-o);if(a===r){const l=rt(e);for(;r<=i-o;o+=r)this.process(l,o);continue}s.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ae(this),ws(e,this),this.finished=!0;const{buffer:t,view:s,blockLen:r,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>r-o&&(this.process(s,0),o=0);for(let d=o;d<r;d++)t[d]=0;no(s,r-8,BigInt(this.length*8),i),this.process(s,0);const a=rt(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<c;d++)a.setUint32(4*d,u[d],i)}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:r,finished:i,destroyed:o,pos:a}=this;return e.length=r,e.pos=a,e.finished=i,e.destroyed=o,r%t&&e.buffer.set(s),e}}const so=(n,e,t)=>n&e^~n&t,ro=(n,e,t)=>n&e^n&t^e&t,io=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]),ee=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),te=new Uint32Array(64);class oo extends Ss{constructor(){super(64,32,8,!1),this.A=ee[0]|0,this.B=ee[1]|0,this.C=ee[2]|0,this.D=ee[3]|0,this.E=ee[4]|0,this.F=ee[5]|0,this.G=ee[6]|0,this.H=ee[7]|0}get(){const{A:e,B:t,C:s,D:r,E:i,F:o,G:a,H:l}=this;return[e,t,s,r,i,o,a,l]}set(e,t,s,r,i,o,a,l){this.A=e|0,this.B=t|0,this.C=s|0,this.D=r|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=l|0}process(e,t){for(let d=0;d<16;d++,t+=4)te[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){const _=te[d-15],g=te[d-2],p=X(_,7)^X(_,18)^_>>>3,m=X(g,17)^X(g,19)^g>>>10;te[d]=m+te[d-7]+p+te[d-16]|0}let{A:s,B:r,C:i,D:o,E:a,F:l,G:c,H:u}=this;for(let d=0;d<64;d++){const _=X(a,6)^X(a,11)^X(a,25),g=u+_+so(a,l,c)+io[d]+te[d]|0,m=(X(s,2)^X(s,13)^X(s,22))+ro(s,r,i)|0;u=c,c=l,l=a,a=o+g|0,o=i,i=r,r=s,s=g+m|0}s=s+this.A|0,r=r+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(s,r,i,o,a,l,c,u)}roundClean(){te.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ao=ln(()=>new oo),nt=BigInt(2**32-1),jt=BigInt(32);function Es(n,e=!1){return e?{h:Number(n&nt),l:Number(n>>jt&nt)}:{h:Number(n>>jt&nt)|0,l:Number(n&nt)|0}}function xs(n,e=!1){let t=new Uint32Array(n.length),s=new Uint32Array(n.length);for(let r=0;r<n.length;r++){const{h:i,l:o}=Es(n[r],e);[t[r],s[r]]=[i,o]}return[t,s]}const co=(n,e)=>BigInt(n>>>0)<<jt|BigInt(e>>>0),lo=(n,e,t)=>n>>>t,uo=(n,e,t)=>n<<32-t|e>>>t,ho=(n,e,t)=>n>>>t|e<<32-t,fo=(n,e,t)=>n<<32-t|e>>>t,po=(n,e,t)=>n<<64-t|e>>>t-32,_o=(n,e,t)=>n>>>t-32|e<<64-t,yo=(n,e)=>e,go=(n,e)=>n,Us=(n,e,t)=>n<<t|e>>>32-t,Bs=(n,e,t)=>e<<t|n>>>32-t,ks=(n,e,t)=>e<<t-32|n>>>64-t,Is=(n,e,t)=>n<<t-32|e>>>64-t;function mo(n,e,t,s){const r=(e>>>0)+(s>>>0);return{h:n+t+(r/2**32|0)|0,l:r|0}}const wo=(n,e,t)=>(n>>>0)+(e>>>0)+(t>>>0),bo=(n,e,t,s)=>e+t+s+(n/2**32|0)|0,vo=(n,e,t,s)=>(n>>>0)+(e>>>0)+(t>>>0)+(s>>>0),To=(n,e,t,s,r)=>e+t+s+r+(n/2**32|0)|0,Ao=(n,e,t,s,r)=>(n>>>0)+(e>>>0)+(t>>>0)+(s>>>0)+(r>>>0),So=(n,e,t,s,r,i)=>e+t+s+r+i+(n/2**32|0)|0,v={fromBig:Es,split:xs,toBig:co,shrSH:lo,shrSL:uo,rotrSH:ho,rotrSL:fo,rotrBH:po,rotrBL:_o,rotr32H:yo,rotr32L:go,rotlSH:Us,rotlSL:Bs,rotlBH:ks,rotlBL:Is,add:mo,add3L:wo,add3H:bo,add4L:vo,add4H:To,add5H:So,add5L:Ao},[Eo,xo]=v.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))),ne=new Uint32Array(80),se=new Uint32Array(80);class Uo extends Ss{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:r,Ch:i,Cl:o,Dh:a,Dl:l,Eh:c,El:u,Fh:d,Fl:_,Gh:g,Gl:p,Hh:m,Hl:f}=this;return[e,t,s,r,i,o,a,l,c,u,d,_,g,p,m,f]}set(e,t,s,r,i,o,a,l,c,u,d,_,g,p,m,f){this.Ah=e|0,this.Al=t|0,this.Bh=s|0,this.Bl=r|0,this.Ch=i|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=c|0,this.El=u|0,this.Fh=d|0,this.Fl=_|0,this.Gh=g|0,this.Gl=p|0,this.Hh=m|0,this.Hl=f|0}process(e,t){for(let y=0;y<16;y++,t+=4)ne[y]=e.getUint32(t),se[y]=e.getUint32(t+=4);for(let y=16;y<80;y++){const x=ne[y-15]|0,k=se[y-15]|0,$=v.rotrSH(x,k,1)^v.rotrSH(x,k,8)^v.shrSH(x,k,7),D=v.rotrSL(x,k,1)^v.rotrSL(x,k,8)^v.shrSL(x,k,7),q=ne[y-2]|0,F=se[y-2]|0,le=v.rotrSH(q,F,19)^v.rotrBH(q,F,61)^v.shrSH(q,F,6),Pt=v.rotrSL(q,F,19)^v.rotrBL(q,F,61)^v.shrSL(q,F,6),et=v.add4L(D,Pt,se[y-7],se[y-16]),Lt=v.add4H(et,$,le,ne[y-7],ne[y-16]);ne[y]=Lt|0,se[y]=et|0}let{Ah:s,Al:r,Bh:i,Bl:o,Ch:a,Cl:l,Dh:c,Dl:u,Eh:d,El:_,Fh:g,Fl:p,Gh:m,Gl:f,Hh:T,Hl:E}=this;for(let y=0;y<80;y++){const x=v.rotrSH(d,_,14)^v.rotrSH(d,_,18)^v.rotrBH(d,_,41),k=v.rotrSL(d,_,14)^v.rotrSL(d,_,18)^v.rotrBL(d,_,41),$=d&g^~d&m,D=_&p^~_&f,q=v.add5L(E,k,D,xo[y],se[y]),F=v.add5H(q,T,x,$,Eo[y],ne[y]),le=q|0,Pt=v.rotrSH(s,r,28)^v.rotrBH(s,r,34)^v.rotrBH(s,r,39),et=v.rotrSL(s,r,28)^v.rotrBL(s,r,34)^v.rotrBL(s,r,39),Lt=s&i^s&a^i&a,zi=r&o^r&l^o&l;T=m|0,E=f|0,m=g|0,f=p|0,g=d|0,p=_|0,{h:d,l:_}=v.add(c|0,u|0,F|0,le|0),c=a|0,u=l|0,a=i|0,l=o|0,i=s|0,o=r|0;const Hn=v.add3L(le,et,zi);s=v.add3H(Hn,F,Pt,Lt),r=Hn|0}({h:s,l:r}=v.add(this.Ah|0,this.Al|0,s|0,r|0)),{h:i,l:o}=v.add(this.Bh|0,this.Bl|0,i|0,o|0),{h:a,l}=v.add(this.Ch|0,this.Cl|0,a|0,l|0),{h:c,l:u}=v.add(this.Dh|0,this.Dl|0,c|0,u|0),{h:d,l:_}=v.add(this.Eh|0,this.El|0,d|0,_|0),{h:g,l:p}=v.add(this.Fh|0,this.Fl|0,g|0,p|0),{h:m,l:f}=v.add(this.Gh|0,this.Gl|0,m|0,f|0),{h:T,l:E}=v.add(this.Hh|0,this.Hl|0,T|0,E|0),this.set(s,r,i,o,a,l,c,u,d,_,g,p,m,f,T,E)}roundClean(){ne.fill(0),se.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 un=ln(()=>new Uo);function Cs(n){if(typeof n!="string")throw new TypeError(`Invalid mnemonic type: ${typeof n}`);return n.normalize("NFKD")}function Bo(n){const e=Cs(n),t=e.split(" ");if(![12,15,18,21,24].includes(t.length))throw new Error("Invalid mnemonic");return{nfkd:e,words:t}}const ko=n=>Cs(`mnemonic${n}`);function Io(n,e=""){return to(un,Bo(n).nfkd,ko(e),{c:2048,dkLen:64})}const[Os,zs,Rs]=[[],[],[]],Co=BigInt(0),Re=BigInt(1),Oo=BigInt(2),zo=BigInt(7),Ro=BigInt(256),No=BigInt(113);for(let n=0,e=Re,t=1,s=0;n<24;n++){[t,s]=[s,(2*t+3*s)%5],Os.push(2*(5*s+t)),zs.push((n+1)*(n+2)/2%64);let r=Co;for(let i=0;i<7;i++)e=(e<<Re^(e>>zo)*No)%Ro,e&Oo&&(r^=Re<<(Re<<BigInt(i))-Re);Rs.push(r)}const[Po,Lo]=xs(Rs,!0),Gn=(n,e,t)=>t>32?ks(n,e,t):Us(n,e,t),Kn=(n,e,t)=>t>32?Is(n,e,t):Bs(n,e,t);function $o(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,l=(o+2)%10,c=t[l],u=t[l+1],d=Gn(c,u,1)^t[a],_=Kn(c,u,1)^t[a+1];for(let g=0;g<50;g+=10)n[o+g]^=d,n[o+g+1]^=_}let r=n[2],i=n[3];for(let o=0;o<24;o++){const a=zs[o],l=Gn(r,i,a),c=Kn(r,i,a),u=Os[o];r=n[u],i=n[u+1],n[u]=l,n[u+1]=c}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]^=Po[s],n[1]^=Lo[s]}t.fill(0)}class dn extends cn{constructor(e,t,s,r=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=s,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,he(s),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Wi(this.state)}keccak(){$o(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){Ae(this);const{blockLen:t,state:s}=this;e=Se(e);const r=e.length;for(let i=0;i<r;){const o=Math.min(t-this.pos,r-i);for(let a=0;a<o;a++)s[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:s,blockLen:r}=this;e[s]^=t,t&128&&s===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Ae(this,!1),an(e),this.finish();const t=this.state,{blockLen:s}=this;for(let r=0,i=e.length;r<i;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=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 he(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(ws(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:r,rounds:i,enableXOF:o}=this;return e||(e=new dn(t,s,r,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=s,e.outputLen=r,e.enableXOF=o,e.destroyed=this.destroyed,e}}const Do=(n,e,t)=>ln(()=>new dn(e,n,t)),Ee=Do(6,136,256/8);function Ns(n,e){return function(){return n.apply(e,arguments)}}const{toString:Fo}=Object.prototype,{getPrototypeOf:hn}=Object,bt=(n=>e=>{const t=Fo.call(e);return n[t]||(n[t]=t.slice(8,-1).toLowerCase())})(Object.create(null)),V=n=>(n=n.toLowerCase(),e=>bt(e)===n),vt=n=>e=>typeof e===n,{isArray:xe}=Array,$e=vt("undefined");function Ho(n){return n!==null&&!$e(n)&&n.constructor!==null&&!$e(n.constructor)&&j(n.constructor.isBuffer)&&n.constructor.isBuffer(n)}const Ps=V("ArrayBuffer");function Mo(n){let e;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?e=ArrayBuffer.isView(n):e=n&&n.buffer&&Ps(n.buffer),e}const qo=vt("string"),j=vt("function"),Ls=vt("number"),Tt=n=>n!==null&&typeof n=="object",jo=n=>n===!0||n===!1,it=n=>{if(bt(n)!=="object")return!1;const e=hn(n);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in n)&&!(Symbol.iterator in n)},Go=V("Date"),Ko=V("File"),Wo=V("Blob"),Vo=V("FileList"),Jo=n=>Tt(n)&&j(n.pipe),Xo=n=>{let e;return n&&(typeof FormData=="function"&&n instanceof FormData||j(n.append)&&((e=bt(n))==="formdata"||e==="object"&&j(n.toString)&&n.toString()==="[object FormData]"))},Qo=V("URLSearchParams"),[Zo,Yo,ea,ta]=["ReadableStream","Request","Response","Headers"].map(V),na=n=>n.trim?n.trim():n.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function je(n,e,{allOwnKeys:t=!1}={}){if(n===null||typeof n>"u")return;let s,r;if(typeof n!="object"&&(n=[n]),xe(n))for(s=0,r=n.length;s<r;s++)e.call(null,n[s],s,n);else{const i=t?Object.getOwnPropertyNames(n):Object.keys(n),o=i.length;let a;for(s=0;s<o;s++)a=i[s],e.call(null,n[a],a,n)}}function $s(n,e){e=e.toLowerCase();const t=Object.keys(n);let s=t.length,r;for(;s-- >0;)if(r=t[s],e===r.toLowerCase())return r;return null}const de=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:ft.global,Ds=n=>!$e(n)&&n!==de;function Gt(){const{caseless:n}=Ds(this)&&this||{},e={},t=(s,r)=>{const i=n&&$s(e,r)||r;it(e[i])&&it(s)?e[i]=Gt(e[i],s):it(s)?e[i]=Gt({},s):xe(s)?e[i]=s.slice():e[i]=s};for(let s=0,r=arguments.length;s<r;s++)arguments[s]&&je(arguments[s],t);return e}const sa=(n,e,t,{allOwnKeys:s}={})=>(je(e,(r,i)=>{t&&j(r)?n[i]=Ns(r,t):n[i]=r},{allOwnKeys:s}),n),ra=n=>(n.charCodeAt(0)===65279&&(n=n.slice(1)),n),ia=(n,e,t,s)=>{n.prototype=Object.create(e.prototype,s),n.prototype.constructor=n,Object.defineProperty(n,"super",{value:e.prototype}),t&&Object.assign(n.prototype,t)},oa=(n,e,t,s)=>{let r,i,o;const a={};if(e=e||{},n==null)return e;do{for(r=Object.getOwnPropertyNames(n),i=r.length;i-- >0;)o=r[i],(!s||s(o,n,e))&&!a[o]&&(e[o]=n[o],a[o]=!0);n=t!==!1&&hn(n)}while(n&&(!t||t(n,e))&&n!==Object.prototype);return e},aa=(n,e,t)=>{n=String(n),(t===void 0||t>n.length)&&(t=n.length),t-=e.length;const s=n.indexOf(e,t);return s!==-1&&s===t},ca=n=>{if(!n)return null;if(xe(n))return n;let e=n.length;if(!Ls(e))return null;const t=new Array(e);for(;e-- >0;)t[e]=n[e];return t},la=(n=>e=>n&&e instanceof n)(typeof Uint8Array<"u"&&hn(Uint8Array)),ua=(n,e)=>{const s=(n&&n[Symbol.iterator]).call(n);let r;for(;(r=s.next())&&!r.done;){const i=r.value;e.call(n,i[0],i[1])}},da=(n,e)=>{let t;const s=[];for(;(t=n.exec(e))!==null;)s.push(t);return s},ha=V("HTMLFormElement"),fa=n=>n.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(t,s,r){return s.toUpperCase()+r}),Wn=(({hasOwnProperty:n})=>(e,t)=>n.call(e,t))(Object.prototype),pa=V("RegExp"),Fs=(n,e)=>{const t=Object.getOwnPropertyDescriptors(n),s={};je(t,(r,i)=>{let o;(o=e(r,i,n))!==!1&&(s[i]=o||r)}),Object.defineProperties(n,s)},_a=n=>{Fs(n,(e,t)=>{if(j(n)&&["arguments","caller","callee"].indexOf(t)!==-1)return!1;const s=n[t];if(j(s)){if(e.enumerable=!1,"writable"in e){e.writable=!1;return}e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+t+"'")})}})},ya=(n,e)=>{const t={},s=r=>{r.forEach(i=>{t[i]=!0})};return xe(n)?s(n):s(String(n).split(e)),t},ga=()=>{},ma=(n,e)=>n!=null&&Number.isFinite(n=+n)?n:e,Dt="abcdefghijklmnopqrstuvwxyz",Vn="0123456789",Hs={DIGIT:Vn,ALPHA:Dt,ALPHA_DIGIT:Dt+Dt.toUpperCase()+Vn},wa=(n=16,e=Hs.ALPHA_DIGIT)=>{let t="";const{length:s}=e;for(;n--;)t+=e[Math.random()*s|0];return t};function ba(n){return!!(n&&j(n.append)&&n[Symbol.toStringTag]==="FormData"&&n[Symbol.iterator])}const va=n=>{const e=new Array(10),t=(s,r)=>{if(Tt(s)){if(e.indexOf(s)>=0)return;if(!("toJSON"in s)){e[r]=s;const i=xe(s)?[]:{};return je(s,(o,a)=>{const l=t(o,r+1);!$e(l)&&(i[a]=l)}),e[r]=void 0,i}}return s};return t(n,0)},Ta=V("AsyncFunction"),Aa=n=>n&&(Tt(n)||j(n))&&j(n.then)&&j(n.catch),Ms=((n,e)=>n?setImmediate:e?((t,s)=>(de.addEventListener("message",({source:r,data:i})=>{r===de&&i===t&&s.length&&s.shift()()},!1),r=>{s.push(r),de.postMessage(t,"*")}))(`axios@${Math.random()}`,[]):t=>setTimeout(t))(typeof setImmediate=="function",j(de.postMessage)),Sa=typeof queueMicrotask<"u"?queueMicrotask.bind(de):typeof ft.process<"u"&&ft.process.nextTick||Ms,h={isArray:xe,isArrayBuffer:Ps,isBuffer:Ho,isFormData:Xo,isArrayBufferView:Mo,isString:qo,isNumber:Ls,isBoolean:jo,isObject:Tt,isPlainObject:it,isReadableStream:Zo,isRequest:Yo,isResponse:ea,isHeaders:ta,isUndefined:$e,isDate:Go,isFile:Ko,isBlob:Wo,isRegExp:pa,isFunction:j,isStream:Jo,isURLSearchParams:Qo,isTypedArray:la,isFileList:Vo,forEach:je,merge:Gt,extend:sa,trim:na,stripBOM:ra,inherits:ia,toFlatObject:oa,kindOf:bt,kindOfTest:V,endsWith:aa,toArray:ca,forEachEntry:ua,matchAll:da,isHTMLForm:ha,hasOwnProperty:Wn,hasOwnProp:Wn,reduceDescriptors:Fs,freezeMethods:_a,toObjectSet:ya,toCamelCase:fa,noop:ga,toFiniteNumber:ma,findKey:$s,global:de,isContextDefined:Ds,ALPHABET:Hs,generateString:wa,isSpecCompliantForm:ba,toJSONObject:va,isAsyncFn:Ta,isThenable:Aa,setImmediate:Ms,asap:Sa};function b(n,e,t,s,r){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=n,this.name="AxiosError",e&&(this.code=e),t&&(this.config=t),s&&(this.request=s),r&&(this.response=r)}h.inherits(b,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:h.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const qs=b.prototype,js={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(n=>{js[n]={value:n}});Object.defineProperties(b,js);Object.defineProperty(qs,"isAxiosError",{value:!0});b.from=(n,e,t,s,r,i)=>{const o=Object.create(qs);return h.toFlatObject(n,o,function(l){return l!==Error.prototype},a=>a!=="isAxiosError"),b.call(o,n.message,e,t,s,r),o.cause=n,o.name=n.name,i&&Object.assign(o,i),o};const Ea=null;function Kt(n){return h.isPlainObject(n)||h.isArray(n)}function Gs(n){return h.endsWith(n,"[]")?n.slice(0,-2):n}function Jn(n,e,t){return n?n.concat(e).map(function(r,i){return r=Gs(r),!t&&i?"["+r+"]":r}).join(t?".":""):e}function xa(n){return h.isArray(n)&&!n.some(Kt)}const Ua=h.toFlatObject(h,{},null,function(e){return/^is[A-Z]/.test(e)});function At(n,e,t){if(!h.isObject(n))throw new TypeError("target must be an object");e=e||new FormData,t=h.toFlatObject(t,{metaTokens:!0,dots:!1,indexes:!1},!1,function(m,f){return!h.isUndefined(f[m])});const s=t.metaTokens,r=t.visitor||u,i=t.dots,o=t.indexes,l=(t.Blob||typeof Blob<"u"&&Blob)&&h.isSpecCompliantForm(e);if(!h.isFunction(r))throw new TypeError("visitor must be a function");function c(p){if(p===null)return"";if(h.isDate(p))return p.toISOString();if(!l&&h.isBlob(p))throw new b("Blob is not supported. Use a Buffer instead.");return h.isArrayBuffer(p)||h.isTypedArray(p)?l&&typeof Blob=="function"?new Blob([p]):ft.Buffer.from(p):p}function u(p,m,f){let T=p;if(p&&!f&&typeof p=="object"){if(h.endsWith(m,"{}"))m=s?m:m.slice(0,-2),p=JSON.stringify(p);else if(h.isArray(p)&&xa(p)||(h.isFileList(p)||h.endsWith(m,"[]"))&&(T=h.toArray(p)))return m=Gs(m),T.forEach(function(y,x){!(h.isUndefined(y)||y===null)&&e.append(o===!0?Jn([m],x,i):o===null?m:m+"[]",c(y))}),!1}return Kt(p)?!0:(e.append(Jn(f,m,i),c(p)),!1)}const d=[],_=Object.assign(Ua,{defaultVisitor:u,convertValue:c,isVisitable:Kt});function g(p,m){if(!h.isUndefined(p)){if(d.indexOf(p)!==-1)throw Error("Circular reference detected in "+m.join("."));d.push(p),h.forEach(p,function(T,E){(!(h.isUndefined(T)||T===null)&&r.call(e,T,h.isString(E)?E.trim():E,m,_))===!0&&g(T,m?m.concat(E):[E])}),d.pop()}}if(!h.isObject(n))throw new TypeError("data must be an object");return g(n),e}function Xn(n){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(n).replace(/[!'()~]|%20|%00/g,function(s){return e[s]})}function fn(n,e){this._pairs=[],n&&At(n,this,e)}const Ks=fn.prototype;Ks.append=function(e,t){this._pairs.push([e,t])};Ks.toString=function(e){const t=e?function(s){return e.call(this,s,Xn)}:Xn;return this._pairs.map(function(r){return t(r[0])+"="+t(r[1])},"").join("&")};function Ba(n){return encodeURIComponent(n).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ws(n,e,t){if(!e)return n;const s=t&&t.encode||Ba,r=t&&t.serialize;let i;if(r?i=r(e,t):i=h.isURLSearchParams(e)?e.toString():new fn(e,t).toString(s),i){const o=n.indexOf("#");o!==-1&&(n=n.slice(0,o)),n+=(n.indexOf("?")===-1?"?":"&")+i}return n}class Qn{constructor(){this.handlers=[]}use(e,t,s){return this.handlers.push({fulfilled:e,rejected:t,synchronous:s?s.synchronous:!1,runWhen:s?s.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){h.forEach(this.handlers,function(s){s!==null&&e(s)})}}const Vs={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},ka=typeof URLSearchParams<"u"?URLSearchParams:fn,Ia=typeof FormData<"u"?FormData:null,Ca=typeof Blob<"u"?Blob:null,Oa={isBrowser:!0,classes:{URLSearchParams:ka,FormData:Ia,Blob:Ca},protocols:["http","https","file","blob","url","data"]},pn=typeof window<"u"&&typeof document<"u",za=(n=>pn&&["ReactNative","NativeScript","NS"].indexOf(n)<0)(typeof navigator<"u"&&navigator.product),Ra=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",Na=pn&&window.location.href||"http://localhost",Pa=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:pn,hasStandardBrowserEnv:za,hasStandardBrowserWebWorkerEnv:Ra,origin:Na},Symbol.toStringTag,{value:"Module"})),W={...Pa,...Oa};function La(n,e){return At(n,new W.classes.URLSearchParams,Object.assign({visitor:function(t,s,r,i){return W.isNode&&h.isBuffer(t)?(this.append(s,t.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)}},e))}function $a(n){return h.matchAll(/\w+|\[(\w*)]/g,n).map(e=>e[0]==="[]"?"":e[1]||e[0])}function Da(n){const e={},t=Object.keys(n);let s;const r=t.length;let i;for(s=0;s<r;s++)i=t[s],e[i]=n[i];return e}function Js(n){function e(t,s,r,i){let o=t[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=t.length;return o=!o&&h.isArray(r)?r.length:o,l?(h.hasOwnProp(r,o)?r[o]=[r[o],s]:r[o]=s,!a):((!r[o]||!h.isObject(r[o]))&&(r[o]=[]),e(t,s,r[o],i)&&h.isArray(r[o])&&(r[o]=Da(r[o])),!a)}if(h.isFormData(n)&&h.isFunction(n.entries)){const t={};return h.forEachEntry(n,(s,r)=>{e($a(s),r,t,0)}),t}return null}function Fa(n,e,t){if(h.isString(n))try{return(e||JSON.parse)(n),h.trim(n)}catch(s){if(s.name!=="SyntaxError")throw s}return(0,JSON.stringify)(n)}const Ge={transitional:Vs,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const s=t.getContentType()||"",r=s.indexOf("application/json")>-1,i=h.isObject(e);if(i&&h.isHTMLForm(e)&&(e=new FormData(e)),h.isFormData(e))return r?JSON.stringify(Js(e)):e;if(h.isArrayBuffer(e)||h.isBuffer(e)||h.isStream(e)||h.isFile(e)||h.isBlob(e)||h.isReadableStream(e))return e;if(h.isArrayBufferView(e))return e.buffer;if(h.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(i){if(s.indexOf("application/x-www-form-urlencoded")>-1)return La(e,this.formSerializer).toString();if((a=h.isFileList(e))||s.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return At(a?{"files[]":e}:e,l&&new l,this.formSerializer)}}return i||r?(t.setContentType("application/json",!1),Fa(e)):e}],transformResponse:[function(e){const t=this.transitional||Ge.transitional,s=t&&t.forcedJSONParsing,r=this.responseType==="json";if(h.isResponse(e)||h.isReadableStream(e))return e;if(e&&h.isString(e)&&(s&&!this.responseType||r)){const o=!(t&&t.silentJSONParsing)&&r;try{return JSON.parse(e)}catch(a){if(o)throw a.name==="SyntaxError"?b.from(a,b.ERR_BAD_RESPONSE,this,null,this.response):a}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:W.classes.FormData,Blob:W.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};h.forEach(["delete","get","head","post","put","patch"],n=>{Ge.headers[n]={}});const Ha=h.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ma=n=>{const e={};let t,s,r;return n&&n.split(`
|
|
3
3
|
`).forEach(function(o){r=o.indexOf(":"),t=o.substring(0,r).trim().toLowerCase(),s=o.substring(r+1).trim(),!(!t||e[t]&&Ha[t])&&(t==="set-cookie"?e[t]?e[t].push(s):e[t]=[s]:e[t]=e[t]?e[t]+", "+s:s)}),e},Zn=Symbol("internals");function Ne(n){return n&&String(n).trim().toLowerCase()}function ot(n){return n===!1||n==null?n:h.isArray(n)?n.map(ot):String(n)}function qa(n){const e=Object.create(null),t=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let s;for(;s=t.exec(n);)e[s[1]]=s[2];return e}const ja=n=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(n.trim());function Ft(n,e,t,s,r){if(h.isFunction(s))return s.call(this,e,t);if(r&&(e=t),!!h.isString(e)){if(h.isString(s))return e.indexOf(s)!==-1;if(h.isRegExp(s))return s.test(e)}}function Ga(n){return n.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(e,t,s)=>t.toUpperCase()+s)}function Ka(n,e){const t=h.toCamelCase(" "+e);["get","set","has"].forEach(s=>{Object.defineProperty(n,s+t,{value:function(r,i,o){return this[s].call(this,e,r,i,o)},configurable:!0})})}class M{constructor(e){e&&this.set(e)}set(e,t,s){const r=this;function i(a,l,c){const u=Ne(l);if(!u)throw new Error("header name must be a non-empty string");const d=h.findKey(r,u);(!d||r[d]===void 0||c===!0||c===void 0&&r[d]!==!1)&&(r[d||l]=ot(a))}const o=(a,l)=>h.forEach(a,(c,u)=>i(c,u,l));if(h.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(h.isString(e)&&(e=e.trim())&&!ja(e))o(Ma(e),t);else if(h.isHeaders(e))for(const[a,l]of e.entries())i(l,a,s);else e!=null&&i(t,e,s);return this}get(e,t){if(e=Ne(e),e){const s=h.findKey(this,e);if(s){const r=this[s];if(!t)return r;if(t===!0)return qa(r);if(h.isFunction(t))return t.call(this,r,s);if(h.isRegExp(t))return t.exec(r);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Ne(e),e){const s=h.findKey(this,e);return!!(s&&this[s]!==void 0&&(!t||Ft(this,this[s],s,t)))}return!1}delete(e,t){const s=this;let r=!1;function i(o){if(o=Ne(o),o){const a=h.findKey(s,o);a&&(!t||Ft(s,s[a],a,t))&&(delete s[a],r=!0)}}return h.isArray(e)?e.forEach(i):i(e),r}clear(e){const t=Object.keys(this);let s=t.length,r=!1;for(;s--;){const i=t[s];(!e||Ft(this,this[i],i,e,!0))&&(delete this[i],r=!0)}return r}normalize(e){const t=this,s={};return h.forEach(this,(r,i)=>{const o=h.findKey(s,i);if(o){t[o]=ot(r),delete t[i];return}const a=e?Ga(i):String(i).trim();a!==i&&delete t[i],t[a]=ot(r),s[a]=!0}),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return h.forEach(this,(s,r)=>{s!=null&&s!==!1&&(t[r]=e&&h.isArray(s)?s.join(", "):s)}),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([e,t])=>e+": "+t).join(`
|
|
4
4
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const s=new this(e);return t.forEach(r=>s.set(r)),s}static accessor(e){const s=(this[Zn]=this[Zn]={accessors:{}}).accessors,r=this.prototype;function i(o){const a=Ne(o);s[a]||(Ka(r,o),s[a]=!0)}return h.isArray(e)?e.forEach(i):i(e),this}}M.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);h.reduceDescriptors(M.prototype,({value:n},e)=>{let t=e[0].toUpperCase()+e.slice(1);return{get:()=>n,set(s){this[t]=s}}});h.freezeMethods(M);function Ht(n,e){const t=this||Ge,s=e||t,r=M.from(s.headers);let i=s.data;return h.forEach(n,function(a){i=a.call(t,i,r.normalize(),e?e.status:void 0)}),r.normalize(),i}function Xs(n){return!!(n&&n.__CANCEL__)}function Ue(n,e,t){b.call(this,n??"canceled",b.ERR_CANCELED,e,t),this.name="CanceledError"}h.inherits(Ue,b,{__CANCEL__:!0});function Qs(n,e,t){const s=t.config.validateStatus;!t.status||!s||s(t.status)?n(t):e(new b("Request failed with status code "+t.status,[b.ERR_BAD_REQUEST,b.ERR_BAD_RESPONSE][Math.floor(t.status/100)-4],t.config,t.request,t))}function Wa(n){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(n);return e&&e[1]||""}function Va(n,e){n=n||10;const t=new Array(n),s=new Array(n);let r=0,i=0,o;return e=e!==void 0?e:1e3,function(l){const c=Date.now(),u=s[i];o||(o=c),t[r]=l,s[r]=c;let d=i,_=0;for(;d!==r;)_+=t[d++],d=d%n;if(r=(r+1)%n,r===i&&(i=(i+1)%n),c-o<e)return;const g=u&&c-u;return g?Math.round(_*1e3/g):void 0}}function Ja(n,e){let t=0,s=1e3/e,r,i;const o=(c,u=Date.now())=>{t=u,r=null,i&&(clearTimeout(i),i=null),n.apply(null,c)};return[(...c)=>{const u=Date.now(),d=u-t;d>=s?o(c,u):(r=c,i||(i=setTimeout(()=>{i=null,o(r)},s-d)))},()=>r&&o(r)]}const pt=(n,e,t=3)=>{let s=0;const r=Va(50,250);return Ja(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-s,c=r(l),u=o<=a;s=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[e?"download":"upload"]:!0};n(d)},t)},Yn=(n,e)=>{const t=n!=null;return[s=>e[0]({lengthComputable:t,total:n,loaded:s}),e[1]]},es=n=>(...e)=>h.asap(()=>n(...e)),Xa=W.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let s;function r(i){let o=i;return e&&(t.setAttribute("href",o),o=t.href),t.setAttribute("href",o),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:t.pathname.charAt(0)==="/"?t.pathname:"/"+t.pathname}}return s=r(window.location.href),function(o){const a=h.isString(o)?r(o):o;return a.protocol===s.protocol&&a.host===s.host}}():function(){return function(){return!0}}(),Qa=W.hasStandardBrowserEnv?{write(n,e,t,s,r,i){const o=[n+"="+encodeURIComponent(e)];h.isNumber(t)&&o.push("expires="+new Date(t).toGMTString()),h.isString(s)&&o.push("path="+s),h.isString(r)&&o.push("domain="+r),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(n){const e=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(n){this.write(n,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Za(n){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(n)}function Ya(n,e){return e?n.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):n}function Zs(n,e){return n&&!Za(e)?Ya(n,e):e}const ts=n=>n instanceof M?{...n}:n;function pe(n,e){e=e||{};const t={};function s(c,u,d){return h.isPlainObject(c)&&h.isPlainObject(u)?h.merge.call({caseless:d},c,u):h.isPlainObject(u)?h.merge({},u):h.isArray(u)?u.slice():u}function r(c,u,d){if(h.isUndefined(u)){if(!h.isUndefined(c))return s(void 0,c,d)}else return s(c,u,d)}function i(c,u){if(!h.isUndefined(u))return s(void 0,u)}function o(c,u){if(h.isUndefined(u)){if(!h.isUndefined(c))return s(void 0,c)}else return s(void 0,u)}function a(c,u,d){if(d in e)return s(c,u);if(d in n)return s(void 0,c)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u)=>r(ts(c),ts(u),!0)};return h.forEach(Object.keys(Object.assign({},n,e)),function(u){const d=l[u]||r,_=d(n[u],e[u],u);h.isUndefined(_)&&d!==a||(t[u]=_)}),t}const Ys=n=>{const e=pe({},n);let{data:t,withXSRFToken:s,xsrfHeaderName:r,xsrfCookieName:i,headers:o,auth:a}=e;e.headers=o=M.from(o),e.url=Ws(Zs(e.baseURL,e.url),n.params,n.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):"")));let l;if(h.isFormData(t)){if(W.hasStandardBrowserEnv||W.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if((l=o.getContentType())!==!1){const[c,...u]=l?l.split(";").map(d=>d.trim()).filter(Boolean):[];o.setContentType([c||"multipart/form-data",...u].join("; "))}}if(W.hasStandardBrowserEnv&&(s&&h.isFunction(s)&&(s=s(e)),s||s!==!1&&Xa(e.url))){const c=r&&i&&Qa.read(i);c&&o.set(r,c)}return e},ec=typeof XMLHttpRequest<"u",tc=ec&&function(n){return new Promise(function(t,s){const r=Ys(n);let i=r.data;const o=M.from(r.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=r,u,d,_,g,p;function m(){g&&g(),p&&p(),r.cancelToken&&r.cancelToken.unsubscribe(u),r.signal&&r.signal.removeEventListener("abort",u)}let f=new XMLHttpRequest;f.open(r.method.toUpperCase(),r.url,!0),f.timeout=r.timeout;function T(){if(!f)return;const y=M.from("getAllResponseHeaders"in f&&f.getAllResponseHeaders()),k={data:!a||a==="text"||a==="json"?f.responseText:f.response,status:f.status,statusText:f.statusText,headers:y,config:n,request:f};Qs(function(D){t(D),m()},function(D){s(D),m()},k),f=null}"onloadend"in f?f.onloadend=T:f.onreadystatechange=function(){!f||f.readyState!==4||f.status===0&&!(f.responseURL&&f.responseURL.indexOf("file:")===0)||setTimeout(T)},f.onabort=function(){f&&(s(new b("Request aborted",b.ECONNABORTED,n,f)),f=null)},f.onerror=function(){s(new b("Network Error",b.ERR_NETWORK,n,f)),f=null},f.ontimeout=function(){let x=r.timeout?"timeout of "+r.timeout+"ms exceeded":"timeout exceeded";const k=r.transitional||Vs;r.timeoutErrorMessage&&(x=r.timeoutErrorMessage),s(new b(x,k.clarifyTimeoutError?b.ETIMEDOUT:b.ECONNABORTED,n,f)),f=null},i===void 0&&o.setContentType(null),"setRequestHeader"in f&&h.forEach(o.toJSON(),function(x,k){f.setRequestHeader(k,x)}),h.isUndefined(r.withCredentials)||(f.withCredentials=!!r.withCredentials),a&&a!=="json"&&(f.responseType=r.responseType),c&&([_,p]=pt(c,!0),f.addEventListener("progress",_)),l&&f.upload&&([d,g]=pt(l),f.upload.addEventListener("progress",d),f.upload.addEventListener("loadend",g)),(r.cancelToken||r.signal)&&(u=y=>{f&&(s(!y||y.type?new Ue(null,n,f):y),f.abort(),f=null)},r.cancelToken&&r.cancelToken.subscribe(u),r.signal&&(r.signal.aborted?u():r.signal.addEventListener("abort",u)));const E=Wa(r.url);if(E&&W.protocols.indexOf(E)===-1){s(new b("Unsupported protocol "+E+":",b.ERR_BAD_REQUEST,n));return}f.send(i||null)})},nc=(n,e)=>{let t=new AbortController,s;const r=function(l){if(!s){s=!0,o();const c=l instanceof Error?l:this.reason;t.abort(c instanceof b?c:new Ue(c instanceof Error?c.message:c))}};let i=e&&setTimeout(()=>{r(new b(`timeout ${e} of ms exceeded`,b.ETIMEDOUT))},e);const o=()=>{n&&(i&&clearTimeout(i),i=null,n.forEach(l=>{l&&(l.removeEventListener?l.removeEventListener("abort",r):l.unsubscribe(r))}),n=null)};n.forEach(l=>l&&l.addEventListener&&l.addEventListener("abort",r));const{signal:a}=t;return a.unsubscribe=o,[a,()=>{i&&clearTimeout(i),i=null}]},sc=function*(n,e){let t=n.byteLength;if(t<e){yield n;return}let s=0,r;for(;s<t;)r=s+e,yield n.slice(s,r),s=r},rc=async function*(n,e,t){for await(const s of n)yield*sc(ArrayBuffer.isView(s)?s:await t(String(s)),e)},ns=(n,e,t,s,r)=>{const i=rc(n,e,r);let o=0,a,l=c=>{a||(a=!0,s&&s(c))};return new ReadableStream({async pull(c){try{const{done:u,value:d}=await i.next();if(u){l(),c.close();return}let _=d.byteLength;if(t){let g=o+=_;t(g)}c.enqueue(new Uint8Array(d))}catch(u){throw l(u),u}},cancel(c){return l(c),i.return()}},{highWaterMark:2})},St=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",er=St&&typeof ReadableStream=="function",Wt=St&&(typeof TextEncoder=="function"?(n=>e=>n.encode(e))(new TextEncoder):async n=>new Uint8Array(await new Response(n).arrayBuffer())),tr=(n,...e)=>{try{return!!n(...e)}catch{return!1}},ic=er&&tr(()=>{let n=!1;const e=new Request(W.origin,{body:new ReadableStream,method:"POST",get duplex(){return n=!0,"half"}}).headers.has("Content-Type");return n&&!e}),ss=64*1024,Vt=er&&tr(()=>h.isReadableStream(new Response("").body)),_t={stream:Vt&&(n=>n.body)};St&&(n=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!_t[e]&&(_t[e]=h.isFunction(n[e])?t=>t[e]():(t,s)=>{throw new b(`Response type '${e}' is not supported`,b.ERR_NOT_SUPPORT,s)})})})(new Response);const oc=async n=>{if(n==null)return 0;if(h.isBlob(n))return n.size;if(h.isSpecCompliantForm(n))return(await new Request(n).arrayBuffer()).byteLength;if(h.isArrayBufferView(n)||h.isArrayBuffer(n))return n.byteLength;if(h.isURLSearchParams(n)&&(n=n+""),h.isString(n))return(await Wt(n)).byteLength},ac=async(n,e)=>{const t=h.toFiniteNumber(n.getContentLength());return t??oc(e)},cc=St&&(async n=>{let{url:e,method:t,data:s,signal:r,cancelToken:i,timeout:o,onDownloadProgress:a,onUploadProgress:l,responseType:c,headers:u,withCredentials:d="same-origin",fetchOptions:_}=Ys(n);c=c?(c+"").toLowerCase():"text";let[g,p]=r||i||o?nc([r,i],o):[],m,f;const T=()=>{!m&&setTimeout(()=>{g&&g.unsubscribe()}),m=!0};let E;try{if(l&&ic&&t!=="get"&&t!=="head"&&(E=await ac(u,s))!==0){let $=new Request(e,{method:"POST",body:s,duplex:"half"}),D;if(h.isFormData(s)&&(D=$.headers.get("content-type"))&&u.setContentType(D),$.body){const[q,F]=Yn(E,pt(es(l)));s=ns($.body,ss,q,F,Wt)}}h.isString(d)||(d=d?"include":"omit"),f=new Request(e,{..._,signal:g,method:t.toUpperCase(),headers:u.normalize().toJSON(),body:s,duplex:"half",credentials:d});let y=await fetch(f);const x=Vt&&(c==="stream"||c==="response");if(Vt&&(a||x)){const $={};["status","statusText","headers"].forEach(le=>{$[le]=y[le]});const D=h.toFiniteNumber(y.headers.get("content-length")),[q,F]=a&&Yn(D,pt(es(a),!0))||[];y=new Response(ns(y.body,ss,q,()=>{F&&F(),x&&T()},Wt),$)}c=c||"text";let k=await _t[h.findKey(_t,c)||"text"](y,n);return!x&&T(),p&&p(),await new Promise(($,D)=>{Qs($,D,{data:k,headers:M.from(y.headers),status:y.status,statusText:y.statusText,config:n,request:f})})}catch(y){throw T(),y&&y.name==="TypeError"&&/fetch/i.test(y.message)?Object.assign(new b("Network Error",b.ERR_NETWORK,n,f),{cause:y.cause||y}):b.from(y,y&&y.code,n,f)}}),Jt={http:Ea,xhr:tc,fetch:cc};h.forEach(Jt,(n,e)=>{if(n){try{Object.defineProperty(n,"name",{value:e})}catch{}Object.defineProperty(n,"adapterName",{value:e})}});const rs=n=>`- ${n}`,lc=n=>h.isFunction(n)||n===null||n===!1,nr={getAdapter:n=>{n=h.isArray(n)?n:[n];const{length:e}=n;let t,s;const r={};for(let i=0;i<e;i++){t=n[i];let o;if(s=t,!lc(t)&&(s=Jt[(o=String(t)).toLowerCase()],s===void 0))throw new b(`Unknown adapter '${o}'`);if(s)break;r[o||"#"+i]=s}if(!s){const i=Object.entries(r).map(([a,l])=>`adapter ${a} `+(l===!1?"is not supported by the environment":"is not available in the build"));let o=e?i.length>1?`since :
|
|
@@ -421,4 +421,4 @@ ${el}`,rl=`
|
|
|
421
421
|
}
|
|
422
422
|
}
|
|
423
423
|
`;function zt(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 Ti(n){if(zt(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 ve(n){if(zt(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 Te(n){return zt(n,["number","bigint","string"]),BigInt(n)}function Al(n,e,t){Dn(n,e,t)}function Dn(n,e,t,s){if(e instanceof ke)t.serializeBool(Ti(n));else if(e instanceof ce)t.serializeU8(ve(n));else if(e instanceof Ke)t.serializeU16(ve(n));else if(e instanceof We)t.serializeU32(ve(n));else if(e instanceof Ie)t.serializeU64(Te(n));else if(e instanceof Ce)t.serializeU128(Te(n));else if(e instanceof Ve)t.serializeU256(Te(n));else if(e instanceof _e)Ai(n,t);else if(e instanceof Je)Sl(n,e,t);else if(e instanceof ye)El(n,e,t);else throw new Error("Unsupported arg type.")}function Ai(n,e){let t;if(typeof n=="string"||n instanceof w)t=A.fromHex(n);else if(n instanceof A)t=n;else throw new Error("Invalid account address.");t.serialize(e)}function Sl(n,e,t,s){if(e.value instanceof ce){if(n instanceof Uint8Array){t.serializeBytes(n);return}if(n instanceof w){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(r=>Dn(r,e.value,t))}function El(n,e,t,s){const{address:r,module_name:i,name:o,type_args:a}=e.value,l=`${w.fromUint8Array(r.address).toShortString()}::${i.value}::${o.value}`;if(l==="0x1::string::String")zt(n,["string"]),t.serializeStr(n);else if(l==="0x1::object::Object")Ai(n,t);else if(l==="0x1::option::Option"){if(a.length!==1)throw new Error(`Option has the wrong number of type arguments ${a.length}`);xl(n,a[0],t)}else throw new Error("Unsupported struct type in function argument")}function xl(n,e,t,s){n==null?t.serializeU32AsUleb128(0):(t.serializeU32AsUleb128(1),Dn(n,e,t))}function Ul(n,e){if(e instanceof ke)return new Ln(Ti(n));if(e instanceof ce)return new kn(ve(n));if(e instanceof Ke)return new In(ve(n));if(e instanceof We)return new Cn(ve(n));if(e instanceof Ie)return new On(Te(n));if(e instanceof Ce)return new zn(Te(n));if(e instanceof Ve)return new Rn(Te(n));if(e instanceof _e){let t;if(typeof n=="string"||n instanceof w)t=A.fromHex(n);else if(n instanceof A)t=n;else throw new Error("Invalid account address.");return new Nn(t)}if(e instanceof Je&&e.value instanceof ce){if(!(n instanceof Uint8Array))throw new Error(`${n} should be an instance of Uint8Array`);return new Pn(n)}throw new Error("Unknown type for TransactionArgument.")}var Bl="APTOS::RawTransaction",fs="APTOS::RawTransactionWithData",Me=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=Ee.create();if(n instanceof ze)e.update(Bl);else if(n instanceof Sn)e.update(fs);else if(n instanceof En)e.update(fs);else throw new Error("Unknown transaction type.");const t=e.digest(),s=Y(n),r=new Uint8Array(t.length+s.length);return r.set(t),r.set(s,t.length),r}},qt=class extends Me{constructor(n,e,t){super(n,t),this.publicKey=e}rawToSigned(n){const e=Me.getSigningMessage(n),t=this.signingFunction(e),s=new wn(new K(this.publicKey),t);return new kt(n,s)}sign(n){return Y(this.rawToSigned(n))}},kl=class extends Me{constructor(n,e){super(n),this.publicKey=e}rawToSigned(n){const e=Me.getSigningMessage(n),t=this.signingFunction(e),s=new bn(this.publicKey,t);return new kt(n,s)}sign(n){return Y(this.rawToSigned(n))}},Il=class on{constructor(e,t){this.abiMap=new Map,e.forEach(s=>{const r=new gn(s),i=Ot.deserialize(r);let o;if(i instanceof He){const a=i,{address:l,name:c}=a.module_name;o=`${w.fromUint8Array(l.address).toShortString()}::${c.value}::${a.name}`}else o=i.name;if(this.abiMap.has(o))throw new Error("Found conflicting ABI interfaces");this.abiMap.set(o,i)}),this.builderConfig={maxGasAmount:BigInt(ar),expSecFromNow:cr,...t}}static toBCSArgs(e,t){if(e.length!==t.length)throw new Error("Wrong number of args provided.");return t.map((s,r)=>{const i=new B;return Al(s,e[r].type_tag,i),i.getBytes()})}static toTransactionArguments(e,t){if(e.length!==t.length)throw new Error("Wrong number of args provided.");return t.map((s,r)=>Ul(s,e[r].type_tag))}setSequenceNumber(e){this.builderConfig.sequenceNumber=BigInt(e)}buildTransactionPayload(e,t,s){const r=t.map(a=>new Xe(a).parseTypeTag());let i;if(!this.abiMap.has(e))throw new Error(`Cannot find function: ${e}`);const o=this.abiMap.get(e);if(o instanceof He){const a=o,l=on.toBCSArgs(a.args,s);i=new Un(new Bt(a.module_name,new P(a.name),r,l))}else if(o instanceof $n){const a=o,l=on.toTransactionArguments(a.args,s);i=new xn(new Tn(a.code,r,l))}else throw new Error("Unknown ABI format.");return i}build(e,t,s){const{sender:r,sequenceNumber:i,gasUnitPrice:o,maxGasAmount:a,expSecFromNow:l,chainId:c}=this.builderConfig;if(!o)throw new Error("No gasUnitPrice provided.");const u=r instanceof A?r:A.fromHex(r),d=BigInt(Math.floor(Date.now()/1e3)+Number(l)),_=this.buildTransactionPayload(e,t,s);if(_)return new ze(u,BigInt(i),_,BigInt(a),BigInt(o),d,new Bn(Number(c)));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(r=>r.abi).flatMap(r=>r.exposed_functions.filter(i=>i.is_entry).map(i=>({fullName:`${r.address}::${r.name}::${i.name}`,...i}))),s=new Map;return t.forEach(r=>{s.set(r.fullName,r)}),s}async build(n,e,t){if(n=(y=>y.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[i,o]=n.split("::"),a=await this.fetchABI(i);if(!a.has(n))throw new Error(`${n} doesn't exist.`);const l=a.get(n),u=l.params.filter(y=>y!=="signer"&&y!=="&signer").map((y,x)=>new Ct(`var${x}`,new Xe(y,e).parseTypeTag())),d=new He(l.name,Fe.fromStr(`${i}::${o}`),"",l.generic_type_params.map((y,x)=>new It(`${x}`)),u),{sender:_,...g}=this.builderConfig,p=_ instanceof A?w.fromUint8Array(_.address):_,[{sequence_number:m},f,{gas_estimate:T}]=await Promise.all([g!=null&&g.sequenceNumber?Promise.resolve({sequence_number:g==null?void 0:g.sequenceNumber}):this.aptosClient.getAccount(p),g!=null&&g.chainId?Promise.resolve(g==null?void 0:g.chainId):this.aptosClient.getChainId(),g!=null&&g.gasUnitPrice?Promise.resolve({gas_estimate:g==null?void 0:g.gasUnitPrice}):this.aptosClient.estimateGasPrice()]);return new Il([Y(d)],{sender:_,sequenceNumber:m,chainId:f,gasUnitPrice:BigInt(T),...g}).build(n,e,t)}};S([lr(10*60*1e3)],Rt.prototype,"fetchABI");var I=class be{constructor(e,t,s=!1){if(!e)throw new Error("Node URL cannot be empty.");s?this.nodeUrl=e:this.nodeUrl=Ec(e),this.config=t==null?{}:{...t}}async getAccount(e){const{data:t}=await H({url:this.nodeUrl,endpoint:`accounts/${w.ensure(e).hex()}`,originMethod:"getAccount",overrides:{...this.config}});return t}async getAccountTransactions(e,t){const{data:s}=await H({url:this.nodeUrl,endpoint:`accounts/${w.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 ls({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:r}=await H({url:this.nodeUrl,endpoint:`accounts/${w.ensure(e).hex()}/module/${t}`,originMethod:"getAccountModule",params:{ledger_version:s==null?void 0:s.ledgerVersion},overrides:{...this.config}});return r}async getAccountResources(e,t){return await ls({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:r}=await H({url:this.nodeUrl,endpoint:`accounts/${w.ensure(e).hex()}/resource/${t}`,originMethod:"getAccountResource",params:{ledger_version:s==null?void 0:s.ledgerVersion},overrides:{...this.config}});return r}static generateBCSTransaction(e,t){return new qt(r=>{const i=e.signBuffer(r);return new U.Ed25519Signature(i.toUint8Array())},e.pubKey().toUint8Array()).sign(t)}static generateBCSSimulation(e,t){return new qt(r=>{const i=new Uint8Array(64);return new U.Ed25519Signature(i)},e.pubKey().toUint8Array()).sign(t)}async generateTransaction(e,t,s){const r={sender:e};if(s!=null&&s.sequence_number&&(r.sequenceNumber=s.sequence_number),s!=null&&s.gas_unit_price&&(r.gasUnitPrice=s.gas_unit_price),s!=null&&s.max_gas_amount&&(r.maxGasAmount=s.max_gas_amount),s!=null&&s.expiration_timestamp_secs){const o=Number.parseInt(s.expiration_timestamp_secs,10);r.expSecFromNow=o-Math.floor(Date.now()/1e3)}return new Rt(this,r).build(t.function,t.type_arguments,t.arguments)}async generateFeePayerTransaction(e,t,s,r=[],i){const o=await this.generateTransaction(e,t,i),a=r.map(c=>A.fromHex(c));return new U.FeePayerRawTransaction(o,a,A.fromHex(s))}async submitFeePayerTransaction(e,t,s,r=[]){const i=new U.TransactionAuthenticatorFeePayer(t,e.secondary_signer_addresses,r,{address:e.fee_payer_address,authenticator:s}),o=Y(new U.SignedTransaction(e.raw_txn,i));return await this.submitSignedBCSTransaction(o)}async signMultiTransaction(e,t){const s=new U.Ed25519Signature(e.signBuffer(Me.getSigningMessage(t)).toUint8Array()),r=new U.AccountAuthenticatorEd25519(new U.Ed25519PublicKey(e.signingKey.publicKey),s);return Promise.resolve(r)}async signTransaction(e,t){return Promise.resolve(be.generateBCSTransaction(e,t))}async getEventsByCreationNumber(e,t,s){const{data:r}=await H({url:this.nodeUrl,endpoint:`accounts/${w.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 r}async getEventsByEventHandle(e,t,s,r){const{data:i}=await H({url:this.nodeUrl,endpoint:`accounts/${w.ensure(e).hex()}/events/${t}/${s}`,originMethod:"getEventsByEventHandle",params:{start:r==null?void 0:r.start,limit:r==null?void 0:r.limit},overrides:{...this.config}});return i}async submitTransaction(e){return this.submitSignedBCSTransaction(e)}async simulateTransaction(e,t,s){let r;return e instanceof gt?r=be.generateBCSSimulation(e,t):e instanceof Ut?r=new kl(()=>{const{threshold:o}=e,a=[],l=[];for(let u=0;u<o;u+=1)a.push(u),l.push(new U.Ed25519Signature(new Uint8Array(64)));const c=U.MultiEd25519Signature.createBitmap(a);return new U.MultiEd25519Signature(l,c)},e).sign(t):r=new qt(()=>{const o=new Uint8Array(64);return new U.Ed25519Signature(o)},e.toBytes()).sign(t),this.submitBCSSimulation(r,s)}async submitSignedBCSTransaction(e){const{data:t}=await Pe({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,r,i;const o={estimate_gas_unit_price:(s=t==null?void 0:t.estimateGasUnitPrice)!=null?s:!1,estimate_max_gas_amount:(r=t==null?void 0:t.estimateMaxGasAmount)!=null?r:!1,estimate_prioritized_gas_unit_price:(i=t==null?void 0:t.estimatePrioritizedGasUnitPrice)!=null?i:!1},{data:a}=await Pe({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 H({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 H({url:this.nodeUrl,endpoint:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash",overrides:{...this.config}});return t}async getTransactionByVersion(e){const{data:t}=await H({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,r;const i=(s=t==null?void 0:t.timeoutSecs)!=null?s:xc,o=(r=t==null?void 0:t.checkSuccess)!=null?r:!1;let a=!0,l=0,c;for(;a&&!(l>=i);){try{if(c=await this.getTransactionByHash(e),a=c.type==="pending_transaction",!a)break}catch(u){const d=u instanceof Fn,_=d&&u.status!==404&&u.status>=400&&u.status<500;if(!d||_)throw u}await Sc(1e3),l+=1}if(c===void 0)throw new Error(`Waiting for transaction ${e} failed`);if(a)throw new Cl(`Waiting for transaction ${e} timed out after ${i} seconds`,c);if(!o)return c;if(!(c!=null&&c.success))throw new Ol(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async waitForTransaction(e,t){await this.waitForTransactionWithResult(e,t)}async getLedgerInfo(){const{data:e}=await H({url:this.nodeUrl,originMethod:"getLedgerInfo",overrides:{...this.config}});return e}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getTableItem(e,t,s){var r;return(await Pe({url:this.nodeUrl,body:t,endpoint:`tables/${e}/item`,originMethod:"getTableItem",params:{ledger_version:(r=s==null?void 0:s.ledgerVersion)==null?void 0:r.toString()},overrides:{...this.config}})).data}async generateRawTransaction(e,t,s){const[{sequence_number:r},i,{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:l,expireTimestamp:c}={maxGasAmount:BigInt(ar),gasUnitPrice:BigInt(o),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+cr),...s};return new U.RawTransaction(U.AccountAddress.fromHex(e),BigInt(r),t,a,l,c,new U.ChainId(i))}async generateSignSubmitTransaction(e,t,s){const r=await this.generateRawTransaction(e.address(),t,s),i=be.generateBCSTransaction(e,r);return(await this.submitSignedBCSTransaction(i)).hash}async signAndSubmitTransaction(e,t){const s=be.generateBCSTransaction(e,t);return(await this.submitSignedBCSTransaction(s)).hash}async publishPackage(e,t,s,r){const i=new B;R(s,i);const o=new U.TransactionPayloadEntryFunction(U.EntryFunction.natural("0x1::code","publish_package_txn",[],[ie(t),i.getBytes()]));return this.generateSignSubmitTransaction(e,o,r)}async createResourceAccountAndPublishPackage(e,t,s,r,i){const o=new B;R(r,o);const a=new U.TransactionPayloadEntryFunction(U.EntryFunction.natural("0x1::resource_account","create_resource_account_and_publish_package",[],[ie(t),ie(s),o.getBytes()]));return this.generateSignSubmitTransaction(e,a,i)}async generateSignSubmitWaitForTransaction(e,t,s){const r=await this.generateSignSubmitTransaction(e,t,s);return this.waitForTransactionWithResult(r,s)}async estimateGasPrice(){const{data:e}=await H({url:this.nodeUrl,endpoint:"estimate_gas_price",originMethod:"estimateGasPrice",overrides:{...this.config}});return e}async estimateMaxGasAmount(e){const t=`0x1::coin::CoinStore<${Zt}>`,[{gas_estimate:s},r]=await Promise.all([this.estimateGasPrice(),this.getAccountResources(e)]),i=r.find(a=>a.type===t);return BigInt(i.data.coin.value)/BigInt(s)}async rotateAuthKeyEd25519(e,t,s){const{sequence_number:r,authentication_key:i}=await this.getAccount(e.address()),o=new gt(t),a=new U.RotationProofChallenge(U.AccountAddress.CORE_CODE_ADDRESS,"account","RotationProofChallenge",BigInt(r),U.AccountAddress.fromHex(e.address()),new U.AccountAddress(new w(i).toUint8Array()),o.pubKey().toUint8Array()),l=w.fromUint8Array(Y(a)),c=e.signHexString(l),u=o.signHexString(l),d=new U.TransactionPayloadEntryFunction(U.EntryFunction.natural("0x1::account","rotate_authentication_key",[],[en(0),ie(e.pubKey().toUint8Array()),en(0),ie(o.pubKey().toUint8Array()),ie(c.toUint8Array()),ie(u.toUint8Array())])),_=await this.generateRawTransaction(e.address(),d,s),g=be.generateBCSTransaction(e,_);return this.submitSignedBCSTransaction(g)}async lookupOriginalAddress(e){const t=await this.getAccountResource("0x1","0x1::account::OriginatingAddress"),{address_map:{handle:s}}=t.data,r=await this.getTableItem(s,{key_type:"address",value_type:"address",key:w.ensure(e).hex()});return new w(r)}async getBlockByHeight(e,t){const{data:s}=await H({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 H({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 Pe({url:this.nodeUrl,body:e,endpoint:"view",originMethod:"getTableItem",params:{ledger_version:t},overrides:{...this.config}});return s}clearCache(e){Uc(e)}};S([z],I.prototype,"getAccount");S([z],I.prototype,"getAccountTransactions");S([z,lr(10*60*1e3)],I.prototype,"getAccountModules");S([z],I.prototype,"getAccountModule");S([z],I.prototype,"getAccountResources");S([z],I.prototype,"getAccountResource");S([z],I.prototype,"getEventsByCreationNumber");S([z],I.prototype,"getEventsByEventHandle");S([z],I.prototype,"submitSignedBCSTransaction");S([z],I.prototype,"submitBCSSimulation");S([z],I.prototype,"getTransactions");S([z],I.prototype,"getTransactionByHash");S([z],I.prototype,"getTransactionByVersion");S([z],I.prototype,"getLedgerInfo");S([xt()],I.prototype,"getChainId");S([z],I.prototype,"getTableItem");S([z,xt({ttlMs:5*60*1e3,tags:["gas_estimates"]})],I.prototype,"estimateGasPrice");S([z],I.prototype,"estimateMaxGasAmount");S([z],I.prototype,"getBlockByHeight");S([z],I.prototype,"getBlockByVersion");S([z],I.prototype,"view");var Nt=I,Cl=class extends Error{constructor(n,e){super(n),this.lastSubmittedTransaction=e}},Ol=class extends Error{constructor(n,e){super(n),this.transaction=e}},Fn=class extends Error{constructor(n,e,t,s){super(e),this.status=n,this.message=e,this.errorCode=t,this.vmErrorCode=s}};function z(n,e,t){const s=t.value;return t.value=async function(...i){var o,a;try{return await s.apply(this,[...i])}catch(l){throw l instanceof ur?new Fn(l.status,JSON.stringify({message:l.message,...l.data}),(o=l.data)==null?void 0:o.error_code,(a=l.data)==null?void 0:a.vm_error_code):l}},t}var Si=class C{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 Pe({url:this.endpoint,body:e,overrides:{WITH_CREDENTIALS:!1,...this.config}});if(t.data.errors)throw new Fn(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:dl};return this.queryIndexer(e)}async getAccountNFTs(e,t){const s=w.ensure(e).hex();C.validateAddress(s);const r={query:sl,variables:{address:s,offset:t==null?void 0:t.offset,limit:t==null?void 0:t.limit}};return this.queryIndexer(r)}async getTokenActivities(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const o={token_data_id:{_eq:i}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:_l,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTokenActivitiesCount(e){const t={query:yl,variables:{token_id:e}};return this.queryIndexer(t)}async getAccountTokensCount(e,t){var s,r;const i={owner_address:{_eq:e},amount:{_gt:"0"}};t!=null&&t.tokenStandard&&(i.token_standard={_eq:t==null?void 0:t.tokenStandard});const o=w.ensure(e).hex();C.validateAddress(o);const a={query:rl,variables:{where_condition:i,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit}};return this.queryIndexer(a)}async getTokenData(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const o={token_data_id:{_eq:i}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:ml,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTokenOwnersData(e,t,s){var r,i;const o=w.ensure(e).hex();C.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 l={query:bl,variables:{where_condition:a,offset:(r=s==null?void 0:s.options)==null?void 0:r.offset,limit:(i=s==null?void 0:s.options)==null?void 0:i.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(l)}async getTokenCurrentOwnerData(e,t,s){var r,i;const o=w.ensure(e).hex();C.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 l={query:gl,variables:{where_condition:a,offset:(r=s==null?void 0:s.options)==null?void 0:r.offset,limit:(i=s==null?void 0:s.options)==null?void 0:i.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(l)}async getOwnedTokens(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const o={owner_address:{_eq:i},amount:{_gt:0}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:fl,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getOwnedTokensByTokenData(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const o={token_data_id:{_eq:i},amount:{_gt:0}};t!=null&&t.tokenStandard&&(o.token_standard={_eq:t==null?void 0:t.tokenStandard});const a={query:pl,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTokenOwnedFromCollectionAddress(e,t,s){var r,i;const o=w.ensure(e).hex();C.validateAddress(o);const a=w.ensure(t).hex();C.validateAddress(a);const l={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};s!=null&&s.tokenStandard&&(l.token_standard={_eq:s==null?void 0:s.tokenStandard});const c={query:wl,variables:{where_condition:l,offset:(r=s==null?void 0:s.options)==null?void 0:r.offset,limit:(i=s==null?void 0:s.options)==null?void 0:i.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(c)}async getTokenOwnedFromCollectionNameAndCreatorAddress(e,t,s,r){const i=await this.getCollectionAddress(s,t,r);return await this.getTokenOwnedFromCollectionAddress(e,i,r)}async getCollectionData(e,t,s){var r,i;const o=w.ensure(e).hex();C.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 l={query:al,variables:{where_condition:a,offset:(r=s==null?void 0:s.options)==null?void 0:r.offset,limit:(i=s==null?void 0:s.options)==null?void 0:i.limit,order_by:s==null?void 0:s.orderBy}};return this.queryIndexer(l)}async getCollectionAddress(e,t,s){return(await this.getCollectionData(e,t,s)).current_collections_v2[0].collection_id}async getCollectionsWithOwnedTokens(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const o={owner_address:{_eq:i}};t!=null&&t.tokenStandard&&(o.current_collection={token_standard:{_eq:t==null?void 0:t.tokenStandard}});const a={query:cl,variables:{where_condition:o,offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getAccountTransactionsCount(e){const t=w.ensure(e).hex();C.validateAddress(t);const s={query:il,variables:{address:t}};return this.queryIndexer(s)}async getAccountTransactionsData(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const a={query:ol,variables:{where_condition:{account_address:{_eq:i}},offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getTopUserTransactions(e){const t={query:vl,variables:{limit:e}};return this.queryIndexer(t)}async getUserTransactions(e){var t,s;const r={version:{_lte:e==null?void 0:e.startVersion}},i={query:Tl,variables:{where_condition:r,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(i)}async getDelegatedStakingActivities(e,t){const s=w.ensure(e).hex(),r=w.ensure(t).hex();C.validateAddress(s),C.validateAddress(r);const i={query:ul,variables:{delegatorAddress:s,poolAddress:r}};return this.queryIndexer(i)}async getNumberOfDelegators(e){const t=w.ensure(e).hex();C.validateAddress(t);const s={query:hl,variables:{poolAddress:t}};return this.queryIndexer(s)}async getAccountCoinsData(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const a={query:nl,variables:{where_condition:{owner_address:{_eq:i}},offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}async getAccountCoinsDataCount(e){const t=w.ensure(e).hex();C.validateAddress(t);const s={query:tl,variables:{address:t}};return this.queryIndexer(s)}async getAccountOwnedObjects(e,t){var s,r;const i=w.ensure(e).hex();C.validateAddress(i);const a={query:ll,variables:{where_condition:{owner_address:{_eq:i}},offset:(s=t==null?void 0:t.options)==null?void 0:s.offset,limit:(r=t==null?void 0:t.options)==null?void 0:r.limit,order_by:t==null?void 0:t.orderBy}};return this.queryIndexer(a)}},mt=class{constructor(n,e,t=!1){let s=null,r=null;if(typeof n=="object"&&zl(n)?(s=n.fullnodeUrl,r=n.indexerUrl,this.network="CUSTOM"):(s=Ic[n],r=Yt[n],this.network=n),this.network==="CUSTOM"&&!s)throw new Error("fullnode url is not provided");r&&(this.indexerClient=new Si(r,e)),this.aptosClient=new Nt(s,e,t)}};function Ei(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(s=>{const r=Object.getOwnPropertyDescriptor(e.prototype,s);r&&(r.value=function(...i){return this[t][s](...i)},Object.defineProperty(n.prototype,s,r))}),Object.getOwnPropertyNames(e).forEach(s=>{const r=Object.getOwnPropertyDescriptor(e,s);r&&(r.value=function(...i){return this[t][s](...i)},!n.hasOwnProperty.call(n,s)&&Object.defineProperty(n,s,r))})}Ei(mt,Nt,"aptosClient");Ei(mt,Si,"indexerClient");function zl(n){return n.fullnodeUrl!==void 0&&typeof n.fullnodeUrl=="string"}var xi=class{constructor(n,e){this.type=n,this.value=e}},Ui=class{constructor(){this.data={}}setProperty(n,e){this.data[n]=e}};function Rl(n){let e;return n==="string"||n==="String"?e=new ye(vn):e=new Xe(n).parseTypeTag(),e}function Bi(n){const e=n.map.data,t=new Ui;return e.forEach(s=>{const{key:r}=s,i=s.value.value,o=s.value.type,a=Rl(o),l=Nl(a,i),c=new xi(o,l);t.setProperty(r,c)}),t}function Nl(n,e){const t=new gn(new w(e).toUint8Array());let s="";return n instanceof ce?s=t.deserializeU8().toString():n instanceof Ie?s=t.deserializeU64().toString():n instanceof Ce?s=t.deserializeU128().toString():n instanceof ke?s=t.deserializeBool()?"true":"false":n instanceof _e?s=w.fromUint8Array(t.deserializeFixedBytes(32)).hex():n instanceof ye&&n.isStringTypeTag()?s=t.deserializeStr():s=e,s}var Pl={};Et(Pl,{PropertyMap:()=>Ui,PropertyValue:()=>xi,Token:()=>$l,TokenData:()=>Ll});var Ll=class{constructor(n,e,t,s,r,i,o,a){this.collection=n,this.description=e,this.name=t,this.maximum=s,this.supply=r,this.uri=i,this.default_properties=Bi(o),this.mutability_config=a}},$l=class{constructor(n,e,t){this.id=n,this.amount=e,this.token_properties=Bi(t)}},ps=class{constructor(n){this.assetType="0x1::fungible_asset::Metadata",this.provider=n}async transfer(n,e,t,s,r){const i=await this.generateTransfer(n,e,t,s,r);return await this.provider.signAndSubmitTransaction(n,i)}async getPrimaryBalance(n,e){const t={function:"0x1::primary_fungible_store::balance",type_arguments:[this.assetType],arguments:[w.ensure(n).hex(),w.ensure(e).hex()]},s=await this.provider.view(t);return BigInt(s[0])}async generateTransfer(n,e,t,s,r){return await new Rt(this.provider,{sender:n.address(),...r}).build("0x1::primary_fungible_store::transfer",[this.assetType],[w.ensure(e).hex(),w.ensure(t).hex(),s])}},_s="0x1::aptos_account::transfer_coins",Dl="0x1::coin::transfer",Fl=class{constructor(n){this.aptosClient=n}async transfer(n,e,t,s){var r,i,o;const a=((r=s==null?void 0:s.coinType)!=null?r:"").toString().includes("::");if(s!=null&&s.coinType&&!a&&A.isValid(s.coinType)){console.warn("to transfer a fungible asset, use `FungibleAssetClient()` class for better support");const m=new mt({fullnodeUrl:this.aptosClient.nodeUrl,indexerUrl:(i=Yt[us[this.aptosClient.nodeUrl]])!=null?i:this.aptosClient.nodeUrl});return await new ps(m).transfer(n,s==null?void 0:s.coinType,st(e),t)}const l=(o=s==null?void 0:s.coinType)!=null?o:Zt;let c;(s==null?void 0:s.createReceiverIfMissing)===void 0?c=_s:c=s!=null&&s.createReceiverIfMissing?_s:Dl;const u=st(e),_=await new Rt(this.aptosClient,{sender:n.address(),...s}).build(c,[l],[u,t]),g=Nt.generateBCSTransaction(n,_);return(await this.aptosClient.submitSignedBCSTransaction(g)).hash}async checkBalance(n,e){var t,s,r;const i=((t=e==null?void 0:e.coinType)!=null?t:"").toString().includes("::");if(e!=null&&e.coinType&&!i&&A.isValid(e.coinType)){console.warn("to check balance of a fungible asset, use `FungibleAssetClient()` class for better support");const u=new mt({fullnodeUrl:this.aptosClient.nodeUrl,indexerUrl:(s=Yt[us[this.aptosClient.nodeUrl]])!=null?s:this.aptosClient.nodeUrl});return await new ps(u).getPrimaryBalance(st(n),e==null?void 0:e.coinType)}const a=`0x1::coin::CoinStore<${(r=e==null?void 0:e.coinType)!=null?r:Zt}>`,l=st(n),c=await this.aptosClient.getAccountResource(l,a);return BigInt(c.data.coin.value)}},Hl={};Et(Hl,{AptosErrorCode:()=>ki,MoveFunctionVisibility:()=>Ii,RoleType:()=>Ci});var ki=(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))(ki||{}),Ii=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(Ii||{}),Ci=(n=>(n.VALIDATOR="validator",n.FULL_NODE="full_node",n))(Ci||{});class Oi extends Pi{}const ue=class ue extends Li{constructor(e,t){super(e,t??$i(e,ue._platform))}getRpc(e){if(e in this.config)return new Nt(this.config[e].rpc);throw new Error("No configuration available for chain: "+e)}getChain(e,t){if(e in this.config)return new Oi(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 Di.tokenId(t,Mn)}static isNativeTokenId(e,t,s){return!this.isSupportedChain(t)||s.chain!==t?!1:this.nativeTokenId(e,t)==s}static isSupportedChain(e){return Fi(e)===ue._platform}static async getDecimals(e,t,s){if($t(s))return Hi(ue._platform);const r=s.toString(),i=`0x1::coin::CoinInfo<${r}>`;return(await t.getAccountResource(r.split(Mi)[0],i)).data.decimals}static async getBalance(e,t,s,r){const i=$t(r)?Mn:r.toString(),o=new Fl(t);try{return await o.checkBalance(s,{coinType:i})}catch(a){if(a.errorCode==="resource_not_found"&&a.status===404)return null;throw a}}static async getBalances(e,t,s,r){return(await Promise.all(r.map(async o=>{const a=await this.getBalance(e,t,s,o);return{[$t(o)?"native":new gs(o).toString()]:a}}))).reduce((o,a)=>Object.assign(o,a),{})}static async sendWait(e,t,s){const r=[];for(const i of s){const o=await t.submitTransaction(i),a=await t.waitForTransactionWithResult(o.hash);r.push(a.hash)}return r}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=qi(ue._platform,BigInt(e));if(!t)throw new Error(`No matching chainId to determine network and chain: ${e}`);const[s,r]=t;return[s,r]}static async chainFromRpc(e){const s=await e.getChainId();return this.chainFromChainId(s.toString())}};me(ue,"_platform",ys);let qe=ue;async function Ml(n,e){const[t,s]=await qe.chainFromRpc(n);return new ql(s,new gt(ji.decode(e)),n)}class ql{constructor(e,t,s,r){me(this,"_chain");me(this,"_account");me(this,"_rpc");me(this,"_debug");this._chain=e,this._account=t,this._rpc=s,this._debug=r}chain(){return this._chain}address(){return this._account.address().hex()}async signAndSend(e){const t=[];for(const s of e){const{description:r,transaction:i}=s;this._debug&&console.log(`Signing: ${r} 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(),i,o),{hash:l}=await this._simSignSend(a);t.push(l)}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}
|
|
424
|
-
${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 jl={Address:gs,Platform:qe,getSigner:Ml,protocols:{WormholeCore:()=>qn(()=>import("./index-
|
|
424
|
+
${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 jl={Address:gs,Platform:qe,getSigner:Ml,protocols:{WormholeCore:()=>qn(()=>import("./index-BY0kgWx8.js"),__vite__mapDeps([0,1,2])),TokenBridge:()=>qn(()=>import("./index-BEc0YFBn.js"),__vite__mapDeps([3,1,2]))},getChain:(n,e,t)=>new Oi(e,new qe(n,Gi(n,ys,{[e]:t})))},Wl=Object.freeze(Object.defineProperty({__proto__:null,default:jl},Symbol.toStringTag,{value:"Module"}));export{qe as A,Wl as a};
|
|
@@ -1 +1 @@
|
|
|
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-BxXdWj24.js";import"../main.js";import"./index-C3Sky6pw.js";class x extends l{constructor({callbackSelector:e,cause:a,data:n,extraData:c,sender:d,urls:r}){var i;super(a.shortMessage||"An error occurred while fetching for an offchain result.",{cause:a,metaMessages:[...a.metaMessages||[],(i=a.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",r&&[" Gateway URL(s):",...r.map(u=>` ${w(u)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${e}`,` Extra data: ${c}`].flat()}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupError"})}}class M extends l{constructor({result:e,url:a}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(a)}`,`Response: ${y(e)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupResponseMalformedError"})}}class R extends l{constructor({sender:e,to:a}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${a}`,`OffchainLookup sender address: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"OffchainLookupSenderMismatchError"})}}function $(o,e){if(!p(o))throw new h({address:o});if(!p(e))throw new h({address:e});return o.toLowerCase()===e.toLowerCase()}const j="0x556f1830",S={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 D(o,{blockNumber:e,blockTag:a,data:n,to:c}){const{args:d}=g({data:n,abi:[S]}),[r,i,u,t,s]=d;try{if(!$(c,r))throw new R({sender:r,to:c});const f=await A({data:u,sender:r,urls:i}),{data:b}=await k(o,{blockNumber:e,blockTag:a,data:O([t,L([{type:"bytes"},{type:"bytes"}],[f,s])]),to:c});return b}catch(f){throw new x({callbackSelector:t,cause:f,data:n,extraData:s,sender:r,urls:i})}}async function A({data:o,sender:e,urls:a}){var c;let n=new Error("An unknown error occurred.");for(let d=0;d<a.length;d++){const r=a[d],i=r.includes("{data}")?"GET":"POST",u=i==="POST"?{data:o,sender:e}:void 0;try{const t=await fetch(r.replace("{sender}",e).replace("{data}",o),{body:JSON.stringify(u),method:i});let s;if((c=t.headers.get("Content-Type"))!=null&&c.startsWith("application/json")?s=(await t.json()).data:s=await t.text(),!t.ok){n=new m({body:u,details:s!=null&&s.error?y(s.error):t.statusText,headers:t.headers,status:t.status,url:r});continue}if(!E(s)){n=new M({result:s,url:r});continue}return s}catch(t){n=new m({body:u,details:t.message,url:r})}}throw n}export{A as ccipFetch,D as offchainLookup,S as offchainLookupAbiItem,j as offchainLookupSignature};
|