@leapwallet/embedded-wallet-sdk-react
Version:
A react library for integrating metamask snaps on a cosmos dApp
2 lines • 1.84 MB
JavaScript
"use strict";var dC=Object.defineProperty;var uC=(C,m,I)=>m in C?dC(C,m,{enumerable:!0,configurable:!0,writable:!0,value:I}):C[m]=I;var sn=(C,m,I)=>(uC(C,typeof m!="symbol"?m+"":m,I),I);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const te=require("react/jsx-runtime"),DA=require("react"),ka=require("@tanstack/react-query"),pC=require("react-dom"),go=require("framer-motion"),Ji=require("@leapwallet/react-ui"),Qc=require("graz"),Bi=require("@leapwallet/embedded-wallet-sdk-core"),yC=require("@leapwallet/parser-parfait"),bn=require("swr"),xo=require("bignumber.js"),BC=require("viem"),xl=require("react-virtuoso"),ec=require("@phosphor-icons/react");require("long");require("@cosmjs/cosmwasm-stargate");require("@cosmjs/stargate");require("@cosmjs/tendermint-rpc");const IC=({children:C,onClick:m,isOpen:I})=>te.jsx(go.motion.div,{className:`fixed inset-0 bg-gray-400 bg-opacity-30 z-50 backdrop-blur-[var(--modal-overlay-blur)] leap-embedded-sdk
${I?"":"hidden"}`,initial:{opacity:0},animate:{opacity:I?1:0},transition:{duration:.3},onClick:m,children:C}),EC=({children:C,onClose:m,isOpen:I,closeOnBackdropClick:_=!0,closeOnEscape:M=!0,size:v="md"})=>{const b=DA.useRef(null),a0=DA.useCallback(M0=>{M0.stopPropagation()},[]),B0=DA.useCallback(()=>{_&&m()},[_,m]);return DA.useEffect(()=>{const M0=b.current;if(!M0||!M)return;const v0=B=>{B.key==="Escape"&&(B.stopPropagation(),m())};return M0.addEventListener("keydown",v0),document.addEventListener("keydown",v0),()=>{M0.removeEventListener("keydown",v0),document.removeEventListener("keydown",v0)}},[M,m]),te.jsx(te.Fragment,{children:I&&pC.createPortal(te.jsx(IC,{onClick:B0,isOpen:I,children:te.jsx("div",{ref:b,className:"fixed inset-0 top-0 right-0 h-full flex items-center justify-center",children:te.jsx("div",{className:`w-full flex justify-center overflow-hidden ${v==="sm"?"max-w-[24rem]":"max-w-[54rem]"}`,onClick:a0,children:C})})}),document.body)})},_C=()=>te.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 256 256",style:{color:"currentcolor"},children:te.jsx("path",{fill:"currentColor",d:"M120,136V80a8,8,0,0,1,16,0v56a8,8,0,0,1-16,0ZM232,91.55v72.9a15.86,15.86,0,0,1-4.69,11.31l-51.55,51.55A15.86,15.86,0,0,1,164.45,232H91.55a15.86,15.86,0,0,1-11.31-4.69L28.69,175.76A15.86,15.86,0,0,1,24,164.45V91.55a15.86,15.86,0,0,1,4.69-11.31L80.24,28.69A15.86,15.86,0,0,1,91.55,24h72.9a15.86,15.86,0,0,1,11.31,4.69l51.55,51.55A15.86,15.86,0,0,1,232,91.55Zm-16,0L164.45,40H91.55L40,91.55v72.9L91.55,216h72.9L216,164.45ZM128,160a12,12,0,1,0,12,12A12,12,0,0,0,128,160Z"})});class Sl extends DA.Component{constructor(m){super(m),this.state={hasError:!1}}static getDerivedStateFromError(m){return console.error(m),{hasError:!0}}componentDidCatch(m,I){console.error(m,I)}render(){const{style:m,theme:I}=this.props;return this.state.hasError?te.jsxs("div",{className:Ji.cn("w-[28rem] h-[44rem] flex flex-col items-center justify-center gap-6 rounded-[1rem] p-2 border leap-ui",{"leap-ui":I==="light","leap-ui dark":I==="dark"}),style:m,children:[te.jsx("div",{className:"rounded-full p-4 flex justify-center",children:te.jsx(_C,{})}),te.jsx("div",{className:"font-bold text-xl mt-8 text-center",children:"Something went wrong"}),te.jsx("div",{className:"text-sm mt-1 text-center",children:"It's not you, it's us. Please try again."}),te.jsx(Ji.Button,{variant:"outline",size:"xs",onClick:()=>{this.setState({hasError:!1})},className:"max-w-[40%] mt-8 border-none py-4 px-8 rounded-md font-bold text-base cursor-pointer",children:"Try Again"})]}):this.props.children}}const Gl=DA.createContext(null),T1=({primaryChainId:C="cosmoshub-4",connectWallet:m,disconnectWallet:I,connectedWalletType:_,chains:M,children:v})=>{const b=DA.useRef(!1),{connect:a0}=Qc.useConnect(),{disconnect:B0}=Qc.useDisconnect();DA.useEffect(()=>{_||B0()},[_]);const{data:M0,isDisconnected:v0}=Qc.useAccount({chainId:C??"cosmoshub-4"});DA.useEffect(()=>{_&&!M0&&!b.current&&(b.current=!0,a0({chainId:C??"cosmoshub-4",walletType:_}))},[_,M0,a0,C]);const B=_?M0==null?void 0:M0.bech32Address:void 0,$0=_?M0==null?void 0:M0.name:void 0,Ae=_?!!(M0!=null&&M0.isNanoLedger):!1;DA.useEffect(()=>{v0&&b.current&&(b.current=!1)},[v0]);const ge=DA.useMemo(()=>({walletName:$0,primaryChainId:C,connectedWalletType:_,connectWallet:m,disconnectWallet:I,isMainnet:!0,userAddress:B,isLedgerWallet:Ae,chains:M}),[B,$0,Ae,C,_,M,m,I]);return te.jsx(Gl.Provider,{value:ge,children:v})},O1=()=>{const C=DA.useContext(Gl);if(!C)throw new Error("useWalletClientContext must be used within a WalletProvider, check if you are using EmbeddedWalletProvider in your app");return C},Pl=DA.createContext(null),Nl=({children:C,chainData:m,enableWalletConnect:I,connectedWalletList:_})=>{const M=O1(),{data:v}=Qc.useAccount({multiChain:!0}),b=DA.useMemo(()=>{if(!I)return m;const a0={};if(v)for(const[B0,M0]of Object.entries(v))M0!=null&&M0.bech32Address&&(M.chains===void 0||M.chains.includes(B0))&&(a0[B0]={address:M0.bech32Address});return a0},[I,m,v,M.chains]);return te.jsx(Pl.Provider,{value:{chainData:b,enableWalletConnect:!!I,connectedWalletList:_},children:C})},dr=()=>{const C=DA.useContext(Pl);if(!C)throw new Error("useAccountContext must be used within an AccountContextProvider");return C},bC=()=>te.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",style:{color:"currentColor"},children:te.jsx("path",{d:"M18 13H13V18C13 18.55 12.55 19 12 19C11.45 19 11 18.55 11 18V13H6C5.45 13 5 12.55 5 12C5 11.45 5.45 11 6 11H11V6C11 5.45 11.45 5 12 5C12.55 5 13 5.45 13 6V11H18C18.55 11 19 11.45 19 12C19 12.55 18.55 13 18 13Z",fill:"currentColor"})}),wC=()=>te.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",style:{color:"currentColor"},children:[te.jsx("g",{clipPath:"url(#clip0_35_799)",children:te.jsx("path",{d:"M3.99117 11.3981L0.194608 15.2083C-0.0648694 15.4814 -0.0648694 15.9048 0.194608 16.1779L3.99117 19.9881C4.41453 20.4251 5.152 20.111 5.152 19.5101V17.0519H13.3597C14.1108 17.0519 14.7254 16.4374 14.7254 15.6863C14.7254 14.9351 14.1108 14.3206 13.3597 14.3206H5.152V11.876C5.152 11.2615 4.41453 10.961 3.99117 11.3981ZM23.8071 7.01425L20.0105 3.20402C19.5871 2.76701 18.8497 3.08111 18.8497 3.68201V6.12656H10.6283C9.87722 6.12656 9.26267 6.74111 9.26267 7.49223C9.26267 8.24335 9.87722 8.8579 10.6283 8.8579H18.836V11.3025C18.836 11.917 19.5735 12.2175 19.9968 11.7804L23.7934 7.97022C24.0665 7.71074 24.0665 7.27372 23.8071 7.01425Z",fill:"currentColor"})}),te.jsx("defs",{children:te.jsx("clipPath",{id:"clip0_35_799",children:te.jsx("rect",{width:"24",height:"24",fill:"white"})})})]}),vC=()=>te.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",style:{color:"currentColor"},children:te.jsx("path",{d:"M19 15.18V7C19 4.79 17.21 3 15 3C12.79 3 11 4.79 11 7V17C11 18.1 10.1 19 9 19C7.9 19 7 18.1 7 17V8.82C8.16 8.4 9 7.3 9 6C9 4.34 7.66 3 6 3C4.34 3 3 4.34 3 6C3 7.3 3.84 8.4 5 8.82V17C5 19.21 6.79 21 9 21C11.21 21 13 19.21 13 17V7C13 5.9 13.9 5 15 5C16.1 5 17 5.9 17 7V15.18C15.84 15.59 15 16.69 15 18C15 19.66 16.34 21 18 21C19.66 21 21 19.66 21 18C21 16.7 20.16 15.6 19 15.18Z",fill:"currentColor"})}),QC=()=>te.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",style:{color:"currentColor"},children:te.jsx("path",{d:"M10 16.2963H14C14.55 16.2963 15 15.8463 15 15.2963V10.2963H16.59C17.48 10.2963 17.93 9.21625 17.3 8.58625L12.71 3.99625C12.32 3.60625 11.69 3.60625 11.3 3.99625L6.71 8.58625C6.08 9.21625 6.52 10.2963 7.41 10.2963H9V15.2963C9 15.8463 9.45 16.2963 10 16.2963ZM6 18.2963H18C18.55 18.2963 19 18.7463 19 19.2963C19 19.8463 18.55 20.2963 18 20.2963H6C5.45 20.2963 5 19.8463 5 19.2963C5 18.7463 5.45 18.2963 6 18.2963Z",fill:"currentColor"})}),kC=()=>te.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",style:{color:"currentColor"},children:te.jsx("path",{d:"M11.9992 7.32626L18.3892 17.5563H5.60916L11.9992 7.32626ZM11.1492 4.91626L2.94916 18.0263C2.53916 18.6963 3.01916 19.5563 3.79916 19.5563H20.1992C20.9892 19.5563 21.4592 18.6963 21.0492 18.0263L12.8492 4.91626C12.4592 4.28626 11.5392 4.28626 11.1492 4.91626Z",fill:"currentColor"})}),FC=()=>{window.open("https://swapfast.app/","_blank","noopener noreferrer")},MC=()=>{window.open("https://swapfast.app/","_blank","noopener noreferrer")},xC=()=>{window.open("https://swapfast.app/","_blank","noopener noreferrer")},Rh=()=>{window.open("https://swapfast.app/","_blank","noopener noreferrer")};var Ul=(C=>(C.SEND="send",C.IBC="ibc",C.BUY="buy",C.SWAP="swap",C.BRIDGE="bridge",C))(Ul||{});const SC=[{id:"send",label:"Send",onClick:Rh,icon:te.jsx(QC,{})},{id:"ibc",label:"IBC",onClick:Rh,icon:te.jsx(kC,{})},{id:"buy",label:"Buy",onClick:FC,icon:te.jsx(bC,{})},{id:"swap",label:"Swap",onClick:MC,icon:te.jsx(wC,{})},{id:"bridge",label:"Bridge",onClick:xC,icon:te.jsx(vC,{})}],Kl=DA.createContext(null),jl=({children:C,config:m,showActionButtons:I})=>{const _=DA.useMemo(()=>{const M={};return[...SC].sort((b,a0)=>{var v0,B;const B0=((v0=m==null?void 0:m[b.id])==null?void 0:v0.order)??0,M0=((B=m==null?void 0:m[a0.id])==null?void 0:B.order)??0;return B0-M0}).forEach(({id:b,label:a0,onClick:B0,icon:M0})=>{const v0=m==null?void 0:m[b];M[b]={label:(v0==null?void 0:v0.label)??a0,onClick:(v0==null?void 0:v0.onClick)??B0,enabled:(v0==null?void 0:v0.enabled)??!0,icon:M0}}),M},[m]);return te.jsx(Kl.Provider,{value:{actionRecords:_,showActionButtons:!!I},children:C})},GC=()=>{const C=DA.useContext(Kl);if(!C)throw new Error("useActionListContext must be used within a ActionListProvider");return C},ql=DA.createContext(null),PC=({children:C})=>{const[m,I]=DA.useState(0);return te.jsx(ql.Provider,{value:{totalCurrencyValue:m,setTotalCurrencyValue:I},children:C})},Hl=()=>{const C=DA.useContext(ql);if(!C)throw new Error("useBalanceAmountContext must be used within a BalanceAmountProvider");return C},Yl=DA.createContext(null),zl=({children:C})=>{const[m,I]=DA.useState(Gn.HOME);return te.jsx(Yl.Provider,{value:{currentPage:m,setCurrentPage:I},children:C})},V1=()=>{const C=DA.useContext(Yl);if(!C)throw new Error("usePageContext must be used within PageContextProvider");return C},NC=({size:C="20"})=>te.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:C,height:C,viewBox:"0 0 20 20",style:{color:"currentcolor"},children:[te.jsx("g",{clipPath:"url(#clip0_122_165)",children:te.jsx("path",{d:"M5.59166 7.7418C5.91666 7.4168 6.44166 7.4168 6.76666 7.7418L10 10.9751L13.2333 7.7418C13.5583 7.4168 14.0833 7.4168 14.4083 7.7418C14.7333 8.0668 14.7333 8.5918 14.4083 8.9168L10.5833 12.7418C10.2583 13.0668 9.73333 13.0668 9.40833 12.7418L5.58333 8.9168C5.26666 8.60013 5.26666 8.0668 5.59166 7.7418Z",fill:"currentColor"})}),te.jsx("defs",{children:te.jsx("clipPath",{id:"clip0_122_165",children:te.jsx("rect",{width:"20",height:"20",fill:"white"})})})]}),UC=({children:C,label:m,onClick:I})=>te.jsxs("div",{className:"flex flex-col items-center gap-2",children:[te.jsx(Ji.Button,{variant:"outline",size:"sm-icon",className:"border-none bg-secondary rounded-full flex items-center justify-center h-14 w-14",onClick:I,children:C}),te.jsx("span",{className:"text-base font-bold leading-5",children:m})]}),KC=()=>{const{actionRecords:C,showActionButtons:m}=GC(),{totalCurrencyValue:I}=Hl(),{setCurrentPage:_}=V1(),M=Object.entries(C).filter(([,{enabled:v}])=>v);return te.jsxs("div",{className:"flex flex-col items-center gap-4 pt-10 px-5",children:[te.jsxs("div",{className:"flex flex-col items-center gap-4",children:[te.jsx("p",{className:"text-center text-4xl font-bold leading-none",children:Bi.formatAmount(I,!0)}),te.jsxs(Ji.Button,{variant:"outline",onClick:()=>_(Gn.ADDRESSES),className:"bg-card border-none rounded-full flex flex-row gap-1 items-center",children:[te.jsx("p",{children:"View addresses"}),te.jsx(NC,{})]})]}),te.jsx("div",{className:"grid grid-cols-5 gap-2 w-full p-2 mb-4",style:{gridTemplateColumns:`repeat(${M.length}, 1fr)`},children:m?M.map(([v,{label:b,onClick:a0,icon:B0}])=>te.jsx(UC,{label:b,onClick:a0,children:B0},v)):null})]})};var X1=(C=>(C.DENOM_TRACE="@leapwallet/embedded-wallet-sdk-core#0:denom-trace",C.DENOM_ORIGIN_TRACE="@leapwallet/embedded-wallet-sdk-core#0:denom-origin-trace",C.COIN_PRICES="@leapwallet/embedded-wallet-sdk-core#0:coin-prices",C.DENOM_DATA="@leapwallet/embedded-wallet-sdk-core#0:denom-data",C.CHAIN_DATA="@leapwallet/embedded-wallet-sdk-core#0:chain-data",C.NMS_REST_URLS="@leapwallet/embedded-wallet-sdk-core#0:nms-rest-urls",C.NMS_RPC_URLS="@leapwallet/embedded-wallet-sdk-core#0:nms-rpc-urls",C))(X1||{}),UA=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function jC(C){return C&&C.__esModule&&Object.prototype.hasOwnProperty.call(C,"default")?C.default:C}function qC(C){if(C.__esModule)return C;var m=C.default;if(typeof m=="function"){var I=function _(){return this instanceof _?Reflect.construct(m,arguments,this.constructor):m.apply(this,arguments)};I.prototype=m.prototype}else I={};return Object.defineProperty(I,"__esModule",{value:!0}),Object.keys(C).forEach(function(_){var M=Object.getOwnPropertyDescriptor(C,_);Object.defineProperty(I,_,M.get?M:{enumerable:!0,get:function(){return C[_]}})}),I}var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});Ea.bech32m=Ea.bech32=void 0;const tr="qpzry9x8gf2tvdw0s3jn54khce6mua7l",Jl={};for(let C=0;C<tr.length;C++){const m=tr.charAt(C);Jl[m]=C}function o2(C){const m=C>>25;return(C&33554431)<<5^-(m>>0&1)&996825010^-(m>>1&1)&642813549^-(m>>2&1)&513874426^-(m>>3&1)&1027748829^-(m>>4&1)&705979059}function Lh(C){let m=1;for(let I=0;I<C.length;++I){const _=C.charCodeAt(I);if(_<33||_>126)return"Invalid prefix ("+C+")";m=o2(m)^_>>5}m=o2(m);for(let I=0;I<C.length;++I){const _=C.charCodeAt(I);m=o2(m)^_&31}return m}function W1(C,m,I,_){let M=0,v=0;const b=(1<<I)-1,a0=[];for(let B0=0;B0<C.length;++B0)for(M=M<<m|C[B0],v+=m;v>=I;)v-=I,a0.push(M>>v&b);if(_)v>0&&a0.push(M<<I-v&b);else{if(v>=m)return"Excess padding";if(M<<I-v&b)return"Non-zero padding"}return a0}function HC(C){return W1(C,8,5,!0)}function YC(C){const m=W1(C,5,8,!1);if(Array.isArray(m))return m}function zC(C){const m=W1(C,5,8,!1);if(Array.isArray(m))return m;throw new Error(m)}function Rl(C){let m;C==="bech32"?m=1:m=734539939;function I(b,a0,B0){if(B0=B0||90,b.length+7+a0.length>B0)throw new TypeError("Exceeds length limit");b=b.toLowerCase();let M0=Lh(b);if(typeof M0=="string")throw new Error(M0);let v0=b+"1";for(let B=0;B<a0.length;++B){const $0=a0[B];if($0>>5)throw new Error("Non 5-bit word");M0=o2(M0)^$0,v0+=tr.charAt($0)}for(let B=0;B<6;++B)M0=o2(M0);M0^=m;for(let B=0;B<6;++B){const $0=M0>>(5-B)*5&31;v0+=tr.charAt($0)}return v0}function _(b,a0){if(a0=a0||90,b.length<8)return b+" too short";if(b.length>a0)return"Exceeds length limit";const B0=b.toLowerCase(),M0=b.toUpperCase();if(b!==B0&&b!==M0)return"Mixed-case string "+b;b=B0;const v0=b.lastIndexOf("1");if(v0===-1)return"No separator character for "+b;if(v0===0)return"Missing prefix for "+b;const B=b.slice(0,v0),$0=b.slice(v0+1);if($0.length<6)return"Data too short";let Ae=Lh(B);if(typeof Ae=="string")return Ae;const ge=[];for(let x0=0;x0<$0.length;++x0){const me=$0.charAt(x0),z0=Jl[me];if(z0===void 0)return"Unknown character "+me;Ae=o2(Ae)^z0,!(x0+6>=$0.length)&&ge.push(z0)}return Ae!==m?"Invalid checksum for "+b:{prefix:B,words:ge}}function M(b,a0){const B0=_(b,a0);if(typeof B0=="object")return B0}function v(b,a0){const B0=_(b,a0);if(typeof B0=="object")return B0;throw new Error(B0)}return{decodeUnsafe:M,decode:v,encode:I,toWords:HC,fromWordsUnsafe:YC,fromWords:zC}}Ea.bech32=Rl("bech32");Ea.bech32m=Rl("bech32m");class JC{constructor(){sn(this,"storage");sn(this,"length");this.storage={},this.length=0}setItem(m,I){this.storage[m]=I}getItem(m){return this.storage[m]||null}clear(){this.storage={}}removeItem(m){this.storage[m]=null}key(m){return this.storage[m]}}class Ll{constructor(m){sn(this,"cache",{});sn(this,"persistence");sn(this,"persistenceKey");typeof window<"u"?this.persistence=localStorage:this.persistence=new JC,this.persistenceKey=m;const I=this.persistence.getItem(this.persistenceKey);I&&(this.cache=JSON.parse(I))}get(m){return this.cache[m]}set(m,I){this.cache[m]=I,this.persistence.setItem(this.persistenceKey,JSON.stringify(this.cache))}clear(){this.cache={},this.persistence.setItem(this.persistenceKey,JSON.stringify(this.cache))}}new Ll(X1.DENOM_TRACE);const RC="https://api.leapwallet.io";class Th extends Error{constructor(I,_,M){const v=I.status||I.status===0?I.status:"",b=I.statusText||"",a0=`${v} ${b}`.trim(),B0=a0?`status code ${a0}`:"an unknown error";super(`Request failed with ${B0}: ${_.method} ${_.url}`);sn(this,"response");sn(this,"request");sn(this,"options");this.name="HTTPError",this.response=I,this.request=_,this.options=M}}class Tl extends Error{constructor(I){super(`Request timed out: ${I.method} ${I.url}`);sn(this,"request");this.name="TimeoutError",this.request=I}}const da=C=>C!==null&&typeof C=="object",zt=(...C)=>{for(const m of C)if((!da(m)||Array.isArray(m))&&m!==void 0)throw new TypeError("The `options` argument must be an object");return Z1({},...C)},Ol=(C={},m={})=>{const I=new globalThis.Headers(C),_=m instanceof globalThis.Headers,M=new globalThis.Headers(m);for(const[v,b]of M.entries())_&&b==="undefined"||b===void 0?I.delete(v):I.set(v,b);return I};function Jt(C,m,I){return Object.hasOwn(m,I)&&m[I]===void 0?[]:Z1(C[I]??[],m[I]??[])}const Vl=(C={},m={})=>({beforeRequest:Jt(C,m,"beforeRequest"),beforeRetry:Jt(C,m,"beforeRetry"),afterResponse:Jt(C,m,"afterResponse"),beforeError:Jt(C,m,"beforeError")}),Z1=(...C)=>{let m={},I={},_={};for(const M of C)if(Array.isArray(M))Array.isArray(m)||(m=[]),m=[...m,...M];else if(da(M)){for(let[v,b]of Object.entries(M))da(b)&&v in m&&(b=Z1(m[v],b)),m={...m,[v]:b};da(M.hooks)&&(_=Vl(_,M.hooks),m.hooks=_),da(M.headers)&&(I=Ol(I,M.headers),m.headers=I)}return m},LC=(()=>{let C=!1,m=!1;const I=typeof globalThis.ReadableStream=="function",_=typeof globalThis.Request=="function";if(I&&_)try{m=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return C=!0,"half"}}).headers.has("Content-Type")}catch(M){if(M instanceof Error&&M.message==="unsupported BodyInit type")return!1;throw M}return C&&!m})(),TC=typeof globalThis.AbortController=="function",OC=typeof globalThis.ReadableStream=="function",VC=typeof globalThis.FormData=="function",Xl=["get","post","put","patch","head","delete"],XC={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},c1=2147483647,Wl=Symbol("stop"),WC={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},ZC={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0},$C=C=>Xl.includes(C)?C.toUpperCase():C,e4=["get","put","head","delete","options","trace"],A4=[408,413,429,500,502,503,504],i4=[413,429,503],Oh={limit:2,methods:e4,statusCodes:A4,afterStatusCodes:i4,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:C=>.3*2**(C-1)*1e3},n4=(C={})=>{if(typeof C=="number")return{...Oh,limit:C};if(C.methods&&!Array.isArray(C.methods))throw new Error("retry.methods must be an array");if(C.statusCodes&&!Array.isArray(C.statusCodes))throw new Error("retry.statusCodes must be an array");return{...Oh,...C}};async function o4(C,m,I,_){return new Promise((M,v)=>{const b=setTimeout(()=>{I&&I.abort(),v(new Tl(C))},_.timeout);_.fetch(C,m).then(M).catch(v).then(()=>{clearTimeout(b)})})}async function c4(C,{signal:m}){return new Promise((I,_)=>{m&&(m.throwIfAborted(),m.addEventListener("abort",M,{once:!0}));function M(){clearTimeout(v),_(m.reason)}const v=setTimeout(()=>{m==null||m.removeEventListener("abort",M),I()},C)})}const a4=(C,m)=>{const I={};for(const _ in m)!(_ in ZC)&&!(_ in WC)&&!(_ in C)&&(I[_]=m[_]);return I};class rr{constructor(m,I={}){sn(this,"request");sn(this,"abortController");sn(this,"_retryCount",0);sn(this,"_input");sn(this,"_options");var _,M;if(this._input=m,this._options={...I,headers:Ol(this._input.headers,I.headers),hooks:Vl({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},I.hooks),method:$C(I.method??this._input.method),prefixUrl:String(I.prefixUrl||""),retry:n4(I.retry),throwHttpErrors:I.throwHttpErrors!==!1,timeout:I.timeout??1e4,fetch:I.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(TC){this.abortController=new globalThis.AbortController;const v=this._options.signal??this._input.signal;v==null||v.addEventListener("abort",()=>{this.abortController.abort(v.reason)}),this._options.signal=this.abortController.signal}if(LC&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=((M=(_=this._options).stringifyJson)==null?void 0:M.call(_,this._options.json))??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){const b="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),a0=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,b);(VC&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(a0,{...this.request}),this._options)}}static create(m,I){const _=new rr(m,I),M=async()=>{if(typeof _._options.timeout=="number"&&_._options.timeout>c1)throw new RangeError(`The \`timeout\` option cannot be greater than ${c1}`);await Promise.resolve();let a0=await _._fetch();for(const B0 of _._options.hooks.afterResponse){const M0=await B0(_.request,_._options,_._decorateResponse(a0.clone()));M0 instanceof globalThis.Response&&(a0=M0)}if(_._decorateResponse(a0),!a0.ok&&_._options.throwHttpErrors){let B0=new Th(a0,_.request,_._options);for(const M0 of _._options.hooks.beforeError)B0=await M0(B0);throw B0}if(_._options.onDownloadProgress){if(typeof _._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!OC)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return _._stream(a0.clone(),_._options.onDownloadProgress)}return a0},b=_._options.retry.methods.includes(_.request.method.toLowerCase())?_._retry(M):M();for(const[a0,B0]of Object.entries(XC))b[a0]=async()=>{_.request.headers.set("accept",_.request.headers.get("accept")||B0);const v0=(await b).clone();if(a0==="json"){if(v0.status===204||(await v0.clone().arrayBuffer()).byteLength===0)return"";if(I.parseJson)return I.parseJson(await v0.text())}return v0[a0]()};return b}_calculateRetryDelay(m){if(this._retryCount++,this._retryCount>this._options.retry.limit||m instanceof Tl)throw m;if(m instanceof Th){if(!this._options.retry.statusCodes.includes(m.response.status))throw m;const _=m.response.headers.get("Retry-After")??m.response.headers.get("RateLimit-Reset")??m.response.headers.get("X-RateLimit-Reset")??m.response.headers.get("X-Rate-Limit-Reset");if(_&&this._options.retry.afterStatusCodes.includes(m.response.status)){let M=Number(_)*1e3;Number.isNaN(M)?M=Date.parse(_)-Date.now():M>=Date.parse("2024-01-01")&&(M-=Date.now());const v=this._options.retry.maxRetryAfter??M;return M<v?M:v}if(m.response.status===413)throw m}const I=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,I)}_decorateResponse(m){return this._options.parseJson&&(m.json=async()=>this._options.parseJson(await m.text())),m}async _retry(m){try{return await m()}catch(I){const _=Math.min(this._calculateRetryDelay(I),c1);if(this._retryCount<1)throw I;await c4(_,{signal:this._options.signal});for(const M of this._options.hooks.beforeRetry)if(await M({request:this.request,options:this._options,error:I,retryCount:this._retryCount})===Wl)return;return this._retry(m)}}async _fetch(){for(const _ of this._options.hooks.beforeRequest){const M=await _(this.request,this._options);if(M instanceof Request){this.request=M;break}if(M instanceof Response)return M}const m=a4(this.request,this._options),I=this.request;return this.request=I.clone(),this._options.timeout===!1?this._options.fetch(I,m):o4(I,m,this.abortController,this._options)}_stream(m,I){const _=Number(m.headers.get("content-length"))||0;let M=0;return m.status===204?(I&&I({percent:1,totalBytes:_,transferredBytes:M},new Uint8Array),new globalThis.Response(null,{status:m.status,statusText:m.statusText,headers:m.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(v){const b=m.body.getReader();I&&I({percent:0,transferredBytes:0,totalBytes:_},new Uint8Array);async function a0(){const{done:B0,value:M0}=await b.read();if(B0){v.close();return}if(I){M+=M0.byteLength;const v0=_===0?0:M/_;I({percent:v0,transferredBytes:M,totalBytes:_},M0)}v.enqueue(M0),await a0()}await a0()}}),{status:m.status,statusText:m.statusText,headers:m.headers})}}/*! MIT License © Sindre Sorhus */const w1=C=>{const m=(I,_)=>rr.create(I,zt(C,_));for(const I of Xl)m[I]=(_,M)=>rr.create(_,zt(C,M,{method:I}));return m.create=I=>w1(zt(I)),m.extend=I=>(typeof I=="function"&&(I=I(C??{})),w1(zt(C,I))),m.stop=Wl,m},t4=w1(),r4=t4;r4.create({prefixUrl:RC});new Ll(X1.COIN_PRICES);var v1=(C=>(C.NUMIA="numia",C))(v1||{}),Ko=(C=>(C.BALANCE="balance",C.BALANCE_RICH="balance-rich",C.CHAINS="chains",C.DENOMS="denoms",C.DENOM_TRACE="denom-traces",C.TRANSACTIONS="transactions",C.NMS_REST_URLS="nms-rest-urls",C.LEAP_ASSETS="leap-assets",C.SKIP_CHAINS="skip-chains",C.SKIP_BALANCES="skip-balances",C))(Ko||{});const Vh={evm:1,btc:0,svm:2,cosmos:3},Sc=(C={})=>bn(Ko.CHAINS,async()=>(await Bi.getChains()).map(I=>I.privateInfra?{...I,chainType:"cosmos",restUrl:I.privateInfra[v1.NUMIA].restUrl,rpcUrl:I.privateInfra[v1.NUMIA].rpcUrl}:{...I,chainType:"cosmos"}),{dedupingInterval:1e3*60,...C}),$1=(C,m)=>{const I=(C==null?void 0:C.includeEVM)??!1,_=(C==null?void 0:C.includeSVM)??!1,M=(C==null?void 0:C.includeTestnets)??!1,v=(C==null?void 0:C.chainIds)??[],b=bn.unstable_serialize([Ko.SKIP_CHAINS,`includeEVM-${I}`,`includeSVM-${_}`,`includeTestnets-${M}`,`chainIds-${v.join("-")}`]);return bn(b,async()=>{const a0=await Bi.SkipAPI.getSupportedChains({chainIds:v,includeEVM:I,includeTestnets:M,includeSVM:_});if(a0.success)return a0.chains;throw new Error(`Failed: ${a0.error}`)},{dedupingInterval:1e3*60,...m})},es=(C={})=>bn(Ko.DENOMS,Bi.getDenoms,{dedupingInterval:1e3*60,...C}),Fa=(C,m={})=>{var M,v;const{data:I,mutate:_}=bn(Ko.DENOMS,Bi.getNMSRestURLs,m);return DA.useEffect(()=>{if(I){const b=I==null?void 0:I[C];if(!b)return;(async()=>{const B0=b.length;let M0=0,v0=b[0],B=!1;const $0=async()=>{try{(await fetch(`${v0.nodeUrl}/cosmos/base/node/v1beta1/status`)).ok&&(B=!0)}catch{}};for(;!B&&M0<B0;)await $0(),B||(M0++,b.push(b.shift()),v0=b[0]);B&&JSON.stringify(I[C])!==JSON.stringify(b)&&_({...I,[C]:b})})()}},[I,C,_]),(v=(M=I==null?void 0:I[C])==null?void 0:M[0])==null?void 0:v.nodeUrl},s4=new yC.TransactionParser,Xh=async(C,m,I,_,M)=>{const v=C.map(a0=>s4.parse(a0)).map(a0=>a0.success?a0.data:null).filter(a0=>a0!==null);return v.sort((a0,B0)=>{const M0=new Date(a0.timestamp).getTime();return new Date(B0.timestamp).getTime()-M0}),(await Promise.allSettled(v.map(a0=>Bi.getActivityCardContent({parsedTx:a0,address:m,denoms:M,chainId:I,restUrl:_})))).map(a0=>a0.status==="fulfilled"?a0.value:null).filter(a0=>a0!==null)};function h4(C,m,I){const{data:_}=Sc(),{data:M}=es(),v=Fa(m),b=DA.useRef(0),a0=DA.useRef(0);return ka.useInfiniteQuery(["activity",m,C],async({pageParam:B0=1})=>{const M0=B0;if(!_)throw new Error("Chains not loaded");const v0=_.find(x0=>x0.chainId===m);if(!v0)throw new Error("Chain not supported");const[{transactions:B,total:$0},{transactions:Ae,total:ge}]=await Promise.all([Bi.fetchTransactions(I??v??v0.restUrl,C,{pagination:{limit:50,offset:(M0-1)*50},transfer:"sender"}),Bi.fetchTransactions(I??v??v0.restUrl,C,{pagination:{limit:50,offset:(M0-1)*50},transfer:"recipient"})]);return b.current=B.length,a0.current=Ae.length,{sender:{total:$0,activity:await Xh(B,C,m,v0.restUrl,M)},recipient:{total:ge,activity:await Xh(Ae,C,m,v0.restUrl,M)}}},{getNextPageParam:(B0,M0)=>{if(B0.sender.activity.length!==0&&(b.current<B0.sender.total||a0.current<B0.recipient.total))return M0.length+1},enabled:!!M&&!!_,retry:2,refetchOnMount:!1,refetchOnWindowFocus:!1})}const l4=(C,m,I,_)=>{const{data:M}=Sc(),v=Fa(m);return bn(M?`${Ko.BALANCE}:${m}:${C}`:null,()=>{const b=M.find(a0=>a0.chainId===m);if(!b)throw new Error("Chain not supported");return Bi.fetchBalance(I??v??b.restUrl,C)},_)},g4=(C,m)=>{const[I,_]=DA.useState(C);return DA.useEffect(()=>{const M=setTimeout(()=>{_(C)},m);return()=>{clearTimeout(M)}},[C,m]),I};BC.defineChain({id:984122,name:"Forma",testnet:!1,nativeCurrency:{name:"TIA",symbol:"TIA",decimals:18},rpcUrls:{default:{http:["https://rpc.forma.art"]},public:{http:["https://rpc.forma.art"]}},blockExplorers:{default:{name:"Forma Explorer",url:"https://explorer.forma.art"}},contracts:{multicall3:{address:"0xd53C6FFB123F7349A32980F87faeD8FfDc9ef079",blockCreated:252705}}});const m4=C=>{const m=(C==null?void 0:C.includeEVMAssets)??!0,I=(C==null?void 0:C.includeCW20Assets)??!0,_=(C==null?void 0:C.includeNoMetadataAssets)??!1,M=(C==null?void 0:C.nativeOnly)??!1,v=(C==null?void 0:C.includeSVMAssets)??!0,b=bn.unstable_serialize([Ko.LEAP_ASSETS,`nativeOnly-${M}`,`includeEVMAssets-${m}`,`includeCW20Assets-${I}`,`includeSvmAssets-${v}`,`includeNoMetadataAssets-${_}`]);return bn(b,async()=>{const a0=await Bi.LeapApi.getAssets({native_only:M,skip_assets_only:!0,include_evm:m,include_svm:v,include_cw20:I});if(a0.success)return a0.assets;throw new Error(`Failed: ${a0.error} and ${a0.error}`)},{revalidateOnFocus:!1,dedupingInterval:60*1e3,keepPreviousData:!0})};function C4(C){return C.coin.denom.startsWith("ibc/")}function f4(C){return C.coin.denom.startsWith("factory/")}function D4(C){return C.coin.denom===C.denomData.coinMinimalDenom}function Rt(C,m){return C.amount.isEqualTo(m.amount)?C.denomData.coinDenom.localeCompare(m.denomData.coinDenom):C.amount.isGreaterThan(m.amount)?-1:1}function Zl(C,m){const I=C.usdValue??new xo(-1/0),_=m.usdValue??new xo(-1/0);if(_.isGreaterThan(I))return 1;if(_.isLessThan(I))return-1;{const M=C.amount??new xo(-1/0);return(m.amount??new xo(-1/0)).minus(M).toNumber()}}const d4=(C,m,I,_)=>{const{data:M}=es(),{data:v}=Sc(),b=Fa(m);return bn(M&&v?`balance:${m}:${C}`:null,async()=>{if(!M||!v)throw new Error("Denoms or chains not loaded");const a0=v.find(x0=>x0.chainId===m);if(!a0)throw new Error("Chain not supported");const B0=await Bi.fetchBalance(I??b??a0.restUrl,C),v0=(await Promise.allSettled(B0.map(x0=>Bi.getTokenData(x0,a0,M)))).map(x0=>x0.status==="fulfilled"&&x0.value!==void 0?x0.value:void 0).filter(x0=>x0!==void 0),B=[],$0=[],Ae=[],ge=[];return v0.forEach(x0=>{C4(x0)?$0.push(x0):f4(x0)?Ae.push(x0):D4(x0)?B.push(x0):ge.push(x0)}),[...B.sort(Rt),...Ae.sort(Rt),...$0.sort(Rt),...ge.sort(Rt)]},_)},u4=C=>{const m=m4({includeCW20Assets:!0,includeSVMAssets:!1,includeEVMAssets:!0}),I=bn.unstable_serialize([Ko.SKIP_BALANCES,Object.keys(C).join("-"),m.data]);return bn(I,async()=>{const _={},M=Object.keys(C).reduce((v0,B)=>{var Ae,ge;const $0=C[B].address;return(ge=(Ae=m.data)==null?void 0:Ae[B])==null||ge.forEach(x0=>(_[x0.denom]=x0,x0.denom)),v0[B]={address:$0},v0},{}),[v,b,a0]=await Promise.all([Bi.SkipAPI.getBalances(M),Bi.getEcosystemPrices("ethereum-ecosystem"),Bi.getEcosystemPrices("cosmos-ecosystem")]),B0={...b,...a0},M0=[];if(v.success){const v0=v.response.chains;return Object.keys(C).forEach(B=>{Object.entries(v0[B].denoms).forEach(([$0,Ae])=>{const ge=Bi.getAlternateKey({chainId:B,denom:$0}),x0=_[$0];if(!x0)return;const me=B0?B0[x0.coingeckoId??""]??B0[ge]:void 0,z0={coin:{denom:$0,amount:Ae.amount},amount:new xo(Ae.formatted_amount),denomData:{chain:_[$0].chainId,coinDenom:_[$0].symbol,coinDecimals:Ae.decimals,coinMinimalDenom:$0,icon:_[$0].logoUri,coinGeckoId:_[$0].coingeckoId??""},chainName:"",chainId:B,usdPrice:me?new xo(me):void 0,usdValue:Ae.value_usd?new xo(Ae.value_usd):void 0};z0.amount.isZero()||M0.push({...z0,isIBC:!1})})}),M0.sort(Zl),M0}else throw new Error(`Failed: ${v.error}`)},{refreshInterval:0,revalidateOnFocus:!1,revalidateOnReconnect:!1,revalidateOnMount:!0,dedupingInterval:1e3,errorRetryCount:5,errorRetryInterval:1e3,focusThrottleInterval:5e3})},p4=(C,m,I,_,M)=>{const{data:v}=Sc(),b=Fa(m);return bn(v?`${Ko.TRANSACTIONS}:${C}:${I}`:null,async()=>{if(!v)throw new Error("Chains not loaded");const a0=v.find(B0=>B0.chainId===m);if(!a0)throw new Error("Chain not supported");return Bi.fetchTransactions(_??b??a0.restUrl,C,{pagination:{limit:100,offset:0},transfer:I})},M)},$l='data:image/svg+xml,<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 20C0 8.95431 8.95431 0 20 0C31.0457 0 40 8.95431 40 20C40 31.0457 31.0457 40 20 40C8.95431 40 0 31.0457 0 20Z" fill="%23383838"/><path d="M10 14C10.55 14 11 13.55 11 13V12C11 11.45 11.45 11 12 11H13C13.55 11 14 10.55 14 10C14 9.45 13.55 9 13 9H12C10.34 9 9 10.34 9 12V13C9 13.55 9.45 14 10 14Z" fill="%23696969"/><path d="M13 29H12C11.45 29 11 28.55 11 28V27C11 26.45 10.55 26 10 26C9.45 26 9 26.45 9 27V28C9 29.66 10.34 31 12 31H13C13.55 31 14 30.55 14 30C14 29.45 13.55 29 13 29Z" fill="%23696969"/><path d="M28 9H27C26.45 9 26 9.45 26 10C26 10.55 26.45 11 27 11H28C28.55 11 29 11.45 29 12V13C29 13.55 29.45 14 30 14C30.55 14 31 13.55 31 13V12C31 10.34 29.66 9 28 9Z" fill="%23696969"/><path d="M30 26C29.45 26 29 26.45 29 27V28C29 28.55 28.55 29 28 29H27C26.45 29 26 29.45 26 30C26 30.55 26.45 31 27 31H28C29.66 31 31 29.66 31 28V27C31 26.45 30.55 26 30 26Z" fill="%23696969"/><path d="M27 22.87V17.13C27 16.41 26.62 15.75 26 15.4L21 12.52C20.69 12.34 20.35 12.25 20 12.25C19.65 12.25 19.31 12.34 19 12.52L14 15.39C13.38 15.75 13 16.41 13 17.13V22.87C13 23.59 13.38 24.25 14 24.6L19 27.48C19.31 27.66 19.65 27.75 20 27.75C20.35 27.75 20.69 27.66 21 27.48L26 24.6C26.62 24.25 27 23.59 27 22.87ZM19 25.17L15 22.87V18.24L19 20.57V25.17ZM20 18.84L16.04 16.53L20 14.25L23.96 16.53L20 18.84ZM25 22.87L21 25.17V20.57L25 18.24V22.87Z" fill="%23696969"/></svg>';function eg(C){return function({currentTarget:m}){m.onerror=null,m.src=C}}const y4=()=>te.jsxs("div",{role:"status",children:[te.jsxs("svg",{"aria-hidden":"true",className:"inline w-8 h-8 text-gray-200 animate-spin dark:text-gray-600 fill-green-500",viewBox:"0 0 100 101",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[te.jsx("path",{d:"M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z",fill:"currentColor"}),te.jsx("path",{d:"M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z",fill:"currentFill"})]}),te.jsx("span",{className:"sr-only",children:"Loading..."})]}),B4=({title:C})=>te.jsxs("div",{className:"flex flex-col items-center justify-center mx-2 px-4 gap-6 h-60 bg-card rounded-xl",children:[te.jsx("p",{className:"font-bold text-lg",children:C}),"Please check if you're connected to the internet.",te.jsx(Ji.Button,{onClick:()=>{window.location.reload()},variant:"outline",size:"xs",style:{color:"black"},className:"leap-ui text-md font-bold px-4 py-3 rounded-full",children:"Refresh Page"})]}),I4=()=>te.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",style:{color:"currentColor"},children:te.jsx("path",{d:"M10.3335 13.3333H3.66683V4.66666C3.66683 4.29999 3.36683 3.99999 3.00016 3.99999C2.6335 3.99999 2.3335 4.29999 2.3335 4.66666V13.3333C2.3335 14.0667 2.9335 14.6667 3.66683 14.6667H10.3335C10.7002 14.6667 11.0002 14.3667 11.0002 14C11.0002 13.6333 10.7002 13.3333 10.3335 13.3333ZM13.6668 10.6667V2.66666C13.6668 1.93333 13.0668 1.33333 12.3335 1.33333H6.3335C5.60016 1.33333 5.00016 1.93333 5.00016 2.66666V10.6667C5.00016 11.4 5.60016 12 6.3335 12H12.3335C13.0668 12 13.6668 11.4 13.6668 10.6667ZM12.3335 10.6667H6.3335V2.66666H12.3335V10.6667Z",fill:"currentColor"})}),E4=()=>te.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"currentColor",viewBox:"0 0 256 256",style:{color:"#33e857"},children:te.jsx("path",{d:"M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"})}),_4=({size:C="24"})=>te.jsx("svg",{width:C,height:(Number(C)*25/24).toFixed(0),viewBox:"0 0 24 25",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{color:"currentColor"},children:te.jsx("g",{id:"close",children:te.jsx("path",{d:"M18.3002 6.21C17.9102 5.82 17.2802 5.82 16.8902 6.21L12.0002 11.09L7.11022 6.2C6.72022 5.81 6.09021 5.81 5.70021 6.2C5.31021 6.59 5.31021 7.22 5.70021 7.61L10.5902 12.5L5.70021 17.39C5.31021 17.78 5.31021 18.41 5.70021 18.8C6.09021 19.19 6.72022 19.19 7.11022 18.8L12.0002 13.91L16.8902 18.8C17.2802 19.19 17.9102 19.19 18.3002 18.8C18.6902 18.41 18.6902 17.78 18.3002 17.39L13.4102 12.5L18.3002 7.61C18.6802 7.23 18.6802 6.59 18.3002 6.21Z",fill:"currentColor"})})}),Ag=({address:C})=>{const[m,I]=DA.useState("idle"),_=DA.useCallback(()=>{navigator.clipboard.writeText(C).then(()=>{I("success")}).catch(()=>{I("fail")}).finally(()=>{setTimeout(()=>I("idle"),1e3)})},[C]);return te.jsx("button",{className:"border-none rounded-full py-2 px-4 flex items-center gap-2 cursor-pointer transition-all duration-200 ease-linear",onClick:_,children:te.jsxs(go.AnimatePresence,{children:[m==="idle"&&te.jsx(go.motion.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{ease:"easeInOut",duration:.5},children:te.jsx(I4,{})},"copy"),m==="success"&&te.jsx(go.motion.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{ease:"easeInOut",duration:.5},children:te.jsx(E4,{})},"check"),m==="fail"&&te.jsx(go.motion.div,{initial:{opacity:0,scale:.5},animate:{opacity:1,scale:1},transition:{ease:"easeInOut",duration:.5},children:te.jsx(_4,{size:"16"})},"close")]})})};function b4(C,m,I){const _={};if(!m)return[];const M=new Map(m.map(v=>[v.chainId,v]));if(I){for(const[v,b]of Object.entries(C)){const a0=M.get(v);a0&&(C[v].coinType=a0.coinType,_[a0.chainName]={address:b.address,logo:a0.icon})}return Object.entries(_).map(([v,{address:b,logo:a0}])=>({chainName:v,address:b,logo:a0}))}for(const[v,b]of Object.entries(C)){const a0=M.get(v);if(a0){C[v].coinType=a0.coinType;for(const B0 of m)if(B0.coinType===a0.coinType){const M0=Bi.convertAddress(b.address,B0.addressPrefix);_[B0.chainName]={address:M0,logo:B0.icon}}}}return Object.entries(_).map(([v,{address:b,logo:a0}])=>({chainName:v,address:b,logo:a0}))}const w4=({data:C})=>te.jsxs("div",{className:"p-4 flex flex-row justify-between rounded-md mb-4 items-center max-w-full bg-card",children:[te.jsxs("div",{className:"flex flex-row gap-4",children:[te.jsx("img",{className:"h-[2.5rem] w-[2.5rem] rounded-full",src:C.logo,alt:C.chainName,onError:eg($l)}),te.jsxs("div",{children:[te.jsx("div",{className:"text-base font-bold leading-6",children:C.chainName}),te.jsx("div",{className:"text-sm text-gray-400 font-medium",children:Bi.sliceAddress(C.address)})]})]}),te.jsx(Ji.Button,{variant:"outline",size:"icon",className:"rounded-full bg-accent",children:te.jsx(Ag,{address:C.address})})]},C.address);function ig(){return te.jsx("div",{style:{padding:"1rem",textAlign:"center"},children:" "})}const v4=({customScrollParentProp:C,restrictChains:m})=>{const{chainData:I}=dr(),{data:_}=Sc(),{data:M}=$1({includeEVM:!0}),{cosmosChains:v,evmChains:b}=DA.useMemo(()=>{const v0={},B={};for(const[$0,Ae]of Object.entries(I))Ae.chainType==="evm"?B[$0]=Ae:v0[$0]=Ae;return{cosmosChains:v0,evmChains:B}},[I]),a0=DA.useMemo(()=>{const v0=[];if(M!=null&&M.length){const B={};M.forEach($0=>{B[$0.chainId]=$0});for(const[$0,Ae]of Object.entries(b))B[$0]&&v0.push({chainName:B[$0].chainName,logo:B[$0].icon,address:Ae.address})}return v0},[b,M]),B0=DA.useMemo(()=>b4(v,_,m),[v,_,m]),M0=[...B0,...a0];return te.jsx("div",{style:{scrollbarWidth:"none"},className:"px-5 pb-6 mt-4",children:B0.length===0?te.jsx("div",{className:"flex flex-col gap-4 h-full",children:te.jsx("div",{className:"flex flex-col items-center justify-center gap-6 h-40 bg-card rounded-xl",children:te.jsx("p",{className:"font-bold text-lg",children:"No addresses found..."})})}):te.jsx("div",{className:"rounded-md flex flex-col",children:C&&te.jsx(xl.Virtuoso,{customScrollParent:C,data:M0,components:{Footer:ig},itemContent:(v0,B)=>te.jsx(w4,{data:B})})})})};function Q4(C,m){if(!m)return{};const I={},_=new Map(m.map(M=>[M.chainId,M]));for(const[M,v]of Object.entries(C)){const b=_.get(M);if(b){C[M].coinType=b.coinType;for(const a0 of m)if(a0.coinType===b.coinType){const B0=Bi.convertAddress(v.address,a0.addressPrefix);I[a0.chainId]={address:M===a0.chainId?v.address:B0,coinType:a0.coinType,restUrl:M===a0.chainId?v.restUrl:a0.restUrl}}}}return I}const k4=({data:C})=>{var m;return te.jsxs("div",{className:"flex flex-row gap-4 items-center justify-between mb-4 p-4 rounded-md max-w-full bg-card",children:[te.jsxs("div",{className:"flex flex-row gap-2 items-center",children:[te.jsx("img",{className:"h-[2.5rem] w-[2.5rem] border rounded-full",src:C.denomData.icon,alt:C.denomData.coinDenom,onError:eg($l)}),te.jsxs("div",{children:[te.jsxs("div",{className:"flex items-center gap-2",children:[te.jsx("div",{className:"text-base font-bold leading-6",children:Bi.sliceDenom(C.denomData.coinDenom)}),C.isIBC?te.jsx("div",{className:"text-xs bg-muted rounded-xs p-1",children:"IBC"}):null]}),te.jsxs("div",{className:"text-sm text-gray-400 font-medium",children:["on ",C.chainName]})]})]}),te.jsxs("div",{className:"flex flex-col justify-end gap-1.5 pr-2",children:[C.usdValue?te.jsx("p",{className:"text-base font-bold leading-5 text-right",children:Bi.formatAmount(C.usdValue,!0)}):null,te.jsx("p",{className:"text-sm font-medium text-gray-400 leading-5 text-right",children:`${Bi.formatAmount(C.amount,!1)} ${Bi.sliceDenom(C.denomData.coinDenom)}`})]})]},(m=C==null?void 0:C.coin)==null?void 0:m.denom)},F4=({restrictChains:C,customScrollParentProp:m})=>{const{chainData:I}=dr(),{data:_}=Sc(),{data:M}=$1({includeEVM:!0}),v=DA.useMemo(()=>{const Ae={};return M==null||M.forEach(ge=>{Ae[ge.chainId]=ge}),Ae},[M]),{setTotalCurrencyValue:b}=Hl(),{cosmosChains:a0,evmChains:B0}=DA.useMemo(()=>{const Ae={},ge={};for(const[x0,me]of Object.entries(I))me.chainType==="evm"?ge[x0]=me:Ae[x0]=me;return{cosmosChains:Ae,evmChains:ge}},[I]),M0=DA.useMemo(()=>C?a0:Q4(a0,_),[a0,_,C]),v0=u4({...B0,...M0}),B=DA.useMemo(()=>{var Ae;return(Ae=v0.data)==null?void 0:Ae.reduce((ge,x0)=>ge.plus(x0.amount),new xo(0))},[v0.data]),$0=DA.useMemo(()=>(v0.data??[]).map(x0=>{var me;return{...x0,chainName:x0.chainId?(me=v[x0.chainId])==null?void 0:me.chainName:"",isIBC:!1}}).sort(Zl),[v0.data,v]);return DA.useEffect(()=>{var ge;const Ae=(ge=v0.data)==null?void 0:ge.reduce((x0,me)=>x0.plus(me.usdValue??0),new xo(0));b(Number(Ae??0))},[v0.data,b]),v0.error?te.jsx(B4,{title:"Failed to fetch your balances"}):te.jsx("div",{className:"px-5",children:v0.isLoading?te.jsxs("div",{className:"flex flex-col gap-2",children:[te.jsx("p",{className:"font-bold text-md border-none",children:"Your tokens"},"loading-token-list-header"),te.jsx("div",{className:"flex items-center justify-center h-40",children:te.jsx(y4,{})})]}):te.jsx(te.Fragment,{children:B!=null&&B.isZero()?te.jsxs("div",{className:"flex flex-col gap-4 h-full",children:[te.jsx("p",{className:"font-bold text-md border-none",children:"Your tokens"},"token-list-header"),te.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 h-40 bg-card rounded-xl",children:[te.jsx("p",{className:"font-bold text-lg",children:"You don’t have any tokens yet!"}),te.jsx("a",{href:"https://swapfast.app",target:"_blank",rel:"noopener noreferrer",className:"font-bold",children:te.jsx(Ji.Button,{variant:"outline",size:"xs",style:{color:"black"},className:"leap-ui text-md font-bold px-4 py-3 rounded-full",children:"Buy tokens"})})]})]}):te.jsxs("div",{className:"flex flex-col gap-4",children:[te.jsx("p",{className:"font-bold text-md border-none",children:"Your tokens"},"token-list-header"),te.jsx("div",{className:"rounded-md flex flex-col",children:m&&te.jsx(xl.Virtuoso,{components:{Footer:ig},customScrollParent:m,data:$0,itemContent:(Ae,ge)=>te.jsx(k4,{data:ge})})})]})})})},M4=({restrictChains:C,customScrollParent:m})=>{const{connectedWalletType:I}=O1(),{enableWalletConnect:_}=dr();return _&&!I?te.jsx("div",{className:"flex justify-center items-center h-full",children:te.jsxs("div",{className:"text-center",children:[te.jsx("div",{className:"text-lg font-bold",children:"Connect Wallet"}),te.jsx("div",{className:"text-sm text-gray-500",children:"Please connect your wallet to view your assets"})]})}):te.jsxs(PC,{children:[te.jsx(KC,{}),te.jsx(F4,{customScrollParentProp:m,restrictChains:C})]})};const x4=()=>te.jsx("div",{children:te.jsx("div",{className:"flex items-center justify-center h-40",children:te.jsx("div",{className:"text-md",children:"Coming soon!"})})});var Gn=(C=>(C.HOME="home",C.ADDRESSES="addresses",C.SWAP="swap",C))(Gn||{});const S4={initial:{opacity:0},animate:{opacity:1,transition:{ease:"easeInOut",duration:.5}},exit:{opacity:0,transition:{ease:"easeInOut",duration:.5}}},ng=({restrictChains:C,customScrollParent:m})=>{const{currentPage:I}=V1();return te.jsxs(go.motion.div,{variants:S4,initial:"initial",animate:"animate",exit:"exit",className:"pb-[65px]",children:[I==="home"&&te.jsx(M4,{customScrollParent:m,restrictChains:C}),I==="addresses"&&te.jsx(v4,{customScrollParentProp:m,restrictChains:C}),I==="swap"&&te.jsx(x4,{})]},I)},og=()=>te.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[te.jsx("path",{d:"M20.518 14.9235C20.518 17.9643 16.8069 19.2 12.1991 19.2C7.59128 19.2 3.82617 17.9643 3.82617 14.9235C3.82617 11.8827 7.56427 9.42212 12.1721 9.42212C16.7799 9.42212 20.518 11.8881 20.518 14.9235Z",fill:"#24A95A"}),te.jsx("path",{d:"M19.6707 8.29541C19.6707 6.69442 18.3635 5.39429 16.7537 5.39429C15.9048 5.39429 15.1411 5.75621 14.6082 6.33057C14.5404 6.40369 14.44 6.43886 14.3423 6.41882C13.6593 6.27876 12.9358 6.20015 12.1891 6.20015C11.4425 6.20015 10.719 6.27413 10.0361 6.41778C9.93833 6.43835 9.83745 6.40376 9.76919 6.33077C9.23195 5.75629 8.46842 5.39429 7.62453 5.39429C6.01477 5.39429 4.70752 6.69442 4.70752 8.29541C4.70752 8.77227 4.82273 9.21828 5.02507 9.61348C5.06462 9.69074 5.06849 9.78177 5.03434 9.86157C4.83861 10.3189 4.73453 10.8024 4.73453 11.304C4.73453 14.1245 8.07289 16.4078 12.1891 16.4078C16.3053 16.4078 19.6437 14.1245 19.6437 11.304C19.6437 10.8024 19.5396 10.3189 19.3439 9.86157C19.3097 9.78177 19.3136 9.69074 19.3532 9.61348C19.5555 9.21828 19.6707 8.77227 19.6707 8.29541Z",fill:"#32DA6D"}),te.jsx("path",{d:"M19.6707 8.29541C19.6707 6.69442 18.3635 5.39429 16.7537 5.39429C15.9048 5.39429 15.1411 5.75621 14.6082 6.33057C14.5404 6.40369 14.44 6.43886 14.3423 6.41882C13.6593 6.27876 12.9358 6.20015 12.1891 6.20015C11.4425 6.20015 10.719 6.27413 10.0361 6.41778C9.93833 6.43835 9.83745 6.40376 9.76919 6.33077C9.23195 5.75629 8.46842 5.39429 7.62453 5.39429C6.01477 5.39429 4.70752 6.69442 4.70752 8.29541C4.70752 8.77227 4.82273 9.21828 5.02507 9.61348C5.06462 9.69074 5.06849 9.78177 5.03434 9.86157C4.83861 10.3189 4.73453 10.8024 4.73453 11.304C4.73453 14.1245 8.07289 16.4078 12.1891 16.4078C16.3053 16.4078 19.6437 14.1245 19.6437 11.304C19.6437 10.8024 19.5396 10.3189 19.3439 9.86157C19.3097 9.78177 19.3136 9.69074 19.3532 9.61348C19.5555 9.21828 19.6707 8.77227 19.6707 8.29541Z",fill:"url(#paint0_radial_625_3823)"}),te.jsx("path",{d:"M14.6212 11.9204C14.8429 11.9395 15.0099 12.1358 14.9602 12.3526C14.9059 12.5892 14.8218 12.8185 14.7095 13.0349C14.5353 13.3708 14.2965 13.6691 14.007 13.9128C13.7174 14.1565 13.3827 14.3407 13.022 14.4551C12.6612 14.5694 12.2815 14.6115 11.9044 14.5791C11.5274 14.5467 11.1604 14.4403 10.8245 14.266C10.4886 14.0918 10.1902 13.853 9.94656 13.5635C9.70288 13.2739 9.51863 12.9392 9.4043 12.5785C9.31708 12.3032 9.27187 12.0169 9.26975 11.7292C9.26865 11.5809 9.40008 11.4712 9.54786 11.484L12.1514 11.7079L14.6212 11.9204Z",fill:"#092511"}),te.jsx("path",{d:"M7.38613 9.9047C8.37065 9.9047 9.16875 9.11094 9.16875 8.13179C9.16875 7.15264 8.37065 6.35889 7.38613 6.35889C6.40162 6.35889 5.60352 7.15264 5.60352 8.13179C5.60352 9.110