@privy-io/react-auth 1.59.6-beta-20240325174440 → 1.59.6
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 +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Xs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var ad=(e,t,r)=>(Xs(e,t,"read from private field"),r?r.call(e):t.get(e)),Fi=(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)},el=(e,t,r,o)=>(Xs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var sd=(e,t,r)=>(Xs(e,t,"access private method"),r);import{getAddress as Ys}from"@ethersproject/address";import{Web3Provider as td}from"@ethersproject/providers";import{createStore as LE}from"mipd";import{useCallback as OE,useEffect as Nr,useMemo as NE,useRef as Fn,useState as Me}from"react";import{FetchError as $y}from"ofetch";var $e=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}]`:""}`}},ir=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},x=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ui=class extends x{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof $e)return e;if(!(e instanceof $y))return ot(e);if(!e.response)return new ir("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new ir(t||"ApiError",e.response.status,r||o,e,n)},ot=e=>e instanceof $e?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var Oo=class extends x{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Ct=class extends x{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Bi=class extends x{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Hi="/api/v1/sessions",Gi="/api/v1/sessions/logout",ld="/api/v1/sessions/fork",Vi="/api/v1/sessions/fork/recover",cd="/api/v1/siwe/init",dd="/api/v1/siwe/authenticate",pd="/api/v1/siwe/link",ud="/api/v1/siwe/unlink",md="/api/v1/farcaster/init",fd="/api/v1/farcaster/authenticate",hd="/api/v1/farcaster/link",yd="/api/v1/farcaster/status",gd="/api/v1/farcaster/unlink",vd="/api/v1/passwordless/init",wd="/api/v1/passwordless/authenticate",Cd="/api/v1/passwordless/link",bd="/api/v1/passwordless/unlink",Ed="/api/v1/passwordless/update",Td="/api/v1/passwordless_sms/init",Pd="/api/v1/passwordless_sms/link",Sd="/api/v1/passwordless_sms/unlink",xd="/api/v1/passwordless_sms/authenticate",_d="/api/v1/oauth/init",Ad="/api/v1/oauth/authenticate",kd="/api/v1/oauth/link",Rd="/api/v1/oauth/unlink";var Id="/api/v1/mfa/passwordless_sms/init",Md="/api/v1/mfa/passwordless_sms/enroll";var Wd="/api/v1/users/me/accept_terms",Ld="/api/v1/analytics_events",Od="/api/v1/plugins/moonpay_on_ramp/sign",Nd="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let t=await this.api.post(Nd,{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 Ur=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(wd,{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 x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Cd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{return await this.api.post(vd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},zi=class extends Ur{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new x("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ed,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as Qy,isIOS as Xy}from"react-device-detect";var qi=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)}},tl=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)}},rl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function ol(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function jy(){return typeof window<"u"&&window.localStorage?new tl:new qi}function Ky(){return typeof window<"u"&&window.sessionStorage?new rl:new qi}var je=Ky(),ue=jy();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Dd(){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 $i=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 nl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||$i(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!nl(r))return!1}return!0},Br=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Fd=()=>{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 Ud="1.59.6-beta-20240325174440";var il="4df5e2316331463a9130964bd6078dfa",al="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Bd="34357d3c125c2bcf2ce2bc3309d98715",ji="https://auth.privy.io",Hd=2e4,Oe=1400,Gd=2500,sl=Ud;var fo="privy:token",ll="privy-token",Ki="privy:refresh_token",cl="privy-refresh-token",Yi="privy-session",Hn="privy:session_transfer_token",Jy="privy:wallet",Gn="privy:caid",ho="privy:state_code",Do="privy:code_verifier",Vn="privy:headless_oauth",Ji=e=>`${Jy}:${e}`,dl="privy:connectors",pl="privy:connections";var yo=12e4,xr=1,ul="0x1",Fo=3e4,Vd="https://api.moonpay.com/v1",zd="https://api.moonpay.com/v1",qd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",$d="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",jd="0x420000000000000000000000000000000000000F",Kd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Yd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Zi=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,}))$/),Jd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Hr=(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}`},ml=e=>new Promise(t=>setTimeout(t,e));function Zd(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 Qd=(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 ml(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Qi=(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 Xd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=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 d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Dd()){let u=$i(d);if(!l.some(y=>y.info.name===u)){if(nl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Xi=(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]+"/"+il:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+al: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},_r=(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 Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+il):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+al):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},ea=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 ta=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={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 Zy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var rp=e=>e in Ho,op=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function np(e,t){let r=Zy(t);if(r.deepLink)return cp(r.deepLink,e);if(r.universalLink)return dp(r.universalLink,e);throw new x(`Unsupported wallet ${t.id}`)}var ip="WALLETCONNECT_DEEPLINK_CHOICE";function ap(){try{localStorage.removeItem(ip)}catch{}}function sp({href:e,name:t}){try{localStorage.setItem(ip,JSON.stringify({href:e,name:t}))}catch{}}function lp(e){return e.startsWith("http://")||e.startsWith("https://")}function cp(e,t){if(lp(e))return dp(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 dp(e,t){if(!lp(e))return cp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ra(e,t){window.open(e,t,"noreferrer noopener")}var nt=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 zn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new nt(this._startChannelOnce.bind(this)),this.pollForReady=new nt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");try{let t=await this.api.post(fd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new x("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 x("Auth flow has no API instance");try{return await this.api.post(hd,{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 x("Auth flow has no API instance");let t=await this.api.post(md,{token:this.captchaToken});Qy&&!Xy&&t.connect_uri&&ra(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new x("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");let t=await this.api.get(yd,{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 mp}from"jose";async function pp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function up(e){return crypto.getRandomValues(new Uint8Array(e))}function oa(){return!!je.get(Vn)}var eg="S256",tg="S256",ar=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:oa();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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(Ad,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),this.meta.headless&&je.del(Vn),{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 x(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new x("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new x("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(kd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),r}catch(r){throw pe(r)}}createCodeVerifier(){return mp.encode(up(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=eg){if(r==tg){let o=await pp(t);return mp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();je.put(Do,t);let r=this.createStateCode();je.put(ho,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&je.put(Vn,!0);try{return await this.api.post(_d,{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 fl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function fp(e,t){let r={detail:"",retryable:!1},o=fl(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 $n(){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:oa()}}function jn(){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"),je.del(ho),window.history.replaceState({},"",e)}var vo=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 Xs=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var ad=(e,t,r)=>(Xs(e,t,"read from private field"),r?r.call(e):t.get(e)),Fi=(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)},el=(e,t,r,o)=>(Xs(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var sd=(e,t,r)=>(Xs(e,t,"access private method"),r);import{getAddress as Ys}from"@ethersproject/address";import{Web3Provider as td}from"@ethersproject/providers";import{createStore as LE}from"mipd";import{useCallback as OE,useEffect as Nr,useMemo as NE,useRef as Fn,useState as Me}from"react";import{FetchError as $y}from"ofetch";var $e=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}]`:""}`}},ir=class extends $e{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},x=class extends $e{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Ui=class extends x{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var J=class extends $e{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},pe=e=>{if(e instanceof $e)return e;if(!(e instanceof $y))return ot(e);if(!e.response)return new ir("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new ir(t||"ApiError",e.response.status,r||o,e,n)},ot=e=>e instanceof $e?e:e instanceof Error?new x(e.message,e):new x(`Internal error: ${e}`);var Oo=class extends x{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},Ct=class extends x{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},Bi=class extends x{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Hi="/api/v1/sessions",Gi="/api/v1/sessions/logout",ld="/api/v1/sessions/fork",Vi="/api/v1/sessions/fork/recover",cd="/api/v1/siwe/init",dd="/api/v1/siwe/authenticate",pd="/api/v1/siwe/link",ud="/api/v1/siwe/unlink",md="/api/v1/farcaster/init",fd="/api/v1/farcaster/authenticate",hd="/api/v1/farcaster/link",yd="/api/v1/farcaster/status",gd="/api/v1/farcaster/unlink",vd="/api/v1/passwordless/init",wd="/api/v1/passwordless/authenticate",Cd="/api/v1/passwordless/link",bd="/api/v1/passwordless/unlink",Ed="/api/v1/passwordless/update",Td="/api/v1/passwordless_sms/init",Pd="/api/v1/passwordless_sms/link",Sd="/api/v1/passwordless_sms/unlink",xd="/api/v1/passwordless_sms/authenticate",_d="/api/v1/oauth/init",Ad="/api/v1/oauth/authenticate",kd="/api/v1/oauth/link",Rd="/api/v1/oauth/unlink";var Id="/api/v1/mfa/passwordless_sms/init",Md="/api/v1/mfa/passwordless_sms/enroll";var Wd="/api/v1/users/me/accept_terms",Ld="/api/v1/analytics_events",Od="/api/v1/plugins/moonpay_on_ramp/sign",Nd="/api/v1/custom_jwt_account/authenticate";var No=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");try{let t=await this.api.post(Nd,{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 Ur=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(wd,{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 x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new x("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(Cd,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw pe(t)}}async sendCodeEmail(t,r){if(!this.api)throw new x("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new x("Email must be set when initialzing authentication.");try{return await this.api.post(vd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw pe(o)}}},zi=class extends Ur{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new x("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(Ed,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw pe(r)}}};import{isMobile as Qy,isIOS as Xy}from"react-device-detect";var qi=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)}},tl=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)}},rl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function ol(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function jy(){return typeof window<"u"&&window.localStorage?new tl:new qi}function Ky(){return typeof window<"u"&&window.sessionStorage?new rl:new qi}var je=Ky(),ue=jy();import{StaticJsonRpcProvider as Uo}from"@ethersproject/providers";function Dd(){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 $i=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 nl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||$i(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!nl(r))return!1}return!0},Br=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),Fd=()=>{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 Ud="1.59.6";var il="4df5e2316331463a9130964bd6078dfa",al="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Bd="34357d3c125c2bcf2ce2bc3309d98715",ji="https://auth.privy.io",Hd=2e4,Oe=1400,Gd=2500,sl=Ud;var fo="privy:token",ll="privy-token",Ki="privy:refresh_token",cl="privy-refresh-token",Yi="privy-session",Hn="privy:session_transfer_token",Jy="privy:wallet",Gn="privy:caid",ho="privy:state_code",Do="privy:code_verifier",Vn="privy:headless_oauth",Ji=e=>`${Jy}:${e}`,dl="privy:connectors",pl="privy:connections";var yo=12e4,xr=1,ul="0x1",Fo=3e4,Vd="https://api.moonpay.com/v1",zd="https://api.moonpay.com/v1",qd="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",$d="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",jd="0x420000000000000000000000000000000000000F",Kd=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var Yd=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Zi=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,}))$/),Jd=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Hr=(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}`},ml=e=>new Promise(t=>setTimeout(t,e));function Zd(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 Qd=(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 ml(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Qi=(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 Xd=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),go=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 d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of Dd()){let u=$i(d);if(!l.some(y=>y.info.name===u)){if(nl(d,!0)&&!s.find(y=>y.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(y=>y.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(y=>y.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function Bo(e){return`eip155:${String(Number(e))}`}var Xi=(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]+"/"+il:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+al: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},_r=(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 Uo(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new Uo(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new Uo({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new Uo(a.rpcUrls.infura.http[0]+"/"+il):a.rpcUrls.blast?.http[0]?i=new Uo(a.rpcUrls.blast.http[0]+"/"+al):i=new Uo(a.rpcUrls.default?.http[0]),!i)throw new J(`No RPC url found for ${e}`);return i},ea=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 ta=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Ho))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Ho={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 Zy(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var rp=e=>e in Ho,op=e=>{let t=Ho[e].mobile;if("native"in t)return t.native};function np(e,t){let r=Zy(t);if(r.deepLink)return cp(r.deepLink,e);if(r.universalLink)return dp(r.universalLink,e);throw new x(`Unsupported wallet ${t.id}`)}var ip="WALLETCONNECT_DEEPLINK_CHOICE";function ap(){try{localStorage.removeItem(ip)}catch{}}function sp({href:e,name:t}){try{localStorage.setItem(ip,JSON.stringify({href:e,name:t}))}catch{}}function lp(e){return e.startsWith("http://")||e.startsWith("https://")}function cp(e,t){if(lp(e))return dp(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 dp(e,t){if(!lp(e))return cp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function ra(e,t){window.open(e,t,"noreferrer noopener")}var nt=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 zn=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new nt(this._startChannelOnce.bind(this)),this.pollForReady=new nt(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");try{let t=await this.api.post(fd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new x("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 x("Auth flow has no API instance");try{return await this.api.post(hd,{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 x("Auth flow has no API instance");let t=await this.api.post(md,{token:this.captchaToken});Qy&&!Xy&&t.connect_uri&&ra(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new x("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.channelToken)throw new x("Auth flow must be initialized first");let t=await this.api.get(yd,{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 mp}from"jose";async function pp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function up(e){return crypto.getRandomValues(new Uint8Array(e))}function oa(){return!!je.get(Vn)}var eg="S256",tg="S256",ar=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:oa();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 x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(Ad,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),this.meta.headless&&je.del(Vn),{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 x(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new x("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new x("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new x("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new x("User denied confirmation during OAuth flow");let t=je.get(Do);if(!t)throw new x("Authentication error.");try{let r=await this.api.post(kd,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return je.del(Do),r}catch(r){throw pe(r)}}createCodeVerifier(){return mp.encode(up(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=eg){if(r==tg){let o=await pp(t);return mp.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new x("Auth flow has no API instance");if(!this.meta.provider)throw new x("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();je.put(Do,t);let r=this.createStateCode();je.put(ho,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&je.put(Vn,!0);try{return await this.api.post(_d,{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 fl(e){return e.charAt(0).toUpperCase()+e.slice(1)}function fp(e,t){let r={detail:"",retryable:!1},o=fl(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 $n(){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:oa()}}function jn(){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"),je.del(ho),window.history.replaceState({},"",e)}var vo=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}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var N1=Object.create;var xa=Object.defineProperty;var D1=Object.getOwnPropertyDescriptor;var F1=Object.getOwnPropertyNames;var U1=Object.getPrototypeOf,B1=Object.prototype.hasOwnProperty;var H1=(e,t)=>{for(var r in t)xa(e,r,{get:t[r],enumerable:!0})},Fd=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of F1(t))!B1.call(e,n)&&n!==r&&xa(e,n,{get:()=>t[n],enumerable:!(o=D1(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?N1(U1(e)):{},Fd(t||!e||!e.__esModule?xa(r,"default",{value:e,enumerable:!0}):r,e)),G1=e=>Fd(xa({},"__esModule",{value:!0}),e);var Kl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Ud=(e,t,r)=>(Kl(e,t,"read from private field"),r?r.call(e):t.get(e)),_a=(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)},Yl=(e,t,r,o)=>(Kl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Bd=(e,t,r)=>(Kl(e,t,"access private method"),r);var l2={};H1(l2,{AsExternalProvider:()=>Er,Captcha:()=>Ss,ConnectorManager:()=>Gn,PrivyClient:()=>Vn,PrivyProvider:()=>n1,PrivyProxyProvider:()=>Le,SUPPORTED_CHAINS:()=>Bn,VERSION:()=>Da,WalletConnector:()=>_t,addRpcUrlOverrideToChain:()=>M1,errorIndicatesMaxMfaRetries:()=>$s,errorIndicatesMfaTimeout:()=>cn,errorIndicatesMfaVerificationFailed:()=>dn,getAccessToken:()=>xe,useConnectWallet:()=>h1,useCreateWallet:()=>g1,useExperimentalFarcasterSigner:()=>I1,useFundWallet:()=>v1,useLinkAccount:()=>m1,useLogin:()=>a1,useLoginWithEmail:()=>d1,useLoginWithOAuth:()=>c1,useLoginWithSms:()=>p1,useLogout:()=>l1,useMfa:()=>vn,useMfaEnrollment:()=>bi,useModalStatus:()=>A1,usePrivy:()=>V,useRegisterMfaListener:()=>ks,useSendTransaction:()=>C1,useSetWalletPassword:()=>E1,useSignMessage:()=>P1,useSignTypedData:()=>x1,useToken:()=>R1,useWallets:()=>ki});module.exports=G1(l2);var Ta=require("@ethersproject/address"),zl=require("@ethersproject/providers"),Xg=require("mipd"),X=require("react");var Hd=require("ofetch"),mt=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}]`:""}`}},Hr=class extends mt{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},_=class extends mt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Aa=class extends _{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var re=class extends mt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ve=e=>{if(e instanceof mt)return e;if(!(e instanceof Hd.FetchError))return Pt(e);if(!e.response)return new Hr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Hr(t||"ApiError",e.response.status,r||o,e,n)},Pt=e=>e instanceof mt?e:e instanceof Error?new _(e.message,e):new _(`Internal error: ${e}`);var Sn=class extends _{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},$t=class extends _{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ka=class extends _{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Ra="/api/v1/sessions",Ia="/api/v1/sessions/logout",Gd="/api/v1/sessions/fork",Ma="/api/v1/sessions/fork/recover",Vd="/api/v1/siwe/init",zd="/api/v1/siwe/authenticate",qd="/api/v1/siwe/link",$d="/api/v1/siwe/unlink",jd="/api/v1/farcaster/init",Kd="/api/v1/farcaster/authenticate",Yd="/api/v1/farcaster/link",Jd="/api/v1/farcaster/status",Zd="/api/v1/farcaster/unlink",Qd="/api/v1/passwordless/init",Xd="/api/v1/passwordless/authenticate",ep="/api/v1/passwordless/link",tp="/api/v1/passwordless/unlink",rp="/api/v1/passwordless/update",op="/api/v1/passwordless_sms/init",np="/api/v1/passwordless_sms/link",ip="/api/v1/passwordless_sms/unlink",ap="/api/v1/passwordless_sms/authenticate",sp="/api/v1/oauth/init",lp="/api/v1/oauth/authenticate",cp="/api/v1/oauth/link",dp="/api/v1/oauth/unlink";var pp="/api/v1/mfa/passwordless_sms/init",up="/api/v1/mfa/passwordless_sms/enroll";var mp="/api/v1/users/me/accept_terms",fp="/api/v1/analytics_events",hp="/api/v1/plugins/moonpay_on_ramp/sign",yp="/api/v1/custom_jwt_account/authenticate";var xn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let t=await this.api.post(yp,{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 ve(t)}}async link(){throw new Error("Unimplemented")}};var xo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Xd,{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 ve(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(ep,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ve(t)}}async sendCodeEmail(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new _("Email must be set when initialzing authentication.");try{return await this.api.post(Qd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ve(o)}}},Wa=class extends xo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new _("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(rp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ve(r)}}};var ja=require("react-device-detect");var La=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)}},Jl=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)}},Zl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function Ql(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function V1(){return typeof window<"u"&&window.localStorage?new Jl:new La}function z1(){return typeof window<"u"&&window.sessionStorage?new Zl:new La}var ft=z1(),we=V1();var tn=require("@ethersproject/providers");function gp(){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 Oa=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 Xl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Oa(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Xl(r))return!1}return!0},_o=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),vp=()=>{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 wp="1.59.6-beta-20240325174440";var ec="4df5e2316331463a9130964bd6078dfa",tc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Cp="34357d3c125c2bcf2ce2bc3309d98715",Na="https://auth.privy.io",bp=2e4,at=1400,Ep=2500,Da=wp;var Qo="privy:token",rc="privy-token",Fa="privy:refresh_token",oc="privy-refresh-token",Ua="privy-session",Oi="privy:session_transfer_token",$1="privy:wallet",Ni="privy:caid",Xo="privy:state_code",_n="privy:code_verifier",Di="privy:headless_oauth",Ba=e=>`${$1}:${e}`,nc="privy:connectors",ic="privy:connections";var en=12e4,so=1,ac="0x1",An=3e4,Tp="https://api.moonpay.com/v1",Pp="https://api.moonpay.com/v1",Sp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",xp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",_p="0x420000000000000000000000000000000000000F",Ap=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var kp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ha=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,}))$/),Rp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Ao=(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}`},sc=e=>new Promise(t=>setTimeout(t,e));function Ip(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 Mp=(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 sc(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Ga=(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 Wp=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),rn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Lp(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 d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of gp()){let u=Oa(d);if(!l.some(v=>v.info.name===u)){if(Xl(d,!0)&&!s.find(v=>v.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(v=>v.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(v=>v.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function kn(e){return`eip155:${String(Number(e))}`}var Va=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new re(`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]+"/"+ec:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+tc:i=a.rpcUrls.default?.http[0];if(!i)throw new re(`No RPC url found for ${e}`);return i},Op=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new re(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},lo=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new re(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new tn.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new tn.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.infura.http[0]+"/"+ec):a.rpcUrls.blast?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.blast.http[0]+"/"+tc):i=new tn.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new re(`No RPC url found for ${e}`);return i},za=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 qa=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Rn))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Rn={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 j1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Np=e=>e in Rn,Dp=e=>{let t=Rn[e].mobile;if("native"in t)return t.native};function Fp(e,t){let r=j1(t);if(r.deepLink)return Vp(r.deepLink,e);if(r.universalLink)return zp(r.universalLink,e);throw new _(`Unsupported wallet ${t.id}`)}var Up="WALLETCONNECT_DEEPLINK_CHOICE";function Bp(){try{localStorage.removeItem(Up)}catch{}}function Hp({href:e,name:t}){try{localStorage.setItem(Up,JSON.stringify({href:e,name:t}))}catch{}}function Gp(e){return e.startsWith("http://")||e.startsWith("https://")}function Vp(e,t){if(Gp(e))return zp(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 zp(e,t){if(!Gp(e))return Vp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function $a(e,t){window.open(e,t,"noreferrer noopener")}var St=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 Fi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new St(this._startChannelOnce.bind(this)),this.pollForReady=new St(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");try{let t=await this.api.post(Kd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new _("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 ve(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(Yd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ve(t)}}async _startChannelOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=await this.api.post(jd,{token:this.captchaToken});ja.isMobile&&!ja.isIOS&&t.connect_uri&&$a(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new _("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");let t=await this.api.get(Jd,{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 lc=require("jose");async function qp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function $p(e){return crypto.getRandomValues(new Uint8Array(e))}function Ka(){return!!ft.get(Di)}var K1="S256",Y1="S256",Gr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Ka();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 _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=ft.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(lp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ft.del(_n),this.meta.headless&&ft.del(Di),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ve(r);throw o.privyErrorCode?new _(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new _("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new _("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=ft.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(cp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ft.del(_n),r}catch(r){throw ve(r)}}createCodeVerifier(){return lc.base64url.encode($p(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=K1){if(r==Y1){let o=await qp(t);return lc.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();ft.put(_n,t);let r=this.createStateCode();ft.put(Xo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&ft.put(Di,!0);try{return await this.api.post(sp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ve(n)}}};function cc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function jp(e,t){let r={detail:"",retryable:!1},o=cc(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 Bi(){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:Ka()}}function Hi(){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"),ft.del(Xo),window.history.replaceState({},"",e)}var on=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 N1=Object.create;var xa=Object.defineProperty;var D1=Object.getOwnPropertyDescriptor;var F1=Object.getOwnPropertyNames;var U1=Object.getPrototypeOf,B1=Object.prototype.hasOwnProperty;var H1=(e,t)=>{for(var r in t)xa(e,r,{get:t[r],enumerable:!0})},Fd=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of F1(t))!B1.call(e,n)&&n!==r&&xa(e,n,{get:()=>t[n],enumerable:!(o=D1(t,n))||o.enumerable});return e};var y=(e,t,r)=>(r=e!=null?N1(U1(e)):{},Fd(t||!e||!e.__esModule?xa(r,"default",{value:e,enumerable:!0}):r,e)),G1=e=>Fd(xa({},"__esModule",{value:!0}),e);var Kl=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};var Ud=(e,t,r)=>(Kl(e,t,"read from private field"),r?r.call(e):t.get(e)),_a=(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)},Yl=(e,t,r,o)=>(Kl(e,t,"write to private field"),o?o.call(e,r):t.set(e,r),r);var Bd=(e,t,r)=>(Kl(e,t,"access private method"),r);var l2={};H1(l2,{AsExternalProvider:()=>Er,Captcha:()=>Ss,ConnectorManager:()=>Gn,PrivyClient:()=>Vn,PrivyProvider:()=>n1,PrivyProxyProvider:()=>Le,SUPPORTED_CHAINS:()=>Bn,VERSION:()=>Da,WalletConnector:()=>_t,addRpcUrlOverrideToChain:()=>M1,errorIndicatesMaxMfaRetries:()=>$s,errorIndicatesMfaTimeout:()=>cn,errorIndicatesMfaVerificationFailed:()=>dn,getAccessToken:()=>xe,useConnectWallet:()=>h1,useCreateWallet:()=>g1,useExperimentalFarcasterSigner:()=>I1,useFundWallet:()=>v1,useLinkAccount:()=>m1,useLogin:()=>a1,useLoginWithEmail:()=>d1,useLoginWithOAuth:()=>c1,useLoginWithSms:()=>p1,useLogout:()=>l1,useMfa:()=>vn,useMfaEnrollment:()=>bi,useModalStatus:()=>A1,usePrivy:()=>V,useRegisterMfaListener:()=>ks,useSendTransaction:()=>C1,useSetWalletPassword:()=>E1,useSignMessage:()=>P1,useSignTypedData:()=>x1,useToken:()=>R1,useWallets:()=>ki});module.exports=G1(l2);var Ta=require("@ethersproject/address"),zl=require("@ethersproject/providers"),Xg=require("mipd"),X=require("react");var Hd=require("ofetch"),mt=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}]`:""}`}},Hr=class extends mt{constructor(r,o,n,a,i){super(n,a,i);this.type=r;this.status=o}},_=class extends mt{constructor(r,o,n){super(r,o,n);this.type="client_error"}},Aa=class extends _{constructor(){super("Request timed out",void 0,"client_request_timeout")}};var re=class extends mt{constructor(r,o,n){super(r,o,n);this.type="connector_error"}},ve=e=>{if(e instanceof mt)return e;if(!(e instanceof Hd.FetchError))return Pt(e);if(!e.response)return new Hr("api_error",null,e.message,e);let{type:t,message:r,error:o,code:n}=e.data;return new Hr(t||"ApiError",e.response.status,r||o,e,n)},Pt=e=>e instanceof mt?e:e instanceof Error?new _(e.message,e):new _(`Internal error: ${e}`);var Sn=class extends _{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}},$t=class extends _{constructor(t="Embedded wallet error",r){super(t,r,"unknown_embedded_wallet_error")}},ka=class extends _{constructor(t="User must be authenticated"){super(t,void 0,"must_be_authenticated")}};var Ra="/api/v1/sessions",Ia="/api/v1/sessions/logout",Gd="/api/v1/sessions/fork",Ma="/api/v1/sessions/fork/recover",Vd="/api/v1/siwe/init",zd="/api/v1/siwe/authenticate",qd="/api/v1/siwe/link",$d="/api/v1/siwe/unlink",jd="/api/v1/farcaster/init",Kd="/api/v1/farcaster/authenticate",Yd="/api/v1/farcaster/link",Jd="/api/v1/farcaster/status",Zd="/api/v1/farcaster/unlink",Qd="/api/v1/passwordless/init",Xd="/api/v1/passwordless/authenticate",ep="/api/v1/passwordless/link",tp="/api/v1/passwordless/unlink",rp="/api/v1/passwordless/update",op="/api/v1/passwordless_sms/init",np="/api/v1/passwordless_sms/link",ip="/api/v1/passwordless_sms/unlink",ap="/api/v1/passwordless_sms/authenticate",sp="/api/v1/oauth/init",lp="/api/v1/oauth/authenticate",cp="/api/v1/oauth/link",dp="/api/v1/oauth/unlink";var pp="/api/v1/mfa/passwordless_sms/init",up="/api/v1/mfa/passwordless_sms/enroll";var mp="/api/v1/users/me/accept_terms",fp="/api/v1/analytics_events",hp="/api/v1/plugins/moonpay_on_ramp/sign",yp="/api/v1/custom_jwt_account/authenticate";var xn=class{constructor(t){this.meta={token:t}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");try{let t=await this.api.post(yp,{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 ve(t)}}async link(){throw new Error("Unimplemented")}};var xo=class{constructor(t,r){this.meta={email:t,captchaToken:r}}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{let t=await this.api.post(Xd,{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 ve(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode)throw new _("Email and email code must be set prior to calling authenticate.");try{return await this.api.post(ep,{email:this.meta.email,code:this.meta.emailCode})}catch(t){throw ve(t)}}async sendCodeEmail(t,r){if(!this.api)throw new _("Auth flow has no API instance");if(t&&(this.meta.email=t),r&&(this.meta.captchaToken=r),!this.meta.email)throw new _("Email must be set when initialzing authentication.");try{return await this.api.post(Qd,{email:this.meta.email,token:this.meta.captchaToken})}catch(o){throw ve(o)}}},Wa=class extends xo{constructor(r,o,n){super(o,n);this.meta={email:o,captchaToken:n,oldAddress:r}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.email||!this.meta.emailCode||!this.meta.oldAddress)throw new _("Email, email code, and an old email address must be set prior to calling update.");try{return await this.api.post(rp,{oldAddress:this.meta.oldAddress,newAddress:this.meta.email,code:this.meta.emailCode})}catch(r){throw ve(r)}}};var ja=require("react-device-detect");var La=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)}},Jl=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)}},Zl=class{get(t){let r=sessionStorage.getItem(t);return r===null?void 0:JSON.parse(r)}put(t,r){r!==void 0?sessionStorage.setItem(t,JSON.stringify(r)):this.del(t)}del(t){sessionStorage.removeItem(t)}getKeys(){return Object.entries(sessionStorage).map(([t])=>t)}};function Ql(){try{let e="privy:__session_storage__test",t="blobby";return window.sessionStorage.setItem(e,t),window.sessionStorage.removeItem(e),!0}catch{return!1}}function V1(){return typeof window<"u"&&window.localStorage?new Jl:new La}function z1(){return typeof window<"u"&&window.sessionStorage?new Zl:new La}var ft=z1(),we=V1();var tn=require("@ethersproject/providers");function gp(){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 Oa=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 Xl=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;if(e.isBraveWallet&&!e._events&&!e._state||Oa(e)!=="MetaMask")return!1;if(e.providers){for(let r of e.providers)if(!Xl(r))return!1}return!0},_o=()=>!!("phantom"in window&&window?.phantom?.ethereum?.isPhantom),vp=()=>{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 wp="1.59.6";var ec="4df5e2316331463a9130964bd6078dfa",tc="fe9c30fc-3bc5-4064-91e2-6ab5887f8f4d",Cp="34357d3c125c2bcf2ce2bc3309d98715",Na="https://auth.privy.io",bp=2e4,at=1400,Ep=2500,Da=wp;var Qo="privy:token",rc="privy-token",Fa="privy:refresh_token",oc="privy-refresh-token",Ua="privy-session",Oi="privy:session_transfer_token",$1="privy:wallet",Ni="privy:caid",Xo="privy:state_code",_n="privy:code_verifier",Di="privy:headless_oauth",Ba=e=>`${$1}:${e}`,nc="privy:connectors",ic="privy:connections";var en=12e4,so=1,ac="0x1",An=3e4,Tp="https://api.moonpay.com/v1",Pp="https://api.moonpay.com/v1",Sp="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",xp="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",_p="0x420000000000000000000000000000000000000F",Ap=["function getL1Fee(bytes memory _data) external view returns (uint256)"];var kp=(e,t)=>{let r=[],o=[];for(let[n,a]of e.entries())n<t?r.push(a):o.push(a);return[r,o]},Ha=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,}))$/),Rp=(e,t)=>{let r=e.slice(0),o=[];for(;r.length;)o.push(r.splice(0,t));return o},Ao=(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}`},sc=e=>new Promise(t=>setTimeout(t,e));function Ip(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 Mp=(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 sc(r)}i||a(new Error("Exceeded max attempts before resolving function"))})},Ga=(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 Wp=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),rn=e=>typeof e=="string"?e:"0x"+e.toString(16);async function Lp(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 d of l)t.includes("coinbase_wallet")&&d.info.rdns==="com.coinbase.wallet"||s.push({type:d.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:d});for(let d of gp()){let u=Oa(d);if(!l.some(v=>v.info.name===u)){if(Xl(d,!0)&&!s.find(v=>v.type==="metamask")){s.push({type:"metamask",legacyInjectedProvider:d});continue}if(u==="Phantom"&&!s.find(v=>v.type==="phantom")){s.push({type:"phantom",legacyInjectedProvider:d});continue}s.find(v=>v.type==="unknown_browser_extension")||s.push({type:"unknown_browser_extension",legacyInjectedProvider:d})}}a(s)}})}function kn(e){return`eip155:${String(Number(e))}`}var Va=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new re(`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]+"/"+ec:a.rpcUrls.blast?.http[0]?i=a.rpcUrls.blast.http[0]+"/"+tc:i=a.rpcUrls.default?.http[0];if(!i)throw new re(`No RPC url found for ${e}`);return i},Op=(e,t)=>{let r=Number(e),o=t.find(n=>n.id===r);if(!o)throw new re(`Unsupported chainId ${e}`,4901);return o.blockExplorers?.default.url},lo=(e,t,r,o)=>{let n=Number(e),a=t.find(l=>l.id===n);if(!a)throw new re(`Unsupported chainId ${e}`,4901);let i;if(a.rpcUrls.privyWalletOverride&&a.rpcUrls.privyWalletOverride.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.privyWalletOverride.http[0]):r.rpcUrls&&r.rpcUrls[n]?i=new tn.StaticJsonRpcProvider(r.rpcUrls[n]):a.rpcUrls.privy?.http[0]?i=new tn.StaticJsonRpcProvider({url:a.rpcUrls.privy.http[0],headers:{"privy-app-id":o.appId}}):a.rpcUrls.infura?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.infura.http[0]+"/"+ec):a.rpcUrls.blast?.http[0]?i=new tn.StaticJsonRpcProvider(a.rpcUrls.blast.http[0]+"/"+tc):i=new tn.StaticJsonRpcProvider(a.rpcUrls.default?.http[0]),!i)throw new re(`No RPC url found for ${e}`);return i},za=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 qa=e=>{let t;try{t=new URL(e).hostname}catch{return}for(let[r,o]of Object.entries(Rn))if(t.includes(o.hostname))return{walletClientType:r,entry:o}};var Rn={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 j1(e){return{name:e.displayName||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}var Np=e=>e in Rn,Dp=e=>{let t=Rn[e].mobile;if("native"in t)return t.native};function Fp(e,t){let r=j1(t);if(r.deepLink)return Vp(r.deepLink,e);if(r.universalLink)return zp(r.universalLink,e);throw new _(`Unsupported wallet ${t.id}`)}var Up="WALLETCONNECT_DEEPLINK_CHOICE";function Bp(){try{localStorage.removeItem(Up)}catch{}}function Hp({href:e,name:t}){try{localStorage.setItem(Up,JSON.stringify({href:e,name:t}))}catch{}}function Gp(e){return e.startsWith("http://")||e.startsWith("https://")}function Vp(e,t){if(Gp(e))return zp(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 zp(e,t){if(!Gp(e))return Vp(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let o=encodeURIComponent(t);return{redirect:`${r}wc?uri=${o}`,href:r}}function $a(e,t){window.open(e,t,"noreferrer noopener")}var St=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 Fi=class{constructor(t){this._meta={};this.captchaToken=t,this.startChannelOnce=new St(this._startChannelOnce.bind(this)),this.pollForReady=new St(this._pollForReady.bind(this))}get meta(){return this._meta}async authenticate(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");try{let t=await this.api.post(Kd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid});if(!t)throw new _("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 ve(t)}}async link(){if(!this.api)throw new _("Auth flow has no API instance");try{return await this.api.post(Yd,{channel_token:this.meta.channelToken,message:this.message,signature:this.signature,fid:this.fid})}catch(t){throw ve(t)}}async _startChannelOnce(){if(!this.api)throw new _("Auth flow has no API instance");let t=await this.api.post(jd,{token:this.captchaToken});ja.isMobile&&!ja.isIOS&&t.connect_uri&&$a(t.connect_uri,"_blank"),this._meta={connectUri:t.connect_uri,channelToken:t.channel_token}}async initializeFarcasterConnect(){if(!this.api)throw new _("Auth flow has no API instance");await this.startChannelOnce.execute()}async _pollForReady(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.channelToken)throw new _("Auth flow must be initialized first");let t=await this.api.get(Jd,{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 lc=require("jose");async function qp(e){let t=new TextEncoder().encode(e),r=await crypto.subtle.digest("SHA-256",t);return new Uint8Array(r)}function $p(e){return crypto.getRandomValues(new Uint8Array(e))}function Ka(){return!!ft.get(Di)}var K1="S256",Y1="S256",Gr=class{constructor(t){let r=typeof t.headless=="boolean"?t.headless:Ka();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 _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling authenticate.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=ft.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(lp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ft.del(_n),this.meta.headless&&ft.del(Di),{user:r.user,token:r.token,refresh_token:r.refresh_token,is_new_user:r.is_new_user}}catch(r){let o=ve(r);throw o.privyErrorCode?new _(o.message||"Invalid code during OAuth flow.",void 0,o.privyErrorCode):o.message==="User denied confirmation during OAuth flow"?new _("Invalid code during oauth flow.",void 0,"oauth_user_denied"):new _("Invalid code during OAuth flow.",void 0,"unknown_auth_error")}}async link(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.authorizationCode||!this.meta.stateCode)throw new _("[OAuth AuthFlow] Authorization and state codes code must be set prior to calling link.");if(this.meta.authorizationCode==="undefined")throw new _("User denied confirmation during OAuth flow");let t=ft.get(_n);if(!t)throw new _("Authentication error.");try{let r=await this.api.post(cp,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:t});return ft.del(_n),r}catch(r){throw ve(r)}}createCodeVerifier(){return lc.base64url.encode($p(36))}createStateCode(){return this.createCodeVerifier()}async deriveCodeChallengeFromCodeVerifier(t,r=K1){if(r==Y1){let o=await qp(t);return lc.base64url.encode(o)}else return t}async getAuthorizationUrl(){if(!this.api)throw new _("Auth flow has no API instance");if(!this.meta.provider)throw new _("Provider must be set when initializing OAuth authentication.");let t=this.createCodeVerifier();ft.put(_n,t);let r=this.createStateCode();ft.put(Xo,r);let o=await this.deriveCodeChallengeFromCodeVerifier(t);this.meta.headless&&ft.put(Di,!0);try{return await this.api.post(sp,{provider:this.meta.provider,redirect_to:window.location.href,token:this.meta.captchaToken,code_challenge:o,state_code:r})}catch(n){throw ve(n)}}};function cc(e){return e.charAt(0).toUpperCase()+e.slice(1)}function jp(e,t){let r={detail:"",retryable:!1},o=cc(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 Bi(){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:Ka()}}function Hi(){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"),ft.del(Xo),window.history.replaceState({},"",e)}var on=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}
|
package/package.json
CHANGED