@dcl/shop 1.0.2-31061952187.commit-8d8b09e → 1.0.2-31093320960.commit-a66fdac
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/{Activity-D_fQdZon.js → Activity-BZYV865P.js} +29 -29
- package/_assets/{AnimatedBackground-C9W4RBcZ.js → AnimatedBackground-C_gdl0Ga.js} +1 -1
- package/_assets/Assets-D6xTxE6H.js +892 -0
- package/_assets/{Assets.styles-BBWJCcMx.js → Assets.styles-C2Y2OMju.js} +80 -72
- package/_assets/{Authorizations-DVwQ95Ww.js → Authorizations-Dyl-2_Wx.js} +1 -1
- package/_assets/Cart-q1C0b7B0.js +706 -0
- package/_assets/{CircularProgress-D09608yv.js → CircularProgress-DfC_DW6J.js} +1 -1
- package/_assets/{Collection-DllncUVv.js → Collection-CikwxEA2.js} +11 -11
- package/_assets/{CollectionCarousel-B9HmGuVb.js → CollectionCarousel-CW99ees-.js} +182 -126
- package/_assets/{Confetti-Dl6FT7nL.js → Confetti-D-f5Qezh.js} +1 -1
- package/_assets/Creator-sxuxQmmv.js +307 -0
- package/_assets/{ErrorNotice-OUNK486K.js → ErrorNotice-D_MmJHjd.js} +1 -1
- package/_assets/{ExchangeController-Cp3qbfAM.js → ExchangeController-5e1qfrC7.js} +1 -1
- package/_assets/{Faq-DXtTtsuA.js → Faq-CZWOMrti.js} +1 -1
- package/_assets/{GetCredits-BhRNCaTG.js → GetCredits-EPpLyZrC.js} +19 -12
- package/_assets/{Grow-DXdR0gI9.js → Grow-CJcrEIIk.js} +1 -1
- package/_assets/{HelpersUtil-rQp5uDAx.js → HelpersUtil-D4FO24BM.js} +1 -1
- package/_assets/ItemDetail-Daqpqudw.js +3552 -0
- package/_assets/JumpInIcon-CfzbSVBF.js +1 -0
- package/_assets/LazyEmoteControls-CynuOxLa.js +2 -0
- package/_assets/{LoadMore-jSNRJiwZ.js → LoadMore-BcR7LuW8.js} +1 -1
- package/_assets/{ManaPricingBanner.styles-vDUAKLLe.js → ManaPricingBanner.styles-b_tWuH2r.js} +2 -2
- package/_assets/MyAssets-CY3P4YpT.js +396 -0
- package/_assets/{MyFavorites-BLrz2vwY.js → MyFavorites-2J4ivx_A.js} +20 -17
- package/_assets/{NotFound-DP4nosOd.js → NotFound-B9SvSXoT.js} +1 -1
- package/_assets/{NotificationsBell-ARziPv8W.js → NotificationsBell-DDd4PHL_.js} +1 -1
- package/_assets/{OutfitDetail-CLmuEgB3.js → OutfitDetail-DfQD1uwS.js} +12 -9
- package/_assets/{OutfitPreview-PWdXvCaE.js → OutfitPreview-B8wqKe4G.js} +1 -1
- package/_assets/{OutfitStudio-Cx3Xm6ff.js → OutfitStudio-C8kgT_Q1.js} +46 -46
- package/_assets/{StoreSettings-BQtEgWRm.js → StoreSettings-BszakGpI.js} +21 -21
- package/_assets/Success-BlrhZwie.js +353 -0
- package/_assets/{SwapController-Bf58lQ6b.js → SwapController-CtdE4CSE.js} +1 -1
- package/_assets/{Tooltip-BDmKiALz.js → Tooltip-D92iGFCG.js} +1 -1
- package/_assets/{TradeService-Yecm1OxI.js → TradeService-CDrDGVbQ.js} +1 -1
- package/_assets/{W3MFrameProviderSingleton-BQyeyr-U.js → W3MFrameProviderSingleton-ChXXI6YZ.js} +3 -3
- package/_assets/{WebCryptoP256-Ou_F2OJp.js → WebCryptoP256-D8s1Qscb.js} +1 -1
- package/_assets/{authorizations-B3AvOvOm.js → authorizations-qnGN3xsk.js} +1 -1
- package/_assets/{basic-DTDRwam-.js → basic-DhSHVZRT.js} +1 -1
- package/_assets/{biconomy-DaLi1O64.js → biconomy-ClBW5VwG.js} +1 -1
- package/_assets/{builder-DxumJmKw.js → builder-CL5pdg21.js} +1 -1
- package/_assets/{buy-BHkfYJLe.js → buy-B-DDln2Y.js} +1 -1
- package/_assets/{buy-gasless-BfTEWjT9.js → buy-gasless-C_BmhnE7.js} +1 -1
- package/_assets/{categories-D23W_J-A.js → categories-B8yCTSzR.js} +73 -58
- package/_assets/{ccip-qhHiv1gU.js → ccip-CJEnBLGM.js} +1 -1
- package/_assets/{ccip-DGVhZCZ4.js → ccip-DQfkaCht.js} +1 -1
- package/_assets/collectionPage.styles-CcRhgEaw.js +32 -0
- package/_assets/{controller-DGtmLk4f.js → controller-JXbdlxZp.js} +2 -2
- package/_assets/{core-BAqS3vu7.js → core-BSxLBlxi.js} +4 -4
- package/_assets/{createSvgIcon-Bm9nxGqG.js → createSvgIcon-yVJuzYrn.js} +2 -2
- package/_assets/{custom-MaGTnz7S.js → custom-B3uMWhu7.js} +1 -1
- package/_assets/{data-capture-5Vi1cyBa.js → data-capture-B-nbrWqF.js} +1 -1
- package/_assets/{email-BG6hRXMo.js → email-CVdda8uU.js} +1 -1
- package/_assets/{embedded-wallet-CfnknCH8.js → embedded-wallet-Y6M29Es7.js} +1 -1
- package/_assets/{emotion-styled.browser.esm-CoxAZUrJ.js → emotion-styled.browser.esm-BF1qb2R0.js} +1 -1
- package/_assets/{engine-nQGCV50K.js → engine-fjR5dIp4.js} +1 -1
- package/_assets/{errors-DZ_QWsza.js → errors-B_JuFrfU.js} +1 -1
- package/_assets/{estimate-l1-fee-CVpJ9ym5.js → estimate-l1-fee-B1LOd6k3.js} +1 -1
- package/_assets/{execute-DFvUDrLY.js → execute-BXynqqjh.js} +2 -2
- package/_assets/{features-BXUedULM.js → features-Czbv6jQA.js} +1 -1
- package/_assets/{fetchTokenMetadata-CkQcnzmO.js → fetchTokenMetadata-BuR7htwA.js} +2 -2
- package/_assets/{field.styles-PE4ZasC2.js → field.styles-DFDRX2tk.js} +1 -1
- package/_assets/{get-ecosystem-wallet-info-CRLH8I6C.js → get-ecosystem-wallet-info-C8Jcr_V9.js} +1 -1
- package/_assets/{getBalance-CiV48JsZ.js → getBalance-sCJcvWYJ.js} +1 -1
- package/_assets/{getNFT-CV3N9TTA.js → getNFT-Vt2rJ26d.js} +1 -1
- package/_assets/{getNFT-C3ucNb89.js → getNFT-mOXdmQiA.js} +1 -1
- package/_assets/{grid.styles-hOZTJ80g.js → grid.styles-CX_shgZ5.js} +1 -1
- package/_assets/{hashTypedData-BtF2J233.js → hashTypedData-CN02HuAO.js} +1 -1
- package/_assets/{hashTypedData-gTABcRB5.js → hashTypedData-LiZBeYpJ.js} +1 -1
- package/_assets/identity-icon-C8yAW_Gq.svg +8 -0
- package/_assets/{in-app-CSDr4Blb.js → in-app-Di-YguDK.js} +1 -1
- package/_assets/{in-app-wallet-calls-Crivl9zc.js → in-app-wallet-calls-DeaYPRmI.js} +1 -1
- package/_assets/{index-CvwosU6Y.js → index-8YFhojLT.js} +1 -1
- package/_assets/{index-BTDIKmoC.js → index-94LcKPqN.js} +1 -1
- package/_assets/{index-CHf7lsmp.js → index-B5pEWwvB.js} +1 -1
- package/_assets/{index-D5eMvKb_.js → index-BJXNRLkE.js} +1 -1
- package/_assets/{index-ItjVcw1b.js → index-BKaw3xHY.js} +1 -1
- package/_assets/{index-Bs4LvV4K.js → index-BKtPMRlC.js} +2 -2
- package/_assets/{index-S0X-BG2b.js → index-BKwIRP5b.js} +1 -1
- package/_assets/{index-C0pcaEQl.js → index-BPg5Mvmb.js} +1 -1
- package/_assets/{index-CwRTjZPC.js → index-BRQ9Wcma.js} +3 -3
- package/_assets/{index-DKHMu0o3.js → index-BVxFsPRO.js} +1 -1
- package/_assets/{index-CyRHowbs.js → index-BanfPpYD.js} +1 -1
- package/_assets/{index-KWEbYeSY.js → index-Bf_azgOs.js} +1 -1
- package/_assets/{index-HAEoS9R6.js → index-BgNzVgyj.js} +1 -1
- package/_assets/{index-BniGBCAO.js → index-Bk3rNDtD.js} +1 -1
- package/_assets/{index-Dp2641E3.js → index-BkZn7ynX.js} +1 -1
- package/_assets/{index-C5Evg5sh.js → index-Bl852CQj.js} +1 -1
- package/_assets/{index-DkV5TYom.js → index-Bm_zAXvq.js} +1 -1
- package/_assets/{index-CHolIX6U.js → index-BsJj67OU.js} +1 -1
- package/_assets/{index-hKv-BpxY.js → index-BuWzyRcz.js} +1 -1
- package/_assets/{index-CKUuopSw.js → index-BwmnMTdg.js} +526 -451
- package/_assets/{index-BBbwMaBz.js → index-Bz4Oae-5.js} +1 -1
- package/_assets/{index-DSuiX4WG.js → index-BzBhg1fo.js} +1 -1
- package/_assets/{index-DnJJn52L.js → index-C0C9VUse.js} +1 -1
- package/_assets/{index-CmY0V0eX.js → index-C3CEKm2j.js} +1 -1
- package/_assets/{index-DdmULNRk.js → index-C6AA1Xf7.js} +2 -2
- package/_assets/{index-CkGO7qOd.js → index-CBhJLill.js} +1 -1
- package/_assets/{index-DLFQdlEW.js → index-CF-t9R4v.js} +1 -1
- package/_assets/{index-BNBzDf6z.js → index-CahHjkxT.js} +1 -1
- package/_assets/{index-Cf-gi-Qq.js → index-CcCpGfgd.js} +1 -1
- package/_assets/{index-UyXkCiLs.js → index-CdZzuE8e.js} +1 -1
- package/_assets/{index-DjTNPtj2.js → index-CfP1fkI_.js} +1 -1
- package/_assets/{index-Dh85kccn.js → index-Cleyy_0q.js} +1 -1
- package/_assets/{index-DwX-9Zo4.js → index-CnCeem_J.js} +1 -1
- package/_assets/{index-ClUPCoEW.js → index-D6OOP-51.js} +1 -1
- package/_assets/{index-BYP7oMPZ.css → index-DB6GvbxL.css} +1 -1
- package/_assets/{index-DXRL-4ld.js → index-DDJ7sdXv.js} +1 -1
- package/_assets/{index-CS27am7J.js → index-DJpl6Nbn.js} +1 -1
- package/_assets/{index-DKdQUEzy.js → index-DNNPYfed.js} +1 -1
- package/_assets/{index-9x1mGBeU.js → index-DQzE_-yq.js} +1 -1
- package/_assets/{index-DgOiZShm.js → index-DULGD4d2.js} +1 -1
- package/_assets/{index-C7hpB9s1.js → index-DaSPxwNy.js} +3 -3
- package/_assets/{index-DoGz07sk.js → index-DjW0J8pD.js} +1 -1
- package/_assets/{index-9_4ZEs3N.js → index-DjYBUAnI.js} +1 -1
- package/_assets/{index-CGBg3yUz.js → index-DlFosNf0.js} +5 -5
- package/_assets/{index-D7LYoLo4.js → index-Dm6Y9ZbQ.js} +1 -1
- package/_assets/{index-EKmmXx1j.js → index-Dr4f9K-t.js} +1 -1
- package/_assets/{index-qGMuaBIs.js → index-FT6agMXk.js} +1 -1
- package/_assets/{index-1oceTWwb.js → index-IvNZzfoI.js} +3 -3
- package/_assets/{index-C23D_vyT.js → index-N1bohwEM.js} +1 -1
- package/_assets/{index-D769FdFr.js → index-OQab0-JQ.js} +1 -1
- package/_assets/{index-wRmEiTlP.js → index-rEZ_4IFC.js} +2 -2
- package/_assets/{index-Bg_gOSx_.js → index-sFhq_-vF.js} +1 -1
- package/_assets/{index-DY1xBku2.js → index-tLIN_GkS.js} +1 -1
- package/_assets/{index.es-g_bB-nFv.js → index.es-CAHIM3qD.js} +1 -1
- package/_assets/{index.es-DnMGDxtr.js → index.es-DAZuzUm7.js} +1 -1
- package/_assets/{index.es-wpL2Ycto.js → index.es-Dwz0IUN6.js} +4 -4
- package/_assets/invite-icon-Bz6lCTuB.svg +11 -0
- package/_assets/{localBatchGatewayRequest-DtELSHiE.js → localBatchGatewayRequest-CmvuTHFj.js} +1 -1
- package/_assets/{networks-ZmRqsvV6.js → networks-DxoGDzHE.js} +1 -1
- package/_assets/{onramp-Bffl3qa3.js → onramp-DUHkYtuW.js} +1 -1
- package/_assets/{openzeppelin-BmH-LNci.js → openzeppelin-sla19LMh.js} +1 -1
- package/_assets/{parseNft-PSjb4qKi.js → parseNft-UEsMFiqe.js} +2 -2
- package/_assets/{parseSignature-IigTmAp7.js → parseSignature-BhyKODlU.js} +1 -1
- package/_assets/{parseSignature-D947kFfv.js → parseSignature-CPQ4376G.js} +3 -3
- package/_assets/{passkeys-BsJVcpuM.js → passkeys-wDVu6yuN.js} +1 -1
- package/_assets/{pay-with-exchange-CU_HZd9F.js → pay-with-exchange-CWK-Ssp3.js} +1 -1
- package/_assets/{qr-overlay-EMShc5uE.js → qr-overlay-BNEHuGJ4.js} +1 -1
- package/_assets/{receive-CO6WElZa.js → receive-BWFbKioL.js} +1 -1
- package/_assets/{resolveImplementation-CUngPhAv.js → resolveImplementation-DgfhwMlM.js} +1 -1
- package/_assets/{rpc-BqH_VMy9.js → rpc-BqdwSpX8.js} +1 -1
- package/_assets/{secp256k1-D7kpLshE.js → secp256k1-BBK7GqHS.js} +1 -1
- package/_assets/{secp256k1-CTsmRKJj.js → secp256k1-C-W8I-Zy.js} +1 -1
- package/_assets/{secp256k1-DneM3aYG.js → secp256k1-DREcXm38.js} +1 -1
- package/_assets/{send-DnwW2LgN.js → send-CHzkLWPr.js} +1 -1
- package/_assets/{send-batch-transaction-BgJnfEM8.js → send-batch-transaction-5BgfAaSR.js} +1 -1
- package/_assets/{send-eip712-transaction-Cw3ykz5y.js → send-eip712-transaction-D_wCG6QA.js} +2 -2
- package/_assets/{send-gasless-transaction-BjGhnCwR.js → send-gasless-transaction-tLadnb9y.js} +2 -2
- package/_assets/{send-transaction-COKVeGfk.js → send-transaction-D3DYgONV.js} +2 -2
- package/_assets/{sendMetaTransaction-Bp3kwdLJ.js → sendMetaTransaction-Uawte2uP.js} +1 -1
- package/_assets/{sendRawTransaction-eVli2oE3.js → sendRawTransaction-yrJJjJuj.js} +3 -3
- package/_assets/{serializeTransaction-CIM9i_-w.js → serializeTransaction-DbAjRO35.js} +1 -1
- package/_assets/{session-proposal-KGl_Ah2b.js → session-proposal-tovuipdf.js} +1 -1
- package/_assets/{session-request-VAEXTksW.js → session-request-CJx8_Nqv.js} +2 -2
- package/_assets/{signing-Cgx49_1X.js → signing-DIdv4EGK.js} +3 -3
- package/_assets/{skeleton.styles-BXNXDWEi.js → skeleton.styles-JTH6hNy6.js} +1 -1
- package/_assets/{socials-oKAOeF-k.js → socials-BMAR0gR_.js} +1 -1
- package/_assets/{styled-pD_2hanx.js → styled-Dfg0i8eX.js} +1 -1
- package/_assets/{swaps-BcAY_D99.js → swaps-BGa4ySw5.js} +1 -1
- package/_assets/{thirdweb-ChAqWFCO.js → thirdweb-Bf4Axk_U.js} +3 -3
- package/_assets/{to-serializable-transaction-D9qGbcrS.js → to-serializable-transaction-DRJLaygN.js} +2 -2
- package/_assets/{transactionReceipt-BMw52z-f.js → transactionReceipt-Bhig9TGy.js} +1 -1
- package/_assets/{transactions-CeENvGIt.js → transactions-CCUXYIeH.js} +1 -1
- package/_assets/{useCreditPacks-BcavayJ3.js → useCreditPacks-D8rMiOb_.js} +1 -1
- package/_assets/{useImportable-CqnIvzif.js → useImportable-CNQfbBw8.js} +1 -1
- package/_assets/{useInfiniteGrid-BjEQAabI.js → useInfiniteGrid-BADHIu6F.js} +1 -1
- package/_assets/{useTheme-BnnteKI4.js → useTheme-DBV2Tqy3.js} +1 -1
- package/_assets/{verifyHash-CuRmy06R.js → verifyHash-Cdp-LdrE.js} +1 -1
- package/_assets/{w3m-modal-BvOCJx7k.js → w3m-modal-BxSlR5wP.js} +1 -1
- package/_assets/{w3m-modal-CkBFH4cA.js → w3m-modal-CIDOCqB8.js} +1 -1
- package/_assets/{wait-for-tx-receipt-B2KaPYJT.js → wait-for-tx-receipt-C9B0C6I6.js} +1 -1
- package/_assets/{wallets-CpXU08d2.js → wallets-wYcTf8sk.js} +5 -5
- package/_assets/{web-connector-BHRkWbB9.js → web-connector-DC2N7iZ9.js} +3 -3
- package/_assets/world-icon-6xQ-PmmW.svg +7 -0
- package/_assets/{writeContract-DNDGvg0r.js → writeContract-EKs-5iav.js} +1 -1
- package/_assets/{zoraTestnet-CCn01jlp.js → zoraTestnet-DPmpNXvV.js} +1 -1
- package/index.html +11 -11
- package/package.json +2 -2
- package/_assets/Assets-CvZql_4R.js +0 -866
- package/_assets/Cart-CBLHJRVj.js +0 -706
- package/_assets/Creator-BreBnKPX.js +0 -305
- package/_assets/ItemDetail-clRbfaLQ.js +0 -3551
- package/_assets/LazyEmoteControls-B7UYn8xk.js +0 -2
- package/_assets/MyAssets-CsWhc-qa.js +0 -381
- package/_assets/Success-BWfI3_Mu.js +0 -280
- package/_assets/collectionPage.styles-CoEdrsfq.js +0 -49
- package/_assets/governance-DnazlIjy.webp +0 -0
- package/_assets/identity-B4DXDuJP.webp +0 -0
- package/_assets/invite-BfwIhP2C.webp +0 -0
- package/_assets/world-B-9aPlxu.webp +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/eth_getTransactionCount-Ck8bEyl_.js","_assets/prepare-contract-call-DDzIRXLv.js","_assets/utils-BQF5MiO5.js","_assets/sentry-Dx-KuLV3.js","_assets/react-BYHuwl8r.js","_assets/in-app-wallet-calls-
|
|
2
|
-
import{_ as y}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_assets/eth_getTransactionCount-Ck8bEyl_.js","_assets/prepare-contract-call-DDzIRXLv.js","_assets/utils-BQF5MiO5.js","_assets/sentry-Dx-KuLV3.js","_assets/react-BYHuwl8r.js","_assets/in-app-wallet-calls-DeaYPRmI.js","_assets/wait-for-tx-receipt-C9B0C6I6.js","_assets/transactionReceipt-Bhig9TGy.js","_assets/to-serializable-transaction-DRJLaygN.js","_assets/index-BwmnMTdg.js","_assets/dcl-schemas-CmtP3U6y.js","_assets/ethers-BDpbhgX6.js","_assets/intl-CBcMB1D2.js","_assets/index-DB6GvbxL.css","_assets/transaction-Col-q-Ce.js","_assets/sleep-mAKpSMLY.js","_assets/send-batch-transaction-5BgfAaSR.js","_assets/send-transaction-D3DYgONV.js","_assets/execute-BXynqqjh.js","_assets/detectExtension-DX7grDLh.js","_assets/passkeys-wDVu6yuN.js","_assets/uint8-array-CjVHUazS.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{_ as y}from"./index-BwmnMTdg.js";import{c as p,e as g,a as I,f as O}from"./utils-BQF5MiO5.js";import{r as q,C as D,w as F,I as Q}from"./execute-BXynqqjh.js";import{a as H,s as J}from"./types-DC0Zmj1B.js";import{s as w,g as b,W as Y,c as P,T as W,f as Z,a6 as K}from"./prepare-contract-call-DDzIRXLv.js";import{p as U,l as X,u as ee,g as te}from"./linkAccount-BtAQZlYa.js";import{t as N}from"./transaction-Col-q-Ce.js";import{e as B}from"./eth_sendRawTransaction-DPdnXbFR.js";import{s as k}from"./sleep-mAKpSMLY.js";import"./react-BYHuwl8r.js";import"./dcl-schemas-CmtP3U6y.js";import"./sentry-Dx-KuLV3.js";import"./ethers-BDpbhgX6.js";import"./intl-CBcMB1D2.js";import"./detectExtension-DX7grDLh.js";const T=new Map,ie={getItem:async i=>T.get(i)??null,removeItem:async i=>{T.delete(i)},setItem:async(i,e)=>{T.set(i,e)}};async function A({authToken:i,client:e,ecosystem:t}){const r=await g(e,t)(`${p("inAppWallet")}/api/2024-05-05/accounts`,{headers:{Authorization:`Bearer embedded-wallet-token:${i}`,"Content-Type":"application/json"},method:"GET"});if(!r.ok){const l=await r.text().catch(()=>"Unknown error");throw new Error(`Failed to get user info: ${l}`)}return await r.json()}const ae=p("inAppWallet"),ne=`${ae}/`,R=`${ne}api/2023-10-20`,re=`${R}/embedded-wallet/validate-custom-jwt`,se=`${R}/embedded-wallet/validate-custom-auth-endpoint`,M=(i,e)=>e instanceof Error?`${i}: ${e.message}`:`${i}: ${w(e)}`;async function oe(i){const t=await g(i.client,i.ecosystem)(se,{body:w({developerClientId:i.client.clientId,payload:i.payload}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`Custom auth endpoint authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post auth_endpoint authentication",a))}}const z=i=>{if(!H.includes(i))throw new Error(`Unknown auth option ${i}`);switch(i){case"wallet":return"siwe";default:return i}},v=({authOption:i,client:e,ecosystem:t,mode:a="popup",redirectUrl:r,authFlow:l})=>{if(a==="popup"&&r)throw new Error("Redirect URL is not supported for popup mode");if(a==="window"&&!r)throw new Error("Redirect URL is required for window mode");const c=z(i);let n=`${p("inAppWallet")}/api/2024-05-05/login/${c}?clientId=${e.clientId}`;if(t!=null&&t.partnerId?n=`${n}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(n=`${n}&ecosystemId=${t.id}`),a!=="popup"){const o=new URL(r||window.location.href);o.searchParams.set("walletId",(t==null?void 0:t.id)||"inApp"),o.searchParams.set("authProvider",i),l&&o.searchParams.set("authFlow",l),n=`${n}&redirectUrl=${encodeURIComponent(o.toString())}`}return n},S=({authOption:i,client:e,ecosystem:t})=>{const a=z(i);let r=`${p("inAppWallet")}/api/2024-05-05/login/${a}/callback?clientId=${e.clientId}`;return t!=null&&t.partnerId?r=`${r}&ecosystemId=${t.id}&ecosystemPartnerId=${t.partnerId}`:t&&(r=`${r}&ecosystemId=${t.id}`),r};async function ce(i){const e=g(i.client,i.ecosystem),t=v({authOption:"backend",client:i.client,ecosystem:i.ecosystem}),a=await e(`${t}`,{body:w({walletSecret:i.walletSecret}),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok){const r=await a.text();throw new Error(`Failed to generate backend account: ${r}`)}return await a.json()}async function le(i){let e=await i.storage.getGuestSessionId();e||(e=q(32),i.storage.saveGuestSessionId(e));const t=g(i.client,i.ecosystem),a=S({authOption:"guest",client:i.client,ecosystem:i.ecosystem}),r=await t(`${a}`,{body:w({sessionId:e}),headers:{"Content-Type":"application/json"},method:"POST"});if(!r.ok){const l=await r.text();throw new Error(`Failed to generate guest account: ${r.status} ${r.statusText} ${l}`)}return await r.json()}async function de(i){const t=await g(i.client,i.ecosystem)(re,{body:w({developerClientId:i.client.clientId,jwt:i.jwt}),headers:{"Content-Type":"application/json"},method:"POST"});if(!t.ok){const a=await t.json();throw new Error(`JWT authentication error: ${a.message}`)}try{const{verifiedToken:a}=await t.json();return{storedToken:a}}catch(a){throw new Error(M("Malformed response from post jwt authentication",a))}}function x(){return`${p("inAppWallet")}/api/2024-05-05/login/passkey/callback`}function G(i,e){return`${p("inAppWallet")}/api/2024-05-05/login/passkey?type=${i}${e?`&username=${e}`:""}`}async function ue(i){var d,h,u;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=g(i.client,i.ecosystem),t=i.username??we(i.ecosystem),r=await(await e(G("sign-up",t))).json();if(!r.challenge)throw new Error("No challenge received");const l=r.challenge,c=await i.passkeyClient.register({challenge:l,name:t,rp:i.rp}),n={};(d=i.ecosystem)!=null&&d.partnerId&&(n["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(h=i.ecosystem)!=null&&h.id&&(n["x-ecosystem-id"]=i.ecosystem.id);const s=await(await e(x(),{body:w({authenticatorData:c.authenticatorData,clientData:c.clientData,credential:{algorithm:c.credential.algorithm,publicKey:c.credential.publicKey},credentialId:c.credentialId,origin:c.origin,rpId:i.rp.id,serverVerificationId:r.serverVerificationId,type:"sign-up",username:t}),headers:{"Content-Type":"application/json",...n},method:"POST"})).json();if(!s||!s.storedToken)throw new Error(`Error verifying passkey: ${s.message??"unknown error"}`);return await((u=i.storage)==null?void 0:u.savePasskeyCredentialId(c.credentialId)),s}async function he(i){var s,d,h,u;if(!i.passkeyClient.isAvailable())throw new Error("Passkeys are not available on this device");const e=g(i.client,i.ecosystem),[t,a]=await Promise.all([e(G("sign-in")).then(f=>f.json()),(s=i.storage)==null?void 0:s.getPasskeyCredentialId()]);if(!t.challenge)throw new Error("No challenge received");const r=t.challenge,l=await i.passkeyClient.authenticate({challenge:r,credentialId:a??void 0,rp:i.rp}),c={};(d=i.ecosystem)!=null&&d.partnerId&&(c["x-ecosystem-partner-id"]=i.ecosystem.partnerId),(h=i.ecosystem)!=null&&h.id&&(c["x-ecosystem-id"]=i.ecosystem.id);const o=await(await e(x(),{body:w({authenticatorData:l.authenticatorData,clientData:l.clientData,credentialId:l.credentialId,origin:l.origin,rpId:i.rp.id,serverVerificationId:t.serverVerificationId,signature:l.signature,type:"sign-in"}),headers:{"Content-Type":"application/json",...c},method:"POST"})).json();if(!o||!o.storedToken)throw new Error(`Error verifying passkey: ${o.message??"unknown error"}`);return await((u=i.storage)==null?void 0:u.savePasskeyCredentialId(l.credentialId)),o}function we(i){return`${(i==null?void 0:i.id)??"wallet"}-${new Date().toISOString()}`}function pe(i){let a=[`${i.domain} wants you to sign in with your Ethereum account:`,i.address].join(`
|
|
3
3
|
`);a=[a,i.statement].join(`
|
|
4
4
|
|
|
5
5
|
`),i.statement&&(a+=`
|
|
6
6
|
`);const r=[];if(i.uri){const d=`URI: ${i.uri}`;r.push(d)}const l=`Version: ${i.version}`;if(r.push(l),i.chain_id){const d=`Chain ID: ${i.chain_id}`||"1";r.push(d)}const c=`Nonce: ${i.nonce}`;r.push(c);const n=`Issued At: ${i.issued_at}`;r.push(n);const o=`Expiration Time: ${i.expiration_time}`;if(r.push(o),i.invalid_before){const d=`Not Before: ${i.invalid_before}`;r.push(d)}i.resources&&r.push(["Resources:",...i.resources.map(d=>`- ${d}`)].join(`
|
|
7
7
|
`));const s=r.join(`
|
|
8
8
|
`);return[a,s].join(`
|
|
9
|
-
`)}async function ge(i){const{payload:e,account:t}=i,a=await t.signMessage({message:pe(e)});return{payload:e,signature:a}}const me=["xyz.abs"];async function fe(i){const{wallet:e,client:t,ecosystem:a,chain:r}=i,l=me.includes(e.id)?r||I(1):I(1),c=e.getAccount()||await e.connect({chain:l,client:t}),n=g(t,a),o=await(async()=>{const h=v({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),u=await n(`${h}&address=${c.address}&chainId=${l.id}`);if(!u.ok)throw new Error("Failed to generate SIWE login payload");return await u.json()})(),{signature:s}=await ge({account:c,payload:o});return await(async()=>{const h=S({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),u=await n(`${h}&signature=${s}&payload=${encodeURIComponent(o)}`,{body:w({payload:o,signature:s}),headers:{"Content-Type":"application/json"},method:"POST"});if(!u.ok)throw new Error("Failed to verify SIWE signature");return await u.json()})()}async function ye({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing message");const c={address:e.address,chainId:e.chainId,nonce:Number(e.nonce)},n=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-authorization`,{body:w(c),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!n.ok)throw new Error(`Failed to sign message - ${n.status} ${n.statusText}`);return await n.json()}async function be({client:i,payload:{message:e,isRaw:t,originalMessage:a,chainId:r},storage:l}){const c=await l.getAuthCookie(),n=l.ecosystem,o=g(i,n);if(!c)throw new Error("No auth token found when signing message");const s=await o(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-message`,{body:w({messagePayload:{chainId:r,isRaw:t,message:e,originalMessage:a}}),headers:{Authorization:`Bearer embedded-wallet-token:${c}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!s.ok)throw new Error(`Failed to sign message - ${s.status} ${s.statusText}`);return await s.json()}async function Ie({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing transaction");const c=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,{body:w({transactionPayload:e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign transaction - ${c.status} ${c.statusText}`);return(await c.json()).signature}async function ve({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing typed data");const c=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,{body:w({...e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign typed data - ${c.status} ${c.statusText}`);return await c.json()}class ke{constructor({client:e,ecosystem:t,address:a,storage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"address",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.address=a,this.localStorage=r}async postWalletSetUp(e){await this.localStorage.saveAuthCookie(e.storedToken.cookieString)}async getUserWalletStatus(){var l,c;const e=await this.localStorage.getAuthCookie();if(!e)return{status:"Logged Out"};const t=await A({authToken:e,client:this.client,ecosystem:this.ecosystem});if(!t)return{status:"Logged Out"};const a=t.wallets[0],r={email:(l=t.linkedAccounts.find(n=>n.details.email!==void 0))==null?void 0:l.details.email,phoneNumber:(c=t.linkedAccounts.find(n=>n.details.phone!==void 0))==null?void 0:c.details.phone,recoveryShareManagement:"ENCLAVE",userWalletId:t.id||""};return a?{account:await this.getAccount(),authDetails:r,status:"Logged In, Wallet Initialized",walletAddress:a.address}:{authDetails:r,status:"Logged In, Wallet Uninitialized"}}async getAccount(){const e=this.client,t=this.localStorage,a=this.address,r=this.ecosystem,l=async n=>{const o=P({chain:I(n.chainId),client:e}),s={chainId:W(n.chainId),data:n.data,gas:m(n.gas),nonce:m(n.nonce)||W(await y(async()=>{const{eth_getTransactionCount:d}=await import("./eth_getTransactionCount-Ck8bEyl_.js");return{eth_getTransactionCount:d}},__vite__mapDeps([0,1,2,3,4])).then(({eth_getTransactionCount:d})=>d(o,{address:b(this.address),blockTag:"pending"}))),to:n.to?b(n.to):void 0,value:m(n.value)};return n.authorizationList&&n.authorizationList.length>0?(s.type=4,s.authorizationList=n.authorizationList,s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas)):m(n.maxFeePerGas)?(s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas),s.type=2):(s.gasPrice=m(n.gasPrice),s.type=0),Ie({client:e,payload:s,storage:t})},c={address:b(a),async sendTransaction(n){const o=P({chain:I(n.chainId),client:e}),s=await l(n),d=await B(o,s);return N({chainId:n.chainId,client:e,contractAddress:n.to??void 0,ecosystem:r,gasPrice:n.gasPrice,transactionHash:d,walletAddress:a,walletType:"inApp"}),{transactionHash:d}},async signAuthorization(n){const o=await ye({client:e,payload:n,storage:t});return{address:b(o.address),chainId:Number.parseInt(o.chainId),nonce:BigInt(o.nonce),r:BigInt(o.r),s:BigInt(o.s),yParity:Number.parseInt(o.yParity)}},async signMessage({message:n,originalMessage:o,chainId:s}){const d=typeof n=="string"?{chainId:s,isRaw:!1,message:n,originalMessage:o}:{chainId:s,isRaw:!0,message:typeof n.raw=="string"?n.raw:Y(n.raw),originalMessage:o},{signature:h}=await be({client:e,payload:d,storage:t});return h},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({chainId:n.chainId,...n})},async signTypedData(n){const o=U(n),{signature:s}=await ve({client:e,payload:o,storage:t});return s},sendCalls:async n=>{const{inAppWalletSendCalls:o}=await y(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-Crivl9zc.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([5,6,7,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19])),s=n.calls[0];if(!s)throw new Error("No calls to send");const d=s.client,h=s.chain||n.chain,u=await o({account:c,calls:n.calls,chain:h});return{chain:h,client:d,id:u}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:o}=await y(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-Crivl9zc.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([5,6,7,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19]));return o(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:o}=await y(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-Crivl9zc.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([5,6,7,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19]));return o(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:!1}}})};return c}}function m(i){return i===void 0||Z(i)?i:W(i)}const Te={backgroundColor:"transparent",border:"none",colorScheme:"light",display:"none",height:"100%",pointerEvents:"all",position:"fixed",right:"0px",top:"0px",width:"100%",zIndex:"2147483646"},L=new Map;class Le{constructor({link:e,baseUrl:t,iframeId:a,container:r,onIframeInitialize:l,localStorage:c,clientId:n,ecosystem:o}){if(Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"POLLING_INTERVAL_SECONDS",{enumerable:!0,configurable:!0,writable:!0,value:1.4}),Object.defineProperty(this,"iframeBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.localStorage=c,this.clientId=n,this.ecosystem=o,this.iframeBaseUrl=t,typeof document>"u")return;r=r??document.body;let s=document.getElementById(a);const d=new URL(e);if(!s||s.src!==d.href){s=document.createElement("iframe");const h={...Te};Object.assign(s.style,h),s.setAttribute("id",a),s.setAttribute("fetchpriority","high"),r.appendChild(s),s.src=d.href;const u=f=>{if(f.data.eventType==="ewsIframeLoaded"){if(window.removeEventListener("message",u),!s){console.warn("thirdweb iFrame not found");return}this.onIframeLoadHandler(s,l)()}};window.addEventListener("message",u)}this.iframe=s}async onIframeLoadedInitVariables(){var e,t;return{authCookie:await this.localStorage.getAuthCookie(),clientId:this.clientId,deviceShareStored:await this.localStorage.getDeviceShare(),ecosystemId:(e=this.ecosystem)==null?void 0:e.id,partnerId:(t=this.ecosystem)==null?void 0:t.partnerId,walletUserId:await this.localStorage.getWalletUserId()}}onIframeLoadHandler(e,t){return async()=>{var l;const a=new MessageChannel,r=new Promise((c,n)=>{a.port1.onmessage=o=>{const{data:s}=o;a.port1.close(),s.success||n(new Error(s.error)),L.set(e.src,!0),t&&t(),c(!0)}});(l=e==null?void 0:e.contentWindow)==null||l.postMessage({data:await this.onIframeLoadedInitVariables(),eventType:"initIframe"},this.iframeBaseUrl,[a.port2]),await r}}async call({procedureName:e,params:t,showIframe:a=!1}){var c;if(!this.iframe)throw new Error("Iframe not found. You are likely calling this from the backend where the DOM is not available.");for(;!L.get(this.iframe.src);)await k(this.POLLING_INTERVAL_SECONDS*1e3);a&&(this.iframe.style.display="block",await k(.005*1e3));const r=new MessageChannel,l=new Promise((n,o)=>{r.port1.onmessage=async s=>{const{data:d}=s;r.port1.close(),a&&(await k(.1*1e3),this.iframe&&(this.iframe.style.display="none")),d.success?n(d.data):o(new Error(d.error))}});return(c=this.iframe.contentWindow)==null||c.postMessage({data:{...t,...await this.onIframeLoadedInitVariables()},eventType:e},this.iframeBaseUrl,[r.port2]),l}destroy(){this.iframe&&L.delete(this.iframe.src)}}class Pe extends Le{constructor({clientId:e,baseUrl:t,ecosystem:a}){super({baseUrl:t,clientId:e,container:typeof document>"u"?void 0:document.body,ecosystem:a,iframeId:Ae+((a==null?void 0:a.id)||""),link:We({baseUrl:t,clientId:e,ecosystem:a,path:Q}).href,localStorage:new D({clientId:e,ecosystem:a,storage:F})}),this.clientId=e,this.ecosystem=a}}function We({clientId:i,baseUrl:e,path:t,ecosystem:a,queryParams:r}){var c;const l=new URL(`${t}`,e);if(r)for(const n of Object.keys(r))l.searchParams.set(n,((c=r[n])==null?void 0:c.toString())||"");return l.searchParams.set("clientId",i),(a==null?void 0:a.partnerId)!==void 0&&l.searchParams.set("partnerId",a.partnerId),(a==null?void 0:a.id)!==void 0&&l.searchParams.set("ecosystemId",a.id),l}const Ae="thirdweb-in-app-wallet-iframe";async function Se({client:i,ecosystem:e,authToken:t}){const r=await g(i,e)(`${p("inAppWallet")}/api/v1/enclave-wallet/generate`,{headers:{Authorization:`Bearer embedded-wallet-token:${t}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!r.ok)throw new Error(`Failed to generate wallet - ${r.status} ${r.statusText}`);const{wallet:l}=await r.json();return l}class Ee{constructor({baseUrl:e,querier:t,preLogin:a,postLogin:r,client:l,ecosystem:c}){Object.defineProperty(this,"LoginQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"postLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=e,this.LoginQuerier=t,this.preLogin=a,this.postLogin=r,this.client=l,this.ecosystem=c}async sendEmailLoginOtp({email:e}){return await this.LoginQuerier.call({params:{email:e},procedureName:"sendThirdwebEmailLoginOtp"})}async sendSmsLoginOtp({phoneNumber:e}){return await this.LoginQuerier.call({params:{phoneNumber:e},procedureName:"sendThirdwebSmsLoginOtp"})}}class Oe extends Ee{async authenticateWithModal(){return this.LoginQuerier.call({params:void 0,procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithModal(){await this.preLogin();const e=await this.authenticateWithModal();return this.postLogin(e)}async authenticateWithIframe({email:e}){return this.LoginQuerier.call({params:{email:e},procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithIframe({email:e}){await this.preLogin();const t=await this.authenticateWithIframe({email:e});return this.postLogin(t)}async authenticateWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");return this.LoginQuerier.call({params:{encryptionKey:e,jwt:t},procedureName:"loginWithCustomJwt"})}async loginWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");await this.preLogin();const a=await this.authenticateWithCustomJwt({encryptionKey:e,jwt:t});return this.postLogin(a)}async authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t}){return this.LoginQuerier.call({params:{encryptionKey:e,payload:t},procedureName:"loginWithCustomAuthEndpoint"})}async loginWithCustomAuthEndpoint({encryptionKey:e,payload:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom auth");await this.preLogin();const a=await this.authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t});return this.postLogin(a)}async authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{email:e,otp:t,recoveryCode:a},procedureName:"verifyThirdwebEmailLoginOtp"})}async loginWithEmailOtp({email:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a});return this.postLogin(r)}async authenticateWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{otp:t,phoneNumber:e,recoveryCode:a},procedureName:"verifyThirdwebSmsLoginOtp"})}async loginWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithSmsOtp({otp:t,phoneNumber:e,recoveryCode:a});return this.postLogin(r)}}class Ce{constructor({client:e,querier:t,onAuthSuccess:a,ecosystem:r,baseUrl:l,localStorage:c}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"AuthQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAuthSuccess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BaseLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=r,this.AuthQuerier=t,this.localStorage=c,this.onAuthSuccess=a,this.BaseLogin=new Oe({baseUrl:l,client:e,ecosystem:r,postLogin:async n=>this.postLogin(n),preLogin:async()=>{await this.preLogin()},querier:t})}async preLogin(){await this.logout()}async postLogin({storedToken:e,walletDetails:t}){return e.shouldStoreCookieString&&await this.localStorage.saveAuthCookie(e.cookieString),await this.onAuthSuccess({storedToken:e,walletDetails:t})}async loginWithAuthToken(e,t){var l;e.storedToken.authProvider!=="Backend"&&await this.preLogin();const a=await A({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot login, no user found for auth token");if(a.wallets.length>0&&((l=a.wallets[0])==null?void 0:l.type)==="enclave")return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:a.wallets[0].address}});if(a.wallets.length===0){const c=await Se({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:c.address}})}const r=await this.AuthQuerier.call({params:{recoveryCode:t,storedToken:e.storedToken},procedureName:"loginWithStoredTokenDetails"});return this.postLogin(r)}async loginWithModal(){return this.BaseLogin.loginWithModal()}async authenticateWithModal(){return this.BaseLogin.authenticateWithModal()}async loginWithIframe(e){return this.BaseLogin.loginWithIframe(e)}async authenticateWithIframe(e){return this.BaseLogin.authenticateWithIframe(e)}async loginWithCustomJwt(e){return this.BaseLogin.loginWithCustomJwt(e)}async authenticateWithCustomJwt(e){return this.BaseLogin.authenticateWithCustomJwt(e)}async loginWithCustomAuthEndpoint(e){return this.BaseLogin.loginWithCustomAuthEndpoint(e)}async authenticateWithCustomAuthEndpoint(e){return this.BaseLogin.authenticateWithCustomAuthEndpoint(e)}async sendEmailLoginOtp({email:e}){return this.BaseLogin.sendEmailLoginOtp({email:e})}async sendSmsLoginOtp({phoneNumber:e}){return this.BaseLogin.sendSmsLoginOtp({phoneNumber:e})}async loginWithEmailOtp(e){return await this.preLogin(),this.BaseLogin.loginWithEmailOtp(e)}async authenticateWithEmailOtp(e){return this.BaseLogin.authenticateWithEmailOtp(e)}async loginWithSmsOtp(e){return await this.preLogin(),this.BaseLogin.loginWithSmsOtp(e)}async authenticateWithSmsOtp(e){return this.BaseLogin.authenticateWithSmsOtp(e)}async logout(){const e=await this.localStorage.removeAuthCookie(),t=await this.localStorage.removeWalletUserId();return{success:e||t}}}const $e="width=350, height=500",C=({isWindowOpenedByFn:i,win:e,closeOpenedWindow:t})=>{i?e==null||e.close():e&&t?t(e):e&&e.close()};async function $(i){const e=v({...i,mode:i.mode||"redirect",authFlow:i.authFlow});i.mode==="redirect"?window.location.href=e:window.open(e),await new Promise(t=>setTimeout(t,5e3))}const je=async i=>{let e=i.openedWindow,t=!1;if(e||(e=window.open(v({...i,mode:"popup"}),`Login to ${i.authOption}`,$e),t=!0),!e)throw new Error("Something went wrong opening pop-up");return await new Promise((r,l)=>{const c=window.setInterval(async()=>{e.closed&&(clearInterval(c),window.removeEventListener("message",n),l(new Error("User closed login window")))},1e3),n=async o=>{if(o.origin===p("inAppWallet")){if(typeof o.data!="object"){l(new Error("Invalid event data"));return}switch(o.data.eventType){case"oauthSuccessResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),o.data.authResult&&r(o.data.authResult);break}case"oauthFailureResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),l(new Error(o.data.errorString));break}}}};window.addEventListener("message",n)})},_e=async i=>{const{client:e,ecosystem:t}=i,a=v({authOption:i.strategy,client:e,ecosystem:t}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{email:i.email};case"phone":return{phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok){const n=await c.text();let o;try{const s=JSON.parse(n);s&&typeof s.message=="string"&&(o=s.message)}catch{}throw new Error(o||"Failed to send verification code")}return await c.json()},j=async i=>{const{client:e,ecosystem:t}=i,a=S({authOption:i.strategy,client:i.client,ecosystem:i.ecosystem}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{code:i.verificationCode,email:i.email};case"phone":return{code:i.verificationCode,phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok)throw new Error("Failed to verify verification code");return await c.json()};class _{constructor({client:e,ecosystem:t,querier:a,localStorage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"walletManagerQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.walletManagerQuerier=a,this.localStorage=r}async postWalletSetUp(e){e.deviceShareStored&&await this.localStorage.saveDeviceShare(e.deviceShareStored,e.storedToken.authDetails.userWalletId)}async getUserWalletStatus(){const e=await this.walletManagerQuerier.call({params:void 0,procedureName:"getUserStatus"});return e.status==="Logged In, Wallet Initialized"?{status:"Logged In, Wallet Initialized",...e.user,account:await this.getAccount()}:e.status==="Logged In, New Device"?{status:"Logged In, New Device",...e.user}:e.status==="Logged In, Wallet Uninitialized"?{status:"Logged In, Wallet Uninitialized",...e.user}:{status:e.status}}async getAccount(){var c;const e=this.walletManagerQuerier,t=this.client,a=(c=this.ecosystem)==null?void 0:c.partnerId,{address:r}=await e.call({params:void 0,procedureName:"getAddress"}),l=async n=>{const o={chainId:n.chainId,data:n.data,gasLimit:n.gas,nonce:n.nonce,to:n.to??void 0,value:n.value};n.maxFeePerGas?(o.accessList=n.accessList,o.maxFeePerGas=n.maxFeePerGas,o.maxPriorityFeePerGas=n.maxPriorityFeePerGas,o.type=2):(o.gasPrice=n.gasPrice,o.type=0);const s=O().rpc,{signedTransaction:d}=await e.call({params:{chainId:n.chainId,partnerId:a,rpcEndpoint:`https://${n.chainId}.${s}`,transaction:o},procedureName:"signTransaction"});return d};return{address:b(r),async sendTransaction(n){const o=P({chain:I(n.chainId),client:t}),s=await l(n),d=await B(o,s);return N({chainId:n.chainId,client:t,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:d,walletAddress:r,walletType:"inApp"}),{transactionHash:d}},async signMessage({message:n}){const o=typeof n=="string"?n:n.raw instanceof Uint8Array?n.raw:K(n.raw),{signedMessage:s}=await e.call({params:{chainId:1,message:o,partnerId:a},procedureName:"signMessage"});return s},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({...n,chainId:n.chainId})},async signTypedData(n){var E;const o=U(n);(E=o.types)!=null&&E.EIP712Domain&&(o.types.EIP712Domain=void 0);const s=o.domain,d=s==null?void 0:s.chainId,u={...s!=null&&s.verifyingContract?{verifyingContract:s==null?void 0:s.verifyingContract}:{},name:s==null?void 0:s.name,version:s==null?void 0:s.version};d&&(u.chainId=d);const f=O().rpc,{signedTypedData:V}=await e.call({params:{chainId:Number.parseInt(BigInt(d||1).toString()),domain:u,message:o.message,partnerId:a,rpcEndpoint:`https://${d}.${f}`,types:o.types},procedureName:"signTypedDataV4"});return V}}}}class Ke{isClientIdLegacyPaper(e){return e.indexOf("-")>0&&e.length===36}constructor({client:e,onAuthSuccess:t,ecosystem:a,passkeyDomain:r,storage:l}){if(Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"querier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"wallet",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"auth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"passkeyDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isClientIdLegacyPaper(e.clientId))throw new Error("You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page");const c=p("inAppWallet");this.client=e,this.ecosystem=a,this.passkeyDomain=r,this.storage=new D({clientId:e.clientId,ecosystem:a,storage:l??Fe()}),this.querier=new Pe({baseUrl:c,clientId:e.clientId,ecosystem:a}),this.auth=new Ce({baseUrl:c,client:e,ecosystem:a,localStorage:this.storage,onAuthSuccess:async n=>{if(t==null||t(n),n.storedToken.authDetails.walletType==="sharded"&&(await this.querier.call({params:{storedToken:n.storedToken},procedureName:"migrateFromShardToEnclave"})||console.warn("Failed to migrate from sharded to enclave wallet, continuing with sharded wallet")),this.wallet=await this.initializeWallet(n.storedToken.cookieString),!this.wallet)throw new Error("Failed to initialize wallet");const o="deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:void 0;return await this.wallet.postWalletSetUp({deviceShareStored:o,storedToken:n.storedToken}),this.wallet instanceof _&&await this.querier.call({params:{authCookie:n.storedToken.cookieString,clientId:this.client.clientId,deviceShareStored:"deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:null,ecosystemId:a==null?void 0:a.id,partnerId:a==null?void 0:a.partnerId,walletUserId:n.storedToken.authDetails.userWalletId},procedureName:"initIframe"}),{user:{account:await this.wallet.getAccount(),authDetails:n.storedToken.authDetails,status:"Logged In, Wallet Initialized",walletAddress:n.walletDetails.walletAddress}}},querier:this.querier})}async initializeWallet(e){var r;const t=await this.storage.getAuthCookie();if(!e&&t===null)throw new Error("No auth token provided and no stored auth token found to initialize the wallet");const a=await A({authToken:e||t,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot initialize wallet, no user logged in");if(a.wallets.length===0)throw new Error("Cannot initialize wallet, this user does not have a wallet generated yet");return((r=a.wallets[0])==null?void 0:r.type)==="enclave"?new ke({address:a.wallets[0].address,client:this.client,ecosystem:this.ecosystem,storage:this.storage}):new _({client:this.client,ecosystem:this.ecosystem,localStorage:this.storage,querier:this.querier})}async getUser(){if(!this.wallet){const e=await this.storage.getAuthCookie();if(!e)return{status:"Logged Out"};this.wallet=await this.initializeWallet(e)}if(!this.wallet)throw new Error("Wallet not initialized");return await this.wallet.getUserWalletStatus()}getAccount(){if(!this.wallet)throw new Error("Wallet not initialized");return this.wallet.getAccount()}async preAuthenticate(e){return _e({...e,client:this.client,ecosystem:this.ecosystem})}async authenticateWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a})}async loginWithAuthToken(e,t){return this.auth.loginWithAuthToken(e,t)}async authenticate(e){const t=e.strategy;switch(t){case"email":return j({...e,client:this.client,ecosystem:this.ecosystem});case"phone":return j({...e,client:this.client,ecosystem:this.ecosystem});case"auth_endpoint":return oe({client:this.client,ecosystem:this.ecosystem,payload:e.payload});case"jwt":return de({client:this.client,ecosystem:this.ecosystem,jwt:e.jwt});case"passkey":return this.passkeyAuth(e);case"iframe_email_verification":return this.auth.authenticateWithIframe({email:e.email});case"iframe":return this.auth.authenticateWithModal();case"apple":case"facebook":case"google":case"telegram":case"github":case"twitch":case"farcaster":case"line":case"x":case"tiktok":case"epic":case"steam":case"coinbase":case"discord":return je({authOption:t,client:this.client,closeOpenedWindow:e.closeOpenedWindow,ecosystem:this.ecosystem,openedWindow:e.openedWindow});case"guest":return le({client:this.client,ecosystem:this.ecosystem,storage:this.storage});case"backend":return ce({client:this.client,ecosystem:this.ecosystem,walletSecret:e.walletSecret});case"wallet":return fe({client:this.client,ecosystem:this.ecosystem,wallet:e.wallet,chain:e.chain})}}async connect(e){const t=e.strategy;switch(t){case"auth_endpoint":case"jwt":{const a=await this.authenticate(e);return await this.loginWithAuthToken(a,e.encryptionKey)}case"iframe_email_verification":return this.auth.loginWithIframe({email:e.email});case"iframe":return this.auth.loginWithModal();case"passkey":{const a=await this.passkeyAuth(e);return this.loginWithAuthToken(a)}case"backend":case"phone":case"email":case"wallet":case"apple":case"facebook":case"google":case"farcaster":case"telegram":case"github":case"line":case"x":case"tiktok":case"epic":case"guest":case"coinbase":case"twitch":case"steam":case"discord":{const a=await this.authenticate(e);return await this.auth.loginWithAuthToken(a)}default:De(t)}}async logout(){return await this.auth.logout()}async passkeyAuth(e){const{PasskeyWebClient:t}=await y(async()=>{const{PasskeyWebClient:n}=await import("./passkeys-BsJVcpuM.js");return{PasskeyWebClient:n}},__vite__mapDeps([20,18,1,2,3,4,9,10,11,12,13,19,21])),{passkeyName:a,storeLastUsedPasskey:r=!0}=e,l=new t,c=this.storage;return e.type==="sign-up"?ue({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0,username:a}):he({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0})}async linkProfileWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a,authFlow:"link"})}async linkProfile(e){if("strategy"in e&&J.includes(e.strategy)&&"mode"in e&&e.mode!=="popup"&&e.mode!==void 0)return await this.linkProfileWithRedirect(e.strategy,e.mode,"redirectUrl"in e?e.redirectUrl:void 0),[];const{storedToken:t}=await this.authenticate(e);return await X({client:e.client,ecosystem:e.ecosystem||this.ecosystem,storage:this.storage,tokenToLink:t.cookieString})}async unlinkProfile(e,t){return await ee({allowAccountDeletion:t,client:this.client,ecosystem:this.ecosystem,profileToUnlink:e,storage:this.storage})}async getProfiles(){return te({client:this.client,ecosystem:this.ecosystem,storage:this.storage})}}function De(i,e){throw new Error(`Invalid param: ${i}`)}function Fe(){return typeof window<"u"&&window.localStorage?F:ie}export{Ke as InAppWebConnector};
|
|
9
|
+
`)}async function ge(i){const{payload:e,account:t}=i,a=await t.signMessage({message:pe(e)});return{payload:e,signature:a}}const me=["xyz.abs"];async function fe(i){const{wallet:e,client:t,ecosystem:a,chain:r}=i,l=me.includes(e.id)?r||I(1):I(1),c=e.getAccount()||await e.connect({chain:l,client:t}),n=g(t,a),o=await(async()=>{const h=v({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),u=await n(`${h}&address=${c.address}&chainId=${l.id}`);if(!u.ok)throw new Error("Failed to generate SIWE login payload");return await u.json()})(),{signature:s}=await ge({account:c,payload:o});return await(async()=>{const h=S({authOption:"wallet",client:i.client,ecosystem:i.ecosystem}),u=await n(`${h}&signature=${s}&payload=${encodeURIComponent(o)}`,{body:w({payload:o,signature:s}),headers:{"Content-Type":"application/json"},method:"POST"});if(!u.ok)throw new Error("Failed to verify SIWE signature");return await u.json()})()}async function ye({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing message");const c={address:e.address,chainId:e.chainId,nonce:Number(e.nonce)},n=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-authorization`,{body:w(c),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!n.ok)throw new Error(`Failed to sign message - ${n.status} ${n.statusText}`);return await n.json()}async function be({client:i,payload:{message:e,isRaw:t,originalMessage:a,chainId:r},storage:l}){const c=await l.getAuthCookie(),n=l.ecosystem,o=g(i,n);if(!c)throw new Error("No auth token found when signing message");const s=await o(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-message`,{body:w({messagePayload:{chainId:r,isRaw:t,message:e,originalMessage:a}}),headers:{Authorization:`Bearer embedded-wallet-token:${c}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!s.ok)throw new Error(`Failed to sign message - ${s.status} ${s.statusText}`);return await s.json()}async function Ie({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing transaction");const c=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-transaction`,{body:w({transactionPayload:e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign transaction - ${c.status} ${c.statusText}`);return(await c.json()).signature}async function ve({client:i,payload:e,storage:t}){const a=await t.getAuthCookie(),r=t.ecosystem,l=g(i,r);if(!a)throw new Error("No auth token found when signing typed data");const c=await l(`${p("inAppWallet")}/api/v1/enclave-wallet/sign-typed-data`,{body:w({...e}),headers:{Authorization:`Bearer embedded-wallet-token:${a}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!c.ok)throw new Error(`Failed to sign typed data - ${c.status} ${c.statusText}`);return await c.json()}class ke{constructor({client:e,ecosystem:t,address:a,storage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"address",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.address=a,this.localStorage=r}async postWalletSetUp(e){await this.localStorage.saveAuthCookie(e.storedToken.cookieString)}async getUserWalletStatus(){var l,c;const e=await this.localStorage.getAuthCookie();if(!e)return{status:"Logged Out"};const t=await A({authToken:e,client:this.client,ecosystem:this.ecosystem});if(!t)return{status:"Logged Out"};const a=t.wallets[0],r={email:(l=t.linkedAccounts.find(n=>n.details.email!==void 0))==null?void 0:l.details.email,phoneNumber:(c=t.linkedAccounts.find(n=>n.details.phone!==void 0))==null?void 0:c.details.phone,recoveryShareManagement:"ENCLAVE",userWalletId:t.id||""};return a?{account:await this.getAccount(),authDetails:r,status:"Logged In, Wallet Initialized",walletAddress:a.address}:{authDetails:r,status:"Logged In, Wallet Uninitialized"}}async getAccount(){const e=this.client,t=this.localStorage,a=this.address,r=this.ecosystem,l=async n=>{const o=P({chain:I(n.chainId),client:e}),s={chainId:W(n.chainId),data:n.data,gas:m(n.gas),nonce:m(n.nonce)||W(await y(async()=>{const{eth_getTransactionCount:d}=await import("./eth_getTransactionCount-Ck8bEyl_.js");return{eth_getTransactionCount:d}},__vite__mapDeps([0,1,2,3,4])).then(({eth_getTransactionCount:d})=>d(o,{address:b(this.address),blockTag:"pending"}))),to:n.to?b(n.to):void 0,value:m(n.value)};return n.authorizationList&&n.authorizationList.length>0?(s.type=4,s.authorizationList=n.authorizationList,s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas)):m(n.maxFeePerGas)?(s.maxFeePerGas=m(n.maxFeePerGas),s.maxPriorityFeePerGas=m(n.maxPriorityFeePerGas),s.type=2):(s.gasPrice=m(n.gasPrice),s.type=0),Ie({client:e,payload:s,storage:t})},c={address:b(a),async sendTransaction(n){const o=P({chain:I(n.chainId),client:e}),s=await l(n),d=await B(o,s);return N({chainId:n.chainId,client:e,contractAddress:n.to??void 0,ecosystem:r,gasPrice:n.gasPrice,transactionHash:d,walletAddress:a,walletType:"inApp"}),{transactionHash:d}},async signAuthorization(n){const o=await ye({client:e,payload:n,storage:t});return{address:b(o.address),chainId:Number.parseInt(o.chainId),nonce:BigInt(o.nonce),r:BigInt(o.r),s:BigInt(o.s),yParity:Number.parseInt(o.yParity)}},async signMessage({message:n,originalMessage:o,chainId:s}){const d=typeof n=="string"?{chainId:s,isRaw:!1,message:n,originalMessage:o}:{chainId:s,isRaw:!0,message:typeof n.raw=="string"?n.raw:Y(n.raw),originalMessage:o},{signature:h}=await be({client:e,payload:d,storage:t});return h},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({chainId:n.chainId,...n})},async signTypedData(n){const o=U(n),{signature:s}=await ve({client:e,payload:o,storage:t});return s},sendCalls:async n=>{const{inAppWalletSendCalls:o}=await y(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-DeaYPRmI.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([5,6,7,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19])),s=n.calls[0];if(!s)throw new Error("No calls to send");const d=s.client,h=s.chain||n.chain,u=await o({account:c,calls:n.calls,chain:h});return{chain:h,client:d,id:u}},getCallsStatus:async n=>{const{inAppWalletGetCallsStatus:o}=await y(async()=>{const{inAppWalletGetCallsStatus:s}=await import("./in-app-wallet-calls-DeaYPRmI.js");return{inAppWalletGetCallsStatus:s}},__vite__mapDeps([5,6,7,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19]));return o(n)},getCallsStatusRaw:async n=>{const{inAppWalletGetCallsStatusRaw:o}=await y(async()=>{const{inAppWalletGetCallsStatusRaw:s}=await import("./in-app-wallet-calls-DeaYPRmI.js");return{inAppWalletGetCallsStatusRaw:s}},__vite__mapDeps([5,6,7,1,2,3,4,8,9,10,11,12,13,14,15,16,17,18,19]));return o(n)},getCapabilities:async n=>({[n.chainId??1]:{atomic:{status:"unsupported"},paymasterService:{supported:!1}}})};return c}}function m(i){return i===void 0||Z(i)?i:W(i)}const Te={backgroundColor:"transparent",border:"none",colorScheme:"light",display:"none",height:"100%",pointerEvents:"all",position:"fixed",right:"0px",top:"0px",width:"100%",zIndex:"2147483646"},L=new Map;class Le{constructor({link:e,baseUrl:t,iframeId:a,container:r,onIframeInitialize:l,localStorage:c,clientId:n,ecosystem:o}){if(Object.defineProperty(this,"iframe",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"POLLING_INTERVAL_SECONDS",{enumerable:!0,configurable:!0,writable:!0,value:1.4}),Object.defineProperty(this,"iframeBaseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"clientId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.localStorage=c,this.clientId=n,this.ecosystem=o,this.iframeBaseUrl=t,typeof document>"u")return;r=r??document.body;let s=document.getElementById(a);const d=new URL(e);if(!s||s.src!==d.href){s=document.createElement("iframe");const h={...Te};Object.assign(s.style,h),s.setAttribute("id",a),s.setAttribute("fetchpriority","high"),r.appendChild(s),s.src=d.href;const u=f=>{if(f.data.eventType==="ewsIframeLoaded"){if(window.removeEventListener("message",u),!s){console.warn("thirdweb iFrame not found");return}this.onIframeLoadHandler(s,l)()}};window.addEventListener("message",u)}this.iframe=s}async onIframeLoadedInitVariables(){var e,t;return{authCookie:await this.localStorage.getAuthCookie(),clientId:this.clientId,deviceShareStored:await this.localStorage.getDeviceShare(),ecosystemId:(e=this.ecosystem)==null?void 0:e.id,partnerId:(t=this.ecosystem)==null?void 0:t.partnerId,walletUserId:await this.localStorage.getWalletUserId()}}onIframeLoadHandler(e,t){return async()=>{var l;const a=new MessageChannel,r=new Promise((c,n)=>{a.port1.onmessage=o=>{const{data:s}=o;a.port1.close(),s.success||n(new Error(s.error)),L.set(e.src,!0),t&&t(),c(!0)}});(l=e==null?void 0:e.contentWindow)==null||l.postMessage({data:await this.onIframeLoadedInitVariables(),eventType:"initIframe"},this.iframeBaseUrl,[a.port2]),await r}}async call({procedureName:e,params:t,showIframe:a=!1}){var c;if(!this.iframe)throw new Error("Iframe not found. You are likely calling this from the backend where the DOM is not available.");for(;!L.get(this.iframe.src);)await k(this.POLLING_INTERVAL_SECONDS*1e3);a&&(this.iframe.style.display="block",await k(.005*1e3));const r=new MessageChannel,l=new Promise((n,o)=>{r.port1.onmessage=async s=>{const{data:d}=s;r.port1.close(),a&&(await k(.1*1e3),this.iframe&&(this.iframe.style.display="none")),d.success?n(d.data):o(new Error(d.error))}});return(c=this.iframe.contentWindow)==null||c.postMessage({data:{...t,...await this.onIframeLoadedInitVariables()},eventType:e},this.iframeBaseUrl,[r.port2]),l}destroy(){this.iframe&&L.delete(this.iframe.src)}}class Pe extends Le{constructor({clientId:e,baseUrl:t,ecosystem:a}){super({baseUrl:t,clientId:e,container:typeof document>"u"?void 0:document.body,ecosystem:a,iframeId:Ae+((a==null?void 0:a.id)||""),link:We({baseUrl:t,clientId:e,ecosystem:a,path:Q}).href,localStorage:new D({clientId:e,ecosystem:a,storage:F})}),this.clientId=e,this.ecosystem=a}}function We({clientId:i,baseUrl:e,path:t,ecosystem:a,queryParams:r}){var c;const l=new URL(`${t}`,e);if(r)for(const n of Object.keys(r))l.searchParams.set(n,((c=r[n])==null?void 0:c.toString())||"");return l.searchParams.set("clientId",i),(a==null?void 0:a.partnerId)!==void 0&&l.searchParams.set("partnerId",a.partnerId),(a==null?void 0:a.id)!==void 0&&l.searchParams.set("ecosystemId",a.id),l}const Ae="thirdweb-in-app-wallet-iframe";async function Se({client:i,ecosystem:e,authToken:t}){const r=await g(i,e)(`${p("inAppWallet")}/api/v1/enclave-wallet/generate`,{headers:{Authorization:`Bearer embedded-wallet-token:${t}`,"Content-Type":"application/json","x-thirdweb-client-id":i.clientId},method:"POST"});if(!r.ok)throw new Error(`Failed to generate wallet - ${r.status} ${r.statusText}`);const{wallet:l}=await r.json();return l}class Ee{constructor({baseUrl:e,querier:t,preLogin:a,postLogin:r,client:l,ecosystem:c}){Object.defineProperty(this,"LoginQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"preLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"postLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"baseUrl",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.baseUrl=e,this.LoginQuerier=t,this.preLogin=a,this.postLogin=r,this.client=l,this.ecosystem=c}async sendEmailLoginOtp({email:e}){return await this.LoginQuerier.call({params:{email:e},procedureName:"sendThirdwebEmailLoginOtp"})}async sendSmsLoginOtp({phoneNumber:e}){return await this.LoginQuerier.call({params:{phoneNumber:e},procedureName:"sendThirdwebSmsLoginOtp"})}}class Oe extends Ee{async authenticateWithModal(){return this.LoginQuerier.call({params:void 0,procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithModal(){await this.preLogin();const e=await this.authenticateWithModal();return this.postLogin(e)}async authenticateWithIframe({email:e}){return this.LoginQuerier.call({params:{email:e},procedureName:"loginWithThirdwebModal",showIframe:!0})}async loginWithIframe({email:e}){await this.preLogin();const t=await this.authenticateWithIframe({email:e});return this.postLogin(t)}async authenticateWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");return this.LoginQuerier.call({params:{encryptionKey:e,jwt:t},procedureName:"loginWithCustomJwt"})}async loginWithCustomJwt({encryptionKey:e,jwt:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom jwt auth");await this.preLogin();const a=await this.authenticateWithCustomJwt({encryptionKey:e,jwt:t});return this.postLogin(a)}async authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t}){return this.LoginQuerier.call({params:{encryptionKey:e,payload:t},procedureName:"loginWithCustomAuthEndpoint"})}async loginWithCustomAuthEndpoint({encryptionKey:e,payload:t}){if(!e||e.length===0)throw new Error("Encryption key is required for custom auth");await this.preLogin();const a=await this.authenticateWithCustomAuthEndpoint({encryptionKey:e,payload:t});return this.postLogin(a)}async authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{email:e,otp:t,recoveryCode:a},procedureName:"verifyThirdwebEmailLoginOtp"})}async loginWithEmailOtp({email:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithEmailOtp({email:e,otp:t,recoveryCode:a});return this.postLogin(r)}async authenticateWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){return this.LoginQuerier.call({params:{otp:t,phoneNumber:e,recoveryCode:a},procedureName:"verifyThirdwebSmsLoginOtp"})}async loginWithSmsOtp({phoneNumber:e,otp:t,recoveryCode:a}){const r=await this.authenticateWithSmsOtp({otp:t,phoneNumber:e,recoveryCode:a});return this.postLogin(r)}}class Ce{constructor({client:e,querier:t,onAuthSuccess:a,ecosystem:r,baseUrl:l,localStorage:c}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"AuthQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"onAuthSuccess",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"BaseLogin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=r,this.AuthQuerier=t,this.localStorage=c,this.onAuthSuccess=a,this.BaseLogin=new Oe({baseUrl:l,client:e,ecosystem:r,postLogin:async n=>this.postLogin(n),preLogin:async()=>{await this.preLogin()},querier:t})}async preLogin(){await this.logout()}async postLogin({storedToken:e,walletDetails:t}){return e.shouldStoreCookieString&&await this.localStorage.saveAuthCookie(e.cookieString),await this.onAuthSuccess({storedToken:e,walletDetails:t})}async loginWithAuthToken(e,t){var l;e.storedToken.authProvider!=="Backend"&&await this.preLogin();const a=await A({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot login, no user found for auth token");if(a.wallets.length>0&&((l=a.wallets[0])==null?void 0:l.type)==="enclave")return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:a.wallets[0].address}});if(a.wallets.length===0){const c=await Se({authToken:e.storedToken.cookieString,client:this.client,ecosystem:this.ecosystem});return this.postLogin({storedToken:e.storedToken,walletDetails:{walletAddress:c.address}})}const r=await this.AuthQuerier.call({params:{recoveryCode:t,storedToken:e.storedToken},procedureName:"loginWithStoredTokenDetails"});return this.postLogin(r)}async loginWithModal(){return this.BaseLogin.loginWithModal()}async authenticateWithModal(){return this.BaseLogin.authenticateWithModal()}async loginWithIframe(e){return this.BaseLogin.loginWithIframe(e)}async authenticateWithIframe(e){return this.BaseLogin.authenticateWithIframe(e)}async loginWithCustomJwt(e){return this.BaseLogin.loginWithCustomJwt(e)}async authenticateWithCustomJwt(e){return this.BaseLogin.authenticateWithCustomJwt(e)}async loginWithCustomAuthEndpoint(e){return this.BaseLogin.loginWithCustomAuthEndpoint(e)}async authenticateWithCustomAuthEndpoint(e){return this.BaseLogin.authenticateWithCustomAuthEndpoint(e)}async sendEmailLoginOtp({email:e}){return this.BaseLogin.sendEmailLoginOtp({email:e})}async sendSmsLoginOtp({phoneNumber:e}){return this.BaseLogin.sendSmsLoginOtp({phoneNumber:e})}async loginWithEmailOtp(e){return await this.preLogin(),this.BaseLogin.loginWithEmailOtp(e)}async authenticateWithEmailOtp(e){return this.BaseLogin.authenticateWithEmailOtp(e)}async loginWithSmsOtp(e){return await this.preLogin(),this.BaseLogin.loginWithSmsOtp(e)}async authenticateWithSmsOtp(e){return this.BaseLogin.authenticateWithSmsOtp(e)}async logout(){const e=await this.localStorage.removeAuthCookie(),t=await this.localStorage.removeWalletUserId();return{success:e||t}}}const $e="width=350, height=500",C=({isWindowOpenedByFn:i,win:e,closeOpenedWindow:t})=>{i?e==null||e.close():e&&t?t(e):e&&e.close()};async function $(i){const e=v({...i,mode:i.mode||"redirect",authFlow:i.authFlow});i.mode==="redirect"?window.location.href=e:window.open(e),await new Promise(t=>setTimeout(t,5e3))}const je=async i=>{let e=i.openedWindow,t=!1;if(e||(e=window.open(v({...i,mode:"popup"}),`Login to ${i.authOption}`,$e),t=!0),!e)throw new Error("Something went wrong opening pop-up");return await new Promise((r,l)=>{const c=window.setInterval(async()=>{e.closed&&(clearInterval(c),window.removeEventListener("message",n),l(new Error("User closed login window")))},1e3),n=async o=>{if(o.origin===p("inAppWallet")){if(typeof o.data!="object"){l(new Error("Invalid event data"));return}switch(o.data.eventType){case"oauthSuccessResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),o.data.authResult&&r(o.data.authResult);break}case"oauthFailureResult":{window.removeEventListener("message",n),clearInterval(c),C({closeOpenedWindow:i.closeOpenedWindow,isWindowOpenedByFn:t,win:e}),l(new Error(o.data.errorString));break}}}};window.addEventListener("message",n)})},_e=async i=>{const{client:e,ecosystem:t}=i,a=v({authOption:i.strategy,client:e,ecosystem:t}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{email:i.email};case"phone":return{phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok){const n=await c.text();let o;try{const s=JSON.parse(n);s&&typeof s.message=="string"&&(o=s.message)}catch{}throw new Error(o||"Failed to send verification code")}return await c.json()},j=async i=>{const{client:e,ecosystem:t}=i,a=S({authOption:i.strategy,client:i.client,ecosystem:i.ecosystem}),r={"Content-Type":"application/json","x-client-id":e.clientId};t!=null&&t.id&&(r["x-ecosystem-id"]=t.id),t!=null&&t.partnerId&&(r["x-ecosystem-partner-id"]=t.partnerId);const l=(()=>{switch(i.strategy){case"email":return{code:i.verificationCode,email:i.email};case"phone":return{code:i.verificationCode,phone:i.phoneNumber}}})(),c=await fetch(a,{body:w(l),headers:r,method:"POST"});if(!c.ok)throw new Error("Failed to verify verification code");return await c.json()};class _{constructor({client:e,ecosystem:t,querier:a,localStorage:r}){Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"walletManagerQuerier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"localStorage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.client=e,this.ecosystem=t,this.walletManagerQuerier=a,this.localStorage=r}async postWalletSetUp(e){e.deviceShareStored&&await this.localStorage.saveDeviceShare(e.deviceShareStored,e.storedToken.authDetails.userWalletId)}async getUserWalletStatus(){const e=await this.walletManagerQuerier.call({params:void 0,procedureName:"getUserStatus"});return e.status==="Logged In, Wallet Initialized"?{status:"Logged In, Wallet Initialized",...e.user,account:await this.getAccount()}:e.status==="Logged In, New Device"?{status:"Logged In, New Device",...e.user}:e.status==="Logged In, Wallet Uninitialized"?{status:"Logged In, Wallet Uninitialized",...e.user}:{status:e.status}}async getAccount(){var c;const e=this.walletManagerQuerier,t=this.client,a=(c=this.ecosystem)==null?void 0:c.partnerId,{address:r}=await e.call({params:void 0,procedureName:"getAddress"}),l=async n=>{const o={chainId:n.chainId,data:n.data,gasLimit:n.gas,nonce:n.nonce,to:n.to??void 0,value:n.value};n.maxFeePerGas?(o.accessList=n.accessList,o.maxFeePerGas=n.maxFeePerGas,o.maxPriorityFeePerGas=n.maxPriorityFeePerGas,o.type=2):(o.gasPrice=n.gasPrice,o.type=0);const s=O().rpc,{signedTransaction:d}=await e.call({params:{chainId:n.chainId,partnerId:a,rpcEndpoint:`https://${n.chainId}.${s}`,transaction:o},procedureName:"signTransaction"});return d};return{address:b(r),async sendTransaction(n){const o=P({chain:I(n.chainId),client:t}),s=await l(n),d=await B(o,s);return N({chainId:n.chainId,client:t,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:d,walletAddress:r,walletType:"inApp"}),{transactionHash:d}},async signMessage({message:n}){const o=typeof n=="string"?n:n.raw instanceof Uint8Array?n.raw:K(n.raw),{signedMessage:s}=await e.call({params:{chainId:1,message:o,partnerId:a},procedureName:"signMessage"});return s},async signTransaction(n){if(!n.chainId)throw new Error("chainId required in tx to sign");return l({...n,chainId:n.chainId})},async signTypedData(n){var E;const o=U(n);(E=o.types)!=null&&E.EIP712Domain&&(o.types.EIP712Domain=void 0);const s=o.domain,d=s==null?void 0:s.chainId,u={...s!=null&&s.verifyingContract?{verifyingContract:s==null?void 0:s.verifyingContract}:{},name:s==null?void 0:s.name,version:s==null?void 0:s.version};d&&(u.chainId=d);const f=O().rpc,{signedTypedData:V}=await e.call({params:{chainId:Number.parseInt(BigInt(d||1).toString()),domain:u,message:o.message,partnerId:a,rpcEndpoint:`https://${d}.${f}`,types:o.types},procedureName:"signTypedDataV4"});return V}}}}class Ke{isClientIdLegacyPaper(e){return e.indexOf("-")>0&&e.length===36}constructor({client:e,onAuthSuccess:t,ecosystem:a,passkeyDomain:r,storage:l}){if(Object.defineProperty(this,"client",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"querier",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"wallet",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"auth",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"passkeyDomain",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.isClientIdLegacyPaper(e.clientId))throw new Error("You are using a legacy clientId. Please use the clientId found on the thirdweb dashboard settings page");const c=p("inAppWallet");this.client=e,this.ecosystem=a,this.passkeyDomain=r,this.storage=new D({clientId:e.clientId,ecosystem:a,storage:l??Fe()}),this.querier=new Pe({baseUrl:c,clientId:e.clientId,ecosystem:a}),this.auth=new Ce({baseUrl:c,client:e,ecosystem:a,localStorage:this.storage,onAuthSuccess:async n=>{if(t==null||t(n),n.storedToken.authDetails.walletType==="sharded"&&(await this.querier.call({params:{storedToken:n.storedToken},procedureName:"migrateFromShardToEnclave"})||console.warn("Failed to migrate from sharded to enclave wallet, continuing with sharded wallet")),this.wallet=await this.initializeWallet(n.storedToken.cookieString),!this.wallet)throw new Error("Failed to initialize wallet");const o="deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:void 0;return await this.wallet.postWalletSetUp({deviceShareStored:o,storedToken:n.storedToken}),this.wallet instanceof _&&await this.querier.call({params:{authCookie:n.storedToken.cookieString,clientId:this.client.clientId,deviceShareStored:"deviceShareStored"in n.walletDetails?n.walletDetails.deviceShareStored:null,ecosystemId:a==null?void 0:a.id,partnerId:a==null?void 0:a.partnerId,walletUserId:n.storedToken.authDetails.userWalletId},procedureName:"initIframe"}),{user:{account:await this.wallet.getAccount(),authDetails:n.storedToken.authDetails,status:"Logged In, Wallet Initialized",walletAddress:n.walletDetails.walletAddress}}},querier:this.querier})}async initializeWallet(e){var r;const t=await this.storage.getAuthCookie();if(!e&&t===null)throw new Error("No auth token provided and no stored auth token found to initialize the wallet");const a=await A({authToken:e||t,client:this.client,ecosystem:this.ecosystem});if(!a)throw new Error("Cannot initialize wallet, no user logged in");if(a.wallets.length===0)throw new Error("Cannot initialize wallet, this user does not have a wallet generated yet");return((r=a.wallets[0])==null?void 0:r.type)==="enclave"?new ke({address:a.wallets[0].address,client:this.client,ecosystem:this.ecosystem,storage:this.storage}):new _({client:this.client,ecosystem:this.ecosystem,localStorage:this.storage,querier:this.querier})}async getUser(){if(!this.wallet){const e=await this.storage.getAuthCookie();if(!e)return{status:"Logged Out"};this.wallet=await this.initializeWallet(e)}if(!this.wallet)throw new Error("Wallet not initialized");return await this.wallet.getUserWalletStatus()}getAccount(){if(!this.wallet)throw new Error("Wallet not initialized");return this.wallet.getAccount()}async preAuthenticate(e){return _e({...e,client:this.client,ecosystem:this.ecosystem})}async authenticateWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a})}async loginWithAuthToken(e,t){return this.auth.loginWithAuthToken(e,t)}async authenticate(e){const t=e.strategy;switch(t){case"email":return j({...e,client:this.client,ecosystem:this.ecosystem});case"phone":return j({...e,client:this.client,ecosystem:this.ecosystem});case"auth_endpoint":return oe({client:this.client,ecosystem:this.ecosystem,payload:e.payload});case"jwt":return de({client:this.client,ecosystem:this.ecosystem,jwt:e.jwt});case"passkey":return this.passkeyAuth(e);case"iframe_email_verification":return this.auth.authenticateWithIframe({email:e.email});case"iframe":return this.auth.authenticateWithModal();case"apple":case"facebook":case"google":case"telegram":case"github":case"twitch":case"farcaster":case"line":case"x":case"tiktok":case"epic":case"steam":case"coinbase":case"discord":return je({authOption:t,client:this.client,closeOpenedWindow:e.closeOpenedWindow,ecosystem:this.ecosystem,openedWindow:e.openedWindow});case"guest":return le({client:this.client,ecosystem:this.ecosystem,storage:this.storage});case"backend":return ce({client:this.client,ecosystem:this.ecosystem,walletSecret:e.walletSecret});case"wallet":return fe({client:this.client,ecosystem:this.ecosystem,wallet:e.wallet,chain:e.chain})}}async connect(e){const t=e.strategy;switch(t){case"auth_endpoint":case"jwt":{const a=await this.authenticate(e);return await this.loginWithAuthToken(a,e.encryptionKey)}case"iframe_email_verification":return this.auth.loginWithIframe({email:e.email});case"iframe":return this.auth.loginWithModal();case"passkey":{const a=await this.passkeyAuth(e);return this.loginWithAuthToken(a)}case"backend":case"phone":case"email":case"wallet":case"apple":case"facebook":case"google":case"farcaster":case"telegram":case"github":case"line":case"x":case"tiktok":case"epic":case"guest":case"coinbase":case"twitch":case"steam":case"discord":{const a=await this.authenticate(e);return await this.auth.loginWithAuthToken(a)}default:De(t)}}async logout(){return await this.auth.logout()}async passkeyAuth(e){const{PasskeyWebClient:t}=await y(async()=>{const{PasskeyWebClient:n}=await import("./passkeys-wDVu6yuN.js");return{PasskeyWebClient:n}},__vite__mapDeps([20,18,1,2,3,4,9,10,11,12,13,19,21])),{passkeyName:a,storeLastUsedPasskey:r=!0}=e,l=new t,c=this.storage;return e.type==="sign-up"?ue({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0,username:a}):he({client:this.client,ecosystem:this.ecosystem,passkeyClient:l,rp:{id:this.passkeyDomain??window.location.hostname,name:this.passkeyDomain??window.document.title},storage:r?c:void 0})}async linkProfileWithRedirect(e,t,a){return $({authOption:e,client:this.client,ecosystem:this.ecosystem,mode:t,redirectUrl:a,authFlow:"link"})}async linkProfile(e){if("strategy"in e&&J.includes(e.strategy)&&"mode"in e&&e.mode!=="popup"&&e.mode!==void 0)return await this.linkProfileWithRedirect(e.strategy,e.mode,"redirectUrl"in e?e.redirectUrl:void 0),[];const{storedToken:t}=await this.authenticate(e);return await X({client:e.client,ecosystem:e.ecosystem||this.ecosystem,storage:this.storage,tokenToLink:t.cookieString})}async unlinkProfile(e,t){return await ee({allowAccountDeletion:t,client:this.client,ecosystem:this.ecosystem,profileToUnlink:e,storage:this.storage})}async getProfiles(){return te({client:this.client,ecosystem:this.ecosystem,storage:this.storage})}}function De(i,e){throw new Error(`Invalid param: ${i}`)}function Fe(){return typeof window<"u"&&window.localStorage?F:ie}export{Ke as InAppWebConnector};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="58" height="60.8976" viewBox="0 0 58 60.8976" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g id="World">
|
|
3
|
+
<path id="Vector" d="M25.4569 6.96283C26.979 6.85533 28.9388 6.95342 30.4446 7.13287C30.0079 8.33624 29.78 9.13619 29.5153 10.3793C29.3383 10.3578 29.1605 10.3424 28.9824 10.333C27.6478 10.2687 25.3244 10.3518 24.2791 11.3256C24.0985 11.4939 23.9728 11.6917 23.9663 11.9444C23.92 13.7475 29.0511 15.1737 30.2807 16.4784C30.4833 16.6934 30.6598 16.9378 30.6423 17.2465C30.5757 18.4233 27.5646 19.9827 26.6598 20.8125C26.2483 21.1899 25.748 21.6382 25.7324 22.2334C25.6987 23.511 26.6218 23.2286 27.231 23.9144C27.4391 24.1486 27.4821 24.4595 27.4595 24.7622C27.3716 25.9386 26.6676 27.4131 25.7662 28.1862C25.3894 28.5094 24.8774 28.8068 24.3643 28.6752C22.7616 28.2637 21.5127 24.937 17.9574 24.7174C17.1003 24.6645 16.311 25.0224 15.682 25.585C15.02 26.1771 14.4871 27.0277 14.4457 27.9325C14.4166 28.5698 14.6349 29.2538 15.072 29.725C16.0928 30.8253 17.3782 30.0457 18.5834 29.8277C18.8859 29.773 19.1854 29.7838 19.4907 29.7974C20.2387 30.2821 20.421 31.3761 20.4552 32.1053C20.6441 36.1326 21.9967 37.1219 25.6195 38.401C26.5104 38.7156 28.0375 39.6576 28.8363 40.3869C30.0627 41.5065 30.9358 43.265 31.05 44.9444C31.1979 47.8669 26.9762 48.2909 25.2734 50.2639C24.1423 51.398 24.058 53.1083 23.0779 54.2944C22.3006 55.2668 20.0112 55.1575 20.0534 53.638C20.0824 52.5933 20.3891 51.8289 19.9693 50.8164C19.6895 50.1412 19.3011 49.2656 19.2737 48.5361C19.2391 47.6131 20.4495 46.5724 19.5917 45.7217C18.5297 44.6498 16.9248 44.2581 15.861 43.1755C13.6774 40.6553 18.6933 39.9452 18.6269 37.6576C18.565 35.5294 16.2779 35.0082 14.633 34.5109C12.6645 33.9157 10.6806 33.2009 9.25174 31.6401C7.32991 29.474 5.96108 25.7705 6.07547 22.8827C4.69264 25.6406 3.82872 28.2079 3.48976 31.3018C2.79531 37.5775 4.64249 43.87 8.61893 48.7745C16.9462 59.0992 31.7594 60.4319 42.0239 52.1582L43.008 51.3172C41.118 49.4723 42.8583 48.5577 42.6142 46.7777C42.4546 45.9268 40.625 45.9462 40.4622 45.2975C39.8783 42.9708 42.1793 42.7961 43.1123 41.3773C43.2832 41.1174 43.0766 40.5538 42.9688 40.3216C42.0122 38.2599 40.1459 38.9798 38.4429 38.3556C34.7375 36.9309 37.4396 35.0003 35.3808 33.1955C34.5158 32.3113 31.7474 31.9527 31.3581 30.7481C30.5441 28.2288 32.1445 26.1561 34.1974 25.2414C34.334 25.4222 34.4811 25.5805 34.6309 25.7495C36.7776 28.1713 39.0661 30.5117 40.6294 33.375C41.261 34.5316 41.6041 35.9304 42.6389 36.8157C43.3858 37.4548 44.327 37.7433 45.3048 37.6678C46.2167 37.599 47.0709 37.1955 47.7035 36.5352C48.4636 35.7335 49.0784 33.874 49.763 32.7644C50.8957 30.9281 51.9801 29.6386 53.373 28.0043C53.5229 29.385 53.8178 30.3961 53.9208 31.971C54.4545 39.1493 52.0824 46.2412 47.3371 51.6537C42.6797 57.013 36.0921 60.3134 29.0111 60.8348C21.6512 61.3104 14.744 59.0838 9.18287 54.193C3.82102 49.4937 0.54155 42.8598 0.063554 35.7462C-0.43216 28.5406 1.98752 21.4379 6.77906 16.0336C11.5415 10.634 18.2685 7.36708 25.4569 6.96283Z" fill="white" fill-opacity="0.8"/>
|
|
4
|
+
<path id="Vector_2" d="M43.7394 0.0571142C43.9387 0.020712 44.5585 0.010183 44.7843 0.00534403C46.7607 -0.0522888 48.7227 0.356921 50.5113 1.19975C53.6452 2.65846 56.069 5.3054 57.2469 8.55535C57.944 10.4847 58.0475 11.9208 57.9842 13.9082C57.774 20.5145 52.8551 23.9267 49.1581 28.6961C47.6268 30.6718 46.9148 32.0879 45.8727 34.3113C45.4552 35.0755 44.5736 35.0755 44.1752 34.3141C43.8873 33.7638 43.6448 33.1571 43.3629 32.5934C42.8331 31.5499 42.2265 30.5472 41.5481 29.5935C39.2829 26.3865 35.7121 23.2826 33.8561 20.0622C32.8942 18.4104 32.3007 16.5701 32.1165 14.6675C31.757 11.0579 32.8515 7.45394 35.1578 4.65401C37.284 2.03037 40.3772 0.373449 43.7394 0.0571142Z" fill="#FF7439"/>
|
|
5
|
+
<path id="Vector_3" d="M44.4319 18.6291C43.3259 18.6678 41.9127 17.8832 41.1188 17.1419C39.9839 16.0881 39.3193 14.624 39.2736 13.0771C39.2226 11.4744 39.7516 10.0114 40.8588 8.8401C41.9344 7.69006 43.4274 7.01947 45.0026 6.97885C46.57 6.94759 48.0851 7.54205 49.2119 8.6304C50.3436 9.71454 50.995 11.205 51.0216 12.7708C51.0426 14.3386 50.4317 15.8491 49.3263 16.9626C48.5484 17.7577 47.1324 18.6158 46.0049 18.6323C45.9494 18.6335 45.8938 18.6328 45.8382 18.6302L45.83 18.7189C45.4434 18.7405 44.8446 18.7236 44.4497 18.7172L44.4319 18.6291Z" fill="#491662"/>
|
|
6
|
+
</g>
|
|
7
|
+
</svg>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b7 as k,aa as H,b8 as J,b9 as l,ba as W,a9 as Q,aG as V,ak as j,bb as X,bc as Y,bd as Z,be as $,bf as M,bg as aa,bh as D,az as ta,aK as ra}from"./sendRawTransaction-
|
|
1
|
+
import{b7 as k,aa as H,b8 as J,b9 as l,ba as W,a9 as Q,aG as V,ak as j,bb as X,bc as Y,bd as Z,be as $,bf as M,bg as aa,bh as D,az as ta,aK as ra}from"./sendRawTransaction-yrJJjJuj.js";import{B as ea,aq as na}from"./NetworkUtil-DXqql1Wz.js";const N=new na(128);async function sa(t,r){var A,v,_,G,L,B;const{account:c=t.account,assertChainId:q=!0,chain:e=t.chain,accessList:m,authorizationList:n,blobs:d,data:s,dataSuffix:o=typeof t.dataSuffix=="string"?t.dataSuffix:(A=t.dataSuffix)==null?void 0:A.value,gas:h,gasPrice:y,maxFeePerBlobGas:i,maxFeePerGas:g,maxPriorityFeePerGas:b,nonce:P,type:F,value:S,...R}=r;if(typeof c>"u")throw new k({docsPath:"/docs/actions/wallet/sendTransaction"});const a=c?D(c):null;let E;try{H(r);const u=await(async()=>{if(r.to)return r.to;if(r.to!==null&&n&&n.length>0)return await J({authorization:n[0]}).catch(()=>{throw new ea("`to` is required. Could not infer from `authorizationList`.")})})();if((a==null?void 0:a.type)==="json-rpc"||a===null){let p;e!==null&&(p=await l(t,W,"getChainId")({}),q&&Q({currentChainId:p,chain:e}));const T=(G=(_=(v=t.chain)==null?void 0:v.formatters)==null?void 0:_.transactionRequest)==null?void 0:G.format,w=(T||V)({...X(R,{format:T}),accessList:m,account:a,authorizationList:n,blobs:d,chainId:p,data:o?j([s??"0x",o]):s,gas:h,gasPrice:y,maxFeePerBlobGas:i,maxFeePerGas:g,maxPriorityFeePerGas:b,nonce:P,to:u,type:F,value:S},"sendTransaction"),C=N.get(t.uid),K=C?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:K,params:[w]},{retryCount:0})}catch(U){if(C===!1)throw U;const f=U;if(f.name==="InvalidInputRpcError"||f.name==="InvalidParamsRpcError"||f.name==="MethodNotFoundRpcError"||f.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[w]},{retryCount:0}).then(I=>(N.set(t.uid,!0),I)).catch(I=>{const x=I;throw x.name==="MethodNotFoundRpcError"||x.name==="MethodNotSupportedRpcError"?(N.set(t.uid,!1),f):x});throw f}}if((a==null?void 0:a.type)==="local"){if(a.nonceManager&&typeof P>"u"){const w=R.chainId,C=await(async()=>typeof w=="number"?w:e?e.id:l(t,W,"getChainId")({}))();E={address:a.address,chainId:C}}const p=await l(t,Y,"prepareTransactionRequest")({account:a,accessList:m,authorizationList:n,blobs:d,chain:e,data:o?j([s??"0x",o]):s,gas:h,gasPrice:y,maxFeePerBlobGas:i,maxFeePerGas:g,maxPriorityFeePerGas:b,nonce:P,nonceManager:a.nonceManager,parameters:[...Z,"sidecars"],type:F,value:S,...R,to:u}),T=(L=e==null?void 0:e.serializers)==null?void 0:L.transaction,O=await a.signTransaction(p,{serializer:T});return await l(t,$,"sendRawTransaction")({serializedTransaction:O})}throw(a==null?void 0:a.type)==="smart"?new M({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new M({docsPath:"/docs/actions/wallet/sendTransaction",type:a==null?void 0:a.type})}catch(u){throw u instanceof M?u:(E&&((B=a==null?void 0:a.nonceManager)==null||B.reset(E)),aa(u,{...r,account:a,chain:r.chain||void 0}))}}async function z(t,r){return z.internal(t,sa,"sendTransaction",r)}(function(t){async function r(c,q,e,m){const{abi:n,account:d=c.account,address:s,args:o,functionName:h,...y}=m;if(typeof d>"u")throw new k({docsPath:"/docs/contract/writeContract"});const i=d?D(d):null,g=ta({abi:n,args:o,functionName:h});try{return await l(c,q,e)({data:g,to:s,account:i,...y})}catch(b){throw ra(b,{abi:n,address:s,args:o,docsPath:"/docs/contract/writeContract",functionName:h,sender:i==null?void 0:i.address})}}t.internal=r})(z||(z={}));export{sa as s,z as w};
|