@edgex-web/components 0.1.0-beta.1 β†’ 0.1.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -100,7 +100,7 @@ React keys must be passed directly to JSX without using spread:
100
100
  absolute z-50 mt-1 w-full max-h-60 overflow-auto rounded-lg
101
101
  bg-gray-800 border border-gray-600 shadow-lg
102
102
  focus:outline-none
103
- `,children:e.map(c=>x.jsx(Je.Option,{value:c,className:({active:u,selected:i})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-gray-700":""} ${i?"bg-gray-700":""}`,children:({selected:u})=>x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsxs("div",{className:"flex items-center space-x-3",children:[c.iconUrl?x.jsx("img",{src:c.iconUrl,alt:c.token,className:"w-5 h-5 rounded-full"}):x.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:x.jsx("span",{className:"text-xs text-white font-bold",children:c.token.charAt(0)})}),x.jsxs("div",{className:"flex flex-col",children:[x.jsx("span",{className:`text-sm font-medium ${u?"text-white":"text-gray-200"}`,children:c.symbol||c.token}),x.jsxs("span",{className:"text-xs text-gray-400",children:[c.decimals," decimals"]})]})]}),u&&x.jsx(Ri,{className:"w-4 h-4 text-blue-400"})]})},c.tokenAddress))})})]})})}),yf=({currentActiveChain:e,chains:t,onChainChange:n,curSelectToken:r,tokens:o,onTokenChange:s,t:c})=>{p.useEffect(()=>{console.log("πŸ” ChainTokenSelector: Props updated",{curSelectToken:r,currentActiveChain:e==null?void 0:e.chain})},[r,e]);const u=o.find(a=>a.token===r||a.symbol===r)||o[0],i=a=>{console.log("πŸ”— ChainTokenSelector: Chain change triggered",a),n(a.chainId)},l=a=>{s(a.symbol||a.token)};return x.jsxs("div",{className:"space-y-4",children:[x.jsx(Bi,{chains:t,selectedChain:e,onChainChange:i,className:"w-full"}),x.jsx(Hi,{tokens:o,selectedToken:u,onTokenChange:l,className:"w-full"})]})},wf=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,t:s})=>{p.useEffect(()=>{var f;console.log("πŸ” MPCChainTokenSelector: Props updated",{curSelectToken:r,currentActiveChain:e==null?void 0:e.chain,availableTokens:((f=e==null?void 0:e.tokenList)==null?void 0:f.length)||0})},[r,e]);const c=p.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),u=p.useMemo(()=>c.find(h=>h.token===r||h.symbol===r)||c[0],[c,r]),i=f=>{var h;if(console.log("πŸ”— MPCChainTokenSelector: Chain change triggered",{chain:f.chain,availableTokens:((h=f.tokenList)==null?void 0:h.length)||0}),n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(b=>b.token===r||b.symbol===r)){const b=f.tokenList[0];console.log("πŸ”„ MPCChainTokenSelector: Auto-selecting first token",b.token),o(b.symbol||b.token)}},l=f=>{console.log("πŸ”„ MPCChainTokenSelector: Token change triggered",f.token),o(f.symbol||f.token)},a=p.useMemo(()=>t.map(f=>({chainId:f.chainId,chain:f.chain,chainIconUrl:f.chainIconUrl,allowDeposit:f.allowDeposit,blockTime:f.blockTime,txConfirm:f.txConfirm})),[t]),d=p.useMemo(()=>({chainId:e.chainId,chain:e.chain,chainIconUrl:e.chainIconUrl,allowDeposit:e.allowDeposit,blockTime:e.blockTime,txConfirm:e.txConfirm}),[e]),m=p.useMemo(()=>c.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[c]);return x.jsxs("div",{className:"space-y-4",children:[x.jsx(Bi,{chains:a,selectedChain:d,onChainChange:f=>{const h=t.find(v=>v.chainId===f.chainId);h&&i(h)},className:"w-full"}),x.jsx(Hi,{tokens:m,selectedToken:u?{token:u.token,symbol:u.symbol,iconUrl:u.iconUrl,decimals:u.decimals,tokenAddress:u.tokenAddress}:m[0],onTokenChange:l,className:"w-full"}),typeof window<"u"&&window.location.hostname==="localhost"&&x.jsxs("div",{className:"text-xs text-gray-500 p-2 bg-gray-800 rounded",children:[x.jsxs("div",{children:["Chain: ",e.chain]}),x.jsxs("div",{children:["Available tokens: ",c.length]}),x.jsxs("div",{children:["Selected token: ",(u==null?void 0:u.token)||"None"]})]})]})},Ef=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,t:o,showToast:s})=>{var c;return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex justify-center mt-4 mb-3",children:x.jsx("div",{className:"bg-white rounded-lg",children:x.jsx(Ks,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",includeMargin:!1})})}),x.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[x.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),x.jsx(Xs,{text:(e==null?void 0:e.getDisplayAddress())||"",onCopy:()=>s("Copied!"),children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[x.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),x.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),x.jsxs("div",{className:"flex items-start",children:[x.jsx("div",{className:"w-5",children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:x.jsx("path",{d:"M8.00016 14.6667C11.6821 14.6667 14.6668 11.6819 14.6668 8C14.6668 4.31809 11.6821 1.33333 8.00016 1.33333C4.31826 1.33333 1.3335 4.31809 1.3335 8C1.3335 11.6819 4.31826 14.6667 8.00016 14.6667Z",fill:"#FF8F34",stroke:"#FF8F34",strokeWidth:"1.33333",strokeLinejoin:"round"})})}),x.jsxs("div",{className:"flex-1",children:[x.jsxs("p",{className:"text-xs text-functional-orange-1",children:["Only ",t," (",n==null?void 0:n.chain,") is supported for deposits to this address."]}),x.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),x.jsx("div",{className:"flex items-start pl-5 pt-2 text-[#FF8E34] text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."}),x.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"}),x.jsxs("div",{className:"text-sm",children:[x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[x.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),x.jsxs("span",{className:"text-text-primary font-medium text-right underline decoration-dotted underline-offset-1",children:["β‰ˆ"," ",Math.ceil(((n==null?void 0:n.blockTime)||12)*((n==null?void 0:n.txConfirm)||12)/60)," ","minutes"]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),x.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((c=r==null?void 0:r.multiChain)==null?void 0:c.minDeposit)||10," ",t]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),x.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},un=(e,t)=>Number(e)>Number(t),xf=(e,t)=>Number(e)<Number(t),Cf=()=>(e,t)=>{let r={Deposit:"Deposit",From:"From",Asset:"Asset",Amount:"Amount",Available:"Available",MAX:"MAX","Deposit.details":"Deposit Details","Deposit.address":"Deposit Address",copySuccess:"Copied successfully",important:"Important",depositAllTip:"Please ensure you are depositing {coin} on {v} network","Deposit.Arrivaltime":"Arrival Time","Deposit.minDeposit":"Min Deposit","Deposit.block.txConfirm":"Block Confirmations","Deposit.Arrival.Estimated":"~{v} minutes",enableSystemProWithToken:"Enable {token} for {network}",enableTokenDesc:"You need to enable {token} to deposit on {network}",enableWithToken:"Enable {token}",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",minDeposit:"Min deposit: {amount} {token}",Equity:"Equity",availableDesc:"Available balance for trading"}[e]||e;return t&&Object.keys(t).forEach(o=>{r=r.replace(new RegExp(`{${o}}`,"g"),t[o])}),r},Sf=()=>({show:(e,t)=>{console.log("Toast:",e,t)}}),cn=[{token:"USDT",iconUrl:"/icons/usdt.svg",decimals:6,tokenAddress:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},{token:"USDC",iconUrl:"/icons/usdc.svg",decimals:6,tokenAddress:"0xA0b86a33E6441b8435b662f0E2d0B8A0E6E6E6E6"}],fn=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],Ui={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Vi={address:"0x1234567890123456789012345678901234567890"},zi={balance:{formatted:"1000.0"},allowance:{formatted:"0"}},Yi={multiChain:{minDeposit:10}},Of=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:c,decimals:u,t:i,onDepositAmountChange:l,onApprove:a})=>{var d;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{className:"text-sm font-medium text-gray-300",children:"Amount"}),x.jsxs("div",{className:"relative",children:[x.jsx("input",{type:"number",placeholder:"0",value:e,onChange:m=>l(m.target.value),className:"w-full bg-gray-800 border border-gray-600 rounded-lg px-4 py-3 text-white text-right pr-16 focus:outline-none focus:border-blue-500"}),x.jsx("button",{onClick:()=>{var f;const m=((f=n==null?void 0:n.balance)==null?void 0:f.formatted)||"0";l(m)},className:"absolute right-4 top-1/2 transform -translate-y-1/2 text-green-400 text-sm font-medium hover:text-green-300",children:"MAX"})]}),x.jsxs("div",{className:"flex justify-between items-center text-sm",children:[x.jsx("span",{className:"text-gray-400",children:"Available"}),x.jsxs("span",{className:"text-white",children:[((d=n==null?void 0:n.balance)==null?void 0:d.formatted)||"278.37"," ",t]})]})]}),!r&&un(e||"0",0)&&x.jsxs("div",{className:"bg-gray-800 border border-gray-600 rounded-lg p-4 space-y-3",children:[x.jsxs("h3",{className:"text-sm font-medium text-white",children:["Enable ",t," on ",o==null?void 0:o.chain]}),x.jsxs("p",{className:"text-xs text-gray-400",children:["You must enable ",t," first before you can deposit on"," ",o==null?void 0:o.chain,"."]}),x.jsxs("button",{className:"w-full bg-white hover:bg-gray-100 text-gray-900 px-4 py-2 rounded-lg text-sm font-medium transition-colors",onClick:a,children:["Enable ",t]})]}),x.jsx("div",{className:"space-y-3 text-sm",children:x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-gray-400",children:"ζ€»θ΅„δΊ§"}),x.jsx("span",{className:"text-white font-medium",children:e?`0.00 β†’ ${(parseFloat(e)||0).toFixed(2)} ${t}`:`0.00 ${t}`})]})})]})},Gi=({isOpen:e,onClose:t,config:n,isWalletConnected:r=!0,currentActiveAccount:o=Ui,smartWallet:s=Vi,tokens:c=cn,chains:u=fn,currentActiveChain:i=fn[0],approved:l=!1,depositAmount:a="",curSelectToken:d=(w=>(w=cn[0])==null?void 0:w.token)()||"",curSelectTokenData:m=zi,metadata:f=Yi,currentEquity:h=5e3,amount:v="1",onDepositAmountChange:b=()=>{},onTokenChange:C=()=>{},onChainChange:E=()=>{},onApprove:y=async()=>{},onDeposit:O=async()=>{}})=>{var R,X,G,Q;p.useEffect(()=>{console.log("πŸ” Deposit: Props updated",{curSelectToken:d,currentActiveChain:i==null?void 0:i.chain,depositAmount:a})},[d,i,a]);const F=Cf(),{show:_}=Sf(),B=p.useMemo(()=>{var T,H;return o?Rs(o,s,l,i==null?void 0:i.chainId,(T=m==null?void 0:m.balance)==null?void 0:T.formatted,(H=m==null?void 0:m.allowance)==null?void 0:H.formatted):null},[o,s,l,i==null?void 0:i.chainId,m]),K=(B==null?void 0:B.getWalletType())==="evm",A=(B==null?void 0:B.getWalletType())==="mpc",j=Math.min(6,parseInt(((X=(R=c.find(T=>T.token===d))==null?void 0:R.decimals)==null?void 0:X.toString())||"6",10)),re=p.useCallback(async()=>{if(!B){console.error("Wallet adapter not available"),_("Wallet not connected");return}if(!r||!(o!=null&&o.ethAddress)){console.error("Wallet not connected"),_("Please connect your wallet first");return}try{A||await O(),t()}catch(T){console.error("Deposit error:",T),T instanceof Error&&(T.message.includes("ConnectorNotConnectedError")||T.message.includes("Connector not connected")?_("Wallet connection lost. Please reconnect your wallet."):_(`Deposit failed: ${T.message}`))}},[B,A,O,t,o,_,r]),U=p.useCallback(async()=>{if(!(!B||!K)){if(!r||!(o!=null&&o.ethAddress)){console.error("Wallet not connected"),_("Please connect your wallet first");return}try{await y()}catch(T){console.error("Approval error:",T),T instanceof Error&&(T.message.includes("ConnectorNotConnectedError")||T.message.includes("Connector not connected")?_("Wallet connection lost. Please reconnect your wallet."):_(`Approval failed: ${T.message}`))}}},[B,K,y,o,_,r]);return e?Ee.createPortal(x.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[2147483647] w-screen h-screen",children:[x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 bg-black/60",onClick:t,"aria-hidden":"true"}),x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center",children:x.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",children:[x.jsxs("div",{className:"flex items-center justify-between mb-4",children:[x.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit"}),x.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:x.jsx(Is,{className:"h-4 w-4"})})]}),x.jsxs("div",{className:"",children:[x.jsx(yf,{currentActiveChain:i,chains:u,onChainChange:E,curSelectToken:d,tokens:c,onTokenChange:C,t:F}),A&&x.jsx(Ef,{walletAdapter:B,curSelectToken:d,currentActiveChain:i,metadata:f,t:F,showToast:_}),K&&x.jsx(Of,{depositAmount:a,curSelectToken:d,curSelectTokenData:m,approved:l,currentActiveChain:i,currentEquity:h,amount:v,decimals:j,t:F,onDepositAmountChange:b,onApprove:U})]}),x.jsx("div",{className:"mt-4",children:x.jsx("button",{className:Qs("w-full bg-white hover:bg-gray-100 text-gray-900 py-3 px-4 rounded-xl font-medium transition-colors",!l&&K&&un(a||"0",0)?"opacity-50 cursor-not-allowed":""),onClick:re,disabled:!l&&K&&un(a||"0",0),children:A?"Deposit":!l&&un(a||"0",0)?`Enable ${d}`:xf(a||"0",((G=f==null?void 0:f.multiChain)==null?void 0:G.minDeposit)||0)?`Min ${(Q=f==null?void 0:f.multiChain)==null?void 0:Q.minDeposit} ${d}`:"Confirm Deposit"})})]})})]}),document.body):null};var cr={exports:{}},dn={exports:{}},ie={};/** @license React v16.13.1
103
+ `,children:e.map(c=>x.jsx(Je.Option,{value:c,className:({active:u,selected:i})=>`relative cursor-pointer select-none py-3 px-3 ${u?"bg-gray-700":""} ${i?"bg-gray-700":""}`,children:({selected:u})=>x.jsxs("div",{className:"flex items-center justify-between",children:[x.jsxs("div",{className:"flex items-center space-x-3",children:[c.iconUrl?x.jsx("img",{src:c.iconUrl,alt:c.token,className:"w-5 h-5 rounded-full"}):x.jsx("div",{className:"w-5 h-5 rounded-full bg-green-500 flex items-center justify-center",children:x.jsx("span",{className:"text-xs text-white font-bold",children:c.token.charAt(0)})}),x.jsxs("div",{className:"flex flex-col",children:[x.jsx("span",{className:`text-sm font-medium ${u?"text-white":"text-gray-200"}`,children:c.symbol||c.token}),x.jsxs("span",{className:"text-xs text-gray-400",children:[c.decimals," decimals"]})]})]}),u&&x.jsx(Ri,{className:"w-4 h-4 text-blue-400"})]})},c.tokenAddress))})})]})})}),yf=({currentActiveChain:e,chains:t,onChainChange:n,curSelectToken:r,tokens:o,onTokenChange:s,t:c})=>{p.useEffect(()=>{console.log("πŸ” ChainTokenSelector: Props updated",{curSelectToken:r,currentActiveChain:e==null?void 0:e.chain})},[r,e]);const u=o.find(a=>a.token===r||a.symbol===r)||o[0],i=a=>{console.log("πŸ”— ChainTokenSelector: Chain change triggered",a),n(a.chainId)},l=a=>{s(a.symbol||a.token)};return x.jsxs("div",{className:"space-y-4",children:[x.jsx(Bi,{chains:t,selectedChain:e,onChainChange:i,className:"w-full"}),x.jsx(Hi,{tokens:o,selectedToken:u,onTokenChange:l,className:"w-full"})]})},wf=({currentActiveChain:e,chainList:t,onChainChange:n,curSelectToken:r,onTokenChange:o,t:s})=>{p.useEffect(()=>{var f;console.log("πŸ” MPCChainTokenSelector: Props updated",{curSelectToken:r,currentActiveChain:e==null?void 0:e.chain,availableTokens:((f=e==null?void 0:e.tokenList)==null?void 0:f.length)||0})},[r,e]);const c=p.useMemo(()=>(e==null?void 0:e.tokenList)||[],[e]),u=p.useMemo(()=>c.find(h=>h.token===r||h.symbol===r)||c[0],[c,r]),i=f=>{var h;if(console.log("πŸ”— MPCChainTokenSelector: Chain change triggered",{chain:f.chain,availableTokens:((h=f.tokenList)==null?void 0:h.length)||0}),n(f.chainId),f.tokenList&&f.tokenList.length>0&&!f.tokenList.some(b=>b.token===r||b.symbol===r)){const b=f.tokenList[0];console.log("πŸ”„ MPCChainTokenSelector: Auto-selecting first token",b.token),o(b.symbol||b.token)}},l=f=>{console.log("πŸ”„ MPCChainTokenSelector: Token change triggered",f.token),o(f.symbol||f.token)},a=p.useMemo(()=>t.map(f=>({chainId:f.chainId,chain:f.chain,chainIconUrl:f.chainIconUrl,allowDeposit:f.allowDeposit,blockTime:f.blockTime,txConfirm:f.txConfirm})),[t]),d=p.useMemo(()=>({chainId:e.chainId,chain:e.chain,chainIconUrl:e.chainIconUrl,allowDeposit:e.allowDeposit,blockTime:e.blockTime,txConfirm:e.txConfirm}),[e]),m=p.useMemo(()=>c.map(f=>({token:f.token,symbol:f.symbol,iconUrl:f.iconUrl,decimals:f.decimals,tokenAddress:f.tokenAddress})),[c]);return x.jsxs("div",{className:"space-y-4",children:[x.jsx(Bi,{chains:a,selectedChain:d,onChainChange:f=>{const h=t.find(v=>v.chainId===f.chainId);h&&i(h)},className:"w-full"}),x.jsx(Hi,{tokens:m,selectedToken:u?{token:u.token,symbol:u.symbol,iconUrl:u.iconUrl,decimals:u.decimals,tokenAddress:u.tokenAddress}:m[0],onTokenChange:l,className:"w-full"}),typeof window<"u"&&window.location.hostname==="localhost"&&x.jsxs("div",{className:"text-xs text-gray-500 p-2 bg-gray-800 rounded",children:[x.jsxs("div",{children:["Chain: ",e.chain]}),x.jsxs("div",{children:["Available tokens: ",c.length]}),x.jsxs("div",{children:["Selected token: ",(u==null?void 0:u.token)||"None"]})]})]})},Ef=({walletAdapter:e,curSelectToken:t,currentActiveChain:n,metadata:r,t:o,showToast:s})=>{var c;return x.jsxs(x.Fragment,{children:[x.jsx("div",{className:"flex justify-center mt-4 mb-3",children:x.jsx("div",{className:"bg-white rounded-lg",children:x.jsx(Ks,{value:(e==null?void 0:e.getDisplayAddress())||"",size:120,level:"L",bgColor:"#ffffff",fgColor:"#000000",includeMargin:!1})})}),x.jsxs("div",{className:"flex items-center justify-between bg-fill-input-primary rounded-lg py-2 px-3 mb-3",children:[x.jsx("span",{className:"flex-1 text-text-primary text-sm font-medium break-all mr-3",children:e==null?void 0:e.getDisplayAddress()}),x.jsx(Xs,{text:(e==null?void 0:e.getDisplayAddress())||"",onCopy:()=>s("Copied!"),children:x.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[x.jsx("rect",{x:"2.08496",y:"4.02295",width:"9.89893",height:"9.89893",rx:"2",stroke:"#F9F9F9"}),x.jsx("path",{d:"M5.85547 2.07861H11.415C12.7957 2.07861 13.915 3.1979 13.915 4.57861V10.0786",stroke:"#F9F9F9",strokeLinecap:"round"})]})})]}),x.jsxs("div",{className:"flex items-start",children:[x.jsx("div",{className:"w-5",children:x.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:x.jsx("path",{d:"M8.00016 14.6667C11.6821 14.6667 14.6668 11.6819 14.6668 8C14.6668 4.31809 11.6821 1.33333 8.00016 1.33333C4.31826 1.33333 1.3335 4.31809 1.3335 8C1.3335 11.6819 4.31826 14.6667 8.00016 14.6667Z",fill:"#FF8F34",stroke:"#FF8F34",strokeWidth:"1.33333",strokeLinejoin:"round"})})}),x.jsxs("div",{className:"flex-1",children:[x.jsxs("p",{className:"text-xs text-functional-orange-1",children:["Only ",t," (",n==null?void 0:n.chain,") is supported for deposits to this address."]}),x.jsx("div",{className:"pt-2 h-[1px] border-b border-dashed border-line-divider-secondary"})]})]}),x.jsx("div",{className:"flex items-start pl-5 pt-2 text-[#FF8E34] text-xs",children:"When the deposit amount exceeds 250,000, there may be a delay in arrival. It is recommended to use the Ethereum network for deposits."}),x.jsx("div",{className:"pt-4 h-[1px] border-b border-dashed border-line-divider-secondary"}),x.jsxs("div",{className:"text-sm",children:[x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-4",children:[x.jsx("span",{className:"text-text-tertiary",children:"Arrival Time"}),x.jsxs("span",{className:"text-text-primary font-medium text-right underline decoration-dotted underline-offset-1",children:["β‰ˆ"," ",Math.ceil(((n==null?void 0:n.blockTime)||12)*((n==null?void 0:n.txConfirm)||12)/60)," ","minutes"]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Minimum Deposit Amount"}),x.jsxs("span",{className:"text-text-primary font-medium text-right",children:[((c=r==null?void 0:r.multiChain)==null?void 0:c.minDeposit)||10," ",t]})]}),x.jsxs("div",{className:"flex justify-between items-center h-[18px] mt-2",children:[x.jsx("span",{className:"text-text-tertiary",children:"Maximum Deposit Amount"}),x.jsxs("span",{className:"text-text-primary font-medium text-right",children:["250,000 ",t]})]})]})]})},un=(e,t)=>Number(e)>Number(t),xf=(e,t)=>Number(e)<Number(t),Cf=()=>(e,t)=>{let r={Deposit:"Deposit",From:"From",Asset:"Asset",Amount:"Amount",Available:"Available",MAX:"MAX","Deposit.details":"Deposit Details","Deposit.address":"Deposit Address",copySuccess:"Copied successfully",important:"Important",depositAllTip:"Please ensure you are depositing {coin} on {v} network","Deposit.Arrivaltime":"Arrival Time","Deposit.minDeposit":"Min Deposit","Deposit.block.txConfirm":"Block Confirmations","Deposit.Arrival.Estimated":"~{v} minutes",enableSystemProWithToken:"Enable {token} for {network}",enableTokenDesc:"You need to enable {token} to deposit on {network}",enableWithToken:"Enable {token}",confirmDeposit:"Confirm Deposit",switchNetwork:"Switch Network",minDeposit:"Min deposit: {amount} {token}",Equity:"Equity",availableDesc:"Available balance for trading"}[e]||e;return t&&Object.keys(t).forEach(o=>{r=r.replace(new RegExp(`{${o}}`,"g"),t[o])}),r},Sf=()=>({show:(e,t)=>{console.log("Toast:",e,t)}}),cn=[{token:"USDT",iconUrl:"/icons/usdt.svg",decimals:6,tokenAddress:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},{token:"USDC",iconUrl:"/icons/usdc.svg",decimals:6,tokenAddress:"0xA0b86a33E6441b8435b662f0E2d0B8A0E6E6E6E6"}],fn=[{chainId:1,chain:"Ethereum",chainIconUrl:"https://static.edgex.exchange/icons/logo/ethereum.svg",allowDeposit:!0,blockTime:12,txConfirm:12},{chainId:42161,chain:"Arbitrum",chainIconUrl:"https://static.edgex.exchange/icons/logo/arbitrum.svg",allowDeposit:!0,blockTime:1,txConfirm:1}],Ui={wallet:"mpc",ethAddress:"0x1234567890123456789012345678901234567890",accountId:"123",l2Key:"0x123"},Vi={address:"0x1234567890123456789012345678901234567890"},zi={balance:{formatted:"1000.0"},allowance:{formatted:"0"}},Yi={multiChain:{minDeposit:10}},Of=({depositAmount:e,curSelectToken:t,curSelectTokenData:n,approved:r,currentActiveChain:o,currentEquity:s,amount:c,decimals:u,t:i,onDepositAmountChange:l,onApprove:a})=>{var d;return x.jsxs(x.Fragment,{children:[x.jsxs("div",{className:"space-y-2",children:[x.jsx("label",{className:"text-sm font-medium text-gray-300",children:"Amount"}),x.jsxs("div",{className:"relative",children:[x.jsx("input",{type:"number",placeholder:"0",value:e,onChange:m=>l(m.target.value),className:"w-full bg-gray-800 border border-gray-600 rounded-lg px-4 py-3 text-white text-right pr-16 focus:outline-none focus:border-blue-500"}),x.jsx("button",{onClick:()=>{var f;const m=((f=n==null?void 0:n.balance)==null?void 0:f.formatted)||"0";l(m)},className:"absolute right-4 top-1/2 transform -translate-y-1/2 text-green-400 text-sm font-medium hover:text-green-300",children:"MAX"})]}),x.jsxs("div",{className:"flex justify-between items-center text-sm",children:[x.jsx("span",{className:"text-gray-400",children:"Available"}),x.jsxs("span",{className:"text-white",children:[((d=n==null?void 0:n.balance)==null?void 0:d.formatted)||"278.37"," ",t]})]})]}),!r&&un(e||"0",0)&&x.jsxs("div",{className:"bg-gray-800 border border-gray-600 rounded-lg p-4 space-y-3",children:[x.jsxs("h3",{className:"text-sm font-medium text-white",children:["Enable ",t," on ",o==null?void 0:o.chain]}),x.jsxs("p",{className:"text-xs text-gray-400",children:["You must enable ",t," first before you can deposit on"," ",o==null?void 0:o.chain,"."]}),x.jsxs("button",{className:"w-full bg-white hover:bg-gray-100 text-gray-900 px-4 py-2 rounded-lg text-sm font-medium transition-colors",onClick:a,children:["Enable ",t]})]}),x.jsx("div",{className:"space-y-3 text-sm",children:x.jsxs("div",{className:"flex justify-between items-center",children:[x.jsx("span",{className:"text-gray-400",children:"ζ€»θ΅„δΊ§"}),x.jsx("span",{className:"text-white font-medium",children:e?`0.00 β†’ ${(parseFloat(e)||0).toFixed(2)} ${t}`:`0.00 ${t}`})]})})]})},Gi=({isOpen:e,onClose:t,config:n,isWalletConnected:r=!0,currentActiveAccount:o=Ui,smartWallet:s=Vi,tokens:c=cn,chains:u=fn,currentActiveChain:i=fn[0],approved:l=!1,depositAmount:a="",curSelectToken:d=(w=>(w=cn[0])==null?void 0:w.token)()||"",curSelectTokenData:m=zi,metadata:f=Yi,currentEquity:h=5e3,amount:v="1",onDepositAmountChange:b=()=>{},onTokenChange:C=()=>{},onChainChange:E=()=>{},onApprove:y=async()=>{},onDeposit:O=async()=>{}})=>{var R,X,G,Q;p.useEffect(()=>{console.log("πŸ” Deposit: Props updated",{curSelectToken:d,currentActiveChain:i==null?void 0:i.chain,depositAmount:a})},[d,i,a]);const F=Cf(),{show:_}=Sf(),B=p.useMemo(()=>{var T,H;return o?Rs(o,s,l,i==null?void 0:i.chainId,(T=m==null?void 0:m.balance)==null?void 0:T.formatted,(H=m==null?void 0:m.allowance)==null?void 0:H.formatted):null},[o,s,l,i==null?void 0:i.chainId,m]),K=(B==null?void 0:B.getWalletType())==="evm",A=(B==null?void 0:B.getWalletType())==="mpc",j=Math.min(6,parseInt(((X=(R=c.find(T=>T.token===d))==null?void 0:R.decimals)==null?void 0:X.toString())||"6",10)),re=p.useCallback(async()=>{if(!B){console.error("Wallet adapter not available"),_("Wallet not connected");return}if(!r||!(o!=null&&o.ethAddress)){console.error("Wallet not connected"),_("Please connect your wallet first");return}try{A||await O(),t()}catch(T){console.error("Deposit error:",T),T instanceof Error&&(T.message.includes("ConnectorNotConnectedError")||T.message.includes("Connector not connected")?_("Wallet connection lost. Please reconnect your wallet."):_(`Deposit failed: ${T.message}`))}},[B,A,O,t,o,_,r]),U=p.useCallback(async()=>{if(!(!B||!K)){if(!r||!(o!=null&&o.ethAddress)){console.error("Wallet not connected"),_("Please connect your wallet first");return}try{await y()}catch(T){console.error("Approval error:",T),T instanceof Error&&(T.message.includes("ConnectorNotConnectedError")||T.message.includes("Connector not connected")?_("Wallet connection lost. Please reconnect your wallet."):_(`Approval failed: ${T.message}`))}}},[B,K,y,o,_,r]);return e?Ee.createPortal(x.jsxs("div",{className:"fixed top-0 left-0 right-0 bottom-0 z-[999] w-screen h-screen",style:{zIndex:999},children:[x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0",style:{backgroundColor:"#000",opacity:.6},onClick:t,"aria-hidden":"true"}),x.jsx("div",{className:"fixed top-0 left-0 right-0 bottom-0 flex items-center justify-center",children:x.jsxs("div",{className:"relative w-[420px] max-h-[85vh] bg-fill-page-secondary overflow-auto rounded-lg p-6 shadow-xl",children:[x.jsxs("div",{className:"flex items-center justify-between mb-4",children:[x.jsx("h2",{className:"text-lg font-semibold text-white",children:"Deposit [DEV MODE]"}),x.jsx("button",{className:"text-gray-400 hover:text-gray-200 transition-colors",onClick:t,"aria-label":"Close",children:x.jsx(Is,{className:"h-4 w-4"})})]}),x.jsxs("div",{className:"",children:[x.jsx(yf,{currentActiveChain:i,chains:u,onChainChange:E,curSelectToken:d,tokens:c,onTokenChange:C,t:F}),A&&x.jsx(Ef,{walletAdapter:B,curSelectToken:d,currentActiveChain:i,metadata:f,t:F,showToast:_}),K&&x.jsx(Of,{depositAmount:a,curSelectToken:d,curSelectTokenData:m,approved:l,currentActiveChain:i,currentEquity:h,amount:v,decimals:j,t:F,onDepositAmountChange:b,onApprove:U})]}),x.jsx("div",{className:"mt-4",children:x.jsx("button",{className:Qs("w-full bg-white hover:bg-gray-100 text-gray-900 py-3 px-4 rounded-xl font-medium transition-colors",!l&&K&&un(a||"0",0)?"opacity-50 cursor-not-allowed":""),onClick:re,disabled:!l&&K&&un(a||"0",0),children:A?"Deposit":!l&&un(a||"0",0)?`Enable ${d}`:xf(a||"0",((G=f==null?void 0:f.multiChain)==null?void 0:G.minDeposit)||0)?`Min ${(Q=f==null?void 0:f.multiChain)==null?void 0:Q.minDeposit} ${d}`:"Confirm Deposit"})})]})})]}),document.body):null};var cr={exports:{}},dn={exports:{}},ie={};/** @license React v16.13.1
104
104
  * react-is.production.min.js
105
105
  *
106
106
  * Copyright (c) Facebook, Inc. and its affiliates.