@dcl/account-site 6.8.0 → 6.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/Address-BHGD07NO.js +1 -0
- package/assets/Authorization-DmoiysGx.js +1 -0
- package/assets/CoinbaseSDKConnection-C9-JnGls.js +1 -0
- package/assets/{ConstantsUtil-Dl5WOfjM.js → ConstantsUtil-g0AjdkOa.js} +1 -1
- package/assets/{ExchangeController-JD5-aj9j.js → ExchangeController-C-OE-irq.js} +1 -1
- package/assets/{HelpersUtil-BYRqEOLc.js → HelpersUtil-C073QcrZ.js} +1 -1
- package/assets/InAppWalletConnectUI-Bdxz0Bmy.js +1 -0
- package/assets/{NetworkUtil-CORVq-U7.js → NetworkUtil-BooKnyFI.js} +1 -1
- package/assets/{QRCodeRenderer-CAUMCMrQ.js → QRCodeRenderer-C2O8aJw5.js} +1 -1
- package/assets/Solidity-D6b-SCK0.js +1 -0
- package/assets/{SwapController-CENGi_f8.js → SwapController-DITN3ZmR.js} +1 -1
- package/assets/ThirdwebWalletManager-BUJ2S4b0.js +298 -0
- package/assets/TypedData-ByTQ7nLR.js +2 -0
- package/assets/addresses-DVWfx5EX.js +1 -0
- package/assets/arweave-CldmCeKB.js +1 -0
- package/assets/{biconomy-DURQhrK6.js → biconomy-C7JeDEA3.js} +1 -1
- package/assets/biconomy-C9hDxeVn.js +1 -0
- package/assets/{ccip-CzLewx-i.js → ccip-BtKXNXL8.js} +1 -1
- package/assets/{ccip-DGvrteB6.js → ccip-ByfH6Pp1.js} +1 -1
- package/assets/ccip-sd4F7RdI.js +1 -0
- package/assets/{chains-ClhAINLn.js → chains-ClhzAPRM.js} +1 -1
- package/assets/{common-BaZ48mbG.js → common-5Sx2Oaqw.js} +1 -1
- package/assets/common-DAlzQshe.js +1 -0
- package/assets/concat-hex-D_Hd0Y8j.js +1 -0
- package/assets/{controller-CgHGY4fa.js → controller-BKewv9ws.js} +2 -2
- package/assets/controller-CMiTdXrl.js +2 -0
- package/assets/{data-capture-C3H4h0ye.js → data-capture-SGXWH8uV.js} +1 -1
- package/assets/decimals-BkxTCZnw.js +1 -0
- package/assets/{decimals-wNlF21S5.js → decimals-DYCSb7r6.js} +1 -1
- package/assets/decimals-Den2KPun.js +1 -0
- package/assets/{detectExtension-ywrU3B9f.js → detectExtension-BqT-gQP6.js} +1 -1
- package/assets/detectExtension-DRxhZaJ-.js +1 -0
- package/assets/{email-EtC4Qw7k.js → email-D9PJu66O.js} +1 -1
- package/assets/{embedded-wallet-BLxx2nq0.js → embedded-wallet-BNJE9JJY.js} +1 -1
- package/assets/{engine-CbOuNdui.js → engine-BpIYDc2z.js} +1 -1
- package/assets/engine-CmO-qFS1.js +1 -0
- package/assets/estimate-l1-fee-DnqX0KQm.js +2 -0
- package/assets/{estimate-l1-fee-COxQ74Xh.js → estimate-l1-fee-n2GS47w0.js} +1 -1
- package/assets/eth_estimateGas-DVJqp0a0.js +1 -0
- package/assets/eth_estimateGas-ZIidgCSn.js +1 -0
- package/assets/{eth_getStorageAt-CLxjZO4t.js → eth_getStorageAt-DMscVfg3.js} +1 -1
- package/assets/eth_getTransactionCount-CMQovf3i.js +1 -0
- package/assets/{eth_getTransactionCount-BKcuSAaU.js → eth_getTransactionCount-h82D3bxu.js} +1 -1
- package/assets/{ethereum-D98w8ceQ.js → ethereum-Db4wQ8cQ.js} +1 -1
- package/assets/{extractIPFS-Bwmi3T5d.js → extractIPFS-446jiCiR.js} +1 -1
- package/assets/extractIPFS-tOg-rRc-.js +1 -0
- package/assets/{features-BqZGfYIj.js → features-Bya_uQnq.js} +1 -1
- package/assets/{fetchTokenMetadata-BrBgEOsH.js → fetchTokenMetadata-B1jhcJrg.js} +2 -2
- package/assets/fetchTokenMetadata-DXhdZ9jJ.js +2 -0
- package/assets/{fortmatic-Rdz9ucwd.js → fortmatic-DWc9CMNy.js} +1 -1
- package/assets/get-bytecode-FPC_G1PK.js +1 -0
- package/assets/get-ecosystem-wallet-info-BH812YkU.js +1 -0
- package/assets/{get-ecosystem-wallet-info-DfHMq1Kz.js → get-ecosystem-wallet-info-CsVSXoZ9.js} +1 -1
- package/assets/{getBalance-ZH0H3K3Z.js → getBalance-BJu93LMj.js} +2 -2
- package/assets/getBalance-BjubRO2E.js +1 -0
- package/assets/getCurrencyMetadata-B6uMlDub.js +2 -0
- package/assets/{getInstalledModules-DRhOlDcR.js → getInstalledModules-C_LJpz_7.js} +1 -1
- package/assets/getInstalledModules-cmepPgT8.js +1 -0
- package/assets/getNFT-BLT_Nrf_.js +2 -0
- package/assets/{getNFT-GNDwObaN.js → getNFT-Cf6D_49D.js} +1 -1
- package/assets/{getNFT-D6wHZRiB.js → getNFT-ClRsQ9zy.js} +2 -2
- package/assets/getNFT-uyJP8nm4.js +1 -0
- package/assets/{hashTypedData-41394cRH.js → hashTypedData-CLob9Zsk.js} +1 -1
- package/assets/{if-defined-DwiGupeI.js → if-defined-BfXFCfhz.js} +1 -1
- package/assets/in-app-wallet-calls-C0n9HjId.js +1 -0
- package/assets/{in-app-wallet-calls-CPU2uJ6f.js → in-app-wallet-calls-DUqkYMt1.js} +1 -1
- package/assets/index-1chDcRmP.js +2 -0
- package/assets/{index-CawWU9rF.js → index-4aItPLLW.js} +1 -1
- package/assets/{index-BEFVLZMS.js → index-9x3mVUYQ.js} +1 -1
- package/assets/{index-BR8a5etK.js → index-ACY2zvow.js} +1 -1
- package/assets/index-B1VBbtk9.js +1 -0
- package/assets/index-B4kmUY0d.js +2 -0
- package/assets/{index-Fv-acDXO.js → index-B6-Xobl2.js} +79 -78
- package/assets/{index-DIBbErfW.js → index-BGg37GBj.js} +1 -1
- package/assets/{index-C5zfi_7H.js → index-BQsaEzy7.js} +1 -1
- package/assets/{index-BOh2weBI.js → index-BRxU5H7H.js} +1 -1
- package/assets/{index-8zzhpxyI.js → index-BSP467IN.js} +1 -1
- package/assets/{index-DYQDZBEQ.js → index-BXifexJq.js} +1 -1
- package/assets/{index-phZWvHfL.js → index-Bi3OUhfd.js} +1 -1
- package/assets/{index-LZKkcZAZ.js → index-BkdqENWn.js} +1 -1
- package/assets/{index-BUjD0aLT.js → index-Bqkhbf-j.js} +1 -1
- package/assets/{index-CAfWDhIh.js → index-BrNT2tPP.js} +1 -1
- package/assets/index-BuLBr4CJ.js +3 -0
- package/assets/index-CBfD9fG_.js +3 -0
- package/assets/{index-Cm5owbs6.js → index-CCxvZC9z.js} +1 -1
- package/assets/{index-dE7qT1rS.js → index-CCzw3eWF.js} +1 -1
- package/assets/{index-BYXYehKA.js → index-CFnBXD-E.js} +2 -2
- package/assets/{index-Bi4I_eXH.js → index-CFy1Eegq.js} +1 -1
- package/assets/{index-vbDUNbAe.js → index-CGT2TfpK.js} +1 -1
- package/assets/{index-DjP1lSeJ.js → index-CLLWxWw1.js} +1 -1
- package/assets/{index-BjsRGW04.js → index-CMAF5KQo.js} +1 -1
- package/assets/{index-DDz_fX9F.js → index-CRXo5c7W.js} +1 -1
- package/assets/{index-C8LVWiNY.js → index-CXPEr8lr.js} +1 -1
- package/assets/{index-C79cRihP.js → index-C_CWRNXS.js} +1 -1
- package/assets/{index-B2fn3xIB.js → index-Ci26p999.js} +1 -1
- package/assets/{index-BkDiaE7t.js → index-Cja4UOCF.js} +1 -1
- package/assets/{index-C8qQNWbc.js → index-CpXrWP2a.js} +1 -1
- package/assets/{index-CgxIIYSr.js → index-Cv59_Dqg.js} +1 -1
- package/assets/{index-BbTsvCPk.js → index-CwOCLTiY.js} +1 -1
- package/assets/{index-C52TTugH.js → index-CxlJ-ZjW.js} +1 -1
- package/assets/{index-CJe1v77g.js → index-D-By2c9G.js} +1 -1
- package/assets/{index-CSiyIFnr.js → index-D0Jyo-s4.js} +1 -1
- package/assets/{index-mD5QWGsm.css → index-D2E7Umr3.css} +3 -3
- package/assets/{index-DLargbIn.js → index-DAGLKstf.js} +2 -2
- package/assets/{index-CSOxc5sc.js → index-DMZH80fA.js} +4 -4
- package/assets/index-DO01SzHY.js +4 -0
- package/assets/{index-DaWq4Nzj.js → index-DPWaLJzM.js} +1 -1
- package/assets/{index-DL0Eu5uz.js → index-DQt5rtxO.js} +1 -1
- package/assets/{index-jGki-zKe.js → index-DSqN93eC.js} +1 -1
- package/assets/{index-DjWVQGcv.js → index-DcZ1OZua.js} +1 -1
- package/assets/{index-BWZPtavh.js → index-DdD6BFNW.js} +1 -1
- package/assets/{index-8Zxz62OX.js → index-DftmpJ8E.js} +2 -2
- package/assets/{index-ZEPn8qKc.js → index-DuB7aae8.js} +1 -1
- package/assets/{index-rAbloVh4.js → index-TpT45Yhr.js} +4 -4
- package/assets/{index-B8gDkzKR.js → index-yvAPBrdI.js} +1 -1
- package/assets/index.es-BdGfQ9jz.js +29 -0
- package/assets/{index.es-BdRu1h__.js → index.es-CN4hhQIr.js} +1 -1
- package/assets/index.es-Cjo6uLeK.js +1 -0
- package/assets/{index.es-pnQCY6-7.js → index.es-LxVxXtUw.js} +1 -1
- package/assets/is-smart-wallet-kSShE3hl.js +1 -0
- package/assets/{native-CjSUDNml.js → native-CXizm-TO.js} +1 -1
- package/assets/{networks-B6IlNWMm.js → networks-DyswiDcL.js} +1 -1
- package/assets/oauth-CbK0gPlt.js +1 -0
- package/assets/{onramp-BTk7sVPr.js → onramp-phO3GqLV.js} +1 -1
- package/assets/{openzeppelin-BKxO6pj6.js → openzeppelin-CASw4uSB.js} +1 -1
- package/assets/openzeppelin-Dkk77Xr9.js +1 -0
- package/assets/ownerOf-Dn5Rvewb.js +1 -0
- package/assets/{ownerOf-CYvZRT99.js → ownerOf-HLFmP4SY.js} +1 -1
- package/assets/parse-typed-data-BSOEUDy_.js +1 -0
- package/assets/{parseNft-DhQFzpJp.js → parseNft-CwiONVVV.js} +2 -2
- package/assets/{parseSignature-DoNNAGxu.js → parseSignature-BsYIWxqL.js} +13 -13
- package/assets/{parseSignature-BduqmbK2.js → parseSignature-DXMGd6Bf.js} +3 -3
- package/assets/passkeys-tlSlZIRR.js +1 -0
- package/assets/{pay-with-exchange-CgOu6Uya.js → pay-with-exchange-BsYgDiHf.js} +1 -1
- package/assets/{qr-overlay-Bm0XTjkI.js → qr-overlay-B21EcFCK.js} +1 -1
- package/assets/{qr-overlay-DyMiJXUk.js → qr-overlay-CDVJkAma.js} +1 -1
- package/assets/read-contract-D8CQ_i-D.js +1 -0
- package/assets/{receive-r5RgRUWl.js → receive-CVGDvas8.js} +1 -1
- package/assets/{ref-Ki-jDMmv.js → ref-DeR4tBmt.js} +1 -1
- package/assets/resolveImplementation-2abc0dxK.js +1 -0
- package/assets/{resolveImplementation-B8tKI-wG.js → resolveImplementation-Cr9HN7sF.js} +1 -1
- package/assets/{rpc-nyXL61KJ.js → rpc-BuDu_uQE.js} +1 -1
- package/assets/{rpc-rFcFDQyb.js → rpc-DjXtIps7.js} +2 -2
- package/assets/secp256k1-BlHNYIaG.js +1 -0
- package/assets/{secp256k1-CPRDF0BA.js → secp256k1-CJ52XpcF.js} +1 -1
- package/assets/{send-DeIfSZo1.js → send-DP5QRJYD.js} +1 -1
- package/assets/send-batch-transaction-De71luzT.js +1 -0
- package/assets/{send-batch-transaction-CIuDJ271.js → send-batch-transaction-Dx0kM3Nk.js} +1 -1
- package/assets/{send-eip712-transaction-CknhU72d.js → send-eip712-transaction-Dm4F9s4t.js} +2 -2
- package/assets/send-eip712-transaction-q3anVEgs.js +2 -0
- package/assets/send-gasless-transaction-CQa_Dj1Y.js +2 -0
- package/assets/{send-gasless-transaction-yIAhbb7k.js → send-gasless-transaction-mWAyMAXy.js} +2 -2
- package/assets/send-transaction-B0F9brDJ.js +2 -0
- package/assets/{session-proposal-qDW11rpc.js → session-proposal-FRNsvDTi.js} +1 -1
- package/assets/session-proposal-ef7aaaHV.js +1 -0
- package/assets/session-request-Bz2BIU-j.js +2 -0
- package/assets/{session-request-By9y-Ayi.js → session-request-Cwmcu41B.js} +2 -2
- package/assets/sha256-BPZogG9w.js +1 -0
- package/assets/{sha256-_sKanFR7.js → sha256-DViOA4V5.js} +1 -1
- package/assets/{signing-Db0bjZpz.js → signing-D7Nlzpwh.js} +5 -5
- package/assets/signing-DhfHxzxy.js +2 -0
- package/assets/sleep-B_ShGKZF.js +1 -0
- package/assets/{socials-BcoSkWK5.js → socials-BZcwTEhb.js} +1 -1
- package/assets/{swaps-Bj8TNJkd.js → swaps-Cam24Ey2.js} +1 -1
- package/assets/switch-chain-YGyDlbyD.js +1 -0
- package/assets/thirdweb-B7gLwLri.js +27 -0
- package/assets/to-serializable-transaction-DAYFWHyO.js +23 -0
- package/assets/{totalSupply-CcNS_GzH.js → totalSupply-BZIagNGM.js} +1 -1
- package/assets/totalSupply-CWYDbbpl.js +1 -0
- package/assets/{transactionReceipt-CdsZdsdr.js → transactionReceipt-B-BG4ub0.js} +1 -1
- package/assets/{transactions-DuCMsSn_.js → transactions-CSAp5P5s.js} +1 -1
- package/assets/types-DFEAKZ3L.js +4 -0
- package/assets/utils-BtpzmIxp.js +2 -0
- package/assets/{utils-mHMkg6Kp.js → utils-Onbz2awt.js} +1 -1
- package/assets/{verifyHash-CboNxe2B.js → verifyHash-Bx9bP5KA.js} +3 -3
- package/assets/{w3m-modal-Cv35RGiT.js → w3m-modal-C63bxWaq.js} +1 -1
- package/assets/wait-for-tx-receipt-CuLnfaKm.js +1 -0
- package/assets/{wait-for-tx-receipt-Drv8Lr1P.js → wait-for-tx-receipt-DhBzWdPW.js} +1 -1
- package/assets/{wallets-GwhGT1dM.js → wallets-SiIK_4eu.js} +6 -6
- package/assets/{web-connector-bxGgXqpW.js → web-connector-BnZ6I9U8.js} +3 -3
- package/assets/web-connector-DJrJBk0_.js +2 -0
- package/assets/{zora-sepolia-Cm6nfoBw.js → zora-sepolia-5TL5obss.js} +1 -1
- package/index.html +2 -2
- package/package.json +3 -3
- package/assets/CoinbaseSDKConnection-BKJdrNl1.js +0 -1
- package/assets/InAppWalletConnectUI-BCpqJr7x.js +0 -1
- package/assets/ThirdwebWalletManager-C0WgXnZx.js +0 -326
- package/assets/biconomy-dnUC9FHi.js +0 -1
- package/assets/ccip-gHbZ_fY7.js +0 -1
- package/assets/common-DXGQjmn7.js +0 -1
- package/assets/concat-hex-BkDmxQZp.js +0 -1
- package/assets/controller-XOXJb_Xj.js +0 -2
- package/assets/decimals-Bk-qoHwa.js +0 -1
- package/assets/detectExtension-BeXqHbY8.js +0 -1
- package/assets/engine-BZxfKBvb.js +0 -1
- package/assets/estimate-l1-fee-CpxowJdJ.js +0 -2
- package/assets/eth_estimateGas-BI87Z6lb.js +0 -1
- package/assets/eth_estimateGas-D6jt3ABx.js +0 -1
- package/assets/eth_getTransactionCount-DX2PE6Uh.js +0 -1
- package/assets/extractIPFS-LV30uJp-.js +0 -1
- package/assets/fetchTokenMetadata-D7KlTBZU.js +0 -2
- package/assets/get-ecosystem-wallet-info-BpGtHQgI.js +0 -1
- package/assets/getBalance-B2S2mDBX.js +0 -1
- package/assets/getCurrencyMetadata-DO1CX_p4.js +0 -2
- package/assets/getInstalledModules-DQWxNwhQ.js +0 -1
- package/assets/getNFT-BS49C2kr.js +0 -1
- package/assets/getNFT-CW_k-N6S.js +0 -2
- package/assets/in-app-wallet-calls-C-2B-t-w.js +0 -1
- package/assets/index-BDODUKme.js +0 -1
- package/assets/index-BKKV2746.js +0 -3
- package/assets/index-C1yUcBr3.js +0 -2
- package/assets/index-DJX4jI7z.js +0 -2
- package/assets/index-DKiQCady.js +0 -3
- package/assets/index.es-DkH7OFeN.js +0 -29
- package/assets/index.es-anFcjT3-.js +0 -1
- package/assets/openzeppelin-C8E5DMGT.js +0 -1
- package/assets/ownerOf-CLN-nhw1.js +0 -1
- package/assets/resolveImplementation-YurP5AVa.js +0 -1
- package/assets/secp256k1-CLk510R-.js +0 -1
- package/assets/send-batch-transaction-BRauQRcY.js +0 -1
- package/assets/send-eip712-transaction-CJ8IBHyz.js +0 -2
- package/assets/send-gasless-transaction-Ds_GyVDO.js +0 -2
- package/assets/session-proposal-BOjuBppp.js +0 -1
- package/assets/session-request-BltijLOZ.js +0 -2
- package/assets/sha256-uQaZGirP.js +0 -1
- package/assets/signing-GXncBciP.js +0 -2
- package/assets/switch-chain-DXxIqQkk.js +0 -1
- package/assets/thirdweb-COhbCMEp.js +0 -27
- package/assets/totalSupply-ur_EDW6t.js +0 -1
- package/assets/web-connector-B0B4AGqG.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{e as u}from"./utils-BtpzmIxp.js";import{concatHex as V}from"./concat-hex-D_Hd0Y8j.js";import{readContract as C}from"./read-contract-D8CQ_i-D.js";import{e as w}from"./to-serializable-transaction-DAYFWHyO.js";import{i as A}from"./is-smart-wallet-kSShE3hl.js";import{U as h,V as P,W as T,M as _,R as S}from"./index-B6-Xobl2.js";import{k as c}from"./types-DFEAKZ3L.js";import{e as H,v as U,h as $}from"./TypedData-ByTQ7nLR.js";import{p as E}from"./index-B4kmUY0d.js";import"./get-bytecode-FPC_G1PK.js";import"./Address-BHGD07NO.js";import"./Solidity-D6b-SCK0.js";import"./index-DO01SzHY.js";import"./addresses-DVWfx5EX.js";import"./send-eip712-transaction-q3anVEgs.js";import"./eth_sendRawTransaction-DPdnXbFR.js";import"./sha256-BPZogG9w.js";import"./send-transaction-B0F9brDJ.js";import"./parse-typed-data-BSOEUDy_.js";const F="0x1626ba7e",O=[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],L=[{type:"bytes4"}];async function B(t){return C({contract:t.contract,method:[F,O,L],params:[t.hash,t.signature]})}const N="0x6492649264926492649264926492649264926492649264926492649264926492";function v({address:t,data:n,signature:e}){return V([u([{type:"address"},{type:"bytes"},{type:"bytes"}],[t,n,e]),N])}const k="0x1626ba7e";async function b({hash:t,signature:n,contract:e}){try{return await B({contract:e,hash:t,signature:n})===k}catch(r){return console.error("Error verifying EIP-1271 signature",r),!1}}const R=`Ethereum Signed Message:
|
|
2
|
+
`;function G(t,n){const e=typeof t=="string"?h(t):t.raw instanceof Uint8Array?t.raw:P(t.raw),r=h(`${R}${e.length}`);return c(T(r,e),n)}function j(t){const{domain:n={},message:e,primaryType:r}=t,a={EIP712Domain:H(n),...t.types};U({domain:n,message:e,primaryType:r,types:a});const s=["0x1901"];if(n&&s.push($({domain:n,types:a})),r!=="EIP712Domain"){const i=(()=>{const o=x({data:e,primaryType:r,types:a});return c(o)})();s.push(i)}return c(T(...s.map(i=>_(i))))}function x({data:t,primaryType:n,types:e}){const r=[{type:"bytes32"}],a=[z({primaryType:n,types:e})];if(!e[n])throw new Error("Invalid types");for(const s of e[n]){const[i,o]=M({name:s.name,type:s.type,types:e,value:t[s.name]});r.push(i),a.push(o)}return u(r,a)}function z({primaryType:t,types:n}){const e=S(W({primaryType:t,types:n}));return c(e)}function W({primaryType:t,types:n}){let e="";const r=D({primaryType:t,types:n});r.delete(t);const a=[t,...Array.from(r).sort()];for(const s of a){if(!n[s])throw new Error("Invalid types");e+=`${s}(${n[s].map(({name:i,type:o})=>`${o} ${i}`).join(",")})`}return e}function D({primaryType:t,types:n},e=new Set){const r=t.match(/^\w*/u),a=r==null?void 0:r[0];if(e.has(a)||n[a]===void 0)return e;e.add(a);for(const s of n[a])D({primaryType:s.type,types:n},e);return e}function M({types:t,name:n,type:e,value:r}){if(t[e]!==void 0)return[{type:"bytes32"},c(x({data:r,primaryType:e,types:t}))];if(e==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},c(r)];if(e==="string")return[{type:"bytes32"},c(S(r))];if(e.lastIndexOf("]")===e.length-1){const a=e.slice(0,e.lastIndexOf("[")),s=r.map(i=>M({name:n,type:a,types:t,value:i}));return[{type:"bytes32"},c(u(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:e},r]}async function fe({accountContract:t,factoryContract:n,options:e,message:r}){var f,p;const a=G(r);let s;const i=u([{type:"bytes32"}],[a]);if(s=await e.personalAccount.signTypedData({domain:{chainId:e.chain.id,name:"Account",verifyingContract:t.address,version:"1"},message:{message:i},primaryType:"AccountMessage",types:{AccountMessage:[{name:"message",type:"bytes"}]}}),await A(t)){if(await b({contract:t,hash:a,signature:s}))return s;throw new Error("Failed to verify signature")}else{const d=E({accountSalt:(f=e.overrides)==null?void 0:f.accountSalt,adminAddress:e.personalAccount.address,createAccountOverride:(p=e.overrides)==null?void 0:p.createAccount,factoryContract:n});if(!d)throw new Error("Create account override not provided");const y=await w(d);return v({address:n.address,data:y,signature:s})}}async function me({accountContract:t,factoryContract:n,options:e,typedData:r}){var p,d,y,m,l;if(((d=(p=r.domain)==null?void 0:p.verifyingContract)==null?void 0:d.toLowerCase())===((y=t.address)==null?void 0:y.toLowerCase()))return e.personalAccount.signTypedData(r);const s=j(r);let i;const o=u([{type:"bytes32"}],[s]);if(i=await e.personalAccount.signTypedData({domain:{chainId:e.chain.id,name:"Account",verifyingContract:t.address,version:"1"},message:{message:o},primaryType:"AccountMessage",types:{AccountMessage:[{name:"message",type:"bytes"}]}}),await A(t)){if(await b({contract:t,hash:s,signature:i}))return i;throw new Error("Failed to verify signature")}else{const g=E({accountSalt:(m=e.overrides)==null?void 0:m.accountSalt,adminAddress:e.personalAccount.address,createAccountOverride:(l=e.overrides)==null?void 0:l.createAccount,factoryContract:n});if(!g)throw new Error("Create account override not provided");const I=await w(g);return v({address:n.address,data:I,signature:i})}}export{fe as smartAccountSignMessage,me as smartAccountSignTypedData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(e){return new Promise(s=>setTimeout(s,e))}export{t as s};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as O,l as _,y as S,O as h,L as W,R as f,d as T,m as c,a as C,P as F,u as D,C as d,o as P,E as u,G as A,S as v,Q as N,M as R,T as x}from"./index-
|
|
1
|
+
import{j as O,l as _,y as S,O as h,L as W,R as f,d as T,m as c,a as C,P as F,u as D,C as d,o as P,E as u,G as A,S as v,Q as N,M as R,T as x}from"./index-TpT45Yhr.js";import{n as j,r as l,c as I}from"./index-yvAPBrdI.js";import{o as $}from"./if-defined-BfXFCfhz.js";import{O as U}from"./index-C_CWRNXS.js";import{e as M}from"./index-BGg37GBj.js";import"./index-CRXo5c7W.js";import"./index-Cv59_Dqg.js";import{C as q}from"./ConstantsUtil-g0AjdkOa.js";import"./index-CCxvZC9z.js";import"./index-ACY2zvow.js";import"./index-CwOCLTiY.js";import"./index-B6-Xobl2.js";import"./NetworkUtil-BooKnyFI.js";import"./hmac-Bk4Z90TB.js";import"./index.es-BdGfQ9jz.js";import"./index.es-LxVxXtUw.js";import"./ref-DeR4tBmt.js";import"./index-BQsaEzy7.js";import"./index-DcZ1OZua.js";import"./browser-DvQJ0ksv.js";const z=O`
|
|
2
2
|
:host {
|
|
3
3
|
margin-top: ${({spacing:t})=>t[1]};
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{j as A,l as D,C as $,N as h,m as u,d as V,E as N,R as S,a as M,M as K,q as F,W as Q,r as W,k as q}from"./index-
|
|
1
|
+
import{j as A,l as D,C as $,N as h,m as u,d as V,E as N,R as S,a as M,M as K,q as F,W as Q,r as W,k as q}from"./index-TpT45Yhr.js";import{r as l,n as w,c as C}from"./index-yvAPBrdI.js";import"./index-CCxvZC9z.js";import"./index-CRXo5c7W.js";import{M as _}from"./index-BXifexJq.js";import"./index-CGT2TfpK.js";import{S as s}from"./SwapController-DITN3ZmR.js";import"./index-CwOCLTiY.js";import"./index-DdD6BFNW.js";import"./index-D0Jyo-s4.js";import"./index-DcZ1OZua.js";import"./index-B6-Xobl2.js";import"./NetworkUtil-BooKnyFI.js";import"./hmac-Bk4Z90TB.js";import"./index.es-BdGfQ9jz.js";import"./index.es-LxVxXtUw.js";import"./index-BQsaEzy7.js";import"./if-defined-BfXFCfhz.js";import"./ref-DeR4tBmt.js";const H={numericInputKeyDown(e,t,o){const i=["Backspace","Meta","Ctrl","a","A","c","C","x","X","v","V","ArrowLeft","ArrowRight","Tab"],r=e.metaKey||e.ctrlKey,n=e.key,a=n.toLocaleLowerCase(),c=a==="a",b=a==="c",I=a==="v",U=a==="x",L=n===",",R=n===".",B=n>="0"&&n<="9";!r&&(c||b||I||U)&&e.preventDefault(),t==="0"&&!L&&!R&&n==="0"&&e.preventDefault(),t==="0"&&B&&(o(n),e.preventDefault()),(L||R)&&(t||(o("0."),e.preventDefault()),(t!=null&&t.includes(".")||t!=null&&t.includes(","))&&e.preventDefault()),!B&&!i.includes(n)&&!R&&!L&&e.preventDefault()}},G=A`
|
|
2
2
|
:host {
|
|
3
3
|
width: 100%;
|
|
4
4
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{h,m as e}from"./index-B6-Xobl2.js";async function c(t){var n;const{wallet:a,params:i}=t;return((n=a.getChain())==null?void 0:n.id)===h(i[0].chainId)||await a.switchChain(e(h(i[0].chainId))),"0x1"}export{c as handleSwitchChain};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-Onbz2awt.js","assets/index-B6-Xobl2.js","assets/index-D2E7Umr3.css","assets/common-5Sx2Oaqw.js","assets/signing-D7Nlzpwh.js","assets/index-CFnBXD-E.js","assets/parseSignature-DXMGd6Bf.js","assets/transactionReceipt-B-BG4ub0.js","assets/rpc-BuDu_uQE.js","assets/sha256-DViOA4V5.js","assets/hashTypedData-CLob9Zsk.js","assets/ccip-BtKXNXL8.js","assets/parseNft-CwiONVVV.js","assets/totalSupply-BZIagNGM.js","assets/detectExtension-BqT-gQP6.js","assets/estimate-l1-fee-n2GS47w0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{e as v,c as T,d as ee,w as St,L as Ct,h as Pt,a as Y,f as $t}from"./utils-Onbz2awt.js";import{j as A,i as xe,o as ie,ar as Ot,as as Ue,u as Le,at as Me,C as Z,V as qe,t as Fe,x as j,w as re,g as U,b as X,au as Dt,n as F,av as zt,m as Ie,aw as Ce,ax as he,ay as We,az as Ve,aA as Ze,af as Rt,aB as He,aC as Ae,aD as me,aE as Ke,aF as Je,aG as $,aa as q,aH as Bt,aI as Ge,d as Nt,aJ as jt,aK as xt,aL as Ut,aM as Lt,aN as Mt,aO as qt,Z as Pe,aP as Ft,aQ as Wt,aR as Vt,aS as Zt,aT as Ht,W as Kt,aU as Jt,aV as Gt,v as Qt,aW as Yt,ab as Xt,aX as en,r as tn,s as nn,aY as rn,ac as on,ad as sn,aZ as an,a_ as cn,a$ as dn,b0 as un,b1 as ln,Y as fn,b2 as hn,b3 as mn,h as pn,b4 as gn,a as yn,ao as wn,b5 as _n,k as bn,b6 as kn,S as In,b7 as An,b8 as Tn,q as vn,b9 as En}from"./signing-D7Nlzpwh.js";import{_ as k}from"./index-B6-Xobl2.js";import{a as Qe,b as Ye,e as Sn,w as Cn}from"./wait-for-tx-receipt-DhBzWdPW.js";import{eth_estimateGas as Pn}from"./eth_estimateGas-ZIidgCSn.js";import{a as Xe}from"./transactionReceipt-B-BG4ub0.js";import{e as $n}from"./eth_getStorageAt-DMscVfg3.js";import{eth_getTransactionCount as On}from"./eth_getTransactionCount-h82D3bxu.js";import{decimals as pe}from"./decimals-Den2KPun.js";import{b as Dn,a as zn,o as Rn,c as Bn,z as Nn,d as jn}from"./zora-sepolia-5TL5obss.js";import{a as xn,s as Un}from"./send-batch-transaction-Dx0kM3Nk.js";const Ln={bodySerializer:e=>JSON.stringify(e,(t,n)=>typeof n=="bigint"?n.toString():n)},Mn=async(e,t)=>{const n=typeof t=="function"?await t(e):t;if(n)return e.scheme==="bearer"?`Bearer ${n}`:e.scheme==="basic"?`Basic ${btoa(n)}`:n},qn=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},Fn=e=>{switch(e){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},Wn=e=>{switch(e){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},et=({allowReserved:e,explode:t,name:n,style:r,value:o})=>{if(!t){const a=(e?o:o.map(c=>encodeURIComponent(c))).join(Fn(r));switch(r){case"label":return`.${a}`;case"matrix":return`;${n}=${a}`;case"simple":return a;default:return`${n}=${a}`}}const s=qn(r),i=o.map(a=>r==="label"||r==="simple"?e?a:encodeURIComponent(a):ae({allowReserved:e,name:n,value:a})).join(s);return r==="label"||r==="matrix"?s+i:i},ae=({allowReserved:e,name:t,value:n})=>{if(n==null)return"";if(typeof n=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${t}=${e?n:encodeURIComponent(n)}`},tt=({allowReserved:e,explode:t,name:n,style:r,value:o,valueOnly:s})=>{if(o instanceof Date)return s?o.toISOString():`${n}=${o.toISOString()}`;if(r!=="deepObject"&&!t){let c=[];Object.entries(o).forEach(([p,f])=>{c=[...c,p,e?f:encodeURIComponent(f)]});const d=c.join(",");switch(r){case"form":return`${n}=${d}`;case"label":return`.${d}`;case"matrix":return`;${n}=${d}`;default:return d}}const i=Wn(r),a=Object.entries(o).map(([c,d])=>ae({allowReserved:e,name:r==="deepObject"?`${n}[${c}]`:c,value:d})).join(i);return r==="label"||r==="matrix"?i+a:a},Vn=/\{[^{}]+\}/g,Zn=({path:e,url:t})=>{let n=t;const r=t.match(Vn);if(r)for(const o of r){let s=!1,i=o.substring(1,o.length-1),a="simple";i.endsWith("*")&&(s=!0,i=i.substring(0,i.length-1)),i.startsWith(".")?(i=i.substring(1),a="label"):i.startsWith(";")&&(i=i.substring(1),a="matrix");const c=e[i];if(c==null)continue;if(Array.isArray(c)){n=n.replace(o,et({explode:s,name:i,style:a,value:c}));continue}if(typeof c=="object"){n=n.replace(o,tt({explode:s,name:i,style:a,value:c,valueOnly:!0}));continue}if(a==="matrix"){n=n.replace(o,`;${ae({name:i,value:c})}`);continue}const d=encodeURIComponent(a==="label"?`.${c}`:c);n=n.replace(o,d)}return n},nt=({allowReserved:e,array:t,object:n}={})=>o=>{const s=[];if(o&&typeof o=="object")for(const i in o){const a=o[i];if(a!=null)if(Array.isArray(a)){const c=et({allowReserved:e,explode:!0,name:i,style:"form",value:a,...t});c&&s.push(c)}else if(typeof a=="object"){const c=tt({allowReserved:e,explode:!0,name:i,style:"deepObject",value:a,...n});c&&s.push(c)}else{const c=ae({allowReserved:e,name:i,value:a});c&&s.push(c)}}return s.join("&")},Hn=e=>{var n;if(!e)return"stream";const t=(n=e.split(";")[0])==null?void 0:n.trim();if(t){if(t.startsWith("application/json")||t.endsWith("+json"))return"json";if(t==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(r=>t.startsWith(r)))return"blob";if(t.startsWith("text/"))return"text"}},Kn=async({security:e,...t})=>{for(const n of e){const r=await Mn(n,t.auth);if(!r)continue;const o=n.name??"Authorization";switch(n.in){case"query":t.query||(t.query={}),t.query[o]=r;break;case"cookie":t.headers.append("Cookie",`${o}=${r}`);break;case"header":default:t.headers.set(o,r);break}return}},$e=e=>Jn({baseUrl:e.baseUrl,path:e.path,query:e.query,querySerializer:typeof e.querySerializer=="function"?e.querySerializer:nt(e.querySerializer),url:e.url}),Jn=({baseUrl:e,path:t,query:n,querySerializer:r,url:o})=>{const s=o.startsWith("/")?o:`/${o}`;let i=(e??"")+s;t&&(i=Zn({path:t,url:i}));let a=n?r(n):"";return a.startsWith("?")&&(a=a.substring(1)),a&&(i+=`?${a}`),i},Oe=(e,t)=>{var r;const n={...e,...t};return(r=n.baseUrl)!=null&&r.endsWith("/")&&(n.baseUrl=n.baseUrl.substring(0,n.baseUrl.length-1)),n.headers=rt(e.headers,t.headers),n},rt=(...e)=>{const t=new Headers;for(const n of e){if(!n||typeof n!="object")continue;const r=n instanceof Headers?n.entries():Object.entries(n);for(const[o,s]of r)if(s===null)t.delete(o);else if(Array.isArray(s))for(const i of s)t.append(o,i);else s!==void 0&&t.set(o,typeof s=="object"?JSON.stringify(s):s)}return t};class de{constructor(){Object.defineProperty(this,"_fns",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._fns=[]}clear(){this._fns=[]}getInterceptorIndex(t){return typeof t=="number"?this._fns[t]?t:-1:this._fns.indexOf(t)}exists(t){const n=this.getInterceptorIndex(t);return!!this._fns[n]}eject(t){const n=this.getInterceptorIndex(t);this._fns[n]&&(this._fns[n]=null)}update(t,n){const r=this.getInterceptorIndex(t);return this._fns[r]?(this._fns[r]=n,t):!1}use(t){return this._fns=[...this._fns,t],this._fns.length-1}}const Gn=()=>({error:new de,request:new de,response:new de}),Qn=nt({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),Yn={"Content-Type":"application/json"},ot=(e={})=>({...Ln,headers:Yn,parseAs:"auto",querySerializer:Qn,...e}),Xn=(e={})=>{let t=Oe(ot(),e);const n=()=>({...t}),r=i=>(t=Oe(t,i),n()),o=Gn(),s=async i=>{const a={...t,...i,fetch:i.fetch??t.fetch??globalThis.fetch,headers:rt(t.headers,i.headers)};a.security&&await Kn({...a,security:a.security}),a.body&&a.bodySerializer&&(a.body=a.bodySerializer(a.body)),(a.body===void 0||a.body==="")&&a.headers.delete("Content-Type");const c=$e(a),d={redirect:"follow",...a};let p=new Request(c,d);for(const y of o.request._fns)y&&(p=await y(p,a));const f=a.fetch;let u=await f(p);for(const y of o.response._fns)y&&(u=await y(u,p,a));const l={request:p,response:u};if(u.ok){if(u.status===204||u.headers.get("Content-Length")==="0")return a.responseStyle==="data"?{}:{data:{},...l};const y=(a.parseAs==="auto"?Hn(u.headers.get("Content-Type")):a.parseAs)??"json";let _;switch(y){case"arrayBuffer":case"blob":case"formData":case"json":case"text":_=await u[y]();break;case"stream":return a.responseStyle==="data"?u.body:{data:u.body,...l}}return y==="json"&&(a.responseValidator&&await a.responseValidator(_),a.responseTransformer&&(_=await a.responseTransformer(_))),a.responseStyle==="data"?_:{data:_,...l}}let h=await u.text();try{h=JSON.parse(h)}catch{}let m=h;for(const y of o.error._fns)y&&(m=await y(h,u,p,a));if(m=m||{},a.throwOnError)throw m;return a.responseStyle==="data"?void 0:{error:m,...l}};return{buildUrl:$e,connect:i=>s({...i,method:"CONNECT"}),delete:i=>s({...i,method:"DELETE"}),get:i=>s({...i,method:"GET"}),getConfig:n,head:i=>s({...i,method:"HEAD"}),interceptors:o,options:i=>s({...i,method:"OPTIONS"}),patch:i=>s({...i,method:"PATCH"}),post:i=>s({...i,method:"POST"}),put:i=>s({...i,method:"PUT"}),request:s,setConfig:r,trace:i=>s({...i,method:"TRACE"})}},H=Xn(ot({baseUrl:"https://engine.thirdweb.com"})),er=e=>(e.client??H).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/write/transaction",...e,headers:{"Content-Type":"application/json",...e.headers}}),tr=e=>(e.client??H).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/sign/message",...e,headers:{"Content-Type":"application/json",...e.headers}}),nr=e=>(e.client??H).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/sign/typed-data",...e,headers:{"Content-Type":"application/json",...e.headers}}),rr=e=>((e==null?void 0:e.client)??H).get({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/accounts",...e}),or=e=>((e==null?void 0:e.client)??H).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/accounts",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}}),st=e=>((e==null?void 0:e.client)??H).post({security:[{name:"x-secret-key",type:"apiKey"}],url:"/v1/transactions/search",...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}});function De(e){return"result"in e}class R extends Error{constructor(t){super(t.message),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"correlationId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"statusCode",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code,this.correlationId=t.correlationId,this.statusCode=t.statusCode}toString(){return A({code:this.code,correlationId:this.correlationId,message:this.message,statusCode:this.statusCode})}}async function sr(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,client:s,maxSteps:i}=e,a="buyAmountWei"in e?e.buyAmountWei:e.amount,c=T(s),d=new URL(`${v("bridge")}/v1/buy/quote`);d.searchParams.set("originChainId",t.toString()),d.searchParams.set("originTokenAddress",n),d.searchParams.set("destinationChainId",r.toString()),d.searchParams.set("destinationTokenAddress",o),d.searchParams.set("buyAmountWei",a.toString()),d.searchParams.set("amount",a.toString()),i&&d.searchParams.set("maxSteps",i.toString());const p=await c(d.toString());if(!p.ok){const u=await p.json();throw new R({code:u.code||"UNKNOWN_ERROR",correlationId:u.correlationId||void 0,message:u.message||p.statusText,statusCode:p.status})}const{data:f}=await p.json();return{blockNumber:f.blockNumber?BigInt(f.blockNumber):void 0,destinationAmount:BigInt(f.destinationAmount),estimatedExecutionTimeMs:f.estimatedExecutionTimeMs,intent:{amount:a,buyAmountWei:a,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n},originAmount:BigInt(f.originAmount),steps:f.steps,timestamp:f.timestamp}}async function it(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,sender:s,receiver:i,client:a,amount:c,purchaseData:d,maxSteps:p,paymentLinkId:f,slippageToleranceBps:u}=e,l=T(a),h=new URL(`${v("bridge")}/v1/buy/prepare`),m=await l(h.toString(),{body:A({amount:c.toString(),buyAmountWei:c.toString(),destinationChainId:r.toString(),destinationTokenAddress:o,maxSteps:p,originChainId:t.toString(),originTokenAddress:n,paymentLinkId:f,purchaseData:d,receiver:i,sender:s,slippageToleranceBps:u}),headers:{"Content-Type":"application/json"},method:"POST"});if(!m.ok){const _=await m.json();throw new R({code:_.code||"UNKNOWN_ERROR",correlationId:_.correlationId||void 0,message:_.message||m.statusText,statusCode:m.status})}const{data:y}=await m.json();return{blockNumber:y.blockNumber?BigInt(y.blockNumber):void 0,destinationAmount:BigInt(y.destinationAmount),estimatedExecutionTimeMs:y.estimatedExecutionTimeMs,intent:{amount:c,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n,receiver:i,sender:s},originAmount:BigInt(y.originAmount),steps:y.steps.map(_=>({..._,transactions:_.transactions.map(g=>({...g,chain:ee(g.chainId),client:a,value:g.value?BigInt(g.value):void 0}))})),timestamp:y.timestamp}}const ir=Object.freeze(Object.defineProperty({__proto__:null,prepare:it,quote:sr},Symbol.toStringTag,{value:"Module"}));async function ar(e){const{client:t}=e;return St(async()=>{const n=T(t),r=new URL(`${v("bridge")}/v1/chains`);e.testnet&&r.searchParams.set("testnet",e.testnet.toString()),"type"in e&&e.type?r.searchParams.set("type",e.type):"originChainId"in e&&e.originChainId?r.searchParams.set("originChainId",e.originChainId.toString()):"destinationChainId"in e&&e.destinationChainId&&r.searchParams.set("destinationChainId",e.destinationChainId.toString());const o=await n(r.toString());if(!o.ok){const i=await o.json();throw new R({code:i.code||"UNKNOWN_ERROR",correlationId:i.correlationId||void 0,message:i.message||o.statusText,statusCode:o.status})}const{data:s}=await o.json();return s},{cacheKey:`bridge-chains-${JSON.stringify(e)}`,cacheTime:1e3*60*60*1})}async function cr(e){const{id:t,client:n}=e,r=T(n),o=new URL(`${v("bridge")}/v1/onramp/status`);o.searchParams.set("id",t);const s=await r(o.toString());if(!s.ok){const a=await s.json();throw new R({code:a.code||"UNKNOWN_ERROR",correlationId:a.correlationId||void 0,message:a.message||s.statusText,statusCode:s.status})}const{data:i}=await s.json();return i}async function dr(e){const{client:t,onramp:n,chainId:r,tokenAddress:o,receiver:s,amount:i,purchaseData:a,sender:c,onrampTokenAddress:d,onrampChainId:p,currency:f,maxSteps:u,excludeChainIds:l,paymentLinkId:h,country:m}=e,y=T(t),_=`${v("bridge")}/v1/onramp/prepare`,g={chainId:Number(r),onramp:n,receiver:s,tokenAddress:o};i!==void 0&&(g.amount=i.toString()),a!==void 0&&(g.purchaseData=a),c!==void 0&&(g.sender=c),d!==void 0&&(g.onrampTokenAddress=d),p!==void 0&&(g.onrampChainId=Number(p)),f!==void 0&&(g.currency=f),u!==void 0&&(g.maxSteps=u),l!==void 0&&(g.excludeChainIds=Array.isArray(l)?l.join(","):l),h!==void 0&&(g.paymentLinkId=h),m!==void 0&&(g.country=m);const b=await y(_,{body:A(g),headers:{"Content-Type":"application/json"},method:"POST"});if(!b.ok){const P=await b.json();throw new R({code:P.code||"UNKNOWN_ERROR",correlationId:P.correlationId||void 0,message:P.message||b.statusText,statusCode:b.status})}const{data:w}=await b.json(),E=w.steps.map(P=>({...P,destinationAmount:BigInt(P.destinationAmount),originAmount:BigInt(P.originAmount),transactions:P.transactions.map(L=>({...L,chain:ee(L.chainId),client:t,value:L.value?BigInt(L.value):void 0}))})),N={...w.intent,amount:w.intent.amount?w.intent.amount:void 0};return{...w,destinationAmount:BigInt(w.destinationAmount),intent:N,steps:E}}const ur=Object.freeze(Object.defineProperty({__proto__:null,prepare:dr,status:cr},Symbol.toStringTag,{value:"Module"}));async function lr(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,amount:s,client:i,maxSteps:a}=e,c=T(i),d=new URL(`${v("bridge")}/v1/sell/quote`);d.searchParams.set("originChainId",t.toString()),d.searchParams.set("originTokenAddress",n),d.searchParams.set("destinationChainId",r.toString()),d.searchParams.set("destinationTokenAddress",o),d.searchParams.set("sellAmountWei",s.toString()),d.searchParams.set("amount",s.toString()),typeof a<"u"&&d.searchParams.set("maxSteps",a.toString());const p=await c(d.toString());if(!p.ok){const u=await p.json();throw new R({code:u.code||"UNKNOWN_ERROR",correlationId:u.correlationId||void 0,message:u.message||p.statusText,statusCode:p.status})}const{data:f}=await p.json();return{blockNumber:f.blockNumber?BigInt(f.blockNumber):void 0,destinationAmount:BigInt(f.destinationAmount),estimatedExecutionTimeMs:f.estimatedExecutionTimeMs,intent:{amount:s,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n},originAmount:BigInt(f.originAmount),steps:f.steps,timestamp:f.timestamp}}async function at(e){const{originChainId:t,originTokenAddress:n,destinationChainId:r,destinationTokenAddress:o,amount:s,sender:i,receiver:a,client:c,purchaseData:d,maxSteps:p,paymentLinkId:f,slippageToleranceBps:u}=e,l=T(c),h=new URL(`${v("bridge")}/v1/sell/prepare`),m=await l(h.toString(),{body:A({amount:s.toString(),destinationChainId:r.toString(),destinationTokenAddress:o,maxSteps:p,originChainId:t.toString(),originTokenAddress:n,paymentLinkId:f,purchaseData:d,receiver:a,sellAmountWei:s.toString(),sender:i,slippageToleranceBps:u}),headers:{"Content-Type":"application/json"},method:"POST"});if(!m.ok){const _=await m.json();throw new R({code:_.code||"UNKNOWN_ERROR",correlationId:_.correlationId||void 0,message:_.message||m.statusText,statusCode:m.status})}const{data:y}=await m.json();return{blockNumber:y.blockNumber?BigInt(y.blockNumber):void 0,destinationAmount:BigInt(y.destinationAmount),estimatedExecutionTimeMs:y.estimatedExecutionTimeMs,expiration:y.expiration,intent:{amount:s,destinationChainId:r,destinationTokenAddress:o,originChainId:t,originTokenAddress:n,purchaseData:d,receiver:a,sender:i},originAmount:BigInt(y.originAmount),steps:y.steps.map(_=>({..._,transactions:_.transactions.map(g=>({...g,chain:ee(g.chainId),client:c,value:g.value?BigInt(g.value):void 0}))})),timestamp:y.timestamp}}const fr=Object.freeze(Object.defineProperty({__proto__:null,prepare:at,quote:lr},Symbol.toStringTag,{value:"Module"}));async function ct(e){const{transactionHash:t,client:n,transactionId:r}=e,o="chainId"in e?e.chainId:e.chain.id,s=T(n),i=new URL(`${v("bridge")}/v1/status`);i.searchParams.set("transactionHash",t),i.searchParams.set("chainId",o.toString()),r&&i.searchParams.set("transactionId",r);const a=await s(i.toString());if(!a.ok){const d=await a.json();throw new R({code:d.code||"UNKNOWN_ERROR",correlationId:d.correlationId||void 0,message:d.message||a.statusText,statusCode:a.status})}const{data:c}=await a.json();return c.status==="FAILED"?{paymentId:c.paymentId,status:"FAILED",transactions:c.transactions}:c.status==="PENDING"?{destinationChainId:c.destinationChainId,destinationToken:c.destinationToken,destinationTokenAddress:c.destinationTokenAddress,originAmount:BigInt(c.originAmount),originChainId:c.originChainId,originToken:c.originToken,originTokenAddress:c.originTokenAddress,paymentId:c.paymentId,purchaseData:c.purchaseData,receiver:c.receiver,sender:c.sender,status:"PENDING",transactions:c.transactions}:c.status==="NOT_FOUND"?{paymentId:c.paymentId,status:"NOT_FOUND",transactions:[]}:{destinationAmount:BigInt(c.destinationAmount),destinationChainId:c.destinationChainId,destinationToken:c.destinationToken,destinationTokenAddress:c.destinationTokenAddress,originAmount:BigInt(c.originAmount),originChainId:c.originChainId,originToken:c.originToken,originTokenAddress:c.originTokenAddress,paymentId:c.paymentId,purchaseData:c.purchaseData,receiver:c.receiver,sender:c.sender,status:"COMPLETED",transactions:c.transactions}}async function hr(e){const{client:t,chainId:n,tokenAddress:r,symbol:o,name:s,limit:i,offset:a,includePrices:c,sortBy:d,query:p}=e,f=T(t),u=new URL(`${v("bridge")}/v1/tokens`);n!=null&&u.searchParams.set("chainId",n.toString()),r&&u.searchParams.set("tokenAddress",r),o&&u.searchParams.set("symbol",o),s&&u.searchParams.set("name",s),i!==void 0&&u.searchParams.set("limit",i.toString()),a!=null&&u.searchParams.set("offset",a.toString()),c!==void 0&&u.searchParams.set("includePrices",c.toString()),d!==void 0&&u.searchParams.set("sortBy",d),p!==void 0&&u.searchParams.set("query",p);const l=await f(u.toString());if(!l.ok){const m=await l.json();throw new R({code:m.code||"UNKNOWN_ERROR",correlationId:m.correlationId||void 0,message:m.message||l.statusText,statusCode:l.status})}const{data:h}=await l.json();return h}async function dt(e){const{chainId:t,tokenAddress:n,sender:r,receiver:o,client:s,amount:i,purchaseData:a,feePayer:c,paymentLinkId:d}=e,p=T(s),f=new URL(`${v("bridge")}/v1/transfer/prepare`),u=await p(f.toString(),{body:A({amount:i.toString(),chainId:t.toString(),feePayer:c,paymentLinkId:d,purchaseData:a,receiver:o,sender:r,tokenAddress:n,transferAmountWei:i.toString()}),headers:{"Content-Type":"application/json"},method:"POST"});if(!u.ok){const h=await u.json();throw new R({code:h.code||"UNKNOWN_ERROR",correlationId:h.correlationId||void 0,message:h.message||u.statusText,statusCode:u.status})}const{data:l}=await u.json();return{blockNumber:l.blockNumber?BigInt(l.blockNumber):void 0,destinationAmount:BigInt(l.destinationAmount),estimatedExecutionTimeMs:l.estimatedExecutionTimeMs,intent:{amount:i,chainId:t,feePayer:c,receiver:o,sender:r,tokenAddress:n},originAmount:BigInt(l.originAmount),steps:l.steps.map(h=>({...h,transactions:h.transactions.map(m=>({...m,chain:ee(m.chainId),client:s,value:m.value?BigInt(m.value):void 0}))})),timestamp:l.timestamp}}const mr=Object.freeze(Object.defineProperty({__proto__:null,prepare:dt},Symbol.toStringTag,{value:"Module"}));function I(e,t,n){function r(a,c){var d;Object.defineProperty(a,"_zod",{value:a._zod??{},enumerable:!1}),(d=a._zod).traits??(d.traits=new Set),a._zod.traits.add(e),t(a,c);for(const p in i.prototype)p in a||Object.defineProperty(a,p,{value:i.prototype[p].bind(a)});a._zod.constr=i,a._zod.def=c}const o=(n==null?void 0:n.Parent)??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;const d=n!=null&&n.Parent?new s:this;r(d,a),(c=d._zod).deferred??(c.deferred=[]);for(const p of d._zod.deferred)p();return d}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>{var c,d;return n!=null&&n.Parent&&a instanceof n.Parent?!0:(d=(c=a==null?void 0:a._zod)==null?void 0:c.traits)==null?void 0:d.has(e)}}),Object.defineProperty(i,"name",{value:e}),i}class oe extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}const ut={};function K(e){return ut}function pr(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function gr(e,t){return typeof t=="bigint"?t.toString():t}function Te(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function lt(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function B(e,t,n){Object.defineProperty(e,t,{get(){{const r=n();return e[t]=r,r}},set(r){Object.defineProperty(e,t,{value:r})},configurable:!0})}function yr(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function G(e){return JSON.stringify(e)}const ft=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function se(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const wr=Te(()=>{var e;if(typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function _r(e){if(se(e)===!1)return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(se(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}const br=new Set(["string","number","symbol"]);function ht(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function kr(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function D(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Ir(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function ue(e,t=0){var n;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function M(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function te(e){return typeof e=="string"?e:e==null?void 0:e.message}function J(e,t,n){var o,s,i,a,c,d;const r={...e,path:e.path??[]};if(!e.message){const p=te((i=(s=(o=e.inst)==null?void 0:o._zod.def)==null?void 0:s.error)==null?void 0:i.call(s,e))??te((a=t==null?void 0:t.error)==null?void 0:a.call(t,e))??te((c=n.customError)==null?void 0:c.call(n,e))??te((d=n.localeError)==null?void 0:d.call(n,e))??"Invalid input";r.message=p}return delete r.inst,delete r.continue,t!=null&&t.reportInput||delete r.input,r}function Ar(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const mt=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),Object.defineProperty(e,"message",{get(){return JSON.stringify(t,gr,2)},enumerable:!0})},Tr=I("$ZodError",mt),ce=I("$ZodError",mt,{Parent:Error}),vr=e=>(t,n,r,o)=>{const s=r?Object.assign(r,{async:!1}):{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new oe;if(i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(c=>J(c,s,K())));throw ft(a,o==null?void 0:o.callee),a}return i.value},Er=vr(ce),Sr=e=>async(t,n,r,o)=>{const s=r?Object.assign(r,{async:!0}):{async:!0};let i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){const a=new((o==null?void 0:o.Err)??e)(i.issues.map(c=>J(c,s,K())));throw ft(a,o==null?void 0:o.callee),a}return i.value},Cr=Sr(ce),Pr=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new oe;return s.issues.length?{success:!1,error:new(e??Tr)(s.issues.map(i=>J(i,o,K())))}:{success:!0,data:s.value}},pt=Pr(ce),$r=e=>async(t,n,r)=>{const o=r?Object.assign(r,{async:!0}):{async:!0};let s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>J(i,o,K())))}:{success:!0,data:s.value}},gt=$r(ce),Or=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Dr=/^\d+n?$/,zr=/^-?\d+(?:\.\d+)?/i,Rr=I("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])});class Br{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
|
|
3
|
+
`).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(const i of s)this.content.push(i)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
|
|
4
|
+
`))}}const Nr={major:4,minor:0,patch:0},C=I("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Nr;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const s of r)for(const i of s._zod.onattach)i(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const s=(i,a,c)=>{let d=ue(i),p;for(const f of a){if(f._zod.when){if(!f._zod.when(i))continue}else if(d)continue;const u=i.issues.length,l=f._zod.check(i);if(l instanceof Promise&&(c==null?void 0:c.async)===!1)throw new oe;if(p||l instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await l,i.issues.length!==u&&(d||(d=ue(i,u)))});else{if(i.issues.length===u)continue;d||(d=ue(i,u))}}return p?p.then(()=>i):i};e._zod.run=(i,a)=>{const c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new oe;return c.then(d=>s(d,r,a))}return s(c,r,a)}}e["~standard"]={validate:s=>{var i;try{const a=pt(e,s);return a.success?{value:a.data}:{issues:(i=a.error)==null?void 0:i.issues}}catch{return gt(e,s).then(c=>{var d;return c.success?{value:c.data}:{issues:(d=c.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}}),jr=I("$ZodString",(e,t)=>{var n;C.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Or(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),xr=I("$ZodNumber",(e,t)=>{C.init(e,t),e._zod.pattern=e._zod.bag.pattern??zr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}const o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;const s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),Ur=I("$ZodBigInt",(e,t)=>{C.init(e,t),e._zod.pattern=Dr,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=BigInt(n.value)}catch{}return typeof n.value=="bigint"||n.issues.push({expected:"bigint",code:"invalid_type",input:n.value,inst:e}),n}}),Lr=I("$ZodUnknown",(e,t)=>{C.init(e,t),e._zod.parse=n=>n});function ze(e,t,n){e.issues.length&&t.issues.push(...M(n,e.issues)),t.value[n]=e.value}const Mr=I("$ZodArray",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const s=[];for(let i=0;i<o.length;i++){const a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(d=>ze(d,n,i))):ze(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function ne(e,t,n){e.issues.length&&t.issues.push(...M(n,e.issues)),t.value[n]=e.value}function Re(e,t,n,r){e.issues.length?r[n]===void 0?n in r?t.value[n]=void 0:t.value[n]=e.value:t.issues.push(...M(n,e.issues)):e.value===void 0?n in r&&(t.value[n]=void 0):t.value[n]=e.value}const qr=I("$ZodObject",(e,t)=>{C.init(e,t);const n=Te(()=>{const f=Object.keys(t.shape);for(const l of f)if(!(t.shape[l]instanceof C))throw new Error(`Invalid element at key "${l}": expected a Zod schema`);const u=Ir(t.shape);return{shape:t.shape,keys:f,keySet:new Set(f),numKeys:f.length,optionalKeys:new Set(u)}});B(e._zod,"propValues",()=>{const f=t.shape,u={};for(const l in f){const h=f[l]._zod;if(h.values){u[l]??(u[l]=new Set);for(const m of h.values)u[l].add(m)}}return u});const r=f=>{const u=new Br(["shape","payload","ctx"]),l=n.value,h=g=>{const b=G(g);return`shape[${b}]._zod.run({ value: input[${b}], issues: [] }, ctx)`};u.write("const input = payload.value;");const m=Object.create(null);let y=0;for(const g of l.keys)m[g]=`key_${y++}`;u.write("const newResult = {}");for(const g of l.keys)if(l.optionalKeys.has(g)){const b=m[g];u.write(`const ${b} = ${h(g)};`);const w=G(g);u.write(`
|
|
5
|
+
if (${b}.issues.length) {
|
|
6
|
+
if (input[${w}] === undefined) {
|
|
7
|
+
if (${w} in input) {
|
|
8
|
+
newResult[${w}] = undefined;
|
|
9
|
+
}
|
|
10
|
+
} else {
|
|
11
|
+
payload.issues = payload.issues.concat(
|
|
12
|
+
${b}.issues.map((iss) => ({
|
|
13
|
+
...iss,
|
|
14
|
+
path: iss.path ? [${w}, ...iss.path] : [${w}],
|
|
15
|
+
}))
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
} else if (${b}.value === undefined) {
|
|
19
|
+
if (${w} in input) newResult[${w}] = undefined;
|
|
20
|
+
} else {
|
|
21
|
+
newResult[${w}] = ${b}.value;
|
|
22
|
+
}
|
|
23
|
+
`)}else{const b=m[g];u.write(`const ${b} = ${h(g)};`),u.write(`
|
|
24
|
+
if (${b}.issues.length) payload.issues = payload.issues.concat(${b}.issues.map(iss => ({
|
|
25
|
+
...iss,
|
|
26
|
+
path: iss.path ? [${G(g)}, ...iss.path] : [${G(g)}]
|
|
27
|
+
})));`),u.write(`newResult[${G(g)}] = ${b}.value`)}u.write("payload.value = newResult;"),u.write("return payload;");const _=u.compile();return(g,b)=>_(f,g,b)};let o;const s=se,i=!ut.jitless,c=i&&wr.value,d=t.catchall;let p;e._zod.parse=(f,u)=>{p??(p=n.value);const l=f.value;if(!s(l))return f.issues.push({expected:"object",code:"invalid_type",input:l,inst:e}),f;const h=[];if(i&&c&&(u==null?void 0:u.async)===!1&&u.jitless!==!0)o||(o=r(t.shape)),f=o(f,u);else{f.value={};const b=p.shape;for(const w of p.keys){const E=b[w],N=E._zod.run({value:l[w],issues:[]},u),P=E._zod.optin==="optional"&&E._zod.optout==="optional";N instanceof Promise?h.push(N.then(L=>P?Re(L,f,w,l):ne(L,f,w))):P?Re(N,f,w,l):ne(N,f,w)}}if(!d)return h.length?Promise.all(h).then(()=>f):f;const m=[],y=p.keySet,_=d._zod,g=_.def.type;for(const b of Object.keys(l)){if(y.has(b))continue;if(g==="never"){m.push(b);continue}const w=_.run({value:l[b],issues:[]},u);w instanceof Promise?h.push(w.then(E=>ne(E,f,b))):ne(w,f,b)}return m.length&&f.issues.push({code:"unrecognized_keys",keys:m,input:l,inst:e}),h.length?Promise.all(h).then(()=>f):f}});function Be(e,t,n,r){for(const o of e)if(o.issues.length===0)return t.value=o.value,t;return t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(o=>o.issues.map(s=>J(s,r,K())))}),t}const Fr=I("$ZodUnion",(e,t)=>{C.init(e,t),B(e._zod,"optin",()=>t.options.some(n=>n._zod.optin==="optional")?"optional":void 0),B(e._zod,"optout",()=>t.options.some(n=>n._zod.optout==="optional")?"optional":void 0),B(e._zod,"values",()=>{if(t.options.every(n=>n._zod.values))return new Set(t.options.flatMap(n=>Array.from(n._zod.values)))}),B(e._zod,"pattern",()=>{if(t.options.every(n=>n._zod.pattern)){const n=t.options.map(r=>r._zod.pattern);return new RegExp(`^(${n.map(r=>lt(r.source)).join("|")})$`)}}),e._zod.parse=(n,r)=>{let o=!1;const s=[];for(const i of t.options){const a=i._zod.run({value:n.value,issues:[]},r);if(a instanceof Promise)s.push(a),o=!0;else{if(a.issues.length===0)return a;s.push(a)}}return o?Promise.all(s).then(i=>Be(i,n,e,r)):Be(s,n,e,r)}}),Wr=I("$ZodDiscriminatedUnion",(e,t)=>{Fr.init(e,t);const n=e._zod.parse;B(e._zod,"propValues",()=>{const o={};for(const s of t.options){const i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(const[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(const d of c)o[a].add(d)}}return o});const r=Te(()=>{const o=t.options,s=new Map;for(const i of o){const a=i._zod.propValues[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(const c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{const i=o.value;if(!se(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;const a=r.value.get(i==null?void 0:i[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",input:i,path:[t.discriminator],inst:e}),o)}}),Vr=I("$ZodRecord",(e,t)=>{C.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!_r(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const s=[];if(t.keyType._zod.values){const i=t.keyType._zod.values;n.value={};for(const c of i)if(typeof c=="string"||typeof c=="number"||typeof c=="symbol"){const d=t.valueType._zod.run({value:o[c],issues:[]},r);d instanceof Promise?s.push(d.then(p=>{p.issues.length&&n.issues.push(...M(c,p.issues)),n.value[c]=p.value})):(d.issues.length&&n.issues.push(...M(c,d.issues)),n.value[c]=d.value)}let a;for(const c in o)i.has(c)||(a=a??[],a.push(c));a&&a.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:a})}else{n.value={};for(const i of Reflect.ownKeys(o)){if(i==="__proto__")continue;const a=t.keyType._zod.run({value:i,issues:[]},r);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(a.issues.length){n.issues.push({origin:"record",code:"invalid_key",issues:a.issues.map(d=>J(d,r,K())),input:i,path:[i],inst:e}),n.value[a.value]=a.value;continue}const c=t.valueType._zod.run({value:o[i],issues:[]},r);c instanceof Promise?s.push(c.then(d=>{d.issues.length&&n.issues.push(...M(i,d.issues)),n.value[a.value]=d.value})):(c.issues.length&&n.issues.push(...M(i,c.issues)),n.value[a.value]=c.value)}}return s.length?Promise.all(s).then(()=>n):n}}),Zr=I("$ZodEnum",(e,t)=>{C.init(e,t);const n=pr(t.entries);e._zod.values=new Set(n),e._zod.pattern=new RegExp(`^(${n.filter(r=>br.has(typeof r)).map(r=>typeof r=="string"?ht(r):r.toString()).join("|")})$`),e._zod.parse=(r,o)=>{const s=r.value;return e._zod.values.has(s)||r.issues.push({code:"invalid_value",values:n,input:s,inst:e}),r}}),Hr=I("$ZodLiteral",(e,t)=>{C.init(e,t),e._zod.values=new Set(t.values),e._zod.pattern=new RegExp(`^(${t.values.map(n=>typeof n=="string"?ht(n):n?n.toString():String(n)).join("|")})$`),e._zod.parse=(n,r)=>{const o=n.value;return e._zod.values.has(o)||n.issues.push({code:"invalid_value",values:t.values,input:o,inst:e}),n}}),Kr=I("$ZodOptional",(e,t)=>{C.init(e,t),e._zod.optin="optional",e._zod.optout="optional",B(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),B(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${lt(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>t.innerType._zod.optin==="optional"?t.innerType._zod.run(n,r):n.value===void 0?n:t.innerType._zod.run(n,r)}),Jr=I("$ZodCustom",(e,t)=>{Rr.init(e,t),C.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Ne(s,n,r,e));Ne(o,n,r,e)}});function Ne(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(Ar(o))}}function Gr(e,t){return new e({type:"string",...D(t)})}function Qr(e,t){return new e({type:"number",checks:[],...D(t)})}function Yr(e,t){return new e({type:"number",coerce:!0,checks:[],...D(t)})}function Xr(e,t){return new e({type:"bigint",coerce:!0,...D(t)})}function eo(e){return new e({type:"unknown"})}function to(e,t,n){return new e({type:"custom",check:"custom",fn:t,...D(n)})}const O=I("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");C.init(e,t),e.def=t,e.parse=(n,r)=>Er(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>pt(e,n,r),e.parseAsync=async(n,r)=>Cr(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>gt(e,n,r),e.check=(...n)=>e.clone({...t,checks:[...t.checks??[],...n.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),e.clone=(n,r)=>kr(e,n,r),e.brand=()=>e,e.register=(n,r)=>(n.add(e,r),e)}),no=I("ZodMiniString",(e,t)=>{jr.init(e,t),O.init(e,t)});function S(e){return Gr(no,e)}const yt=I("ZodMiniNumber",(e,t)=>{xr.init(e,t),O.init(e,t)});function ro(e){return Qr(yt,e)}const oo=I("ZodMiniBigInt",(e,t)=>{Ur.init(e,t),O.init(e,t)}),so=I("ZodMiniUnknown",(e,t)=>{Lr.init(e,t),O.init(e,t)});function wt(){return eo(so)}const io=I("ZodMiniArray",(e,t)=>{Mr.init(e,t),O.init(e,t)});function ao(e,t){return new io({type:"array",element:e,...D(t)})}const co=I("ZodMiniObject",(e,t)=>{qr.init(e,t),O.init(e,t),B(e,"shape",()=>t.shape)});function z(e,t){const n={type:"object",get shape(){return yr(this,"shape",{...e}),this.shape},...D(t)};return new co(n)}const uo=I("ZodMiniDiscriminatedUnion",(e,t)=>{Wr.init(e,t),O.init(e,t)});function ve(e,t,n){return new uo({type:"union",options:t,discriminator:e,...D(n)})}const lo=I("ZodMiniRecord",(e,t)=>{Vr.init(e,t),O.init(e,t)});function fo(e,t,n){return new lo({type:"record",keyType:e,valueType:t,...D(n)})}const ho=I("ZodMiniEnum",(e,t)=>{Zr.init(e,t),O.init(e,t)});function ge(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new ho({type:"enum",entries:n,...D(t)})}const mo=I("ZodMiniLiteral",(e,t)=>{Hr.init(e,t),O.init(e,t)});function x(e,t){return new mo({type:"literal",values:Array.isArray(e)?e:[e],...D(t)})}const po=I("ZodMiniOptional",(e,t)=>{Kr.init(e,t),O.init(e,t)});function W(e){return new po({type:"optional",innerType:e})}const go=I("ZodMiniCustom",(e,t)=>{Jr.init(e,t),O.init(e,t)});function _t(e,t={}){return to(go,e,t)}function Q(e){return Yr(yt,e)}function ye(e){return Xr(oo,e)}const bt=S().check(_t(ie,{message:"Invalid hex string"})),V=S().check(_t(xe,{message:"Invalid address"})),we=z({address:V,chainId:Q(),decimals:Q(),iconUri:W(S()),name:S(),priceUsd:Q(),symbol:S()}),yo=ve("version",[z({data:z({}),type:x("pay.onchain-transaction"),version:x(1)}),z({data:z({action:ge(["TRANSFER","BUY","SELL"]),clientId:S(),destinationAmount:ye(),destinationToken:we,developerFeeBps:Q(),developerFeeRecipient:V,originAmount:ye(),originToken:we,paymentId:S(),paymentLinkId:W(S()),purchaseData:W(fo(S(),wt())),receiver:V,sender:V,status:ge(["PENDING","FAILED","COMPLETED"]),transactions:ao(z({chainId:Q(),transactionHash:bt})),type:S()}),type:x("pay.onchain-transaction"),version:x(2)})]),wo=ve("version",[z({data:z({}),type:x("pay.onramp-transaction"),version:x(1)}),z({data:z({amount:ye(),currency:S(),currencyAmount:ro(),id:S(),onramp:S(),paymentLinkId:W(S()),purchaseData:wt(),receiver:V,sender:W(V),status:ge(["PENDING","COMPLETED","FAILED"]),token:we,transactionHash:W(bt)}),type:x("pay.onramp-transaction"),version:x(2)})]),_o=ve("type",[yo,wo]);async function kt(e,t,n,r=300,o){const s=t["x-payload-signature"]||t["x-pay-signature"],i=t["x-timestamp"]||t["x-pay-timestamp"];if(!s||!i)throw new Error("Missing required webhook headers: signature or timestamp");const a=Math.floor(Date.now()/1e3),c=Number.parseInt(i,10),d=Math.abs(a-c);if(d>r)throw new Error(`Webhook timestamp is too old. Difference: ${d}s, tolerance: ${r}s`);const p=new TextEncoder,f=await crypto.subtle.importKey("raw",p.encode(n),{hash:"SHA-256",name:"HMAC"},!1,["sign"]),u=await crypto.subtle.sign("HMAC",f,p.encode(`${i}.${e}`));if(Array.from(new Uint8Array(u)).map(y=>y.toString(16).padStart(2,"0")).join("")!==s)throw new Error("Invalid webhook signature");let h;try{h=JSON.parse(e)}catch{throw new Error("Invalid webhook payload: not valid JSON")}const m=_o.parse(h);if(m.version===1)throw new Error("Invalid webhook payload: version 1 is no longer supported, please upgrade to webhook version 2.");if(o){if(o.receiverAddress&&m.data.receiver.toLowerCase()!==o.receiverAddress.toLowerCase())throw new Error(`Verification Failed: receiverAddress mismatch, Expected: ${o.receiverAddress}, Received: ${m.data.receiver}`);if(o.destinationTokenAddress){if("destinationToken"in m.data){if(m.data.destinationToken.address.toLowerCase()!==o.destinationTokenAddress.toLowerCase())throw new Error(`Verification Failed: destinationTokenAddress mismatch, Expected: ${o.destinationTokenAddress}, Received: ${m.data.destinationToken.address}`)}else if("onramp"in m.data&&m.data.token.address.toLowerCase()!==o.destinationTokenAddress.toLowerCase())throw new Error(`Verification Failed: destinationTokenAddress mismatch, Expected: ${o.destinationTokenAddress}, Received: ${m.data.token.address}`)}if(o.destinationChainId){if("destinationToken"in m.data){if(m.data.destinationToken.chainId!==o.destinationChainId)throw new Error(`Verification Failed: destinationChainId mismatch, Expected: ${o.destinationChainId}, Received: ${m.data.destinationToken.chainId}`)}else if("onramp"in m.data&&m.data.token.chainId!==o.destinationChainId)throw new Error(`Verification Failed: destinationChainId mismatch, Expected: ${o.destinationChainId}, Received: ${m.data.token.chainId}`)}if(o.minDestinationAmount){if("destinationAmount"in m.data){if(m.data.destinationAmount<o.minDestinationAmount)throw new Error(`Verification Failed: minDestinationAmount, Expected minimum amount to be ${o.minDestinationAmount}, Received: ${m.data.destinationAmount}`)}else if("onramp"in m.data&&m.data.amount<o.minDestinationAmount)throw new Error(`Verification Failed: minDestinationAmount, Expected minimum amount to be ${o.minDestinationAmount}, Received: ${m.data.amount}`)}}return m}const bo=Object.freeze(Object.defineProperty({__proto__:null,parse:kt},Symbol.toStringTag,{value:"Module"})),ko=Object.freeze(Object.defineProperty({__proto__:null,Buy:ir,Onramp:ur,Sell:fr,Transfer:mr,Webhook:bo,chains:ar,parse:kt,status:ct,tokens:hr},Symbol.toStringTag,{value:"Module"}));function It(e,t){const n=Ot(ie(e,{strict:!1})?Ue(e):e);return t==="bytes"?n:Le(n)}const le=new Ct(4096);function Io(e){if(le.has(e))return le.get(e);const t=It(Me(e)).slice(2,34);return le.set(e,t),t}function Ao(e){const{clientId:t,secretKey:n,...r}=e;let o=t;if(n)if(Pt(n)){if(!t)throw new Error("clientId must be provided when using a JWT secretKey")}else o=t??Io(n);if(!o)throw new Error("clientId or secretKey must be provided");return{...r,clientId:o,secretKey:n}}async function To(e){var s;const{client:t,label:n}=e,r=await or({baseUrl:v("engineCloud"),body:{label:n},bodySerializer:Z,fetch:T(t)});if(r.error)throw new Error(`Error creating server wallet with label ${n}: ${Z(r.error)}`);const o=(s=r.data)==null?void 0:s.result;if(!o)throw new Error(`No server wallet created with label ${n}`);return o}async function At(e){var i,a,c;const{client:t,transactionId:n}=e,r=await st({baseUrl:v("engineCloud"),body:{filters:[{field:"id",operation:"OR",values:[n]}]},bodySerializer:A,fetch:T(t)});if(r.error)throw new Error(`Error searching for transaction ${n}: ${A(r.error)}`);const o=(c=(a=(i=r.data)==null?void 0:i.result)==null?void 0:a.transactions)==null?void 0:c[0];if(!o)throw new Error(`Transaction ${n} not found`);return{...o.executionResult,cancelledAt:o.cancelledAt,chain:Y(Number(o.chainId)),confirmedAt:o.confirmedAt,createdAt:o.createdAt,from:o.from??void 0,id:o.id}}async function vo(e){var o;const{client:t}=e,n=await rr({baseUrl:v("engineCloud"),bodySerializer:Z,fetch:T(t),query:{limit:e.limit,page:e.page}});if(n.error)throw new Error(`Error listing server wallets: ${Z(n.error)}`);const r=(o=n.data)==null?void 0:o.result;if(!r)throw new Error("No server wallets found");return r}async function Eo(e){var a;const{client:t,filters:n,pageSize:r=100,page:o=1}=e,s=await st({baseUrl:v("engineCloud"),body:{filters:n,limit:r,page:o},bodySerializer:A,fetch:T(t)});if(s.error)throw new Error(`Error searching for transaction with filters ${A(n)}: ${A(s.error)}`);const i=(a=s.data)==null?void 0:a.result;if(!i)throw new Error(`No transactions found with filters ${A(n)}`);return i}async function _e(e){const t=Date.now(),n=e.timeoutInSeconds?e.timeoutInSeconds*1e3:5*60*1e3;for(;Date.now()-t<n;){const r=await At(e);switch(r.status){case"FAILED":throw new Error(`Transaction failed: ${Z(r.error)||"Unknown error"}`);case"CONFIRMED":{if((r&&"onchainStatus"in r?r.onchainStatus:null)==="REVERTED"){const i="revertData"in r?r.revertData:void 0;throw new Error(`Transaction reverted: ${(i==null?void 0:i.errorName)||"unknown error"} ${i!=null&&i.errorArgs?Z(i.errorArgs):""} - ${r.transactionHash?r.transactionHash:""}`)}return{chain:r.chain,client:e.client,transactionHash:r.transactionHash}}default:await new Promise(s=>setTimeout(s,1e3))}}throw new Error(`Transaction timed out after ${n/1e3} seconds`)}function So(e){const{client:t,vaultAccessToken:n,address:r,chain:o,executionOptions:s}=e,i=n?{"x-vault-access-token":n}:{},a=f=>{if(!s)return{chainId:f,from:r,type:"auto"};switch(s.type){case"auto":return{chainId:f,from:r,type:"auto"};case"ERC4337":return{...s,chainId:f,type:"ERC4337"};case"EOA":return{chainId:f,from:r,type:"EOA"};case"EIP7702":return{...s,chainId:f,type:"EIP7702"}}},c=f=>{if(!f)return{from:r,type:"EOA"};if(!s)return{chainId:f,from:r,type:"auto"};switch(s.type){case"ERC4337":return{chainId:f,...s,type:"ERC4337"};case"auto":return{chainId:f,from:r,type:"auto"};case"EIP7702":case"EOA":return{chainId:f,from:r,type:"EOA"}}},d=async f=>{var _,g,b;if(f.length===0)throw new Error("No transactions to enqueue");const u=f[0];if(!u)throw new Error("No transactions to enqueue");const l=u.chainId;for(let w=1;w<f.length;w++)if(((_=f[w])==null?void 0:_.chainId)!==l)throw new Error(`All transactions in batch must be on the same chain. Expected ${l}, got ${(g=f[w])==null?void 0:g.chainId} at index ${w}`);const h={executionOptions:a(l),params:f.map(w=>{var E;return{data:w.data,to:w.to,gasLimit:w.gas?Number(w.gas):void 0,value:(E=w.value)==null?void 0:E.toString()}})},m=await er({baseUrl:v("engineCloud"),body:h,bodySerializer:A,fetch:T(t),headers:i});if(m.error)throw new Error(`Error sending transaction: ${A(m.error)}`);const y=(b=m.data)==null?void 0:b.result;if(!y)throw new Error("No data returned from engine");return y.transactions.map(w=>w.id)};return{address:(s==null?void 0:s.type)==="ERC4337"&&s.smartAccountAddress?s.smartAccountAddress:r,enqueueBatchTransaction:async f=>{const u=[];for(const m of f.transactions){const[y,_,g]=await Promise.all([m.to?j(m.to):null,re(m),m.value?j(m.value):null]);u.push({chainId:m.chain.id,data:_,to:y??void 0,value:g??void 0})}const h=(await d(u))[0];if(!h)throw new Error("No transactionId returned from engine");return{transactionId:h}},enqueueTransaction:async f=>{let u;if(f.simulate)u=await Fe({transaction:f.transaction,from:r});else{const[m,y,_]=await Promise.all([f.transaction.to?j(f.transaction.to):null,re(f.transaction),f.transaction.value?j(f.transaction.value):null]);u={chainId:f.transaction.chain.id,data:y,to:m??void 0,value:_??void 0}}const h=(await d([u]))[0];if(!h)throw new Error("No transactionId returned from engine");return{transactionId:h}},sendBatchTransaction:async f=>{const l=(await d(f))[0];if(!l)throw new Error("No transactionId returned from engine");return _e({client:t,transactionId:l})},sendTransaction:async f=>{const l=(await d([f]))[0];if(!l)throw new Error("No transactionId returned from engine");return _e({client:t,transactionId:l})},signMessage:async f=>{var b;const{message:u,chainId:l}=f;let h,m=!1;typeof u=="string"?h=u:(h=qe(u.raw),m=!0);const y=l||(o==null?void 0:o.id);if(!y)throw new Error("Chain ID is required for signing messages");const _=await tr({baseUrl:v("engineCloud"),body:{params:[{format:m?"hex":"text",message:h}],signingOptions:c(y)},bodySerializer:A,fetch:T(t),headers:i});if(_.error)throw new Error(`Error signing message: ${A(_.error)}`);const g=(b=_.data)==null?void 0:b.result[0];if(g&&De(g))return g.result.signature;throw new Error(`Failed to sign message: ${A(g==null?void 0:g.error)||"Unknown error"}`)},signTypedData:async f=>{var m;const u=o==null?void 0:o.id;if(!u)throw new Error("Chain ID is required for signing messages");const l=await nr({baseUrl:v("engineCloud"),body:{params:[f],signingOptions:c(u)},bodySerializer:A,fetch:T(t),headers:i});if(l.error)throw new Error(`Error signing message: ${A(l.error)}`);const h=(m=l.data)==null?void 0:m.result[0];if(h&&De(h))return h.result.signature;throw new Error(`Failed to sign message: ${A(h==null?void 0:h.error)||"Unknown error"}`)}}}const Co=Object.freeze(Object.defineProperty({__proto__:null,createServerWallet:To,getServerWallets:vo,getTransactionStatus:At,searchTransactions:Eo,serverWallet:So,waitForTransactionHash:_e},Symbol.toStringTag,{value:"Module"}));async function Ee(e){var h;const[{getV1EventsByContractAddress:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-Onbz2awt.js").then(m=>m.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-Onbz2awt.js").then(m=>m.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-5Sx2Oaqw.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-D7Nlzpwh.js").then(m=>m.cS),__vite__mapDeps([4,0,1,2]))]),{client:i,chains:a,contractAddress:c,event:d,queryOptions:p,decodeLogs:f}=e;await o(a);const u={chain:a.map(m=>m.id),decode:f,limit:100};d&&(u.filter_topic_0=d.topics[0],u.filter_topic_1=d.topics[1],u.filter_topic_2=d.topics[2],u.filter_topic_3=d.topics[3]);const l=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contractAddress:c},query:{...u,...p}});if(l.error)throw new Error(`${l.response.status} ${l.response.statusText} - ${l.error?s(l.error):"Unknown error"}`);return((h=l.data)==null?void 0:h.data)??[]}async function Po(e){var h;const[{getV1Nfts:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-Onbz2awt.js").then(m=>m.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-Onbz2awt.js").then(m=>m.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-5Sx2Oaqw.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./index-CFnBXD-E.js"),__vite__mapDeps([5,6,4,0,1,2,7,8,9,10,11]))]),{client:i,chains:a,ownerAddress:c,contractAddresses:d,queryOptions:p}=e;await o(a);const f={chain:a.map(m=>m.id),limit:50,owner_address:[c],contract_address:d||void 0},u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return(await Se(((h=u.data)==null?void 0:h.data)??[],i,c)).map(m=>({...m,quantityOwned:m.quantityOwned??1n}))}async function $o(e){var l;const[{getV1NftsByContractAddress:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-Onbz2awt.js").then(h=>h.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-Onbz2awt.js").then(h=>h.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-5Sx2Oaqw.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-D7Nlzpwh.js").then(h=>h.cS),__vite__mapDeps([4,0,1,2]))]),{client:i,chains:a,contractAddress:c,includeOwners:d=!0,queryOptions:p}=e,f={chain:a.map(h=>h.id),include_owners:d===!0?"true":"false",limit:50};await o(a);const u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contract_address:c},query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return Se(((l=u.data)==null?void 0:l.data)??[],i)}async function Oo(e){var m;const[{getV1NftsByContractAddressByTokenId:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-Onbz2awt.js").then(y=>y.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-Onbz2awt.js").then(y=>y.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-5Sx2Oaqw.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-D7Nlzpwh.js").then(y=>y.cS),__vite__mapDeps([4,0,1,2]))]),{client:i,chain:a,contractAddress:c,tokenId:d,includeOwners:p=!0,queryOptions:f}=e;await o([a]);const u={chain_id:[a.id],include_owners:p===!0?"true":"false"},l=await t({baseUrl:`https://${n().insight}`,fetch:r(i),path:{contract_address:c,token_id:d.toString()},query:{...u,...f}});if(l.error)throw new Error(`${l.response.status} ${l.response.statusText} - ${l.error?s(l.error):"Unknown error"}`);const h=await Se(((m=l.data)==null?void 0:m.data)??[],i);return h==null?void 0:h[0]}async function Se(e,t,n){const[{parseNFT:r},{totalSupply:o}]=await Promise.all([k(()=>import("./parseNft-CwiONVVV.js"),__vite__mapDeps([12,1,2,0,4])),k(()=>import("./totalSupply-BZIagNGM.js"),__vite__mapDeps([13,4,0,1,2,14]))]);return await Promise.all(e.map(async s=>{var w;let i;const{contract:a,extra_metadata:c,collection:d,metadata_url:p,chain_id:f,token_id:u,status:l,balance:h,token_type:m,...y}=s;let _=y,g=n?[U(n)]:void 0;if("owner_addresses"in y){const{owner_addresses:E,...N}=y;_=N,g=g??(E==null?void 0:E.map(P=>U(P)))}const b=Tt({attributes:((w=s.extra_metadata)==null?void 0:w.attributes)??void 0,image:s.image_url,uri:s.metadata_url??"",..._});if((a==null?void 0:a.type)==="erc1155"){const E=await o({contract:X({address:a.address,chain:Y(a.chain_id),client:t}),id:BigInt(u)}).catch(()=>0n);i=r(b,{chainId:(a==null?void 0:a.chain_id)??0,owner:g==null?void 0:g[0],supply:E,tokenAddress:(a==null?void 0:a.address)??"",tokenId:BigInt(u),tokenUri:be(p)??"",type:"ERC1155"})}else i=r(b,{chainId:(a==null?void 0:a.chain_id)??0,owner:g==null?void 0:g[0],tokenAddress:(a==null?void 0:a.address)??"",tokenId:BigInt(u),tokenUri:be(p)??"",type:"ERC721"});return{...i,...(a==null?void 0:a.type)==="erc1155"?{quantityOwned:h?BigInt(h):void 0}:{}}}))}function Tt(e){if(typeof e!="object"||e===null)return e;for(const t in e)typeof e[t]=="string"?e[t]=be(e[t]):Tt(e[t]);return e}function be(e){if(!e||typeof e!="string")return e;try{const t=new URL(e);if(t.host.endsWith(".ipfscdn.io")){const n=t.pathname.split("/"),r=n.findIndex(s=>s==="ipfs");if(r===-1)return e;const o=n.slice(r+1).join("/");return o?`ipfs://${o}`:e}}catch{return e}return e}async function Do(e){var l;const[{getV1Tokens:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-Onbz2awt.js").then(h=>h.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-Onbz2awt.js").then(h=>h.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-5Sx2Oaqw.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-D7Nlzpwh.js").then(h=>h.cS),__vite__mapDeps([4,0,1,2]))]),{client:i,chains:a,ownerAddress:c,tokenAddresses:d,queryOptions:p}=e;await o(a);const f={chain_id:a.length>0?a.map(h=>h.id):[1],include_native:"true",include_spam:"false",limit:50,metadata:"true",owner_address:[c],token_address:d||void 0,sort_by:"balance",sort_order:"desc"},u=await t({baseUrl:`https://${n().insight}`,fetch:r(i),query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return zo(((l=u.data)==null?void 0:l.data)??[])}async function zo(e){const{toTokens:t}=await k(async()=>{const{toTokens:n}=await import("./signing-D7Nlzpwh.js").then(r=>r.cT);return{toTokens:n}},__vite__mapDeps([4,0,1,2]));return e.map(n=>{const r=n.decimals??18,o=BigInt(n.balance);return{chainId:n.chain_id,decimals:r,displayValue:t(o,r),name:n.name??"",symbol:n.symbol??"",tokenAddress:n.token_address,value:o}})}async function Ro(e){const[{getV1WalletsByWalletAddressTransactions:t},{getThirdwebDomains:n},{getClientFetch:r},{assertInsightEnabled:o},{stringify:s}]=await Promise.all([k(()=>import("./thirdweb-DZ2vK6IO.js"),[]),k(()=>import("./utils-Onbz2awt.js").then(l=>l.q),__vite__mapDeps([0,1,2])),k(()=>import("./utils-Onbz2awt.js").then(l=>l.r),__vite__mapDeps([0,1,2])),k(()=>import("./common-5Sx2Oaqw.js"),__vite__mapDeps([3,0,1,2])),k(()=>import("./signing-D7Nlzpwh.js").then(l=>l.cS),__vite__mapDeps([4,0,1,2]))]);await o(e.chains);const i=Math.floor((Date.now()-3*30*24*60*60*1e3)/1e3),{client:a,walletAddress:c,chains:d,queryOptions:p}=e,f={chain:d.map(l=>l.id),filter_block_timestamp_gte:i,limit:100},u=await t({baseUrl:`https://${n().insight}`,fetch:r(a),path:{wallet_address:c},query:{...f,...p}});if(u.error)throw new Error(`${u.response.status} ${u.response.statusText} - ${u.error?s(u.error):"Unknown error"}`);return u.data.data||[]}const Bo=Object.freeze(Object.defineProperty({__proto__:null,getContractEvents:Ee,getContractNFTs:$o,getNFT:Oo,getOwnedNFTs:Po,getOwnedTokens:Do,getTransactions:Ro},Symbol.toStringTag,{value:"Module"}));async function No(e,t){const n=t.includeTransactions??!1,r=await e({method:"eth_getBlockByHash",params:[t.blockHash,n]});if(!r)throw new Error("Block not found");return Dt(r)}async function ke(e,t={}){const n=t.topics??[];let r;if(t.blockHash){const o={blockHash:t.blockHash,topics:n};t.address&&(o.address=U(t.address)),r=await e({method:"eth_getLogs",params:[o]})}else{const o={topics:n};t.address&&(o.address=t.address),t.fromBlock&&(o.fromBlock=typeof t.fromBlock=="bigint"?F(t.fromBlock):t.fromBlock),t.toBlock&&(o.toBlock=typeof t.toBlock=="bigint"?F(t.toBlock):t.toBlock),r=await e({method:"eth_getLogs",params:[o]})}return r.map(o=>Xe(o))}async function jo(e,t){const n=await e({method:"eth_getTransactionByHash",params:[t.hash]});if(!n)throw new Error("Transaction not found.");return zt(n)}async function vt(e){var u;const{contract:t,events:n,blockRange:r,useIndexer:o=!0,...s}=e,i=Ie(t);if(s.blockHash&&(r||s.fromBlock||s.toBlock))throw new Error("Cannot specify blockHash and range simultaneously,");const a=await Qe(i);if(r){const{fromBlock:l,toBlock:h}=s;if(l!==void 0&&h!==void 0&&BigInt(h)-BigInt(l)!==BigInt(r))throw new Error("Incompatible blockRange with specified fromBlock and toBlock. Please only define fromBlock or toBlock when specifying blockRange.");l!==void 0?s.toBlock=BigInt(l)+BigInt(r)-1n:h!==void 0?s.fromBlock=BigInt(h)-BigInt(r)+1n:(s.toBlock=a,s.fromBlock=a-BigInt(r)+1n)}let c=n??[];if(!(n!=null&&n.length)&&t){if(o){const l=await Ee({chains:[t.chain],client:t.client,contractAddress:t.address,decodeLogs:!0,queryOptions:{filter_block_hash:s.blockHash,filter_block_number_gte:s.fromBlock,filter_block_number_lte:s.toBlock,limit:500}}).catch(()=>null);if(l)return Et(l)}(u=t.abi)!=null&&u.length?c=t.abi.filter(Ce).map(l=>he({signature:l})):c=(await We(t)).filter(Ce).map(h=>he({signature:h}))}const d=n&&n.length>0?n.map(l=>({...s,address:U(t.address),topics:l.topics})):[{...s,address:U(t.address)}];let p=[];if(o)try{p=await Promise.all(d.map(l=>xo({contract:t,params:l})))}catch(l){console.warn("Error fetching from insight, falling back to rpc",l),p=await Promise.all(d.map(h=>ke(i,h)))}else p=await Promise.all(d.map(l=>ke(i,l)));const f=p.flat().sort((l,h)=>Number((l.blockNumber??0n)-(h.blockNumber??0n)));return Ve({events:c,logs:f})}async function xo(e){var i,a,c,d;const{params:t,contract:n}=e,r=typeof t.fromBlock=="bigint"?Number(t.fromBlock):void 0,o=typeof t.toBlock=="bigint"?Number(t.toBlock):void 0,s=await Ee({chains:[n.chain],client:n.client,contractAddress:n.address,queryOptions:{filter_block_hash:t.blockHash,filter_block_number_gte:r,filter_block_number_lte:o,filter_topic_0:(i=t.topics)==null?void 0:i[0],filter_topic_1:(a=t.topics)==null?void 0:a[1],filter_topic_2:(c=t.topics)==null?void 0:c[2],filter_topic_3:(d=t.topics)==null?void 0:d[3],limit:500}});return Et(s)}function Et(e){return e.map(n=>({address:n.address,blockHash:n.block_hash,blockNumber:F(Number(n.block_number)),blockTimestamp:n.block_timestamp,chainId:n.chain_id,data:n.data,logIndex:F(n.log_index),topics:n.topics,transactionHash:n.transaction_hash,transactionIndex:F(n.transaction_index),...n.decoded?{args:{...n.decoded.indexed_params,...n.decoded.non_indexed_params},eventName:n.decoded.name}:{}})).map(n=>Xe(n)).sort((n,r)=>Number((n.blockNumber??0n)-(r.blockNumber??0n)))}async function Uo(e,t){const n=t.retries,r=t.delay;let o=null;for(let s=0;s<n;s++)try{return await e()}catch(i){o=i,await new Promise(a=>setTimeout(a,r))}throw o}function Lo(e){return Ye({...e.contract,latestBlockNumber:e.latestBlockNumber,onNewBlockNumber:async t=>{const n=await Uo(async()=>vt({...e,fromBlock:t,toBlock:t,useIndexer:!1}),{delay:500,retries:3});n.length&&e.onEvents(n)}})}const Mo=()=>{const e=$t().pay;return e.startsWith("localhost")?`http://${e}`:`https://${e}`},qo=()=>`${Mo()}/buy-with-crypto/history/v1`;async function Fo(e){try{const t=new URLSearchParams;t.append("walletAddress",e.walletAddress),t.append("start",e.start.toString()),t.append("count",e.count.toString());const n=t.toString(),r=`${qo()}?${n}`,o=await T(e.client)(r);if(!o.ok){const i=await o.text().catch(()=>null);throw new Error(`HTTP error! status: ${o.status} - ${o.statusText}: ${i||"unknown error"}`)}return(await o.json()).result}catch(t){throw new Error(`Fetch failed: ${t}`)}}const Wo=[Dn.id,zn.id,Rn.id,Bn.id,Nn.id,jn.id,34443,919,42220,44787,204,5611];async function Vo(e){if(e.id===1337||e.id===31337)return!1;if(Wo.includes(e.id))return!0;try{const{getChainMetadata:t}=await k(async()=>{const{getChainMetadata:r}=await import("./utils-Onbz2awt.js").then(o=>o.u);return{getChainMetadata:r}},__vite__mapDeps([0,1,2]));return(await t(e)).stackType==="optimism_bedrock"}catch{return!1}}async function Zo(e){var c;const{transaction:t}=e,n=e.from??((c=e.account)==null?void 0:c.address)??void 0,r=await j(t.gas)||await Ze({from:n,transaction:t}),o=await Rt(t.client,t.chain),s=o.maxFeePerGas||o.gasPrice;if(s===void 0)throw new Error(`Unable to determine gas price for chain ${t.chain.id}`);let i;if(await Vo(t.chain)){const{estimateL1Fee:d}=await k(async()=>{const{estimateL1Fee:p}=await import("./estimate-l1-fee-n2GS47w0.js");return{estimateL1Fee:p}},__vite__mapDeps([15,4,0,1,2]));i=await d({transaction:t})}else i=0n;const a=r*s+i;return{ether:He(a),wei:a}}async function Ho(e){try{const t=await(async()=>{if(e.toAmount){const d=X({address:e.toTokenAddress,chain:Y(e.toChainId),client:e.client}),p=d.address.toLowerCase()===Ae?18:await pe({contract:d}),f=me(e.toAmount,p);return it({amount:f,client:e.client,destinationChainId:e.toChainId,destinationTokenAddress:e.toTokenAddress,originChainId:e.fromChainId,originTokenAddress:e.fromTokenAddress,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress})}else if(e.fromAmount){const d=X({address:e.fromTokenAddress,chain:Y(e.fromChainId),client:e.client}),p=await pe({contract:d}),f=me(e.fromAmount,p);return at({amount:f,client:e.client,destinationChainId:e.toChainId,destinationTokenAddress:e.toTokenAddress,originChainId:e.fromChainId,originTokenAddress:e.fromTokenAddress,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress})}throw new Error("Invalid quote request, must provide either `fromAmount` or `toAmount`")})(),n=t.steps[0];if(!n)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const r=n.transactions.filter(d=>d.action==="approval");if(r.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const o=r[0],s=n.transactions.filter(d=>d.action!=="approval");if(s.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");const i=s[0];if(!i)throw new Error("This quote is incompatible with getBuyWithCryptoQuote. Please use Bridge.Buy.prepare instead.");let a;if(o){const d=Ke(["function approve(address spender, uint256 amount)"]),[p,f]=Je(d,o.data);a={amountWei:f.toString(),chainId:n.originToken.chainId,spenderAddress:p,tokenAddress:n.originToken.address}}return{approvalData:a,client:e.client,paymentTokens:[{amount:$(t.originAmount,n.originToken.decimals).toString(),amountUSDCents:Number($(t.originAmount,n.originToken.decimals))*(n.originToken.prices.USD||0)*100,amountWei:t.originAmount.toString(),token:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address}}],processingFees:[{amount:"0",amountUSDCents:0,amountWei:"0",token:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address}}],swapDetails:{estimated:{durationSeconds:n.estimatedExecutionTimeMs/1e3,feesUSDCents:0,fromAmountUSDCents:Number($(t.originAmount,n.originToken.decimals))*(n.originToken.prices.USD||0)*100,gasCostUSDCents:0,slippageBPS:0,toAmountMinUSDCents:Number($(t.destinationAmount,n.destinationToken.decimals))*(n.destinationToken.prices.USD||0)*100,toAmountUSDCents:Number($(t.destinationAmount,n.destinationToken.decimals))*(n.destinationToken.prices.USD||0)*100},fromAddress:t.intent.sender,fromAmount:$(t.originAmount,n.originToken.decimals).toString(),fromAmountWei:t.originAmount.toString(),fromToken:{chainId:n.originToken.chainId,decimals:n.originToken.decimals,name:n.originToken.name,priceUSDCents:(n.originToken.prices.USD||0)*100,symbol:n.originToken.symbol,tokenAddress:n.originToken.address},maxSlippageBPS:0,toAddress:t.intent.receiver,toAmount:$(t.destinationAmount,n.destinationToken.decimals).toString(),toAmountMin:$(t.destinationAmount,n.destinationToken.decimals).toString(),toAmountMinWei:t.destinationAmount.toString(),toAmountWei:t.destinationAmount.toString(),toToken:{chainId:n.destinationToken.chainId,decimals:n.destinationToken.decimals,name:n.destinationToken.name,priceUSDCents:(n.destinationToken.prices.USD||0)*100,symbol:n.destinationToken.symbol,tokenAddress:n.destinationToken.address}},transactionRequest:{...i,extraGas:50000n}}}catch(t){throw console.error("Error getting buy with crypto quote",t),t}}async function Ko(e){var t,n,r,o;try{if(!e.transactionHash)throw new Error("Transaction hash is required");const s=await ct({chainId:e.chainId,client:e.client,transactionHash:e.transactionHash});switch(s.status){case"COMPLETED":{const i=(t=s.transactions)==null?void 0:t.find(c=>c.chainId===e.chainId),a=(n=s.transactions)==null?void 0:n.find(c=>c.chainId!==e.chainId);return fe({destinationAmount:s.destinationAmount,destinationChainId:s.destinationChainId,destinationToken:s.destinationToken,destinationTokenAddress:s.destinationTokenAddress,destinationTransaction:a,originAmount:s.originAmount,originChainId:s.originChainId,originToken:s.originToken,originTokenAddress:s.originTokenAddress,originTransaction:i,paymentId:s.paymentId,purchaseData:s.purchaseData,receiver:s.receiver,sender:s.sender,status:s.status})}case"PENDING":return fe({destinationChainId:s.destinationChainId,destinationToken:s.destinationToken,destinationTokenAddress:s.destinationTokenAddress,originAmount:s.originAmount,originChainId:s.originChainId,originToken:s.originToken,originTokenAddress:s.originTokenAddress,paymentId:s.paymentId,purchaseData:s.purchaseData,receiver:s.receiver,sender:s.sender,status:s.status});case"FAILED":{const i=(r=s.transactions)==null?void 0:r.find(c=>c.chainId===e.chainId),a=(o=s.transactions)==null?void 0:o.find(c=>c.chainId!==e.chainId);return fe({destinationChainId:0,destinationToken:void 0,destinationTokenAddress:"",destinationTransaction:a,originAmount:BigInt(0),originChainId:0,originToken:void 0,originTokenAddress:"",originTransaction:i,paymentId:"",purchaseData:s.purchaseData,receiver:"",sender:"",status:s.status})}default:return{status:"NOT_FOUND"}}}catch(s){throw console.error("Fetch error:",s),new Error(`Fetch failed: ${s}`)}}function fe(e){const{originTransaction:t,destinationTransaction:n,status:r,purchaseData:o,originAmount:s,destinationAmount:i,originTokenAddress:a,destinationTokenAddress:c,originChainId:d,destinationChainId:p,sender:f,receiver:u,originToken:l,destinationToken:h}=e;return{bridge:"STARPORT",destination:{amount:h?q(i??BigInt(0),h.decimals).toString():"",amountUSDCents:0,amountWei:(i==null?void 0:i.toString())??"",completedAt:new Date().toISOString(),explorerLink:"",token:{chainId:p,decimals:(h==null?void 0:h.decimals)??18,name:(h==null?void 0:h.name)??"",priceUSDCents:0,symbol:(h==null?void 0:h.symbol)??"",tokenAddress:c},transactionHash:(n==null?void 0:n.transactionHash)??""},fromAddress:f,purchaseData:o,quote:{createdAt:new Date().toISOString(),estimated:{durationSeconds:0,feesUSDCents:0,fromAmountUSDCents:0,gasCostUSDCents:0,slippageBPS:0,toAmountMinUSDCents:0,toAmountUSDCents:0},fromAmount:l?q(s,l.decimals).toString():"",fromAmountWei:s.toString(),fromToken:{chainId:d,decimals:(l==null?void 0:l.decimals)??18,name:(l==null?void 0:l.name)??"",priceUSDCents:0,symbol:(l==null?void 0:l.symbol)??"",tokenAddress:a},toAmount:h&&i?q(i,h.decimals).toString():"",toAmountMin:h?q(i??BigInt(0),h.decimals).toString():"",toAmountMinWei:i?i.toString():"",toAmountWei:i?i.toString():"",toToken:{chainId:p,decimals:(h==null?void 0:h.decimals)??18,name:(h==null?void 0:h.name)??"",priceUSDCents:0,symbol:(h==null?void 0:h.symbol)??"",tokenAddress:c}},source:{amount:l?q(s,l.decimals).toString():"",amountUSDCents:0,amountWei:s.toString(),completedAt:new Date().toISOString(),explorerLink:"",token:{chainId:d,decimals:(l==null?void 0:l.decimals)??18,name:(l==null?void 0:l.name)??"",priceUSDCents:0,symbol:(l==null?void 0:l.symbol)??"",tokenAddress:a},transactionHash:(t==null?void 0:t.transactionHash)??""},status:r,subStatus:r==="COMPLETED"?"SUCCESS":"NONE",swapType:(t==null?void 0:t.chainId)===(n==null?void 0:n.chainId)?"SAME_CHAIN":"CROSS_CHAIN",toAddress:u}}async function Jo(e){try{const t=X({address:e.tokenAddress,chain:Y(e.chainId),client:e.client}),n=t.address.toLowerCase()===Ae?18:await pe({contract:t}),r=me(e.amount,n),o=await dt({amount:r,chainId:e.chainId,client:e.client,feePayer:e.feePayer,paymentLinkId:e.paymentLinkId,purchaseData:e.purchaseData,receiver:e.toAddress,sender:e.fromAddress,tokenAddress:e.tokenAddress}),s=o.steps[0];if(!s)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const i=s.transactions.filter(u=>u.action==="approval");if(i.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const a=i[0];let c;if(a){const u=Ke(["function approve(address spender, uint256 amount)"]),[l,h]=Je(u,a.data);c={amountWei:h.toString(),chainId:s.originToken.chainId,spenderAddress:l,tokenAddress:s.originToken.address}}const d=s.transactions.filter(u=>u.action!=="approval");if(d.length>1)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");const p=d[0];if(!p)throw new Error("This quote is incompatible with getBuyWithCryptoTransfer. Please use Bridge.Transfer.prepare instead.");return{approvalData:c,client:e.client,estimatedGasCostUSDCents:0,fromAddress:e.fromAddress,paymentToken:{amount:$(o.originAmount,s.originToken.decimals).toString(),amountUSDCents:Number($(o.originAmount,s.originToken.decimals))*(s.originToken.prices.USD||0)*100,amountWei:o.originAmount.toString(),token:{chainId:s.originToken.chainId,decimals:s.originToken.decimals,name:s.originToken.name,priceUSDCents:(s.originToken.prices.USD||0)*100,symbol:s.originToken.symbol,tokenAddress:s.originToken.address}},processingFee:{amount:e.feePayer==="sender"?$(o.originAmount-o.destinationAmount,s.originToken.decimals).toString():"0",amountUSDCents:e.feePayer==="sender"?Number($(o.originAmount-o.destinationAmount,s.originToken.decimals))*(s.originToken.prices.USD||0)*100:0,amountWei:e.feePayer==="sender"?(o.originAmount-o.destinationAmount).toString():"0",token:{chainId:s.originToken.chainId,decimals:s.originToken.decimals,name:s.originToken.name,priceUSDCents:(s.originToken.prices.USD||0)*100,symbol:s.originToken.symbol,tokenAddress:s.originToken.address}},toAddress:e.toAddress,transactionRequest:{...p,extraGas:50000n}}}catch(t){throw console.error("Error getting buy with crypto transfer",t),t}}async function Go(e){var c;const[t,n,r,o]=await Promise.all([re(e.transaction),j(e.transaction.to),j(e.transaction.accessList),j(e.transaction.value)]),s=e.from??((c=e.account)==null?void 0:c.address)??void 0,i=Bt({accessList:r,data:t,from:s?U(s):void 0,to:n?U(n):void 0,value:o}),a=Ie(e.transaction);try{const d=await Ge(a,i);if(!e.transaction.__preparedMethod)return d;const p=await e.transaction.__preparedMethod(),f=Nt(p[2],d);return Array.isArray(f)&&f.length===1?f[0]:f}catch(d){throw await jt({contract:e.transaction.__contract,error:d,fromAddress:s})}}function Qo(e){return async t=>{var o;if(typeof e=="string"&&e.startsWith("function "))return xt(e);const r=((o=t.abi)!=null&&o.length?t.abi:await We(t)).find(s=>s.type!=="function"?!1:s.name===e);if(!r)throw new Error(`could not find function with name "${e}" in abi`);return r}}function Yo(e){return typeof e=="object"&&e!==null}function je(e,t=[]){return Yo(e)&&t.every(n=>n in e)}function Xo(e){return je(e,["__contract"])&&je(e.__contract,["address","chain"])&&typeof e.__contract.address=="string"}async function es({address:e,signature:t,client:n,chain:r,accountFactory:o,message:s,domain:i,primaryType:a,types:c}){const d=Ut({domain:i,message:s,primaryType:a,types:c});if(!ie(t))return!1;try{if(Lt({payload:d,signature:Mt(t)}).toLowerCase()===e.toLowerCase())return!0}catch{}return qt({accountFactory:o,address:e,chain:r,client:n,hash:d,signature:t})}async function ts(e){const{account:t,request:n}=e;if(typeof t.signAuthorization>"u")throw new Error("This account type does not yet support signing EIP-7702 authorizations");return t.signAuthorization(n)}const hs=Object.freeze(Object.defineProperty({__proto__:null,ADDRESS_ZERO:Pe,Bridge:ko,Engine:Co,Insight:Bo,NATIVE_TOKEN_ADDRESS:Ae,ZERO_ADDRESS:Pe,boolToBytes:kn,boolToHex:hn,bytesToBigInt:an,bytesToBool:cn,bytesToNumber:dn,bytesToString:un,concatHex:fn,createThirdwebClient:Ao,defineChain:ee,deploySmartAccount:En,encode:re,estimateGas:Ze,estimateGasCost:Zo,eth_blockNumber:Qe,eth_call:Ge,eth_estimateGas:Pn,eth_gasPrice:Ft,eth_getBalance:Wt,eth_getBlockByHash:No,eth_getBlockByNumber:Vt,eth_getCode:Zt,eth_getLogs:ke,eth_getStorageAt:$n,eth_getTransactionByHash:jo,eth_getTransactionCount:On,eth_getTransactionReceipt:Sn,eth_maxPriorityFeePerGas:Ht,eth_sendRawTransaction:Kt,fromBytes:ln,fromGwei:rn,fromHex:mn,getAddress:U,getBuyWithCryptoHistory:Fo,getBuyWithCryptoQuote:Ho,getBuyWithCryptoStatus:Ko,getBuyWithCryptoTransfer:Jo,getContract:X,getContractEvents:vt,getGasPrice:Gt,getRpcClient:Ie,getUser:Jt,hexToBigInt:pn,hexToBool:gn,hexToBytes:In,hexToNumber:yn,hexToString:wn,hexToUint8Array:Ue,isAddress:xe,isBaseTransactionOptions:Xo,isHex:ie,keccak256:vn,numberToBytes:An,numberToHex:F,padHex:_n,parseEventLogs:Ve,prepareContractCall:Xt,prepareEvent:he,prepareTransaction:en,readContract:tn,resolveMethod:Qo,sendAndConfirmTransaction:xn,sendBatchTransaction:Un,sendTransaction:Qt,serializeTransaction:nn,sha256:It,signAuthorization:ts,signTransaction:Yt,simulateTransaction:Go,stringToBytes:Me,stringToHex:bn,toBytes:Tn,toEther:He,toHex:qe,toSerializableTransaction:Fe,toTokens:q,toUnits:on,toWei:sn,uint8ArrayToHex:Le,verifyTypedData:es,waitForReceipt:Cn,watchBlockNumber:Ye,watchContractEvents:Lo},Symbol.toStringTag,{value:"Module"}));export{Oo as g,hs as t};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/resolveImplementation-2abc0dxK.js","assets/get-bytecode-FPC_G1PK.js","assets/types-DFEAKZ3L.js","assets/index-B6-Xobl2.js","assets/index-D2E7Umr3.css","assets/read-contract-D8CQ_i-D.js","assets/utils-BtpzmIxp.js","assets/extractIPFS-tOg-rRc-.js","assets/getInstalledModules-cmepPgT8.js","assets/eth_estimateGas-DVJqp0a0.js","assets/concat-hex-D_Hd0Y8j.js","assets/send-eip712-transaction-q3anVEgs.js","assets/eth_sendRawTransaction-DPdnXbFR.js","assets/sha256-BPZogG9w.js","assets/eth_getTransactionCount-CMQovf3i.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as Be,n as wt,_ as w,T as Se,w as Pt,o as At,z as he}from"./index-B6-Xobl2.js";import{B as l,s as x,d as Te,i as Fe,j as vt,v as $t,S as Me,w as h,x as T,y as Et,I as It,z as _t,A as K,f as _,h as te,C as oe,D as Bt,E as St,e as Tt,a as ae,b as Ft,n as Mt,o as Ot,g as S}from"./types-DFEAKZ3L.js";const Rt="1.0.8";class m extends Error{constructor(t,n={}){var s;const r=n.cause instanceof m?n.cause.details:(s=n.cause)!=null&&s.message?n.cause.message:n.details,i=n.cause instanceof m&&n.cause.docsPath||n.docsPath,o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${Rt}`].join(`
|
|
3
|
+
`);super(o),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.shortMessage=t}}function I(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Oe=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Re=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Le=/^\(.+?\).*?$/,me=/^tuple(?<array>(\[(\d*)\])*)$/;function ne(e){let t=e.type;if(me.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let i=0;i<n;i++){const o=e.components[i];t+=ne(o),i<n-1&&(t+=", ")}const r=I(me,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,ne({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function G(e){let t="";const n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=ne(i),r!==n-1&&(t+=", ")}return t}function Lt(e){var t;return e.type==="function"?`function ${e.name}(${G(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${G(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${G(e.inputs)})`:e.type==="error"?`error ${e.name}(${G(e.inputs)})`:e.type==="constructor"?`constructor(${G(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function kt(e){const t=[],n=e.length;for(let r=0;r<n;r++){const i=e[r],o=Lt(i);t.push(o)}return t}const ke=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Gt(e){return ke.test(e)}function Ct(e){return I(ke,e)}const Ge=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function zt(e){return Ge.test(e)}function Ut(e){return I(Ge,e)}const Ce=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Dt(e){return Ce.test(e)}function jt(e){return I(Ce,e)}const ze=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ue(e){return ze.test(e)}function Nt(e){return I(ze,e)}const De=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Vt(e){return De.test(e)}function Ht(e){return I(De,e)}const je=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Wt(e){return je.test(e)}function Zt(e){return I(je,e)}const Kt=/^receive\(\) external payable$/;function Yt(e){return Kt.test(e)}const Xt=new Set(["indexed"]),re=new Set(["calldata","memory","storage"]);class _i extends m{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Jt extends m{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Qt extends m{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class qt extends m{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class en extends m{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class tn extends m{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class nn extends m{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class rn extends m{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class L extends m{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class sn extends m{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class on extends m{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class an extends m{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class cn extends m{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function un(e,t,n){let r="";if(n)for(const i of Object.entries(n)){if(!i)continue;let o="";for(const s of i[1])o+=`[${s.type}${s.name?`:${s.name}`:""}]`;r+=`(${i[0]}{${o}})`}return t?`${t}:${e}${r}`:e}const X=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function dn(e,t={}){if(Dt(e))return ln(e,t);if(zt(e))return fn(e,t);if(Gt(e))return pn(e,t);if(Vt(e))return yn(e,t);if(Wt(e))return hn(e);if(Yt(e))return{type:"receive",stateMutability:"payable"};throw new sn({signature:e})}function ln(e,t={}){const n=jt(e);if(!n)throw new L({signature:e,type:"function"});const r=$(n.parameters),i=[],o=r.length;for(let a=0;a<o;a++)i.push(F(r[a],{modifiers:re,structs:t,type:"function"}));const s=[];if(n.returns){const a=$(n.returns),c=a.length;for(let u=0;u<c;u++)s.push(F(a[u],{modifiers:re,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:i,outputs:s}}function fn(e,t={}){const n=Ut(e);if(!n)throw new L({signature:e,type:"event"});const r=$(n.parameters),i=[],o=r.length;for(let s=0;s<o;s++)i.push(F(r[s],{modifiers:Xt,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:i}}function pn(e,t={}){const n=Ct(e);if(!n)throw new L({signature:e,type:"error"});const r=$(n.parameters),i=[],o=r.length;for(let s=0;s<o;s++)i.push(F(r[s],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:i}}function yn(e,t={}){const n=Ht(e);if(!n)throw new L({signature:e,type:"constructor"});const r=$(n.parameters),i=[],o=r.length;for(let s=0;s<o;s++)i.push(F(r[s],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:i}}function hn(e){const t=Zt(e);if(!t)throw new L({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const mn=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,gn=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,bn=/^u?int$/;function F(e,t){var p,f;const n=un(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(X.has(n))return X.get(n);const r=Le.test(e),i=I(r?gn:mn,e);if(!i)throw new qt({param:e});if(i.name&&wn(i.name))throw new en({param:e,name:i.name});const o=i.name?{name:i.name}:{},s=i.modifier==="indexed"?{indexed:!0}:{},a=(t==null?void 0:t.structs)??{};let c,u={};if(r){c="tuple";const y=$(i.type),P=[],A=y.length;for(let v=0;v<A;v++)P.push(F(y[v],{structs:a}));u={components:P}}else if(i.type in a)c="tuple",u={components:a[i.type]};else if(bn.test(i.type))c=`${i.type}256`;else if(c=i.type,(t==null?void 0:t.type)!=="struct"&&!Ne(c))throw new Qt({type:c});if(i.modifier){if(!((f=(p=t==null?void 0:t.modifiers)==null?void 0:p.has)!=null&&f.call(p,i.modifier)))throw new tn({param:e,type:t==null?void 0:t.type,modifier:i.modifier});if(re.has(i.modifier)&&!Pn(c,!!i.array))throw new nn({param:e,type:t==null?void 0:t.type,modifier:i.modifier})}const d={type:`${c}${i.array??""}`,...o,...s,...u};return X.set(n,d),d}function $(e,t=[],n="",r=0){const i=e.trim().length;for(let o=0;o<i;o++){const s=e[o],a=e.slice(o+1);switch(s){case",":return r===0?$(a,[...t,n.trim()]):$(a,t,`${n}${s}`,r);case"(":return $(a,t,`${n}${s}`,r+1);case")":return $(a,t,`${n}${s}`,r-1);default:return $(a,t,`${n}${s}`,r)}}if(n==="")return t;if(r!==0)throw new cn({current:n,depth:r});return t.push(n.trim()),t}function Ne(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Oe.test(e)||Re.test(e)}const xn=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function wn(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Oe.test(e)||Re.test(e)||xn.test(e)}function Pn(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function An(e){const t={},n=e.length;for(let s=0;s<n;s++){const a=e[s];if(!Ue(a))continue;const c=Nt(a);if(!c)throw new L({signature:a,type:"struct"});const u=c.properties.split(";"),d=[],p=u.length;for(let f=0;f<p;f++){const P=u[f].trim();if(!P)continue;const A=F(P,{type:"struct"});d.push(A)}if(!d.length)throw new on({signature:a});t[c.name]=d}const r={},i=Object.entries(t),o=i.length;for(let s=0;s<o;s++){const[a,c]=i[s];r[a]=Ve(c,t)}return r}const vn=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Ve(e,t,n=new Set){const r=[],i=e.length;for(let o=0;o<i;o++){const s=e[o];if(Le.test(s.type))r.push(s);else{const c=I(vn,s.type);if(!(c!=null&&c.type))throw new rn({abiParameter:s});const{array:u,type:d}=c;if(d in t){if(n.has(d))throw new an({type:d});r.push({...s,type:`tuple${u??""}`,components:Ve(t[d]??[],t,new Set([...n,d]))})}else if(Ne(d))r.push(s);else throw new Jt({type:d})}}return r}function $n(e){const t=An(e),n=[],r=e.length;for(let i=0;i<r;i++){const o=e[i];Ue(o)||n.push(dn(o,t))}return n}function En(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Bi=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Si=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Ti=/^\(.+?\).*?$/,ge=/^tuple(?<array>(\[(\d*)\])*)$/;function ie(e){let t=e.type;if(ge.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let i=0;i<n;i++){const o=e.components[i];t+=ie(o),i<n-1&&(t+=", ")}const r=En(ge,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,ie({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function C(e){let t="";const n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=ie(i),r!==n-1&&(t+=", ")}return t}function In(e){var t;return e.type==="function"?`function ${e.name}(${C(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${C(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${C(e.inputs)})`:e.type==="error"?`error ${e.name}(${C(e.inputs)})`:e.type==="constructor"?`constructor(${C(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function H(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new kn(e.type);return`${e.name}(${Y(e.inputs,{includeName:t})})`}function Y(e,{includeName:t=!1}={}){return e?e.map(n=>_n(n,{includeName:t})).join(t?", ":","):""}function _n(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Y(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class Fi extends l{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
4
|
+
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Mi extends l{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
5
|
+
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Oi extends l{constructor({data:t,size:n}){super([`Data size of ${n} bytes is invalid.`,"Size must be in increments of 32 bytes (size % 32 === 0)."].join(`
|
|
6
|
+
`),{metaMessages:[`Data: ${t} (${n} bytes)`],name:"AbiDecodingDataSizeInvalidError"})}}class Bn extends l{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
7
|
+
`),{metaMessages:[`Params: (${Y(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=n,this.size=r}}class He extends l{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class Sn extends l{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
8
|
+
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class Tn extends l{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${x(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class Fn extends l{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
9
|
+
`),{name:"AbiEncodingLengthMismatchError"})}}class Ri extends l{constructor(t,{docsPath:n}){super([`Arguments (\`args\`) were provided to "${t}", but "${t}" on the ABI does not contain any parameters (\`inputs\`).`,"Cannot encode error result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the inputs exist on it."].join(`
|
|
10
|
+
`),{docsPath:n,name:"AbiErrorInputsNotFoundError"})}}class Li extends l{constructor(t,{docsPath:n}={}){super([`Error ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it."].join(`
|
|
11
|
+
`),{docsPath:n,name:"AbiErrorNotFoundError"})}}class Mn extends l{constructor(t,{docsPath:n}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
12
|
+
`),{docsPath:n,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class ki extends l{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Gi extends l{constructor(t,{docsPath:n}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
13
|
+
`),{docsPath:n,name:"AbiEventSignatureNotFoundError"})}}class Ci extends l{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
|
|
14
|
+
`),{docsPath:n,name:"AbiEventNotFoundError"})}}class zi extends l{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
15
|
+
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}}class Ui extends l{constructor(t,{docsPath:n}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
16
|
+
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}}class Di extends l{constructor(t,{docsPath:n}){super([`Encoded function signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
17
|
+
`),{docsPath:n,name:"AbiFunctionSignatureNotFoundError"})}}class ji extends l{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${H(t.abiItem)}\`, and`,`\`${n.type}\` in \`${H(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class Ni extends l{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}}class Vi extends l{constructor({abiItem:t,data:n,params:r,size:i}){super([`Data size of ${i} bytes is too small for non-indexed event parameters.`].join(`
|
|
18
|
+
`),{metaMessages:[`Params: (${Y(r,{includeName:!0})})`,`Data: ${n} (${i} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=n,this.params=r,this.size=i}}class Hi extends l{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${H(t,{includeName:!0})}".`].join(`
|
|
19
|
+
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class On extends l{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
20
|
+
`),{docsPath:n,name:"InvalidAbiEncodingType"})}}class Rn extends l{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
21
|
+
`),{docsPath:n,name:"InvalidAbiDecodingType"})}}class Ln extends l{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
22
|
+
`),{name:"InvalidArrayError"})}}class kn extends l{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
23
|
+
`),{name:"InvalidDefinitionTypeError"})}}class Wi extends l{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}const V=BigInt(2**32-1),be=BigInt(32);function Gn(e,t=!1){return t?{h:Number(e&V),l:Number(e>>be&V)}:{h:Number(e>>be&V)|0,l:Number(e&V)|0}}function Cn(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let o=0;o<n;o++){const{h:s,l:a}=Gn(e[o],t);[r[o],i[o]]=[s,a]}return[r,i]}const zn=(e,t,n)=>e<<n|t>>>32-n,Un=(e,t,n)=>t<<n|e>>>32-n,Dn=(e,t,n)=>t<<n-32|e>>>64-n,jn=(e,t,n)=>e<<n-32|t>>>64-n,M=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Nn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function W(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function D(e,...t){if(!Nn(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Zi(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");W(e.outputLen),W(e.blockLen)}function xe(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Vn(e,t){D(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Hn(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function We(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function Ki(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Yi(e,t){return e<<32-t|e>>>t}function Xi(e,t){return e<<t|e>>>32-t>>>0}const Wn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Zn(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Kn(e){for(let t=0;t<e.length;t++)e[t]=Zn(e[t]);return e}const we=Wn?e=>e:Kn;function Yn(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ze(e){return typeof e=="string"&&(e=Yn(e)),D(e),e}function Ji(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];D(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const o=e[r];n.set(o,i),i+=o.length}return n}class Xn{}function Jn(e){const t=r=>e().update(Ze(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Qi(e=32){if(M&&typeof M.getRandomValues=="function")return M.getRandomValues(new Uint8Array(e));if(M&&typeof M.randomBytes=="function")return Uint8Array.from(M.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Qn=BigInt(0),z=BigInt(1),qn=BigInt(2),er=BigInt(7),tr=BigInt(256),nr=BigInt(113),Ke=[],Ye=[],Xe=[];for(let e=0,t=z,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ke.push(2*(5*r+n)),Ye.push((e+1)*(e+2)/2%64);let i=Qn;for(let o=0;o<7;o++)t=(t<<z^(t>>er)*nr)%tr,t&qn&&(i^=z<<(z<<BigInt(o))-z);Xe.push(i)}const Je=Cn(Xe,!0),rr=Je[0],ir=Je[1],Pe=(e,t,n)=>n>32?Dn(e,t,n):zn(e,t,n),Ae=(e,t,n)=>n>32?jn(e,t,n):Un(e,t,n);function sr(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){const a=(s+8)%10,c=(s+2)%10,u=n[c],d=n[c+1],p=Pe(u,d,1)^n[a],f=Ae(u,d,1)^n[a+1];for(let y=0;y<50;y+=10)e[s+y]^=p,e[s+y+1]^=f}let i=e[2],o=e[3];for(let s=0;s<24;s++){const a=Ye[s],c=Pe(i,o,a),u=Ae(i,o,a),d=Ke[s];i=e[d],o=e[d+1],e[d]=c,e[d+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=rr[r],e[1]^=ir[r]}We(n)}class ce extends Xn{constructor(t,n,r,i=!1,o=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=o,W(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Hn(this.state)}clone(){return this._cloneInto()}keccak(){we(this.state32),sr(this.state32,this.rounds),we(this.state32),this.posOut=0,this.pos=0}update(t){xe(this),t=Ze(t),D(t);const{blockLen:n,state:r}=this,i=t.length;for(let o=0;o<i;){const s=Math.min(n-this.pos,i-o);for(let a=0;a<s;a++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,n&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){xe(this,!1),D(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,o=t.length;i<o;){this.posOut>=r&&this.keccak();const s=Math.min(r-this.posOut,o-i);t.set(n.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return W(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Vn(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,We(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:o,enableXOF:s}=this;return t||(t=new ce(n,r,i,s,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=i,t.enableXOF=s,t.destroyed=this.destroyed,t}}const or=(e,t,n)=>Jn(()=>new ce(t,e,n)),ar=or(1,136,256/8);function Qe(e,t){const n=t||"hex",r=ar(Fe(e,{strict:!1})?Te(e):e);return n==="bytes"?r:vt(r)}const cr=e=>Qe(Te(e));function ur(e){return cr(e)}function dr(e){let t=!0,n="",r=0,i="",o=!1;for(let s=0;s<e.length;s++){const a=e[s];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(i))i="";else if(i+=a,a===")"){o=!0;break}continue}if(a===" "){e[s-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!o)throw new l("Unable to normalize signature.");return i}const lr=e=>{const t=typeof e=="string"?e:In(e);return dr(t)};function fr(e){return ur(lr(e))}class qe extends l{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class et extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const J=new et(8192);function ue(e,t){if(J.has(`${e}.${t}`))return J.get(`${e}.${t}`);const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Qe($t(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&i[s]&&(i[s]=i[s].toUpperCase()),(r[s>>1]&15)>=8&&i[s+1]&&(i[s+1]=i[s+1].toUpperCase());const o=`0x${i.join("")}`;return J.set(`${e}.${t}`,o),o}function qi(e,t){if(!tt(e,{strict:!1}))throw new qe({address:e});return ue(e,t)}const pr=/^0x[a-fA-F0-9]{40}$/,Q=new et(8192);function tt(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Q.has(r))return Q.get(r);const i=pr.test(e)?e.toLowerCase()===e?!0:n?ue(e)===e:!0:!1;return Q.set(r,i),i}function R(e){return typeof e[0]=="string"?hr(e):yr(e)}function yr(e){let t=0;for(const i of e)t+=i.length;const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}function hr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Z(e,t,n,{strict:r}={}){return Fe(e,{strict:!1})?mr(e,t,n,{strict:r}):it(e,t,n,{strict:r})}function nt(e,t){if(typeof t=="number"&&t>0&&t>x(e)-1)throw new Me({offset:t,position:"start",size:x(e)})}function rt(e,t,n){if(typeof t=="number"&&typeof n=="number"&&x(e)!==n-t)throw new Me({offset:n,position:"end",size:x(e)})}function it(e,t,n,{strict:r}={}){nt(e,t);const i=e.slice(t,n);return r&&rt(i,t,n),i}function mr(e,t,n,{strict:r}={}){nt(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&rt(i,t,n),i}const es=/^(.*)\[([0-9]*)\]$/,ts=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,gr=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function ns(e,t){if(e.length!==t.length)throw new Fn({expectedLength:e.length,givenLength:t.length});const n=br({params:e,values:t}),r=le(n);return r.length===0?"0x":r}function br({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(de({param:e[r],value:t[r]}));return n}function de({param:e,value:t}){const n=fe(e.type);if(n){const[r,i]=n;return wr(t,{length:r,param:{...e,type:i}})}if(e.type==="tuple")return Er(t,{param:e});if(e.type==="address")return xr(t);if(e.type==="bool")return Ar(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,i="256"]=gr.exec(e.type)??[];return vr(t,{signed:r,size:Number(i)})}if(e.type.startsWith("bytes"))return Pr(t,{param:e});if(e.type==="string")return $r(t);throw new On(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function le(e){let t=0;for(let o=0;o<e.length;o++){const{dynamic:s,encoded:a}=e[o];s?t+=32:t+=x(a)}const n=[],r=[];let i=0;for(let o=0;o<e.length;o++){const{dynamic:s,encoded:a}=e[o];s?(n.push(h(t+i,{size:32})),r.push(a),i+=x(a)):n.push(a)}return R([...n,...r])}function xr(e){if(!tt(e))throw new qe({address:e});return{dynamic:!1,encoded:T(e.toLowerCase())}}function wr(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Ln(e);if(!r&&e.length!==t)throw new Sn({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let i=!1;const o=[];for(let s=0;s<e.length;s++){const a=de({param:n,value:e[s]});a.dynamic&&(i=!0),o.push(a)}if(r||i){const s=le(o);if(r){const a=h(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?R([a,s]):a}}if(i)return{dynamic:!0,encoded:s}}return{dynamic:!1,encoded:R(o.map(({encoded:s})=>s))}}function Pr(e,{param:t}){const[,n]=t.type.split("bytes"),r=x(e);if(!n){let i=e;return r%32!==0&&(i=T(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:R([T(h(r,{size:32})),i])}}if(r!==Number.parseInt(n,10))throw new Tn({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:T(e,{dir:"right"})}}function Ar(e){if(typeof e!="boolean")throw new l(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:T(Et(e))}}function vr(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new It({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:h(e,{size:32,signed:t})}}function $r(e){const t=_t(e),n=Math.ceil(x(t)/32),r=[];for(let i=0;i<n;i++)r.push(T(Z(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:R([T(h(x(t),{size:32})),...r])}}function Er(e,{param:t}){let n=!1;const r=[];for(let i=0;i<t.components.length;i++){const o=t.components[i],s=Array.isArray(e)?i:o.name,a=de({param:o,value:e[s]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?le(r):R(r.map(({encoded:i})=>i))}}function fe(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Ir=e=>Z(fr(e),0,4),rs={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},_r={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Br={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class ve extends l{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class Sr extends l{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class Tr extends l{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const Fr={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Tr({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Sr({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new ve({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new ve({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Mr(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(Fr);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function is(e,t){const n=typeof t=="string"?{to:t}:t,r=n.to;return r==="number"?E(e,n):r==="bigint"?st(e,n):r==="boolean"?ot(e,n):r==="string"?at(e,n):_(e,n)}function st(e,t={}){typeof t.size<"u"&&K(e,{size:t.size});const n=_(e,t);return St(n,t)}function ot(e,t={}){let n=e;if(typeof t.size<"u"&&(K(n,{size:t.size}),n=oe(n)),n.length>1||n[0]>1)throw new Bt(n);return!!n[0]}function E(e,t={}){typeof t.size<"u"&&K(e,{size:t.size});const n=_(e,t);return te(n,t)}function at(e,t={}){let n=e;return typeof t.size<"u"&&(K(n,{size:t.size}),n=oe(n,{dir:"right"})),new TextDecoder().decode(n)}function Or(e,t){const n=typeof t=="string"?Tt(t):t,r=Mr(n);if(x(n)===0&&e.length>0)throw new He;if(x(t)&&x(t)<32)throw new Bn({data:typeof t=="string"?t:_(t),params:e,size:x(t)});let i=0;const o=[];for(let s=0;s<e.length;++s){const a=e[s];r.setPosition(i);const[c,u]=O(r,a,{staticPosition:0});i+=u,o.push(c)}return o}function O(e,t,{staticPosition:n}){const r=fe(t.type);if(r){const[i,o]=r;return Lr(e,{...t,type:o},{length:i,staticPosition:n})}if(t.type==="tuple")return zr(e,t,{staticPosition:n});if(t.type==="address")return Rr(e);if(t.type==="bool")return kr(e);if(t.type.startsWith("bytes"))return Gr(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Cr(e,t);if(t.type==="string")return Ur(e,{staticPosition:n});throw new Rn(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const $e=32,se=32;function Rr(e){const t=e.readBytes(32);return[ue(_(it(t,-20))),32]}function Lr(e,t,{length:n,staticPosition:r}){if(!n){const s=E(e.readBytes(se)),a=r+s,c=a+$e;e.setPosition(a);const u=E(e.readBytes($e)),d=j(t);let p=0;const f=[];for(let y=0;y<u;++y){e.setPosition(c+(d?y*32:p));const[P,A]=O(e,t,{staticPosition:c});p+=A,f.push(P)}return e.setPosition(r+32),[f,32]}if(j(t)){const s=E(e.readBytes(se)),a=r+s,c=[];for(let u=0;u<n;++u){e.setPosition(a+u*32);const[d]=O(e,t,{staticPosition:a});c.push(d)}return e.setPosition(r+32),[c,32]}let i=0;const o=[];for(let s=0;s<n;++s){const[a,c]=O(e,t,{staticPosition:r+i});i+=c,o.push(a)}return[o,i]}function kr(e){return[ot(e.readBytes(32),{size:32}),32]}function Gr(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const s=E(e.readBytes(32));e.setPosition(n+s);const a=E(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[_(c),32]}return[_(e.readBytes(Number.parseInt(i,10),32)),32]}function Cr(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[r>48?st(i,{signed:n}):E(i,{signed:n}),32]}function zr(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:s})=>!s),i=r?[]:{};let o=0;if(j(t)){const s=E(e.readBytes(se)),a=n+s;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(a+o);const[d,p]=O(e,u,{staticPosition:a});o+=p,i[r?c:u==null?void 0:u.name]=d}return e.setPosition(n+32),[i,32]}for(let s=0;s<t.components.length;++s){const a=t.components[s],[c,u]=O(e,a,{staticPosition:n});i[r?s:a==null?void 0:a.name]=c,o+=u}return[i,o]}function Ur(e,{staticPosition:t}){const n=E(e.readBytes(32)),r=t+n;e.setPosition(r);const i=E(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const o=e.readBytes(i,32),s=at(oe(o));return e.setPosition(t+32),[s,32]}function j(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(j);const n=fe(e.type);return!!(n&&j({...e,type:n[1]}))}function Dr(e){const{abi:t,data:n}=e,r=Z(n,0,4);if(r==="0x")throw new He;const o=[...t||[],_r,Br].find(s=>s.type==="error"&&r===Ir(H(s)));if(!o)throw new Mn(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Or(o.inputs,Z(n,4)):void 0,errorName:o.name}}const jr=(e,t,n)=>JSON.stringify(e,(r,i)=>{const o=typeof i=="bigint"?i.toString():i;return typeof t=="function"?t(r,o):o},n);function pe(e,t){return({exclude:n,format:r})=>({exclude:n,format:(i,o)=>{const s=t(i,o);if(n)for(const a of n)delete s[a];return{...s,...r(i,o)}},type:e})}const Nr={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function ct(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Vr(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>_(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=h(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=h(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=h(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=h(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=h(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=h(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Nr[e.type]),typeof e.value<"u"&&(n.value=h(e.value)),n}const ss=pe("transactionRequest",ct);function Vr(e){return e.map(t=>({address:t.address,r:t.r?h(BigInt(t.r)):t.r,s:t.s?h(BigInt(t.s)):t.s,chainId:h(t.chainId),nonce:h(t.nonce),...typeof t.yParity<"u"?{yParity:h(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:h(t.v)}:{}}))}const Hr={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function ut(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?te(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?te(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Hr[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=Wr(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}const os=pe("transaction",ut);function Wr(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function dt(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:ut(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const as=pe("block",dt);function Zr(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}async function Kr(e){const t=await e({method:"eth_gasPrice"});return Be(t)}async function Ee(e){const{client:t,chain:n,percentMultiplier:r}=e,i=ae({chain:n,client:t}),o=await Kr(i),s=r?o/BigInt(100)*BigInt(r):0n;return o+s}async function Yr(e,t){const n=t.blockTag??"latest",r=t.includeTransactions??!1,i=t.blockNumber!==void 0?wt(t.blockNumber):void 0,o=await e({method:"eth_getBlockByNumber",params:[i||n,r]});if(!o)throw new Error("Block not found");return dt(o)}async function Xr(e){const t=await e({method:"eth_maxPriorityFeePerGas"});return Be(t)}async function b(e){return typeof e=="function"?await e():e}function lt(e,t){const n=e.toString(),r=n[0]==="-"?"-":"",o=(r?n.slice(1):n).padStart(t+1,"0"),s=o.length-t,a=o.slice(0,s)||"0";let c=o.slice(s);for(let u=c.length-1;u>=0;u--){if(c[u]!=="0"){c=c.slice(0,u+1);break}u===0&&(c="")}return`${r}${a}${c?`.${c}`:""}`}function Jr(e){return lt(e,18)}function ye(e,t){e.includes("e")&&(e=Number(e).toFixed(t));let[n,r=""]=e.split(".");const i=n.startsWith("-")?"-":"";if(i&&(n=n.slice(1)),r=r.padEnd(t,"0"),t===0)r[0]&&Number.parseInt(r[0])>=5&&(n=(BigInt(n)+1n).toString()),r="";else if(r.length>t){const o=r[t];o&&Number.parseInt(o,10)>=5?(r=(BigInt(r.substring(0,t))+1n).toString().padStart(t,"0"),r.length>t&&(n=(BigInt(n)+1n).toString(),r=r.substring(r.length-t))):r=r.substring(0,t)}return BigInt(`${i}${n}${r}`)}function Qr(e){return ye(e,18)}const cs=Object.freeze(Object.defineProperty({__proto__:null,toEther:Jr,toTokens:lt,toUnits:ye,toWei:Qr},Symbol.toStringTag,{value:"Module"}));function U(e){if(e===0n||(e&e-1n)===0n)return e;let t=1n;for(;e>0n;)e>>=1n,t<<=1n;return t}const qr=[78600,2040,248,9372,841,842,2016,9768,2442,1942999413,1952959480,994873017,19011,40875,1511670449,5464,2020,2021,98866,1417429182];async function ft(e){var s;const[t,n,r,i]=await Promise.all([b(e.maxFeePerGas),b(e.maxPriorityFeePerGas),b(e.gasPrice),b(e.type)]);if(t!==void 0&&n!==void 0)return{maxFeePerGas:t,maxPriorityFeePerGas:n};if(typeof r=="bigint")return{gasPrice:r};const o=await pt(e.client,e.chain,i==="legacy"?"legacy":"eip1559");return(s=e.chain.experimental)!=null&&s.increaseZeroByteCount?o.gasPrice?{gasPrice:U(o.gasPrice)}:{maxFeePerGas:t??U(o.maxFeePerGas??0n),maxPriorityFeePerGas:n??U(o.maxPriorityFeePerGas??0n)}:o.gasPrice!==void 0?o:{maxFeePerGas:t??o.maxFeePerGas,maxPriorityFeePerGas:n??o.maxPriorityFeePerGas}}async function pt(e,t,n){if((n??t.feeType)==="legacy"||qr.includes(t.id))return{gasPrice:await Ee({chain:t,client:e,percentMultiplier:10})};const i=await ei(e,t);return i.maxFeePerGas!==null&&i.maxPriorityFeePerGas!==null?{maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}:{gasPrice:await Ee({chain:t,client:e,percentMultiplier:10})}}async function ei(e,t,n=10){let r=null,i=null;const o=ae({chain:t,client:e}),[s,a]=await Promise.all([Yr(o,{blockTag:"latest"}),Xr(o).catch(()=>null)]),c=s==null?void 0:s.baseFeePerGas,u=t.id;return u===220||u===1220?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(u===80002||u===137?i=await ii(u):a!==null&&(i=a),i==null||c==null?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(i=ti(i,n),r=c*2n+i,(u===42220||u===44787||u===62320)&&(i=r),{maxFeePerGas:r,maxPriorityFeePerGas:i}))}function ti(e,t=10){const n=e/BigInt(100)*BigInt(t);return e+n}function ni(e){switch(e){case 137:return"https://gasstation.polygon.technology/v2";case 80002:return"https://gasstation.polygon.technology/amoy"}}const ri=31n;async function ii(e){const t=ni(e);try{const r=(await(await fetch(t)).json()).fast.maxPriorityFee;if(r>0){const i=Number.parseFloat(r).toFixed(9);return ye(i,9)}}catch(n){console.error("failed to fetch gas",n)}return ri}const us=Object.freeze(Object.defineProperty({__proto__:null,getDefaultGasOverrides:pt,getGasOverridesForTransaction:ft},Symbol.toStringTag,{value:"Module"})),si=Zr({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://11155111.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:8928790}},testnet:!0}),oi="https://{clientId}.ipfscdn.io/ipfs/{cid}";function ai(e){var t,n;if(e.uri.startsWith("ipfs://")){const r=((n=(t=e.client.config)==null?void 0:t.storage)==null?void 0:n.gatewayUrl)??oi,i=e.client.clientId,o=ci(e.uri);let s;return typeof globalThis<"u"&&"Application"in globalThis&&(s=globalThis.Application.applicationId),`${r.replace("{clientId}",i).split("/ipfs")[0]}/ipfs/${o}${s?`?bundleId=${s}`:""}`}if(e.uri.startsWith("http"))return e.uri;throw new Error('Invalid URI scheme, expected "ipfs://" or "http(s)://"')}function ci(e){if(!e.startsWith("ipfs://"))return e;const t=e.search(/\/(Qm|baf)/i);return e.slice(t+1)}async function yt(e){var r,i,o,s,a,c,u,d,p;let t;if(e.uri.startsWith("ar://")){const{resolveArweaveScheme:f}=await w(async()=>{const{resolveArweaveScheme:y}=await import("./arweave-CAGvOb64.js");return{resolveArweaveScheme:y}},[]);t=f(e)}else t=ai(e);const n=await Se(e.client)(t,{headers:(o=(i=(r=e.client.config)==null?void 0:r.storage)==null?void 0:i.fetch)==null?void 0:o.headers,keepalive:(c=(a=(s=e.client.config)==null?void 0:s.storage)==null?void 0:a.fetch)==null?void 0:c.keepalive,requestTimeoutMs:e.requestTimeoutMs??((p=(d=(u=e.client.config)==null?void 0:u.storage)==null?void 0:d.fetch)==null?void 0:p.requestTimeoutMs)??6e4});if(!n.ok){const f=await n.text();throw new Error(`Failed to download file: ${n.status} ${n.statusText} ${f||""}`)}return n}const ds=Object.freeze(Object.defineProperty({__proto__:null,download:yt},Symbol.toStringTag,{value:"Module"}));function ui(e){if(!e.client)throw new Error(`getContract validation error - invalid client: ${e.client}`);if(!Ft(e.address))throw new Error(`getContract validation error - invalid address: ${e.address}`);if(!e.chain||!e.chain.id)throw new Error(`getContract validation error - invalid chain: ${e.chain}`);return e}function di(e,t="https://contract.thirdweb.com/abi"){return Pt(async()=>{if(e.abi)return e.abi;if(e.chain.id===31337||e.chain.id===1337||e.chain.id===si.id)return await Ie(e);try{return await li(e,t)}catch{return await Ie(e)}},{cacheKey:`${e.chain.id}-${e.address}`,cacheTime:1e3*60*60*1})}async function li(e,t="https://contract.thirdweb.com/abi"){const r=await(await Se(e.client)(`${t}/${e.chain.id}/${e.address}`)).json();if(!r||r.error)throw new Error(`Failed to resolve ABI from contract API. ${r.error||""}`);return r}async function ht(e){const[{resolveImplementation:t},{extractIPFSUri:n}]=await Promise.all([w(()=>import("./resolveImplementation-2abc0dxK.js"),__vite__mapDeps([0,1,2,3,4,5,6])),w(()=>import("./extractIPFS-tOg-rRc-.js"),__vite__mapDeps([7,3,4]))]),{bytecode:r}=await t(e);if(r==="0x"){const{id:o,name:s}=e.chain;throw new Error(`Failed to load contract bytecode. Make sure the contract [${e.address}] exists on the chain [${s||"Unknown Chain"} (chain id: ${o})]`)}const i=n(r);if(!i)return[];try{return(await(await yt({client:e.client,uri:i})).json()).output.abi}catch{return[]}}const fi={inputs:[],name:"getAllPlugins",outputs:[{components:[{internalType:"bytes4",name:"functionSelector",type:"bytes4"},{internalType:"string",name:"functionSignature",type:"string"},{internalType:"address",name:"pluginAddress",type:"address"}],internalType:"struct IPluginMap.Plugin[]",name:"registered",type:"tuple[]"}],stateMutability:"view",type:"function"},pi={inputs:[],name:"getAllExtensions",outputs:[{components:[{components:[{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"metadataURI",type:"string"},{internalType:"address",name:"implementation",type:"address"}],internalType:"struct IExtension.ExtensionMetadata",name:"metadata",type:"tuple"},{components:[{internalType:"bytes4",name:"functionSelector",type:"bytes4"},{internalType:"string",name:"functionSignature",type:"string"}],internalType:"struct IExtension.ExtensionFunction[]",name:"functions",type:"tuple[]"}],internalType:"struct IExtension.Extension[]",name:"allExtensions",type:"tuple[]"}],stateMutability:"view",type:"function"},yi={inputs:[],name:"facets",outputs:[{components:[{internalType:"address",name:"facetAddress",type:"address"},{internalType:"bytes4[]",name:"functionSelectors",type:"bytes4[]"}],type:"tuple[]"}],stateMutability:"view",type:"function"};async function Ie(e,t,n){const[r,i,o,s,a]=await Promise.all([ht(e),hi(e),mi(e),gi(e),bi(e)]),c=[...new Set([...i,...o,...s,...a])];if(!c.length)return r;const u=await xi({contract:e,plugins:c,resolveSubAbi:n});return wi({pluginAbis:u,rootAbi:r})}async function hi(e){try{const{readContract:t}=await w(async()=>{const{readContract:r}=await import("./read-contract-D8CQ_i-D.js");return{readContract:r}},__vite__mapDeps([5,3,4,2,6])),n=await t({contract:e,method:fi});return n.length?[...new Set(n.map(r=>r.pluginAddress))]:[]}catch{}return[]}async function mi(e){try{const{readContract:t}=await w(async()=>{const{readContract:r}=await import("./read-contract-D8CQ_i-D.js");return{readContract:r}},__vite__mapDeps([5,3,4,2,6])),n=await t({contract:e,method:pi});return n.length?[...new Set(n.map(r=>r.metadata.implementation))]:[]}catch{}return[]}async function gi(e){try{const{getInstalledModules:t}=await w(async()=>{const{getInstalledModules:r}=await import("./getInstalledModules-cmepPgT8.js");return{getInstalledModules:r}},__vite__mapDeps([8,5,3,4,2,6])),n=await t({contract:e});return n.length?[...new Set(n.map(r=>r.implementation))]:[]}catch{}return[]}async function bi(e){try{const{readContract:t}=await w(async()=>{const{readContract:r}=await import("./read-contract-D8CQ_i-D.js");return{readContract:r}},__vite__mapDeps([5,3,4,2,6])),n=await t({contract:e,method:yi});return n.length?n.map(r=>r.facetAddress):[]}catch{}return[]}async function xi(e){return Promise.all(e.plugins.map(t=>{const n=ui({...e.contract,address:t});return e.resolveSubAbi?e.resolveSubAbi(n):ht(n)}))}function wi(e){let t=e.pluginAbis.flat().filter(r=>r.type!=="constructor");e.rootAbi&&(t=[...e.rootAbi,...t].filter(r=>r.type!=="fallback"&&r.type!=="receive").filter(Boolean));const n=[...new Set(kt(t))];return $n(n)}async function _e(e){var o;const{error:t,contract:n,fromAddress:r}=e;Mt(t)&&n&&Ot({chainId:(o=n.chain)==null?void 0:o.id,client:n.client,contractAddress:n.address,error:t,walletAddress:r});const i=await Pi({contract:n,error:t});return i?new Ai(i,n):t}async function Pi(e){const{error:t,contract:n}=e;if(typeof t=="object"){const r=t;if(r.data&&r.data!=="0x"&&At(r.data)){let i=n==null?void 0:n.abi;n&&!i&&(i=await di(n).catch(()=>{}));const o=Dr({abi:i,data:r.data});return`${o.errorName}${o.args?` - ${o.args}`:""}`}}return`Execution Reverted: ${jr(t)}`}class Ai extends Error{constructor(t,n){var i;let r=t;super(r),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chainId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TransactionError",this.contractAddress=n==null?void 0:n.address,this.chainId=(i=n==null?void 0:n.chain)==null?void 0:i.id,this.message=r}}const q=new WeakMap;async function mt(e){var o,s;const t=typeof e.from=="string"?e.from??void 0:((o=e.from)==null?void 0:o.address)??((s=e.account)==null?void 0:s.address),n={...e.transaction,from:t};if(q.has(n))return q.get(n);const{account:r}=e,i=(async()=>{var v,N;const a=await b(e.transaction.gas);if(a!==void 0)return a;if(r!=null&&r.estimateGas)try{let g=await r.estimateGas(e.transaction);return(v=e.transaction.chain.experimental)!=null&&v.increaseZeroByteCount&&(g=U(g)),g}catch(g){throw await _e({contract:e.transaction.__contract,error:g,fromAddress:t})}const{encode:c}=await w(async()=>{const{encode:g}=await Promise.resolve().then(()=>vi);return{encode:g}},void 0),[u,d,p,f]=await Promise.all([c(e.transaction),b(e.transaction.to),b(e.transaction.value),b(e.transaction.authorizationList)]),[{getRpcClient:y},{eth_estimateGas:P}]=await Promise.all([w(()=>import("./types-DFEAKZ3L.js").then(g=>g.V),__vite__mapDeps([2,3,4])),w(()=>import("./eth_estimateGas-DVJqp0a0.js"),__vite__mapDeps([9,3,4]))]),A=y(e.transaction);try{const g=ct({authorizationList:f==null?void 0:f.map(B=>({...B,address:S(B.address),nonce:Number(B.nonce),r:he(B.r),s:he(B.s)})),data:u,from:t?S(t):void 0,to:d?S(d):void 0,value:p});let k=await P(A,g);return(N=e.transaction.chain.experimental)!=null&&N.increaseZeroByteCount&&(k=U(k)),k}catch(g){throw await _e({contract:e.transaction.__contract,error:g,fromAddress:t})}})();return q.set(n,i),i}const ls=Object.freeze(Object.defineProperty({__proto__:null,estimateGas:mt},Symbol.toStringTag,{value:"Module"})),ee=new WeakMap;async function gt(e){if(ee.has(e))return ee.get(e);const t=(async()=>{const[n,r,{concatHex:i}]=await Promise.all([bt(e),xt(e),w(()=>import("./concat-hex-D_Hd0Y8j.js"),__vite__mapDeps([10,3,4]))]);return r?i([n,r]):n})();return ee.set(e,t),t}async function bt(e){if(e.data===void 0)return"0x";if(typeof e.data=="function"){const t=await e.data();return t||"0x"}return e.data}async function xt(e){if(e.extraCallData){if(typeof e.extraCallData=="function"){const t=await e.extraCallData();if(!t)return;if(!t.startsWith("0x"))throw Error("Invalid extra calldata - must be a hex string");return t==="0x"?void 0:t}if(!e.extraCallData.startsWith("0x"))throw Error("Invalid extra calldata - must be a hex string");return e.extraCallData}}const vi=Object.freeze(Object.defineProperty({__proto__:null,encode:gt,getDataFromTx:bt,getExtraCallDataFromTx:xt},Symbol.toStringTag,{value:"Module"}));async function $i(e){if(e.id===1337||e.id===31337)return!1;if(e.id===324||e.id===300||e.id===302||e.id===11124||e.id===282||e.id===388||e.id===4654||e.id===333271||e.id===37111||e.id===978658||e.id===531050104||e.id===4457845||e.id===2741||e.id===240||e.id===555271||e.id===61166||e.id===555272)return!0;try{const{getChainMetadata:t}=await w(async()=>{const{getChainMetadata:r}=await import("./index-B6-Xobl2.js").then(i=>i.ba);return{getChainMetadata:r}},__vite__mapDeps([3,4]));return(await t(e)).stackType==="zksync_stack"}catch{return!1}}async function fs(e){if(await $i(e.transaction.chain)){const{getZkGasFees:A}=await w(async()=>{const{getZkGasFees:k}=await import("./send-eip712-transaction-q3anVEgs.js").then(B=>B.a);return{getZkGasFees:k}},__vite__mapDeps([11,3,4,12,2,10,13])),{gas:v,maxFeePerGas:N,maxPriorityFeePerGas:g}=await A({from:typeof e.from=="string"?S(e.from):e.from!==void 0?S(e.from.address):void 0,transaction:e.transaction});e.transaction={...e.transaction,gas:v,maxFeePerGas:N,maxPriorityFeePerGas:g}}const n=ae(e.transaction),r=e.transaction.chain.id,i=e.from;let[o,s,a,c,u,d,p,f,y]=await Promise.all([gt(e.transaction),(async()=>{const A=await b(e.transaction.nonce);return A!==void 0?A:i?await w(async()=>{const{eth_getTransactionCount:v}=await import("./eth_getTransactionCount-CMQovf3i.js");return{eth_getTransactionCount:v}},__vite__mapDeps([14,3,4])).then(({eth_getTransactionCount:v})=>v(n,{address:typeof i=="string"?S(i):S(i.address),blockTag:"pending"})):void 0})(),mt({...e,from:e.from}),ft(e.transaction),b(e.transaction.to),b(e.transaction.accessList),b(e.transaction.value),b(e.transaction.authorizationList),b(e.transaction.type)]);const P=await b(e.transaction.extraGas);return P&&(a+=P),{accessList:d,authorizationList:f,chainId:r,data:o,gas:a,nonce:s,to:u,type:y,value:p,...c}}export{et as $,pt as A,Jr as B,Ee as C,ye as D,Qr as E,$i as F,fr as G,Xn as H,_i as I,tt as J,ji as K,Ci as L,H as M,Qe as N,qe as O,ki as P,Gi as Q,Hi as R,Bn as S,Sr as T,Vi as U,qi as V,Z as W,Xi as X,mr as Y,ct as Z,ue as _,ns as a,Fi as a0,Mi as a1,Oi as a2,He as a3,Sn as a4,Tn as a5,Fn as a6,Ri as a7,Li as a8,Mn as a9,En as aA,Ti as aB,Bi as aC,Si as aD,rs as aE,_r as aF,gr as aG,ts as aH,es as aI,ar as aJ,C as aK,Zi as aL,W as aM,Qi as aN,Ji as aO,In as aP,ai as aQ,cs as aR,us as aS,ds as aT,ls as aU,zi as aa,Ui as ab,Di as ac,Ni as ad,Rn as ae,On as af,Ln as ag,kn as ah,Wi as ai,Zr as aj,yr as ak,hr as al,it as am,st as an,ot as ao,E as ap,at as aq,is as ar,as,dt as at,os as au,ut as av,ss as aw,Nr as ax,lr as ay,si as az,lt as b,Dr as c,Or as d,gt as e,R as f,ui as g,fs as h,Hr as i,pe as j,Mr as k,Ki as l,xe as m,Ze as n,D as o,Vn as p,We as q,b as r,jr as s,Ir as t,Jn as u,Yi as v,dn as w,An as x,Ue as y,mt as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as n,d as a,r as c}from"./signing-
|
|
1
|
+
import{e as n,d as a,r as c}from"./signing-D7Nlzpwh.js";import{d}from"./detectExtension-BqT-gQP6.js";import"./utils-Onbz2awt.js";import"./index-B6-Xobl2.js";const e="0xbd85b039",o=[{name:"id",type:"uint256"}],r=[{type:"uint256"}];function l(t){return d({availableSelectors:t,method:[e,o,r]})}function p(t){return n(o,[t.id])}function S(t){return e+p(t).slice(2)}function y(t){return a(r,t)[0]}async function T(t){return c({contract:t.contract,method:[e,o,r],params:[t.id]})}export{e as FN_SELECTOR,y as decodeTotalSupplyResult,S as encodeTotalSupply,p as encodeTotalSupplyParams,l as isTotalSupplySupported,T as totalSupply};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{readContract as n}from"./read-contract-D8CQ_i-D.js";import{e as a}from"./utils-BtpzmIxp.js";import{d as c}from"./detectExtension-DRxhZaJ-.js";import{d as p}from"./to-serializable-transaction-DAYFWHyO.js";import"./index-B6-Xobl2.js";import"./types-DFEAKZ3L.js";const o="0xbd85b039",e=[{name:"id",type:"uint256"}],r=[{type:"uint256"}];function S(t){return c({availableSelectors:t,method:[o,e,r]})}function d(t){return a(e,[t.id])}function y(t){return o+d(t).slice(2)}function T(t){return p(r,t)[0]}async function P(t){return n({contract:t.contract,method:[o,e,r],params:[t.id]})}export{o as FN_SELECTOR,T as decodeTotalSupplyResult,y as encodeTotalSupply,d as encodeTotalSupplyParams,S as isTotalSupplySupported,P as totalSupply};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{y as d,z as r,A as e}from"./signing-
|
|
1
|
+
import{y as d,z as r,A as e}from"./signing-D7Nlzpwh.js";function n(s,{args:u,eventName:l}={}){return{...s,blockHash:s.blockHash?s.blockHash:null,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,logIndex:s.logIndex?Number(s.logIndex):null,transactionHash:s.transactionHash?s.transactionHash:null,transactionIndex:s.transactionIndex?Number(s.transactionIndex):null,...l?{args:u,eventName:l}:{}}}const a={"0x0":"reverted","0x1":"success"};function o(s,u){const l={...s,blockNumber:s.blockNumber?BigInt(s.blockNumber):null,contractAddress:s.contractAddress?s.contractAddress:null,cumulativeGasUsed:s.cumulativeGasUsed?BigInt(s.cumulativeGasUsed):null,effectiveGasPrice:s.effectiveGasPrice?BigInt(s.effectiveGasPrice):null,gasUsed:s.gasUsed?BigInt(s.gasUsed):null,logs:s.logs?s.logs.map(b=>n(b)):null,to:s.to?s.to:null,transactionIndex:s.transactionIndex?e(s.transactionIndex):null,status:s.status?a[s.status]:null,type:s.type?r[s.type]||s.type:null};return s.blobGasPrice&&(l.blobGasPrice=BigInt(s.blobGasPrice)),s.blobGasUsed&&(l.blobGasUsed=BigInt(s.blobGasUsed)),l}const f=d("transactionReceipt",o);export{n as a,f as d,o as f,a as r};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as m,l as f,m as p}from"./index-
|
|
1
|
+
import{n as m,l as f,m as p}from"./index-TpT45Yhr.js";import{c as a}from"./index-yvAPBrdI.js";import"./index-DftmpJ8E.js";import"./index-B6-Xobl2.js";import"./NetworkUtil-BooKnyFI.js";import"./hmac-Bk4Z90TB.js";import"./index.es-BdGfQ9jz.js";import"./index.es-LxVxXtUw.js";import"./index-CRXo5c7W.js";import"./if-defined-BfXFCfhz.js";import"./index-BRxU5H7H.js";import"./index-DcZ1OZua.js";import"./index-CwOCLTiY.js";const d=m`
|
|
2
2
|
:host > wui-flex:first-child {
|
|
3
3
|
height: 500px;
|
|
4
4
|
overflow-y: auto;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{T as G,s as A,e as fe,a3 as le,a4 as he,a5 as U,a6 as de,a7 as j,a8 as q,a9 as R,aa as ge,ab as pe,ac as be,ad as me,ae as ye,o as xe,u as K,L as we,U as $e,af as W}from"./index-B6-Xobl2.js";function J(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function F(e){return J(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Q="2.39.0";let k={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Q}`};function It(e){k=e}class g extends Error{constructor(t,n={}){var c;const s=(()=>{var a;return n.cause instanceof g?n.cause.details:(a=n.cause)!=null&&a.message?n.cause.message:n.details})(),i=n.cause instanceof g&&n.cause.docsPath||n.docsPath,r=(c=k.getDocsUrl)==null?void 0:c.call(k,{...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...s?[`Details: ${s}`]:[],...k.version?[`Version: ${k.version}`]:[]].join(`
|
|
2
|
+
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=s,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Q}walk(t){return Z(this,t)}}function Z(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Z(e.cause,t):t?null:e}class At extends g{constructor({offset:t,position:n,size:s}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${s}).`,{name:"SliceOffsetOutOfBoundsError"})}}class Y extends g{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}class kt extends g{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} is expected to be ${n} ${s} long, but is ${t} ${s} long.`,{name:"InvalidBytesLengthError"})}}function S(e,{dir:t,size:n=32}={}){return typeof e=="string"?Te(e,{dir:t,size:n}):Ie(e,{dir:t,size:n})}function Te(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new Y({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Ie(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Y({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let i=0;i<n;i++){const r=t==="right";s[r?i:n-i-1]=e[r?i:e.length-i-1]}return s}class Ae extends g{constructor({max:t,min:n,signed:s,size:i,value:r}){super(`Number "${r}" is not in safe ${i?`${i*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class St extends g{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class ke extends g{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}class Et extends g{constructor(t){super(`Hex value "${t}" is an odd length (${t.length}). It must be an even length.`,{name:"InvalidHexValueError"})}}class Se extends g{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function _(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,s=0;for(let i=0;i<n.length-1&&n[t==="left"?i:n.length-i-1].toString()==="0";i++)s++;return n=t==="left"?n.slice(s):n.slice(0,n.length-s),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function T(e,{size:t}){if(F(e)>t)throw new Se({givenSize:F(e),maxSize:t})}function Bt(e,t){const n=typeof t=="string"?{to:t}:t,s=n.to;return s==="number"?Be(e,n):s==="bigint"?ee(e,n):s==="string"?ze(e,n):s==="boolean"?Ee(e,n):M(e,n)}function ee(e,t={}){const{signed:n}=t;t.size&&T(e,{size:t.size});const s=BigInt(e);if(!n)return s;const i=(e.length-2)/2,r=(1n<<BigInt(i)*8n-1n)-1n;return s<=r?s:s-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function Ee(e,t={}){let n=e;if(t.size&&(T(n,{size:t.size}),n=_(n)),_(n)==="0x00")return!1;if(_(n)==="0x01")return!0;throw new ke(n)}function Be(e,t={}){return Number(ee(e,t))}function ze(e,t={}){let n=M(e);return t.size&&(T(n,{size:t.size}),n=_(n,{dir:"right"})),new TextDecoder().decode(n)}const _e=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function zt(e,t={}){return typeof e=="number"||typeof e=="bigint"?ne(e,t):typeof e=="string"?Ce(e,t):typeof e=="boolean"?Me(e,t):te(e,t)}function Me(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(T(n,{size:t.size}),S(n,{size:t.size})):n}function te(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=_e[e[i]];const s=`0x${n}`;return typeof t.size=="number"?(T(s,{size:t.size}),S(s,{dir:"right",size:t.size})):s}function ne(e,t={}){const{signed:n,size:s}=t,i=BigInt(e);let r;s?n?r=(1n<<BigInt(s)*8n-1n)-1n:r=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&n?-r-1n:0;if(r&&i>r||i<o){const a=typeof e=="bigint"?"n":"";throw new Ae({max:r?`${r}${a}`:void 0,min:`${o}${a}`,signed:n,size:s,value:`${e}${a}`})}const c=`0x${(n&&i<0?(1n<<BigInt(s*8))+BigInt(i):i).toString(16)}`;return s?S(c,{size:s}):c}const Oe=new TextEncoder;function Ce(e,t={}){const n=Oe.encode(e);return te(n,t)}const He=new TextEncoder;function _t(e,t={}){return typeof e=="number"||typeof e=="bigint"?ve(e,t):typeof e=="boolean"?Le(e,t):J(e)?M(e,t):Pe(e,t)}function Le(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(T(n,{size:t.size}),S(n,{size:t.size})):n}const w={zero:48,nine:57,A:65,F:70,a:97,f:102};function N(e){if(e>=w.zero&&e<=w.nine)return e-w.zero;if(e>=w.A&&e<=w.F)return e-(w.A-10);if(e>=w.a&&e<=w.f)return e-(w.a-10)}function M(e,t={}){let n=e;t.size&&(T(n,{size:t.size}),n=S(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,r=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const a=N(s.charCodeAt(c++)),u=N(s.charCodeAt(c++));if(a===void 0||u===void 0)throw new g(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);r[o]=a*16+u}return r}function ve(e,t){const n=ne(e,t);return M(n)}function Pe(e,t={}){const n=He.encode(e);return typeof t.size=="number"?(T(n,{size:t.size}),S(n,{dir:"right",size:t.size})):n}async function Ue(e,t,n){var i,r,o,c,a,u,f,m,y;const s=await G(t)(e,{body:A(n.requests),headers:{...(o=(r=(i=t.config)==null?void 0:i.rpc)==null?void 0:r.fetch)==null?void 0:o.headers,"Content-Type":"application/json"},keepalive:(u=(a=(c=t.config)==null?void 0:c.rpc)==null?void 0:a.fetch)==null?void 0:u.keepalive,method:"POST",requestTimeoutMs:n.requestTimeoutMs??((y=(m=(f=t.config)==null?void 0:f.rpc)==null?void 0:m.fetch)==null?void 0:y.requestTimeoutMs)});if(!s.ok){const p=await s.text().catch(()=>null);throw new Error(`RPC request failed with status ${s.status} - ${s.statusText}: ${p||"unknown error"}`)}return await s.json()}async function je(e,t,n){var i,r,o,c,a,u,f,m,y;const s=await G(t)(e,{body:A(n.request),headers:{...((o=(r=(i=t.config)==null?void 0:i.rpc)==null?void 0:r.fetch)==null?void 0:o.headers)||{},"Content-Type":"application/json"},keepalive:(u=(a=(c=t.config)==null?void 0:c.rpc)==null?void 0:a.fetch)==null?void 0:u.keepalive,method:"POST",requestTimeoutMs:n.requestTimeoutMs??((y=(m=(f=t.config)==null?void 0:f.rpc)==null?void 0:m.fetch)==null?void 0:y.requestTimeoutMs)});if(!s.ok){const p=await s.text().catch(()=>null);throw new Error(`RPC request failed with status ${s.status} - ${s.statusText}: ${p||"unknown error"}`)}return await s.json()}const C=new WeakMap;function qe(e){if(C.has(e))return C.get(e);const t=new Map;return C.set(e,t),t}function Re(e){return`${e.method}:${A(e.params)}`}const Fe=100,Ne=0;function De(e){const t=qe(e.client),n=e.chain.rpc;if(t.has(n))return t.get(n);const s=(()=>{var m,y,p,L,v,P;const i=fe({chain:e.chain,client:e.client}),r=((m=e.config)==null?void 0:m.maxBatchSize)??((p=(y=e.client.config)==null?void 0:y.rpc)==null?void 0:p.maxBatchSize)??Fe,o=((L=e.config)==null?void 0:L.batchTimeoutMs)??((P=(v=e.client.config)==null?void 0:v.rpc)==null?void 0:P.batchTimeoutMs)??Ne,c=new Map;let a=[],u=null;function f(){var $;u&&(clearTimeout(u),u=null);const x=new Array(a.length),h=a.slice().map((d,l)=>(d.request.id=l,d.request.jsonrpc="2.0",x[l]=d.request,d));a=[],Ue(i,e.client,{requests:x,requestTimeoutMs:($=e.config)==null?void 0:$.requestTimeoutMs}).then(d=>{h.forEach((l,O)=>{const b=d[O];b?b instanceof Error?l.reject(b):"error"in b?l.reject(b.error):typeof b=="string"?l.reject(new Error(b)):b.method==="eth_subscription"?l.reject("Subscriptions not supported yet"):l.resolve(b.result):l.reject(new Error(`RPC Error from ${i}:
|
|
3
|
+
requests: ${A(x)}
|
|
4
|
+
responses: ${A(d)}`))})}).catch(d=>{for(const l of h)l.reject(d)}).finally(()=>{c.clear()})}return r===1?async x=>{var $;x.id=1,x.jsonrpc="2.0";const h=await je(i,e.client,{request:x,requestTimeoutMs:($=e.config)==null?void 0:$.requestTimeoutMs});if(!h)throw new Error("No response");if("error"in h)throw h.error;return h.result}:async x=>{const h=Re(x);if(c.has(h))return c.get(h);let $,d;const l=new Promise((O,b)=>{$=O,d=b});return c.set(h,l),a.push({reject:d,request:x,requestKey:h,resolve:$}),r>1?(u||(u=setTimeout(f,o)),a.length>=r&&f()):f(),l}})();return t.set(n,s),s}const Mt=Object.freeze(Object.defineProperty({__proto__:null,getRpcClient:De},Symbol.toStringTag,{value:"Module"})),z=BigInt(2**32-1),D=BigInt(32);function Xe(e,t=!1){return t?{h:Number(e&z),l:Number(e>>D&z)}:{h:Number(e>>D&z)|0,l:Number(e&z)|0}}function Ve(e,t=!1){let n=new Uint32Array(e.length),s=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:r,l:o}=Xe(e[i],t);[n[i],s[i]]=[r,o]}return[n,s]}const Ge=(e,t,n)=>e<<n|t>>>32-n,Ke=(e,t,n)=>t<<n|e>>>32-n,We=(e,t,n)=>t<<n-32|e>>>64-n,Je=(e,t,n)=>e<<n-32|t>>>64-n,se=[],ie=[],re=[],Qe=BigInt(0),E=BigInt(1),Ze=BigInt(2),Ye=BigInt(7),et=BigInt(256),tt=BigInt(113);for(let e=0,t=E,n=1,s=0;e<24;e++){[n,s]=[s,(2*n+3*s)%5],se.push(2*(5*s+n)),ie.push((e+1)*(e+2)/2%64);let i=Qe;for(let r=0;r<7;r++)t=(t<<E^(t>>Ye)*tt)%et,t&Ze&&(i^=E<<(E<<BigInt(r))-E);re.push(i)}const[nt,st]=Ve(re,!0),X=(e,t,n)=>n>32?We(e,t,n):Ge(e,t,n),V=(e,t,n)=>n>32?Je(e,t,n):Ke(e,t,n);function oe(e,t=24){const n=new Uint32Array(10);for(let s=24-t;s<24;s++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,a=(o+2)%10,u=n[a],f=n[a+1],m=X(u,f,1)^n[c],y=V(u,f,1)^n[c+1];for(let p=0;p<50;p+=10)e[o+p]^=m,e[o+p+1]^=y}let i=e[2],r=e[3];for(let o=0;o<24;o++){const c=ie[o],a=X(i,r,c),u=V(i,r,c),f=se[o];i=e[f],r=e[f+1],e[f]=a,e[f+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)n[c]=e[o+c];for(let c=0;c<10;c++)e[o+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=nt[s],e[1]^=st[s]}n.fill(0)}class B extends he{constructor(t,n,s,i=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=s,this.enableXOF=i,this.rounds=r,U(s),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=de(this.state)}keccak(){j||q(this.state32),oe(this.state32,this.rounds),j||q(this.state32),this.posOut=0,this.pos=0}update(t){R(this);const{blockLen:n,state:s}=this;t=ge(t);const i=t.length;for(let r=0;r<i;){const o=Math.min(n-this.pos,i-r);for(let c=0;c<o;c++)s[this.pos++]^=t[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:s,blockLen:i}=this;t[s]^=n,n&128&&s===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){R(this,!1),pe(t),this.finish();const n=this.state,{blockLen:s}=this;for(let i=0,r=t.length;i<r;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,r-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return U(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(be(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:s,outputLen:i,rounds:r,enableXOF:o}=this;return t||(t=new B(n,s,i,o,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=s,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const I=(e,t,n)=>le(()=>new B(t,e,n)),it=I(6,144,224/8),rt=I(6,136,256/8),ot=I(6,104,384/8),ct=I(6,72,512/8),at=I(1,144,224/8),ce=I(1,136,256/8),ut=I(1,104,384/8),ft=I(1,72,512/8),ae=(e,t,n)=>me((s={})=>new B(t,e,s.dkLen===void 0?n:s.dkLen,!0)),lt=ae(31,168,128/8),ht=ae(31,136,256/8),Ot=Object.freeze(Object.defineProperty({__proto__:null,Keccak:B,keccakP:oe,keccak_224:at,keccak_256:ce,keccak_384:ut,keccak_512:ft,sha3_224:it,sha3_256:rt,sha3_384:ot,sha3_512:ct,shake128:lt,shake256:ht},Symbol.toStringTag,{value:"Module"}));function dt(e,t){const n=ce(xe(e,{strict:!1})?ye(e):e);return t==="bytes"?n:K(n)}const gt=/^0x[a-fA-F0-9]{40}$/,H=new we(4096);function pt(e){if(H.has(e))return H.get(e);const t=gt.test(e)&&(e.toLowerCase()===e||ue(e)===e);return H.set(e,t),t}function ue(e){const t=e.substring(2).toLowerCase(),n=dt($e(t),"bytes"),s=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&e[i]&&(s[i]=s[i].toUpperCase()),(n[i>>1]&15)>=8&&e[i+1]&&(s[i+1]=s[i+1].toUpperCase());return`0x${s.join("")}`}function bt(e){if(!pt(e))throw new Error(`Invalid address: ${e}`);return ue(e)}function Ct(e,t=4){const n=bt(e);return mt(n,t)}function mt(e,t=4){return`${e.slice(0,t+2)}...${e.slice(-t)}`}function Ht(e){var s;if(!e)return!1;const n=(typeof e=="string"?e:(e==null?void 0:e.message)||((s=e==null?void 0:e.data)==null?void 0:s.message)||"").toLowerCase();return n.includes("insufficient funds")||n.includes("insufficient balance")||n.includes("insufficient")&&(n.includes("native")||n.includes("gas"))||(e==null?void 0:e.code)==="INSUFFICIENT_FUNDS"||(e==null?void 0:e.reason)==="insufficient funds"}function yt(e){var s;if(!e)return{message:"Unknown error"};const t=typeof e=="string"?e:(e==null?void 0:e.message)||((s=e==null?void 0:e.data)==null?void 0:s.message)||String(e);return{code:(e==null?void 0:e.code)||(e==null?void 0:e.reason),message:t}}async function Lt(e){return xt({...e,action:"transaction:sent"})}function xt(e){return W({client:e.client,data:{action:e.action,chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:A(e.error),functionName:e.functionName,gasPrice:e.gasPrice,transactionHash:e.transactionHash,walletAddress:e.walletAddress,walletType:e.walletType},ecosystem:e.ecosystem})}async function vt(e){var n,s,i;const t=yt(e.error);return W({client:e.client,data:{action:"transaction:insufficient_funds",chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:t.code?A(t.code):void 0,errorMessage:t.message,functionName:e.functionName,requiredAmount:(n=e.requiredAmount)==null?void 0:n.toString(),transactionValue:(s=e.transactionValue)==null?void 0:s.toString(),userBalance:(i=e.userBalance)==null?void 0:i.toString(),walletAddress:e.walletAddress},ecosystem:e.ecosystem})}function Pt(e=32){return K(wt(e))}function wt(e=32){return globalThis.crypto.getRandomValues(new Uint8Array(e))}const $t=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],Ut=[...$t,"guest","backend","email","phone","passkey","wallet"];export{T as A,g as B,_ as C,St as D,ee as E,Et as F,It as G,Y as H,Ae as I,ke as J,Se as K,Ie as L,Bt as M,Ee as N,ze as O,Le as P,ve as Q,kt as R,At as S,Ct as T,mt as U,Mt as V,De as a,pt as b,ce as c,_t as d,M as e,te as f,bt as g,Be as h,J as i,zt as j,dt as k,Ut as l,ue as m,Ht as n,vt as o,S as p,$t as q,Pt as r,F as s,Lt as t,Ot as u,Pe as v,ne as w,Te as x,Me as y,Ce as z};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B6-Xobl2.js","assets/index-D2E7Umr3.css","assets/estimate-l1-fee-DnqX0KQm.js","assets/to-serializable-transaction-DAYFWHyO.js","assets/types-DFEAKZ3L.js","assets/read-contract-D8CQ_i-D.js","assets/Authorization-DmoiysGx.js","assets/Address-BHGD07NO.js","assets/Solidity-D6b-SCK0.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{o as x,n as u,c as p,Y as c,Z as S,f as C,G as P,s as z,L as _,m as l,_ as b}from"./index-B6-Xobl2.js";import{b as A}from"./types-DFEAKZ3L.js";import{w as g,x as T,y as k,I,t as H,r as M,z as L,A as B,B as U,C as F}from"./to-serializable-transaction-DAYFWHyO.js";function G(e){let t;if(typeof e=="string")t=g(e);else{const r=T(e),n=e.length;for(let a=0;a<n;a++){const s=e[a];if(!k(s)){t=g(s,r);break}}}if(!t)throw new I({signature:e});return t}function d(e){return x(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function se(e,t){if(e.length!==t.length)throw new Error("The number of parameters and values must match.");const r=O({params:e,values:t}),n=h(r);return n.length===0?"0x":n}function O({params:e,values:t}){const r=[];for(let n=0;n<e.length;n++)r.push(f({param:e[n],value:t[n]}));return r}function f({param:e,value:t}){const r=R(e.type);if(r){const[n,a]=r;return Z(t,{length:n,param:{...e,type:a}})}if(e.type==="tuple")return v(t,{param:e});if(e.type==="address")return $(t);if(e.type==="bool")return W(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const n=e.type.startsWith("int");return D(t,{signed:n})}if(e.type.startsWith("bytes"))return V(t,{param:e});if(e.type==="string")return N(t);throw new Error(`Unsupported parameter type: ${e.type}`)}function h(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:o}=e[s];i?t+=32:t+=d(o)}const r=[],n=[];let a=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:o}=e[s];i?(r.push(u(t+a,{size:32})),n.push(o),a+=d(o)):r.push(o)}return p(...r,...n)}function $(e){if(e!==""&&e!==void 0&&!A(e))throw new Error(`Invalid address: ${e}`);return{dynamic:!1,encoded:c(e.toLowerCase())}}function Z(e,{length:t,param:r}){const n=t===null;if(!Array.isArray(e))throw new Error("Invalid array value.");if(!n&&e.length!==t)throw new Error("Invalid array length.");let a=!1;const s=[];for(let i=0;i<e.length;i++){const o=f({param:r,value:e[i]});o.dynamic&&(a=!0),s.push(o)}if(n||a){const i=h(s);if(n){const o=u(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?p(o,i):o}}if(a)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:p(...s.map(({encoded:i})=>i))}}function V(e,{param:t}){const[,r]=t.type.split("bytes"),n=d(e);if(!r){let a=e;return n%32!==0&&(a=c(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:p(c(u(n,{size:32})),a)}}if(n!==Number.parseInt(r))throw new Error(`Invalid bytes${r} size: ${n}`);return{dynamic:!1,encoded:c(e,{dir:"right"})}}function W(e){return{dynamic:!1,encoded:c(S(e))}}function D(e,{signed:t}){return{dynamic:!1,encoded:u(e,{signed:t,size:32})}}function N(e){const t=C(e),r=Math.ceil(d(t)/32),n=[];for(let a=0;a<r;a++)n.push(c(P(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:p(c(u(d(t),{size:32})),...n)}}function v(e,{param:t}){let r=!1;const n=[];for(let a=0;a<t.components.length;a++){const s=t.components[a],i=Array.isArray(e)?a:s.name,o=f({param:s,value:e[i]});n.push(o),o.dynamic&&(r=!0)}return{dynamic:r,encoded:r?h(n):p(...n.map(({encoded:a})=>a))}}function R(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const m=new _(4096);function ie(e){const t=typeof e=="string"?e:z(e);if(m.has(t))return m.get(t);const r=typeof e=="string"?G(e):e,a=[H(r),r.inputs,r.outputs];return m.set(t,a),a}const j=l({blockExplorers:[{apiUrl:"https://api.basescan.org/api",name:"Basescan",url:"https://basescan.org"}],id:8453,name:"Base",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"}}),Y=l({blockExplorers:[{apiUrl:"https://api-sepolia.basescan.org/api",name:"Basescan",url:"https://sepolia.basescan.org"}],id:84532,name:"Base Sepolia",nativeCurrency:{decimals:18,name:"Sepolia Ether",symbol:"ETH"},testnet:!0}),q=l({blockExplorers:[{apiUrl:"https://api-optimistic.etherscan.io",name:"Optimism Explorer",url:"https://optimistic.etherscan.io"}],id:10,name:"OP Mainnet",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"}}),J=l({blockExplorers:[{apiUrl:"https://optimism-sepolia.blockscout.com/api",name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}],id:11155420,name:"OP Sepolia",nativeCurrency:{decimals:18,name:"Sepolia Ether",symbol:"ETH"},testnet:!0}),K=l({blockExplorers:[{apiUrl:"https://explorer.zora.energy/api",name:"Explorer",url:"https://explorer.zora.energy"}],id:7777777,name:"Zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"}}),Q=l({blockExplorers:[{apiUrl:"https://sepolia.explorer.zora.energy/api",name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}],id:999999999,name:"Zora Sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},testnet:!0}),X=[j.id,Y.id,q.id,J.id,K.id,Q.id,34443,919,42220,44787,204,5611];async function ee(e){if(e.id===1337||e.id===31337)return!1;if(X.includes(e.id))return!0;try{const{getChainMetadata:t}=await b(async()=>{const{getChainMetadata:n}=await import("./index-B6-Xobl2.js").then(a=>a.ba);return{getChainMetadata:n}},__vite__mapDeps([0,1]));return(await t(e)).stackType==="optimism_bedrock"}catch{return!1}}async function te(e){var y;const{transaction:t}=e,r=((y=e.account)==null?void 0:y.address)??void 0,n=await M(t.gas)||await L({from:r,transaction:t}),a=await B(t.client,t.chain),s=a.maxFeePerGas||a.gasPrice;if(s===void 0)throw new Error(`Unable to determine gas price for chain ${t.chain.id}`);let i;if(await ee(t.chain)){const{estimateL1Fee:w}=await b(async()=>{const{estimateL1Fee:E}=await import("./estimate-l1-fee-DnqX0KQm.js");return{estimateL1Fee:E}},__vite__mapDeps([2,3,0,1,4,5,6,7,8]));i=await w({transaction:t})}else i=0n;const o=n*s+i;return{ether:U(o),wei:o}}function oe(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="function")}async function ce(e,t){try{const r=await te({from:t,transaction:e}),n=r.wei/10n;return r.wei+n}catch{return 1000000n*await F({chain:e.chain,client:e.client})}}export{G as a,se as e,ce as g,oe as i,ie as p};
|