@nexus-cross/connect-kit-react 1.4.1-beta.1 → 1.4.1-beta.2

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.
@@ -1,4 +1,4 @@
1
- var gt="1.4.1-beta.1";var Pt="__nexusCrossAppLauncherRuntime";function Fo(){if(typeof window>"u")return null;let e=window;return e[Pt]??(e[Pt]={mode:"dapp-ui"}),e[Pt]}function Lo(e){if(e.scheduled)return;e.scheduled=!0;let t=()=>{if(e.scheduled=!1,e.loggedMode!==e.mode){if(e.mode==="connect-kit-react"){let n=e.connectKitVersion??gt;console.info(`[CROSSx App Launcher] connect-kit-react v${n} \uCD08\uAE30\uD654 \uC644\uB8CC (dapp-ui v${gt}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${gt} \uCD08\uAE30\uD654 \uC644\uB8CC (\uC0AC\uC6A9 \uBAA8\uB4DC: dapp-ui only)`);e.loggedMode=e.mode}};typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function fn(){let e=Fo();e&&(e.mode="connect-kit-react",e.connectKitVersion=gt,Lo(e))}import{useCallback as Re,useEffect as ne,useMemo as We,useRef as ge,useState as Xe}from"react";import{WagmiProvider as Vo,useAccount as jo,useChainId as Qo,useConnect as zo,useDisconnect as Xo,useSwitchChain as Yo}from"wagmi";import{QueryClient as Jo,QueryClientProvider as Zo}from"@tanstack/react-query";import{attachEmbeddedAuthSync as er,clearWalletSessionStorage as Cn,onOpenOtherWallets as tr,pickInitialState as nr,resolveCurrentWallet as or}from"@nexus-cross/connect-kit-wagmi";import{resolveThemeMode as rr}from"@nexus-cross/connect-kit-core";import{buildDesignSystemCss as sr}from"@nexus-cross/crossx-design-system";import{OnRampProvider as ir}from"@nexus-cross/onramp/react";import{KycProvider as ar}from"@nexus-cross/kyc/react";import{createContext as Uo,useContext as Mo}from"react";var Mt=Uo(null);function Ae(){let e=Mo(Mt);if(!e)throw new Error("useCrossConnectKit must be used within <CrossConnectKitProvider>");return e}import{createContext as Go,useContext as gn}from"react";var St=Go(null);function Ko(){let e=gn(St);if(!e)throw new Error("useCrossConnectKitTheme must be used within <CrossConnectKitProvider>");return e}function yt(){return gn(St)}import{createContext as $o}from"react";var At=$o(null);function yn(){let e=new Set,t=n=>{for(let s of[...e])try{s(n)}catch(o){console.debug("[crossx-kit] analytics handler threw",o)}};return{track:t,emit:n=>t({...n,timestamp:Date.now()}),subscribe:n=>(e.add(n),()=>{e.delete(n)})}}import{useCallback as qo,useMemo as bn}from"react";import{WalletConnectModal as hn}from"@nexus-cross/dapp-ui";import{jsx as wn}from"react/jsx-runtime";var Ho=new Set(["cross_wallet","cross_extension","metamask","binance"]);function Gt({open:e,onOpenChange:t}){let{connect:n,availableWallets:s,oauth:o,extraWallets:c,walletAllowlist:g,kitConfig:y}=Ae(),r=yt()?.mode??"dark",m=bn(()=>{let p=g?new Set(g):null,k={};for(let T of s){if(!Ho.has(T.walletId)||p&&!p.has(T.walletId))continue;let x=T.walletId;k[x]=()=>{n(T.walletId)}}for(let[T,x]of Object.entries(c))x&&(p&&!p.has(T)||(k[T]=x));return k},[s,n,c,g]),b=bn(()=>{if(o)return{apple:()=>{o.signIn("apple")},google:()=>{o.signIn("google")}}},[o]),C=qo(p=>t(p),[t]);return wn(hn,{wallets:m,socialProviders:b,termsUrl:y.legal?.termsUrl,privacyUrl:y.legal?.privacyUrl,theme:r,open:e,onOpenChange:C,children:wn(hn.Content,{})})}import{jsx as Ye,jsxs as vn}from"react/jsx-runtime";var cr=new Jo,Kt="crossx-kit:last-wallet-intent",dr=15e3,lr=1500,ur=3;function kn(e,t){return Promise.race([e.then(()=>{},()=>{}),new Promise(n=>setTimeout(n,t))])}function pr(e){let t=[],n=e,s=0;for(;n&&s<5;){let o=n;typeof o.message=="string"&&t.push(o.message),n=o.cause,s+=1}return t.some(o=>/external wallet connection/i.test(o))}function mr(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Kt)??null}catch{return null}}function Tn(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Kt,e):window.localStorage.removeItem(Kt)}catch{}}function fr(e,t){if(typeof window>"u")return t;try{let n=window.localStorage.getItem(e);return n==="cross"||n==="reown"?n:t}catch{return t}}function gr(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}function yr({children:e,config:t,activeProvider:n,onRequestProviderSwap:s,pendingConnectWalletId:o,clearPending:c,themeMode:g,themeTokens:y,extraWallets:u,walletAllowlist:r,emit:m}){let[b,C]=Xe(!1),[p,k]=Xe(()=>mr()),[T,x]=Xe(null),{address:P,isConnected:v,isConnecting:W,isReconnecting:R,connector:_}=jo(),{connectors:q,connectAsync:U}=zo(),{disconnectAsync:z}=Xo(),{kitConfig:M,connectorRegistry:H,crossProvider:Ee,reownProvider:ke}=t,L=n==="cross"?Ee:ke,O=We(()=>!v||!_?null:or(H,_.id,p),[v,_,H,p]),X=We(()=>H.entries.filter(l=>l.type!=="embedded"),[H]),ee=Re(l=>H.getEntry(l)?.type??"external",[H]),Se=ge(null);Se.current=T;let Ue=ge(O);Ue.current=O;let Ve=ge(P);Ve.current=P;let Me=M.embeddedProjectId?.trim()||M.crossProjectId?.trim(),oe=!!M.onRampEnabled&&!!Me,ue=We(()=>!oe||!Me?null:{projectId:Me,walletState:{getAddress:()=>Ve.current}},[oe,Me]),re=ge(_);re.current=_;let Te=M.embeddedProjectId?.trim()||M.crossProjectId?.trim(),_e=!!M.kycEnabled&&!!Te,je=We(()=>!_e||!Te?null:{projectId:Te,getAccessToken:async()=>{let l=re.current;if(!(!l||typeof l.getProvider!="function"))try{return(await(await l.getProvider())?.sdk?.getUserInfo?.())?.data?.accessToken||void 0}catch{return}}},[_e,Te]);ne(()=>tr(()=>C(!0)),[]),ne(()=>{if(!b||typeof document>"u")return;let l=setTimeout(()=>{document.querySelectorAll("#__crossx-confirm-overlay").forEach(h=>h.remove())},50);return()=>clearTimeout(l)},[b]);let be=ge(v),tt=ge(v);be.current=v;let ve=ge(!1);ne(()=>{console.debug("[crossx-kit] state",{activeProvider:n,isConnected:v,isConnecting:W,isReconnecting:R,activeConnectorId:_?.id,currentWallet:O,lastIntent:p})},[n,v,W,R,_?.id,O,p]),ne(()=>{v&&!tt.current&&L?.closeModal?.({kitConfig:M}),tt.current=v},[v,L,M]),ne(()=>{v&&x(null)},[v]);let Qe=Qo(),{switchChainAsync:nt}=Yo(),Be=ge(null);ne(()=>{if(!M.enforceDefaultNetworkOnConnect)return;let l=M.defaultNetwork?.id;if(!l)return;if(!v||!P||!_){Be.current=null;return}let h=`${_.id}:${P}`;Be.current!==h&&(Be.current=h,Qe!==l&&nt({chainId:l}).catch(()=>{}))},[M.enforceDefaultNetworkOnConnect,M.defaultNetwork,v,P,_,Qe,nt]);let Ge=ge(b);ne(()=>{b&&!Ge.current?m({name:"connect_modal_opened"}):!b&&Ge.current&&m({name:"connect_modal_closed",completed:be.current}),Ge.current=b},[b,m]);let ct=ge(v);ne(()=>{if(v&&!ct.current){let l=Se.current;l&&m({name:"connect_succeeded",walletId:l,walletType:ee(l),chainId:Qe})}ct.current=v},[v,Qe,m,ee]);let i=Re(l=>q.find(h=>h.id===l),[q]);ne(()=>{let l=H.getEntry("cross_embedded");if(!l)return;let h=i(l.connectorId);if(!h)return;let I=!1;return(async()=>{try{let E=await h.getProvider();if(I)return;E?.sdk?.applyTheme?.(g,y??void 0)}catch(E){console.debug("[crossx-kit] applyTheme skipped:",E)}})(),()=>{I=!0}},[H,i,g,y]);let a=Re(l=>{k(l),Tn(l)},[]),d=Re(()=>{k(null),Tn(null),x(null)},[]);ne(()=>{if(!L?.subscribeModalState)return;let l=!1;return L.subscribeModalState({kitConfig:M},h=>{if(ve.current=h,h){l=!0;return}l&&(l=!1,setTimeout(()=>{if(be.current)return;let I=Se.current;I&&m({name:"connect_cancelled",walletId:I,stage:"popup"}),(async()=>{try{await z()}catch{}d()})()},250))})},[L,M,z,d,m]),ne(()=>{if(!T||v||typeof window>"u"||T==="cross_embedded")return;let l=typeof document<"u"&&!document.hasFocus(),h=null,I=()=>{l=!0},E=()=>{l&&(h&&clearTimeout(h),h=setTimeout(()=>{if(be.current||ve.current)return;let B=Se.current;B&&m({name:"connect_cancelled",walletId:B,stage:"popup"}),(async()=>{try{await z()}catch{}d()})()},1e3))};return window.addEventListener("blur",I),window.addEventListener("focus",E),()=>{window.removeEventListener("blur",I),window.removeEventListener("focus",E),h&&clearTimeout(h)}},[T,v,z,d,m]);let f=Re(async l=>{console.debug("[crossx-kit] runConnect enter",{walletId:l,activeProvider:n,isConnected:v,activeConnectorId:_?.id});let h=H.getEntry(l);if(!h){if((l==="metamask"||l==="binance")&&!ke){console.error(`[crossx-kit] "${l}" requires the Reown adapter, but it is not configured. Pass \`reownProjectId\` (and ensure \`reown\` is not set to \`false\`) when calling createConnectKitConfig() or createCrossxConfig() to enable WalletConnect-based wallets.`);return}console.error(`[crossx-kit] Unknown walletId: "${l}"`);return}if(x(l),h.providerKind!==n){console.debug("[crossx-kit] provider swap needed",{from:n,to:h.providerKind,walletId:l}),a(l);try{await z()}catch{}await new Promise(B=>setTimeout(B,0)),s(h.providerKind,l);return}let I=ee(l);if(m({name:"wallet_selected",walletId:l,walletType:I}),m({name:"connect_started",walletId:l,walletType:I}),a(l),L?.beforeConnect)try{let B=await L.beforeConnect({kitConfig:M,themeMode:g},l);if(console.debug("[crossx-kit] beforeConnect result",{walletId:l,result:B}),B==="handled")return}catch(B){console.warn('[crossx-kit] adapter.beforeConnect threw for "%s":',l,B)}let E=i(h.connectorId);if(console.debug("[crossx-kit] findConnector",{lookupId:h.connectorId,found:E?.id,availableIds:q.map(B=>B.id)}),!E){console.error(`[crossx-kit] Connector "${h.connectorId}" not found on provider "${h.providerKind}". Available: ${q.map(B=>B.id).join(", ")}`),m({name:"connect_failed",walletId:l,reason:"connector_not_found"}),d();return}try{console.debug("[crossx-kit] connectAsync start",{connectorId:E.id});let B=await U({connector:E});console.debug("[crossx-kit] connectAsync resolved",{accountsLen:B.accounts.length,chainId:B.chainId});return}catch(B){let Ie=pr(B);if(!Ie){console.error('[crossx-kit] connectAsync error for "%s":',l,B);try{await z()}catch{}}if(!h.fallbackConnectorId){Ie||m({name:"connect_failed",walletId:l,reason:"connector_error"}),d();return}}if(h.fallbackConnectorId){let B=i(h.fallbackConnectorId);if(B)try{await U({connector:B})}catch(Ie){console.error('[crossx-kit] Fallback connect failed for "%s":',l,Ie);try{await z()}catch{}m({name:"connect_failed",walletId:l,reason:"fallback_failed"}),d()}else m({name:"connect_failed",walletId:l,reason:"fallback_failed"}),d()}},[H,q,i,U,z,a,d,L,n,M,s,g,m,ee]);ne(()=>{if(!o)return;let l=o;c(),f(l)},[o,n]);let w=Re(async()=>{C(!0)},[]),N=Re(async()=>{m({name:"disconnected",walletId:Ue.current});try{await z()}catch(l){console.error("[crossx-kit] wagmi disconnect error:",l)}if(L?.teardown)try{await L.teardown({kitConfig:M})}catch(l){console.error("[crossx-kit] adapter teardown error:",l)}Cn(),d()},[z,L,M,d,m]),D=Re(async()=>{await kn(z(),3e3);try{let l=H.getEntry("cross_embedded"),h=l&&i(l.connectorId);if(h?.getProvider){let I=await Promise.race([h.getProvider(),new Promise(B=>setTimeout(B,3e3))]),E=I?.sdk?.signOut;typeof E=="function"&&await kn(E.call(I.sdk),3e3)}}catch{}Cn()},[H,i,z]),A=Re(async()=>{let l=H.getEntry("cross_embedded");if(!l)return null;let h=i(l.connectorId);if(!h)return null;try{let I=await h.getProvider(),E=I?.sdk;if(!E?.selectWallet)return null;let B=await E.selectWallet(E.currentAddress??void 0);return B?.address&&I.notifyAccountsChanged&&I.notifyAccountsChanged([B.address]),B&&m({name:"wallet_switched",index:B.index}),B}catch{return null}},[H,i,m]),G=We(()=>{let l=t.oauth;return l?{signIn:async h=>{x("cross_embedded"),m({name:"wallet_selected",walletId:"cross_embedded",walletType:"embedded"}),m({name:"connect_started",walletId:"cross_embedded",walletType:"embedded"});try{await l.signIn(h)}catch(I){throw m({name:"connect_cancelled",walletId:"cross_embedded",stage:"popup"}),x(null),I}}}:null},[t.oauth,m]),Y=ge(!1);ne(()=>{if(n!=="cross"||v||W||R||T!=null||Y.current)return;let l=H.getEntry("cross_embedded");if(!l)return;let h=i(l.connectorId);if(!h)return;Y.current=!0;let I=!1;return(async()=>{try{let E=await h.isAuthorized?.();if(I||!E)return;await U({connector:h})}catch{}})(),()=>{I=!0}},[n,v,W,R,T,H,i,U]);let S=ge(0);ne(()=>{if(n!=="cross"||v||!W&&!R||S.current>=ur)return;let l=H.getEntry("cross_embedded");if(!l)return;let h=i(l.connectorId);if(!h)return;let I=!1,E=setInterval(()=>{(async()=>{if(I||be.current)return;let B=await Promise.resolve(h.isAuthorized?.()).catch(()=>!1);if(!(I||!B||be.current)){S.current+=1,console.warn("[crossx-kit] wagmi reconnect stalled while the SDK holds a session \u2014 forcing an explicit connect to realign");try{await U({connector:h})}catch{}}})()},lr);return()=>{I=!0,clearInterval(E)}},[n,v,W,R,H,i,U]),ne(()=>{if(T!=="cross_embedded"||v||typeof window>"u")return;let l=!document.hasFocus(),h=()=>{l=!0};window.addEventListener("blur",h);let I=setTimeout(()=>{be.current||l||(console.warn("[crossx-kit] embedded sign-in stalled before the OAuth popup opened \u2014 clearing the stale session so a retry starts clean"),m({name:"connect_cancelled",walletId:"cross_embedded",stage:"stalled"}),d(),D())},dr);return()=>{window.removeEventListener("blur",h),clearTimeout(I)}},[T,v,d,D,m]);let F=T!=null&&!v,V=We(()=>({kitConfig:M,connectorRegistry:H,availableWallets:X,connect:f,connectWallet:w,disconnect:N,selectWallet:A,currentWallet:O,lastIntent:p,isConnecting:F,connectingWalletId:T,openOtherWallets:()=>C(!0),closeOtherWallets:()=>C(!1),otherWalletsOpen:b,oauth:G,extraWallets:u,walletAllowlist:r,onRampEnabled:oe}),[M,H,X,f,w,N,A,O,p,F,T,b,G,u,r,oe]),j=vn(Mt.Provider,{value:V,children:[e,Ye(Gt,{open:b,onOpenChange:C})]});return je&&(j=Ye(ar,{config:je,children:j})),ue&&(j=Ye(ir,{config:ue,children:j})),j}var br=[/Connection interrupted while trying to subscribe/i,/No matching key\. subscription:/i,/Proposal expired/i];function hr(e){let t=e?.message;return typeof t!="string"?!1:br.some(n=>n.test(t))}var wr={};function Cr(e){return e&&{...e,connections:new Map,current:null}}function kr({children:e,config:t,initialState:n,extraWallets:s=wr,walletAllowlist:o}){let[c,g]=Xe(()=>fr(t.activeProviderStorageKey,t.defaultProvider)),[y,u]=Xe(null),r=ge(!1),m=ge(null);m.current||(m.current=yn());let b=m.current,C=We(()=>({subscribe:b.subscribe}),[b]),{kitConfig:p}=t,[k,T]=Xe(null),[x,P]=Xe(null),[v,W]=Xe(0),R=We(()=>rr(p.theme,p.autoDetectTheme),[p.theme,p.autoDetectTheme,v]),_=k??R,q=x??p.themeTokens;ne(()=>{if(!p.autoDetectTheme||k||typeof window>"u"||!window.matchMedia)return;let O=window.matchMedia("(prefers-color-scheme: dark)"),X=()=>W(ee=>ee+1);try{return O.addEventListener("change",X),()=>O.removeEventListener("change",X)}catch{return O.addListener(X),()=>O.removeListener(X)}},[p.autoDetectTheme,k]),ne(()=>{if(typeof document>"u")return;let O=document.documentElement,X=O.getAttribute("data-ds-theme"),ee=O.getAttribute("data-theme");return O.setAttribute("data-ds-theme",_),ee||O.setAttribute("data-theme",_),()=>{X==null?O.removeAttribute("data-ds-theme"):O.setAttribute("data-ds-theme",X),ee==null&&O.removeAttribute("data-theme")}},[_]);let U=We(()=>sr(t.designSystem),[t.designSystem]),z=We(()=>({mode:_,tokens:q,setThemeMode:O=>T(O),setThemeTokens:O=>P(O)}),[_,q]);ne(()=>{if(typeof window>"u")return;let O=X=>{hr(X.reason)&&X.preventDefault()};return window.addEventListener("unhandledrejection",O),()=>window.removeEventListener("unhandledrejection",O)},[]),ne(()=>{if(c!=="cross")return;let O=t.crossWagmiConfig;if(O)return er(O)},[c,t.crossWagmiConfig]);let M=Re((O,X)=>{r.current||(r.current=!0,u(X),g(O),gr(t.activeProviderStorageKey,O),queueMicrotask(()=>{r.current=!1}))},[t.activeProviderStorageKey]),H=Re(()=>u(null),[]),Ee=c==="cross"?t.crossWagmiConfig:t.reownWagmiConfig,ke=Cr(nr(n,c));if(!Ee){if(!(c==="cross"?t.reownWagmiConfig:t.crossWagmiConfig))throw new Error("[crossx-kit] createCrossxConfig returned no wagmi Config for either side");let X=c==="cross"?"reown":"cross";queueMicrotask(()=>g(X))}let L=Ee??(c==="cross"?t.reownWagmiConfig:t.crossWagmiConfig);return Ye(At.Provider,{value:C,children:vn(St.Provider,{value:z,children:[Ye("style",{"data-crossx-design-system":"",children:U}),Ye(Vo,{config:L,initialState:ke,children:Ye(Zo,{client:cr,children:Ye(yr,{config:t,activeProvider:c,onRequestProviderSwap:M,pendingConnectWalletId:y,clearPending:H,themeMode:_,themeTokens:q,extraWallets:s,walletAllowlist:o??t.kitConfig.wallets??null,emit:b.emit,children:e})})},c)]})})}import{useCallback as He,useEffect as ri,useMemo as Tt,useState as si}from"react";import{useQueryClient as ii}from"@tanstack/react-query";import{useAccount as ai,useChainId as ci,useConfig as di,useSendTransaction as li,useSwitchChain as ui}from"wagmi";import{getPublicClient as Zt,readContracts as no}from"wagmi/actions";import{WalletInfo as en,ConnectorId as et,OnePopGetTokenTrigger as pi,resolveEnvironment as mi,WALLET_REGISTRY as fi}from"@nexus-cross/dapp-ui";import{useOptionalOnRamp as gi,useOptionalOnRampEligibility as yi}from"@nexus-cross/onramp/react";import{APPLE_ICON as rn,BINANCE_ICON as so,CROSSX_ICON as on,EXTENSION_ICON as bi,GOOGLE_ICON as io,METAMASK_ICON as ao}from"@nexus-cross/connect-kit-wagmi";import{WALLET_LABELS as vt}from"@nexus-cross/crossx-design-system";import{useCallback as Us,useMemo as zn}from"react";import{useAccount as Ms,useConfig as Gs}from"wagmi";import{waitForTransactionReceipt as Ks}from"wagmi/actions";import{GetOneUsd as $s,resolveEnvironment as qs}from"@nexus-cross/dapp-ui";import{useCallback as ie,useMemo as Ce,useRef as Tr}from"react";import{useQueries as Pn,useQuery as Je}from"@tanstack/react-query";import{encodeFunctionData as bt,formatUnits as Nt,parseSignature as vr,parseUnits as Ir}from"viem";import{getChainId as $t,getPublicClient as Mn,readContract as Oe,signTypedData as xr,switchChain as Sn,waitForTransactionReceipt as Pr,writeContract as An}from"wagmi/actions";import{useConfig as Sr}from"wagmi";async function Rt(e,t,n){if(!(!n||t===void 0))try{if(e.getChainId()===t)return;await e.switchChain(t)}catch{}}var ut=10000n;function In(e){let t=e==="auto"?1:Number(e||"1");return!Number.isFinite(t)||t<0?100n:BigInt(Math.min(1e4,Math.floor(t*100)))}function Ot(e,t){let n=In(t);return n>=ut?0n:e*(ut-n)/ut}function xn(e,t){let n=In(t);return(e*(ut+n)+(ut-1n))/ut}function Ar(e){return e!=="bridge"}var qe="0x0000000000000000000000000000000000000000",Pe=100,mt=18,Rr=180000n,Or=500000n,Gn=new Set([56,97]),Er=130n,_r=100n,Br={dev:"https://stg-contents.crosstoken.io/frontend/game-token/json/hidden-path.json",stage:"https://stg-contents.crosstoken.io/frontend/game-token/json/hidden-path.json",production:"https://contents.crosstoken.io/frontend/game-token/json/hidden-path.json"},Nr={dev:"dev",stage:"stg",production:"prod"};function Wr(e,t){let n=e?.[Nr[t]]?.hiddenPairs;if(!Array.isArray(n))return null;let s=n.filter(o=>!!o&&typeof o=="object"&&typeof o.fromKey=="string"&&typeof o.toKey=="string");return s.length>0?s:null}var Dr={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/contracts.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/contracts.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/contracts.json"},Fr=["BSC_CROSS","W_CROSS","NATIVE_CROSS","USDTX","CROSSD","USDTB","SWAP_BRIDGE_ROUTER"],Lr={BSC_CROSS:qe,W_CROSS:qe,NATIVE_CROSS:qe,USDTX:qe,CROSSD:qe,USDTB:qe,SWAP_BRIDGE_ROUTER:qe},Ur=/^0x[0-9a-fA-F]{40}$/;function Mr(e,t){let n=typeof e=="string"?e:e?.[t];return typeof n=="string"&&Ur.test(n)?n:null}function Gr(e,t){if(!e?.bridge)return null;let n=e.envToNetwork?.[t]??(t==="production"?"mainnet":"testnet"),s={};for(let o of Fr){let c=Mr(e.bridge[o],n);if(!c)return null;s[o]=c}return s}var Kr={dev:{bridgeApi:"https://stg-bridge-api.crosstoken.io/bridge",walletApi:"https://stg-wallet-server.crosstoken.io/api",chainIds:{cross:612044,bsc:97}},stage:{bridgeApi:"https://stg-bridge-api.crosstoken.io/bridge",walletApi:"https://stg-wallet-server.crosstoken.io/api",chainIds:{cross:612044,bsc:97}},production:{bridgeApi:"https://bridge-api.crosstoken.io/bridge",walletApi:"https://wallet-server.crosstoken.io/api",chainIds:{cross:612055,bsc:56}}},rt=[{type:"function",name:"quoter",stateMutability:"view",inputs:[],outputs:[{name:"",type:"address"}]},{type:"function",name:"swapRouter",stateMutability:"view",inputs:[],outputs:[{name:"",type:"address"}]},{type:"function",name:"getAmountSwapBridgeOut",stateMutability:"view",inputs:[{name:"toChainID",type:"uint256"},{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"amountIn",type:"uint256"}],outputs:[{name:"ok",type:"bool"},{name:"swapAmountOut",type:"uint256"},{name:"bridgeValue",type:"uint256"},{name:"networkFee",type:"uint256"},{name:"exFee",type:"uint256"}]},{type:"function",name:"getAmountSwapBridgeIn",stateMutability:"view",inputs:[{name:"toChainID",type:"uint256"},{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"bridgeValue",type:"uint256"}],outputs:[{name:"ok",type:"bool"},{name:"amountIn",type:"uint256"},{name:"swapAmountOut",type:"uint256"},{name:"networkFee",type:"uint256"},{name:"exFee",type:"uint256"}]},{type:"function",name:"swapBridgeExactInputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"amountIn",type:"uint256"},{name:"amountOutMinimum",type:"uint256"},{name:"sqrtPriceLimitX96",type:"uint160"},{name:"bridgeParams",type:"tuple",components:[{name:"toChainID",type:"uint256"},{name:"recipient",type:"address"},{name:"extraData",type:"bytes"}]}]},{name:"deadline",type:"uint256"}],outputs:[{name:"amountOut",type:"uint256"}]},{type:"function",name:"swapBridgeExactOutputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"amountOut",type:"uint256"},{name:"amountInMaximum",type:"uint256"},{name:"sqrtPriceLimitX96",type:"uint160"},{name:"bridgeParams",type:"tuple",components:[{name:"toChainID",type:"uint256"},{name:"recipient",type:"address"},{name:"extraData",type:"bytes"}]}]},{name:"deadline",type:"uint256"}],outputs:[{name:"amountIn",type:"uint256"}]}],qt=[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],Rn=[{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"nonces",stateMutability:"view",inputs:[{name:"owner",type:"address"}],outputs:[{name:"",type:"uint256"}]}],On=[{type:"function",name:"quoteExactInputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"amountIn",type:"uint256"},{name:"fee",type:"uint24"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountOut",type:"uint256"},{name:"sqrtPriceX96After",type:"uint160"},{name:"initializedTicksCrossed",type:"uint32"},{name:"gasEstimate",type:"uint256"}]},{type:"function",name:"quoteExactOutputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"amount",type:"uint256"},{name:"fee",type:"uint24"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountIn",type:"uint256"},{name:"sqrtPriceX96After",type:"uint160"},{name:"initializedTicksCrossed",type:"uint32"},{name:"gasEstimate",type:"uint256"}]}],$r=[{type:"function",name:"slot0",stateMutability:"view",inputs:[],outputs:[{name:"sqrtPriceX96",type:"uint160"},{name:"tick",type:"int24"},{name:"observationIndex",type:"uint16"},{name:"observationCardinality",type:"uint16"},{name:"observationCardinalityNext",type:"uint16"},{name:"feeProtocol",type:"uint8"},{name:"unlocked",type:"bool"}]}],Ke=[{type:"function",name:"exactInputSingle",stateMutability:"payable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"recipient",type:"address"},{name:"deadline",type:"uint256"},{name:"amountIn",type:"uint256"},{name:"amountOutMinimum",type:"uint256"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountOut",type:"uint256"}]},{type:"function",name:"multicall",stateMutability:"payable",inputs:[{name:"data",type:"bytes[]"}],outputs:[{name:"results",type:"bytes[]"}]},{type:"function",name:"unwrapWETH9",stateMutability:"payable",inputs:[{name:"amountMinimum",type:"uint256"},{name:"recipient",type:"address"}],outputs:[]},{type:"function",name:"refundETH",stateMutability:"payable",inputs:[],outputs:[]}],qr=[{type:"function",name:"bridgeToken",stateMutability:"payable",inputs:[{name:"toChainID",type:"uint256"},{name:"fromToken",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"gasFee",type:"uint256"},{name:"exFee",type:"uint256"},{name:"extraData",type:"bytes"}],outputs:[{name:"",type:"bool"}]}];async function Kn(e){let t="";try{t=await e.text()}catch{}if(t){try{let n=JSON.parse(t),s=typeof n.data=="string"&&n.data||typeof n.message=="string"&&n.message||"";if(s)return`${s} (status ${e.status})`}catch{}return`${t.slice(0,300)} (status ${e.status})`}return`status ${e.status}`}async function De(e,t){let n=await fetch(e,{cache:"no-store",signal:t});if(!n.ok)throw new Error(`CrossD bridge adapter request failed: ${await Kn(n)}`);let s=await n.json();if(s&&typeof s=="object"&&"code"in s&&typeof s.code=="number"&&s.code!==200)throw new Error(s.message||`CrossD bridge adapter API error: ${s.code}`);return s&&typeof s=="object"&&"data"in s?s.data:s}async function En(e,t,n){let s=await fetch(e,{method:"POST",cache:"no-store",signal:n,headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error(`CrossD bridge adapter request failed: ${await Kn(s)}`);let o=await s.json();if(o&&typeof o=="object"&&"code"in o&&typeof o.code=="number"&&o.code!==200)throw new Error(o.message||`CrossD bridge adapter API error: ${o.code}`);return o&&typeof o=="object"&&"data"in o?o.data:o}function Hr(e){return new Promise(t=>setTimeout(t,e))}async function Vr(e,t,{attempts:n=60,intervalMs:s=2e3}={}){for(let o=0;o<n;o+=1){try{let c=await De(`${e}/permit-hash/${t}`);if(jt(c))return c}catch{}await Hr(s)}return null}function ce(e,t){return`${e}-${t.toLowerCase()}`}function fe(e){return ce(e.chainId,e.address)}function Fe(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function jr(e){let t=e instanceof Error?e.message:typeof e=="string"?e:"",n=t.toLowerCase();return n.includes("quoteexactinputsingle")||n.includes("quoteexactoutputsingle")||n.includes("getamountswapbridgeout")||n.includes("getamountswapbridgein")||n.includes("execution reverted")?"Amount is too large for this route.":t.split(`
1
+ var gt="1.4.1-beta.2";var Pt="__nexusCrossAppLauncherRuntime";function Fo(){if(typeof window>"u")return null;let e=window;return e[Pt]??(e[Pt]={mode:"dapp-ui"}),e[Pt]}function Lo(e){if(e.scheduled)return;e.scheduled=!0;let t=()=>{if(e.scheduled=!1,e.loggedMode!==e.mode){if(e.mode==="connect-kit-react"){let n=e.connectKitVersion??gt;console.info(`[CROSSx App Launcher] connect-kit-react v${n} \uCD08\uAE30\uD654 \uC644\uB8CC (dapp-ui v${gt}, \uC0AC\uC6A9 \uBAA8\uB4DC: connect-kit)`)}else console.info(`[CROSSx App Launcher] dapp-ui v${gt} \uCD08\uAE30\uD654 \uC644\uB8CC (\uC0AC\uC6A9 \uBAA8\uB4DC: dapp-ui only)`);e.loggedMode=e.mode}};typeof queueMicrotask=="function"?queueMicrotask(t):Promise.resolve().then(t)}function fn(){let e=Fo();e&&(e.mode="connect-kit-react",e.connectKitVersion=gt,Lo(e))}import{useCallback as Re,useEffect as ne,useMemo as We,useRef as ge,useState as Xe}from"react";import{WagmiProvider as Vo,useAccount as jo,useChainId as Qo,useConnect as zo,useDisconnect as Xo,useSwitchChain as Yo}from"wagmi";import{QueryClient as Jo,QueryClientProvider as Zo}from"@tanstack/react-query";import{attachEmbeddedAuthSync as er,clearWalletSessionStorage as Cn,onOpenOtherWallets as tr,pickInitialState as nr,resolveCurrentWallet as or}from"@nexus-cross/connect-kit-wagmi";import{resolveThemeMode as rr}from"@nexus-cross/connect-kit-core";import{buildDesignSystemCss as sr}from"@nexus-cross/crossx-design-system";import{OnRampProvider as ir}from"@nexus-cross/onramp/react";import{KycProvider as ar}from"@nexus-cross/kyc/react";import{createContext as Uo,useContext as Mo}from"react";var Mt=Uo(null);function Ae(){let e=Mo(Mt);if(!e)throw new Error("useCrossConnectKit must be used within <CrossConnectKitProvider>");return e}import{createContext as Go,useContext as gn}from"react";var St=Go(null);function Ko(){let e=gn(St);if(!e)throw new Error("useCrossConnectKitTheme must be used within <CrossConnectKitProvider>");return e}function yt(){return gn(St)}import{createContext as $o}from"react";var At=$o(null);function yn(){let e=new Set,t=n=>{for(let s of[...e])try{s(n)}catch(o){console.debug("[crossx-kit] analytics handler threw",o)}};return{track:t,emit:n=>t({...n,timestamp:Date.now()}),subscribe:n=>(e.add(n),()=>{e.delete(n)})}}import{useCallback as qo,useMemo as bn}from"react";import{WalletConnectModal as hn}from"@nexus-cross/dapp-ui";import{jsx as wn}from"react/jsx-runtime";var Ho=new Set(["cross_wallet","cross_extension","metamask","binance"]);function Gt({open:e,onOpenChange:t}){let{connect:n,availableWallets:s,oauth:o,extraWallets:c,walletAllowlist:g,kitConfig:y}=Ae(),r=yt()?.mode??"dark",m=bn(()=>{let p=g?new Set(g):null,k={};for(let T of s){if(!Ho.has(T.walletId)||p&&!p.has(T.walletId))continue;let x=T.walletId;k[x]=()=>{n(T.walletId)}}for(let[T,x]of Object.entries(c))x&&(p&&!p.has(T)||(k[T]=x));return k},[s,n,c,g]),b=bn(()=>{if(o)return{apple:()=>{o.signIn("apple")},google:()=>{o.signIn("google")}}},[o]),C=qo(p=>t(p),[t]);return wn(hn,{wallets:m,socialProviders:b,termsUrl:y.legal?.termsUrl,privacyUrl:y.legal?.privacyUrl,theme:r,open:e,onOpenChange:C,children:wn(hn.Content,{})})}import{jsx as Ye,jsxs as vn}from"react/jsx-runtime";var cr=new Jo,Kt="crossx-kit:last-wallet-intent",dr=15e3,lr=1500,ur=3;function kn(e,t){return Promise.race([e.then(()=>{},()=>{}),new Promise(n=>setTimeout(n,t))])}function pr(e){let t=[],n=e,s=0;for(;n&&s<5;){let o=n;typeof o.message=="string"&&t.push(o.message),n=o.cause,s+=1}return t.some(o=>/external wallet connection/i.test(o))}function mr(){if(typeof window>"u")return null;try{return window.localStorage.getItem(Kt)??null}catch{return null}}function Tn(e){if(!(typeof window>"u"))try{e?window.localStorage.setItem(Kt,e):window.localStorage.removeItem(Kt)}catch{}}function fr(e,t){if(typeof window>"u")return t;try{let n=window.localStorage.getItem(e);return n==="cross"||n==="reown"?n:t}catch{return t}}function gr(e,t){if(!(typeof window>"u"))try{window.localStorage.setItem(e,t)}catch{}}function yr({children:e,config:t,activeProvider:n,onRequestProviderSwap:s,pendingConnectWalletId:o,clearPending:c,themeMode:g,themeTokens:y,extraWallets:u,walletAllowlist:r,emit:m}){let[b,C]=Xe(!1),[p,k]=Xe(()=>mr()),[T,x]=Xe(null),{address:P,isConnected:v,isConnecting:W,isReconnecting:R,connector:_}=jo(),{connectors:q,connectAsync:U}=zo(),{disconnectAsync:z}=Xo(),{kitConfig:M,connectorRegistry:H,crossProvider:Ee,reownProvider:ke}=t,L=n==="cross"?Ee:ke,O=We(()=>!v||!_?null:or(H,_.id,p),[v,_,H,p]),X=We(()=>H.entries.filter(l=>l.type!=="embedded"),[H]),ee=Re(l=>H.getEntry(l)?.type??"external",[H]),Se=ge(null);Se.current=T;let Ue=ge(O);Ue.current=O;let Ve=ge(P);Ve.current=P;let Me=M.embeddedProjectId?.trim()||M.crossProjectId?.trim(),oe=!!M.onRampEnabled&&!!Me,ue=We(()=>!oe||!Me?null:{projectId:Me,walletState:{getAddress:()=>Ve.current}},[oe,Me]),re=ge(_);re.current=_;let Te=M.embeddedProjectId?.trim()||M.crossProjectId?.trim(),_e=!!M.kycEnabled&&!!Te,je=We(()=>!_e||!Te?null:{projectId:Te,getAccessToken:async()=>{let l=re.current;if(!(!l||typeof l.getProvider!="function"))try{return(await(await l.getProvider())?.sdk?.getUserInfo?.())?.data?.accessToken||void 0}catch{return}}},[_e,Te]);ne(()=>tr(()=>C(!0)),[]),ne(()=>{if(!b||typeof document>"u")return;let l=setTimeout(()=>{document.querySelectorAll("#__crossx-confirm-overlay").forEach(h=>h.remove())},50);return()=>clearTimeout(l)},[b]);let be=ge(v),tt=ge(v);be.current=v;let ve=ge(!1);ne(()=>{console.debug("[crossx-kit] state",{activeProvider:n,isConnected:v,isConnecting:W,isReconnecting:R,activeConnectorId:_?.id,currentWallet:O,lastIntent:p})},[n,v,W,R,_?.id,O,p]),ne(()=>{v&&!tt.current&&L?.closeModal?.({kitConfig:M}),tt.current=v},[v,L,M]),ne(()=>{v&&x(null)},[v]);let Qe=Qo(),{switchChainAsync:nt}=Yo(),Be=ge(null);ne(()=>{if(!M.enforceDefaultNetworkOnConnect)return;let l=M.defaultNetwork?.id;if(!l)return;if(!v||!P||!_){Be.current=null;return}let h=`${_.id}:${P}`;Be.current!==h&&(Be.current=h,Qe!==l&&nt({chainId:l}).catch(()=>{}))},[M.enforceDefaultNetworkOnConnect,M.defaultNetwork,v,P,_,Qe,nt]);let Ge=ge(b);ne(()=>{b&&!Ge.current?m({name:"connect_modal_opened"}):!b&&Ge.current&&m({name:"connect_modal_closed",completed:be.current}),Ge.current=b},[b,m]);let ct=ge(v);ne(()=>{if(v&&!ct.current){let l=Se.current;l&&m({name:"connect_succeeded",walletId:l,walletType:ee(l),chainId:Qe})}ct.current=v},[v,Qe,m,ee]);let i=Re(l=>q.find(h=>h.id===l),[q]);ne(()=>{let l=H.getEntry("cross_embedded");if(!l)return;let h=i(l.connectorId);if(!h)return;let I=!1;return(async()=>{try{let E=await h.getProvider();if(I)return;E?.sdk?.applyTheme?.(g,y??void 0)}catch(E){console.debug("[crossx-kit] applyTheme skipped:",E)}})(),()=>{I=!0}},[H,i,g,y]);let a=Re(l=>{k(l),Tn(l)},[]),d=Re(()=>{k(null),Tn(null),x(null)},[]);ne(()=>{if(!L?.subscribeModalState)return;let l=!1;return L.subscribeModalState({kitConfig:M},h=>{if(ve.current=h,h){l=!0;return}l&&(l=!1,setTimeout(()=>{if(be.current)return;let I=Se.current;I&&m({name:"connect_cancelled",walletId:I,stage:"popup"}),(async()=>{try{await z()}catch{}d()})()},250))})},[L,M,z,d,m]),ne(()=>{if(!T||v||typeof window>"u"||T==="cross_embedded")return;let l=typeof document<"u"&&!document.hasFocus(),h=null,I=()=>{l=!0},E=()=>{l&&(h&&clearTimeout(h),h=setTimeout(()=>{if(be.current||ve.current)return;let B=Se.current;B&&m({name:"connect_cancelled",walletId:B,stage:"popup"}),(async()=>{try{await z()}catch{}d()})()},1e3))};return window.addEventListener("blur",I),window.addEventListener("focus",E),()=>{window.removeEventListener("blur",I),window.removeEventListener("focus",E),h&&clearTimeout(h)}},[T,v,z,d,m]);let f=Re(async l=>{console.debug("[crossx-kit] runConnect enter",{walletId:l,activeProvider:n,isConnected:v,activeConnectorId:_?.id});let h=H.getEntry(l);if(!h){if((l==="metamask"||l==="binance")&&!ke){console.error(`[crossx-kit] "${l}" requires the Reown adapter, but it is not configured. Pass \`reownProjectId\` (and ensure \`reown\` is not set to \`false\`) when calling createConnectKitConfig() or createCrossxConfig() to enable WalletConnect-based wallets.`);return}console.error(`[crossx-kit] Unknown walletId: "${l}"`);return}if(x(l),h.providerKind!==n){console.debug("[crossx-kit] provider swap needed",{from:n,to:h.providerKind,walletId:l}),a(l);try{await z()}catch{}await new Promise(B=>setTimeout(B,0)),s(h.providerKind,l);return}let I=ee(l);if(m({name:"wallet_selected",walletId:l,walletType:I}),m({name:"connect_started",walletId:l,walletType:I}),a(l),L?.beforeConnect)try{let B=await L.beforeConnect({kitConfig:M,themeMode:g},l);if(console.debug("[crossx-kit] beforeConnect result",{walletId:l,result:B}),B==="handled")return}catch(B){console.warn('[crossx-kit] adapter.beforeConnect threw for "%s":',l,B)}let E=i(h.connectorId);if(console.debug("[crossx-kit] findConnector",{lookupId:h.connectorId,found:E?.id,availableIds:q.map(B=>B.id)}),!E){console.error(`[crossx-kit] Connector "${h.connectorId}" not found on provider "${h.providerKind}". Available: ${q.map(B=>B.id).join(", ")}`),m({name:"connect_failed",walletId:l,reason:"connector_not_found"}),d();return}try{console.debug("[crossx-kit] connectAsync start",{connectorId:E.id});let B=await U({connector:E});console.debug("[crossx-kit] connectAsync resolved",{accountsLen:B.accounts.length,chainId:B.chainId});return}catch(B){let Ie=pr(B);if(!Ie){console.error('[crossx-kit] connectAsync error for "%s":',l,B);try{await z()}catch{}}if(!h.fallbackConnectorId){Ie||m({name:"connect_failed",walletId:l,reason:"connector_error"}),d();return}}if(h.fallbackConnectorId){let B=i(h.fallbackConnectorId);if(B)try{await U({connector:B})}catch(Ie){console.error('[crossx-kit] Fallback connect failed for "%s":',l,Ie);try{await z()}catch{}m({name:"connect_failed",walletId:l,reason:"fallback_failed"}),d()}else m({name:"connect_failed",walletId:l,reason:"fallback_failed"}),d()}},[H,q,i,U,z,a,d,L,n,M,s,g,m,ee]);ne(()=>{if(!o)return;let l=o;c(),f(l)},[o,n]);let w=Re(async()=>{C(!0)},[]),N=Re(async()=>{m({name:"disconnected",walletId:Ue.current});try{await z()}catch(l){console.error("[crossx-kit] wagmi disconnect error:",l)}if(L?.teardown)try{await L.teardown({kitConfig:M})}catch(l){console.error("[crossx-kit] adapter teardown error:",l)}Cn(),d()},[z,L,M,d,m]),D=Re(async()=>{await kn(z(),3e3);try{let l=H.getEntry("cross_embedded"),h=l&&i(l.connectorId);if(h?.getProvider){let I=await Promise.race([h.getProvider(),new Promise(B=>setTimeout(B,3e3))]),E=I?.sdk?.signOut;typeof E=="function"&&await kn(E.call(I.sdk),3e3)}}catch{}Cn()},[H,i,z]),A=Re(async()=>{let l=H.getEntry("cross_embedded");if(!l)return null;let h=i(l.connectorId);if(!h)return null;try{let I=await h.getProvider(),E=I?.sdk;if(!E?.selectWallet)return null;let B=await E.selectWallet(E.currentAddress??void 0);return B?.address&&I.notifyAccountsChanged&&I.notifyAccountsChanged([B.address]),B&&m({name:"wallet_switched",index:B.index}),B}catch{return null}},[H,i,m]),G=We(()=>{let l=t.oauth;return l?{signIn:async h=>{x("cross_embedded"),m({name:"wallet_selected",walletId:"cross_embedded",walletType:"embedded"}),m({name:"connect_started",walletId:"cross_embedded",walletType:"embedded"});try{await l.signIn(h)}catch(I){throw m({name:"connect_cancelled",walletId:"cross_embedded",stage:"popup"}),x(null),I}}}:null},[t.oauth,m]),Y=ge(!1);ne(()=>{if(n!=="cross"||v||W||R||T!=null||Y.current)return;let l=H.getEntry("cross_embedded");if(!l)return;let h=i(l.connectorId);if(!h)return;Y.current=!0;let I=!1;return(async()=>{try{let E=await h.isAuthorized?.();if(I||!E)return;await U({connector:h})}catch{}})(),()=>{I=!0}},[n,v,W,R,T,H,i,U]);let S=ge(0);ne(()=>{if(n!=="cross"||v||!W&&!R||S.current>=ur)return;let l=H.getEntry("cross_embedded");if(!l)return;let h=i(l.connectorId);if(!h)return;let I=!1,E=setInterval(()=>{(async()=>{if(I||be.current)return;let B=await Promise.resolve(h.isAuthorized?.()).catch(()=>!1);if(!(I||!B||be.current)){S.current+=1,console.warn("[crossx-kit] wagmi reconnect stalled while the SDK holds a session \u2014 forcing an explicit connect to realign");try{await U({connector:h})}catch{}}})()},lr);return()=>{I=!0,clearInterval(E)}},[n,v,W,R,H,i,U]),ne(()=>{if(T!=="cross_embedded"||v||typeof window>"u")return;let l=!document.hasFocus(),h=()=>{l=!0};window.addEventListener("blur",h);let I=setTimeout(()=>{be.current||l||(console.warn("[crossx-kit] embedded sign-in stalled before the OAuth popup opened \u2014 clearing the stale session so a retry starts clean"),m({name:"connect_cancelled",walletId:"cross_embedded",stage:"stalled"}),d(),D())},dr);return()=>{window.removeEventListener("blur",h),clearTimeout(I)}},[T,v,d,D,m]);let F=T!=null&&!v,V=We(()=>({kitConfig:M,connectorRegistry:H,availableWallets:X,connect:f,connectWallet:w,disconnect:N,selectWallet:A,currentWallet:O,lastIntent:p,isConnecting:F,connectingWalletId:T,openOtherWallets:()=>C(!0),closeOtherWallets:()=>C(!1),otherWalletsOpen:b,oauth:G,extraWallets:u,walletAllowlist:r,onRampEnabled:oe}),[M,H,X,f,w,N,A,O,p,F,T,b,G,u,r,oe]),j=vn(Mt.Provider,{value:V,children:[e,Ye(Gt,{open:b,onOpenChange:C})]});return je&&(j=Ye(ar,{config:je,children:j})),ue&&(j=Ye(ir,{config:ue,children:j})),j}var br=[/Connection interrupted while trying to subscribe/i,/No matching key\. subscription:/i,/Proposal expired/i];function hr(e){let t=e?.message;return typeof t!="string"?!1:br.some(n=>n.test(t))}var wr={};function Cr(e){return e&&{...e,connections:new Map,current:null}}function kr({children:e,config:t,initialState:n,extraWallets:s=wr,walletAllowlist:o}){let[c,g]=Xe(()=>fr(t.activeProviderStorageKey,t.defaultProvider)),[y,u]=Xe(null),r=ge(!1),m=ge(null);m.current||(m.current=yn());let b=m.current,C=We(()=>({subscribe:b.subscribe}),[b]),{kitConfig:p}=t,[k,T]=Xe(null),[x,P]=Xe(null),[v,W]=Xe(0),R=We(()=>rr(p.theme,p.autoDetectTheme),[p.theme,p.autoDetectTheme,v]),_=k??R,q=x??p.themeTokens;ne(()=>{if(!p.autoDetectTheme||k||typeof window>"u"||!window.matchMedia)return;let O=window.matchMedia("(prefers-color-scheme: dark)"),X=()=>W(ee=>ee+1);try{return O.addEventListener("change",X),()=>O.removeEventListener("change",X)}catch{return O.addListener(X),()=>O.removeListener(X)}},[p.autoDetectTheme,k]),ne(()=>{if(typeof document>"u")return;let O=document.documentElement,X=O.getAttribute("data-ds-theme"),ee=O.getAttribute("data-theme");return O.setAttribute("data-ds-theme",_),ee||O.setAttribute("data-theme",_),()=>{X==null?O.removeAttribute("data-ds-theme"):O.setAttribute("data-ds-theme",X),ee==null&&O.removeAttribute("data-theme")}},[_]);let U=We(()=>sr(t.designSystem),[t.designSystem]),z=We(()=>({mode:_,tokens:q,setThemeMode:O=>T(O),setThemeTokens:O=>P(O)}),[_,q]);ne(()=>{if(typeof window>"u")return;let O=X=>{hr(X.reason)&&X.preventDefault()};return window.addEventListener("unhandledrejection",O),()=>window.removeEventListener("unhandledrejection",O)},[]),ne(()=>{if(c!=="cross")return;let O=t.crossWagmiConfig;if(O)return er(O)},[c,t.crossWagmiConfig]);let M=Re((O,X)=>{r.current||(r.current=!0,u(X),g(O),gr(t.activeProviderStorageKey,O),queueMicrotask(()=>{r.current=!1}))},[t.activeProviderStorageKey]),H=Re(()=>u(null),[]),Ee=c==="cross"?t.crossWagmiConfig:t.reownWagmiConfig,ke=Cr(nr(n,c));if(!Ee){if(!(c==="cross"?t.reownWagmiConfig:t.crossWagmiConfig))throw new Error("[crossx-kit] createCrossxConfig returned no wagmi Config for either side");let X=c==="cross"?"reown":"cross";queueMicrotask(()=>g(X))}let L=Ee??(c==="cross"?t.reownWagmiConfig:t.crossWagmiConfig);return Ye(At.Provider,{value:C,children:vn(St.Provider,{value:z,children:[Ye("style",{"data-crossx-design-system":"",children:U}),Ye(Vo,{config:L,initialState:ke,children:Ye(Zo,{client:cr,children:Ye(yr,{config:t,activeProvider:c,onRequestProviderSwap:M,pendingConnectWalletId:y,clearPending:H,themeMode:_,themeTokens:q,extraWallets:s,walletAllowlist:o??t.kitConfig.wallets??null,emit:b.emit,children:e})})},c)]})})}import{useCallback as He,useEffect as ri,useMemo as Tt,useState as si}from"react";import{useQueryClient as ii}from"@tanstack/react-query";import{useAccount as ai,useChainId as ci,useConfig as di,useSendTransaction as li,useSwitchChain as ui}from"wagmi";import{getPublicClient as Zt,readContracts as no}from"wagmi/actions";import{WalletInfo as en,ConnectorId as et,OnePopGetTokenTrigger as pi,resolveEnvironment as mi,WALLET_REGISTRY as fi}from"@nexus-cross/dapp-ui";import{useOptionalOnRamp as gi,useOptionalOnRampEligibility as yi}from"@nexus-cross/onramp/react";import{APPLE_ICON as rn,BINANCE_ICON as so,CROSSX_ICON as on,EXTENSION_ICON as bi,GOOGLE_ICON as io,METAMASK_ICON as ao}from"@nexus-cross/connect-kit-wagmi";import{WALLET_LABELS as vt}from"@nexus-cross/crossx-design-system";import{useCallback as Us,useMemo as zn}from"react";import{useAccount as Ms,useConfig as Gs}from"wagmi";import{waitForTransactionReceipt as Ks}from"wagmi/actions";import{GetOneUsd as $s,resolveEnvironment as qs}from"@nexus-cross/dapp-ui";import{useCallback as ie,useMemo as Ce,useRef as Tr}from"react";import{useQueries as Pn,useQuery as Je}from"@tanstack/react-query";import{encodeFunctionData as bt,formatUnits as Nt,parseSignature as vr,parseUnits as Ir}from"viem";import{getChainId as $t,getPublicClient as Mn,readContract as Oe,signTypedData as xr,switchChain as Sn,waitForTransactionReceipt as Pr,writeContract as An}from"wagmi/actions";import{useConfig as Sr}from"wagmi";async function Rt(e,t,n){if(!(!n||t===void 0))try{if(e.getChainId()===t)return;await e.switchChain(t)}catch{}}var ut=10000n;function In(e){let t=e==="auto"?1:Number(e||"1");return!Number.isFinite(t)||t<0?100n:BigInt(Math.min(1e4,Math.floor(t*100)))}function Ot(e,t){let n=In(t);return n>=ut?0n:e*(ut-n)/ut}function xn(e,t){let n=In(t);return(e*(ut+n)+(ut-1n))/ut}function Ar(e){return e!=="bridge"}var qe="0x0000000000000000000000000000000000000000",Pe=100,mt=18,Rr=180000n,Or=500000n,Gn=new Set([56,97]),Er=130n,_r=100n,Br={dev:"https://stg-contents.crosstoken.io/frontend/game-token/json/hidden-path.json",stage:"https://stg-contents.crosstoken.io/frontend/game-token/json/hidden-path.json",production:"https://contents.crosstoken.io/frontend/game-token/json/hidden-path.json"},Nr={dev:"dev",stage:"stg",production:"prod"};function Wr(e,t){let n=e?.[Nr[t]]?.hiddenPairs;if(!Array.isArray(n))return null;let s=n.filter(o=>!!o&&typeof o=="object"&&typeof o.fromKey=="string"&&typeof o.toKey=="string");return s.length>0?s:null}var Dr={dev:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/contracts.json",stage:"https://stg-contents.crosstoken.io/frontend/common/app-launcher/contracts.json",production:"https://contents.crosstoken.io/frontend/common/app-launcher/contracts.json"},Fr=["BSC_CROSS","W_CROSS","NATIVE_CROSS","USDTX","CROSSD","USDTB","SWAP_BRIDGE_ROUTER"],Lr={BSC_CROSS:qe,W_CROSS:qe,NATIVE_CROSS:qe,USDTX:qe,CROSSD:qe,USDTB:qe,SWAP_BRIDGE_ROUTER:qe},Ur=/^0x[0-9a-fA-F]{40}$/;function Mr(e,t){let n=typeof e=="string"?e:e?.[t];return typeof n=="string"&&Ur.test(n)?n:null}function Gr(e,t){if(!e?.bridge)return null;let n=e.envToNetwork?.[t]??(t==="production"?"mainnet":"testnet"),s={};for(let o of Fr){let c=Mr(e.bridge[o],n);if(!c)return null;s[o]=c}return s}var Kr={dev:{bridgeApi:"https://stg-bridge-api.crosstoken.io/bridge",walletApi:"https://stg-wallet-server.crosstoken.io/api",chainIds:{cross:612044,bsc:97}},stage:{bridgeApi:"https://stg-bridge-api.crosstoken.io/bridge",walletApi:"https://stg-wallet-server.crosstoken.io/api",chainIds:{cross:612044,bsc:97}},production:{bridgeApi:"https://bridge-api.crosstoken.io/bridge",walletApi:"https://wallet-server.crosstoken.io/api",chainIds:{cross:612055,bsc:56}}},rt=[{type:"function",name:"quoter",stateMutability:"view",inputs:[],outputs:[{name:"",type:"address"}]},{type:"function",name:"swapRouter",stateMutability:"view",inputs:[],outputs:[{name:"",type:"address"}]},{type:"function",name:"getAmountSwapBridgeOut",stateMutability:"view",inputs:[{name:"toChainID",type:"uint256"},{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"amountIn",type:"uint256"}],outputs:[{name:"ok",type:"bool"},{name:"swapAmountOut",type:"uint256"},{name:"bridgeValue",type:"uint256"},{name:"networkFee",type:"uint256"},{name:"exFee",type:"uint256"}]},{type:"function",name:"getAmountSwapBridgeIn",stateMutability:"view",inputs:[{name:"toChainID",type:"uint256"},{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"bridgeValue",type:"uint256"}],outputs:[{name:"ok",type:"bool"},{name:"amountIn",type:"uint256"},{name:"swapAmountOut",type:"uint256"},{name:"networkFee",type:"uint256"},{name:"exFee",type:"uint256"}]},{type:"function",name:"swapBridgeExactInputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"amountIn",type:"uint256"},{name:"amountOutMinimum",type:"uint256"},{name:"sqrtPriceLimitX96",type:"uint160"},{name:"bridgeParams",type:"tuple",components:[{name:"toChainID",type:"uint256"},{name:"recipient",type:"address"},{name:"extraData",type:"bytes"}]}]},{name:"deadline",type:"uint256"}],outputs:[{name:"amountOut",type:"uint256"}]},{type:"function",name:"swapBridgeExactOutputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"amountOut",type:"uint256"},{name:"amountInMaximum",type:"uint256"},{name:"sqrtPriceLimitX96",type:"uint160"},{name:"bridgeParams",type:"tuple",components:[{name:"toChainID",type:"uint256"},{name:"recipient",type:"address"},{name:"extraData",type:"bytes"}]}]},{name:"deadline",type:"uint256"}],outputs:[{name:"amountIn",type:"uint256"}]}],qt=[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"allowance",stateMutability:"view",inputs:[{name:"owner",type:"address"},{name:"spender",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],Rn=[{type:"function",name:"name",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]},{type:"function",name:"nonces",stateMutability:"view",inputs:[{name:"owner",type:"address"}],outputs:[{name:"",type:"uint256"}]}],On=[{type:"function",name:"quoteExactInputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"amountIn",type:"uint256"},{name:"fee",type:"uint24"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountOut",type:"uint256"},{name:"sqrtPriceX96After",type:"uint160"},{name:"initializedTicksCrossed",type:"uint32"},{name:"gasEstimate",type:"uint256"}]},{type:"function",name:"quoteExactOutputSingle",stateMutability:"nonpayable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"amount",type:"uint256"},{name:"fee",type:"uint24"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountIn",type:"uint256"},{name:"sqrtPriceX96After",type:"uint160"},{name:"initializedTicksCrossed",type:"uint32"},{name:"gasEstimate",type:"uint256"}]}],$r=[{type:"function",name:"slot0",stateMutability:"view",inputs:[],outputs:[{name:"sqrtPriceX96",type:"uint160"},{name:"tick",type:"int24"},{name:"observationIndex",type:"uint16"},{name:"observationCardinality",type:"uint16"},{name:"observationCardinalityNext",type:"uint16"},{name:"feeProtocol",type:"uint8"},{name:"unlocked",type:"bool"}]}],Ke=[{type:"function",name:"exactInputSingle",stateMutability:"payable",inputs:[{name:"params",type:"tuple",components:[{name:"tokenIn",type:"address"},{name:"tokenOut",type:"address"},{name:"fee",type:"uint24"},{name:"recipient",type:"address"},{name:"deadline",type:"uint256"},{name:"amountIn",type:"uint256"},{name:"amountOutMinimum",type:"uint256"},{name:"sqrtPriceLimitX96",type:"uint160"}]}],outputs:[{name:"amountOut",type:"uint256"}]},{type:"function",name:"multicall",stateMutability:"payable",inputs:[{name:"data",type:"bytes[]"}],outputs:[{name:"results",type:"bytes[]"}]},{type:"function",name:"unwrapWETH9",stateMutability:"payable",inputs:[{name:"amountMinimum",type:"uint256"},{name:"recipient",type:"address"}],outputs:[]},{type:"function",name:"refundETH",stateMutability:"payable",inputs:[],outputs:[]}],qr=[{type:"function",name:"bridgeToken",stateMutability:"payable",inputs:[{name:"toChainID",type:"uint256"},{name:"fromToken",type:"address"},{name:"to",type:"address"},{name:"value",type:"uint256"},{name:"gasFee",type:"uint256"},{name:"exFee",type:"uint256"},{name:"extraData",type:"bytes"}],outputs:[{name:"",type:"bool"}]}];async function Kn(e){let t="";try{t=await e.text()}catch{}if(t){try{let n=JSON.parse(t),s=typeof n.data=="string"&&n.data||typeof n.message=="string"&&n.message||"";if(s)return`${s} (status ${e.status})`}catch{}return`${t.slice(0,300)} (status ${e.status})`}return`status ${e.status}`}async function De(e,t){let n=await fetch(e,{cache:"no-store",signal:t});if(!n.ok)throw new Error(`CrossD bridge adapter request failed: ${await Kn(n)}`);let s=await n.json();if(s&&typeof s=="object"&&"code"in s&&typeof s.code=="number"&&s.code!==200)throw new Error(s.message||`CrossD bridge adapter API error: ${s.code}`);return s&&typeof s=="object"&&"data"in s?s.data:s}async function En(e,t,n){let s=await fetch(e,{method:"POST",cache:"no-store",signal:n,headers:{"content-type":"application/json"},body:JSON.stringify(t)});if(!s.ok)throw new Error(`CrossD bridge adapter request failed: ${await Kn(s)}`);let o=await s.json();if(o&&typeof o=="object"&&"code"in o&&typeof o.code=="number"&&o.code!==200)throw new Error(o.message||`CrossD bridge adapter API error: ${o.code}`);return o&&typeof o=="object"&&"data"in o?o.data:o}function Hr(e){return new Promise(t=>setTimeout(t,e))}async function Vr(e,t,{attempts:n=60,intervalMs:s=2e3}={}){for(let o=0;o<n;o+=1){try{let c=await De(`${e}/permit-hash/${t}`);if(jt(c))return c}catch{}await Hr(s)}return null}function ce(e,t){return`${e}-${t.toLowerCase()}`}function fe(e){return ce(e.chainId,e.address)}function Fe(e){return e==="swap"||e==="deposit-swap"||e==="swap-withdraw"}function jr(e){let t=e instanceof Error?e.message:typeof e=="string"?e:"",n=t.toLowerCase();return n.includes("quoteexactinputsingle")||n.includes("quoteexactoutputsingle")||n.includes("getamountswapbridgeout")||n.includes("getamountswapbridgein")||n.includes("execution reverted")?"Amount is too large for this route.":t.split(`
2
2
  `)[0]?.trim()||"Failed to quote bridge."}function _n(e){return e===56||e===97?"BSC":e===612044||e===612055?"ONEchain":`Chain ${e}`}function ae(e,t){return t?t.toLowerCase()===e.contracts.NATIVE_CROSS.toLowerCase()?e.contracts.W_CROSS:t:qe}function st(e){let t=Nt(e,mt);return t.includes(".")?t.replace(/\.?0+$/,""):t}function wt(e){return Ir(e||"0",mt)}function ye(e){try{return wt(e||"0")}catch{return 0n}}function Ze(e){if(typeof e=="bigint")return e;if(typeof e=="number")return BigInt(Math.trunc(e));if(!e)return 0n;try{return BigInt(e)}catch{return 0n}}function Ht(e){let t=Nt(e,9);return(t.includes(".")?t.replace(/\.?0+$/,""):t)||"0"}function Et(e){return e==="bridge"?Rr:Or}function Bn(e,t){if(!e||!t)return"0";let n=e*e;if(n===0n)return"0";let s=t*t,o=s>n?s-n:n-s;if(o===0n)return"0";let c=(o*100000000n+n/2n)/n;if(c>=100000000n)return"100";let g=c/1000000n,y=(c%1000000n).toString().padStart(6,"0").replace(/0+$/,"");return y?`${g}.${y}`:`${g}`}function Qr(e){if(!e||Number(e)===0)return"0%";let[t,n=""]=e.split("."),s=n.length>4?n.slice(0,4):n;return s?`${t}.${s}%`:`${t}%`}async function Nn(e,t,n,s,o,c=!1){let g=Mn(e,{chainId:t}),y=n;try{let r=await g?.estimateContractGas?.({account:o.account,address:o.address,abi:o.abi,functionName:o.functionName,args:o.args,value:o.value});typeof r=="bigint"&&r>0n&&(y=s?r*Er/_r:r)}catch{}let u={gas:y};if(Gn.has(t))try{let r=await g?.getGasPrice?.();typeof r=="bigint"&&r>0n&&(u.gasPrice=r)}catch{}else if(c)try{let r=await g?.estimateFeesPerGas?.();typeof r?.maxFeePerGas=="bigint"&&(u.maxFeePerGas=r.maxFeePerGas),typeof r?.maxPriorityFeePerGas=="bigint"&&(u.maxPriorityFeePerGas=r.maxPriorityFeePerGas)}catch{}return u}function ht(){return BigInt(Math.floor(Date.now()/1e3)+1800)}var zr={100:"0.01%",500:"0.05%",3e3:"0.3%",1e4:"1%"};function Xr(e){return zr[e]??`${e/1e4}%`}function Yr(e,t){let n=Number(e||"0");return!Number.isFinite(n)||n<=0?"0":(n*t/1e6).toFixed(8).replace(/\.?0+$/,"")}function Wn(e){return st(e)}function Dn(e,t){let n=Number(t??"0");return!Number.isFinite(n)||n<=0?0n:e*BigInt(Math.floor(n))/1000n}function _t(e,t){if(!e)return!1;let n=e.toLowerCase();return t.some(s=>s.toLowerCase()===n)}function Jr(e,t,n){return[{from:[e.contracts.USDTX],to:[e.contracts.CROSSD]},{from:[e.contracts.BSC_CROSS],to:[e.contracts.NATIVE_CROSS,e.contracts.W_CROSS]},{from:[e.contracts.NATIVE_CROSS,e.contracts.W_CROSS],to:[e.contracts.CROSSD]}].some(o=>_t(t,o.from)&&_t(n,o.to)||_t(t,o.to)&&_t(n,o.from))}function Zr(e){if(Fe(e.type))return null;if(e.type==="swap-bridge"){let t=e.steps.find(n=>n.type==="bridge");return t?{from:t.fromChain,to:t.toChain,token:t.fromToken}:null}if(e.type==="bridge-swap"){let t=e.steps.find(n=>n.type==="bridge");return t?{from:t.fromChain,to:t.toChain,token:t.fromToken}:null}return{from:e.from.chainId,to:e.to.chainId,token:e.from.address}}function es({input:e,path:t,config:n}){if(!n||Fe(t.type))return"";let s=Ze(n.minimumValue),o=Ze(n.gasFee??n.gas_fee),c=t.type==="swap-bridge"?s+o*12n/10n:s;return c<=0n?"":e.fromAmount&&ye(e.fromAmount)<c&&t.type!=="swap"?`Minimum ${Wn(c)}`:t.type==="swap-bridge"&&e.toAmount&&ye(e.toAmount)<c?`Available ${Wn(c)} or more.`:""}function ts({input:e,path:t,config:n}){if(!n||t.type!=="bridge"&&t.type!=="bridge-swap")return"";let s=Ze(n.gasFee??n.gas_fee);if(s<=0n||!e.fromAmount)return"";let o=ye(e.fromToken.balance||"0"),c=ye(e.fromAmount);return o-s<c?`Insufficient network fee(${e.fromToken.symbol})`:""}function ns(e,t){let n=new Set;return e?.list?.forEach(s=>{let o=s.localChain??s.local_chain;o&&Object.entries(s.pairs||{}).forEach(([c,g])=>{g.forEach(y=>{y.localToken&&n.add(ce(o,y.localToken)),y.remoteToken&&n.add(ce(Number(c),y.remoteToken))})})}),Object.entries(t?.swapPools||t?.swap_pools||{}).forEach(([s,o])=>{o.forEach(c=>{c.token0&&n.add(ce(Number(s),c.token0)),c.token1&&n.add(ce(Number(s),c.token1))})}),n}function os(e,t){return!e||!t?null:ce(e,t)}function rs({envConfig:e,bridgePairList:t,swapPools:n,tokenInfo:s,tokenStats:o}){let c=ns(t,n),g=new Map;o?.forEach(u=>{let r=os(Number(u.chainId??u.chain_id),u.address);r&&g.set(r,u)});let y={};return c.forEach(u=>{let[r,m]=u.split("-"),b=Number(r),C=s?.find(k=>Number(k.chainId??k.chain_id)===b&&k.address?.toLowerCase()===m);if(!C?.symbol||!C.name)return;let p=g.get(u);y[u]={key:u,chainId:b,address:m,symbol:C.symbol,name:C.name,decimals:C.decimals||mt,image:C.image||C.icon_url,price:p?.price?Number(p.price):void 0,isNativeToken:m.toLowerCase()===e.contracts.NATIVE_CROSS.toLowerCase()}}),y}function $n(e,t){return t?.list?.find(n=>(n.localChain??n.local_chain)===e)?.bridge||""}function qn(e,t,n){let[s,o]=e.split("-"),[c,g]=t.split("-"),y=Number(s),u=Number(c);for(let r of n?.list||[]){if((r.localChain??r.local_chain)!==y)continue;let m=r.pairs?.[c];if(m){for(let b of m)if(b.localToken?.toLowerCase()===o&&b.remoteToken?.toLowerCase()===g)return{type:"bridge",fromChain:y,fromToken:o,toChain:u,toToken:g,bridgeAddress:$n(y,n)}}}return null}function Hn(e,t,n,s){let o,c=1/0;for(let g of e||[]){let y=s(g.token0),u=s(g.token1);if(y===t&&u===n||u===t&&y===n){let r=g.fee??Pe;r<c&&(o=g,c=r)}}return o?{fee:c,poolAddress:o.poolAddress||o.pool_address||""}:null}function Vn(e,t,n,s){let[o,c]=e.split("-"),[g,y]=t.split("-");if(o!==g)return null;let u=Number(o),r=(n?.swapPools||n?.swap_pools)?.[o];if(!r)return null;let m=s.contracts.W_CROSS.toLowerCase(),b=s.contracts.NATIVE_CROSS.toLowerCase(),p=Hn(r,c,y,T=>T?.toLowerCase()===m?b:T?.toLowerCase());if(!p)return null;let k="swap";return u===s.chainIds.cross&&(c===b&&(k="deposit-swap"),y===b&&(k="swap-withdraw")),{pathType:k,step:{type:"swap",chain:u,fromToken:c,toToken:y,fee:p.fee,poolAddress:p.poolAddress}}}function ss(e,t,n,s){let[o,c]=e.split("-"),[g]=t.split("-");if(o===g)return null;let y=(n?.swapPools||n?.swap_pools)?.[o]||[],u=r=>r?.toLowerCase();for(let r of y){let m=u(r.token0),b=u(r.token1),C=m===c?b:b===c?m:null;if(!C)continue;let p=qn(ce(Number(o),C),t,s);if(!p)continue;let k=Hn(y,c,C,u);return[{type:"swap",chain:Number(o),fromToken:c,toToken:C,fee:k?.fee??Pe,poolAddress:k?.poolAddress??""},p]}return null}function is(e,t,n,s,o){let[c,g]=e.split("-"),[y]=t.split("-");if(c===y)return null;for(let u of n?.list||[])if((u.localChain??u.local_chain)===Number(c))for(let r of u.pairs?.[y]||[]){if(r.localToken?.toLowerCase()!==g)continue;let m=r.remoteToken?.toLowerCase();if(!m)continue;let b=Vn(ce(Number(y),m),t,s,o);if(b)return[{type:"bridge",fromChain:Number(c),fromToken:g,toChain:Number(y),toToken:m,bridgeAddress:$n(Number(c),n)},b.step]}return null}function as({envConfig:e,bridgePairList:t,swapPools:n,enrichedTokens:s}){return(o,c)=>{let g=s[o],y=s[c];if(!g||!y||o===c)return null;let u=qn(o,c,t);if(u)return{type:"bridge",steps:[u],from:g,to:y};let r=Vn(o,c,n,e);if(r)return{type:r.pathType,steps:[r.step],from:g,to:y};let m=ss(o,c,n,t);if(m)return{type:"swap-bridge",steps:m,from:g,to:y};let b=is(o,c,t,n,e);return b?{type:"bridge-swap",steps:b,from:g,to:y}:null}}function Fn(e,t){return{name:e.name,symbol:e.symbol,chainId:e.chainId,address:e.address,decimals:e.decimals,balance:t.get(e.key)||"0",iconUrl:e.image,priceUsd:e.price}}function cs(e){return e.length<=10?e:`${e.slice(0,6)}...${e.slice(-4)}`}function ds(e){return e.includes(".")?e.replace(/\.?0+$/,"")||"0":e}function ls(e,t){let n=e.startsWith("-"),s=n?e.slice(1):e,[o,c=""]=s.split("."),g=c.slice(0,t).replace(/0+$/,""),y=g?`${o}.${g}`:o;return n?`-${y}`:y}function us(e){let t=e.startsWith("-"),n=t?e.slice(1):e,[s,o]=n.split("."),c=s.replace(/\B(?=(\d{3})+(?!\d))/g,","),g=o?`${c}.${o}`:c;return t?`-${g}`:g}function Vt(e){if(e==null||e==="")return"0";let t=String(e),n=Number(t);return!Number.isFinite(n)||n===0?"0":us(ls(t,4))}function Ln(e,t){if(e==null||e==="")return"0";try{return ds(Nt(BigInt(String(e)),t.decimals))}catch{return"0"}}function jt(e){return!!(e&&/^0x[0-9a-fA-F]+$/.test(e))}function ps(e){return e?new Date(e*1e3).toISOString():new Date().toISOString()}function ms(e,t){return t.toLowerCase()===e.contracts.W_CROSS.toLowerCase()?e.contracts.NATIVE_CROSS:t}function fs(e,t){let n=cs(t);return{name:n,symbol:n,chainId:e,address:t,decimals:mt,balance:"0"}}function Un({envConfig:e,tokenByBridgeKey:t,chainId:n,address:s}){if(!s)return null;let o=ms(e,s);return t.get(ce(n,o))||t.get(ce(n,s))||fs(n,o)}function Bt(e){return e?.toLowerCase()||""}function gs(e){if(e.source==="swap")return"swap";let t=Bt(e.fromToken??e.from_token),n=Bt(e.toToken??e.to_token),s=Bt(e.swapTokenIn??e.swap_token_in),o=Bt(e.swapTokenOut??e.swap_token_out);return n&&s&&n===s?"bridge-swap":t&&o&&t===o?"swap-bridge":"bridge"}function ys(e,t){let n=e.status??0,s=e.extracallSuccess??e.extracall_success??!1;return t==="bridge-swap"&&n===1&&!s?"failed":n===1?"success":"pending"}function bs({envConfig:e,item:t,tokenByBridgeKey:n}){let s=Number(t.fromChainID??t.from_chain_id??0),o=Number(t.toChainID??t.to_chain_id??0);if(!s||!o)return null;let c=gs(t),g=t.swapTokenIn??t.swap_token_in,y=t.swapTokenOut??t.swap_token_out,u=t.swapAmountIn??t.swap_amount_in,r=t.swapAmountOut??t.swap_amount_out,m=t.fromToken??t.from_token,b=t.toToken??t.to_token,C=t.value,p=t.value;c==="swap"?(m=g,b=y,C=u,p=r):c==="swap-bridge"?(m=g,C=u,p=t.value):c==="bridge-swap"&&(b=y,C=u,p=r);let k=Un({envConfig:e,tokenByBridgeKey:n,chainId:s,address:m}),T=Un({envConfig:e,tokenByBridgeKey:n,chainId:o,address:b}),x=t.initiatedTxHash??t.initiated_tx_hash;return!k||!T||!jt(x)?null:{id:`${x}-${t.index??""}`,timestamp:ps(t.initiatedTime??t.initiated_time),txHash:x,fromToken:k,toToken:T,fromAmount:Ln(C,k),toAmount:Ln(p,T),summary:{pathType:c},status:ys(t,c)}}function hs(e){let t=new Map;return e.flat().forEach(n=>{let s=Number(n.chainId??n.chain_id),o=n.address?.toLowerCase();if(!s||!o)return;let c=n.quantity?.numeric??n.balance??"0",g=n.quantity?.decimals??n.decimals??mt;try{t.set(ce(s,o),Nt(BigInt(c||"0"),g))}catch{t.set(ce(s,o),"0")}}),t}function $e(e,t="first"){let n=e.steps.filter(s=>s.type==="swap");return t==="last"?n[n.length-1]:n[0]}function ws(e,t){let n=(e?.swapPools||e?.swap_pools)?.[String(t.chainIds.cross)];if(!n?.length)return"";let s=t.contracts.CROSSD.toLowerCase(),o=t.contracts.USDTX.toLowerCase(),c=n.find(g=>{let y=g.token0?.toLowerCase(),u=g.token1?.toLowerCase();return y===s&&u===o||y===o&&u===s});return c?.poolAddress||c?.pool_address||""}function Cs(e,t){return e.from.chainId===t.chainIds.cross&&e.from.address.toLowerCase()===t.contracts.CROSSD.toLowerCase()&&e.to.chainId===t.chainIds.bsc&&e.to.address.toLowerCase()===t.contracts.USDTB.toLowerCase()}function ks(e){if(e===void 0)return;let t=10n**BigInt(mt),n=e>=50000n*t?"normal":e>10000n*t?"low":"rebalancing",s=Number(e>0n?e*100n/(100000n*t):0n);return{label:"Available Liquidity",status:n,percentage:Math.min(s,100)}}function pt(e,t,n,s){let o=[e.from,e.to].find(c=>c.chainId===t&&c.address.toLowerCase()===n.toLowerCase())??s?.[ce(t,n)];return{symbol:o?.symbol||n.slice(0,6),iconUrl:o?.image}}function Ts(e,t){let n=[];for(let o of e.steps)o.type==="swap"?(n.push({chain:o.chain,address:o.fromToken}),n.push({chain:o.chain,address:o.toToken})):(n.push({chain:o.fromChain,address:o.fromToken}),n.push({chain:o.toChain,address:o.toToken}));let s=n.filter((o,c)=>c===0||!(o.chain===n[c-1].chain&&o.address.toLowerCase()===n[c-1].address.toLowerCase()));return s.length===0?[{symbol:e.from.symbol,iconUrl:e.from.image},{symbol:e.to.symbol,iconUrl:e.to.image}]:s.map(o=>pt(e,o.chain,o.address,t))}function vs({input:e,path:t,amountData:n,gasInfo:s,liquidity:o,enrichedTokens:c,priceImpact:g}){let y=e.fromAmount||"0",u=e.toAmount||"0",r=$e(t),m=t.steps.find(W=>W.type==="bridge"),b=t.type!=="bridge",C=!Fe(t.type),p=r?Yr(y,r.fee):"0",k=Number(y)>0||Number(u)>0,T=r?pt(t,r.chain,r.fromToken,c):{symbol:e.fromToken.symbol,iconUrl:e.fromToken.iconUrl},x=r?pt(t,r.chain,r.toToken,c):{symbol:e.toToken.symbol,iconUrl:e.toToken.iconUrl},P=m?pt(t,m.fromChain,m.fromToken,c):void 0,v=(W,R,_)=>k?R&&R>0n?{label:W,value:st(R),tone:"default",valueToken:_}:{label:W,value:"Free",tone:"accent"}:{label:W,value:"0"};return{pathType:t.type,priceImpact:g,liquidity:o,bridgeInfo:C&&m?[{label:"Route",value:`${_n(m.fromChain)} \u2192 ${_n(m.toChain)}`},v("Validator Fee",n?.exFee,P),v("Network Fee",n?.networkFee,P)]:void 0,swapInfo:b&&r?[{label:"Route",value:"",routeTokens:[pt(t,r.chain,r.fromToken,c),pt(t,r.chain,r.toToken,c)]},{label:"Price Impact",value:Qr(g)},{label:"In Amount",value:Vt(y),valueToken:T},{label:r&&Fe(t.type)?`Swap Fee (${Xr(r.fee??Pe)})`:"Swap Fee",value:Vt(p),valueToken:T},{label:"Out Amount",value:Vt(u),valueToken:x}]:void 0,txFee:[...s?.gasPrice?[{label:"Gas Price",value:`${s.gasPrice} Gwei`}]:[{label:"Priority Fee Per Gas",value:`${s?.priorityFeePerGas||"0"} Gwei`},{label:"Max Fee Per Gas",value:`${s?.maxFeePerGas||"0"} Gwei`}],{label:"Gas Limit",value:s?.gasLimit||"0"}],txFeeInfo:s?{estTxFee:s.estTxFee,isDelegateFee:s.isDelegateFee,tokenIconUrl:s.gasCurrencyIconUrl,tokenSymbol:s.gasCurrencySymbol}:{estTxFee:"0",isDelegateFee:!1}}}function Ct({env:e,walletAddress:t,enabled:n=!0,restoreChainAfterSwitch:s=!0}){let o=Sr(),c=Tr(new Map),y=Je({queryKey:["crossd-bridge-adapter",e,"remote-contracts"],queryFn:async({signal:i})=>{let a=Gr(await De(Dr[e],i),e);if(!a)throw new Error("CrossD bridge adapter: invalid contracts.json");return a},enabled:n,staleTime:5*6e4}).data??null,u=n&&!!y,r=Ce(()=>({...Kr[e],contracts:y??Lr}),[e,y]),m=Je({queryKey:["crossd-bridge-adapter",e,"pairs"],queryFn:({signal:i})=>De(`${r.bridgeApi}/pairs`,i),enabled:u,staleTime:3e4}),b=Je({queryKey:["crossd-bridge-adapter",e,"swap-pools"],queryFn:({signal:i})=>De(`${r.bridgeApi}/swap-pools`,i),enabled:u,staleTime:3e4}),C=Ce(()=>ws(b.data,r),[r,b.data]),p=Je({queryKey:["crossd-bridge-adapter",e,"available-liquidity",C],queryFn:async()=>await Oe(o,{address:r.contracts.USDTX,abi:qt,functionName:"balanceOf",args:[C],chainId:r.chainIds.cross}),enabled:u&&!!C,staleTime:3e4}),k=Je({queryKey:["crossd-bridge-adapter",e,"token-info"],queryFn:({signal:i})=>De(`${r.walletApi}/v1/public/token/info`,i),enabled:u,staleTime:3e4}),T=Je({queryKey:["crossd-bridge-adapter",e,"token-stats"],queryFn:({signal:i})=>De(`${r.walletApi}/v1/public/token/stats`,i),enabled:u,staleTime:3e4}),x=Pn({queries:[r.chainIds.cross,r.chainIds.bsc].map(i=>({queryKey:["crossd-bridge-adapter",e,"balance",t,i],queryFn:({signal:a})=>{let d=new URLSearchParams({networkId:`eip155:${i}`,account:t||""});return De(`${r.walletApi}/v1/public/token/balance?${d}`,a)},enabled:u&&!!t,staleTime:0,refetchInterval:u&&t?5e3:!1}))}),P=Pn({queries:[r.chainIds.cross,r.chainIds.bsc].map(i=>({queryKey:["crossd-bridge-adapter",e,"gas-suggestion",i],queryFn:async({signal:a})=>{try{let w=await Mn(o,{chainId:i})?.estimateFeesPerGas?.();if(w?.maxFeePerGas||w?.gasPrice)return{fast:{maxFee:w.maxFeePerGas?.toString()||w.gasPrice?.toString(),maxPriorityFee:w.maxPriorityFeePerGas?.toString()||"0"}}}catch{}let d=new URLSearchParams({chain_id:String(i),without_gas_limit:"false"});return De(`${r.walletApi}/v1/public/transaction/gas-suggestion/dynamic?${d}`,a)},enabled:u,staleTime:1e4,retry:1}))}),v=Je({queryKey:["crossd-bridge-adapter",e,"hidden-pairs"],queryFn:async({signal:i})=>Wr(await De(Br[e],i),e),enabled:u,staleTime:5*6e4,retry:1}),W=Ce(()=>v.data??[],[v.data]),R=Ce(()=>rs({envConfig:r,bridgePairList:m.data,swapPools:b.data,tokenInfo:k.data,tokenStats:T.data}),[m.data,r,b.data,k.data,T.data]),_=Ce(()=>as({envConfig:r,bridgePairList:m.data,swapPools:b.data,enrichedTokens:R}),[m.data,R,r,b.data]),q=Ce(()=>hs(x.map(i=>i.data).filter(i=>Array.isArray(i))),[x]),U=Ce(()=>{let i=new Map;return Object.values(R).forEach(a=>{let d=Fn(a,q);i.set(a.key,d)}),i},[q,R]),z=Ce(()=>{let i=new Map,a=U.get(ce(r.chainIds.cross,r.contracts.NATIVE_CROSS));a&&i.set(r.chainIds.cross,{symbol:a.symbol,iconUrl:a.iconUrl});let d=k.data?.find(f=>Number(f.chainId??f.chain_id)===r.chainIds.bsc&&(f.symbol??"").toUpperCase()==="BNB");return d&&i.set(r.chainIds.bsc,{symbol:d.symbol??"BNB",iconUrl:d.image??d.icon_url}),i},[r,U,k.data]),M=Je({queryKey:["crossd-bridge-adapter",e,"history",t],queryFn:({signal:i})=>En(`${r.bridgeApi}/history`,{owner:t,page:1,size:20,sort:"desc",status:"all"},i),enabled:u&&!!t,staleTime:0,refetchInterval:u&&t?5e3:!1}),H=Ce(()=>(M.data?.histories||[]).map(i=>bs({envConfig:r,item:i,tokenByBridgeKey:U})).filter(i=>!!i),[M.data?.histories,r,U]),Ee=Ce(()=>ks(p.data),[p.data]),ke=P[0]?.data,L=P[1]?.data,O=Ce(()=>{let i=new Map;return ke&&i.set(r.chainIds.cross,ke),L&&i.set(r.chainIds.bsc,L),i},[L,ke,r.chainIds.bsc,r.chainIds.cross]),X=ie((i,a,d)=>{let f=O.get(i.from.chainId)?.fast,w=a?d?.gasLimit??Et(i.type):0n,N=d?.gasPrice&&d.gasPrice>0n?d.gasPrice:0n,D=d?.maxFeePerGas&&d.maxFeePerGas>0n?d.maxFeePerGas:0n,A=d?.maxPriorityFeePerGas&&d.maxPriorityFeePerGas>0n?d.maxPriorityFeePerGas:0n,G=Ze(f?.maxFee??f?.max_fee),Y=Ze(f?.maxPriorityFee??f?.max_priority_fee),S=D>0n?D:G>0n?G:N,F=A>0n?A:Y>0n?Y:S,V=N>0n?N:S,$=Gn.has(i.from.chainId)&&V>0n,l=w*($?V:S),h=U.get(ce(i.from.chainId,r.contracts.NATIVE_CROSS)),I=i.type!=="swap-bridge",E=z.get(i.from.chainId);return{estTxFee:a?st(l):"0",priorityFeePerGas:a&&!$?Ht(F):"0",maxFeePerGas:a&&!$?Ht(S):"0",gasLimit:a?w.toString():"0",gasPrice:a&&$?Ht(V):void 0,isDelegateFee:i.type==="swap-bridge"?!1:Jr(r,i.from.address,i.to.address),tokenIconUrl:I?h?.iconUrl:void 0,tokenSymbol:I?h?.symbol:void 0,gasCurrencyIconUrl:E?.iconUrl,gasCurrencySymbol:E?.symbol}},[r,O,z,U]),ee=ie(async i=>{let a=Zr(i);if(!a)return null;let d=`${e}:${a.from}:${a.to}:${a.token.toLowerCase()}`,f=c.current.get(d);if(f)return f;let w=(async()=>{let N=new URLSearchParams({from:String(a.from),to:String(a.to),token:a.token});try{return(await De(`${r.bridgeApi}/token-config?${N}`)).config??null}catch{return null}})();return c.current.set(d,w),w},[e,r.bridgeApi]),Se=Ce(()=>{let i=Object.values(R).map(d=>Fn(d,q)),a=ce(r.chainIds.cross,r.contracts.CROSSD);return i.sort((d,f)=>{let w=fe(d).toLowerCase()===a.toLowerCase(),N=fe(f).toLowerCase()===a.toLowerCase();return w!==N?w?-1:1:fe(d).localeCompare(fe(f))})},[q,R,r]),Ue=Ce(()=>{if(y)return{target:{chainId:r.chainIds.cross,address:r.contracts.CROSSD},swap:{from:{chainId:r.chainIds.cross,address:r.contracts.NATIVE_CROSS},feeDelegated:!0},bridge:{from:[{chainId:r.chainIds.bsc,address:r.contracts.USDTB},{chainId:r.chainIds.cross,address:r.contracts.USDTX}]}}},[r,y]),Ve=ie(i=>{let a=fe(i),d=a.toLowerCase(),f=[];Object.keys(R).forEach(D=>{let A=D.toLowerCase();if(d===A||W.some(S=>S.fromKey===d&&S.toKey===A))return;let G=_(a,D);if(!G)return;let Y=U.get(D);Y&&f.push({token:Y,path:G})});let w=ce(r.chainIds.cross,r.contracts.CROSSD),N=ce(r.chainIds.cross,r.contracts.NATIVE_CROSS);return f.sort((D,A)=>{if(d===w.toLowerCase()){let V=fe(D.token).toLowerCase()===N.toLowerCase(),$=fe(A.token).toLowerCase()===N.toLowerCase();if(V!==$)return V?-1:1}let G=Fe(D.path.type),Y=Fe(A.path.type);if(G!==Y)return G?-1:1;let S=D.token.chainId===i.chainId,F=A.token.chainId===i.chainId;return S!==F?S?-1:1:fe(D.token).localeCompare(fe(A.token))}),f.map(D=>D.token)},[R,r,_,W,U]),Me=ie(async i=>await Oe(o,{address:r.contracts.SWAP_BRIDGE_ROUTER,abi:rt,functionName:"quoter",chainId:i}),[r.contracts.SWAP_BRIDGE_ROUTER,o]),oe=ie(async i=>{$t(o)!==i&&await Sn(o,{chainId:i})},[o]),ue=ie(i=>Rt({getChainId:()=>$t(o),switchChain:a=>Sn(o,{chainId:a})},i,s),[s,o]),re=ie(async i=>await Oe(o,{address:r.contracts.SWAP_BRIDGE_ROUTER,abi:rt,functionName:"swapRouter",chainId:i}),[r.contracts.SWAP_BRIDGE_ROUTER,o]),Te=ie(async({path:i,step:a,amount:d,source:f})=>{let w=await Me(a.chain),N=a.poolAddress?Oe(o,{address:a.poolAddress,abi:$r,functionName:"slot0",chainId:a.chain}).then(G=>G?.[0]).catch(()=>{}):Promise.resolve(void 0);if(f==="from"){let G=await Oe(o,{address:w,abi:On,functionName:"quoteExactInputSingle",args:[{tokenIn:ae(r,a.fromToken),tokenOut:ae(r,a.toToken),amountIn:wt(d),fee:a.fee??Pe,sqrtPriceLimitX96:0n}],chainId:a.chain}),Y=Bn(await N,G[1]);return{amount:st(G[0]),path:i,priceImpact:Y}}let D=await Oe(o,{address:w,abi:On,functionName:"quoteExactOutputSingle",args:[{tokenIn:ae(r,a.fromToken),tokenOut:ae(r,a.toToken),amount:wt(d),fee:a.fee??Pe,sqrtPriceLimitX96:0n}],chainId:a.chain}),A=Bn(await N,D[1]);return{amount:st(D[0]),path:i,priceImpact:A}},[r,Me,o]),_e=ie(async(i,a)=>{if(!t)throw new Error("Wallet is not connected.");let d=Et(a.type);if(Fe(a.type)){let S=$e(a,"first");if(!S)throw new Error("Swap route is not available.");let F=ye(i.fromAmount),V=ye(i.toAmount);if(F<=0n)throw new Error("Bridge amount is empty.");if(V<=0n)throw new Error("Bridge quote is not ready.");let $=await re(S.chain),j=Ot(V,i.slippage),l=a.type==="swap-withdraw"?qe:t,h={tokenIn:ae(r,S.fromToken),tokenOut:ae(r,S.toToken),fee:S.fee??Pe,recipient:l,deadline:ht(),amountIn:F,amountOutMinimum:j,sqrtPriceLimitX96:0n};if(a.type==="swap-withdraw"){let I=bt({abi:Ke,functionName:"exactInputSingle",args:[h]}),E=bt({abi:Ke,functionName:"unwrapWETH9",args:[j,t]});return{address:$,abi:Ke,functionName:"multicall",args:[[I,E]],chainId:S.chain,fallbackGasLimit:d}}if(a.type==="deposit-swap"){let I=bt({abi:Ke,functionName:"exactInputSingle",args:[h]}),E=bt({abi:Ke,functionName:"refundETH",args:[]});return{address:$,abi:Ke,functionName:"multicall",args:[[I,E]],value:F,chainId:S.chain,fallbackGasLimit:d}}return{address:$,abi:Ke,functionName:"exactInputSingle",args:[h],chainId:S.chain,fallbackGasLimit:d}}if(a.type==="swap-bridge"){let S=$e(a,"first");if(!S)throw new Error("Swap bridge route is not available.");let F=ye(i.fromAmount),V=ye(i.toAmount);if(F<=0n)throw new Error("Bridge amount is empty.");if(V<=0n)throw new Error("Bridge quote is not ready.");let $=r.contracts.SWAP_BRIDGE_ROUTER,j=ht(),l={toChainID:BigInt(a.to.chainId),recipient:t,extraData:"0x"},h={tokenIn:ae(r,a.from.address),tokenOut:ae(r,S.toToken),fee:S.fee??Pe,sqrtPriceLimitX96:0n,bridgeParams:l};if(i.lastChangedBy==="to"){let E={...h,amountOut:V,amountInMaximum:xn(F,i.slippage)};return{address:$,abi:rt,functionName:"swapBridgeExactOutputSingle",args:[E,j],value:a.from.isNativeToken?E.amountInMaximum:void 0,chainId:a.from.chainId,fallbackGasLimit:d}}let I={...h,amountIn:F,amountOutMinimum:Ot(V,i.slippage)};return{address:$,abi:rt,functionName:"swapBridgeExactInputSingle",args:[I,j],value:a.from.isNativeToken?F:void 0,chainId:a.from.chainId,fallbackGasLimit:d}}let f=a.steps.find(S=>S.type==="bridge");if(!f?.bridgeAddress)throw new Error("Bridge route is not available.");let w=ye(i.fromAmount);if(w<=0n)throw new Error("Bridge amount is empty.");let N=await ee(a),D=Ze(N?.gasFee??N?.gas_fee),A=Dn(w,N?.exFeeRate??N?.ex_fee_rate),G="0x";if(a.type==="bridge-swap"){let S=$e(a,"last");if(!S)throw new Error("Bridge swap route is not available.");let F=ye(i.toAmount);if(F<=0n)throw new Error("Bridge quote is not ready.");let V=await re(a.to.chainId),$=Ot(F,i.slippage),j=bt({abi:Ke,functionName:"exactInputSingle",args:[{tokenIn:ae(r,S.fromToken),tokenOut:ae(r,S.toToken),fee:S.fee??Pe,recipient:t,deadline:ht(),amountIn:w,amountOutMinimum:$,sqrtPriceLimitX96:0n}]});G=`${V}${j.slice(2)}`}let Y=[BigInt(a.to.chainId),a.from.address,t,w,D,A,G];return{address:f.bridgeAddress,abi:qr,functionName:"bridgeToken",args:Y,value:a.from.isNativeToken?w+A+D:void 0,chainId:a.from.chainId,fallbackGasLimit:d}},[r,ee,re,t]),je=ie(async(i,a)=>{if(a.type==="bridge"||a.type==="bridge-swap")return _e(i,a);if(!t)throw new Error("Wallet is not connected.");let d=ye(i.fromAmount);if(d<=0n)throw new Error("Bridge amount is empty.");if(a.type==="swap-bridge"){let D=$e(a,"first");if(!D)throw new Error("Swap bridge route is not available.");let A=r.contracts.SWAP_BRIDGE_ROUTER,G={tokenIn:ae(r,a.from.address),tokenOut:ae(r,D.toToken),fee:D.fee??Pe,sqrtPriceLimitX96:0n,bridgeParams:{toChainID:BigInt(a.to.chainId),recipient:t,extraData:"0x"},amountIn:d,amountOutMinimum:0n};return{address:A,abi:rt,functionName:"swapBridgeExactInputSingle",args:[G,ht()],value:a.from.isNativeToken?d:void 0,chainId:a.from.chainId,fallbackGasLimit:Et(a.type)}}let f=$e(a,"first");if(!f)throw new Error("Swap route is not available.");let w=await re(f.chain),N={tokenIn:ae(r,f.fromToken),tokenOut:ae(r,f.toToken),fee:f.fee??Pe,recipient:t,deadline:ht(),amountIn:d,amountOutMinimum:0n,sqrtPriceLimitX96:0n};return{address:w,abi:Ke,functionName:"exactInputSingle",args:[N],value:a.from.isNativeToken?d:void 0,chainId:f.chain,fallbackGasLimit:Et(a.type)}},[_e,r,re,t]),be=ie(async(i,a)=>{if(!t)return null;try{let d=await je(i,a),f=Fe(a.type)||a.type==="swap-bridge",w=await Nn(o,d.chainId,d.fallbackGasLimit,f,{account:t,address:d.address,abi:d.abi,functionName:d.functionName,args:d.args,value:d.value},!0);return{gasLimit:w.gas,gasPrice:w.gasPrice,maxFeePerGas:w.maxFeePerGas,maxPriorityFeePerGas:w.maxPriorityFeePerGas}}catch{return null}},[je,o,t]),tt=ie(async i=>{let a=fe(i.fromToken),d=fe(i.toToken),f=_(a,d);if(!f)return{error:"Route is not available."};let w=i.lastChangedBy==="to"?i.toAmount:i.fromAmount,N=!!w&&Number(w)>0,D=Cs(f,r)?Ee:void 0,A=async(j,l,h)=>{let I=N?await be(j,f):null,E=X(f,N,I);return vs({input:j,path:f,gasInfo:E,amountData:l,liquidity:D,enrichedTokens:R,priceImpact:h})};if(!w||Number(w)<=0)return{fromAmount:i.fromAmount,toAmount:i.toAmount,summary:await A(i)};let G=await ee(f),Y=Ze(G?.gasFee??G?.gas_fee),S=f.type==="bridge"||f.type==="bridge-swap"?{networkFee:Y}:void 0,F=f.type==="bridge"?i.lastChangedBy==="to"?{...i,fromAmount:i.toAmount}:{...i,toAmount:i.fromAmount}:i,V=es({input:F,path:f,config:G});if(V)return{fromAmount:F.fromAmount,toAmount:F.toAmount,summary:await A(F,S),error:V};let $=ts({input:F,path:f,config:G});if($)return{fromAmount:F.fromAmount,toAmount:F.toAmount,summary:await A(F,S),error:$};if(f.type==="bridge")return{fromAmount:F.fromAmount,toAmount:F.toAmount,summary:await A(F,S)};try{if(f.type==="swap-bridge"){let I=$e(f,"first"),E=r.contracts.SWAP_BRIDGE_ROUTER;if(!I)return{error:"Swap bridge route is not ready."};let B=Ne=>Te({path:f,step:I,amount:Ne,source:"from"}).then(pe=>pe.priceImpact).catch(()=>{});if(i.lastChangedBy==="from"){let Ne=await Oe(o,{address:E,abi:rt,functionName:"getAmountSwapBridgeOut",args:[BigInt(f.to.chainId),ae(r,f.from.address),ae(r,I.toToken),I.fee??Pe,wt(i.fromAmount)],chainId:f.from.chainId}),pe=st(Ne[1]),Wt={...i,toAmount:pe};return{toAmount:pe,summary:await A(Wt,{networkFee:Ne[3],exFee:Ne[4]},await B(i.fromAmount))}}let Ie=await Oe(o,{address:E,abi:rt,functionName:"getAmountSwapBridgeIn",args:[BigInt(f.to.chainId),ae(r,f.from.address),ae(r,I.toToken),I.fee??Pe,wt(i.toAmount)],chainId:f.from.chainId}),ze=st(Ie[1]),dt={...i,fromAmount:ze};return{fromAmount:ze,summary:await A(dt,{networkFee:Ie[3],exFee:Ie[4]},await B(ze))}}let j=f.type==="bridge-swap"?$e(f,"last"):$e(f,"first");if(!j)return{error:"Swap route is not available."};let l=await Te({path:f,step:j,amount:w,source:i.lastChangedBy});if(i.lastChangedBy==="from"){let I={...i,toAmount:l.amount};return{toAmount:l.amount,summary:await A(I,S,l.priceImpact)}}let h={...i,fromAmount:l.amount};return{fromAmount:l.amount,summary:await A(h,S,l.priceImpact)}}catch(j){return{fromAmount:i.fromAmount,toAmount:i.toAmount,summary:await A(i,S),error:jr(j)}}},[Ee,X,R,r,be,_,ee,Te,o]),ve=ie(async i=>{if(i.from.isNativeToken)return null;if(i.type==="swap"||i.type==="deposit-swap"||i.type==="swap-withdraw")return re(i.from.chainId);if(i.type==="swap-bridge")return r.contracts.SWAP_BRIDGE_ROUTER;let a=i.steps.find(d=>d.type==="bridge");return a?.bridgeAddress?a.bridgeAddress:null},[r.contracts.SWAP_BRIDGE_ROUTER,re]),Qe=ie(async i=>{if(!t)throw new Error("Wallet is not connected.");let a=fe(i.fromToken),d=fe(i.toToken),f=_(a,d);if(!f)throw new Error("Route is not available.");if(!Fe(f.type)&&f.type!=="swap-bridge"||f.from.isNativeToken)return null;let w=ye(i.fromAmount);if(w<=0n)return null;let N=await ve(f);return!N||await Oe(o,{address:f.from.address,abi:qt,functionName:"allowance",args:[t,N],chainId:f.from.chainId})>=w?null:{token:i.fromToken,tokenAddress:f.from.address,spenderAddress:N,amount:i.fromAmount}},[_,ve,o,t]),nt=ie(async(i,a)=>{let d=ye(a.amount||i.fromAmount);if(d<=0n)throw new Error("Approval amount is empty.");await oe(a.token.chainId);let f=await An(o,{address:a.tokenAddress,abi:qt,functionName:"approve",args:[a.spenderAddress,d],chainId:a.token.chainId});await Pr(o,{hash:f,chainId:a.token.chainId})},[oe,o]),Be=ie(async(i,a)=>{let d=await _e(i,a);await oe(d.chainId);let f=await Nn(o,d.chainId,d.fallbackGasLimit,Ar(a.type),{account:t,address:d.address,abi:d.abi,functionName:d.functionName,args:d.args,value:d.value});return{txHash:await An(o,{address:d.address,abi:d.abi,functionName:d.functionName,args:d.args,value:d.value,chainId:d.chainId,...f}),fromToken:i.fromToken,toToken:i.toToken,fromAmount:i.fromAmount,toAmount:i.toAmount}},[_e,oe,o,t]),Ge=ie(async(i,a)=>{let d=t;if(!d)throw new Error("Wallet is not connected.");let f=a.steps.find(pe=>pe.type==="bridge");if(!f?.bridgeAddress)throw new Error("Bridge route is not available.");let w=a.from.address,N=a.from.chainId,D=ye(i.fromAmount);if(D<=0n)throw new Error("Bridge amount is empty.");let A=await ee(a),G=Ze(A?.gasFee??A?.gas_fee),Y=Dn(D,A?.exFeeRate??A?.ex_fee_rate),S=D+Y+G,[F,V]=await Promise.all([Oe(o,{address:w,abi:Rn,functionName:"name",chainId:N}),Oe(o,{address:w,abi:Rn,functionName:"nonces",args:[d],chainId:N})]),$=BigInt(Math.floor(Date.now()/1e3)+300),j=await xr(o,{domain:{name:F,version:"1",chainId:N,verifyingContract:w},types:{Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},primaryType:"Permit",message:{owner:d,spender:f.bridgeAddress,value:S,nonce:V,deadline:$}}),{r:l,s:h,v:I,yParity:E}=vr(j),B=I!==void 0?Number(I):E+27,Ie={exFee:Y.toString(),from:N,fromToken:w,nonce:Number(V),gasFee:G.toString(),permitArgs:{account:d,deadline:$.toString(),r:l,s:h,token:w,v:B,value:S.toString()},to:d,toChainID:String(a.to.chainId),value:S.toString()},ze=await En(`${r.bridgeApi}/permit`,Ie),dt=ze?.requestId??ze?.request_id;if(!dt)throw new Error("Bridge permit request failed.");let Ne=await Vr(r.bridgeApi,dt);if(!jt(Ne))throw new Error("Bridge submitted, but confirmation timed out. Check History shortly.");return{txHash:Ne,fromToken:i.fromToken,toToken:i.toToken,fromAmount:i.fromAmount,toAmount:i.toAmount}},[r,ee,o,t]),ct=ie(async i=>{let a=$t(o),d=fe(i.fromToken),f=fe(i.toToken),w=_(d,f);if(!w)throw new Error("Route is not available.");if(!(Fe(w.type)||w.type==="swap-bridge"||w.type==="bridge-swap"||w.type==="bridge"))throw new Error("This bridge route is not supported yet.");let A=w.type==="bridge"&&w.from.chainId===r.chainIds.bsc&&w.from.address.toLowerCase()===r.contracts.BSC_CROSS.toLowerCase()?await Ge(i,w):await Be(i,w);return await ue(a),{...A,pathType:w.type,routeTokens:Ts(w,R)}},[R,r,_,ue,Ge,Be,o]);return{bridgeTokens:Se,bridgeHistory:H,getBridgeApproval:Qe,approveBridge:nt,getBridgeQuote:tt,getBridgeToTokens:Ve,submitBridge:ct,oneUsdPairs:Ue,isLoading:m.isLoading||b.isLoading||k.isLoading||T.isLoading||x.some(i=>i.isLoading)}}import{useEffect as Is,useMemo as jn}from"react";import{useAccount as xs,useConfig as Ps,useSendTransaction as Ss,useSwitchChain as As,useWriteContract as Rs}from"wagmi";import{getBalance as Os,readContract as Es,readContracts as _s,waitForTransactionReceipt as Bs}from"wagmi/actions";import{RelayDeposit as Qt}from"@nexus-cross/dapp-ui";import{jsx as Ls}from"react/jsx-runtime";var Ns=56,Ws=[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{name:"",type:"string"}]}],it=e=>e,Qn=!1;function ft(){let{address:e,chainId:t}=xs(),n=Ps(),{sendTransactionAsync:s}=Ss(),{writeContractAsync:o}=Rs(),{switchChainAsync:c}=As(),g=n.chains.some(u=>u.id===Ns);Is(()=>{g||Qn||(Qn=!0,console.warn("[connect-kit] CrossRelayDeposit: BNB Smart Chain (56) is not in the wagmi config \u2014 one-click deposit verification and fund recovery are disabled. Add `bsc` to `createCrossxConfig({ networks })` to enable them."))},[g]);let y=jn(()=>({sendTransaction:async({chainId:u,to:r,value:m,data:b})=>s({chainId:it(u),to:r,value:m,data:b}),writeContract:async({chainId:u,address:r,abi:m,functionName:b,args:C})=>o({chainId:it(u),address:r,abi:m,functionName:b,args:C}),readContract:g?async({chainId:u,address:r,abi:m,functionName:b,args:C})=>Es(n,{chainId:it(u),address:r,abi:m,functionName:b,args:C}):void 0,switchChain:async u=>{await c({chainId:it(u)})},waitForReceipt:async({chainId:u,hash:r})=>({status:(await Bs(n,{chainId:it(u),hash:r})).status==="success"?"success":"reverted"}),getBalance:async({chainId:u,address:r,token:m})=>{if(!m){let x=await Os(n,{chainId:it(u),address:r});return{value:x.value,decimals:x.decimals,symbol:x.symbol}}let b={address:m,abi:Ws,chainId:it(u)},C=await _s(n,{contracts:[{...b,functionName:"balanceOf",args:[r]},{...b,functionName:"decimals"},{...b,functionName:"symbol"}],allowFailure:!1}),[p,k,T]=C;return{value:p,decimals:k,symbol:T}}}),[n,g,s,o,c]);return jn(()=>({walletAddress:e,walletChainId:t,...y}),[e,t,y])}function Ds(e){let t=ft();return Ls(Qt,{...t,...e,requireWalletConnection:!0})}var Fs=Object.assign(Ds,{Trigger:Qt.Trigger,Content:Qt.Content});import{jsx as Hs}from"react/jsx-runtime";function zt({env:e,pairs:t,bridgeOptions:n,relay:s,restoreChainAfterSwitch:o=!0,waitForTransaction:c,onRequestConnect:g,...y}){let u=qs(e),{address:r}=Ms(),m=Gs(),{connectWallet:b}=Ae(),C=ft(),p=Ct({env:u,walletAddress:r,enabled:!0,restoreChainAfterSwitch:o}),{bridgeHistory:k,getBridgeQuote:T,getBridgeToTokens:x,getBridgeApproval:P,approveBridge:v,submitBridge:W}=p,R=zn(()=>({...n,history:k,getQuote:T,getToTokens:x,getApproval:P,approveBridge:v,submitBridge:W}),[v,k,n,P,T,x,W]),_=zn(()=>({...s,...C}),[s,C]),q=Us(async U=>{if((await Ks(m,{hash:U.txHash,chainId:U.fromToken.chainId})).status!=="success")throw new Error("Transaction reverted.")},[m]);return Hs($s,{...y,env:u,walletAddress:r,tokens:p.bridgeTokens,pairs:t??p.oneUsdPairs,loading:p.isLoading,bridge:R,relay:_,waitForTransaction:c??q,onRequestConnect:g??b})}import{useEffect as Xn,useRef as Vs,useState as Yn}from"react";import{useAccount as js}from"wagmi";function Xt(e){let{address:t,connector:n}=js(),{currentWallet:s}=Ae(),o=e?.walletId!==void 0?e.walletId:s,c=e?.connector!==void 0?e.connector:n,g=e?.address!==void 0?e.address:t,[y,u]=Yn({loginType:null,accountName:null,accounts:[],isResolved:!1}),r=Vs(new Map),[m,b]=Yn(0);return Xn(()=>{let C=!1;if(o!=="cross_embedded")return u({loginType:null,accountName:null,accounts:[],isResolved:!0}),()=>{C=!0};if(!c)return u({loginType:null,accountName:null,accounts:[],isResolved:!1}),()=>{C=!0};u(x=>({...x,isResolved:!1}));let p=20,k=300,T=async()=>{if(typeof c.getProvider!="function")return"retry";let x;try{x=await c.getProvider()}catch{return"retry"}let P=x?.sdk;if(!P)return"giveup";try{let L=P.getRNBridgeActiveWallet?.(),O=L?.walletName?.trim();L&&O&&r.current.set(L.address.toLowerCase(),O)}catch{}let[v,W]=await Promise.all([P.getUserInfo?.().catch(()=>null)??null,P.getAddresses?.().catch(()=>null)??null]);if(C)return"done";let R=v?.loginType,_=R==="google"||R==="apple"?R:null;if(!_)return"retry";let q=g?.toLowerCase(),U=q&&Array.isArray(W)?W.find(L=>L.address.toLowerCase()===q):null,z=Array.isArray(W)?W.filter(L=>/^0x[a-fA-F0-9]{40}$/.test(L.address)).map(L=>({address:L.address.toLowerCase(),...Number.isFinite(L.index)?{index:L.index}:{},...L.name?.trim()?{name:L.name.trim()}:{}})):[],M=q?r.current.get(q)?.trim():void 0,H=!U&&q&&/^0x[a-fA-F0-9]{40}$/.test(q)?[...z,{address:q,index:z.length,...M?{name:M}:{}}]:z,ke=M||U?.name?.trim()||(typeof U?.index=="number"?`Account ${U.index+1}`:g?`${g.slice(0,6)}\u2026${g.slice(-4)}`:null);return u({loginType:_,accountName:ke,accounts:H,isResolved:!0}),"done"};return(async()=>{for(let x=0;x<p;x++){if(C)return;let P=await T();if(P==="done")return;if(P==="giveup"){C||u({loginType:null,accountName:null,accounts:[],isResolved:!0});return}await new Promise(v=>setTimeout(v,k))}C||u({loginType:null,accountName:null,accounts:[],isResolved:!0})})(),()=>{C=!0}},[o,c,g,m]),Xn(()=>{if(o!=="cross_embedded"||!c||typeof c.getProvider!="function")return;let C=!1,p;return(async()=>{let k;try{k=await c.getProvider()}catch{return}if(C)return;let T=k?.sdk;T?.on&&(p=T.on("addressChanged",({address:x,walletName:P})=>{let v=P?.trim();v&&(r.current.set(x.toLowerCase(),v),b(W=>W+1))}))})(),()=>{C=!0,p?.()}},[o,c]),y}import{useCallback as Qs,useMemo as Yt,useRef as zs}from"react";import{useQuery as Xs}from"@tanstack/react-query";import{useAccount as Ys,useSignMessage as Js}from"wagmi";import{CrossAuthClient as Zs,HttpSafeDropApiAdapter as ei,ONE_POP_DEPLOYMENTS as ti,resolvePopEnvironment as ni}from"@nexus-cross/pop/api";function Jn(e,t){let n=[];for(let s of t)s.rejected||n.push({id:`pending-${s.claimAddress}`,direction:"received",handle:s.sender.handle||s.sender.address,...s.sender.profileImageUrl?{avatarUrl:s.sender.profileImageUrl}:{},amountRaw:s.amount.toString(),decimals:18,timestamp:Date.parse(s.depositedAt)||0,status:"ready"});for(let s of e){let o=s.status.toLowerCase(),c=(s.resolvedAt?Date.parse(s.resolvedAt):0)||Date.parse(s.depositedAt)||0,g={id:`${s.type}-${s.id}`,amountRaw:s.amount.toString(),decimals:18,timestamp:c};if(s.type==="sent"){n.push({...g,direction:"sent",handle:s.receiver.handle||s.receiver.address||"",...s.receiver.profileImageUrl?{avatarUrl:s.receiver.profileImageUrl}:{},status:o==="claimed"?"claimed":o==="refunded"?"refunded":"waiting"});continue}o==="claimed"&&n.push({...g,direction:"received",handle:s.sender.handle||s.sender.address,...s.sender.profileImageUrl?{avatarUrl:s.sender.profileImageUrl}:{},status:"claimed"})}return n.sort((s,o)=>o.timestamp-s.timestamp),n}var to="one-pop-summary",eo=20,kt=new Map;function oi(e){e?kt.delete(e.toLowerCase()):kt.clear()}function Jt(e={}){let{enabled:t=!1,environment:n,token:s,apiBaseUrl:o,authBaseUrl:c,getJwt:g,repliesWaitingCount:y=0}=e,u=Yt(()=>{if(s)return s;let P=ni(n);return ti[P]?.contracts?.permitErc20},[s,n]),{address:r,chainId:m}=Ys(),{signMessageAsync:b}=Js(),C=zs(null),p=Qs(async()=>{if(g)return g();if(!r||!m)return;let P=r.toLowerCase(),v=kt.get(P);if(v)return v;if(C.current)return C.current;let W=(async()=>{let R=new Zs(c?{baseUrl:c}:{}),{message:_}=await R.unsignedHash(m,r),q=await b({message:_}),{token:U}=await R.siweToken(r,q);return kt.set(P,U),U})();C.current=W;try{return await W}catch(R){throw kt.delete(P),R}finally{C.current=null}},[g,r,m,c,b]),k=Yt(()=>new ei({...o?{baseUrl:o}:{},getJwt:p}),[o,p]),T=Xs({queryKey:[to,r?.toLowerCase()??null,u?.toLowerCase()??null],enabled:t&&!!r,retry:!1,refetchOnWindowFocus:!1,staleTime:6e4,queryFn:async()=>{let[P,v,W,R]=await Promise.all([u?k.listDrops({token:u}).catch(()=>null):Promise.resolve(null),k.listHistories({type:"sent",page:1,pageSize:eo}).catch(()=>null),k.listHistories({type:"received",page:1,pageSize:eo}).catch(()=>null),k.getXConnection().catch(()=>null)]);return{drops:P,items:[...v?.items??[],...W?.items??[]],xConnected:!!R}}});return{summary:Yt(()=>{if(!t||!r)return;if(!T.data)return T.isLoading?{claimableCount:0,claimableTotalRaw:"0",claimableDecimals:18,repliesWaitingCount:y,activity:[],xConnected:!1,isLoading:!0}:void 0;let{drops:P,items:v,xConnected:W}=T.data;return{claimableCount:P?.count??0,claimableTotalRaw:(P?.totalAmount??0n).toString(),claimableDecimals:18,repliesWaitingCount:y,activity:Jn(v,P?.items??[]),xConnected:W,isLoading:!1}},[t,r,T.data,T.isLoading,y]),isLoading:T.isLoading,error:T.error??null,refetch:T.refetch}}import{Fragment as ro,jsx as le,jsxs as at}from"react/jsx-runtime";var hi=[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"totalSupply",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint8"}]}],wi=[{type:"function",name:"earned",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{name:"account",type:"address"}],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"posaActive",stateMutability:"view",inputs:[],outputs:[{name:"",type:"bool"}]},{type:"function",name:"lastRewardBlock",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]},{type:"function",name:"totalStaked",stateMutability:"view",inputs:[],outputs:[{name:"",type:"uint256"}]}],Ci={dev:{poolAddress:"0x0000000c5BB5C7B081237B5efaFC753D61201b94",crossChainId:612044,networkStatsUrl:"https://stg-posa-api.crosstoken.io/api/v1/network/stats"},stage:{poolAddress:"0x0000000c5BB5C7B081237B5efaFC753D61201b94",crossChainId:612044,networkStatsUrl:"https://stg-posa-api.crosstoken.io/api/v1/network/stats"},production:{poolAddress:"0x000000068122d9bB43B4BCF5497A10EdfA9F5E93",crossChainId:612055,networkStatsUrl:"https://posa-api.crosstoken.io/api/v1/network/stats"}},tn=10n**18n,ki={google:{name:"Google",iconUrl:io,connectorId:et.CROSSx},apple:{name:"Apple",iconUrl:rn,connectorId:et.CROSSx},cross:{name:vt.default,iconUrl:on,connectorId:et.CROSSx},metamask:{name:"MetaMask",iconUrl:ao,connectorId:et.MetaMask},binance:{name:"Binance Wallet",iconUrl:so,connectorId:et.Binance}};function Ti(e){switch(e){case"cross_embedded":return et.CROSSx;case"metamask":return et.MetaMask;case"binance":return et.Binance;default:return}}function vi(e,t){switch(e){case"cross_embedded":return t==="google"?{name:"Google",iconUrl:io}:t==="apple"?{name:"Apple",iconUrl:rn}:{name:vt.default,iconUrl:on};case"cross_wallet":return{name:vt.default,iconUrl:on};case"cross_extension":return{name:vt.extension,iconUrl:bi};case"metamask":return{name:"MetaMask",iconUrl:ao};case"binance":return{name:"Binance Wallet",iconUrl:so};default:return null}}function Ii(e){if(e)return e==="cross_embedded"?vt.default:fi[e]?.name}function xi({label:e="Connect Wallet",className:t,style:n,walletInfoStyle:s,user:o,enablePortfolio:c,portfolio:g,theme:y,accountName:u,connectorId:r,showPortfolio:m,sendAccounts:b,getTransactionReceipt:C,sendTransaction:p,estimateGas:k,onDisconnect:T,onSelectWallet:x,onBuy:P,onRampRedirectUrl:v,onePopSummary:W,onOnePopOpen:R,onePopGetTokenSlot:_,onePopGetTokenOptions:q,showOnePop:U,bridgeTokens:z,bridgeHistory:M,getBridgeQuote:H,getBridgeToTokens:Ee,getBridgeApproval:ke,approveBridge:L,submitBridge:O,showBalance:X=!0,env:ee,...Se}){let{address:Ue,isConnected:Ve,connector:Me,chain:oe}=ai(),ue=di(),re=ci(),{switchChainAsync:Te}=ui(),{sendTransactionAsync:_e}=li(),{connectWallet:je,disconnect:be,selectWallet:tt,currentWallet:ve,isConnecting:Qe,kitConfig:nt}=Ae(),Be=nt?.restoreChainAfterSwitch!==!1,Ge=!!nt?.onePopEnabled,ct=yt(),i=y??ct?.mode??"dark",a=Tt(()=>mi(ee),[ee]),d=o?.address??Ue,f=o?ki[o.provider]:null,{loginType:w,accountName:N,accounts:D}=Xt({walletId:ve,connector:Me,address:d}),A=Tt(()=>f?{name:f.name,iconUrl:f.iconUrl}:vi(ve,w),[f,ve,w]),G=u??o?.name??N??void 0,Y=Se.connectorName??(f?f.name:Ii(ve)),S=f?f.connectorId:Ti(ve),F=r??S,V=g??m??!!c,$=Ct({env:a,walletAddress:d,enabled:Ve&&!!d&&X,restoreChainAfterSwitch:Be}),j=z??$.bridgeTokens,l=M??$.bridgeHistory,h=H??$.getBridgeQuote,I=Ee??$.getBridgeToTokens,E=ke??$.getBridgeApproval,B=L??$.approveBridge,Ie=O??$.submitBridge,ze=He(()=>{je().catch(K=>{console.error("[crossx-kit] connectWallet error:",K)})},[je]),dt=He(()=>{be()},[be]),Ne=T??dt,pe=gi(),{eligibility:Wt}=yi({network:oe?String(oe.id):void 0}),It=Wt?.allowed===!0,mo=Tt(()=>{if(P)return P;if(!(!pe||!oe||!It))return()=>pe.open({crypto:oe.nativeCurrency?.symbol??"USDT",network:String(oe.id),...v?{redirectUrl:v}:{}}).then(()=>{}).catch(K=>{throw console.warn("[crossx-kit] onramp open failed:",K),K})},[P,pe,oe,It,v]),cn=ii();ri(()=>{if(pe?.onStatus)return pe.onStatus(()=>{cn.invalidateQueries()})},[pe,cn]);let fo=Tt(()=>{if(!P&&!(!pe||!oe)&&!It)return"On-ramp is not available in your region."},[P,pe,oe,It]),[go,yo]=si(!1),bo=He(()=>{yo(!0),R?.()},[R]),{summary:ho}=Jt({enabled:Ge&&!W&&go,environment:a}),wo=W??ho,Dt=U??Ge,Co=Tt(()=>{if(_!==void 0)return _;if(Dt)return le(zt,{...q,env:a,theme:i,mode:"button",buttonComponent:pi})},[q,_,a,Dt,i]),ko=Se.onBridgeDisabledMessage,To=Se.onSendDisabledMessage,vo=o?o.provider==="google"||o.provider==="apple":ve==="cross_embedded",Io=He(()=>{tt().catch(K=>{console.error("[crossx-kit] selectWallet error:",K)})},[tt]),dn=x??(vo?Io:void 0),xo=He(async({hash:K,chainId:te})=>{let se=Zt(ue,te?{chainId:te}:void 0);if(!se)return null;try{return await se.getTransactionReceipt({hash:K})}catch{return null}},[ue]),Po=He(async K=>{let te=re,se=!1;K.chainId!==void 0&&K.chainId!==re&&(await Te({chainId:K.chainId}),se=!0);let me=K.chainId===56||K.chainId===97?{...K,type:"legacy"}:K,J=await(p??_e)(me);return await Rt({getChainId:()=>se?K.chainId:te,switchChain:we=>Te({chainId:we})},te,Be),J},[p,_e,re,Te,Be]),So=V||p?Po:void 0,Ao=He(async K=>{let te=K.chainId??re,se=Zt(ue,te?{chainId:te}:void 0);if(!se)throw new Error(`publicClient for chainId ${te??"unknown"} is not available \u2014 register the chain in createCrossxConfig({ networks }).`);let he=te===56||te===97,[me,xe]=await Promise.all([se.estimateGas({account:K.from,to:K.to,value:K.value,data:K.data}),(async()=>{if(he)return{maxFeePerGas:void 0,maxPriorityFeePerGas:void 0,gasPrice:await se.getGasPrice()};try{let J=await se.estimateFeesPerGas();return{maxFeePerGas:J.maxFeePerGas,maxPriorityFeePerGas:J.maxPriorityFeePerGas,gasPrice:void 0}}catch{return{maxFeePerGas:void 0,maxPriorityFeePerGas:void 0,gasPrice:await se.getGasPrice()}}})()]);return{gasLimit:me,maxFeePerGas:xe.maxFeePerGas,maxPriorityFeePerGas:xe.maxPriorityFeePerGas,gasPrice:xe.gasPrice}},[ue,re]),Ro=k??Ao,Oo=He(async K=>{let te={};if(!Ue||K.length===0)return te;let se=K.flatMap(me=>{let J={address:me,abi:hi,chainId:re};return[{...J,functionName:"balanceOf",args:[Ue]},{...J,functionName:"totalSupply"},{...J,functionName:"decimals"}]}),he;try{he=await no(ue,{contracts:se,allowFailure:!0})}catch{return te}return K.forEach((me,xe)=>{let J=xe*3,we=he[J],xt=he[J+1],lt=he[J+2];!we||we.status!=="success"||(te[me.toLowerCase()]={balance:we.result,totalSupply:xt&&xt.status==="success"?xt.result:void 0,decimals:lt&&lt.status==="success"?Number(lt.result):void 0})}),te},[ue,Ue,re]),Eo=He(async K=>{let te={earnedWei:0n,stakedWei:0n};if(!K)return te;let se=Ci[a],he={address:se.poolAddress,abi:wi,chainId:se.crossChainId},me;try{me=await no(ue,{allowFailure:!0,contracts:[{...he,functionName:"earned",args:[K]},{...he,functionName:"balanceOf",args:[K]},{...he,functionName:"posaActive"},{...he,functionName:"lastRewardBlock"},{...he,functionName:"totalStaked"}]})}catch{return te}let xe=ot=>me[ot]&&me[ot].status==="success"?me[ot].result:0n,J=xe(0),we=xe(1);if(me[2]&&me[2].status==="success"?me[2].result:!1)return{earnedWei:J,stakedWei:we};let lt=xe(3),pn=xe(4);if(pn===0n)return{earnedWei:J,stakedWei:we};let Ft=0n;try{Ft=await Zt(ue,{chainId:se.crossChainId})?.getBlockNumber?.()??0n}catch{return{earnedWei:J,stakedWei:we}}if(Ft<=lt)return{earnedWei:J,stakedWei:we};let Lt=0n;try{let ot=await fetch(se.networkStatsUrl).then(Ut=>Ut.json()),mn=ot?.data?.block_reward??ot?.block_reward;if(mn){let[Ut,Wo=""]=String(mn).split("."),Do=(Wo+"0".repeat(18)).slice(0,18);Lt=BigInt(Ut||"0")*tn+BigInt(Do||"0")}}catch{}if(Lt===0n)return{earnedWei:J,stakedWei:we};let Bo=(Ft-lt)*Lt*tn/pn,No=we*Bo/tn;return{earnedWei:J+No,stakedWei:we}},[ue,a]),ln=!dn,un=t?`cb-button ${t}`:"cb-button",_o=t?`cb-pill ${t}`:"cb-pill";return Qe&&!Ve?at(ro,{children:[le("style",{children:nn}),at("button",{type:"button",disabled:!0,className:un,style:n,"aria-busy":"true",children:[le("span",{className:"cb-spinner","aria-hidden":"true"}),le("span",{className:"cb-button-label",children:"Connecting..."})]})]}):Ve&&d?at("span",{"data-crossx-wallet-info":ln?"external":"embedded",children:[le("style",{children:nn}),ln&&le("style",{children:Si}),at(en,{...Se,env:a,theme:i,showBalance:X,walletAddress:d,accountName:G,sendAccounts:b??D,connectorName:Y,connectorId:F,showPortfolio:V,showOnePop:Dt,onePopSummary:wo,onOnePopOpen:bo,onePopGetTokenSlot:Co,onDisconnect:Ne,onSelectWallet:dn,onBuy:mo,onBuyDisabledMessage:fo,onBridgeDisabledMessage:ko,onSendDisabledMessage:To,sendTransaction:So,getTransactionReceipt:C??xo,estimateGas:Ro,lpBalanceReader:Oo,stakingRewardsReader:Eo,bridgeTokens:j,bridgeHistory:l,getBridgeQuote:h,getBridgeToTokens:I,getBridgeApproval:E,approveBridge:B,submitBridge:Ie,style:s,children:[le(en.Trigger,{asChild:!0,children:at("button",{type:"button",className:_o,style:n,"aria-label":`Connected with ${A?.name??"wallet"}: ${oo(d)}`,children:[A?.iconUrl?le("img",{src:A.iconUrl,alt:"",width:20,height:20,className:"cb-pill-icon","data-provider":A.iconUrl===rn?"apple":void 0}):le("span",{className:"cb-pill-icon-placeholder","aria-hidden":"true"}),le("span",{className:"cb-pill-address",children:oo(d)})]})}),le(en.Content,{align:"end",sideOffset:8})]})]}):at(ro,{children:[le("style",{children:nn}),at("button",{type:"button",onClick:ze,className:un,style:n,"aria-label":typeof e=="string"?e:"Connect Wallet",children:[le(Pi,{}),le("span",{className:"cb-button-label",children:e})]})]})}function Pi(){return le("svg",{className:"cb-button-icon",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:le("path",{d:"M11.4368 10.5007C11.4368 9.9538 11.6544 9.42855 12.041 9.04175C12.4278 8.65492 12.9529 8.4375 13.5 8.4375H15.1875V6.00073L15.1732 5.92822C15.1639 5.90585 15.15 5.88528 15.1326 5.8678C15.0973 5.83263 15.0494 5.81287 14.9996 5.81287H3.74963C3.4787 5.81287 3.21001 5.75949 2.95972 5.65576C2.90937 5.63488 2.86089 5.61017 2.8125 5.58545V14.2504C2.8125 14.4989 2.91141 14.7371 3.08716 14.9128C3.2629 15.0886 3.50109 15.1875 3.74963 15.1875H15.0007C15.0252 15.1875 15.0495 15.1826 15.0721 15.1732C15.0948 15.1638 15.1152 15.1499 15.1326 15.1326C15.1499 15.1152 15.1638 15.0948 15.1732 15.0721C15.1826 15.0495 15.1875 15.0252 15.1875 15.0007V12.5629H13.5C12.9529 12.5629 12.4278 12.3454 12.041 11.9586C11.6545 11.5719 11.4369 11.0475 11.4368 10.5007ZM12.5618 10.5007C12.5619 10.7491 12.6609 10.9875 12.8364 11.1632C13.0123 11.3391 13.2513 11.4379 13.5 11.4379H15.75C15.7998 11.4379 15.8477 11.4182 15.8829 11.3829C15.9182 11.3477 15.9379 11.2998 15.9379 11.25V9.75037C15.9379 9.70054 15.9182 9.65266 15.8829 9.61743C15.8477 9.5822 15.7998 9.5625 15.75 9.5625H13.5C13.2513 9.5625 13.0123 9.66131 12.8364 9.83716C12.6607 10.013 12.5618 10.2522 12.5618 10.5007ZM13.6879 3.00037C13.6879 2.95054 13.6682 2.90266 13.6329 2.86743C13.5977 2.8322 13.5498 2.8125 13.5 2.8125H3.74963C3.50109 2.8125 3.2629 2.91141 3.08716 3.08716C2.91141 3.2629 2.8125 3.50109 2.8125 3.74963L2.81689 3.84192C2.82585 3.93354 2.8486 4.02351 2.88391 4.10889C2.93096 4.22263 3.00015 4.32614 3.08716 4.41321C3.17403 4.50009 3.2769 4.56936 3.39038 4.61646C3.50412 4.66359 3.62651 4.68787 3.74963 4.68787H13.6879V3.00037ZM14.8129 4.68787H14.9996C15.3473 4.68787 15.6808 4.82576 15.9269 5.07129C16.173 5.31702 16.3119 5.65077 16.3125 5.99854V8.56494C16.4469 8.62873 16.5711 8.7148 16.6783 8.82202C16.9246 9.06823 17.0629 9.40217 17.0629 9.75037V11.25C17.0629 11.5982 16.9246 11.9321 16.6783 12.1783C16.5712 12.2855 16.4468 12.3706 16.3125 12.4343V14.9985L16.3059 15.1282C16.2934 15.2564 16.2619 15.3822 16.2125 15.5017C16.1466 15.6612 16.05 15.806 15.928 15.928C15.806 16.05 15.6612 16.1466 15.5017 16.2125C15.3425 16.2783 15.1719 16.3126 14.9996 16.3125H3.74963C3.20272 16.3125 2.67847 16.095 2.29175 15.7083C1.90502 15.3215 1.6875 14.7973 1.6875 14.2504V3.74963C1.6875 3.20272 1.90502 2.67847 2.29175 2.29175C2.67847 1.90502 3.20272 1.6875 3.74963 1.6875H13.5C13.8482 1.6875 14.1821 1.82581 14.4283 2.07202C14.6746 2.31823 14.8129 2.65217 14.8129 3.00037V4.68787Z",fill:"currentColor"})})}var Si=`
3
3
  [data-crossx-wallet-info="external"] .wi-select-wallet-btn {
4
4
  display: none !important;
package/dist/client.js CHANGED
@@ -1 +1 @@
1
- import{A as ie,B as se,C as de,D as pe,E as ce,F as le,G as ue,H as fe,I as Ce,J as we,K as me,L as ge,M as ye,N as Ne,O as ve,P as xe,Q as Ee,a as S,b as V,c as W,d as X,e as L,f as h,g as j,h as B,i as F,j as D,k as U,l as q,m as z,n as $,o as G,p as H,q as J,r as Q,s as Y,t as Z,u as ee,v as ne,w as te,x as oe,y as re,z as ae}from"./chunk-YI4N53HO.js";import{bscMainnetNetwork as v,bscTestnetNetwork as x,createCrossxConfig as E,crossMainnetNetwork as k,crossTestnetNetwork as O}from"@nexus-cross/connect-kit-wagmi";import{toNexusAdapter as A}from"@nexus-cross/connect-kit-wagmi/to-nexus";import{reownAdapter as M}from"@nexus-cross/connect-kit-wagmi/reown";import{embeddedConnectorFactory as P}from"@nexus-cross/connect-kit-wagmi/embedded";import{WALLET_BRAND_NAME as I}from"@nexus-cross/crossx-design-system";function d(e){try{return import.meta.env?.[e]}catch{return}}function p(e){if(!(typeof process>"u"))return process.env?.[e]}function K(){return d("VITE_CROSSX_ENVIRONMENT")??d("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??p("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??p("CROSSX_ENVIRONMENT")}function R(e){switch(e?.toLowerCase()){case"dev":case"development":return"development";case"stage":case"staging":case"stg":return"staging";default:return"production"}}function T(e){return e==="production"?[k,v]:[O,x]}function b(){let e=typeof window<"u"&&window.location?.origin?window.location.origin:"https://example.com";return{name:`${I} DApp`,url:e}}function _(e){let{app:c,appMetadata:l,networks:u,defaultNetwork:f,wallets:n,embedded:C=!0,environment:w,toNexus:t,reown:o,...r}=e,m=R(w??K()),i=u??T(m),a=Array.isArray(n)?null:n??"all",s=a!=="external-only"&&t!==!1,g=a!=="cross-only"&&o!==!1&&!!r.reownProjectId,y=t===!1?void 0:t,N=o===!1?void 0:o;if(a==="external-only"&&!r.reownProjectId)throw new Error('[crossx-kit] createConnectKitConfig({ wallets: "external-only" }) requires `reownProjectId`.');return E({...r,appMetadata:l??c??b(),networks:i,defaultNetwork:f??i[0],...Array.isArray(n)?{wallets:n}:{},...s?{crossProvider:A(y)}:{},...g?{reownProvider:M(N)}:{},...s&&C?{embeddedConnectorFactory:P}:{}})}export{de as AppLauncher,ce as AppLauncherContent,pe as AppLauncherTrigger,$ as ConnectButton,ve as ConnectionStatus,se as ConnectorId,L as CrossConnectKitProvider,X as CrossConnectModal,F as CrossGetOneUsd,B as CrossRelayDeposit,H as CrossRelayHistory,J as CrossRelayRecovery,we as DEFAULT_TRUSTED_FACTORIES,re as KycError,oe as KycProvider,U as ONE_POP_SUMMARY_QUERY_KEY,Ne as OnRampError,ee as OnRampProvider,G as OtherWalletsModal,Ce as RelayApiError,ue as SkillsButton,ie as WalletInfo,q as clearOnePopJwtCache,_ as createConnectKitConfig,fe as createRelayClient,xe as formatBalance,Ee as formatWei,ae as launchKycVerification,Q as useConnectKitAnalytics,S as useCrossConnectKit,V as useCrossConnectKitTheme,h as useCrossdBridgeAdapter,D as useCrossxEmbeddedInfo,le as useGlobalMenu,ne as useKyc,Y as useOnRamp,Z as useOnRampEligibility,z as useOnePopSummary,W as useOptionalCrossConnectKitTheme,te as useOptionalKyc,me as useRelayConfig,ge as useRelayOrders,ye as useRelayRecovery,j as useRelayWalletProps};
1
+ import{A as ie,B as se,C as de,D as pe,E as ce,F as le,G as ue,H as fe,I as Ce,J as we,K as me,L as ge,M as ye,N as Ne,O as ve,P as xe,Q as Ee,a as S,b as V,c as W,d as X,e as L,f as h,g as j,h as B,i as F,j as D,k as U,l as q,m as z,n as $,o as G,p as H,q as J,r as Q,s as Y,t as Z,u as ee,v as ne,w as te,x as oe,y as re,z as ae}from"./chunk-E7KEUA7Q.js";import{bscMainnetNetwork as v,bscTestnetNetwork as x,createCrossxConfig as E,crossMainnetNetwork as k,crossTestnetNetwork as O}from"@nexus-cross/connect-kit-wagmi";import{toNexusAdapter as A}from"@nexus-cross/connect-kit-wagmi/to-nexus";import{reownAdapter as M}from"@nexus-cross/connect-kit-wagmi/reown";import{embeddedConnectorFactory as P}from"@nexus-cross/connect-kit-wagmi/embedded";import{WALLET_BRAND_NAME as I}from"@nexus-cross/crossx-design-system";function d(e){try{return import.meta.env?.[e]}catch{return}}function p(e){if(!(typeof process>"u"))return process.env?.[e]}function K(){return d("VITE_CROSSX_ENVIRONMENT")??d("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??p("NEXT_PUBLIC_CROSSX_ENVIRONMENT")??p("CROSSX_ENVIRONMENT")}function R(e){switch(e?.toLowerCase()){case"dev":case"development":return"development";case"stage":case"staging":case"stg":return"staging";default:return"production"}}function T(e){return e==="production"?[k,v]:[O,x]}function b(){let e=typeof window<"u"&&window.location?.origin?window.location.origin:"https://example.com";return{name:`${I} DApp`,url:e}}function _(e){let{app:c,appMetadata:l,networks:u,defaultNetwork:f,wallets:n,embedded:C=!0,environment:w,toNexus:t,reown:o,...r}=e,m=R(w??K()),i=u??T(m),a=Array.isArray(n)?null:n??"all",s=a!=="external-only"&&t!==!1,g=a!=="cross-only"&&o!==!1&&!!r.reownProjectId,y=t===!1?void 0:t,N=o===!1?void 0:o;if(a==="external-only"&&!r.reownProjectId)throw new Error('[crossx-kit] createConnectKitConfig({ wallets: "external-only" }) requires `reownProjectId`.');return E({...r,appMetadata:l??c??b(),networks:i,defaultNetwork:f??i[0],...Array.isArray(n)?{wallets:n}:{},...s?{crossProvider:A(y)}:{},...g?{reownProvider:M(N)}:{},...s&&C?{embeddedConnectorFactory:P}:{}})}export{de as AppLauncher,ce as AppLauncherContent,pe as AppLauncherTrigger,$ as ConnectButton,ve as ConnectionStatus,se as ConnectorId,L as CrossConnectKitProvider,X as CrossConnectModal,F as CrossGetOneUsd,B as CrossRelayDeposit,H as CrossRelayHistory,J as CrossRelayRecovery,we as DEFAULT_TRUSTED_FACTORIES,re as KycError,oe as KycProvider,U as ONE_POP_SUMMARY_QUERY_KEY,Ne as OnRampError,ee as OnRampProvider,G as OtherWalletsModal,Ce as RelayApiError,ue as SkillsButton,ie as WalletInfo,q as clearOnePopJwtCache,_ as createConnectKitConfig,fe as createRelayClient,xe as formatBalance,Ee as formatWei,ae as launchKycVerification,Q as useConnectKitAnalytics,S as useCrossConnectKit,V as useCrossConnectKitTheme,h as useCrossdBridgeAdapter,D as useCrossxEmbeddedInfo,le as useGlobalMenu,ne as useKyc,Y as useOnRamp,Z as useOnRampEligibility,z as useOnePopSummary,W as useOptionalCrossConnectKitTheme,te as useOptionalKyc,me as useRelayConfig,ge as useRelayOrders,ye as useRelayRecovery,j as useRelayWalletProps};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-YI4N53HO.js";export{C as AppLauncher,E as AppLauncherContent,D as AppLauncherTrigger,n as ConnectButton,O as ConnectionStatus,B as ConnectorId,e as CrossConnectKitProvider,d as CrossConnectModal,i as CrossGetOneUsd,h as CrossRelayDeposit,p as CrossRelayHistory,q as CrossRelayRecovery,J as DEFAULT_TRUSTED_FACTORIES,y as KycError,x as KycProvider,k as ONE_POP_SUMMARY_QUERY_KEY,N as OnRampError,u as OnRampProvider,o as OtherWalletsModal,I as RelayApiError,G as SkillsButton,A as WalletInfo,l as clearOnePopJwtCache,H as createRelayClient,P as formatBalance,Q as formatWei,z as launchKycVerification,r as useConnectKitAnalytics,a as useCrossConnectKit,b as useCrossConnectKitTheme,f as useCrossdBridgeAdapter,j as useCrossxEmbeddedInfo,F as useGlobalMenu,v as useKyc,s as useOnRamp,t as useOnRampEligibility,m as useOnePopSummary,c as useOptionalCrossConnectKitTheme,w as useOptionalKyc,K as useRelayConfig,L as useRelayOrders,M as useRelayRecovery,g as useRelayWalletProps};
1
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-E7KEUA7Q.js";export{C as AppLauncher,E as AppLauncherContent,D as AppLauncherTrigger,n as ConnectButton,O as ConnectionStatus,B as ConnectorId,e as CrossConnectKitProvider,d as CrossConnectModal,i as CrossGetOneUsd,h as CrossRelayDeposit,p as CrossRelayHistory,q as CrossRelayRecovery,J as DEFAULT_TRUSTED_FACTORIES,y as KycError,x as KycProvider,k as ONE_POP_SUMMARY_QUERY_KEY,N as OnRampError,u as OnRampProvider,o as OtherWalletsModal,I as RelayApiError,G as SkillsButton,A as WalletInfo,l as clearOnePopJwtCache,H as createRelayClient,P as formatBalance,Q as formatWei,z as launchKycVerification,r as useConnectKitAnalytics,a as useCrossConnectKit,b as useCrossConnectKitTheme,f as useCrossdBridgeAdapter,j as useCrossxEmbeddedInfo,F as useGlobalMenu,v as useKyc,s as useOnRamp,t as useOnRampEligibility,m as useOnePopSummary,c as useOptionalCrossConnectKitTheme,w as useOptionalKyc,K as useRelayConfig,L as useRelayOrders,M as useRelayRecovery,g as useRelayWalletProps};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nexus-cross/connect-kit-react",
3
- "version": "1.4.1-beta.1",
3
+ "version": "1.4.1-beta.2",
4
4
  "description": "React components and hooks for @nexus-cross/connect-kit wallet connection",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -24,13 +24,13 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@nexus-cross/connect-kit-core": "1.4.1-beta.1",
28
- "@nexus-cross/connect-kit-wagmi": "1.4.1-beta.1",
29
- "@nexus-cross/crossx-design-system": "1.4.1-beta.1",
30
- "@nexus-cross/dapp-ui": "1.4.1-beta.1",
31
- "@nexus-cross/kyc": "1.4.1-beta.1",
32
- "@nexus-cross/pop": "1.4.1-beta.1",
33
- "@nexus-cross/onramp": "1.4.1-beta.1"
27
+ "@nexus-cross/connect-kit-core": "1.4.1-beta.2",
28
+ "@nexus-cross/connect-kit-wagmi": "1.4.1-beta.2",
29
+ "@nexus-cross/crossx-design-system": "1.4.1-beta.2",
30
+ "@nexus-cross/dapp-ui": "1.4.1-beta.2",
31
+ "@nexus-cross/kyc": "1.4.1-beta.2",
32
+ "@nexus-cross/onramp": "1.4.1-beta.2",
33
+ "@nexus-cross/pop": "1.4.1-beta.2"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@tanstack/react-query": "^5.60.0",