@privy-io/react-auth 1.60.5 → 1.60.6-beta-20240418031538
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +2 -2
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var gl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Td=(e,t,r)=>(gl(e,t,"read from private field"),r?r.call(e):t.get(e)),Qi=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},vl=(e,t,r,o)=>(gl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Pd=(e,t,r)=>(gl(e,t,"access private method"),r);import{getAddress as fl}from"@ethersproject/address";import{Web3Provider as gd}from"@ethersproject/providers";import{createStore as l7}from"mipd";import{useCallback as c7,useEffect as Ir,useMemo as d7,useRef as Xn,useState as Oe}from"react";import{FetchError as N1}from"ofetch";var Ie=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Yt=class extends Ie{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},T=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Xi=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof Ie)return e;if(!(e instanceof N1))return Xe(e);if(!e.response)return new Yt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Yt(t||"ApiError",e.response.status,r||o,e,n)},Xe=e=>e instanceof Ie?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var Jr=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},St=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ea=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var mr=class extends T{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var ta="/api/v1/sessions",ra="/api/v1/sessions/logout",Sd="/api/v1/sessions/fork",oa="/api/v1/sessions/fork/recover",xd="/api/v1/siwe/init",kd="/api/v1/siwe/authenticate",_d="/api/v1/siwe/link",Ad="/api/v1/siwe/unlink",Rd="/api/v1/farcaster/init",Id="/api/v1/farcaster/authenticate",Md="/api/v1/farcaster/link",Wd="/api/v1/farcaster/status",Ld="/api/v1/farcaster/unlink",Od="/api/v1/passwordless/init",Nd="/api/v1/passwordless/authenticate",Dd="/api/v1/passwordless/link",Fd="/api/v1/passwordless/unlink",Ud="/api/v1/passwordless/update",Bd="/api/v1/passwordless_sms/init",Hd="/api/v1/passwordless_sms/link",Gd="/api/v1/passwordless_sms/unlink",Vd="/api/v1/passwordless_sms/authenticate",zd="/api/v1/oauth/init",qd="/api/v1/oauth/authenticate",$d="/api/v1/oauth/link",jd="/api/v1/oauth/unlink",Kd="/api/v1/passkeys/link/init",Yd="/api/v1/passkeys/authenticate/init",Zd="/api/v1/passkeys/link",Jd="/api/v1/passkeys/authenticate",Qd="/api/v1/passkeys/unlink";var Xd="/api/v1/mfa/passwordless_sms/init",ep="/api/v1/mfa/passwordless_sms/enroll";var tp="/api/v1/users/me/accept_terms",rp="/api/v1/analytics_events",op="/api/v1/plugins/moonpay_on_ramp/sign",np="/api/v1/custom_jwt_account/authenticate";var Jo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(np,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){throw new Error("Unimplemented")}};var Qr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Nd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Dd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(Od,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},na=class extends Qr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ud,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as H1,isIOS as G1}from"react-device-detect";var Cl=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},ia=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function wl(){try{let e="privy:__session_storage__test",t="blobby",r=new ia;return r.put(e,t),r.del(e),!0}catch{return!1}}function D1(){return typeof window<"u"&&window.localStorage?new ia:new Cl}var j=D1();import{StaticJsonRpcProvider as en}from"@ethersproject/providers";function ip(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var aa=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var bl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||aa(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!bl(r))return!1}return!0},Xr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ap=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var sp="1.60.5";var El="4df5e2316331463a9130964bd6078dfa",Tl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",lp="34357d3c125c2bcf2ce2bc3309d98715",sa="https://auth.privy.io",cp=2e4,Me=1400,dp=2500,Pl=sp;var Eo="privy:token",Sl="privy-token",la="privy:refresh_token",xl="privy-refresh-token",ca="privy-session",oi="privy:session_transfer_token",U1="privy:wallet",ni="privy:caid",To="privy:state_code",Qo="privy:code_verifier",Po="privy:headless_oauth",da=e=>`${U1}:${e}`,kl="privy:connectors",_l="privy:connections";var So=12e4,Or=1,Al="0x1",Xo=3e4,pp="https://api.moonpay.com/v1",up="https://api.moonpay.com/v1",mp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",fp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",hp="0x420000000000000000000000000000000000000F",yp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var gp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},pa=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),vp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},eo=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},Rl=e=>new Promise(t=>setTimeout(t,e));function Cp(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var wp=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await Rl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},ua=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var bp=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),xo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ep(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of ip()){let u=aa(c);if(!l.some(h=>h.info.name===u)){if(bl(c,!0)&&!s.find(h=>h.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(h=>h.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(h=>h.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(h=>h.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}a(s)}})}function tn(e){return`eip155:${String(Number(e))}`}var ma=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+El:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+Tl:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},Tp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new J(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Nr=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new en(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new en(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new en({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new en(a.rpcUrls.infura.http[0]+"/"+El):a.rpcUrls.blast?.http[0]?i=new en(a.rpcUrls.blast.http[0]+"/"+Tl):i=new en(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},fa=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var ha=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ya))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ya={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function B1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Pp(e,t){let r=B1(t);if(r.deepLink)return Ap(r.deepLink,e);if(r.universalLink)return Rp(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var Sp="WALLETCONNECT_DEEPLINK_CHOICE";function xp(){try{localStorage.removeItem(Sp)}catch{}}function kp({href:e,name:t}){try{localStorage.setItem(Sp,JSON.stringify({href:e,name:t}))}catch{}}function _p(e){return e.startsWith("http://")||e.startsWith("https://")}function Ap(e,t){if(_p(e))return Rp(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Rp(e,t){if(!_p(e))return Ap(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ga(e,t){window.open(e,t,"noreferrer noopener")}var Fe=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var ii=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Fe(this._startChannelOnce.bind(this)),this.pollForReady=new Fe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Id,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(Md,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw pe(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Rd,{token:this.captchaToken});H1&&!G1&&t.connect_uri&&ga(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(Wd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as Wp}from"jose";async function Ip(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Mp(e){return crypto.getRandomValues(new Uint8Array(e))}function va(){return!!j.get(Po)}var V1="S256",z1="S256",fr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:va();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(qd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),this.meta.headless&&j.del(Po),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=pe(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post($d,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),r}catch(r){throw pe(r)}}createCodeVerifier(){return Wp.encode(Mp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=V1){if(r==z1){let o=await Ip(t);return Wp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Qo,t);let r=this.createStateCode();j.put(To,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(Po,!0);try{return await this.api.post(zd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw pe(n)}}};function Il(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Lp(e,t){let r={detail:"",retryable:!1},o=Il(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function ai(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:va()}}function si(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),j.del(To),window.history.replaceState({},"",e)}var ko=class{constructor(t){this.initAuthenticateOnce=new Fe(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Fe(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Jd,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Zd,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async _initAuthenticateOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Yd,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Kd,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var _o=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
var gl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Td=(e,t,r)=>(gl(e,t,"read from private field"),r?r.call(e):t.get(e)),Qi=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},vl=(e,t,r,o)=>(gl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Pd=(e,t,r)=>(gl(e,t,"access private method"),r);import{getAddress as fl}from"@ethersproject/address";import{Web3Provider as gd}from"@ethersproject/providers";import{createStore as l7}from"mipd";import{useCallback as c7,useEffect as Ir,useMemo as d7,useRef as Xn,useState as Oe}from"react";import{FetchError as N1}from"ofetch";var Ie=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},Yt=class extends Ie{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},T=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Xi=class extends T{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends Ie{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof Ie)return e;if(!(e instanceof N1))return Xe(e);if(!e.response)return new Yt("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Yt(t||"ApiError",e.response.status,r||o,e,n)},Xe=e=>e instanceof Ie?e:e instanceof Error?new T(e.message,e):new T(`Internal error: ${e}`);var Jr=class extends T{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},St=class extends T{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ea=class extends T{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var mr=class extends T{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var ta="/api/v1/sessions",ra="/api/v1/sessions/logout",Sd="/api/v1/sessions/fork",oa="/api/v1/sessions/fork/recover",xd="/api/v1/siwe/init",kd="/api/v1/siwe/authenticate",_d="/api/v1/siwe/link",Ad="/api/v1/siwe/unlink",Rd="/api/v1/farcaster/init",Id="/api/v1/farcaster/authenticate",Md="/api/v1/farcaster/link",Wd="/api/v1/farcaster/status",Ld="/api/v1/farcaster/unlink",Od="/api/v1/passwordless/init",Nd="/api/v1/passwordless/authenticate",Dd="/api/v1/passwordless/link",Fd="/api/v1/passwordless/unlink",Ud="/api/v1/passwordless/update",Bd="/api/v1/passwordless_sms/init",Hd="/api/v1/passwordless_sms/link",Gd="/api/v1/passwordless_sms/unlink",Vd="/api/v1/passwordless_sms/authenticate",zd="/api/v1/oauth/init",qd="/api/v1/oauth/authenticate",$d="/api/v1/oauth/link",jd="/api/v1/oauth/unlink",Kd="/api/v1/passkeys/link/init",Yd="/api/v1/passkeys/authenticate/init",Zd="/api/v1/passkeys/link",Jd="/api/v1/passkeys/authenticate",Qd="/api/v1/passkeys/unlink";var Xd="/api/v1/mfa/passwordless_sms/init",ep="/api/v1/mfa/passwordless_sms/enroll";var tp="/api/v1/users/me/accept_terms",rp="/api/v1/analytics_events",op="/api/v1/plugins/moonpay_on_ramp/sign",np="/api/v1/custom_jwt_account/authenticate";var Jo=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");try{let t=await this.api.post(np,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){throw new Error("Unimplemented")}};var Qr=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Nd,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new T("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Dd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new T("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new T("Email must be set when initialzing authentication.");try{return await this.api.post(Od,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},na=class extends Qr{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new T("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ud,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as H1,isIOS as G1}from"react-device-detect";var Cl=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},ia=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function wl(){try{let e="privy:__session_storage__test",t="blobby",r=new ia;return r.put(e,t),r.del(e),!0}catch{return!1}}function D1(){return typeof window<"u"&&window.localStorage?new ia:new Cl}var j=D1();import{StaticJsonRpcProvider as en}from"@ethersproject/providers";function ip(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var aa=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var bl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||aa(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!bl(r))return!1}return!0},Xr=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),ap=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var sp="1.60.6-beta-20240418031538";var El="4df5e2316331463a9130964bd6078dfa",Tl="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",lp="34357d3c125c2bcf2ce2bc3309d98715",sa="https://auth.privy.io",cp=2e4,Me=1400,dp=2500,Pl=sp;var Eo="privy:token",Sl="privy-token",la="privy:refresh_token",xl="privy-refresh-token",ca="privy-session",oi="privy:session_transfer_token",U1="privy:wallet",ni="privy:caid",To="privy:state_code",Qo="privy:code_verifier",Po="privy:headless_oauth",da=e=>`${U1}:${e}`,kl="privy:connectors",_l="privy:connections";var So=12e4,Or=1,Al="0x1",Xo=3e4,pp="https://api.moonpay.com/v1",up="https://api.moonpay.com/v1",mp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",fp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",hp="0x420000000000000000000000000000000000000F",yp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var gp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},pa=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),vp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},eo=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},Rl=e=>new Promise(t=>setTimeout(t,e));function Cp(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var wp=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await Rl(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},ua=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var bp=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),xo=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Ep(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of ip()){let u=aa(c);if(!l.some(h=>h.info.name===u)){if(bl(c,!0)&&!s.find(h=>h.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(h=>h.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(h=>h.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(h=>h.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}a(s)}})}function tn(e){return`eip155:${String(Number(e))}`}var ma=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+El:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+Tl:i=a.rpcUrls.default?.http[0];if(!i)throw new J(`No RPC url found for ${e}`);return i},Tp=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new J(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Nr=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new J(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new en(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new en(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new en({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new en(a.rpcUrls.infura.http[0]+"/"+El):a.rpcUrls.blast?.http[0]?i=new en(a.rpcUrls.blast.http[0]+"/"+Tl):i=new en(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},fa=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var ha=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(ya))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var ya={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function B1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function Pp(e,t){let r=B1(t);if(r.deepLink)return Ap(r.deepLink,e);if(r.universalLink)return Rp(r.universalLink,e);throw new T(`Unsupported wallet ${t.id}`)}var Sp="WALLETCONNECT_DEEPLINK_CHOICE";function xp(){try{localStorage.removeItem(Sp)}catch{}}function kp({href:e,name:t}){try{localStorage.setItem(Sp,JSON.stringify({href:e,name:t}))}catch{}}function _p(e){return e.startsWith("http://")||e.startsWith("https://")}function Ap(e,t){if(_p(e))return Rp(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function Rp(e,t){if(!_p(e))return Ap(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ga(e,t){window.open(e,t,"noreferrer noopener")}var Fe=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var ii=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new Fe(this._startChannelOnce.bind(this)),this.pollForReady=new Fe(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");try{let t=await this.api.post(Id,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new T("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw pe(t)}}async link(){if(!this.api)throw new T("Auth flow has no API instance");try{return await this.api.post(Md,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw pe(t)}}async _startChannelOnce(){if(!this.api)throw new T("Auth flow has no API instance");let t=await this.api.post(Rd,{token:this.captchaToken});H1&&!G1&&t.connect_uri&&ga(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new T("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.channelToken)throw new T("Auth flow must be initialized first");let t=await this.api.get(Wd,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};import{base64url as Wp}from"jose";async function Ip(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function Mp(e){return crypto.getRandomValues(new Uint8Array(e))}function va(){return!!j.get(Po)}var V1="S256",z1="S256",fr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:va();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post(qd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),this.meta.headless&&j.del(Po),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=pe(r);throw o.privyErrorCode?new T(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new T("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new T("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new T("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new T("User denied confirmation during OAuth flow");let t=j.get(Qo);if(!t)throw new T("Authentication error.");try{let r=await this.api.post($d,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return j.del(Qo),r}catch(r){throw pe(r)}}createCodeVerifier(){return Wp.encode(Mp(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=V1){if(r==z1){let o=await Ip(t);return Wp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new T("Auth flow has no API instance");if(!this.meta.provider)throw new T("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();j.put(Qo,t);let r=this.createStateCode();j.put(To,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&j.put(Po,!0);try{return await this.api.post(zd,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw pe(n)}}};function Il(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Lp(e,t){let r={detail:"",retryable:!1},o=Il(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function ai(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:va()}}function si(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),j.del(To),window.history.replaceState({},"",e)}var ko=class{constructor(t){this.initAuthenticateOnce=new Fe(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new Fe(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new T("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Jd,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new T("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new T("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Zd,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new T("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):pe(r)}}async _initAuthenticateOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Yd,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new T("Auth flow has no API instance");return await this.api.post(Kd,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var _o=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
2
2
|
${r}
|
|
3
3
|
|
|
4
4
|
${l}
|
|
@@ -2295,7 +2295,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2295
2295
|
overflow: hidden;
|
|
2296
2296
|
max-width: 275px;
|
|
2297
2297
|
text-overflow: ellipsis;
|
|
2298
|
-
`;import{VoidSigner as A5}from"@ethersproject/abstract-signer";import{EtherscanProvider as iH}from"@ethersproject/providers";import{BigNumber as Ey}from"@ethersproject/bignumber";import{BigNumber as $n}from"@ethersproject/bignumber";import{Contract as P5}from"@ethersproject/contracts";import{serialize as S5}from"@ethersproject/transactions";var jn=e=>[Wa.id,La.id,Oa.id,Na.id,Da.id,Fa.id,Ua.id,Ha.id,Ba.id].includes(e),Cy=async(e,t)=>{if(!jn(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let a=$n.from(r).mul($n.from(126)).div($n.from(100)).add($n.from(e.maxPriorityFeePerGas));e.maxFeePerGas=ji(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function wy(e,t){if(!e.chainId||e.chainId&&!jn(e.chainId))return $n.from(0);let r=$n.from(0);try{let o=new P5(hp,yp,t),n=by(e),a=S5(n);r=await o.getL1Fee(a)}catch{}return r}async function Ty(e,t){try{
|
|
2298
|
+
`;import{VoidSigner as A5}from"@ethersproject/abstract-signer";import{EtherscanProvider as iH}from"@ethersproject/providers";import{BigNumber as Ey}from"@ethersproject/bignumber";import{BigNumber as $n}from"@ethersproject/bignumber";import{Contract as P5}from"@ethersproject/contracts";import{serialize as S5}from"@ethersproject/transactions";var jn=e=>[Wa.id,La.id,Oa.id,Na.id,Da.id,Fa.id,Ua.id,Ha.id,Ba.id].includes(e),Cy=async(e,t)=>{if(!jn(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let a=$n.from(r).mul($n.from(126)).div($n.from(100)).add($n.from(e.maxPriorityFeePerGas));e.maxFeePerGas=ji(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function wy(e,t){if(!e.chainId||e.chainId&&!jn(e.chainId))return $n.from(0);let r=$n.from(0);try{let o=new P5(hp,yp,t),n=by(e),a=S5(n);r=await o.getL1Fee(a)}catch{}return r}async function Ty(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var Py=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Kn(e,t){if(!e.gasLimit)throw new Re("gasLimit was not successfully set for transaction.");let r=nt(e.gasLimit),o=Ey.from(0);if(e.type==2)if(e.maxFeePerGas)o=nt(e.maxFeePerGas);else throw new Re("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=nt(e.gasPrice);else throw new Re("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=Ey.from(0);if(e.chainId&&jn(e.chainId))try{a=await wy(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}import{BigNumber as Qc}from"@ethersproject/bignumber";var Xc=e=>[Ra.id,Ia.id,Ma.id].includes(e),Sy=async(e,t)=>{if(!Xc(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul(Qc.from(120)).div(Qc.from(100));e.maxFeePerGas=ji(o),e.maxPriorityFeePerGas=ji(Qc.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var ed=e=>[56,97].includes(e),xy=async(e,t)=>{if(!ed(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};import{parseUnits as ky}from"@ethersproject/units";import{ofetch as x5}from"ofetch";var td={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var od=e=>[li.id,ci.id,td.id].includes(e),rd=e=>({maxPriorityFee:ky(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:ky(e.maxFee.toFixed(9),"gwei").toHexString()}),k5=e=>({safeLow:rd(e.safeLow),standard:rd(e.standard),fast:rd(e.fast)}),_5=async e=>{let t="";switch(e){case li.id:t="https://gasstation.polygon.technology/v2";break;case ci.id:t="https://gasstation-testnet.polygon.technology/v2";break;case td.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return k5(await x5(t))};async function _y(e){if(!od(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await _5(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function ji(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function by(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=nt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=nt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=nt(e.gasPrice)),e.value!==void 0&&(t.value=nt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=nt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=nt(e.maxPriorityFeePerGas)),t}async function Yn(e,t,r){if(t.chainId=Number(t.chainId),Ay(t),t.from||(t.from=e),!t.nonce){let o=new A5(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await Ty(t,r)),typeof t.type=="string"&&Ry(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),od(t.chainId)?t=await _y(t):Xc(t.chainId)?t=await Sy(t,r):jn(t.chainId)?t=await Cy(t,r):ed(t.chainId)?t=await xy(t,r):t=await Py(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function nl(e,t,r,o,n){o=Object.assign({chainId:Or},o),Ay(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function il(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(nt(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function Ay(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!R5(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function R5(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&Ry(e);return t||r||o}function Ry(e){return/^-?0x[a-f0-9]+$/i.test(e)}function al(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}import{useState as nd,useEffect as I5}from"react";var sl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=M(),[n,a]=nd(!0),[i,l]=nd(void 0),[s,c]=nd(void 0);return I5(()=>{let u=e.chainId||Or,h=o.find(g=>g.id===Number(u));if(!h)throw new J(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let g=await r(h);g?c(g):l(new Error(`Unable to fetch token price on chain id ${h.id}`))}catch(g){l(g)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};import{createContext as M5,useContext as W5}from"react";var id=M5(null);function Ki(){let e=W5(id);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}import{jsx as My}from"react/jsx-runtime";var ad=({pendingTransaction:e})=>{let{getAccessToken:t}=G(),{wallets:r}=Ki(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=M(),[s,c]=Iy(null),[u,h]=Iy(e),{tokenPrice:f}=sl(u),g=l(e.chainId)||"ETH",b=L5(()=>r.find(v=>v.walletClientType==="privy"),[r]);return O5(()=>{async function v(){if(!await t()||!o||!b)return u;let E=Nr(u.chainId,a,n,{appId:i}),P=await Yn(b.address,u,E),{totalGasEstimate:W}=await Kn(P,E);return c(W.toHexString()),P}v().then(h).catch(console.error)},[o]),b?My(D5,{children:My(qn,{from:b.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:g})}):null},D5=N5.div`
|
|
2299
2299
|
width: 100%;
|
|
2300
2300
|
padding: 1rem 0;
|
|
2301
2301
|
`;import{Fragment as ld,jsx as ce,jsxs as Ar}from"react/jsx-runtime";var cd=({open:e,onClose:t})=>{let{user:r}=G(),[o,n]=sd(null),{init:a,cancel:i}=Vn();V5(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(c){try{n(c),await a(c)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?ce(z5,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):Ar(ld,{children:[ce(S,{onClose:s},"header"),ce(We,{children:ce(qe,{children:ce(G5,{})})}),ce(we,{children:"Verify your identity"}),ce(fe,{children:"Choose a verification method"}),Ar(Xa,{children:[r.mfaMethods.includes("totp")&&Ar(Te,{onClick:()=>l("totp"),children:[ce(F5,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&Ar(Te,{onClick:()=>l("sms"),children:[ce(U5,{}),"SMS"]},"sms")]}),ce(K,{})]})},z5=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=_(),{pendingTransaction:n}=M(),[a,i]=sd(!1),[l,s]=sd(!1),{submit:c}=Vn();async function u(h){try{if(!h)return;await c(e,h),s(!0),i(!1),t()}catch(f){throw pc(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):An(f)?(i(!1),new Error("The code you entered is not valid")):_n(f)?(i(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(i(!1),new Error("Unknown error"))}}switch(e){case"sms":return Ar(ld,{children:[ce(S,{onClose:t},"header"),ce(We,{children:ce(qe,{children:ce(H5,{})})}),ce(we,{children:"Enter verification code"}),Ar(no,{children:[ce(Gn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code sent to your ",ce("strong",{children:"mobile device"})]}),n&&ce(ad,{pendingTransaction:n})]}),r&&ce(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ce(Xt,{onClick:t,children:"Not now"}),ce(K,{})]});case"totp":return Ar(ld,{children:[ce(S,{onClose:t},"header"),ce(We,{children:ce(qe,{children:ce(B5,{})})}),ce(we,{children:"Enter verification code"}),Ar(no,{children:[ce(Gn,{success:l,disabled:a,onChange:u}),Ar(fe,{children:["To continue, please enter the 6-digit code generated from your"," ",ce("strong",{children:"authenticator app"})]}),n&&ce(ad,{pendingTransaction:n})]}),r&&ce(Jl,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),ce(Xt,{onClick:t,children:"Not now"}),ce(K,{})]});default:return null}};import{useEffect as Wy,useState as Ly}from"react";import q5 from"styled-components";import{Fragment as j5,jsx as Rr,jsxs as ll}from"react/jsx-runtime";var Oy={google:{name:"Google",component:Hs},discord:{name:"Discord",component:Fs},github:{name:"Github",component:Us},linkedin:{name:"LinkedIn",component:Vs},twitter:{name:"Twitter",component:$s},spotify:{name:"Spotify",component:zs},tiktok:{name:"Tiktok",component:qs},apple:{name:"Apple",component:Ds}},Ny=()=>{let{authenticated:e,logout:t,ready:r,user:o}=G(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=_(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:h,setReadyToTrue:f,closePrivyModal:g,createAnalyticsEvent:b}=M(),[v,x]=Ly(!1),[E,P]=Ly(void 0),W=s()?.provider||"google",I=Oy[W].name,D=Oy[W].component,R=n?.render.inDialog?Me:0;Wy(()=>{u(W).then(()=>{x(!0),f(!0)}).catch(V=>{if(V?.privyErrorCode==="allowlist_rejected"){P(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(V?.privyErrorCode==="max_accounts_reached"){console.error(new mr(V).toString()),P(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}let{retryable:z,detail:A}=Lp(V,W);P({retryable:z,detail:A,message:"Authentication failed"}),f(!1)}).finally(()=>{si()})},[I,W]),Wy(()=>{if(r&&e&&v&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let z=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},R);return()=>clearTimeout(z)}if(Nt(o,n?.embeddedWallets?.createOnLogin)){let z=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:A=>{console.error(A),b({eventName:"embedded_wallet_creation_failure_logout",payload:{error:A,provider:W,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},R);return()=>clearTimeout(z)}else{let z=setTimeout(()=>g({shouldCallAuthOnSuccess:!0,isSuccess:!0}),R);return h(),()=>clearTimeout(z)}}},[r,e,v,o]);let B=v?`Successfully connected with ${I}`:E?E.message:`Verifying connection to ${I}`,$="";return v?$="You\u2019re good to go!":E?$=E.detail:$="Just a few moments more",ll(j5,{children:[Rr(S,{}),Rr(Z,{}),ll($5,{children:[Rr(Et,{children:ll("div",{children:[Rr(Ct,{success:v,fail:!!E}),Rr(D,{style:{width:"38px",height:"38px"}})]})}),ll(Ue,{children:[Rr("h3",{children:B}),Rr("p",{children:$})]}),E&&E?.retryable?Rr(Ya,{onClick:()=>{si(),c(W),P(void 0)},disabled:!v&&!E?.retryable,children:"Retry"}):null]}),Rr(te,{}),Rr(K,{})]})},$5=q5.div`
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var R2=Object.create;var Ba=Object.defineProperty;var I2=Object.getOwnPropertyDescriptor;var M2=Object.getOwnPropertyNames;var W2=Object.getPrototypeOf,L2=Object.prototype.hasOwnProperty;var O2=(e,t)=>{for(var r in t)Ba(e,r,{get:t[r],enumerable:!0})},op=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M2(t))!L2.call(e,n)&&n!==r&&Ba(e,n,{get:()=>t[n],enumerable:!(o=I2(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?R2(W2(e)):{},op(t||!e||!e.__esModule?Ba(r,"default",{value:e,enumerable:!0}):r,e)),N2=e=>op(Ba({},"__esModule",{value:!0}),e);var sc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var np=(e,t,r)=>(sc(e,t,"read from private field"),r?r.call(e):t.get(e)),Ha=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},lc=(e,t,r,o)=>(sc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var ip=(e,t,r)=>(sc(e,t,"access private method"),r);var b4={};O2(b4,{AsExternalProvider:()=>Rr,Captcha:()=>Bs,ConnectorManager:()=>oi,PrivyClient:()=>ni,PrivyProvider:()=>Jg,PrivyProxyProvider:()=>Ue,SUPPORTED_CHAINS:()=>ti,VERSION:()=>Ja,WalletConnector:()=>Lt,addRpcUrlOverrideToChain:()=>S2,errorIndicatesMaxMfaRetries:()=>il,errorIndicatesMfaTimeout:()=>Tn,errorIndicatesMfaVerificationFailed:()=>Pn,getAccessToken:()=>_e,useConnectWallet:()=>l2,useCreateWallet:()=>d2,useExperimentalFarcasterSigner:()=>P2,useFundWallet:()=>p2,useLinkAccount:()=>a2,useLogin:()=>Xg,useLoginWithEmail:()=>o2,useLoginWithOAuth:()=>r2,useLoginWithSms:()=>n2,useLogout:()=>t2,useMfa:()=>Mn,useMfaEnrollment:()=>Oi,useModalStatus:()=>b2,usePrivy:()=>V,useRegisterMfaListener:()=>zs,useSendTransaction:()=>m2,useSetWalletPassword:()=>h2,useSignMessage:()=>g2,useSignTypedData:()=>C2,useToken:()=>T2,useWallets:()=>Vi});module.exports=N2(b4);var Da=require("@ethersproject/address"),nc=require("@ethersproject/providers"),$g=require("mipd"),te=require("react");var ap=require("ofetch"),Ze=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},kr=class extends Ze{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},P=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ga=class extends P{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ne=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ye=e=>{if(e instanceof Ze)return e;if(!(e instanceof ap.FetchError))return Tt(e);if(!e.response)return new kr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new kr(t||"ApiError",e.response.status,r||o,e,n)},Tt=e=>e instanceof Ze?e:e instanceof Error?new P(e.message,e):new P(`Internal error: ${e}`);var Uo=class extends P{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Xt=class extends P{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Va=class extends P{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Jr=class extends P{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var za="/api/v1/sessions",qa="/api/v1/sessions/logout",sp="/api/v1/sessions/fork",$a="/api/v1/sessions/fork/recover",lp="/api/v1/siwe/init",cp="/api/v1/siwe/authenticate",dp="/api/v1/siwe/link",pp="/api/v1/siwe/unlink",up="/api/v1/farcaster/init",mp="/api/v1/farcaster/authenticate",fp="/api/v1/farcaster/link",hp="/api/v1/farcaster/status",yp="/api/v1/farcaster/unlink",gp="/api/v1/passwordless/init",vp="/api/v1/passwordless/authenticate",Cp="/api/v1/passwordless/link",wp="/api/v1/passwordless/unlink",bp="/api/v1/passwordless/update",Ep="/api/v1/passwordless_sms/init",Tp="/api/v1/passwordless_sms/link",Pp="/api/v1/passwordless_sms/unlink",Sp="/api/v1/passwordless_sms/authenticate",xp="/api/v1/oauth/init",kp="/api/v1/oauth/authenticate",_p="/api/v1/oauth/link",Ap="/api/v1/oauth/unlink",Rp="/api/v1/passkeys/link/init",Ip="/api/v1/passkeys/authenticate/init",Mp="/api/v1/passkeys/link",Wp="/api/v1/passkeys/authenticate",Lp="/api/v1/passkeys/unlink";var Op="/api/v1/mfa/passwordless_sms/init",Np="/api/v1/mfa/passwordless_sms/enroll";var Dp="/api/v1/users/me/accept_terms",Fp="/api/v1/analytics_events",Up="/api/v1/plugins/moonpay_on_ramp/sign",Bp="/api/v1/custom_jwt_account/authenticate";var Gn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");try{let t=await this.api.post(Bp,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ye(t)}}async link(){throw new Error("Unimplemented")}};var Bo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(vp,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ye(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Cp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ye(t)}}async sendCodeEmail(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new P("Email must be set when initialzing authentication.");try{return await this.api.post(gp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ye(o)}}},ja=class extends Bo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new P("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(bp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ye(r)}}};var ls=require("react-device-detect");var cc=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Ka=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function dc(){try{let e="privy:__session_storage__test",t="blobby",r=new Ka;return r.put(e,t),r.del(e),!0}catch{return!1}}function D2(){return typeof window<"u"&&window.localStorage?new Ka:new cc}var X=D2();var mn=require("@ethersproject/providers");function Hp(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var Ya=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var pc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ya(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!pc(r))return!1}return!0},Ho=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Gp=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var Vp="1.60.5";var uc="4df5e2316331463a9130964bd6078dfa",mc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",zp="34357d3c125c2bcf2ce2bc3309d98715",Za="https://auth.privy.io",qp=2e4,Qe=1400,$p=2500,Ja=Vp;var cn="privy:token",fc="privy-token",Qa="privy:refresh_token",hc="privy-refresh-token",Xa="privy-session",Zi="privy:session_transfer_token",U2="privy:wallet",Ji="privy:caid",dn="privy:state_code",Vn="privy:code_verifier",pn="privy:headless_oauth",es=e=>`${U2}:${e}`,yc="privy:connectors",gc="privy:connections";var un=12e4,vo=1,vc="0x1",zn=3e4,jp="https://api.moonpay.com/v1",Kp="https://api.moonpay.com/v1",Yp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Zp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Jp="0x420000000000000000000000000000000000000F",Qp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Xp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},ts=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),eu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Go=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},Cc=e=>new Promise(t=>setTimeout(t,e));function tu(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var ru=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await Cc(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},rs=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var ou=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),fn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function nu(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of Hp()){let u=Ya(c);if(!l.some(g=>g.info.name===u)){if(pc(c,!0)&&!s.find(g=>g.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(g=>g.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(g=>g.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(g=>g.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}a(s)}})}function qn(e){return`eip155:${String(Number(e))}`}var os=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ne(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+uc:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+mc:i=a.rpcUrls.default?.http[0];if(!i)throw new ne(`No RPC url found for ${e}`);return i},iu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ne(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Co=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ne(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new mn.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new mn.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new mn.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new mn.StaticJsonRpcProvider(a.rpcUrls.infura.http[0]+"/"+uc):a.rpcUrls.blast?.http[0]?i=new mn.StaticJsonRpcProvider(a.rpcUrls.blast.http[0]+"/"+mc):i=new mn.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new ne(`No RPC url found for ${e}`);return i},ns=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var is=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(as))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var as={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function B2(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function au(e,t){let r=B2(t);if(r.deepLink)return pu(r.deepLink,e);if(r.universalLink)return uu(r.universalLink,e);throw new P(`Unsupported wallet ${t.id}`)}var su="WALLETCONNECT_DEEPLINK_CHOICE";function lu(){try{localStorage.removeItem(su)}catch{}}function cu({href:e,name:t}){try{localStorage.setItem(su,JSON.stringify({href:e,name:t}))}catch{}}function du(e){return e.startsWith("http://")||e.startsWith("https://")}function pu(e,t){if(du(e))return uu(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function uu(e,t){if(!du(e))return pu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ss(e,t){window.open(e,t,"noreferrer noopener")}var it=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Qi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new it(this._startChannelOnce.bind(this)),this.pollForReady=new it(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");try{let t=await this.api.post(mp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new P("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ye(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{return await this.api.post(fp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ye(t)}}async _startChannelOnce(){if(!this.api)throw new P("Auth flow has no API instance");let t=await this.api.post(up,{token:this.captchaToken});ls.isMobile&&!ls.isIOS&&t.connect_uri&&ss(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new P("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");let t=await this.api.get(hp,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var wc=require("jose");async function mu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function fu(e){return crypto.getRandomValues(new Uint8Array(e))}function cs(){return!!X.get(pn)}var H2="S256",G2="S256",Qr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:cs();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=X.get(Vn);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(kp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return X.del(Vn),this.meta.headless&&X.del(pn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ye(r);throw o.privyErrorCode?new P(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new P("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new P("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=X.get(Vn);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(_p,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return X.del(Vn),r}catch(r){throw ye(r)}}createCodeVerifier(){return wc.base64url.encode(fu(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=H2){if(r==G2){let o=await mu(t);return wc.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.provider)throw new P("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();X.put(Vn,t);let r=this.createStateCode();X.put(dn,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&X.put(pn,!0);try{return await this.api.post(xp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ye(n)}}};function bc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hu(e,t){let r={detail:"",retryable:!1},o=bc(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function Xi(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:cs()}}function ea(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),X.del(dn),window.history.replaceState({},"",e)}var hn=class{constructor(t){this.initAuthenticateOnce=new it(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new it(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new P("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new P("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new P("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new P("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Wp,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new P("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ye(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new P("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new P("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Mp,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new P("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ye(r)}}async _initAuthenticateOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(Ip,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(Rp,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var yn=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
1
|
+
"use strict";var R2=Object.create;var Ba=Object.defineProperty;var I2=Object.getOwnPropertyDescriptor;var M2=Object.getOwnPropertyNames;var W2=Object.getPrototypeOf,L2=Object.prototype.hasOwnProperty;var O2=(e,t)=>{for(var r in t)Ba(e,r,{get:t[r],enumerable:!0})},op=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M2(t))!L2.call(e,n)&&n!==r&&Ba(e,n,{get:()=>t[n],enumerable:!(o=I2(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?R2(W2(e)):{},op(t||!e||!e.__esModule?Ba(r,"default",{value:e,enumerable:!0}):r,e)),N2=e=>op(Ba({},"__esModule",{value:!0}),e);var sc=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var np=(e,t,r)=>(sc(e,t,"read from private field"),r?r.call(e):t.get(e)),Ha=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},lc=(e,t,r,o)=>(sc(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var ip=(e,t,r)=>(sc(e,t,"access private method"),r);var b4={};O2(b4,{AsExternalProvider:()=>Rr,Captcha:()=>Bs,ConnectorManager:()=>oi,PrivyClient:()=>ni,PrivyProvider:()=>Jg,PrivyProxyProvider:()=>Ue,SUPPORTED_CHAINS:()=>ti,VERSION:()=>Ja,WalletConnector:()=>Lt,addRpcUrlOverrideToChain:()=>S2,errorIndicatesMaxMfaRetries:()=>il,errorIndicatesMfaTimeout:()=>Tn,errorIndicatesMfaVerificationFailed:()=>Pn,getAccessToken:()=>_e,useConnectWallet:()=>l2,useCreateWallet:()=>d2,useExperimentalFarcasterSigner:()=>P2,useFundWallet:()=>p2,useLinkAccount:()=>a2,useLogin:()=>Xg,useLoginWithEmail:()=>o2,useLoginWithOAuth:()=>r2,useLoginWithSms:()=>n2,useLogout:()=>t2,useMfa:()=>Mn,useMfaEnrollment:()=>Oi,useModalStatus:()=>b2,usePrivy:()=>V,useRegisterMfaListener:()=>zs,useSendTransaction:()=>m2,useSetWalletPassword:()=>h2,useSignMessage:()=>g2,useSignTypedData:()=>C2,useToken:()=>T2,useWallets:()=>Vi});module.exports=N2(b4);var Da=require("@ethersproject/address"),nc=require("@ethersproject/providers"),$g=require("mipd"),te=require("react");var ap=require("ofetch"),Ze=class extends Error{constructor(r,o,n){super(r);o instanceof Error&&(this.cause=o),this.privyErrorCode=n}toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}},kr=class extends Ze{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},P=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ga=class extends P{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var ne=class extends Ze{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ye=e=>{if(e instanceof Ze)return e;if(!(e instanceof ap.FetchError))return Tt(e);if(!e.response)return new kr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new kr(t||"ApiError",e.response.status,r||o,e,n)},Tt=e=>e instanceof Ze?e:e instanceof Error?new P(e.message,e):new P(`Internal error: ${e}`);var Uo=class extends P{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Xt=class extends P{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Va=class extends P{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Jr=class extends P{constructor(t){super("This application is in development mode and must be upgraded to production to log in new users.",t,"max_accounts_reached")}};var za="/api/v1/sessions",qa="/api/v1/sessions/logout",sp="/api/v1/sessions/fork",$a="/api/v1/sessions/fork/recover",lp="/api/v1/siwe/init",cp="/api/v1/siwe/authenticate",dp="/api/v1/siwe/link",pp="/api/v1/siwe/unlink",up="/api/v1/farcaster/init",mp="/api/v1/farcaster/authenticate",fp="/api/v1/farcaster/link",hp="/api/v1/farcaster/status",yp="/api/v1/farcaster/unlink",gp="/api/v1/passwordless/init",vp="/api/v1/passwordless/authenticate",Cp="/api/v1/passwordless/link",wp="/api/v1/passwordless/unlink",bp="/api/v1/passwordless/update",Ep="/api/v1/passwordless_sms/init",Tp="/api/v1/passwordless_sms/link",Pp="/api/v1/passwordless_sms/unlink",Sp="/api/v1/passwordless_sms/authenticate",xp="/api/v1/oauth/init",kp="/api/v1/oauth/authenticate",_p="/api/v1/oauth/link",Ap="/api/v1/oauth/unlink",Rp="/api/v1/passkeys/link/init",Ip="/api/v1/passkeys/authenticate/init",Mp="/api/v1/passkeys/link",Wp="/api/v1/passkeys/authenticate",Lp="/api/v1/passkeys/unlink";var Op="/api/v1/mfa/passwordless_sms/init",Np="/api/v1/mfa/passwordless_sms/enroll";var Dp="/api/v1/users/me/accept_terms",Fp="/api/v1/analytics_events",Up="/api/v1/plugins/moonpay_on_ramp/sign",Bp="/api/v1/custom_jwt_account/authenticate";var Gn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");try{let t=await this.api.post(Bp,{token:this.meta.token});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ye(t)}}async link(){throw new Error("Unimplemented")}};var Bo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(vp,{email:this.meta.email,code:this.meta.emailCode});return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ye(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new P("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Cp,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ye(t)}}async sendCodeEmail(t,r){if(!this.api)throw new P("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new P("Email must be set when initialzing authentication.");try{return await this.api.post(gp,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ye(o)}}},ja=class extends Bo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new P("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(bp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ye(r)}}};var ls=require("react-device-detect");var cc=class{constructor(){this._cache={}}get(t){return this._cache[t]}put(t,r){r!==void 0?this._cache[t]=r:this.del(t)}del(t){delete this._cache[t]}getKeys(){return Object.keys(this._cache)}},Ka=class{get(t){let r=localStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?localStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){localStorage.removeItem(t)}getKeys(){return Object.entries(localStorage).map(([t])=>t)}};function dc(){try{let e="privy:__session_storage__test",t="blobby",r=new Ka;return r.put(e,t),r.del(e),!0}catch{return!1}}function D2(){return typeof window<"u"&&window.localStorage?new Ka:new cc}var X=D2();var mn=require("@ethersproject/providers");function Hp(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let o of t.providers)o&&r.push(o);return r.push(e.ethereum),r}var Ya=e=>{if(e.isApexWallet)return"Apex Wallet";if(e.isAvalanche)return"Core Wallet";if(e.isBackpack)return"Backpack";if(e.isBifrost)return"Bifrost Wallet";if(e.isBitKeep)return"BitKeep";if(e.isBitski)return"Bitski";if(e.isBlockWallet)return"BlockWallet";if(e.isBraveWallet)return"Brave Wallet";if(e.isClover)return"Clover";if(e.isCoin98)return"Coin98 Wallet";if(e.isCoinbaseWallet)return"Coinbase Wallet";if(e.isDawn)return"Dawn Wallet";if(e.isDefiant)return"Defiant";if(e.isDesig)return"Desig Wallet";if(e.isEnkrypt)return"Enkrypt";if(e.isExodus)return"Exodus";if(e.isFordefi)return"Fordefi";if(e.isFrame)return"Frame";if(e.isFrontier)return"Frontier Wallet";if(e.isGamestop)return"GameStop Wallet";if(e.isHaqqWallet)return"HAQQ Wallet";if(e.isHyperPay)return"HyperPay Wallet";if(e.isImToken)return"ImToken";if(e.isHaloWallet)return"Halo Wallet";if(e.isKuCoinWallet)return"KuCoin Wallet";if(e.isMathWallet)return"MathWallet";if(e.isNovaWallet)return"Nova Wallet";if(e.isOkxWallet||e.isOKExWallet)return"OKX Wallet";if(e.isOneInchIOSWallet||e.isOneInchAndroidWallet)return"1inch Wallet";if(e.isOneKey)return"OneKey Wallet";if(e.isOpera)return"Opera";if(e.isPhantom)return"Phantom";if(e.isPortal)return"Ripio Portal";if(e.isRabby)return"Rabby Wallet";if(e.isRainbow)return"Rainbow";if(e.isSafePal)return"SafePal Wallet";if(e.isStatus)return"Status";if(e.isSubWallet)return"SubWallet";if(e.isTalisman)return"Talisman";if(e.isTally||e.isTaho)return"Taho";if(e.isTokenPocket)return"TokenPocket";if(e.isTokenary)return"Tokenary";if(e.isTrust||e.isTrustWallet)return"Trust Wallet";if(e.isTTWallet)return"TTWallet";if(e.isXDEFI)return"XDEFI Wallet";if(e.isZeal)return"Zeal";if(e.isZerion)return"Zerion";if(e.isMetaMask)return"MetaMask"};var pc=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Ya(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!pc(r))return!1}return!0},Ho=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Gp=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1};var Vp="1.60.6-beta-20240418031538";var uc="4df5e2316331463a9130964bd6078dfa",mc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",zp="34357d3c125c2bcf2ce2bc3309d98715",Za="https://auth.privy.io",qp=2e4,Qe=1400,$p=2500,Ja=Vp;var cn="privy:token",fc="privy-token",Qa="privy:refresh_token",hc="privy-refresh-token",Xa="privy-session",Zi="privy:session_transfer_token",U2="privy:wallet",Ji="privy:caid",dn="privy:state_code",Vn="privy:code_verifier",pn="privy:headless_oauth",es=e=>`${U2}:${e}`,yc="privy:connectors",gc="privy:connections";var un=12e4,vo=1,vc="0x1",zn=3e4,jp="https://api.moonpay.com/v1",Kp="https://api.moonpay.com/v1",Yp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",Zp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",Jp="0x420000000000000000000000000000000000000F",Qp=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Xp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},ts=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),eu=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Go=(e,t=3,r=4)=>{if(!e)return"";let o=2,n=3;if(t+r+o+n>=e.length)return e;let a=e.slice(0,o+t),i=e.slice(e.length-r,e.length);return`${a}...${i}`},Cc=e=>new Promise(t=>setTimeout(t,e));function tu(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((o,n)=>{let a=0,i,l=()=>{if(a>=r){n("Max attempts reached without result");return}if(i=e(),a+=t,i!=null){o(i);return}setTimeout(l,t)};l()})}var ru=(e,t={})=>{let r=t.delayMs||150,o=t.maxAttempts||270;return new Promise(async(n,a)=>{let i=!1,l=0;for(;!i&&l<o;){if(t.abortSignal?.aborted)return;e().then(()=>{i=!0,n()},(...s)=>{i=!0,a(...s)}),l+=1,await Cc(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},rs=(e,t,r={})=>{let o=new URL(t,e);for(let[n,a]of Object.entries(r))o.searchParams.set(n,a);return o.href};var ou=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),fn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function nu(e,t,r=3e3){let o=!1,n=window;return new Promise(a=>{n.ethereum?i():(window.addEventListener("ethereum#initialized",i,{once:!0}),setTimeout(()=>{i()},r));function i(){if(o)return;o=!0,window.removeEventListener("ethereum#initialized",i);let l=e.getProviders(),s=[];for(let c of l)t.includes("coinbase_wallet")&&c.info.rdns==="com.coinbase.wallet"||s.push({type:c.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:c});for(let c of Hp()){let u=Ya(c);if(!l.some(g=>g.info.name===u)){if(pc(c,!0)&&!s.find(g=>g.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:c});continue}if(u==="Phantom"&&!s.find(g=>g.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:c});continue}if(u==="Coinbase Wallet"&&!s.find(g=>g.type==="coinbase_wallet")){s.push({type:"coinbase_wallet",legacyInjectedProvider:c});continue}s.find(g=>g.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:c})}}a(s)}})}function qn(e){return`eip155:${String(Number(e))}`}var os=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ne(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0])i=a.rpcUrls.privyWalletOverride.http[0];else if(r.rpcUrls&&r.rpcUrls[n])i=r.rpcUrls[n];else if(a.rpcUrls.privy?.http[0]){let l=new URL(a.rpcUrls.privy.http[0]);l.searchParams.append("privyAppId",o),i=l.toString()}else a.rpcUrls.infura?.http[0]?i=a.rpcUrls.infura.http[0]+"/"+uc:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+mc:i=a.rpcUrls.default?.http[0];if(!i)throw new ne(`No RPC url found for ${e}`);return i},iu=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new ne(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},Co=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new ne(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new mn.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new mn.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new mn.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new mn.StaticJsonRpcProvider(a.rpcUrls.infura.http[0]+"/"+uc):a.rpcUrls.blast?.http[0]?i=new mn.StaticJsonRpcProvider(a.rpcUrls.blast.http[0]+"/"+mc):i=new mn.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new ne(`No RPC url found for ${e}`);return i},ns=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([o,n])=>{if(n!=null&&typeof o=="string"&&o in t)return{name:o,type:t[o]}}).filter(o=>o!==void 0);return{...e,types:{...e.types,EIP712Domain:r}}};var is=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(as))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var as={metamask:{id:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",displayName:"MetaMask",hostname:"metamask.io",mobile:{native:"metamask://",universal:"https://metamask.app.link"}},trust:{id:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",displayName:"Trust",hostname:"trustwallet.com",mobile:{universal:"https://link.trustwallet.com"}},safe:{id:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",displayName:"Safe",hostname:"safe.global",mobile:{universal:"https://app.safe.global/"}},rainbow:{id:"1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369",displayName:"Rainbow",hostname:"rainbow.me",mobile:{native:"rainbow://",universal:"https://rnbwapp.com"}},uniswap:{id:"c03dfee351b6fcc421b4494ea33b9d4b92a984f87aa76d1663bb28705e95034a",displayName:"Uniswap",hostname:"uniswap.org",mobile:{universal:"https://uniswap.org/app",native:"uniswap://"}},zerion:{id:"ecc4036f814562b41a5268adc86270fba1365471402006302e70169465b7ac18",displayName:"Zerion",hostname:"zerion.io",mobile:{native:"zerion://",universal:"https://wallet.zerion.io"}},argent:{id:"bc949c5d968ae81310268bf9193f9c9fb7bb4e1283e1284af8f2bd4992535fd6",displayName:"Argent",hostname:"www.argent.xyz",mobile:{universal:"https://www.argent.xyz/app"}},spot:{id:"74f8092562bd79675e276d8b2062a83601a4106d30202f2d509195e30e19673d",displayName:"Spot",hostname:"www.spot-wallet.com",mobile:{universal:"https://spot.so"}},omni:{id:"afbd95522f4041c71dd4f1a065f971fd32372865b416f95a0b1db759ae33f2a7",displayName:"Omni",hostname:"omni.app",mobile:{universal:"https://links.omni.app"}},cryptocom:{id:"f2436c67184f158d1beda5df53298ee84abfc367581e4505134b5bcf5f46697d",displayName:"Crypto.com",hostname:"crypto.com",mobile:{universal:"https://wallet.crypto.com",native:"dfw://"}},blockchain:{id:"84b43e8ddfcd18e5fcb5d21e7277733f9cccef76f7d92c836d0e481db0c70c04",displayName:"Blockchain",hostname:"www.blockchain.com",mobile:{universal:"https://www.blockchain.com"}},safepal:{id:"0b415a746fb9ee99cce155c2ceca0c6f6061b1dbca2d722b3ba16381d0562150",displayName:"SafePal",hostname:"safepal.com",mobile:{universal:"https://link.safepal.io"}},bitkeep:{id:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",displayName:"BitKeep",hostname:"bitkeep.com",mobile:{universal:"https://bkapp.vip"}},zengo:{id:"9414d5a85c8f4eabc1b5b15ebe0cd399e1a2a9d35643ab0ad22a6e4a32f596f0",displayName:"ZenGo",hostname:"zengo.com",mobile:{universal:"https://get.zengo.com/"}},"1inch":{id:"c286eebc742a537cd1d6818363e9dc53b21759a1e8e5d9b263d0c03ec7703576",displayName:"1inch",hostname:"wallet.1inch.io",mobile:{universal:"https://wallet.1inch.io/wc/"}},binance:{id:"8a0ee50d1f22f6651afcae7eb4253e52a3310b90af5daef78a8c4929a9bb99d4",displayName:"Binance",hostname:"www.binance.com",mobile:{universal:"https://app.binance.com/cedefi"}},exodus:{id:"e9ff15be73584489ca4a66f64d32c4537711797e30b6660dbcb71ea72a42b1f4",displayName:"Exodus",hostname:"exodus.com",mobile:{universal:"https://exodus.com/m"}},mew_wallet:{id:"f5b4eeb6015d66be3f5940a895cbaa49ef3439e518cd771270e6b553b48f31d2",displayName:"MEW wallet",hostname:"mewwallet.com",mobile:{universal:"https://mewwallet.com"}},alphawallet:{id:"138f51c8d00ac7b9ac9d8dc75344d096a7dfe370a568aa167eabc0a21830ed98",displayName:"AlphaWallet",hostname:"alphawallet.com",mobile:{universal:"https://aw.app"}},keyring_pro:{id:"47bb07617af518642f3413a201ec5859faa63acb1dd175ca95085d35d38afb83",displayName:"KEYRING PRO",hostname:"keyring.app",mobile:{universal:"https://keyring.app/"}},mathwallet:{id:"7674bb4e353bf52886768a3ddc2a4562ce2f4191c80831291218ebd90f5f5e26",displayName:"MathWallet",hostname:"mathwallet.org",mobile:{universal:"https://www.mathwallet.org"}},unstoppable:{id:"8308656f4548bb81b3508afe355cfbb7f0cb6253d1cc7f998080601f838ecee3",displayName:"Unstoppable",hostname:"unstoppabledomains.com",mobile:{universal:"https://unstoppabledomains.com/mobile"}},obvious:{id:"031f0187049b7f96c6f039d1c9c8138ff7a17fd75d38b34350c7182232cc29aa",displayName:"Obvious",hostname:"obvious.technology",mobile:{universal:"https://wallet.obvious.technology"}},ambire:{id:"2c81da3add65899baeac53758a07e652eea46dbb5195b8074772c62a77bbf568",displayName:"Ambire",hostname:"www.ambire.com",mobile:{universal:"https://mobile.ambire.com"}},internet_money_wallet:{id:"dd43441a6368ec9046540c46c5fdc58f79926d17ce61a176444568ca7c970dcd",displayName:"Internet Money Wallet",hostname:"internetmoney.io",mobile:{universal:"https://internetmoney.io"}},coin98:{id:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",displayName:"Coin98",hostname:"coin98.com",mobile:{universal:"https://coin98.services"}},abc_wallet:{id:"b956da9052132e3dabdcd78feb596d5194c99b7345d8c4bd7a47cabdcb69a25f",displayName:"ABC Wallet",hostname:"myabcwallet.io",mobile:{universal:"https://abcwalletconnect.page.link"}},arculus_wallet:{id:"0e4915107da5b3408b38e248f7a710f4529d54cd30e9d12ff0eb886d45c18e92",displayName:"Arculus Wallet",hostname:"www.getarculus.com",mobile:{universal:"https://gw.arculus.co/app"}},haha:{id:"719bd888109f5e8dd23419b20e749900ce4d2fc6858cf588395f19c82fd036b3",displayName:"HaHa",hostname:"www.haha.me",mobile:{universal:"https://haha.me"}},cling_wallet:{id:"942d0e22a7e6b520b0a03abcafc4dbe156a1fc151876e3c4a842f914277278ef",displayName:"Cling Wallet",hostname:"clingon.io",mobile:{universal:"https://cling.carrieverse.com/apple-app-site-association"}},broearn:{id:"8ff6eccefefa7506339201bc33346f92a43118d6ff7d6e71d499d8187a1c56a2",displayName:"Broearn",hostname:"www.broearn.com",mobile:{universal:"https://www.broearn.com/link/wallet/"}},copiosa:{id:"07f99a5d9849bb049d74830012b286f8b238e72b0337933ef22b84947409db80",displayName:"Copiosa",hostname:"copiosa.io",mobile:{universal:"https://copiosa.io/action/"}},burrito_wallet:{id:"8821748c25de9dbc4f72a691b25a6ddad9d7df12fa23333fd9c8b5fdc14cc819",displayName:"Burrito Wallet",hostname:"burritowallet.com",mobile:{universal:"https://burritowallet.com/wc?uri="}},enjin_wallet:{id:"bdc9433ffdaee55d31737d83b931caa1f17e30666f5b8e03eea794bac960eb4a",displayName:"Enjin Wallet",hostname:"enjin.io",mobile:{universal:"https://deeplink.wallet.enjin.io/"}},plasma_wallet:{id:"cbe13eb482c76f1fa401ff4c84d9acd0b8bc9af311ca0620a0b192fb28359b4e",displayName:"Plasma Wallet",hostname:"plasma-wallet.com",mobile:{universal:"https://plasma-wallet.com"}},avacus:{id:"94f785c0c8fb8c4f38cd9cd704416430bcaa2137f27e1468782d624bcd155a43",displayName:"Avacus",hostname:"avacus.cc",mobile:{universal:"https://avacus.app.link"}},bee:{id:"2cca8c1b0bea04ba37dee4017991d348cdb7b826804ab2bd31073254f345b715",displayName:"Bee",hostname:"www.beewallet.app",mobile:{universal:"https://beewallet.app/wc"}},pitaka:{id:"14e5d957c6eb62d3ee8fc6239703ac2d537d7e3552154836ca0beef775f630bc",displayName:"Pitaka",hostname:"pitaka.io",mobile:{universal:"https://app.pitaka.io"}},pltwallet:{id:"576c90ceaea34f29ff0104837cf2b2e23d201be43be1433feeb18d375430e1fd",displayName:"PLTwallet",hostname:"pltwallet.io",mobile:{universal:"https://pltwallet.io/"}},minerva:{id:"49bb9d698dbdf2c3d4627d66f99dd9fe90bba1eec84b143f56c64a51473c60bd",displayName:"Minerva",hostname:"minerva.digital",mobile:{universal:"https://minerva.digital"}},kryptogo:{id:"19418ecfd44963883e4d6abca1adeb2036f3b5ffb9bee0ec61f267a9641f878b",displayName:"KryptoGO",hostname:"kryptogo.com",mobile:{universal:"https://kryptogo.page.link"}},prema:{id:"5b8e33346dfb2a532748c247876db8d596734da8977905a27b947ba1e2cf465b",displayName:"PREMA",hostname:"premanft.com",mobile:{universal:"https://premanft.com"}},slingshot:{id:"d23de318f0f56038c5edb730a083216ff0cce00c1514e619ab32231cc9ec484b",displayName:"Slingshot",hostname:"slingshot.finance",mobile:{universal:"https://app.slingshot.finance"}},kriptonio:{id:"50df7da345f84e5a79aaf617df5167335a4b6751626df2e8a38f07029b3dde7b",displayName:"Kriptonio",hostname:"kriptonio.com",mobile:{universal:"https://app.kriptonio.com/mobile"}},timeless:{id:"9751385960bca290c13b443155288f892f62ee920337eda8c5a8874135daaea8",displayName:"Timeless",hostname:"timelesswallet.xyz",mobile:{universal:"https://timelesswallet.xyz"}},secux:{id:"6464873279d46030c0b6b005b33da6be5ed57a752be3ef1f857dc10eaf8028aa",displayName:"SecuX",hostname:"secuxtech.com",mobile:{universal:"https://wsweb.secuxtech.com"}},bitizen:{id:"41f20106359ff63cf732adf1f7dc1a157176c9b02fd266b50da6dcc1e9b86071",displayName:"Bitizen",hostname:"bitizen.org",mobile:{universal:"https://bitizen.org/wallet"}},blocto:{id:"14e7176536cb3706e221daaa3cfd7b88b7da8c7dfb64d1d241044164802c6bdd",displayName:"Blocto",hostname:"blocto.io",mobile:{universal:"https://blocto.app"}},safemoon:{id:"a0e04f1086aac204d4ebdd5f985c12ed226cd0006323fd8143715f9324da58d1",displayName:"SafeMoon",hostname:"safemoon.com",mobile:{universal:"https://safemoon.com/wc"}},okx_wallet:{id:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",displayName:"OKX Wallet",hostname:"okx.com",mobile:{native:"okex://main"}}};function B2(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function au(e,t){let r=B2(t);if(r.deepLink)return pu(r.deepLink,e);if(r.universalLink)return uu(r.universalLink,e);throw new P(`Unsupported wallet ${t.id}`)}var su="WALLETCONNECT_DEEPLINK_CHOICE";function lu(){try{localStorage.removeItem(su)}catch{}}function cu({href:e,name:t}){try{localStorage.setItem(su,JSON.stringify({href:e,name:t}))}catch{}}function du(e){return e.startsWith("http://")||e.startsWith("https://")}function pu(e,t){if(du(e))return uu(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function uu(e,t){if(!du(e))return pu(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ss(e,t){window.open(e,t,"noreferrer noopener")}var it=class{constructor(t){this.promise=null;this.fn=t}execute(t){return this.promise===null&&(this.promise=(async()=>{try{return await this.fn(t)}finally{this.promise=null}})()),this.promise}};var Qi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new it(this._startChannelOnce.bind(this)),this.pollForReady=new it(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");try{let t=await this.api.post(mp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new P("No response from authentication");return{user:t.user,token:t.token,refresh_token:t.refresh_token,is_new_user:t.is_new_user}}catch(t){throw ye(t)}}async link(){if(!this.api)throw new P("Auth flow has no API instance");try{return await this.api.post(fp,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ye(t)}}async _startChannelOnce(){if(!this.api)throw new P("Auth flow has no API instance");let t=await this.api.post(up,{token:this.captchaToken});ls.isMobile&&!ls.isIOS&&t.connect_uri&&ss(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new P("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.channelToken)throw new P("Auth flow must be initialized first");let t=await this.api.get(hp,{headers:{"farcaster-channel-token":this.meta.channelToken}});return t.state==="completed"?(this.message=t.message,this.signature=t.signature,this.fid=t.fid,!0):!1}};var wc=require("jose");async function mu(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function fu(e){return crypto.getRandomValues(new Uint8Array(e))}function cs(){return!!X.get(pn)}var H2="S256",G2="S256",Qr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:cs();this.meta={...t,headless:r}}addCaptchaToken(t){this.meta.captchaToken=t}isActive(){return!!(this.meta.authorizationCode&&this.meta.stateCode&&this.meta.provider)}async authenticate(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=X.get(Vn);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(kp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return X.del(Vn),this.meta.headless&&X.del(pn),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ye(r);throw o.privyErrorCode?new P(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new P("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new P("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new P("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new P("User denied confirmation during OAuth flow");let t=X.get(Vn);if(!t)throw new P("Authentication error.");try{let r=await this.api.post(_p,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return X.del(Vn),r}catch(r){throw ye(r)}}createCodeVerifier(){return wc.base64url.encode(fu(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=H2){if(r==G2){let o=await mu(t);return wc.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new P("Auth flow has no API instance");if(!this.meta.provider)throw new P("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();X.put(Vn,t);let r=this.createStateCode();X.put(dn,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&X.put(pn,!0);try{return await this.api.post(xp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ye(n)}}};function bc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function hu(e,t){let r={detail:"",retryable:!1},o=bc(t);return e?.privyErrorCode==="linked_to_another_user"&&(r.detail="This account has already been linked to another user."),e?.privyErrorCode==="invalid_credentials"&&(r.retryable=!0,r.detail="Something went wrong. Try again."),e.privyErrorCode==="oauth_user_denied"&&(r.detail=`Retry and check ${o} to finish connecting your account.`,r.retryable=!0),e?.privyErrorCode==="too_many_requests"&&(r.detail="Too many requests. Please wait before trying again."),e?.privyErrorCode==="oauth_account_suspended"&&(r.detail=`Your ${o} account is suspended. Please try another login method.`),r}function Xi(){let e=new URLSearchParams(window.location.search),t=e.get("privy_oauth_code"),r=e.get("privy_oauth_state"),o=e.get("privy_oauth_provider");return!t||!r||!o?{inProgress:!1}:{inProgress:!0,authorizationCode:t,stateCode:r,provider:o,headless:cs()}}function ea(){let e=new URL(window.location.href);e.searchParams.delete("privy_oauth_code"),e.searchParams.delete("privy_oauth_provider"),e.searchParams.delete("privy_oauth_state"),X.del(dn),window.history.replaceState({},"",e)}var hn=class{constructor(t){this.initAuthenticateOnce=new it(this._initAuthenticateOnce.bind(this)),this.initLinkOnce=new it(this._initLinkOnce.bind(this)),this.meta={captchaToken:t}}async initAuthenticationFlow(){if(!this.api)throw new P("Auth flow has no API instance");this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute()}async initLinkFlow(){if(!this.api)throw new P("Auth flow has no API instance");this.meta.initLinkResponse=await this.initLinkOnce.execute()}async authenticate(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new P("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new P("WebAuthn is not supported in this browser");this.meta.initAuthenticateResponse||(this.meta.initAuthenticateResponse=await this.initAuthenticateOnce.execute());try{let r=await t.startAuthentication(this._transformInitAuthenticateOptionsToCamelCase(this.meta.initAuthenticateResponse.options)),o=await this.api.post(Wp,{relying_party:this.meta.initAuthenticateResponse.relying_party,challenge:this.meta.initAuthenticateResponse.options.challenge,authenticator_response:this._transformAuthenticationResponseToSnakeCase(r)});return{user:o.user,token:o.token,refresh_token:o.refresh_token,is_new_user:o.is_new_user}}catch(r){throw r.name==="NotAllowedError"?new P("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ye(r)}}async link(){let t=await import("@simplewebauthn/browser");if(!this.api)throw new P("Auth flow has no API instance");if(!t.browserSupportsWebAuthn())throw new P("WebAuthn is not supported in this browser");this.meta.initLinkResponse||(this.meta.initLinkResponse=await this.initLinkOnce.execute());try{let r=this.meta.initLinkResponse.options,o=await t.startRegistration(this._transformInitLinkOptionsToCamelCase(r));return await this.api.post(Mp,{relying_party:this.meta.initLinkResponse.relying_party,authenticator_response:this._transformRegistrationResponseToSnakeCase(o)})}catch(r){throw r.name==="NotAllowedError"?new P("Passkey request timed out or rejected by user.",void 0,"passkey_not_allowed"):ye(r)}}async _initAuthenticateOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(Ip,{token:this.meta.captchaToken})}async _initLinkOnce(){if(!this.api)throw new P("Auth flow has no API instance");return await this.api.post(Rp,{})}_transformInitLinkOptionsToCamelCase(t){return{rp:t.rp,user:{id:t.user.id,name:t.user.name,displayName:t.user.display_name},challenge:t.challenge,pubKeyCredParams:t.pub_key_cred_params.map(r=>({type:r.type,alg:r.alg})),timeout:t.timeout,excludeCredentials:t.exclude_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports})),authenticatorSelection:{authenticatorAttachment:t.authenticator_selection?.authenticator_attachment,requireResidentKey:t.authenticator_selection?.require_resident_key,residentKey:t.authenticator_selection?.resident_key,userVerification:t.authenticator_selection?.user_verification},attestation:t.attestation,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props?.rk,hmacCreateSecret:t.extensions?.hmac_create_secret}}}_transformRegistrationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,attestation_object:t.response.attestationObject,authenticator_data:t.response.authenticatorData},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}_transformInitAuthenticateOptionsToCamelCase(t){return{challenge:t.challenge,allowCredentials:t.allow_credentials?.map(r=>({id:r.id,type:r.type,transports:r.transports}))||[],timeout:t.timeout,extensions:{appid:t.extensions?.app_id,credProps:t.extensions?.cred_props,hmacCreateSecret:t.extensions?.hmac_create_secret},userVerification:t.user_verification}}_transformAuthenticationResponseToSnakeCase(t){return{id:t.id,raw_id:t.rawId,response:{client_data_json:t.response.clientDataJSON,authenticator_data:t.response.authenticatorData,signature:t.response.signature,user_handle:t.response.userHandle},authenticator_attachment:t.authenticatorAttachment,client_extension_results:{app_id:t.clientExtensionResults.appid,cred_props:t.clientExtensionResults.credProps,hmac_create_secret:t.clientExtensionResults.hmacCreateSecret},type:t.type}}};var yn=class{constructor(t,r){this.createSiweMessage=(t,r,o,n,a,i,l)=>`${o} wants you to sign in with your Ethereum account:
|
|
2
2
|
${r}
|
|
3
3
|
|
|
4
4
|
${l}
|
|
@@ -2295,7 +2295,7 @@ You will need this password to access your ${e} wallet on a new device. Please k
|
|
|
2295
2295
|
overflow: hidden;
|
|
2296
2296
|
max-width: 275px;
|
|
2297
2297
|
text-overflow: ellipsis;
|
|
2298
|
-
`;var Q1=require("@ethersproject/abstract-signer"),RC=require("@ethersproject/providers");var Wd=require("@ethersproject/bignumber");var Ln=require("@ethersproject/bignumber"),H1=require("@ethersproject/contracts"),G1=require("@ethersproject/transactions");var Ui=e=>[Ps.id,Ss.id,xs.id,ks.id,_s.id,As.id,Rs.id,Ms.id,Is.id].includes(e),V1=async(e,t)=>{if(!Ui(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let a=Ln.BigNumber.from(r).mul(Ln.BigNumber.from(126)).div(Ln.BigNumber.from(100)).add(Ln.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=La(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function z1(e,t){if(!e.chainId||e.chainId&&!Ui(e.chainId))return Ln.BigNumber.from(0);let r=Ln.BigNumber.from(0);try{let o=new H1.Contract(Jp,Qp,t),n=q1(e),a=(0,G1.serialize)(n);r=await o.getL1Fee(a)}catch{}return r}async function $1(e,t){try{
|
|
2298
|
+
`;var Q1=require("@ethersproject/abstract-signer"),RC=require("@ethersproject/providers");var Wd=require("@ethersproject/bignumber");var Ln=require("@ethersproject/bignumber"),H1=require("@ethersproject/contracts"),G1=require("@ethersproject/transactions");var Ui=e=>[Ps.id,Ss.id,xs.id,ks.id,_s.id,As.id,Rs.id,Ms.id,Is.id].includes(e),V1=async(e,t)=>{if(!Ui(e.chainId))throw new Error("Invalid chain ID for OP Stack gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas||e.gasPrice)return e;try{if(!e.maxPriorityFeePerGas){let r=await t.send("eth_maxPriorityFeePerGas",[]);e.maxPriorityFeePerGas=r}if(e.maxFeePerGas&&(console.warn("maxFeePerGas is specified without maxPriorityFeePerGas - this can result in hung transactions."),e.maxPriorityFeePerGas>=e.maxFeePerGas))throw new Error("Overridden maxFeePerGas is less than or equal to the calculated maxPriorityFeePerGas. Please set both values or maxPriorityFeePerGas alone for correct gas estimation.");if(!e.maxFeePerGas){let{lastBaseFeePerGas:r}=await t.getFeeData();if(!r)throw new Error("Unable to fetch baseFee for last block.");let a=Ln.BigNumber.from(r).mul(Ln.BigNumber.from(126)).div(Ln.BigNumber.from(100)).add(Ln.BigNumber.from(e.maxPriorityFeePerGas));e.maxFeePerGas=La(a)}}catch(r){throw new Error(`Failed to set gas price for OP stack transaction: ${r}.`)}return e};async function z1(e,t){if(!e.chainId||e.chainId&&!Ui(e.chainId))return Ln.BigNumber.from(0);let r=Ln.BigNumber.from(0);try{let o=new H1.Contract(Jp,Qp,t),n=q1(e),a=(0,G1.serialize)(n);r=await o.getL1Fee(a)}catch{}return r}async function $1(e,t){try{return(await t.estimateGas(e)).toHexString()}catch{}let r={...e,from:void 0};return(await t.estimateGas(r)).toHexString()}var j1=async(e,t)=>{if(e.type===void 0&&(e.type=2),e.type===2){if(!e.maxFeePerGas||!e.maxPriorityFeePerGas){let r=await t.getFeeData();e.maxFeePerGas||(e.maxFeePerGas=r.maxFeePerGas?.toHexString()),e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=r.maxPriorityFeePerGas?.toHexString())}}else if(!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};async function Bi(e,t){if(!e.gasLimit)throw new $e("gasLimit was not successfully set for transaction.");let r=Rt(e.gasLimit),o=Wd.BigNumber.from(0);if(e.type==2)if(e.maxFeePerGas)o=Rt(e.maxFeePerGas);else throw new $e("maxFeePerGas was not successfully set for transaction of type 2.");else if(e.gasPrice)o=Rt(e.gasPrice);else throw new $e("gasPrice was not successfully set for transaction of type 0 or 1.");let n=r.mul(o),a=Wd.BigNumber.from(0);if(e.chainId&&Ui(e.chainId))try{a=await z1(e,t),n=n.add(a)}catch{}return{totalGasEstimate:n,l1ExecutionFeeEstimate:a}}var $l=require("@ethersproject/bignumber");var Ld=e=>[bs.id,Es.id,Ts.id].includes(e),K1=async(e,t)=>{if(!Ld(e.chainId))throw new Error("Invalid chain ID for Arbitrum gas estimation.");if(e.type===void 0&&(e.type=2),e.maxFeePerGas)return e;try{let{lastBaseFeePerGas:r}=await t.getFeeData();if(r){let o=r.mul($l.BigNumber.from(120)).div($l.BigNumber.from(100));e.maxFeePerGas=La(o),e.maxPriorityFeePerGas=La($l.BigNumber.from(0))}}catch(r){throw new Error(`Failed to set gas price for Arbitrum transaction: ${r}.`)}return e};var Od=e=>[56,97].includes(e),Y1=async(e,t)=>{if(!Od(e.chainId))throw new Error("Invalid chain ID for BSC gas estimation.");if(e.type===void 0?e.type=0:(e.type==1||e.type==2)&&console.warn("Transaction request type specified is incompatible for chain and will result in undefined behavior. Please use transaction type 0."),!e.gasPrice){let r=await t.getFeeData();e.gasPrice=r.gasPrice?.toHexString()}return e};var Fd=require("@ethersproject/units"),Z1=require("ofetch");var Nd={id:80002,name:"Polygon Amoy",nativeCurrency:{name:"MATIC",symbol:"MATIC",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0};var Ud=e=>[oa.id,na.id,Nd.id].includes(e),Dd=e=>({maxPriorityFee:(0,Fd.parseUnits)(e.maxPriorityFee.toFixed(9),"gwei").toHexString(),maxFee:(0,Fd.parseUnits)(e.maxFee.toFixed(9),"gwei").toHexString()}),_C=e=>({safeLow:Dd(e.safeLow),standard:Dd(e.standard),fast:Dd(e.fast)}),AC=async e=>{let t="";switch(e){case oa.id:t="https://gasstation.polygon.technology/v2";break;case na.id:t="https://gasstation-testnet.polygon.technology/v2";break;case Nd.id:t="https://gasstation-testnet.polygon.technology/amoy";break;default:throw Error(`chainId ${e} does not support polygon gas stations`)}return _C(await(0,Z1.ofetch)(t))};async function J1(e){if(!Ud(e.chainId))throw new Error("Invalid chain ID for Polygon gas estimation.");if(e.type===void 0&&(e.type=2),e.maxPriorityFeePerGas&&e.maxFeePerGas)return e;try{let{standard:t}=await AC(e.chainId);e.maxPriorityFeePerGas||(e.maxPriorityFeePerGas=t.maxPriorityFee),e.maxFeePerGas||(e.maxFeePerGas=t.maxFee)}catch(t){throw new Error(`Failed to set gas prices from Polygon gas station with error: ${t}.`)}return e}function La(e){if(typeof e=="number"||typeof e=="bigint"||typeof e=="string")return e;if(typeof e.toHexString=="function")return e.toHexString();throw new Error(`Expected numeric value but received ${e}`)}function q1(e){let t={};return e.to!==void 0&&(t.to=e.to),e.data!==void 0&&(t.data=e.data),e.chainId!==void 0&&(t.chainId=e.chainId),e.type!==void 0&&(t.type=e.type),e.accessList!==void 0&&(t.accessList=e.accessList),e.nonce!==void 0&&(t.nonce=Rt(e.nonce).toNumber()),e.gasLimit!==void 0&&(t.gasLimit=Rt(e.gasLimit)),e.gasPrice!==void 0&&(t.gasPrice=Rt(e.gasPrice)),e.value!==void 0&&(t.value=Rt(e.value)),e.maxFeePerGas!==void 0&&(t.maxFeePerGas=Rt(e.maxFeePerGas)),e.maxPriorityFeePerGas!==void 0&&(t.maxPriorityFeePerGas=Rt(e.maxPriorityFeePerGas)),t}async function Hi(e,t,r){if(t.chainId=Number(t.chainId),X1(t),t.from||(t.from=e),!t.nonce){let o=new Q1.VoidSigner(e,r);t.nonce=await o.getTransactionCount("pending")}return t.gasLimit||(t.gas?(t.gasLimit=t.gas,delete t.gas):t.gasLimit=await $1(t,r)),typeof t.type=="string"&&eg(t.type)&&(t.type=Number(t.type)),[23294,23295].includes(t.chainId)&&(t.type=0),Ud(t.chainId)?t=await J1(t):Ld(t.chainId)?t=await K1(t,r):Ui(t.chainId)?t=await V1(t,r):Od(t.chainId)?t=await Y1(t,r):t=await j1(t,r),t.type===0&&delete t.accessList,t.type!==2&&(delete t.maxPriorityFeePerGas,delete t.maxFeePerGas),t}async function jl(e,t,r,o,n){o=Object.assign({chainId:vo},o),X1(o);let i=(await r.rpc({address:t,accessToken:e,request:{method:"eth_signTransaction",params:[o]}})).response.data;return await n.sendTransaction(i)}async function Kl(e,t,r,o){let n=await o.getBalance(e),a=t.value||0,l=!n.sub(Rt(a)).sub(r).isNegative();return{balance:n,hasSufficientFunds:l}}function X1(e){let t=["gasLimit","gasPrice","value","maxPriorityFeePerGas","maxFeePerGas"];for(let r of t){let o=e[r];if(!(typeof o>"u")&&!IC(o))throw new Error(`Transaction request property '${r}' must be a valid number, bigint, or hex string representing a quantity`)}if(typeof e.chainId!="number")throw new Error("Transaction request property 'chainId' must be a number")}function IC(e){let t=typeof e=="number",r=typeof e=="bigint",o=typeof e=="string"&&eg(e);return t||r||o}function eg(e){return/^-?0x[a-f0-9]+$/i.test(e)}function Yl(e){return{to:e.to,from:e.from,contractAddress:e.contractAddress,transactionIndex:e.transactionIndex,root:e.root,logsBloom:e.logsBloom,blockHash:e.blockHash,transactionHash:e.transactionHash,logs:e.logs,blockNumber:e.blockNumber,confirmations:e.confirmations,byzantium:e.byzantium,type:e.type,status:e.status,gasUsed:e.gasUsed.toHexString(),cumulativeGasUsed:e.cumulativeGasUsed.toHexString(),effectiveGasPrice:e.effectiveGasPrice?e.effectiveGasPrice.toHexString():void 0}}var Gi=require("react");var Zl=e=>{let{showFiatPrices:t,getUsdTokenPrice:r,chains:o}=W(),[n,a]=(0,Gi.useState)(!0),[i,l]=(0,Gi.useState)(void 0),[s,c]=(0,Gi.useState)(void 0);return(0,Gi.useEffect)(()=>{let u=e.chainId||vo,g=o.find(C=>C.id===Number(u));if(!g)throw new ne(`Unsupported chain: ${u}`);(async()=>{if(!t){a(!1);return}try{a(!0);let C=await r(g);C?c(C):l(new Error(`Unable to fetch token price on chain id ${g.id}`))}catch(C){l(C)}finally{a(!1)}})()},[e.chainId]),{tokenPrice:s,isTokenPriceLoading:n,tokenPriceError:i}};var Jl=require("react"),Bd=(0,Jl.createContext)(null);function Vi(){let e=(0,Jl.useContext)(Bd);if(e===null)throw new Error("`useWallets` was called outside the PrivyProvider component");return e}var Hd=require("react/jsx-runtime"),Gd=({pendingTransaction:e})=>{let{getAccessToken:t}=V(),{wallets:r}=Vi(),{walletProxy:o,rpcConfig:n,chains:a,appId:i,nativeTokenSymbolForChainId:l}=W(),[s,c]=(0,On.useState)(null),[u,g]=(0,On.useState)(e),{tokenPrice:f}=Zl(u),C=l(e.chainId)||"ETH",E=(0,On.useMemo)(()=>r.find(w=>w.walletClientType==="privy"),[r]);return(0,On.useEffect)(()=>{async function w(){if(!await t()||!o||!E)return u;let T=Co(u.chainId,a,n,{appId:i}),S=await Hi(E.address,u,T),{totalGasEstimate:L}=await Bi(S,T);return c(L.toHexString()),S}w().then(g).catch(console.error)},[o]),E?(0,Hd.jsx)(MC,{children:(0,Hd.jsx)(Di,{from:E.address,to:u.to,txn:u,gas:s??void 0,tokenPrice:f,tokenSymbol:C})}):null},MC=tg.default.div`
|
|
2299
2299
|
width: 100%;
|
|
2300
2300
|
padding: 1rem 0;
|
|
2301
2301
|
`;var Z=require("react/jsx-runtime"),Vd=({open:e,onClose:t})=>{let{user:r}=V(),[o,n]=(0,zi.useState)(null),{init:a,cancel:i}=Mn();(0,zi.useEffect)(()=>{e&&r?.mfaMethods&&r.mfaMethods.length>0?l(r.mfaMethods[0]):n(null)},[r?.mfaMethods,e]);async function l(c){try{n(c),await a(c)}catch(u){console.error(u)}}let s=()=>{n(null),i(),t()};return!e||!r?null:o?(0,Z.jsx)(WC,{selectedMethod:o,onClose:s,onBack:r.mfaMethods.length>1?()=>n(null):void 0}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{onClose:s},"header"),(0,Z.jsx)(Xe,{children:(0,Z.jsx)(yt,{children:(0,Z.jsx)(ag.default,{})})}),(0,Z.jsx)(We,{children:"Verify your identity"}),(0,Z.jsx)(be,{children:"Choose a verification method"}),(0,Z.jsxs)(Js,{children:[r.mfaMethods.includes("totp")&&(0,Z.jsxs)(Be,{onClick:()=>l("totp"),children:[(0,Z.jsx)(rg.default,{}),"Authenticator App"]},"totp"),r.mfaMethods.includes("sms")&&(0,Z.jsxs)(Be,{onClick:()=>l("sms"),children:[(0,Z.jsx)(og.default,{}),"SMS"]},"sms")]}),(0,Z.jsx)(ee,{})]})},WC=({selectedMethod:e,onClose:t,onBack:r})=>{let{app:o}=A(),{pendingTransaction:n}=W(),[a,i]=(0,zi.useState)(!1),[l,s]=(0,zi.useState)(!1),{submit:c}=Mn();async function u(g){try{if(!g)return;await c(e,g),s(!0),i(!1),t()}catch(f){throw il(f)?(i(!0),new Error("You have exceeded the maximum number of attempts. Please close this window and try again in 10 seconds.")):Pn(f)?(i(!1),new Error("The code you entered is not valid")):Tn(f)?(i(!0),new Error("You have exceeded the time limit for code entry. Please try again in 30 seconds.")):(i(!1),new Error("Unknown error"))}}switch(e){case"sms":return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{onClose:t},"header"),(0,Z.jsx)(Xe,{children:(0,Z.jsx)(yt,{children:(0,Z.jsx)(ig.default,{})})}),(0,Z.jsx)(We,{children:"Enter verification code"}),(0,Z.jsxs)(Ko,{children:[(0,Z.jsx)(Li,{success:l,disabled:a,onChange:u}),(0,Z.jsxs)(be,{children:["To continue, please enter the 6-digit code sent to your ",(0,Z.jsx)("strong",{children:"mobile device"})]}),n&&(0,Z.jsx)(Gd,{pendingTransaction:n})]}),r&&(0,Z.jsx)(Bc,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,Z.jsx)(Wr,{onClick:t,children:"Not now"}),(0,Z.jsx)(ee,{})]});case"totp":return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{onClose:t},"header"),(0,Z.jsx)(Xe,{children:(0,Z.jsx)(yt,{children:(0,Z.jsx)(ng.default,{})})}),(0,Z.jsx)(We,{children:"Enter verification code"}),(0,Z.jsxs)(Ko,{children:[(0,Z.jsx)(Li,{success:l,disabled:a,onChange:u}),(0,Z.jsxs)(be,{children:["To continue, please enter the 6-digit code generated from your"," ",(0,Z.jsx)("strong",{children:"authenticator app"})]}),n&&(0,Z.jsx)(Gd,{pendingTransaction:n})]}),r&&(0,Z.jsx)(Bc,{theme:o?.appearance.palette.colorScheme,onClick:r,children:"Choose another method"}),(0,Z.jsx)(Wr,{onClick:t,children:"Not now"}),(0,Z.jsx)(ee,{})]});default:return null}};var qi=require("react"),lg=y(require("styled-components"));var mt=require("react/jsx-runtime"),sg={google:{name:"Google",component:_l},discord:{name:"Discord",component:xl},github:{name:"Github",component:kl},linkedin:{name:"LinkedIn",component:Al},twitter:{name:"Twitter",component:Ml},spotify:{name:"Spotify",component:Rl},tiktok:{name:"Tiktok",component:Il},apple:{name:"Apple",component:Sl}},cg=()=>{let{authenticated:e,logout:t,ready:r,user:o}=V(),{app:n,setModalData:a,navigate:i,resetNavigation:l}=A(),{getAuthMeta:s,initLoginWithOAuth:c,loginWithOAuth:u,updateWallets:g,setReadyToTrue:f,closePrivyModal:C,createAnalyticsEvent:E}=W(),[w,k]=(0,qi.useState)(!1),[T,S]=(0,qi.useState)(void 0),L=s()?.provider||"google",M=sg[L].name,F=sg[L].component,I=n?.render.inDialog?Qe:0;(0,qi.useEffect)(()=>{u(L).then(()=>{k(!0),f(!0)}).catch(q=>{if(q?.privyErrorCode==="allowlist_rejected"){S(void 0),l(),i("ALLOWLIST_REJECTION_SCREEN");return}if(q?.privyErrorCode==="max_accounts_reached"){console.error(new Jr(q).toString()),S(void 0),l(),i("USER_LIMIT_REACHED_SCREEN");return}let{retryable:$,detail:R}=hu(q,L);S({retryable:$,detail:R,message:"Authentication failed"}),f(!1)}).finally(()=>{ea()})},[M,L]),(0,qi.useEffect)(()=>{if(r&&e&&w&&o){if(n?.legal.requireUsersAcceptTerms&&!o.hasAcceptedTerms){let $=setTimeout(()=>{i("AFFIRMATIVE_CONSENT_SCREEN")},I);return()=>clearTimeout($)}if(fr(o,n?.embeddedWallets?.createOnLogin)){let $=setTimeout(()=>{a({createWallet:{onSuccess:()=>{},onFailure:R=>{console.error(R),E({eventName:"embedded_wallet_creation_failure_logout",payload:{error:R,provider:L,screen:"OAuthStatusScreen"}}),t()},callAuthOnSuccessOnClose:!0}}),i("EMBEDDED_WALLET_ON_ACCOUNT_CREATE_SCREEN")},I);return()=>clearTimeout($)}else{let $=setTimeout(()=>C({shouldCallAuthOnSuccess:!0,isSuccess:!0}),I);return g(),()=>clearTimeout($)}}},[r,e,w,o]);let H=w?`Successfully connected with ${M}`:T?T.message:`Verifying connection to ${M}`,Y="";return w?Y="You\u2019re good to go!":T?Y=T.detail:Y="Just a few moments more",(0,mt.jsxs)(mt.Fragment,{children:[(0,mt.jsx)(x,{}),(0,mt.jsx)(oe,{}),(0,mt.jsxs)(LC,{children:[(0,mt.jsx)(qt,{children:(0,mt.jsxs)("div",{children:[(0,mt.jsx)(Gt,{success:w,fail:!!T}),(0,mt.jsx)(F,{style:{width:"38px",height:"38px"}})]})}),(0,mt.jsxs)(ct,{children:[(0,mt.jsx)("h3",{children:H}),(0,mt.jsx)("p",{children:Y})]}),T&&T?.retryable?(0,mt.jsx)(Ks,{onClick:()=>{ea(),c(L),S(void 0)},disabled:!w&&!T?.retryable,children:"Retry"}):null]}),(0,mt.jsx)(le,{}),(0,mt.jsx)(ee,{})]})},LC=lg.default.div`
|
package/package.json
CHANGED