1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="35941e65-0986-cc16-148e-8f134bc5e843")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,450223,e=>{"use strict";var t=e.i(150292);let a="u">typeof globalThis?globalThis:"u">typeof self?self:"u">typeof window?window:e.g,r=a.fetch?(...e)=>a.fetch(...e):()=>Promise.reject(Error("[ofetch] global.fetch is not supported!")),n=a.Headers,i=a.AbortController,s=(0,t.c)({fetch:r,Headers:n,AbortController:i});e.s(["ofetch",0,s])},559754,e=>{"use strict";var t=e.i(843476),a=e.i(271645);let r=(0,e.i(768834).create)(()=>({})),n=e=>r.getState()[e];e.s(["P",0,({children:e,configPlugins:n})=>((0,a.useEffect)(()=>{if(n&&0!==n.length)return r.setState(Object.fromEntries(n.map(e=>[e.id,e]))),()=>{r.setState(Object.fromEntries(n.map(e=>[e.id,void 0])))}},[n]),(0,t.jsx)(t.Fragment,{children:e})),"g",0,n,"u",0,()=>(0,a.useCallback)(e=>n(e),[])])},7146,e=>{"use strict";e.s(["createStore",0,function(){let e=new Set,t=[],a=()=>(function(e){if("u"<typeof window)return;let t=t=>e(t.detail);return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)})(a=>{t.some(({info:e})=>e.uuid===a.info.uuid)||(t=[...t,a],e.forEach(e=>e(t,{added:[a]})))}),r=a();return{_listeners:()=>e,clear(){e.forEach(e=>e([],{removed:[...t]})),t=[]},destroy(){this.clear(),e.clear(),r?.()},findProvider:({rdns:e})=>t.find(t=>t.info.rdns===e),getProviders:()=>t,reset(){this.clear(),r?.(),r=a()},subscribe:(a,{emitImmediately:r}={})=>(e.add(a),r&&a(t,{added:t}),()=>e.delete(a))}}],7146)},866352,e=>{"use strict";var t=e.i(843476),a=e.i(271645),r=e.i(283291),n=e.i(951186);function i({src:e,...a}){return(0,t.jsx)("img",{src:e,...a,style:{display:"none"}})}let s=(0,a.createContext)({currentScreen:null,lastScreen:null,navigate:n.n,navigateBack:n.n,resetNavigation:n.n,setModalData:n.n,onUserCloseViaDialogOrKeybindRef:void 0});e.s(["M",0,e=>{let n=(0,r.u)(),[o,c]=(0,a.useState)(e.initialScreen),l=(0,a.useRef)(null);(0,a.useEffect)(()=>{e.open||(l.current=null)},[e.open]),(0,a.useEffect)(()=>{l.current=null},[e.initialScreen]);let d={data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:o,navigate:(t,a=!0)=>{e.setInitialScreen(t),a&&c(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(o)},resetNavigation:()=>{e.setInitialScreen(null),c(null)},onUserCloseViaDialogOrKeybindRef:l};return(0,t.jsxs)(s.Provider,{value:d,children:[("string"==typeof n.appearance.logo||"img"===n.appearance.logo?.type)&&(0,t.jsx)(i,{src:"string"==typeof n.appearance.logo?n.appearance.logo:n.appearance.logo.props.src}),e.children]})},"u",0,()=>(0,a.useContext)(s)])},91838,654544,797481,932763,194820,840796,199220,e=>{"use strict";var t=e.i(33750),a=e.i(951186);let r=crypto;e.s(["default",0,r,"isCryptoKey",0,e=>e instanceof CryptoKey],654544);let n=async(e,t)=>{let a=`SHA-${e.slice(-3)}`;return new Uint8Array(await r.subtle.digest(a,t))};e.s(["default",0,n],797481);let i=new TextEncoder,s=new TextDecoder;function o(...e){let t=new Uint8Array(e.reduce((e,{length:t})=>e+t,0)),a=0;return e.forEach(e=>{t.set(e,a),a+=e.length}),t}function c(e,t,a){if(t<0||t>=0x100000000)throw RangeError(`value must be >= 0 and <= ${0x100000000-1}. Received ${t}`);e.set([t>>>24,t>>>16,t>>>8,255&t],a)}function l(e){let t=new Uint8Array(4);return c(t,e),t}async function d(e,t,a){let r=Math.ceil((t>>3)/32),i=new Uint8Array(32*r);for(let t=0;t<r;t++){let r=new Uint8Array(4+e.length+a.length);r.set(l(t+1)),r.set(e,4),r.set(a,4+e.length),i.set(await n("sha256",r),32*t)}return i.slice(0,t>>3)}e.s(["concat",0,o,"concatKdf",0,d,"decoder",0,s,"encoder",0,i,"lengthAndInput",0,function(e){return o(l(e.length),e)},"p2s",0,function(e,t){return o(i.encode(e),new Uint8Array([0]),t)},"uint32be",0,l,"uint64be",0,function(e){let t=Math.floor(e/0x100000000),a=new Uint8Array(8);return c(a,t,0),c(a,e%0x100000000,4),a}],932763);let u=e=>{let t=e;"string"==typeof t&&(t=i.encode(t));let a=[];for(let e=0;e<t.length;e+=32768)a.push(String.fromCharCode.apply(null,t.subarray(e,e+32768)));return btoa(a.join(""))}
2,p=e=>u(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),h=e=>{let t=atob(e),a=new Uint8Array(t.length);for(let e=0;e<t.length;e++)a[e]=t.charCodeAt(e);return a},f=e=>{let t=e;t instanceof Uint8Array&&(t=s.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return h(t)}catch(e){throw TypeError("The input to be decoded is not correctly encoded.")}};e.s(["decode",0,f,"decodeBase64",0,h,"encode",0,p,"encodeBase64",0,u],194820),e.s(["decode",0,f,"encode",0,p],840796);var w=e.i(840796);e.s(["base64url",0,w],199220);var w=w,m=e.i(283291),y=e.i(767700);function g(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}let v="WALLETCONNECT_DEEPLINK_CHOICE";function C(e){return e.startsWith("http://")||e.startsWith("https://")}function A(e,t){if(C(e))return T(e,t);let a=e;return a.includes("://")||(a=e.replaceAll("/","").replaceAll(":",""),a=`${a}://`),a.endsWith("/")||(a=`${a}/`),{redirect:`${a}wc?uri=${encodeURIComponent(t)}`,href:a}}function T(e,t){if(!C(e))return A(e,t);let a=e;return a.endsWith("/")||(a=`${a}/`),{redirect:`${a}wc?uri=${encodeURIComponent(t)}`,href:a}}function E(e){return crypto.getRandomValues(new Uint8Array(e))}function b(){return w.encode(E(36))}async function S(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return w.encode(t)}}e.s(["a",0,function(){return b()},"b",0,function(e,r){let n=g(r);if(t.isMobile&&t.isAndroid&&n.universalLink)return T(n.universalLink,e);if(n.deepLink)return A(n.deepLink,e);if(n.universalLink)return T(n.universalLink,e);throw new a.P(`Unsupported wallet ${r.id}`)},"c",0,b,"d",0,S,"e",0,function(){try{localStorage.removeItem(v)}catch{}},"f",0,function(e,t){let a=g(t);if(a.universalLink)return T(a.universalLink,e)},"g",0,E,"h",0,function(){let e=y.s.get(m.f);if(!e)throw new a.P("Authentication error.");return e},"o",0,function(e,t){window.open(e,t,"noreferrer noopener")},"r",0,function(){try{localStorage.removeItem(v)}catch{}},"s",0,function({href:e,name:t}){try{localStorage.setItem(v,JSON.stringify({href:e,name:t}))}catch{}}],91838)},844224,e=>{"use strict";e.s(["$",0,"/api/v1/siwe/transfer","A",0,"/api/v1/passwordless_sms/link","B",0,"/api/v1/passwordless_sms/init","C",0,"/api/v1/passwordless_sms/update","D",0,"/api/v1/mfa/passwordless_sms/init","E",0,"/api/v1/mfa/passkeys/init","F",0,"/api/v1/users/me/accept_terms","G",0,"/api/v1/passwordless/unlink","H",0,"/api/v1/passwordless_sms/unlink","I",0,"/api/v1/siwe/unlink","J",0,"/api/v1/siws/unlink","K",0,"/api/v1/oauth/unlink","L",0,"/api/v1/farcaster/unlink","M",0,"/api/v1/telegram/unlink","N",0,"/api/v1/wallets/revoke","O",0,"/api/v1/plugins/moonpay_on_ramp/sign","P",0,"/api/v1/funding/coinbase_on_ramp/init","Q",0,"/api/v1/funding/coinbase_on_ramp/status","R",0,"/api/v1/siwe/init","S",0,"/api/v1/siwe/authenticate","T",0,"/api/v1/siwe/link","U",0,"/api/v1/siwe/link_smart_wallet","V",0,"/api/v1/siws/init","W",0,"/api/v1/siws/authenticate","X",0,"/api/v1/oauth/transfer","Y",0,"/api/v1/siws/transfer","Z",0,"/api/v1/telegram/transfer","_",0,"/api/v1/farcaster/transfer","a",0,"/api/v1/farcaster/link","a0",0,"/api/v1/passwordless_sms/transfer","a1",0,"/api/v1/passwordless/transfer","a2",0,"/api/v1/siws/link","a3",0,"/api/v1/users/me","a4",0,"/api/v1/scan/transaction","a5",0,"api/v2/farcaster/init","a6",0,"api/v2/farcaster/authenticate","a8",0,"/api/v1/recovery/oauth/authenticate","a9",0,"/api/v1/recovery/oauth/init_icloud","aa",0,"/api/v1/recovery/oauth/init","b",0,"/api/v1/farcaster/init","c",0,"/api/v1/farcaster/status","d",0,"/api/v1/passkeys/authenticate","e",0,"/api/v1/passkeys/link","f",0,"/api/v1/farcaster/authenticate","g",0,"/api/v1/passkeys/register/init","h",0,"/api/v1/passkeys/authenticate/init","i",0,"/api/v1/passkeys/link/init","j",0,"/api/v1/telegram/link","k",0,"/api/v1/oauth/link","l",0,"/api/v1/oauth/init","m",0,"/api/v1/sessions/logout","n",0,"/api/v1/analytics_events","o",0,"/api/v1/oauth/authenticate","p",0,"/api/v1/passkeys/register","q",0,"/api/v1/custom_jwt_account/authenticate","r",0,"/api/v1/custom_jwt_account/link","s",0,"/api/v1/sessions","t",0,"/api/v1/telegram/authenticate","u",0,"/api/v1/passwordless/authenticate","v",0,"/api/v1/passwordless/link","w",0,"/api/v1/passwordless/init","x",0,"/api/v1/passwordless/update","y",0,"/api/v1/guest/authenticate","z",0,"/api/v1/passwordless_sms/authenticate"])},944406,e=>{"use strict";e.s(["WalletCreate",0,{path:"/api/v1/wallets",method:"POST"},"WalletGet",0,{path:"/api/v1/wallets/:wallet_id",method:"GET"},"WalletRpc",0,{path:"/api/v1/wallets/:wallet_id/rpc",method:"POST"},"WalletUpdate",0,{path:"/api/v1/wallets/:wallet_id",method:"PATCH"},"WalletsRevoke",0,{path:"/api/v1/wallets/revoke",method:"POST"}])},768797,e=>{"use strict";var t=e.i(944406);async function a(e,{request:r,headers:n}
2){return await e.fetchPrivyRoute(t.WalletCreate,{body:r,headers:n})}e.s(["create",0,a])},673049,e=>{"use strict";e.s(["monadMainnet",0,{id:143,name:"Monad",network:"monad",nativeCurrency:{name:"Monad",symbol:"MON",decimals:18},rpcUrls:{privy:{http:["https://monad-mainnet.rpc.privy.systems"]},default:{http:["https://rpc.monad.xyz"]},public:{http:["https://rpc.monad.xyz"]}},blockExplorers:{default:{name:"Monadscan",url:"https://mainnet-beta.monvision.io"}}}])},512596,e=>{"use strict";var t=e.i(951186),a=e.i(673049),r=e.i(435528),n=e.i(331191),i=e.i(47258),s=e.i(853317),o=e.i(975477),c=e.i(83319),l=e.i(301325),d=e.i(744645),u=e.i(141628),p=e.i(707213),h=e.i(554952),f=e.i(991120),w=e.i(271645),m=e.i(443392),y=e.i(823859),g=e.i(283291),v=e.i(957246),C=e.i(866352);function A(e){return["ethereum","solana"].includes(e.chainType)}function T(e){let t=e.replace("eip155:","");if(t)return parseInt(t);throw Error("Chain ID not compatible with CAIP-2 format.")}let E=e=>e.filter(e=>"wallets"===e.method||("exchange"===e.method?"coinbase"===e.provider:"card"===e.method||"payment-request"===e.method?"coinbase"===e.provider||"moonpay"===e.provider:(e.method,!1))),b={[f.mainnet.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[h.sepolia.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[p.optimism.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[u.optimismSepolia.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[d.polygon.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[l.polygonAmoy.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[c.base.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[o.baseSepolia.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[s.avalanche.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[i.avalancheFuji.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[n.arbitrum.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[r.arbitrumSepolia.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",999:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",[a.monadMainnet.id]:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603"};e.s(["a",0,()=>{let{client:e,setUser:a}=(0,t.u)();return{unlink:(0,w.useCallback)(async({address:t})=>{let r;return a(r=t.startsWith("0x")?await e.unlinkEthereumWallet(t):await e.unlinkSolanaWallet(t)),r},[e,a])}},"b",0,function({address:e,fundWalletConfig:t,appConfig:a,comingFromSendTransactionScreen:r,externalSolanaFundingScreen:n,methodScreen:i}){if(!a.fundingConfig)throw Error("Wallet funding is not enabled");let s=E(a.fundingConfig.options);if(s.length<1)throw Error("Wallet funding is not enabled");if("USDC"===t?.asset&&"solana:testnet"===t?.chain)throw Error("USDC funding is not supported on the Solana testnet");let o=t?.amount??a.fundingConfig.defaultRecommendedAmount,c=t?.defaultFundingMethod;return{chainType:"solana",address:e,supportedOptions:s,amount:o,isUSDC:"USDC"===t?.asset,methodScreen:i,comingFromSendTransactionScreen:r,chain:t?.chain||"solana:mainnet",crossChainBridgingEnabled:a.fundingConfig.crossChainBridgingEnabled??!1,defaultFundingMethod:c,preferredCardProvider:t?.card?.preferredProvider,usingDefaultFundingMethod:!!c,uiConfig:t?.uiConfig,externalSolanaFundingScreen:n,onComplete:()=>{},onError:()=>{}}},"e",0,T,"f",0,E,"i",0,A,"p",0,({address:e,appConfig:a,fundWalletConfig:r,methodScreen:n,chainIdOverride:i,comingFromSendTransactionScreen:s=!1,onComplete:o,onError:c})=>{let l,d;if(!a.fundingConfig)throw Error("Wallet funding is not enabled");let u=E(a.fundingConfig.options);if(u.length<1)throw Error("Wallet funding is not enabled");l=i||(r?.chain?r.chain.id:T(a.fundingConfig.defaultRecommendedCurrency.chain));let p=a.chains.find(e=>e.id===l);if(!p)throw new t.P(`Funding chain ${l} is not in PrivyProvider chains list`);let h=r?.amount??a.fundingConfig.defaultRecommendedAmount,f=!1;function w(){if(!l)return;let e=b[l];u.find(e=>"wallets"===e.method)&&!e&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),d=e,f=!0}r&&"asset"in r?"USDC"===r.asset?w():"string"!=typeof r.asset&&"erc20"in r.asset&&(f=(d=r.asset.erc20)===b[p.id]):"USDC"===a.fundingConfig.defaultRecommendedCurrency.asset&&w();let m=r?.defaultFundingMethod;return{chainType:"ethereum",address:e,amount:h,chain:p,erc20Address:d,erc20ContractInfo:f?{symbol:"USDC",decimals:6}:void 0,isUSDC:f,methodScreen:n,supportedOptions:u,comingFromSendTransactionScreen:s,defaultFundingMethod:m,usingDefaultFundingMethod:!!m,preferredCardProvider:r?.card?.preferredProvider,crossChainBridgingEnabled:a.fundingConfig.crossChainBridgingEnabled??!1,solanaChain:"solana:mainnet",uiConfig:r&&"uiConfig"in r?r.uiConfig:void 0,externalSolanaFundingScreen:null,onComplete:o??(()=>{}),onError:c??(()=>{})}},"u",0,function(){let{user:e,getAccessToken:a}=(0,y.u)(),{walletProxy:r,openModal:n,client:i}=(0,t.u)(),{setModalData:s}=(0,C.u)(),o=(0,g.u)();return(0,w.useMemo)(()=>({exportWallet:c=>new Promise(async(l,d)=>{if(!e)return void d(Error("User must be authenticated before exporting their Privy wallet"));c&&"target"in c&&c&&(c=void 0);let u=c?.address?(0,y.f)(e,c.address):(0,y.b)(e);if(!u)return void d(new t.P("User must have an embedded wallet."));let p=u.address,{entropyId:h,entropyIdVerifier:f}=(0,v.g)(e,u),w=(0,y.a)(u);if(!p)return void d(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));
2if(!(0,m.isAddress)(p))return void d(Error("Must provide a valid Ethereum address."));let g={recoveryMethod:u.recoveryMethod,connectingWalletAddress:u.address,isUnifiedWallet:w,entropyId:h,entropyIdVerifier:f,onCompleteNavigateTo:"EmbeddedWalletKeyExportScreen",onFailure:d,shouldForceMFA:!0};await a()&&r?A(u)?(s({keyExport:{appId:o.id,appClientId:o.appClientId,origin:i.apiUrl,address:u.address,entropyId:h,entropyIdVerifier:f,hdWalletIndex:u.walletIndex,chainType:u.chainType,walletId:u.id,isUnifiedWallet:w,imported:u.imported,onSuccess:l,onFailure:d,showBackButton:c?.showBackButton},connectWallet:g}),n("EmbeddedWalletConnectingScreen")):d(Error(`Export is not supported for ${u.chainType} wallets`)):d(Error("Must have valid access token."))})}),[e,a,r,n,i,s,o])}],512596)},320065,e=>{"use strict";e.s(["trigger",0,e=>window.open(e?.location,void 0,(({w:e,h:t})=>{let a=void 0!==window.screenLeft?window.screenLeft:window.screenX,r=void 0!==window.screenTop?window.screenTop:window.screenY,n=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,i=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e},popup=1,left=${(n-e)/2/(n/window.screen.availWidth)+a},top=${(i-t)/2/(i/window.screen.availHeight)+r}`})({w:440,h:680}))],320065)},977225,e=>{"use strict";var t=e.i(271645),a=e.i(512596),r=e.i(823859),n=e.i(320065),i=e.i(283291),s=e.i(951186),o=e.i(844224),c=e.i(91838),l=e.i(544316),d=e.i(767700),u=e.i(594025),p=e.i(866352),h=e.i(957246),f=e.i(768797);class w{async authenticate(){if(!this.api)throw new s.P("Auth flow has no API instance");try{return await this.api.post(o.o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw(0,s.f)(e)}}async link(){if(!this.api)throw new s.P("Auth flow has no API instance");try{return await this.api.post(o.k,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw(0,s.f)(e)}}constructor(e){this.meta=e}}async function m({api:e,requesterAppId:t,providerAppId:a}){let r=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(e=>e.provider_app_id===a);if(!r)throw new s.P("Invalid connected app");return{name:r.provider_app_name,logoUrl:r.provider_app_icon_url||void 0,apiUrl:r.provider_app_custom_api_url,readOnly:r.read_only,customAuthAuthorizeUrl:r.provider_app_custom_auth_authorize_url,customAuthTransactUrl:r.provider_app_custom_auth_transact_url}}async function y({api:e,appId:t}){let a=(0,c.c)(),r=(0,c.a)(),n=await (0,c.d)(a);try{let{url:i}=await e.post(o.l,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:n,state_code:r});return{url:i,stateCode:r,codeVerifier:a}}catch(e){throw(0,s.f)(e)}}async function g({appId:e,stateCode:t,codeVerifier:a,authorizationCode:r,action:n,client:i,disableSignup:o}){if(!r||!t)throw new s.P("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===r)throw new s.P("User denied confirmation during cross-app auth flow");try{let s=new w({authorizationCode:r,stateCode:t,codeVerifier:a,provider:`privy:${e}`,disableSignup:!!o});i.startAuthFlow(s);let c="link"===n?await i.link():await i.authenticate(),l=c.oAuthTokens?.accessToken;return console.debug(),l}catch(t){let e=(0,s.f)(t);if(e.privyErrorCode===s.a.ACCOUNT_TRANSFER_REQUIRED)throw e;if(e.privyErrorCode)throw new s.P(e.message||"Invalid code during cross-app auth flow.",void 0,e.privyErrorCode);if("User denied confirmation during cross-app auth flow"===e.message)throw new s.P("Invalid code during cross-app auth flow.",void 0,s.a.OAUTH_USER_DENIED);throw new s.P("Invalid code during cross-app auth flow.",void 0,s.a.UNKNOWN_AUTH_ERROR)}}let v=Symbol("solana-funding-plugin"),C=Symbol("solana-ledger-plugin"),A=async({user:e,accessToken:t,proxy:a,refreshSessionAndUser:n,privy:i,appConfig:s,recoverEmbeddedWallet:o,setUser:c,walletIndex:l,chainType:u,recoveryMethod:p,recoveryPassword:w,recoveryAccessToken:m,idempotencyKey:y,additionalSigners:g})=>{if(0===l)if("user-controlled-server-wallets-only"===s.embeddedWallets.mode)await (0,f.create)(i,{request:{chain_type:u,additional_signers:g?(0,d.b)(g):void 0},headers:y?{"privy-idempotency-key":y}:void 0});else if("ethereum"===u){let n=(0,r.d)(e);n&&await o({address:n.address}),await a.create({accessToken:t,solanaAddress:n?.address,recoveryMethod:p,recoveryPassword:w,recoveryAccessToken:m})}else{if("solana"!==u)throw Error("Invalid input to create wallet");{let n=(0,r.b)(e);n&&await o({address:n.address}),await a.createSolana({accessToken:t,ethereumAddress:n?.address,recoveryMethod:p,recoveryPassword:w,recoveryAccessToken:m})}}else if("user-controlled-server-wallets-only"===s.embeddedWallets.mode)await (0,f.create)(i,{request:{chain_type:u,additional_signers:g?(0,d.b)(g):void 0}});else{let{entropyId:r,entropyIdVerifier:n}=(0,h.g)(e);await o(),await a.addWallet({accessToken:t,entropyId:r,entropyIdVerifier:n,chainType:u,hdWalletIndex:l})}
2let v=await n(),C=(0,h.c)(v,{chainType:u,walletIndex:l})[0];return c(v),{user:v,account:C}},T=async({user:e,address:t,client:a,request:r,requesterAppId:i,reconnect:o})=>{a.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:r.method}});let c=e?.linkedAccounts.find(e=>"cross_app"===e.type&&(e.embeddedWallets.some(e=>e.address===t)||e.smartWallets.some(e=>e.address===t)));if(!e||!c)throw a.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new s.P("Cannot request a signature with this wallet address");let l=a.getProviderAccessToken(c.providerApp.id),d=await m({api:a.api,requesterAppId:i,providerAppId:c.providerApp.id});if(!l){if(d.readOnly)throw console.error("cannot transact against a read-only provider app"),new s.P("Cannot transact against a read-only provider app");await o({appId:c.providerApp.id,action:"link"})&&(l=a.getProviderAccessToken(c.providerApp.id))}if(!l)throw a.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new s.P("Transactions require a valid token");let u=new URL(d.customAuthTransactUrl||`${d.apiUrl}/oauth/transact`);u.searchParams.set("token",l||""),u.searchParams.set("request",E(r));let p=(0,n.trigger)({location:u.href});if(!p)throw a.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new s.P("Failed to initialize signature request");return new Promise((e,n)=>{let i=setTimeout(()=>{d(),n(new s.P("Request timeout")),a.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),o=setInterval(()=>{p.closed&&(d(),n(new s.P("User rejected request")),a.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),l=i=>{i.data&&("set"===i.data.token?.action&&void 0!==i.data.token?.value?a.storeProviderAccessToken(c.providerApp.id,i.data.token.value):"clear"===i.data.token?.action&&a.storeProviderAccessToken(c.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===i.data.type&&i.data.result&&(d(),e(i.data.result),a.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:r.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===i.data.type&&i.data.error&&(d(),n(i.data.error),a.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:i.data.error,address:t}})))};window.addEventListener("message",l);let d=()=>{p.close(),clearInterval(o),clearTimeout(i),window.removeEventListener("message",l)}})},E=e=>JSON.stringify({content:{request:{request:b(e,l.toHex)}},timestamp:Date.now(),callbackUrl:window.origin}),b=(e,t)=>"bigint"==typeof e?t(e):Array.isArray(e)?e.map(e=>b(e,t)):e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,a])=>[e,b(a,t)])):e,S=()=>{let{user:e,getAccessToken:a}=(0,r.u)(),{client:o,setUser:c,openModal:l,inProgressAuthFlowRef:h,inProgressLoginOrLinkMethodRef:f}=(0,s.u)(),w=(0,i.u)(),y=(0,u.a)(),{setModalData:g}=(0,p.u)(),v=(0,t.useCallback)(t=>e?.linkedAccounts.some(e=>"cross_app"===e.type&&e.smartWallets.some(e=>e.address===t))??!1,[e]),C=(0,t.useCallback)(async({appId:e,action:t,disableSignup:r})=>{let i=await a();if("link"===t&&!i)throw y("linkAccount","onError",s.a.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new s.P("User must be authenticated before linking an account.");if("login"===t&&i)throw y("login","onError",s.a.UNKNOWN_AUTH_ERROR),new s.P("Attempted to log in, but user is already logged in. Use a `link` helper instead.");f.current=`privy:${e}`,h.current=t;let c=(0,n.trigger)();return o.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise(async(a,n)=>{let{name:i,logoUrl:s}=await m({api:o.api,providerAppId:e,requesterAppId:w.id});g({crossAppAuth:{appId:e,name:i,logoUrl:s,action:t,popup:c,disableSignup:r,onSuccess:a,onError:n}}),l("CrossAppAuthScreen")})},[a,y,f,h,o,w.id,g,l]),A=(0,t.useCallback)(async({subject:t})=>{let a=e?.linkedAccounts.find(e=>"cross_app"===e.type&&e.subject===t)?.providerApp;if(!a)throw new s.P("Invalid subject");o.storeProviderAccessToken(a.id,null);let r=await o.unlinkOAuth(`privy:${a.id}`,t);return c(r),r},[e,o,c]),E=(0,t.useCallback)((t,{address:a,chainId:r})=>T({user:e,client:o,address:a,requesterAppId:w.id,request:{method:v(a)?"privy_signSmartWalletMessage":"personal_sign",params:[t,a],chainId:r},reconnect:C}),[e,o,w.id,v,C]),b=(0,t.useCallback)((t,{address:a,chainId:r})=>{let n=(0,d.g)(t);return T({user:e,client:o,address:a,requesterAppId:w.id,request:{method:v(a)?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[a,n],chainId:r},reconnect:C})},[e,o,w.id,v,C]),S=(0,t.useCallback)((t,{address:a})=>T({user:e,client:o,address:a,requesterAppId:w.id,request:{method:v(a)?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[t],
2chainId:t.chainId},reconnect:C}),[e,o,w.id,v,C]),k=(0,t.useCallback)((t,{address:a})=>T({user:e,client:o,address:a,requesterAppId:w.id,request:{method:v(a)?"privy_signSmartWalletTx":"eth_signTransaction",params:[t],chainId:t.chainId},reconnect:C}),[e,o,w.id,v,C]);return(0,t.useMemo)(()=>({startCrossAppAuthFlow:C,unlinkCrossAppAccount:A,signMessageWithCrossAppWallet:E,signTypedDataWithCrossAppWallet:b,sendTransactionWithCrossAppWallet:S,signTransactionWithCrossAppWallet:k}),[C,A,E,b,S,k])},k=()=>{let{client:e,setUser:a,walletProxy:n}=(0,s.u)(),{getAccessToken:o}=(0,r.u)(),c=(0,i.u)(),l=c?.passkeys?.shouldUnenrollMfaOnUnlink??!1;return{unlink:(0,t.useCallback)(async({credentialId:t})=>{let r=await o();if(!r)throw Error("Must have valid access token to enroll in MFA");if(!n)throw Error("Wallet proxy not initialized.");await n.unlinkPasskeyAccount({credentialId:t,accessToken:r,removeAsMfa:l});let i=await e.getAuthenticatedUser();return a(i),i},[l,e,o,a,n])}},_=async({appConfig:e,getAccessToken:t,initializeWalletProxy:a,user:r,privy:n,emitPrivyEvent:i,recoverEmbeddedWallet:o,setModalData:c,openModal:l,setUser:d,options:u,timeoutDuration:p,refreshSessionAndUser:f,chainType:w,idempotencyKey:m,additionalSigners:y})=>{let[g,v]=await Promise.all([a(p),t()]);if(!v||!r)throw i("createWallet","onError",s.a.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");if(!g&&e.customAuth?.enabled)throw i("createWallet","onError",s.a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(y&&"user-controlled-server-wallets-only"!==e.embeddedWallets.mode)throw new s.P("Specifying additionalSigners is only supported for TEE execution and this app uses on-device execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");if(u&&"walletIndex"in u&&"number"==typeof u.walletIndex){if("user-controlled-server-wallets-only"===e.embeddedWallets.mode)throw i("createWallet","onError",s.a.INVALID_DATA),Error("Invalid input, use `createAdditional` instead of `walletIndex` to create additional wallets.");return I({accessToken:v,appConfig:e,privy:n,emitPrivyEvent:i,openModal:l,proxy:g,refreshSessionAndUser:f,recoverEmbeddedWallet:o,setModalData:c,user:r,walletIndex:u.walletIndex,chainType:w,setUser:d,additionalSigners:y})}let C=u&&"createAdditional"in u&&u.createAdditional,A=(0,h.c)(r,{chainType:w});if(A[0]&&!C)throw i("createWallet","onError",s.a.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return I({accessToken:v,appConfig:e,privy:n,emitPrivyEvent:i,openModal:l,proxy:g,recoverEmbeddedWallet:o,setModalData:c,user:r,walletIndex:(A.reduce((e,t)=>!e||e.walletIndex<t.walletIndex?t:e,null)?.walletIndex??-1)+1,chainType:w,refreshSessionAndUser:f,setUser:d,idempotencyKey:m,additionalSigners:y})},I=async({accessToken:e,appConfig:t,privy:a,emitPrivyEvent:n,proxy:i,refreshSessionAndUser:o,recoverEmbeddedWallet:c,user:l,walletIndex:d,setModalData:u,openModal:p,chainType:f,setUser:w,idempotencyKey:m,additionalSigners:y})=>{if(d<0)throw n("createWallet","onError",s.a.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${d}) is invalid.`);let g=(0,r.g)(l);if(d>0&&!g)throw n("createWallet","onError",s.a.EMBEDDED_WALLET_NOT_FOUND),Error("Must have an existing embedded wallet to create an additional wallet.");if(t.embeddedWallets.requireUserOwnedRecoveryOnCreate&&"user-controlled-server-wallets-only"===t.embeddedWallets.mode)throw n("createWallet","onError",s.a.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!g&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await x({emitPrivyEvent:n,setModalData:u,openModal:p,chainType:f});let v=(0,h.c)(l,{chainType:f,walletIndex:d})[0];if(v)return{user:l,account:v};if(0===d&&!i)return x({emitPrivyEvent:n,setModalData:u,openModal:p,chainType:f});if(!i)throw n("createWallet","onError",s.a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return A({appConfig:t,walletIndex:d,chainType:f,user:l,accessToken:e,proxy:i,refreshSessionAndUser:o,privy:a,recoverEmbeddedWallet:c,setUser:w,idempotencyKey:m,additionalSigners:y})},x=async({emitPrivyEvent:e,setModalData:t,openModal:a,chainType:r})=>new Promise((n,i)=>{t({createWallet:{onSuccess:({user:t,account:a})=>{e("createWallet","onSuccess",{wallet:a}),n({user:t,account:a})},onFailure:t=>{e("createWallet","onError",s.a.UNKNOWN_EMBEDDED_WALLET_ERROR),i(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===r,shouldCreateSol:"solana"===r}}),a("EmbeddedWalletOnAccountCreateScreen")}),P=()=>{let e=(0,i.u)(),t=(0,u.a)(),{setModalData:a}=(0,p.u)(),{initializeWalletProxy:r,recoverEmbeddedWallet:n,setUser:o,openModal:c,refreshSessionAndUser:l,privy:d,client:h}=(0,s.u)();return{create:async({chainType:u,options:p,latestUser:f,idempotencyKey:w})=>{let m=f;if(m||(m=await l()),!m)throw t("createWallet","onError",s.a.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return await _({appConfig:e,privy:d,getAccessToken:()=>h.getAccessToken(),refreshSessionAndUser:l,initializeWalletProxy:r,user:m,emitPrivyEvent:t,recoverEmbeddedWallet:n,setModalData:a,openModal:c,setUser:o,options:p,timeoutDuration:i.W,chainType:u,idempotencyKey:w,additionalSigners:p?.signers})}}};function U(e){let{create:t}=P();return(0,u.u)("createWallet",e),{createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:a}=await t({chainType:"ethereum",options:e});return a}}}let R=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:a,refreshSessionAndUser:n,user:i,appConfig:o},{privateKey:c,chainType:l,additionalSigners:d})=>{if(!i)throw e("linkAccount","onError",s.a.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new s.P("User must be authenticated before linking an account.");let u="user-controlled-server-wallets-only"===o.embeddedWallets.mode?"tee":"on-device";if(d&&"on-device"===u)throw new s.P("Specifying additionalSigners is only supported for TEE execution and this app uses on-device execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let[p,h]=await Promise.all([t(),a(15e3)]);if(!h||!p)throw e("linkAccount","onError",s.a.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new s.P("User must be authenticated before linking an account.");let{address:f}=await h.importWallet({privateKey:c,accessToken:p,chainType:l,mode:u,additionalSigners:d}),w=await n(),m="solana"===l?(0,r.e)(w):(0,r.c)(w),y=m?.find(e=>e.address===f);if(!y)throw e("createWallet","onError",s.a.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:y}),y};e.s(["S",0,v,"a",0,g,"b",0,C,"c",0,A,"d",0,S,"e",0,P,"f",0,U,"g",0,y,"l",0,k,"p",0,({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account: 3${e} 4 5You are proving you own ${e}. 6 7URI: ${window.location.origin} 8Version: 1 9Chain ID: mainnet 10Nonce: ${t} 11Issued At: ${(new Date).toISOString()} 12Resources: 13- https://privy.io`,"u",0,()=>{let{importWallet:e}=(()=>{let{user:e}=(0,r.u)(),{client:a,refreshSessionAndUser:n,initializeWalletProxy:o}=(0,s.u)(),c=(0,u.a)(),l=(0,i.u)();return{importWallet:(0,t.useCallback)(({privateKey:t,additionalSigners:r})=>R({getAccessToken:()=>a.getAccessToken(),user:e,initializeWalletProxy:o,refreshSessionAndUser:n,emitPrivyEvent:c,appConfig:l},{privateKey:t,chainType:"ethereum",additionalSigners:r}),[e,a,n,o,c,l])}})(),{exportWallet:n}=(0,a.u)(),{createWallet:o}=U(),{unlinkCrossAppAccount:c}=S(),{unlink:l}=(0,a.a)(),{unlink:d}=(()=>{let{client:e,setUser:a}=(0,s.u)();return{unlink:(0,t.useCallback)(async({address:t})=>{let r=await e.unlinkEmail(t);return a(r),r},[e,a])}})(),{unlink:p}=(()=>{let{client:e,setUser:a}=(0,s.u)();return{unlink:(0,t.useCallback)(async({phoneNumber:t})=>{let r=await e.unlinkPhone(t);return a(r),r},[e,a])}})(),{unlink:h}=(()=>{let{client:e,setUser:a}=(0,s.u)();return{unlink:(0,t.useCallback)(async({fid:t})=>{let r=await e.unlinkFarcaster(t);return a(r),r},[e,a])}})(),{unlink:f}=(()=>{let{client:e,setUser:a}=(0,s.u)();return{unlink:(0,t.useCallback)(async({telegramUserId:t})=>{let r=await e.unlinkTelegram(t);return a(r),r},[e,a])}})(),{unlink:w}=k(),{unlink:m}=(()=>{let{client:e,setUser:a}=(0,s.u)();return{unlink:(0,t.useCallback)(async({provider:t,subject:r})=>{let n=await e.unlinkOAuth(t,r);return a(n),n},[e,a])}})(),y=(0,t.useCallback)(e=>l({address:e}),[l]),g=(0,t.useCallback)(e=>d({address:e}),[d]),v=(0,t.useCallback)(e=>p({phoneNumber:e}),[p]),C=(0,t.useCallback)(e=>h({fid:e}
13),[h]),A=(0,t.useCallback)(e=>f({telegramUserId:e}),[f]),T=(0,t.useCallback)(e=>w({credentialId:e}),[w]),E=(0,t.useCallback)(e=>m(e),[m]),b=(0,t.useCallback)(e=>m({provider:"google",subject:e}),[m]),_=(0,t.useCallback)(e=>m({provider:"twitter",subject:e}),[m]),I=(0,t.useCallback)(e=>m({provider:"twitch",subject:e}),[m]),x=(0,t.useCallback)(e=>m({provider:"discord",subject:e}),[m]),P=(0,t.useCallback)(e=>m({provider:"github",subject:e}),[m]),M=(0,t.useCallback)(e=>m({provider:"spotify",subject:e}),[m]),W=(0,t.useCallback)(e=>m({provider:"instagram",subject:e}),[m]),D=(0,t.useCallback)(e=>m({provider:"tiktok",subject:e}),[m]),N=(0,t.useCallback)(e=>m({provider:"line",subject:e}),[m]),q=(0,t.useCallback)(e=>m({provider:"linkedin",subject:e}),[m]),O=(0,t.useCallback)(e=>m({provider:"apple",subject:e}),[m]);return{...(0,t.useContext)(r.P),importWallet:e,createWallet:o,exportWallet:n,unlinkCrossAppAccount:c,unlinkWallet:y,unlinkEmail:g,unlinkPhone:v,unlinkGoogle:b,unlinkTwitter:_,unlinkTwitch:I,unlinkDiscord:x,unlinkGithub:P,unlinkSpotify:M,unlinkInstagram:W,unlinkTiktok:D,unlinkLine:N,unlinkLinkedIn:q,unlinkApple:O,unlinkFarcaster:C,unlinkTelegram:A,unlinkPasskey:T,unlinkOAuth:E}}])},469272,e=>{"use strict";var t=e.i(991120),a=e.i(331191),r=e.i(83319),n=e.i(744645),i=e.i(853317),s=e.i(958747),o=e.i(673049),c=e.i(707213);let l=new Set([t.mainnet.id,a.arbitrum.id,r.base.id,n.polygon.id,i.avalanche.id,s.celo.id,o.monadMainnet.id]),d=new Set([t.mainnet.id,a.arbitrum.id,c.optimism.id,r.base.id,n.polygon.id,i.avalanche.id]);e.s(["MoonpayEnvironments",0,{prod:{url:"https://api.moonpay.com/v1",key:"pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL"},sandbox:{url:"https://api.moonpay.com/v1",key:"pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI"}},"chainToMoonpayCurrency",0,function(e,c){switch(e){case a.arbitrum.id:return"native-currency"===c?"ETH_ARBITRUM":"USDC_ARBITRUM";case i.avalanche.id:return"native-currency"===c?"AVAX_CCHAIN":"USDC_CCHAIN";case r.base.id:return"native-currency"===c?"ETH_BASE":"USDC_BASE";case s.celo.id:return"CELO_CELO";case n.polygon.id:return"native-currency"===c?"MATIC_POLYGON":"USDC_POLYGON";case o.monadMainnet.id:return"MON_MON";case t.mainnet.id:return"native-currency"===c?"ETH_ETHEREUM":"USDC_ETHEREUM";default:return console.warn(`Chain ${e} not supported by Moonpay, defaulting to Ethereum mainnet`),"ETH_ETHEREUM"}},"isSupportedChainIdForMoonpay",0,function(e,t){switch(t){case"native-currency":return l.has(e);case"USDC":return d.has(e);default:return console.warn("Unknown asset passed to MoonPay Onramp"),!1}}])},590935,e=>{"use strict";var t=e.i(138981),a=e.i(18440),r=e.i(241582),n=e.i(544316),i=e.i(710826),s=e.i(377092),o=e.i(782872),c=e.i(666864);async function l(e,l){let{account:d=e.account,chain:u=e.chain,...p}=l;if(!d)throw new a.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});let h=(0,t.parseAccount)(d);(0,o.assertRequest)({account:h,...l});let f=await (0,s.getAction)(e,c.getChainId,"getChainId")({});null!==u&&(0,r.assertCurrentChain)({currentChainId:f,chain:u});let w=u?.formatters||e.chain?.formatters,m=w?.transactionRequest?.format||i.formatTransactionRequest;return h.signTransaction?h.signTransaction({...p,account:h,chainId:f},{serializer:e.chain?.serializers?.transaction}):await e.request({method:"eth_signTransaction",params:[{...m({...p,account:h},"signTransaction"),chainId:(0,n.numberToHex)(f),from:h.address}]},{retryCount:0})}e.s(["signTransaction",0,l])},87757,e=>{"use strict";var t=e.i(544316);async function a(e,{chain:r}){let{id:n,name:i,nativeCurrency:s,rpcUrls:o,blockExplorers:c}=r;await e.request({method:"wallet_addEthereumChain",params:[{chainId:(0,t.numberToHex)(n),chainName:i,nativeCurrency:s,rpcUrls:o.default.http,blockExplorerUrls:c?Object.values(c).map(({url:e})=>e):void 0}]},{dedupe:!0,retryCount:0})}e.s(["addChain",0,a])},632034,e=>{"use strict";var t=e.i(185391),a=e.i(21701);e.s(["deployContract",0,function(e,r){let{abi:n,args:i,bytecode:s,...o}=r,c=(0,t.encodeDeployData)({abi:n,args:i,bytecode:s});return(0,a.sendTransaction)(e,{...o,...o.authorizationList?{to:null}:{},data:c})}])},559982,e=>{"use strict";var t=e.i(736618);async function a(e){return e.account?.type==="local"?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map(e=>(0,t.checksumAddress)(e))}e.s(["getAddresses",0,a])},276860,100620,e=>{"use strict";var t=e.i(28106),a=e.i(696748),r=e.i(977824),n=e.i(486144),i=e.i(138981),s=e.i(224704),o=e.i(832607),c=e.i(586651),l=e.i(351674),d=e.i(544316),u=e.i(246794),p=e.i(21701);let h="0x5792579257925792579257925792579257925792579257925792579257925792",f=(0,d.numberToHex)(0,{size:32});async function w(e,t){let{account:a=e.account,chain:n=e.chain,experimental_fallback:w,experimental_fallbackDelay:m=32,forceAtomic:y=!1,id:g,version:v="2.0.0"}=t,C=a?(0,i.parseAccount)(a):null,A=t.capabilities;e.dataSuffix&&!t.capabilities?.dataSuffix&&(A="string"==typeof e.dataSuffix?{...t.capabilities,dataSuffix:{value:e.dataSuffix,optional:!0}}:{...t.capabilities,dataSuffix:{value:e.dataSuffix.value,...e.dataSuffix.required?{}:{optional:!0}}});let T=t.calls.map(e=>{let t=e.abi?(0,c.encodeFunctionData)({abi:e.abi,functionName:e.functionName,args:e.args}):e.data;return{data:e.dataSuffix&&t?(0,l.concat)([t,e.dataSuffix]):t,to:e.to,value:e.value?(0,d.numberToHex)(e.value):void 0}});try{let t=await e.request({method:"wallet_sendCalls",params:[{atomicRequired:y,calls:T,capabilities:A,chainId:(0,d.numberToHex)(n.id),from:C?.address,id:g,version:v}]},{retryCount:0});if("string"==typeof t)return{id:t};return t}catch(a){if(w&&("MethodNotFoundRpcError"===a.name||"MethodNotSupportedRpcError"===a.name||"UnknownRpcError"===a.name||a.details.toLowerCase().includes("does not exist / is not available")||a.details.toLowerCase().includes("missing or invalid. request()")||a.details.toLowerCase().includes("did n
13ot match any variant of untagged enum")||a.details.toLowerCase().includes("account upgraded to unsupported contract")||a.details.toLowerCase().includes("eip-7702 not supported")||a.details.toLowerCase().includes("unsupported wc_ method")||a.details.toLowerCase().includes("feature toggled misconfigured")||a.details.toLowerCase().includes("jsonrpcengine: response has no error or result for request"))){if(A&&Object.values(A).some(e=>!e.optional)){let e="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new o.UnsupportedNonOptionalCapabilityError(new s.BaseError(e,{details:e}))}if(y&&T.length>1){let e="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new o.AtomicityNotSupportedError(new s.BaseError(e,{details:e}))}let t=[];for(let a of T){try{let i=await (0,p.sendTransaction)(e,{account:C,chain:n,data:a.data,to:a.to,value:a.value?(0,r.hexToBigInt)(a.value):void 0});t.push({status:"fulfilled",value:i})}catch(e){t.push({reason:e,status:"rejected"})}m>0&&await new Promise(e=>setTimeout(e,m))}if(t.every(e=>"rejected"===e.status))throw t[0].reason;let a=t.map(e=>"fulfilled"===e.status?e.value:f);return{id:(0,l.concat)([...a,(0,d.numberToHex)(n.id,{size:32}),h])}}throw(0,u.getTransactionError)(a,{...t,account:C,chain:t.chain})}}async function m(e,i){let s;async function o(n){if(n.endsWith(h.slice(2))){let i=(0,a.trim)((0,t.sliceHex)(n,-64,-32)),s=(0,t.sliceHex)(n,0,-64).slice(2).match(/.{1,64}/g),o=await Promise.all(s.map(t=>f.slice(2)!==t?e.request({method:"eth_getTransactionReceipt",params:[`0x${t}`]},{dedupe:!0}):void 0)),c=o.some(e=>null===e)?100:o.every(e=>e?.status==="0x1")?200:o.every(e=>e?.status==="0x0")?500:600;return{atomic:!1,chainId:(0,r.hexToNumber)(i),receipts:o.filter(Boolean),status:c,version:"2.0.0"}}return e.request({method:"wallet_getCallsStatus",params:[n]})}let{atomic:c=!1,chainId:l,receipts:d,version:u="2.0.0",...p}=await o(i.id),[w,m]=(s=p.status)>=100&&s<200?["pending",s]:s>=200&&s<300?["success",s]:s>=300&&s<700?["failure",s]:"CONFIRMED"===s?["success",200]:"PENDING"===s?["pending",100]:[void 0,s];return{...p,atomic:c,chainId:l?(0,r.hexToNumber)(l):void 0,receipts:d?.map(e=>({...e,blockNumber:(0,r.hexToBigInt)(e.blockNumber),gasUsed:(0,r.hexToBigInt)(e.gasUsed),status:n.receiptStatuses[e.status]}))??[],statusCode:m,status:w,version:u}}e.s(["fallbackMagicIdentifier",0,h,"fallbackTransactionErrorMagicIdentifier",0,f,"sendCalls",0,w],100620),e.s(["getCallsStatus",0,m],276860)},715993,e=>{"use strict";var t=e.i(138981),a=e.i(544316);async function r(e,n={}){let{account:i=e.account,chainId:s}=n,o=i?(0,t.parseAccount)(i):void 0,c=s?[o?.address,[(0,a.numberToHex)(s)]]:[o?.address],l=await e.request({method:"wallet_getCapabilities",params:c}),d={};for(let[e,t]of Object.entries(l))for(let[a,r]of(d[Number(e)]={},Object.entries(t)))"addSubAccount"===a&&(a="unstable_addSubAccount"),d[Number(e)][a]=r;return"number"==typeof s?d[s]:d}e.s(["getCapabilities",0,r])},604794,919079,309136,263122,e=>{"use strict";async function t(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}e.s(["getPermissions",0,t],604794);var a=e.i(138981),r=e.i(18440),n=e.i(198480),i=e.i(377092),s=e.i(666864),o=e.i(858708);async function c(e,t){let{account:c=e.account,chainId:l,nonce:d}=t;if(!c)throw new r.AccountNotFoundError({docsPath:"/docs/eip7702/prepareAuthorization"});let u=(0,a.parseAccount)(c),p=(()=>
13{if(t.executor)return"self"===t.executor?t.executor:(0,a.parseAccount)(t.executor)})(),h={address:t.contractAddress??t.address,chainId:l,nonce:d};return void 0===h.chainId&&(h.chainId=e.chain?.id??await (0,i.getAction)(e,s.getChainId,"getChainId")({})),void 0===h.nonce&&(h.nonce=await (0,i.getAction)(e,o.getTransactionCount,"getTransactionCount")({address:u.address,blockTag:"pending"}),("self"===p||p?.address&&(0,n.isAddressEqual)(p.address,u.address))&&(h.nonce+=1)),h}e.s(["prepareAuthorization",0,c],919079);var l=e.i(736618);async function d(e){return(await e.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(e=>(0,l.getAddress)(e))}async function u(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}e.s(["requestAddresses",0,d],309136),e.s(["requestPermissions",0,u],263122)},469429,e=>{"use strict";var t=e.i(224704);class a extends t.BaseError{constructor(e){super(`Call bundle failed with status: ${e.statusCode}`,{name:"BundleFailedError"}),Object.defineProperty(this,"result",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.result=e}}e.s(["BundleFailedError",0,a])},610213,e=>{"use strict";var t=e.i(224704),a=e.i(469429),r=e.i(377092),n=e.i(794367),i=e.i(130525),s=e.i(64025),o=e.i(900034),c=e.i(927607),l=e.i(276860);async function d(e,t){let d,{id:p,pollingInterval:h=e.pollingInterval,status:f=({statusCode:e})=>200===e||e>=300,retryCount:w=4,retryDelay:m=({count:e})=>200*~~(1<<e),timeout:y=6e4,throwOnFailure:g=!1}=t,v=(0,c.stringify)(["waitForCallsStatus",e.uid,p]),{promise:C,resolve:A,reject:T}=(0,s.withResolvers)(),E=(0,n.observe)(v,{resolve:A,reject:T},t=>{let n=(0,i.poll)(async()=>{let i=e=>{clearTimeout(d),n(),e(),E()};try{let n=await (0,o.withRetry)(async()=>{let t=await (0,r.getAction)(e,l.getCallsStatus,"getCallsStatus")({id:p});if(g&&"failure"===t.status)throw new a.BundleFailedError(t);return t},{retryCount:w,delay:m});if(!f(n))return;i(()=>t.resolve(n))}catch(e){i(()=>t.reject(e))}},{interval:h,emitOnBegin:!0});return n});return d=y?setTimeout(()=>{E(),clearTimeout(d),T(new u({id:p}))},y):void 0,await C}class u extends t.BaseError{constructor({id:e}){super(`Timed out while waiting for call bundle with id "${e}" to be confirmed.`,{name:"WaitForCallsStatusTimeoutError"})}}e.s(["WaitForCallsStatusTimeoutError",0,u,"waitForCallsStatus",0,d])},338975,236718,762980,345578,487837,669386,431435,31602,818115,e=>{"use strict";var t=e.i(377092),a=e.i(100620),r=e.i(610213);async function n(e,n){let{chain:i=e.chain}=n,s=n.timeout??Math.max((i?.blockTime??0)*3,5e3),o=await (0,t.getAction)(e,a.sendCalls,"sendCalls")(n);return await (0,t.getAction)(e,r.waitForCallsStatus,"waitForCallsStatus")({...n,id:o.id,timeout:s})}e.s(["sendCallsSync",0,n],338975);var i=e.i(138981),s=e.i(18440),o=e.i(224704),c=e.i(803116),l=e.i(350436),d=e.i(241582),u=e.i(351674),p=e.i(246794),h=e.i(151223),f=e.i(710826),w=e.i(463823),m=e.i(782872),y=e.i(666864),g=e.i(46281),v=e.i(247320),C=e.i(656803);let A=new w.LruMap(128);async function T(e,a){let r,{account:n=e.account,assertChainId:w=!0,chain:T=e.chain,accessList:E,authorizationList:b,blobs:S,data:k,dataSuffix:_="string"==typeof e.dataSuffix?e.dataSuffix:e.dataSuffix?.value,gas:I,gasPrice:x,maxFeePerBlobGas:P,maxFeePerGas:U,maxPriorityFeePerGas:R,nonce:M,pollingInterval:W,throwOnReceiptRevert:D,type:N,value:q,...O}=a,F=a.timeout??Math.max((T?.blockTime??0)*3,5e3);if(void 0===n)throw new s.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransactionSync"});let B=n?(0,i.parseAccount)(n):null;try{(0,m.assertRequest)(a);let n=await (async()=>a.to?a.to:null!==a.to&&b&&b.length>0?await (0,l.recoverAuthorizationAddress)({authorization:b[0]}).catch(()=>{throw new o.BaseError("`to` is required. Could not infer from `authorizationList`.")}):void 0)();if(B?.type==="json-rpc"||null===B){let a;null!==T&&(a=await (0,t.getAction)(e,y.getChainId,"getChainId")({}),w&&(0,d.assertCurrentChain)({currentChainId:a,chain:T}));let r=e.chain?.formatters?.transactionRequest?.format,i=(r||f.formatTransactionRequest)({...(0,h.extract)(O,{format:r}),accessList:E,account:B,authorizationList:b,blobs:S,chainId:a,data:_?(0,u.concat)([k??"0x",_]):k,gas:I,gasPrice:x,maxFeePerBlobGas:P,maxFeePerGas:U,maxPriorityFeePerGas:R,nonce:M,to:n,type:N,value:q},"sendTransaction"),s=A.get(e.uid),o=s?"wallet_sendTransaction":"eth_sendTransaction",l=await (async()=>{try{return await e.request({method:o,params:[i]},{retryCount:0})}catch(t){if(!1===s)throw t;if("InvalidInputRpcError"===t.name||"InvalidParamsRpcError"===t.name||"MethodNotFoundRpcError"===t.name||"MethodNotSupportedRpcError"===t.name)return await e.request({method:"wallet_sendTransaction",params:[i]},{retryCount:0}).then(t=>(A.set(e.uid,!0),t)).catch(a=>{if("MethodNotFoundRpcError"===a.name||"MethodNotSupportedRpcError"===a.name)throw A.set(e.uid,!1),t;throw a});throw t}})(),p=await (0,t.getAction)(e,g.waitForTransactionReceipt,"waitForTransactionReceipt")({checkReplacement:!1,hash:l,pollingInterval:W,timeout:F});if(D&&"reverted"===p.status)throw new c.TransactionReceiptRevertedError({receipt:p});return p}if(B?.type==="local"){if(B.nonceManager&&void 0===M){let a=O.chainId,n=await (async()=>"number"==typeof a?a:T?T.id:(0,t.getAction)(e,y.getChainId,"getChainId")({}))();r={address:B.address,chainId:n}}let i=await (0,t.getAction)(e,v.prepareTransactionRequest,"prepareTransactionRequest")({account:B,accessList:E,authorizationList:b,blobs:S,chain:T,data:_?(0,u.concat)([k??"0x",_]):k,gas:I,gasPrice:x,maxFeePerBlobGas:P,maxFeePerGas:U,maxPriorityFeePerGas:R,nonce:M,nonceManager:B.nonceManager,parameters:[...v.defaultParameters,"sidecars"],type:N,value:q,...O,to:n}),s=T?.serializers?.transaction,o=await B.signTransaction(i,{seri
13alizer:s});return await (0,t.getAction)(e,C.sendRawTransactionSync,"sendRawTransactionSync")({serializedTransaction:o,throwOnReceiptRevert:D,timeout:a.timeout})}if(B?.type==="smart")throw new s.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"});throw new s.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransactionSync",type:B?.type})}catch(e){if(e instanceof s.AccountTypeNotSupportedError)throw e;throw!r||e instanceof c.TransactionReceiptRevertedError||B?.nonceManager?.reset(r),(0,p.getTransactionError)(e,{...a,account:B,chain:a.chain||void 0})}}async function E(e,t){let{id:a}=t;await e.request({method:"wallet_showCallsStatus",params:[a]})}e.s(["sendTransactionSync",0,T],236718),e.s(["showCallsStatus",0,E],762980);var b=e.i(919079);async function S(e,t){let{account:a=e.account}=t;if(!a)throw new s.AccountNotFoundError({docsPath:"/docs/eip7702/signAuthorization"});let r=(0,i.parseAccount)(a);if(!r.signAuthorization)throw new s.AccountTypeNotSupportedError({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:r.type});let n=await (0,b.prepareAuthorization)(e,t);return r.signAuthorization(n)}e.s(["signAuthorization",0,S],345578);var k=e.i(544316);async function _(e,{account:t=e.account,message:a}){if(!t)throw new s.AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});let r=(0,i.parseAccount)(t);if(r.signMessage)return r.signMessage({message:a});let n="string"==typeof a?(0,k.stringToHex)(a):a.raw instanceof Uint8Array?(0,k.toHex)(a.raw):a.raw;return e.request({method:"personal_sign",params:[n,r.address]},{retryCount:0})}e.s(["signMessage",0,_],487837);var I=e.i(975599);async function x(e,t){let{account:a=e.account,domain:r,message:n,primaryType:o}=t;if(!a)throw new s.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});let c=(0,i.parseAccount)(a),l={EIP712Domain:(0,I.getTypesForEIP712Domain)({domain:r}),...t.types};if((0,I.validateTypedData)({domain:r,message:n,primaryType:o,types:l}),c.signTypedData)return c.signTypedData({domain:r,message:n,primaryType:o,types:l});let d=(0,I.serializeTypedData)({domain:r,message:n,primaryType:o,types:l});return e.request({method:"eth_signTypedData_v4",params:[c.address,d]},{retryCount:0})}async function P(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,k.numberToHex)(t)}]},{retryCount:0})}async function U(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}e.s(["signTypedData",0,x],669386),e.s(["switchChain",0,P],431435),e.s(["watchAsset",0,U],31602);var R=e.i(293585);async function M(e,t){return R.writeContract.internal(e,T,"sendTransactionSync",t)}e.s(["writeContractSync",0,M],818115)},382920,e=>{"use strict";var t=e.i(866882),a=e.i(666864),r=e.i(87757),n=e.i(632034),i=e.i(559982),s=e.i(276860),o=e.i(715993),c=e.i(604794),l=e.i(919079),d=e.i(247320),u=e.i(309136),p=e.i(263122),h=e.i(100620),f=e.i(338975),w=e.i(372078),m=e.i(656803),y=e.i(21701),g=e.i(236718),v=e.i(762980),C=e.i(345578),A=e.i(487837),T=e.i(590935),E=e.i(669386),b=e.i(431435),S=e.i(610213),k=e.i(31602),_=e.i(293585),I=e.i(818115);e.s(["walletActions",0,function(e){return{addChain:t=>(0,r.addChain)(e,t),deployContract:t=>(0,n.deployContract)(e,t),fillTransaction:a=>(0,t.fillTransaction)(e,a),getAddresses:()=>(0,i.getAddresses)(e),getCallsStatus:t=>(0,s.getCallsStatus)(e,t),getCapabilities:t=>(0,o.getCapabilities)(e,t),getChainId:()=>(0,a.getChainId)(e),getPermissions:()=>(0,c.getPermissions)(e),prepareAuthorization:t=>(0,l.prepareAuthorization)(e,t),prepareTransactionRequest:t=>(0,d.prepareTransactionRequest)(e,t),requestAddresses:()=>(0,u.requestAddresses)(e),requestPermissions:t=>(0,p.requestPermissions)(e,t),sendCalls:t=>(0,h.sendCalls)(e,t),sendCallsSync:t=>(0,f.sendCallsSync)(e,t),sendRawTransaction:t=>(0,w.sendRawTransaction)(e,t),sendRawTransactionSync:t=>(0,m.sendRawTransactionSync)(e,t),sendTransaction:t=>(0,y.sendTransaction)(e,t),sendTransactionSync:t=>(0,g.sendTransactionSync)(e,t),showCallsStatus:t=>(0,v.showCallsStatus)(e,t),signAuthorization:t=>(0,C.signAuthorization)(e,t),signMessage:t=>(0,A.signMessage)(e,t),signTransaction:t=>(0,T.signTransaction)(e,t),signTypedData:t=>(0,E.signTypedData)(e,t),switchChain:t=>(0,b.switchChain)(e,t),waitForCallsStatus:t=>(0,S.waitForCallsStatus)(e,t),watchAsset:t=>(0,k.watchAsset)(e,t),writeContract:t=>(0,_.writeContract)(e,t),writeContractSync:t=>(0,I.writeContractSync)(e,t)}}])},261389,896229,e=>{"use strict";var t=e.i(612880),a=e.i(382920);e.s(["createWalletClient",0,function(e){let{key:r="wallet",name:n="Wallet Client",transport:i}=e;return(0,t.createClient)({...e,key:r,name:n,transport:i,type:"walletClient"}).extend(a.walletActions)}],261389);var r=e.i(978629),n=e.i(544316);e.s(["parseSignature",0,function(e){let{r:t,s:a}=r.secp256k1.Signature.fromCompact(e.slice(2,130)),i=Number(`0x${e.slice(130)}`),[s,o]=(()=>
13{if(0===i||1===i)return[void 0,i];if(27===i)return[BigInt(i),0];if(28===i)return[BigInt(i),1];throw Error("Invalid yParityOrV value")})();return void 0!==s?{r:(0,n.numberToHex)(t,{size:32}),s:(0,n.numberToHex)(a,{size:32}),v:s,yParity:o}:{r:(0,n.numberToHex)(t,{size:32}),s:(0,n.numberToHex)(a,{size:32}),yParity:o}}],896229)},57159,866797,431254,414639,e=>{"use strict";var t=e.i(363625),a=e.i(818249),r=e.i(975948),n=e.i(675107);async function i(e,{chain:t}){let{id:a,name:r,nativeCurrency:s,rpcUrls:o,blockExplorers:c}=t;await e.request({method:"wallet_addEthereumChain",params:[{chainId:(0,n.numberToHex)(a),chainName:r,nativeCurrency:s,rpcUrls:o.default.http,blockExplorerUrls:c?Object.values(c).map(({url:e})=>e):void 0}]},{dedupe:!0,retryCount:0})}var s=e.i(289169),o=e.i(888794),c=e.i(823838);async function l(e){return e.account?.type==="local"?[e.account.address]:(await e.request({method:"eth_accounts"},{dedupe:!0})).map(e=>(0,c.checksumAddress)(e))}var d=e.i(509916),u=e.i(189991);async function p(e,t={}){let{account:a=e.account,chainId:r}=t,i=a?(0,u.parseAccount)(a):void 0,s=r?[i?.address,[(0,n.numberToHex)(r)]]:[i?.address],o=await e.request({method:"wallet_getCapabilities",params:s}),c={};for(let[e,t]of Object.entries(o))for(let[a,r]of(c[Number(e)]={},Object.entries(t)))"addSubAccount"===a&&(a="unstable_addSubAccount"),c[Number(e)][a]=r;return"number"==typeof r?c[r]:c}async function h(e){return await e.request({method:"wallet_getPermissions"},{dedupe:!0})}var f=e.i(829897),w=e.i(368941);async function m(e){return(await e.request({method:"eth_requestAccounts"},{dedupe:!0,retryCount:0})).map(e=>(0,c.getAddress)(e))}async function y(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}var g=e.i(460841),v=e.i(467125),C=e.i(763448);async function A(e,t){let{chain:a=e.chain}=t,r=t.timeout??Math.max((a?.blockTime??0)*3,5e3),n=await (0,v.getAction)(e,g.sendCalls,"sendCalls")(t);return await (0,v.getAction)(e,C.waitForCallsStatus,"waitForCallsStatus")({...t,id:n.id,timeout:r})}var T=e.i(638291),E=e.i(738977),b=e.i(611573),S=e.i(569934),k=e.i(393702),_=e.i(290392),I=e.i(942305),x=e.i(147526),P=e.i(10725),U=e.i(264404),R=e.i(190521),M=e.i(976677),W=e.i(353464),D=e.i(948789);let N=new M.LruMap(128);async function q(e,t){let a,{account:n=e.account,assertChainId:i=!0,chain:s=e.chain,accessList:o,authorizationList:c,blobs:l,data:d,dataSuffix:p="string"==typeof e.dataSuffix?e.dataSuffix:e.dataSuffix?.value,gas:h,gasPrice:f,maxFeePerBlobGas:m,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:C,pollingInterval:A,throwOnReceiptRevert:T,type:M,value:q,...O}=t,F=t.timeout??Math.max((s?.blockTime??0)*3,5e3);if(void 0===n)throw new b.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransactionSync"});let B=n?(0,u.parseAccount)(n):null;try{(0,W.assertRequest)(t);let n=await (async()=>t.to?t.to:null!==t.to&&c&&c.length>0?await (0,_.recoverAuthorizationAddress)({authorization:c[0]}).catch(()=>{throw new S.BaseError("`to` is required. Could not infer from `authorizationList`.")}):void 0)();if(B?.type==="json-rpc"||null===B){let t;null!==s&&(t=await (0,v.getAction)(e,r.getChainId,"getChainId")({}),i&&(0,I.assertCurrentChain)({currentChainId:t,chain:s}));let a=e.chain?.formatters?.transactionRequest?.format,u=(a||R.formatTransactionRequest)({...(0,U.extract)(O,{format:a}),accessList:o,account:B,authorizationList:c,blobs:l,chainId:t,data:p?(0,x.concat)([d??"0x",p]):d,gas:h,gasPrice:f,maxFeePerBlobGas:m,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:C,to:n,type:M,value:q},"sendTransaction"),w=N.get(e.uid),E=w?"wallet_sendTransaction":"eth_sendTransaction",b=await (async()=>{try{return await e.request({method:E,params:[u]},{retryCount:0})}catch(t){if(!1===w)throw t;if("InvalidInputRpcError"===t.name||"InvalidParamsRpcError"===t.name||"MethodNotFoundRpcError"===t.name||"MethodNotSupportedRpcError"===t.name)return await e.request({method:"wallet_sendTransaction",params:[u]},{retryCount:0}).then(t=>(N.set(e.uid,!0),t)).catch(a=>{if("MethodNotFoundRpcError"===a.name||"MethodNotSupportedRpcError"===a.name)throw N.set(e.uid,!1),t;throw a});throw t}})(),S=await (0,v.getAction)(e,D.waitForTransactionReceipt,"waitForTransactionReceipt")({checkReplacement:!1,hash:b,pollingInterval:A,timeout:F});if(T&&"reverted"===S.status)throw new k.TransactionReceiptRevertedError({receipt:S});return S}if(B?.type==="local"){if(B.nonceManager&&void 0===C){let t=O.chainId,n=await (async()=>"number"==typeof t?t:s?s.id:(0,v.getAction)(e,r.getChainId,"getChainId")({}))();a={address:B.address,chainId:n}}let i=await (0,v.getAction)(e,w.prepareTransactionRequest,"prepareTransactionRequest")({account:B,accessList:o,authorizationList:c,blobs:l,chain:s,data:p?(0,x.concat)([d??"0x",p]):d,gas:h,gasPrice:f,maxFeePerBlobGas:m,maxFeePerGas:y,maxPriorityFeePerGas:g,nonce:C,nonceManager:B.nonceManager,parameters:[...w.defaultParameters,"sidecars"],type:M,value:q,...O,to:n}),u=s?.serializers?.transaction,A=await B.signTransaction(i,{seri
13alizer:u});return await (0,v.getAction)(e,E.sendRawTransactionSync,"sendRawTransactionSync")({serializedTransaction:A,throwOnReceiptRevert:T,timeout:t.timeout})}if(B?.type==="smart")throw new b.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"});throw new b.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransactionSync",type:B?.type})}catch(e){if(e instanceof b.AccountTypeNotSupportedError)throw e;throw!a||e instanceof k.TransactionReceiptRevertedError||B?.nonceManager?.reset(a),(0,P.getTransactionError)(e,{...t,account:B,chain:t.chain||void 0})}}async function O(e,t){let{id:a}=t;await e.request({method:"wallet_showCallsStatus",params:[a]})}async function F(e,t){let{account:a=e.account}=t;if(!a)throw new b.AccountNotFoundError({docsPath:"/docs/eip7702/signAuthorization"});let r=(0,u.parseAccount)(a);if(!r.signAuthorization)throw new b.AccountTypeNotSupportedError({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:r.type});let n=await (0,f.prepareAuthorization)(e,t);return r.signAuthorization(n)}async function B(e,{account:t=e.account,message:a}){if(!t)throw new b.AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});let r=(0,u.parseAccount)(t);if(r.signMessage)return r.signMessage({message:a});let i="string"==typeof a?(0,n.stringToHex)(a):a.raw instanceof Uint8Array?(0,n.toHex)(a.raw):a.raw;return e.request({method:"personal_sign",params:[i,r.address]},{retryCount:0})}async function z(e,t){let{account:a=e.account,chain:i=e.chain,...s}=t;if(!a)throw new b.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});let o=(0,u.parseAccount)(a);(0,W.assertRequest)({account:o,...t});let c=await (0,v.getAction)(e,r.getChainId,"getChainId")({});null!==i&&(0,I.assertCurrentChain)({currentChainId:c,chain:i});let l=i?.formatters||e.chain?.formatters,d=l?.transactionRequest?.format||R.formatTransactionRequest;return o.signTransaction?o.signTransaction({...s,account:o,chainId:c},{serializer:e.chain?.serializers?.transaction}):await e.request({method:"eth_signTransaction",params:[{...d({...s,account:o},"signTransaction"),chainId:(0,n.numberToHex)(c),from:o.address}]},{retryCount:0})}e.s(["signTransaction",0,z],866797);var L=e.i(643506);async function j(e,t){let{account:a=e.account,domain:r,message:n,primaryType:i}=t;if(!a)throw new b.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});let s=(0,u.parseAccount)(a),o={EIP712Domain:(0,L.getTypesForEIP712Domain)({domain:r}),...t.types};if((0,L.validateTypedData)({domain:r,message:n,primaryType:i,types:o}),s.signTypedData)return s.signTypedData({domain:r,message:n,primaryType:i,types:o});let c=(0,L.serializeTypedData)({domain:r,message:n,primaryType:i,types:o});return e.request({method:"eth_signTypedData_v4",params:[s.address,c]},{retryCount:0})}async function H(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,n.numberToHex)(t)}]},{retryCount:0})}async function $(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}e.s(["signTypedData",0,j],431254);var K=e.i(938630);async function V(e,t){return K.writeContract.internal(e,q,"sendTransactionSync",t)}function J(e){return{addChain:t=>i(e,t),deployContract:t=>(function(e,t){let{abi:a,args:r,bytecode:n,...i}=t,c=(0,s.encodeDeployData)({abi:a,args:r,bytecode:n});return(0,o.sendTransaction)(e,{...i,...i.authorizationList?{to:null}:{},data:c})})(e,t),fillTransaction:t=>(0,a.fillTransaction)(e,t),getAddresses:()=>l(e),getCallsStatus:t=>(0,d.getCallsStatus)(e,t),getCapabilities:t=>p(e,t),getChainId:()=>(0,r.getChainId)(e),getPermissions:()=>h(e),prepareAuthorization:t=>(0,f.prepareAuthorization)(e,t),prepareTransactionRequest:t=>(0,w.prepareTransactionRequest)(e,t),requestAddresses:()=>m(e),requestPermissions:t=>y(e,t),sendCalls:t=>(0,g.sendCalls)(e,t),sendCallsSync:t=>A(e,t),sendRawTransaction:t=>(0,T.sendRawTransaction)(e,t),sendRawTransactionSync:t=>(0,E.sendRawTransactionSync)(e,t),sendTransaction:t=>(0,o.sendTransaction)(e,t),sendTransactionSync:t=>q(e,t),showCallsStatus:t=>O(e,t),signAuthorization:t=>F(e,t),signMessage:t=>B(e,t),signTransaction:t=>z(e,t),signTypedData:t=>j(e,t),switchChain:t=>H(e,t),waitForCallsStatus:t=>(0,C.waitForCallsStatus)(e,t),watchAsset:t=>$(e,t),writeContract:t=>(0,K.writeContract)(e,t),writeContractSync:t=>V(e,t)}}e.s(["walletActions",0,J],414639),e.s(["createWalletClient",0,function(e){let{key:a="wallet",name:r="Wallet Client",transport:n}=e;
13return(0,t.createClient)({...e,key:a,name:r,transport:n,type:"walletClient"}).extend(J)}],57159)},57716,e=>{"use strict";e.s(["constructURL",0,({origin:e,path:t,query:a={},hash:r={}})=>{let n=new URL(t,e.endsWith("/")?e:`${e}/`);for(let[e,t]of Object.entries(a))void 0!==t&&n.searchParams.set(e,t);let i=Object.entries(r);if(i.length>0){let e=new URLSearchParams;for(let[t,a]of i)void 0!==a&&e.append(t,a);n.hash=e.toString()}return n.href}])},142700,e=>{"use strict";e.s(["MoonpayApiError",0,class extends Error{constructor({error:e,code:t,response:a}){super(e),this.code=t,this.error=e,this.response=a}},"PrivyApiError",0,class extends Error{constructor({error:e,code:t,status:a}){super(e),this.name="PrivyApiError",this.error=e,this.code=t,this.status=a}},"PrivyClientError",0,class extends Error{constructor({error:e,code:t}){super(e),this.code=t,this.error=e}}])},733821,(e,t,a)=>{"use strict";t.exports=function e(t){if("number"==typeof t&&isNaN(t))throw Error("NaN is not allowed");if("number"==typeof t&&!isFinite(t))throw Error("Infinity is not allowed");if(null===t||"object"!=typeof t)return JSON.stringify(t);if(t.toJSON instanceof Function)return e(t.toJSON());if(Array.isArray(t)){let a=t.reduce((t,a,r)=>`${t}${0===r?"":","}${e(void 0===a||"symbol"==typeof a?null:a)}`,"");return`[${a}]`}let a=Object.keys(t).sort().reduce((a,r)=>{if(void 0===t[r]||"symbol"==typeof t[r])return a;let n=0===a.length?"":",";return`${a}${n}${e(r)}:${e(t[r])}`},"");return`{${a}}`}},991914,e=>{"use strict";var t=e.i(166953);let a=new TextEncoder,r=new TextDecoder;e.s(["encoding",0,{utf8:{fromBytes:e=>r.decode(e),toBytes:e=>Uint8Array.from(a.encode(e))},base64:{fromBytes:e=>t.base64.encode(e),toBytes:e=>{try{return Uint8Array.from(t.base64.decode(e))}catch(a){if(a instanceof Error&&a.message.includes("string should have whole number of bytes"))return Uint8Array.from(t.base64nopad.decode(e));throw a}}},base64url:{fromBytes:e=>t.base64url.encode(e),toBytes:e=>Uint8Array.from(t.base64url.decode(e))},hex:{fromBytes:e=>t.hex.encode(e),toBytes:e=>Uint8Array.from(t.hex.decode(e))}}],991914)},962063,472690,887346,e=>{"use strict";var t=e.i(944406),a=e.i(733821),r=e.i(991914),n=e.i(142700);async function i(e,t){let i;if(t instanceof Uint8Array)i=r.encoding.base64.fromBytes(t);else{let e=(0,a.default)(t);if(void 0===e)throw new n.PrivyClientError({error:"Failed to prepare the payload for signing",code:"invalid_input"});i=r.encoding.base64.fromBytes(r.encoding.utf8.toBytes(e))}let{signature:s}=await e({message:i});return{signature:s}}e.s(["generateAuthorizationSignature",0,i],472690);let s="privy-request-expiry";async function o(e,a,{wallet_id:r,...n}){let c=e.getCompiledPath(t.WalletRpc,{params:{wallet_id:r}}),l=String(Date.now()+18e5),d={version:1,url:c,method:t.WalletRpc.method,headers:{"privy-app-id":e.app.appId,[s]:l},body:{...n}},{signature:u}=await i(a,d);return await e.fetchPrivyRoute(t.WalletRpc,{body:n,params:{wallet_id:r},headers:{"privy-authorization-signature":u,[s]:l}})}e.s(["rpc",0,o],962063);var c=e.i(271645),l=e.i(283291),d=e.i(951186);e.s(["u",0,()=>{let{walletProxy:e,initializeWalletProxy:t,client:a}=(0,d.u)();return(0,c.useMemo)(()=>({signWithUserSigner:async({message:r,targetAppId:n})=>{let i=e??await t(l.W);if(!i)throw Error("Wallet proxy not initialized");let s=await a.getAccessToken();if(!s)throw Error("User must be authenticated");let{signature:o}=await i.signWithUserSigner({accessToken:s,message:r,targetAppId:n});return{signature:o}}}),[e,a])}],887346)}]); 14 15//# debugId=35941e65-0986-cc16-148e-8f134bc5e843
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.