@spicenet-io/spiceflow-ui 3.3.55-next.4 → 3.3.55-next.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -105,4 +105,4 @@
105
105
  from { opacity: 0; transform: translateY(-4px); }
106
106
  to { opacity: 1; transform: translateY(0); }
107
107
  }
108
- `})]}),document.body):null;return n.jsxs(n.Fragment,{children:[Ce,ft,E&&Mn.createPortal(n.jsx(Eo,{isOpen:!0,onClose:K,supportedChains:[E.chainId],escrowOnly:!0,escrowTokenAddress:E.tokenAddress,escrowAmount:E.amount,escrowTokenDecimals:E.tokenDecimals,escrowTokenSymbol:E.tokenSymbol,styles:d,onDepositSuccess:te}),document.body)]})},Pr=class ro extends i.Component{constructor(t){super(t),this.handleRetry=()=>{this.state.retryCount>=ro.MAX_RETRIES||this.setState(s=>({hasError:!1,error:null,retryCount:s.retryCount+1}))},this.state={hasError:!1,error:null,retryCount:0}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,s){console.error(`[SdkErrorBoundary] ${this.props.componentName||"SDK component"} failed:`,{message:t.message,componentStack:s.componentStack})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",borderRadius:"8px",border:"1px solid rgba(239, 68, 68, 0.2)",backgroundColor:this.props.dark?"rgba(239, 68, 68, 0.08)":"rgba(239, 68, 68, 0.05)",gap:"12px"},s={fontSize:"14px",color:"#f87171",margin:0},o={fontSize:"12px",color:"#888",maxWidth:"280px",textAlign:"center",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",margin:0},r={padding:"8px 16px",fontSize:"12px",borderRadius:"6px",backgroundColor:this.props.dark?"#2a2a2a":"#f3f4f6",color:this.props.dark?"#888":"#374151",border:this.props.dark?"1px solid #3a3a3a":"1px solid #d1d5db",cursor:"pointer",transition:"background-color 150ms ease"},a={fontSize:"12px",color:"#888",margin:0},l=ro.MAX_RETRIES-this.state.retryCount;return n.jsxs("div",{style:t,children:[n.jsxs("p",{style:s,children:[this.props.componentName||"Component"," failed to load"]}),this.state.error&&n.jsx("p",{style:o,children:this.state.error.message}),l>0?n.jsxs("button",{onClick:this.handleRetry,style:r,onMouseEnter:d=>{d.target.style.backgroundColor=this.props.dark?"#333":"#e5e7eb"},onMouseLeave:d=>{d.target.style.backgroundColor=this.props.dark?"#2a2a2a":"#f3f4f6"},children:["Try again (",l," left)"]}):n.jsx("p",{style:a,children:"Please refresh the page to try again"})]})}return this.props.children}};Pr.MAX_RETRIES=3;let zl=Pr;const Ll=()=>{const[e,t]=i.useState("0"),[s,o]=i.useState(null);return{assetAmount:e,setAssetAmount:t,selectedAsset:s,setSelectedAsset:o}};function Ol(e,t=0){const[s,o]=i.useState(t),r=e[s]??e[0],a=i.useMemo(()=>r?BigInt(Math.round(r.months*30*24*3600)):0n,[r?.months]);return{selectedDurationIdx:s,setSelectedDurationIdx:o,selectedDuration:r,durationSeconds:a}}function Hl(){const{actions:e,isReady:t,isAuthenticated:s}=p.useWallet(),o=p.useEmbeddedWalletAddress(),r=i.useRef(!1),a=i.useRef(0),l=i.useRef(null),d=i.useRef(e),[u,c]=i.useState(0);d.current=e,i.useEffect(()=>{r.current=!1,a.current=0,l.current&&(clearTimeout(l.current),l.current=null)},[o]),i.useEffect(()=>{if(!o||!t||!s||r.current)return;r.current=!0;let h=!1;return(async()=>{await new Promise(f=>setTimeout(f,2e3));try{await p.ensureSmartWallet(o,d.current.signMessage),a.current=0}catch(f){console.warn("[SmartWallet] Registration failed:",f),r.current=!1,!h&&a.current<3&&(a.current+=1,l.current=setTimeout(()=>{c(x=>x+1)},5e3))}})(),()=>{h=!0,l.current&&(clearTimeout(l.current),l.current=null)}},[o,t,s,u])}function rs(e){const{destinationToken:t,recipient:s,buildActionCalls:o,buildSpicenetBatch:r,amountMode:a,amount:l,sourceChains:d,supportedSourceAssets:u,feeExecutionMode:c="user-transfer",enabled:h=!0,onSuccess:f,onError:x}=e,g=a==="exact-output"?"output":"input",m=g==="output",y=t.chainId,b=i.useContext(p.SpiceFlowProviderContext),k=(b?.mode||"7702")!=="7702",w=!!b?.isWhitelistGateActive,v=i.useMemo(()=>d??b?.supportedChainIds??[],[d,b?.supportedChainIds]),I=i.useMemo(()=>w?[]:u,[w,u]),C=p.useWallet(),{address:E,isConnected:A,isReady:R,isAuthenticated:T,provider:S}=C,{executeGasless:F,estimateGasless:M}=Ln(),{externalWallet:D,externalAddress:Q,embeddedAddress:z}=p.useProviderWallets(),q=p.useEmbeddedWalletAddress()||z,{displayAssets:X,filteredSpiceAssets:W,embeddedWalletAddress:G,refreshSpiceAssets:Z,refreshWalletAssets:H}=eo({destinationToken:t,supportedSourceAssets:I,sourceChains:v,enabled:h&&(k?!!Q:!!q)}),U=X,[P,ce]=i.useState(null),[N,_]=i.useState(!1),[le,de]=i.useState(null),[be,oe]=i.useState("idle"),[he,O]=i.useState(""),[ee,K]=i.useState(null),[te,pe]=i.useState(null),[,ve]=i.useState(!1),[J,L]=i.useState(null),[ie,fe]=i.useState(!1),[Be,He]=i.useState(!1),[Je,Le]=i.useState(null),Ee=i.useRef(P),Ce=i.useRef(!1),ft=i.useRef(null),V=i.useRef(0),ke=i.useRef(null),je=i.useRef(null);i.useEffect(()=>{Ee.current=P},[P]);const We=m?l||"0":P?.amount||"0";i.useEffect(()=>{h||(ce(null),de(null),_(!1),oe("idle"),O(""),K(null),pe(null),ve(!1),L(null),fe(!1),He(!1),Le(null),Ce.current=!1,ft.current&&(ft.current.abort(),ft.current=null))},[h]),i.useEffect(()=>{m||ce(me=>me&&me.amount!==l?{...me,amount:l}:me)},[l,m]);const $e=i.useCallback(me=>{ce(me),de(null),Le(null),He(!1)},[]),wt=i.useCallback(me=>{ce(Ct=>({asset:me,amount:Ct?.asset?.address===me.address&&Ct?.asset?.chainId===me.chainId&&Ct.amount||(m?"":l)})),de(null),Le(null),He(!1)},[l,m]),At=G||z||E,{isQuoting:lt,quoteError:Se,estimatedOutput:Pt,estimatedInput:Yt,resolvedSwap:St,exactOutputSwap:_e,quoteAmountOut:Et,resolvedTokenIn:De,isDirect:ht,needsSwap:Te,selectedIsEquivalent:ot}=so({direction:g,selectedAsset:P,destinationToken:t,chainId:y,recipient:At,paymentAmount:We}),Ne=m?parseFloat(We):parseFloat(P?.amount||"")||0,ct=P?.asset?._source==="wallet",Rt=!!P?.asset&&ct&&P.asset.chainId!==y,ye=ct&&P?.asset?._fundingWallet==="external",qe=k||ye,dt=i.useMemo(()=>P?.asset?W.find(me=>p.addressesEqual(me.address,P.asset.address))?.balanceFormatted??0:0,[P,W]),kt=ct?P?.asset.balanceFormatted??0:dt,we=i.useMemo(()=>{if(!P?.asset)return!1;if(m)return J?fn(J.grossAmount,J.decimals,P.asset.decimals)>P.asset.balance:ot||ht?Ne>P.asset.balanceFormatted:_e?parseFloat(j.formatUnits(_e.amountInMax,P.asset.decimals))>P.asset.balanceFormatted:!1;if(J){const me=fn(J.grossAmount,J.decimals,P.asset.decimals);return ct?me>P.asset.balance:parseFloat(j.formatUnits(me,P.asset.decimals))>kt}return Ne>kt},[P,m,J,ot,Ne,_e,kt,ct,ht]),Wt=i.useCallback(me=>{oe({building:"signing-delegation","signing-delegation":"signing-delegation","signing-intent":"signing-intent",submitting:"submitting",executing:"executing",success:"success",error:"error"}[me.step]||"executing"),O(me.message),me.txHash&&K(me.txHash)},[]),et=i.useMemo(()=>({currentPaymentAmount:We,destinationToken:t,embeddedWalletAddress:G,providerEmbeddedAddress:z,externalWalletAddress:Q,address:E,recipient:s,isNon7702:qe,isPayMode:m,resolvedChainId:y,buildActionCalls:o,feeExecutionMode:c,buildSpicenetBatch:r,selectedAsset:P,needsSwap:Te,resolvedSwap:St,exactOutputSwap:_e,quoteAmountOut:Et,resolvedTokenIn:De}),[We,t,G,z,Q,E,s,qe,m,y,o,c,r,P,Te,St,_e,Et,De]),gt=i.useCallback(me=>Ks(et,me),[et]),vt=i.useCallback(me=>Zs(et,me),[et]),Ut=i.useCallback((me,Ct,ze,Ft)=>Ys(me,Ct,ze,M,Ft),[M]),Dt=i.useMemo(()=>P?.asset?Te&&De?De:P.asset.chainId===y?P.asset.address:De??$t(P.asset,y)??t.address:t.address,[P,t.address,Te,y,De]),Ve=i.useMemo(()=>P?.asset?p.addressesEqual(P.asset.address,t.address)&&P.asset.chainId===t.chainId:!1,[P,t.address,t.chainId]),Ot=qe&&Ve,Me=Ot&&Ne>0&&!!P?.asset,ut=i.useMemo(()=>!(!P?.asset||Ne<=0),[P,Ne]),It=i.useMemo(()=>!h||N||be!=="idle"||!ut||Me||!P?.asset?null:[m?"pay":"supply",g,P.asset.address.toLowerCase(),P.asset.chainId,P.amount,We,t.address.toLowerCase(),t.chainId,y,De?.toLowerCase()??"",Te?"swap":"direct",ht?"direct-token":"routed-token",qe?"non7702":"7702",Ve?"source-dest":"cross-chain",lt?"quoting":"quoted",s?.toLowerCase()??"",_e?.amountIn?.toString()??"",_e?.amountInMax?.toString()??"",_e?.venue??"",St?.amountOut?.toString()??"",Et?.toString()??"",G??"",z??"",E??""].join("|"),[h,N,be,ut,Me,P,m,g,We,t,y,De,Te,ht,qe,Ve,lt,s,_e,St,Et,G,z,E]),Ge=i.useCallback(()=>Xs({selectedAsset:P,isPayMode:m,parsedAmount:Ne,needsSwap:Te,exactOutputSwap:_e,isNon7702:qe,isSourceDestToken:Ve,currentPaymentAmount:We,destinationToken:t,feeExecutionMode:c,resolvedTokenIn:De,embeddedWalletAddress:G,providerEmbeddedAddress:z,resolvedChainId:y,isConnected:A,address:E,ready:R,authenticated:T,isDirect:ht,resolvedSwap:St,isQuoting:lt,executionTokenAddress:Dt,buildPayChainBatches:gt,buildSupplyChainBatches:vt,estimateGasless:M,estimateRequiredGrossFunding:Ut}),[P,m,Ne,Te,_e,qe,Ve,We,t,c,De,G,z,Ut,gt,M,y,A,E,R,T,ht,St,lt,vt,Dt,s]);i.useEffect(()=>{ke.current=Ge},[Ge]),i.useEffect(()=>{if(!h){fe(!1),He(!1),Le(null),L(null);return}if(N||be!=="idle"){V.current+=1,fe(!1);return}if(!ut){L(null),fe(!1),He(!1),Le(null);return}if(Me){L(null),fe(!1),He(!0),Le(null);return}if(lt){V.current+=1,fe(!1),He(!1);return}if(!It)return;let me=!1;const Ct=async()=>{const Ft=++V.current;Le(null),fe(!0);try{const Bt=await ke.current?.();if(me||V.current!==Ft)return;Bt?(L(Bt),He(!0)):(L(null),He(!1)),Le(null)}catch(Bt){if(me||V.current!==Ft)return;const zt=p.sanitizeError(Bt,"Unable to calculate fees for this action.");L(null),He(!1),Le(zt)}finally{!me&&V.current===Ft&&fe(!1)}},ze=window.setTimeout(()=>{Ct()},250);return()=>{me=!0,clearTimeout(ze),fe(!1)}},[h,N,be,ut,Me,lt,It]),i.useEffect(()=>{!m&&be==="success"&&ee&&(Z(),f?.(ee))},[m,be,ee,Z,f]),i.useEffect(()=>{if(!m||te?.status!=="success"||Ce.current||!E)return;Ce.current=!0;const me=Ee.current;!me?.asset||me.asset?._source==="wallet"||Z()},[m,te?.status,E,Z]);const tt=i.useRef(f),jt=i.useRef(x);i.useEffect(()=>{tt.current=f},[f]),i.useEffect(()=>{jt.current=x},[x]),i.useEffect(()=>{m&&(te?.status==="success"&&tt.current?.(te.txHash||""),te?.status==="failed"&&jt.current?.(new Error("Payment execution failed")))},[m,te?.status]),i.useEffect(()=>{h&&(Z(),H())},[h,Z,H]),je.current={selectedAsset:P,parsedAmount:Ne,currentPaymentAmount:We,isInsufficientBalance:we,isPayMode:m,isNon7702:qe,isSourceDestToken:Ve,needsSwap:Te,exactOutputSwap:_e,selectedIsEquivalent:ot,resolvedTokenIn:De,embeddedWalletAddress:G,providerEmbeddedAddress:z,externalWallet:D,externalWalletAddress:Q,address:E,isConnected:A,ready:R,authenticated:T,provider:S,resolvedChainId:y,executionTokenAddress:Dt,destinationToken:t,recipient:s,buildActionCalls:o,feeExecutionMode:c,buildSpicenetBatch:r,onError:x,gasless:{estimateGasless:M,executeGasless:F,buildPayChainBatches:gt,buildSupplyChainBatches:vt,estimateRequiredGrossFunding:Ut,onProgress:Wt},ui:{setError:de,setStep:oe,setStatusMsg:O,setTxHash:K,setIsExecuting:_,setShowStatusPanel:ve,setPaymentResult:pe},refs:{spiceDepositSubmittedRef:Ce,abortControllerRef:ft}};const mt=i.useCallback(async()=>{const me=je.current;me&&(me.isPayMode?await _s(me):await Js(me))},[]),Ue=m&&Ne===0,Ye=m?!!P?.asset&&Ne>=0&&!we&&!N&&(Ue||Me||Be)&&!Je&&(Ue||!Te||!!_e):!!P?.asset&&Ne>0&&!we&&!N&&(Ot||Be)&&!Je&&(Rt||ht||!!St&&!lt),yt=i.useCallback(()=>{Z(),H()},[Z,H]);return{sources:U,selectedAsset:P,setSelectedAsset:$e,selectAsset:wt,quote:{isQuoting:lt,error:Se,estimatedInput:Yt,estimatedOutput:Pt,isDirect:ht,needsSwap:Te},feePreview:J,isFeePreviewLoading:ie,feePreviewError:Je,canSubmit:Ye,execute:mt,isExecuting:N,step:be,statusMsg:he,txHash:ee,paymentResult:te,refreshAssets:yt}}function Ql(e){return rs({...e,amountMode:"exact-input"})}function ql(e){return rs({...e,amountMode:"exact-output"})}function Vl(e){return rs({...e,amountMode:"exact-input"})}const as=1500,Wr="spiceflow-75f053db-70ab-4f37-83cc-abf68cb5b70d",Gl={1:{chainId:1,domain:0,network:"mainnet"},42161:{chainId:42161,domain:3,network:"mainnet"},8453:{chainId:8453,domain:6,network:"mainnet"},11155111:{chainId:11155111,domain:0,network:"testnet"},421614:{chainId:421614,domain:3,network:"testnet"},84532:{chainId:84532,domain:6,network:"testnet"}};function Ur(e,t,s){return(e*t+s-1n)/s}function zr(e,t=as){return Ur(e,BigInt(1e4+t),10000n)}function Lr(e,t){return`evm:${e}:${j.getAddress(t).toLowerCase()}`}function Or(e){return Gl[e]??null}function Kl(e){return e==="testnet"?"https://iris-api-sandbox.circle.com":"https://iris-api.circle.com"}function Zl(e){const t=typeof e=="number"?e.toString():typeof e=="string"?e:"0",[s,o=""]=t.trim().split("."),r=BigInt(s||"0"),a=BigInt((o+"00").slice(0,2)||"0");return r*100n+a}function Yl(e,t){const s=Zl(t);return Ur(e,s,1000000n)}async function Xl(e){const t=e.transferMode??"fast",s=Or(e.sourceChainId),o=Or(e.destinationChainId);if(!s||!o||s.network!==o.network)throw new Error(`Unsupported CCTP route ${e.sourceChainId} -> ${e.destinationChainId}`);let r=0n;const a=t==="fast"?1e3:2e3;if(t==="fast"){const d=e.fetchImpl??fetch,u=`${Kl(s.network)}/v2/burn/USDC/fees/${s.domain}/${o.domain}`,c=await d(u);if(!c.ok)throw new Error(`CCTP fee quote failed: ${c.status} ${c.statusText}`);const h=await c.json(),f=Array.isArray(h)?h:Array.isArray(h?.data)?h.data:[],x=f.find(g=>String(g.finalityThreshold??g.finalityThresholdExecuted??"")==="1000")??f[0];r=Yl(e.amountIn,x?.minimumFee??0)}const l=zr(r,e.bufferBps);return{provider:"cctp",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:j.getAddress(e.tokenIn),tokenOut:j.getAddress(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:e.amountIn>r?e.amountIn-r:0n,quotedBridgeFee:r,bufferedBridgeFee:l,bufferBps:e.bufferBps??as,minFinalityThreshold:a,metadata:{sourceDomain:s.domain,destinationDomain:o.domain,transferMode:t}}}function is(e){return typeof e=="string"&&e.length>0?e:void 0}function ls(e){return typeof e=="bigint"?e:typeof e=="number"&&Number.isFinite(e)?BigInt(Math.trunc(e)):typeof e=="string"&&/^\d+$/.test(e)?BigInt(e):null}function Jl(e){const t=e.estimate;return ls(t?.toAmountMin)??ls(t?.toAmount)??ls(e.toAmountMin)??ls(e.toAmount)}async function $l(e){const t=e.integratorId??Wr,s=e.fetchImpl??fetch,o=e.baseUrl??"https://v2.api.squidrouter.com",r=await s(`${o}/v2/route`,{method:"POST",headers:{"Content-Type":"application/json","x-integrator-id":t},body:JSON.stringify({fromAddress:j.getAddress(e.fromAddress),fromChain:String(e.sourceChainId),fromToken:j.getAddress(e.tokenIn),fromAmount:e.amountIn.toString(),toAddress:j.getAddress(e.toAddress),toChain:String(e.destinationChainId),toToken:j.getAddress(e.tokenOut),slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0})}),a=await r.json().catch(()=>null);if(!r.ok){const c=typeof a?.message=="string"?a.message:`${r.status} ${r.statusText}`;throw new Error(`Squid route quote failed: ${c}`)}const l=a?.route;if(!l)throw new Error("Squid route quote response did not include route");const d=Jl(l);if(d===null)throw new Error("Squid route quote response did not include output amount");const u=e.amountIn>d?e.amountIn-d:0n;return{provider:"squid",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:j.getAddress(e.tokenIn),tokenOut:j.getAddress(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:d,quotedBridgeFee:u,bufferedBridgeFee:zr(u,e.bufferBps),bufferBps:e.bufferBps??as,...is(l.quoteId)?{quoteId:is(l.quoteId)}:{},...is(r.headers.get("x-request-id"))?{route:is(r.headers.get("x-request-id"))}:{},metadata:{requestId:r.headers.get("x-request-id")??void 0,slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0}}}function _l(e){return{type:"rebalancing",version:1,reason:e.reason??"spiceflow-intent",bridge:{provider:e.bridgeQuote.provider,quoteId:e.bridgeQuote.quoteId,route:e.bridgeQuote.route,sourceChainId:e.bridgeQuote.sourceChainId,destinationChainId:e.bridgeQuote.destinationChainId,tokenIn:e.bridgeQuote.tokenIn,tokenOut:e.bridgeQuote.tokenOut,amountIn:e.bridgeQuote.amountIn.toString(),estimatedAmountOut:e.bridgeQuote.estimatedAmountOut.toString(),quotedBridgeFee:e.bridgeQuote.quotedBridgeFee.toString(),bufferedBridgeFee:e.bridgeQuote.bufferedBridgeFee.toString(),bufferBps:e.bridgeQuote.bufferBps,minFinalityThreshold:e.bridgeQuote.minFinalityThreshold,...e.bridgeQuote.metadata},sourceAsset:e.sourceAsset?{chainId:e.sourceAsset.chainId,token:e.sourceAsset.address,symbol:e.sourceAsset.symbol,decimals:e.sourceAsset.decimals}:void 0,...e.extra}}function ec(e){return`0x72${j.keccak256(j.encodeAbiParameters([{type:"address"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"}],[j.getAddress(e.recipient),BigInt(e.fromChainId),j.getAddress(e.fromToken),e.fromAmount,BigInt(e.toChainId),j.getAddress(e.toToken),e.toAmountMin,e.salt??BigInt(Date.now())])).slice(4)}`}function tc(e){const t=BigInt(Math.floor(Date.now()/1e3)),s=e.exp??t+3600n,o=e.nbf??0n,r=e.idempotenceKey??ec({recipient:e.recipient,fromChainId:e.fromChainId,fromToken:e.fromToken,fromAmount:e.fromAmount,toChainId:e.toChainId,toToken:e.toToken,toAmountMin:e.toAmountMin});return{chainId:e.spicenetChainId,tokenTransfers:[],calls:[{to:"0x0000000000000000000000000000000000000000",value:0n,data:j.encodeFunctionData({abi:B.spicenetAbi,functionName:"createRebalancingRequest",args:[{idempotenceKey:r,nbf:o,exp:s,metadata:JSON.stringify(e.metadata??{}),recipient:j.getAddress(e.recipient).toLowerCase(),fromChainToken:Lr(e.fromChainId,e.fromToken),fromChainTokenAmount:e.fromAmount,toChainToken:Lr(e.toChainId,e.toToken),toChainTokenAmountMin:e.toAmountMin}]})}]}}function Hn(e){try{return B.resolveTokenRef(e)}catch{throw new p.SpiceflowError("ROUTE_TOKEN_NOT_FOUND",`Token "${e[0]}" not found on chain ${e[1]} in the token registry.`,{symbol:e[0],chainId:e[1]})}}function nc(e,t){if(e[0].toUpperCase()===t[0].toUpperCase()&&e[1]===t[1])return!0;let s,o;try{s=Hn(e),o=Hn(t)}catch{return!1}const r=new Set(B.getEquivalentAddresses(o.address).map(a=>a.toLowerCase()));return r.add(o.address.toLowerCase()),r.has(s.address.toLowerCase())}function sc(){const e=[];for(const t of Object.keys(B.CHAINS).map(Number))for(const s of B.getTokensForChain(t))e.push([s.symbol,t]);return e}async function oc(e){const{action:t,inputToken:s,inputAmount:o,registry:r,userAddress:a,slippage:l,intermediaryCandidates:d}=e;if(t.calls.length===0)throw new p.SpiceflowError("INVALID_PARAMS","buildIntent: action.calls must not be empty.",{action:t});if(o<=0n)throw new p.SpiceflowError("INVALID_PARAMS","buildIntent: inputAmount must be greater than zero.",{inputAmount:o.toString()});const u=t.supportedInputTokens??sc();if(!u.some(b=>nc(s,b))){const b=u.map(([k,w])=>`${k} (chain ${w})`).join(", ");throw new p.SpiceflowError("ROUTE_UNSUPPORTED_INPUT",`Input token "${s[0]}" on chain ${s[1]} is not in the action's supported input tokens. Supported: ${b}.`,{inputToken:{symbol:s[0],chainId:s[1]},supportedInputTokens:u})}const c=Hn(s),h=Hn(t.outputToken),f=nr({sourceAsset:c,outputAsset:h,sourceChainId:c.chainId,destinationChainId:t.chainId,intermediaryCandidates:d}),{chainBatches:x,solverFrontToken:g,solverFrontAmount:m,resolvedSwaps:y}=await sr({route:f,sourceAmount:o,userAddress:a,registry:r,actionCalls:t.calls,slippage:l});return{chainBatches:x,route:f,resolvedSwaps:y,resolvedInputToken:c,resolvedOutputToken:h,solverFrontToken:g,solverFrontAmount:m}}const rc=[0n,1n,30n],ac=new Set(["ABORT","CONCURRENT_EXECUTION","WALLET_DISCONNECTED","WALLET_REJECTED","NO_VENUE_FOR_CHAIN"]);function Hr(e,t){return t===0n?e:e*(1000n-t)/1000n}async function ic(e,t){const{chainId:s,swapCalls:o,quoteAmountOut:r,buildActionCalls:a,tokenAddress:l,tokenTransferAmount:d,onProgress:u,signal:c,options:h,buffers:f=rc}=t;for(let x=0;x<f.length;x++){const g=f[x],m=Hr(r,g),y=a(m),b=[{chainId:s,calls:[...o,...y]}];try{return await e(b,l,d,u,c,h)}catch(k){const w=typeof k?.message=="string"?k.message:String(k?.message??"");if(p.isSpiceflowError(k)&&ac.has(k.code)||k.name==="AbortError"||c?.aborted||w.includes("User rejected")||w.includes("User denied")||k.code===4001||x>=f.length-1)throw k;const v=Number(f[x+1])/10;console.warn(`[SwapThenAction] Action attempt ${x+1} failed (buffer ${Number(g)/10}%), retrying with ${v}% buffer...`,k.message),u?.({step:"signing-delegation",message:`Adjusting action amount, retrying (${v}% buffer)...`})}}throw new p.SpiceflowError("ALL_ATTEMPTS_FAILED","All action attempts failed after exhausting buffer progression.",{attempts:f.length,chainId:s})}ta(),exports.SpiceFlowProvider=p.SpiceFlowProvider,exports.SpiceFlowProviderContext=p.SpiceFlowProviderContext,exports.SpiceflowError=p.SpiceflowError,exports.Spinner=p.Spinner,exports.buildDarkPalette=p.buildDarkPalette,exports.buildLightPalette=p.buildLightPalette,exports.getChainConfig=p.getChainConfig,exports.getChainName=p.getChainName,exports.isSpiceflowError=p.isSpiceflowError,exports.relayerService=p.relayerService,exports.resolveTheme=p.resolveTheme,exports.useEmbeddedWalletAddress=p.useEmbeddedWalletAddress,exports.useIsUserWhitelisted=p.useIsUserWhitelisted,exports.useSpiceBrand=p.useSpiceBrand,exports.useWallet=p.useWallet,Object.defineProperty(exports,"NATIVE_TOKEN_ADDRESS",{enumerable:!0,get:function(){return B.ZERO_ADDRESS}}),Object.defineProperty(exports,"SPICENET_NATIVE_CHAIN_ID",{enumerable:!0,get:function(){return B.SPICENET_NATIVE_CHAIN_ID}}),Object.defineProperty(exports,"SPICE_COMBINED_FEE_RECIPIENT",{enumerable:!0,get:function(){return B.SPICE_COMBINED_FEE_RECIPIENT}}),Object.defineProperty(exports,"SPICE_GAS_FEE_RECIPIENT",{enumerable:!0,get:function(){return B.SPICE_GAS_FEE_RECIPIENT}}),Object.defineProperty(exports,"SPICE_PLATFORM_FEE_RECIPIENT",{enumerable:!0,get:function(){return B.SPICE_PLATFORM_FEE_RECIPIENT}}),Object.defineProperty(exports,"SPICE_SOLVER_ADDRESS",{enumerable:!0,get:function(){return B.SPICE_SOLVER_ADDRESS}}),Object.defineProperty(exports,"applySlippage",{enumerable:!0,get:function(){return B.applySlippage}}),Object.defineProperty(exports,"buildUniV3SwapCalls",{enumerable:!0,get:function(){return B.buildUniV3SwapCalls}}),Object.defineProperty(exports,"getChainIdsByNetwork",{enumerable:!0,get:function(){return B.getChainIdsByNetwork}}),Object.defineProperty(exports,"getEscrowContractAddress",{enumerable:!0,get:function(){return B.getEscrowContractAddress}}),Object.defineProperty(exports,"isNativeToken",{enumerable:!0,get:function(){return B.isNativeToken}}),Object.defineProperty(exports,"isSpicenetChainId",{enumerable:!0,get:function(){return B.isSpicenetChainId}}),Object.defineProperty(exports,"normalizeNativeTokenAddress",{enumerable:!0,get:function(){return B.normalizeNativeTokenAddress}}),Object.defineProperty(exports,"spicenetAbi",{enumerable:!0,get:function(){return B.spicenetAbi}}),Object.defineProperty(exports,"spicenetWithdrawalAbi",{enumerable:!0,get:function(){return B.spicenetAbi}}),exports.AccountDisplay=Ul,exports.AddFundsLink=As,exports.CheckIcon=ko,exports.ChevronIcon=on,exports.CloseIcon=In,exports.DEFAULT_BRIDGE_FEE_BUFFER_BPS=as,exports.DEFAULT_SQUID_INTEGRATOR_ID=Wr,exports.DetailRow=En,exports.ExportWalletButton=Fl,exports.ProviderLogin=Bs,exports.SATSUMA_CITREA_CONFIG=no,exports.SdkErrorBoundary=zl,exports.SearchInput=fs,exports.SelectChainModal=ei,exports.SpiceBalance=Gi,exports.SpiceDeposit=Fo,exports.SpiceLock=cr,exports.SpiceLockModal=cr,exports.SpicePay=jl,exports.SpiceSupply=Rr,exports.SpiceWithdraw=or,exports.StatusBanner=An,exports.UNIV3_BASE_CONFIG=Ar,exports.applyBuffer=Hr,exports.areEquivalentOnChains=Wn,exports.buildIntent=oc,exports.buildPayChainBatches=Ks,exports.buildRebalancingBatch=tc,exports.buildRebalancingMetadata=_l,exports.buildRoutedBatches=sr,exports.buildSupplyChainBatches=Zs,exports.create1inchVenue=Sr,exports.createLiquidityRegistry=Fr,exports.createSatsumaVenue=Er,exports.duration=Gt,exports.easing=Nt,exports.estimateFeePreview=Xs,exports.estimateRequiredGrossFunding=Ys,exports.estimateSupplyMaxAmount=dr,exports.executeDirectExternalAction=$s,exports.executeNon7702Supply=mr,exports.executePay=_s,exports.executeSupply=Js,exports.executeSwapThenAction=ic,exports.findEquivalentOnChain=an,exports.findTokenOnChain=Ls,exports.font=lo,exports.getAssetChainTokenCandidates=Xn,exports.getBestUniV3Quote=wr,exports.getUniV3Quote=br,exports.isSupportedSupplyAsset=Cr,exports.isSwapIntent=kr,exports.quoteCctpFee=Xl,exports.quoteSquidFee=$l,exports.radius=ps,exports.resolveAssetTokenAddressOnChain=$t,exports.resolveFundedToken=Uo,exports.resolveInputSupplySwapQuote=El,exports.resolveRoute=nr,exports.resolveTokenRef=Hn,exports.stripSpicenetFundingBatches=pn,exports.transition=Kt,exports.useAssetInput=Ll,exports.useGaslessExecution=Ln,exports.useLockDuration=Ol,exports.usePay=ql,exports.useRepay=Vl,exports.useSmartWallet=Hl,exports.useSpiceAction=rs,exports.useSpiceAssets=Un,exports.useSpiceExecution=Ln,exports.useSpicePendingDeposits=Dr,exports.useSupply=Ql,exports.useSupplyAssets=eo,exports.useSupplyQuote=so,exports.z=xn;
108
+ `})]}),document.body):null;return n.jsxs(n.Fragment,{children:[Ce,ft,E&&Mn.createPortal(n.jsx(Eo,{isOpen:!0,onClose:K,supportedChains:[E.chainId],escrowOnly:!0,escrowTokenAddress:E.tokenAddress,escrowAmount:E.amount,escrowTokenDecimals:E.tokenDecimals,escrowTokenSymbol:E.tokenSymbol,styles:d,onDepositSuccess:te}),document.body)]})},Pr=class ro extends i.Component{constructor(t){super(t),this.handleRetry=()=>{this.state.retryCount>=ro.MAX_RETRIES||this.setState(s=>({hasError:!1,error:null,retryCount:s.retryCount+1}))},this.state={hasError:!1,error:null,retryCount:0}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,s){console.error(`[SdkErrorBoundary] ${this.props.componentName||"SDK component"} failed:`,{message:t.message,componentStack:s.componentStack})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",borderRadius:"8px",border:"1px solid rgba(239, 68, 68, 0.2)",backgroundColor:this.props.dark?"rgba(239, 68, 68, 0.08)":"rgba(239, 68, 68, 0.05)",gap:"12px"},s={fontSize:"14px",color:"#f87171",margin:0},o={fontSize:"12px",color:"#888",maxWidth:"280px",textAlign:"center",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",margin:0},r={padding:"8px 16px",fontSize:"12px",borderRadius:"6px",backgroundColor:this.props.dark?"#2a2a2a":"#f3f4f6",color:this.props.dark?"#888":"#374151",border:this.props.dark?"1px solid #3a3a3a":"1px solid #d1d5db",cursor:"pointer",transition:"background-color 150ms ease"},a={fontSize:"12px",color:"#888",margin:0},l=ro.MAX_RETRIES-this.state.retryCount;return n.jsxs("div",{style:t,children:[n.jsxs("p",{style:s,children:[this.props.componentName||"Component"," failed to load"]}),this.state.error&&n.jsx("p",{style:o,children:this.state.error.message}),l>0?n.jsxs("button",{onClick:this.handleRetry,style:r,onMouseEnter:d=>{d.target.style.backgroundColor=this.props.dark?"#333":"#e5e7eb"},onMouseLeave:d=>{d.target.style.backgroundColor=this.props.dark?"#2a2a2a":"#f3f4f6"},children:["Try again (",l," left)"]}):n.jsx("p",{style:a,children:"Please refresh the page to try again"})]})}return this.props.children}};Pr.MAX_RETRIES=3;let zl=Pr;const Ll=()=>{const[e,t]=i.useState("0"),[s,o]=i.useState(null);return{assetAmount:e,setAssetAmount:t,selectedAsset:s,setSelectedAsset:o}};function Ol(e,t=0){const[s,o]=i.useState(t),r=e[s]??e[0],a=i.useMemo(()=>r?BigInt(Math.round(r.months*30*24*3600)):0n,[r?.months]);return{selectedDurationIdx:s,setSelectedDurationIdx:o,selectedDuration:r,durationSeconds:a}}function Hl(){const{actions:e,isReady:t,isAuthenticated:s}=p.useWallet(),o=p.useEmbeddedWalletAddress(),r=i.useRef(!1),a=i.useRef(0),l=i.useRef(null),d=i.useRef(e),[u,c]=i.useState(0);d.current=e,i.useEffect(()=>{r.current=!1,a.current=0,l.current&&(clearTimeout(l.current),l.current=null)},[o]),i.useEffect(()=>{if(!o||!t||!s||r.current)return;r.current=!0;let h=!1;return(async()=>{await new Promise(f=>setTimeout(f,2e3));try{await p.ensureSmartWallet(o,d.current.signMessage),a.current=0}catch(f){console.warn("[SmartWallet] Registration failed:",f),r.current=!1,!h&&a.current<3&&(a.current+=1,l.current=setTimeout(()=>{c(x=>x+1)},5e3))}})(),()=>{h=!0,l.current&&(clearTimeout(l.current),l.current=null)}},[o,t,s,u])}function rs(e){const{destinationToken:t,recipient:s,buildActionCalls:o,buildSpicenetBatch:r,amountMode:a,amount:l,sourceChains:d,supportedSourceAssets:u,feeExecutionMode:c="user-transfer",enabled:h=!0,onSuccess:f,onError:x}=e,g=a==="exact-output"?"output":"input",m=g==="output",y=t.chainId,b=i.useContext(p.SpiceFlowProviderContext),k=(b?.mode||"7702")!=="7702",w=!!b?.isWhitelistGateActive,v=i.useMemo(()=>d??b?.supportedChainIds??[],[d,b?.supportedChainIds]),I=i.useMemo(()=>w?[]:u,[w,u]),C=p.useWallet(),{address:E,isConnected:A,isReady:R,isAuthenticated:T,provider:S}=C,{executeGasless:F,estimateGasless:M}=Ln(),{externalWallet:D,externalAddress:Q,embeddedAddress:z}=p.useProviderWallets(),q=p.useEmbeddedWalletAddress()||z,{displayAssets:X,filteredSpiceAssets:W,embeddedWalletAddress:G,refreshSpiceAssets:Z,refreshWalletAssets:H}=eo({destinationToken:t,supportedSourceAssets:I,sourceChains:v,enabled:h&&(k?!!Q:!!q)}),U=X,[P,ce]=i.useState(null),[N,_]=i.useState(!1),[le,de]=i.useState(null),[be,oe]=i.useState("idle"),[he,O]=i.useState(""),[ee,K]=i.useState(null),[te,pe]=i.useState(null),[,ve]=i.useState(!1),[J,L]=i.useState(null),[ie,fe]=i.useState(!1),[Be,He]=i.useState(!1),[Je,Le]=i.useState(null),Ee=i.useRef(P),Ce=i.useRef(!1),ft=i.useRef(null),V=i.useRef(0),ke=i.useRef(null),je=i.useRef(null);i.useEffect(()=>{Ee.current=P},[P]);const We=m?l||"0":P?.amount||"0";i.useEffect(()=>{h||(ce(null),de(null),_(!1),oe("idle"),O(""),K(null),pe(null),ve(!1),L(null),fe(!1),He(!1),Le(null),Ce.current=!1,ft.current&&(ft.current.abort(),ft.current=null))},[h]),i.useEffect(()=>{m||ce(me=>me&&me.amount!==l?{...me,amount:l}:me)},[l,m]);const $e=i.useCallback(me=>{ce(me),de(null),Le(null),He(!1)},[]),wt=i.useCallback(me=>{ce(Ct=>({asset:me,amount:Ct?.asset?.address===me.address&&Ct?.asset?.chainId===me.chainId&&Ct.amount||(m?"":l)})),de(null),Le(null),He(!1)},[l,m]),At=G||z||E,{isQuoting:lt,quoteError:Se,estimatedOutput:Pt,estimatedInput:Yt,resolvedSwap:St,exactOutputSwap:_e,quoteAmountOut:Et,resolvedTokenIn:De,isDirect:ht,needsSwap:Te,selectedIsEquivalent:ot}=so({direction:g,selectedAsset:P,destinationToken:t,chainId:y,recipient:At,paymentAmount:We}),Ne=m?parseFloat(We):parseFloat(P?.amount||"")||0,ct=P?.asset?._source==="wallet",Rt=!!P?.asset&&ct&&P.asset.chainId!==y,ye=ct&&P?.asset?._fundingWallet==="external",qe=P?.asset?._source!=="spice"&&(k||ye),dt=i.useMemo(()=>P?.asset?W.find(me=>p.addressesEqual(me.address,P.asset.address))?.balanceFormatted??0:0,[P,W]),kt=ct?P?.asset.balanceFormatted??0:dt||(P?.asset.balanceFormatted??0),we=i.useMemo(()=>{if(!P?.asset)return!1;if(m)return J?fn(J.grossAmount,J.decimals,P.asset.decimals)>P.asset.balance:ot||ht?Ne>P.asset.balanceFormatted:_e?parseFloat(j.formatUnits(_e.amountInMax,P.asset.decimals))>P.asset.balanceFormatted:!1;if(J){const me=fn(J.grossAmount,J.decimals,P.asset.decimals);return ct?me>P.asset.balance:parseFloat(j.formatUnits(me,P.asset.decimals))>kt}return Ne>kt},[P,m,J,ot,Ne,_e,kt,ct,ht]),Wt=i.useCallback(me=>{oe({building:"signing-delegation","signing-delegation":"signing-delegation","signing-intent":"signing-intent",submitting:"submitting",executing:"executing",success:"success",error:"error"}[me.step]||"executing"),O(me.message),me.txHash&&K(me.txHash)},[]),et=i.useMemo(()=>({currentPaymentAmount:We,destinationToken:t,embeddedWalletAddress:G,providerEmbeddedAddress:z,externalWalletAddress:Q,address:E,recipient:s,isNon7702:qe,isPayMode:m,resolvedChainId:y,buildActionCalls:o,feeExecutionMode:c,buildSpicenetBatch:r,selectedAsset:P,needsSwap:Te,resolvedSwap:St,exactOutputSwap:_e,quoteAmountOut:Et,resolvedTokenIn:De}),[We,t,G,z,Q,E,s,qe,m,y,o,c,r,P,Te,St,_e,Et,De]),gt=i.useCallback(me=>Ks(et,me),[et]),vt=i.useCallback(me=>Zs(et,me),[et]),Ut=i.useCallback((me,Ct,ze,Ft)=>Ys(me,Ct,ze,M,Ft),[M]),Dt=i.useMemo(()=>P?.asset?Te&&De?De:P.asset.chainId===y?P.asset.address:De??$t(P.asset,y)??t.address:t.address,[P,t.address,Te,y,De]),Ve=i.useMemo(()=>P?.asset?p.addressesEqual(P.asset.address,t.address)&&P.asset.chainId===t.chainId:!1,[P,t.address,t.chainId]),Ot=qe&&Ve,Me=Ot&&Ne>0&&!!P?.asset,ut=i.useMemo(()=>!(!P?.asset||Ne<=0),[P,Ne]),It=i.useMemo(()=>!h||N||be!=="idle"||!ut||Me||!P?.asset?null:[m?"pay":"supply",g,P.asset.address.toLowerCase(),P.asset.chainId,P.amount,We,t.address.toLowerCase(),t.chainId,y,De?.toLowerCase()??"",Te?"swap":"direct",ht?"direct-token":"routed-token",qe?"non7702":"7702",Ve?"source-dest":"cross-chain",lt?"quoting":"quoted",s?.toLowerCase()??"",_e?.amountIn?.toString()??"",_e?.amountInMax?.toString()??"",_e?.venue??"",St?.amountOut?.toString()??"",Et?.toString()??"",G??"",z??"",E??""].join("|"),[h,N,be,ut,Me,P,m,g,We,t,y,De,Te,ht,qe,Ve,lt,s,_e,St,Et,G,z,E]),Ge=i.useCallback(()=>Xs({selectedAsset:P,isPayMode:m,parsedAmount:Ne,needsSwap:Te,exactOutputSwap:_e,isNon7702:qe,isSourceDestToken:Ve,currentPaymentAmount:We,destinationToken:t,feeExecutionMode:c,resolvedTokenIn:De,embeddedWalletAddress:G,providerEmbeddedAddress:z,resolvedChainId:y,isConnected:A,address:E,ready:R,authenticated:T,isDirect:ht,resolvedSwap:St,isQuoting:lt,executionTokenAddress:Dt,buildPayChainBatches:gt,buildSupplyChainBatches:vt,estimateGasless:M,estimateRequiredGrossFunding:Ut}),[P,m,Ne,Te,_e,qe,Ve,We,t,c,De,G,z,Ut,gt,M,y,A,E,R,T,ht,St,lt,vt,Dt,s]);i.useEffect(()=>{ke.current=Ge},[Ge]),i.useEffect(()=>{if(!h){fe(!1),He(!1),Le(null),L(null);return}if(N||be!=="idle"){V.current+=1,fe(!1);return}if(!ut){L(null),fe(!1),He(!1),Le(null);return}if(Me){L(null),fe(!1),He(!0),Le(null);return}if(lt){V.current+=1,fe(!1),He(!1);return}if(!It)return;let me=!1;const Ct=async()=>{const Ft=++V.current;Le(null),fe(!0);try{const Bt=await ke.current?.();if(me||V.current!==Ft)return;Bt?(L(Bt),He(!0)):(L(null),He(!1)),Le(null)}catch(Bt){if(me||V.current!==Ft)return;const zt=p.sanitizeError(Bt,"Unable to calculate fees for this action.");L(null),He(!1),Le(zt)}finally{!me&&V.current===Ft&&fe(!1)}},ze=window.setTimeout(()=>{Ct()},250);return()=>{me=!0,clearTimeout(ze),fe(!1)}},[h,N,be,ut,Me,lt,It]),i.useEffect(()=>{!m&&be==="success"&&ee&&(Z(),f?.(ee))},[m,be,ee,Z,f]),i.useEffect(()=>{if(!m||te?.status!=="success"||Ce.current||!E)return;Ce.current=!0;const me=Ee.current;!me?.asset||me.asset?._source==="wallet"||Z()},[m,te?.status,E,Z]);const tt=i.useRef(f),jt=i.useRef(x);i.useEffect(()=>{tt.current=f},[f]),i.useEffect(()=>{jt.current=x},[x]),i.useEffect(()=>{m&&(te?.status==="success"&&tt.current?.(te.txHash||""),te?.status==="failed"&&jt.current?.(new Error("Payment execution failed")))},[m,te?.status]),i.useEffect(()=>{h&&(Z(),H())},[h,Z,H]),je.current={selectedAsset:P,parsedAmount:Ne,currentPaymentAmount:We,isInsufficientBalance:we,isPayMode:m,isNon7702:qe,isSourceDestToken:Ve,needsSwap:Te,exactOutputSwap:_e,selectedIsEquivalent:ot,resolvedTokenIn:De,embeddedWalletAddress:G,providerEmbeddedAddress:z,externalWallet:D,externalWalletAddress:Q,address:E,isConnected:A,ready:R,authenticated:T,provider:S,resolvedChainId:y,executionTokenAddress:Dt,destinationToken:t,recipient:s,buildActionCalls:o,feeExecutionMode:c,buildSpicenetBatch:r,onError:x,gasless:{estimateGasless:M,executeGasless:F,buildPayChainBatches:gt,buildSupplyChainBatches:vt,estimateRequiredGrossFunding:Ut,onProgress:Wt},ui:{setError:de,setStep:oe,setStatusMsg:O,setTxHash:K,setIsExecuting:_,setShowStatusPanel:ve,setPaymentResult:pe},refs:{spiceDepositSubmittedRef:Ce,abortControllerRef:ft}};const mt=i.useCallback(async()=>{const me=je.current;me&&(me.isPayMode?await _s(me):await Js(me))},[]),Ue=m&&Ne===0,Ye=m?!!P?.asset&&Ne>=0&&!we&&!N&&(Ue||Me||Be)&&!Je&&(Ue||!Te||!!_e):!!P?.asset&&Ne>0&&!we&&!N&&(Ot||Be)&&!Je&&(Rt||ht||!!St&&!lt),yt=i.useCallback(()=>{Z(),H()},[Z,H]);return{sources:U,selectedAsset:P,setSelectedAsset:$e,selectAsset:wt,quote:{isQuoting:lt,error:Se,estimatedInput:Yt,estimatedOutput:Pt,isDirect:ht,needsSwap:Te},feePreview:J,isFeePreviewLoading:ie,feePreviewError:Je,canSubmit:Ye,execute:mt,isExecuting:N,step:be,statusMsg:he,txHash:ee,paymentResult:te,refreshAssets:yt}}function Ql(e){return rs({...e,amountMode:"exact-input"})}function ql(e){return rs({...e,amountMode:"exact-output"})}function Vl(e){return rs({...e,amountMode:"exact-input"})}const as=1500,Wr="spiceflow-75f053db-70ab-4f37-83cc-abf68cb5b70d",Gl={1:{chainId:1,domain:0,network:"mainnet"},42161:{chainId:42161,domain:3,network:"mainnet"},8453:{chainId:8453,domain:6,network:"mainnet"},11155111:{chainId:11155111,domain:0,network:"testnet"},421614:{chainId:421614,domain:3,network:"testnet"},84532:{chainId:84532,domain:6,network:"testnet"}};function Ur(e,t,s){return(e*t+s-1n)/s}function zr(e,t=as){return Ur(e,BigInt(1e4+t),10000n)}function Lr(e,t){return`evm:${e}:${j.getAddress(t).toLowerCase()}`}function Or(e){return Gl[e]??null}function Kl(e){return e==="testnet"?"https://iris-api-sandbox.circle.com":"https://iris-api.circle.com"}function Zl(e){const t=typeof e=="number"?e.toString():typeof e=="string"?e:"0",[s,o=""]=t.trim().split("."),r=BigInt(s||"0"),a=BigInt((o+"00").slice(0,2)||"0");return r*100n+a}function Yl(e,t){const s=Zl(t);return Ur(e,s,1000000n)}async function Xl(e){const t=e.transferMode??"fast",s=Or(e.sourceChainId),o=Or(e.destinationChainId);if(!s||!o||s.network!==o.network)throw new Error(`Unsupported CCTP route ${e.sourceChainId} -> ${e.destinationChainId}`);let r=0n;const a=t==="fast"?1e3:2e3;if(t==="fast"){const d=e.fetchImpl??fetch,u=`${Kl(s.network)}/v2/burn/USDC/fees/${s.domain}/${o.domain}`,c=await d(u);if(!c.ok)throw new Error(`CCTP fee quote failed: ${c.status} ${c.statusText}`);const h=await c.json(),f=Array.isArray(h)?h:Array.isArray(h?.data)?h.data:[],x=f.find(g=>String(g.finalityThreshold??g.finalityThresholdExecuted??"")==="1000")??f[0];r=Yl(e.amountIn,x?.minimumFee??0)}const l=zr(r,e.bufferBps);return{provider:"cctp",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:j.getAddress(e.tokenIn),tokenOut:j.getAddress(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:e.amountIn>r?e.amountIn-r:0n,quotedBridgeFee:r,bufferedBridgeFee:l,bufferBps:e.bufferBps??as,minFinalityThreshold:a,metadata:{sourceDomain:s.domain,destinationDomain:o.domain,transferMode:t}}}function is(e){return typeof e=="string"&&e.length>0?e:void 0}function ls(e){return typeof e=="bigint"?e:typeof e=="number"&&Number.isFinite(e)?BigInt(Math.trunc(e)):typeof e=="string"&&/^\d+$/.test(e)?BigInt(e):null}function Jl(e){const t=e.estimate;return ls(t?.toAmountMin)??ls(t?.toAmount)??ls(e.toAmountMin)??ls(e.toAmount)}async function $l(e){const t=e.integratorId??Wr,s=e.fetchImpl??fetch,o=e.baseUrl??"https://v2.api.squidrouter.com",r=await s(`${o}/v2/route`,{method:"POST",headers:{"Content-Type":"application/json","x-integrator-id":t},body:JSON.stringify({fromAddress:j.getAddress(e.fromAddress),fromChain:String(e.sourceChainId),fromToken:j.getAddress(e.tokenIn),fromAmount:e.amountIn.toString(),toAddress:j.getAddress(e.toAddress),toChain:String(e.destinationChainId),toToken:j.getAddress(e.tokenOut),slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0})}),a=await r.json().catch(()=>null);if(!r.ok){const c=typeof a?.message=="string"?a.message:`${r.status} ${r.statusText}`;throw new Error(`Squid route quote failed: ${c}`)}const l=a?.route;if(!l)throw new Error("Squid route quote response did not include route");const d=Jl(l);if(d===null)throw new Error("Squid route quote response did not include output amount");const u=e.amountIn>d?e.amountIn-d:0n;return{provider:"squid",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:j.getAddress(e.tokenIn),tokenOut:j.getAddress(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:d,quotedBridgeFee:u,bufferedBridgeFee:zr(u,e.bufferBps),bufferBps:e.bufferBps??as,...is(l.quoteId)?{quoteId:is(l.quoteId)}:{},...is(r.headers.get("x-request-id"))?{route:is(r.headers.get("x-request-id"))}:{},metadata:{requestId:r.headers.get("x-request-id")??void 0,slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0}}}function _l(e){return{type:"rebalancing",version:1,reason:e.reason??"spiceflow-intent",bridge:{provider:e.bridgeQuote.provider,quoteId:e.bridgeQuote.quoteId,route:e.bridgeQuote.route,sourceChainId:e.bridgeQuote.sourceChainId,destinationChainId:e.bridgeQuote.destinationChainId,tokenIn:e.bridgeQuote.tokenIn,tokenOut:e.bridgeQuote.tokenOut,amountIn:e.bridgeQuote.amountIn.toString(),estimatedAmountOut:e.bridgeQuote.estimatedAmountOut.toString(),quotedBridgeFee:e.bridgeQuote.quotedBridgeFee.toString(),bufferedBridgeFee:e.bridgeQuote.bufferedBridgeFee.toString(),bufferBps:e.bridgeQuote.bufferBps,minFinalityThreshold:e.bridgeQuote.minFinalityThreshold,...e.bridgeQuote.metadata},sourceAsset:e.sourceAsset?{chainId:e.sourceAsset.chainId,token:e.sourceAsset.address,symbol:e.sourceAsset.symbol,decimals:e.sourceAsset.decimals}:void 0,...e.extra}}function ec(e){return`0x72${j.keccak256(j.encodeAbiParameters([{type:"address"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"}],[j.getAddress(e.recipient),BigInt(e.fromChainId),j.getAddress(e.fromToken),e.fromAmount,BigInt(e.toChainId),j.getAddress(e.toToken),e.toAmountMin,e.salt??BigInt(Date.now())])).slice(4)}`}function tc(e){const t=BigInt(Math.floor(Date.now()/1e3)),s=e.exp??t+3600n,o=e.nbf??0n,r=e.idempotenceKey??ec({recipient:e.recipient,fromChainId:e.fromChainId,fromToken:e.fromToken,fromAmount:e.fromAmount,toChainId:e.toChainId,toToken:e.toToken,toAmountMin:e.toAmountMin});return{chainId:e.spicenetChainId,tokenTransfers:[],calls:[{to:"0x0000000000000000000000000000000000000000",value:0n,data:j.encodeFunctionData({abi:B.spicenetAbi,functionName:"createRebalancingRequest",args:[{idempotenceKey:r,nbf:o,exp:s,metadata:JSON.stringify(e.metadata??{}),recipient:j.getAddress(e.recipient).toLowerCase(),fromChainToken:Lr(e.fromChainId,e.fromToken),fromChainTokenAmount:e.fromAmount,toChainToken:Lr(e.toChainId,e.toToken),toChainTokenAmountMin:e.toAmountMin}]})}]}}function Hn(e){try{return B.resolveTokenRef(e)}catch{throw new p.SpiceflowError("ROUTE_TOKEN_NOT_FOUND",`Token "${e[0]}" not found on chain ${e[1]} in the token registry.`,{symbol:e[0],chainId:e[1]})}}function nc(e,t){if(e[0].toUpperCase()===t[0].toUpperCase()&&e[1]===t[1])return!0;let s,o;try{s=Hn(e),o=Hn(t)}catch{return!1}const r=new Set(B.getEquivalentAddresses(o.address).map(a=>a.toLowerCase()));return r.add(o.address.toLowerCase()),r.has(s.address.toLowerCase())}function sc(){const e=[];for(const t of Object.keys(B.CHAINS).map(Number))for(const s of B.getTokensForChain(t))e.push([s.symbol,t]);return e}async function oc(e){const{action:t,inputToken:s,inputAmount:o,registry:r,userAddress:a,slippage:l,intermediaryCandidates:d}=e;if(t.calls.length===0)throw new p.SpiceflowError("INVALID_PARAMS","buildIntent: action.calls must not be empty.",{action:t});if(o<=0n)throw new p.SpiceflowError("INVALID_PARAMS","buildIntent: inputAmount must be greater than zero.",{inputAmount:o.toString()});const u=t.supportedInputTokens??sc();if(!u.some(b=>nc(s,b))){const b=u.map(([k,w])=>`${k} (chain ${w})`).join(", ");throw new p.SpiceflowError("ROUTE_UNSUPPORTED_INPUT",`Input token "${s[0]}" on chain ${s[1]} is not in the action's supported input tokens. Supported: ${b}.`,{inputToken:{symbol:s[0],chainId:s[1]},supportedInputTokens:u})}const c=Hn(s),h=Hn(t.outputToken),f=nr({sourceAsset:c,outputAsset:h,sourceChainId:c.chainId,destinationChainId:t.chainId,intermediaryCandidates:d}),{chainBatches:x,solverFrontToken:g,solverFrontAmount:m,resolvedSwaps:y}=await sr({route:f,sourceAmount:o,userAddress:a,registry:r,actionCalls:t.calls,slippage:l});return{chainBatches:x,route:f,resolvedSwaps:y,resolvedInputToken:c,resolvedOutputToken:h,solverFrontToken:g,solverFrontAmount:m}}const rc=[0n,1n,30n],ac=new Set(["ABORT","CONCURRENT_EXECUTION","WALLET_DISCONNECTED","WALLET_REJECTED","NO_VENUE_FOR_CHAIN"]);function Hr(e,t){return t===0n?e:e*(1000n-t)/1000n}async function ic(e,t){const{chainId:s,swapCalls:o,quoteAmountOut:r,buildActionCalls:a,tokenAddress:l,tokenTransferAmount:d,onProgress:u,signal:c,options:h,buffers:f=rc}=t;for(let x=0;x<f.length;x++){const g=f[x],m=Hr(r,g),y=a(m),b=[{chainId:s,calls:[...o,...y]}];try{return await e(b,l,d,u,c,h)}catch(k){const w=typeof k?.message=="string"?k.message:String(k?.message??"");if(p.isSpiceflowError(k)&&ac.has(k.code)||k.name==="AbortError"||c?.aborted||w.includes("User rejected")||w.includes("User denied")||k.code===4001||x>=f.length-1)throw k;const v=Number(f[x+1])/10;console.warn(`[SwapThenAction] Action attempt ${x+1} failed (buffer ${Number(g)/10}%), retrying with ${v}% buffer...`,k.message),u?.({step:"signing-delegation",message:`Adjusting action amount, retrying (${v}% buffer)...`})}}throw new p.SpiceflowError("ALL_ATTEMPTS_FAILED","All action attempts failed after exhausting buffer progression.",{attempts:f.length,chainId:s})}ta(),exports.SpiceFlowProvider=p.SpiceFlowProvider,exports.SpiceFlowProviderContext=p.SpiceFlowProviderContext,exports.SpiceflowError=p.SpiceflowError,exports.Spinner=p.Spinner,exports.buildDarkPalette=p.buildDarkPalette,exports.buildLightPalette=p.buildLightPalette,exports.getChainConfig=p.getChainConfig,exports.getChainName=p.getChainName,exports.isSpiceflowError=p.isSpiceflowError,exports.relayerService=p.relayerService,exports.resolveTheme=p.resolveTheme,exports.useEmbeddedWalletAddress=p.useEmbeddedWalletAddress,exports.useIsUserWhitelisted=p.useIsUserWhitelisted,exports.useSpiceBrand=p.useSpiceBrand,exports.useWallet=p.useWallet,Object.defineProperty(exports,"NATIVE_TOKEN_ADDRESS",{enumerable:!0,get:function(){return B.ZERO_ADDRESS}}),Object.defineProperty(exports,"SPICENET_NATIVE_CHAIN_ID",{enumerable:!0,get:function(){return B.SPICENET_NATIVE_CHAIN_ID}}),Object.defineProperty(exports,"SPICE_COMBINED_FEE_RECIPIENT",{enumerable:!0,get:function(){return B.SPICE_COMBINED_FEE_RECIPIENT}}),Object.defineProperty(exports,"SPICE_GAS_FEE_RECIPIENT",{enumerable:!0,get:function(){return B.SPICE_GAS_FEE_RECIPIENT}}),Object.defineProperty(exports,"SPICE_PLATFORM_FEE_RECIPIENT",{enumerable:!0,get:function(){return B.SPICE_PLATFORM_FEE_RECIPIENT}}),Object.defineProperty(exports,"SPICE_SOLVER_ADDRESS",{enumerable:!0,get:function(){return B.SPICE_SOLVER_ADDRESS}}),Object.defineProperty(exports,"applySlippage",{enumerable:!0,get:function(){return B.applySlippage}}),Object.defineProperty(exports,"buildUniV3SwapCalls",{enumerable:!0,get:function(){return B.buildUniV3SwapCalls}}),Object.defineProperty(exports,"getChainIdsByNetwork",{enumerable:!0,get:function(){return B.getChainIdsByNetwork}}),Object.defineProperty(exports,"getEscrowContractAddress",{enumerable:!0,get:function(){return B.getEscrowContractAddress}}),Object.defineProperty(exports,"isNativeToken",{enumerable:!0,get:function(){return B.isNativeToken}}),Object.defineProperty(exports,"isSpicenetChainId",{enumerable:!0,get:function(){return B.isSpicenetChainId}}),Object.defineProperty(exports,"normalizeNativeTokenAddress",{enumerable:!0,get:function(){return B.normalizeNativeTokenAddress}}),Object.defineProperty(exports,"spicenetAbi",{enumerable:!0,get:function(){return B.spicenetAbi}}),Object.defineProperty(exports,"spicenetWithdrawalAbi",{enumerable:!0,get:function(){return B.spicenetAbi}}),exports.AccountDisplay=Ul,exports.AddFundsLink=As,exports.CheckIcon=ko,exports.ChevronIcon=on,exports.CloseIcon=In,exports.DEFAULT_BRIDGE_FEE_BUFFER_BPS=as,exports.DEFAULT_SQUID_INTEGRATOR_ID=Wr,exports.DetailRow=En,exports.ExportWalletButton=Fl,exports.ProviderLogin=Bs,exports.SATSUMA_CITREA_CONFIG=no,exports.SdkErrorBoundary=zl,exports.SearchInput=fs,exports.SelectChainModal=ei,exports.SpiceBalance=Gi,exports.SpiceDeposit=Fo,exports.SpiceLock=cr,exports.SpiceLockModal=cr,exports.SpicePay=jl,exports.SpiceSupply=Rr,exports.SpiceWithdraw=or,exports.StatusBanner=An,exports.UNIV3_BASE_CONFIG=Ar,exports.applyBuffer=Hr,exports.areEquivalentOnChains=Wn,exports.buildIntent=oc,exports.buildPayChainBatches=Ks,exports.buildRebalancingBatch=tc,exports.buildRebalancingMetadata=_l,exports.buildRoutedBatches=sr,exports.buildSupplyChainBatches=Zs,exports.create1inchVenue=Sr,exports.createLiquidityRegistry=Fr,exports.createSatsumaVenue=Er,exports.duration=Gt,exports.easing=Nt,exports.estimateFeePreview=Xs,exports.estimateRequiredGrossFunding=Ys,exports.estimateSupplyMaxAmount=dr,exports.executeDirectExternalAction=$s,exports.executeNon7702Supply=mr,exports.executePay=_s,exports.executeSupply=Js,exports.executeSwapThenAction=ic,exports.findEquivalentOnChain=an,exports.findTokenOnChain=Ls,exports.font=lo,exports.getAssetChainTokenCandidates=Xn,exports.getBestUniV3Quote=wr,exports.getUniV3Quote=br,exports.isSupportedSupplyAsset=Cr,exports.isSwapIntent=kr,exports.quoteCctpFee=Xl,exports.quoteSquidFee=$l,exports.radius=ps,exports.resolveAssetTokenAddressOnChain=$t,exports.resolveFundedToken=Uo,exports.resolveInputSupplySwapQuote=El,exports.resolveRoute=nr,exports.resolveTokenRef=Hn,exports.stripSpicenetFundingBatches=pn,exports.transition=Kt,exports.useAssetInput=Ll,exports.useGaslessExecution=Ln,exports.useLockDuration=Ol,exports.usePay=ql,exports.useRepay=Vl,exports.useSmartWallet=Hl,exports.useSpiceAction=rs,exports.useSpiceAssets=Un,exports.useSpiceExecution=Ln,exports.useSpicePendingDeposits=Dr,exports.useSupply=Ql,exports.useSupplyAssets=eo,exports.useSupplyQuote=so,exports.z=xn;
package/dist/index.js CHANGED
@@ -105,4 +105,4 @@ import{jsxs as g,jsx as a,Fragment as fn}from"react/jsx-runtime";import wn,{useS
105
105
  from { opacity: 0; transform: translateY(-4px); }
106
106
  to { opacity: 1; transform: translateY(0); }
107
107
  }
108
- `})]}),document.body):null;return g(fn,{children:[Ce,Et,S&&mr.createPortal(a(Nr,{isOpen:!0,onClose:q,supportedChains:[S.chainId],escrowOnly:!0,escrowTokenAddress:S.tokenAddress,escrowAmount:S.amount,escrowTokenDecimals:S.tokenDecimals,escrowTokenSymbol:S.tokenSymbol,styles:c,onDepositSuccess:ee}),document.body)]})},Qa=class or extends wn.Component{constructor(t){super(t),this.handleRetry=()=>{this.state.retryCount>=or.MAX_RETRIES||this.setState(n=>({hasError:!1,error:null,retryCount:n.retryCount+1}))},this.state={hasError:!1,error:null,retryCount:0}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error(`[SdkErrorBoundary] ${this.props.componentName||"SDK component"} failed:`,{message:t.message,componentStack:n.componentStack})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",borderRadius:"8px",border:"1px solid rgba(239, 68, 68, 0.2)",backgroundColor:this.props.dark?"rgba(239, 68, 68, 0.08)":"rgba(239, 68, 68, 0.05)",gap:"12px"},n={fontSize:"14px",color:"#f87171",margin:0},o={fontSize:"12px",color:"#888",maxWidth:"280px",textAlign:"center",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",margin:0},s={padding:"8px 16px",fontSize:"12px",borderRadius:"6px",backgroundColor:this.props.dark?"#2a2a2a":"#f3f4f6",color:this.props.dark?"#888":"#374151",border:this.props.dark?"1px solid #3a3a3a":"1px solid #d1d5db",cursor:"pointer",transition:"background-color 150ms ease"},r={fontSize:"12px",color:"#888",margin:0},i=or.MAX_RETRIES-this.state.retryCount;return g("div",{style:t,children:[g("p",{style:n,children:[this.props.componentName||"Component"," failed to load"]}),this.state.error&&a("p",{style:o,children:this.state.error.message}),i>0?g("button",{onClick:this.handleRetry,style:s,onMouseEnter:c=>{c.target.style.backgroundColor=this.props.dark?"#333":"#e5e7eb"},onMouseLeave:c=>{c.target.style.backgroundColor=this.props.dark?"#2a2a2a":"#f3f4f6"},children:["Try again (",i," left)"]}):a("p",{style:r,children:"Please refresh the page to try again"})]})}return this.props.children}};Qa.MAX_RETRIES=3;let ud=Qa;const pd=()=>{const[e,t]=M("0"),[n,o]=M(null);return{assetAmount:e,setAssetAmount:t,selectedAsset:n,setSelectedAsset:o}};function fd(e,t=0){const[n,o]=M(t),s=e[n]??e[0],r=te(()=>s?BigInt(Math.round(s.months*30*24*3600)):0n,[s?.months]);return{selectedDurationIdx:n,setSelectedDurationIdx:o,selectedDuration:s,durationSeconds:r}}function hd(){const{actions:e,isReady:t,isAuthenticated:n}=vn(),o=In(),s=le(!1),r=le(0),i=le(null),c=le(e),[d,l]=M(0);c.current=e,G(()=>{s.current=!1,r.current=0,i.current&&(clearTimeout(i.current),i.current=null)},[o]),G(()=>{if(!o||!t||!n||s.current)return;s.current=!0;let p=!1;return(async()=>{await new Promise(u=>setTimeout(u,2e3));try{await si(o,c.current.signMessage),r.current=0}catch(u){console.warn("[SmartWallet] Registration failed:",u),s.current=!1,!p&&r.current<3&&(r.current+=1,i.current=setTimeout(()=>{l(m=>m+1)},5e3))}})(),()=>{p=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[o,t,n,d])}function Jo(e){const{destinationToken:t,recipient:n,buildActionCalls:o,buildSpicenetBatch:s,amountMode:r,amount:i,sourceChains:c,supportedSourceAssets:d,feeExecutionMode:l="user-transfer",enabled:p=!0,onSuccess:u,onError:m}=e,h=r==="exact-output"?"output":"input",f=h==="output",y=t.chainId,b=an(Xt),C=(b?.mode||"7702")!=="7702",w=!!b?.isWhitelistGateActive,k=te(()=>c??b?.supportedChainIds??[],[c,b?.supportedChainIds]),I=te(()=>w?[]:d,[w,d]),x=vn(),{address:S,isConnected:A,isReady:T,isAuthenticated:F,provider:v}=x,{executeGasless:E,estimateGasless:B}=Bo(),{externalWallet:R,externalAddress:H,embeddedAddress:U}=$n(),j=In()||U,{displayAssets:Z,filteredSpiceAssets:W,embeddedWalletAddress:V,refreshSpiceAssets:K,refreshWalletAssets:O}=$s({destinationToken:t,supportedSourceAssets:I,sourceChains:k,enabled:p&&(C?!!H:!!j)}),P=Z,[N,ue]=M(null),[D,$]=M(!1),[ce,pe]=M(null),[ke,se]=M("idle"),[ge,z]=M(""),[_,q]=M(null),[ee,he]=M(null),[,Ae]=M(!1),[X,L]=M(null),[ie,me]=M(!1),[Pe,Ze]=M(!1),[at,Ke]=M(null),Te=le(N),Ce=le(!1),Et=le(null),Q=le(0),Ie=le(null),Me=le(null);G(()=>{Te.current=N},[N]);const Qe=f?i||"0":N?.amount||"0";G(()=>{p||(ue(null),pe(null),$(!1),se("idle"),z(""),q(null),he(null),Ae(!1),L(null),me(!1),Ze(!1),Ke(null),Ce.current=!1,Et.current&&(Et.current.abort(),Et.current=null))},[p]),G(()=>{f||ue(ye=>ye&&ye.amount!==i?{...ye,amount:i}:ye)},[i,f]);const it=de(ye=>{ue(ye),pe(null),Ke(null),Ze(!1)},[]),Ut=de(ye=>{ue(Wt=>({asset:ye,amount:Wt?.asset?.address===ye.address&&Wt?.asset?.chainId===ye.chainId&&Wt.amount||(f?"":i)})),pe(null),Ke(null),Ze(!1)},[i,f]),Qt=V||U||S,{isQuoting:bt,quoteError:Se,estimatedOutput:nn,estimatedInput:xn,resolvedSwap:Ot,exactOutputSwap:lt,quoteAmountOut:Vt,resolvedTokenIn:Oe,isDirect:Ft,needsSwap:Ue,selectedIsEquivalent:ft}=tr({direction:h,selectedAsset:N,destinationToken:t,chainId:y,recipient:Qt,paymentAmount:Qe}),He=f?parseFloat(Qe):parseFloat(N?.amount||"")||0,vt=N?.asset?._source==="wallet",Jt=!!N?.asset&&vt&&N.asset.chainId!==y,we=vt&&N?.asset?._fundingWallet==="external",Je=C||we,It=te(()=>N?.asset?W.find(ye=>Fe(ye.address,N.asset.address))?.balanceFormatted??0:0,[N,W]),Lt=vt?N?.asset.balanceFormatted??0:It,ve=te(()=>{if(!N?.asset)return!1;if(f)return X?Yn(X.grossAmount,X.decimals,N.asset.decimals)>N.asset.balance:ft||Ft?He>N.asset.balanceFormatted:lt?parseFloat(ht(lt.amountInMax,N.asset.decimals))>N.asset.balanceFormatted:!1;if(X){const ye=Yn(X.grossAmount,X.decimals,N.asset.decimals);return vt?ye>N.asset.balance:parseFloat(ht(ye,N.asset.decimals))>Lt}return He>Lt},[N,f,X,ft,He,lt,Lt,vt,Ft]),on=de(ye=>{se({building:"signing-delegation","signing-delegation":"signing-delegation","signing-intent":"signing-intent",submitting:"submitting",executing:"executing",success:"success",error:"error"}[ye.step]||"executing"),z(ye.message),ye.txHash&&q(ye.txHash)},[]),ct=te(()=>({currentPaymentAmount:Qe,destinationToken:t,embeddedWalletAddress:V,providerEmbeddedAddress:U,externalWalletAddress:H,address:S,recipient:n,isNon7702:Je,isPayMode:f,resolvedChainId:y,buildActionCalls:o,feeExecutionMode:l,buildSpicenetBatch:s,selectedAsset:N,needsSwap:Ue,resolvedSwap:Ot,exactOutputSwap:lt,quoteAmountOut:Vt,resolvedTokenIn:Oe}),[Qe,t,V,U,H,S,n,Je,f,y,o,l,s,N,Ue,Ot,lt,Vt,Oe]),Tt=de(ye=>qs(ct,ye),[ct]),zt=de(ye=>Ks(ct,ye),[ct]),sn=de((ye,Wt,qe,Kt)=>Ys(ye,Wt,qe,B,Kt),[B]),$t=te(()=>N?.asset?Ue&&Oe?Oe:N.asset.chainId===y?N.asset.address:Oe??En(N.asset,y)??t.address:t.address,[N,t.address,Ue,y,Oe]),$e=te(()=>N?.asset?Fe(N.asset.address,t.address)&&N.asset.chainId===t.chainId:!1,[N,t.address,t.chainId]),cn=Je&&$e,Le=cn&&He>0&&!!N?.asset,At=te(()=>!(!N?.asset||He<=0),[N,He]),Ht=te(()=>!p||D||ke!=="idle"||!At||Le||!N?.asset?null:[f?"pay":"supply",h,N.asset.address.toLowerCase(),N.asset.chainId,N.amount,Qe,t.address.toLowerCase(),t.chainId,y,Oe?.toLowerCase()??"",Ue?"swap":"direct",Ft?"direct-token":"routed-token",Je?"non7702":"7702",$e?"source-dest":"cross-chain",bt?"quoting":"quoted",n?.toLowerCase()??"",lt?.amountIn?.toString()??"",lt?.amountInMax?.toString()??"",lt?.venue??"",Ot?.amountOut?.toString()??"",Vt?.toString()??"",V??"",U??"",S??""].join("|"),[p,D,ke,At,Le,N,f,h,Qe,t,y,Oe,Ue,Ft,Je,$e,bt,n,lt,Ot,Vt,V,U,S]),_e=de(()=>Gs({selectedAsset:N,isPayMode:f,parsedAmount:He,needsSwap:Ue,exactOutputSwap:lt,isNon7702:Je,isSourceDestToken:$e,currentPaymentAmount:Qe,destinationToken:t,feeExecutionMode:l,resolvedTokenIn:Oe,embeddedWalletAddress:V,providerEmbeddedAddress:U,resolvedChainId:y,isConnected:A,address:S,ready:T,authenticated:F,isDirect:Ft,resolvedSwap:Ot,isQuoting:bt,executionTokenAddress:$t,buildPayChainBatches:Tt,buildSupplyChainBatches:zt,estimateGasless:B,estimateRequiredGrossFunding:sn}),[N,f,He,Ue,lt,Je,$e,Qe,t,l,Oe,V,U,sn,Tt,B,y,A,S,T,F,Ft,Ot,bt,zt,$t,n]);G(()=>{Ie.current=_e},[_e]),G(()=>{if(!p){me(!1),Ze(!1),Ke(null),L(null);return}if(D||ke!=="idle"){Q.current+=1,me(!1);return}if(!At){L(null),me(!1),Ze(!1),Ke(null);return}if(Le){L(null),me(!1),Ze(!0),Ke(null);return}if(bt){Q.current+=1,me(!1),Ze(!1);return}if(!Ht)return;let ye=!1;const Wt=async()=>{const Kt=++Q.current;Ke(null),me(!0);try{const Yt=await Ie.current?.();if(ye||Q.current!==Kt)return;Yt?(L(Yt),Ze(!0)):(L(null),Ze(!1)),Ke(null)}catch(Yt){if(ye||Q.current!==Kt)return;const rn=Cn(Yt,"Unable to calculate fees for this action.");L(null),Ze(!1),Ke(rn)}finally{!ye&&Q.current===Kt&&me(!1)}},qe=window.setTimeout(()=>{Wt()},250);return()=>{ye=!0,clearTimeout(qe),me(!1)}},[p,D,ke,At,Le,bt,Ht]),G(()=>{!f&&ke==="success"&&_&&(K(),u?.(_))},[f,ke,_,K,u]),G(()=>{if(!f||ee?.status!=="success"||Ce.current||!S)return;Ce.current=!0;const ye=Te.current;!ye?.asset||ye.asset?._source==="wallet"||K()},[f,ee?.status,S,K]);const dt=le(u),qt=le(m);G(()=>{dt.current=u},[u]),G(()=>{qt.current=m},[m]),G(()=>{f&&(ee?.status==="success"&&dt.current?.(ee.txHash||""),ee?.status==="failed"&&qt.current?.(new Error("Payment execution failed")))},[f,ee?.status]),G(()=>{p&&(K(),O())},[p,K,O]),Me.current={selectedAsset:N,parsedAmount:He,currentPaymentAmount:Qe,isInsufficientBalance:ve,isPayMode:f,isNon7702:Je,isSourceDestToken:$e,needsSwap:Ue,exactOutputSwap:lt,selectedIsEquivalent:ft,resolvedTokenIn:Oe,embeddedWalletAddress:V,providerEmbeddedAddress:U,externalWallet:R,externalWalletAddress:H,address:S,isConnected:A,ready:T,authenticated:F,provider:v,resolvedChainId:y,executionTokenAddress:$t,destinationToken:t,recipient:n,buildActionCalls:o,feeExecutionMode:l,buildSpicenetBatch:s,onError:m,gasless:{estimateGasless:B,executeGasless:E,buildPayChainBatches:Tt,buildSupplyChainBatches:zt,estimateRequiredGrossFunding:sn,onProgress:on},ui:{setError:pe,setStep:se,setStatusMsg:z,setTxHash:q,setIsExecuting:$,setShowStatusPanel:Ae,setPaymentResult:he},refs:{spiceDepositSubmittedRef:Ce,abortControllerRef:Et}};const Bt=de(async()=>{const ye=Me.current;ye&&(ye.isPayMode?await Js(ye):await Zs(ye))},[]),Ve=f&&He===0,ot=f?!!N?.asset&&He>=0&&!ve&&!D&&(Ve||Le||Pe)&&!at&&(Ve||!Ue||!!lt):!!N?.asset&&He>0&&!ve&&!D&&(cn||Pe)&&!at&&(Jt||Ft||!!Ot&&!bt),Dt=de(()=>{K(),O()},[K,O]);return{sources:P,selectedAsset:N,setSelectedAsset:it,selectAsset:Ut,quote:{isQuoting:bt,error:Se,estimatedInput:xn,estimatedOutput:nn,isDirect:Ft,needsSwap:Ue},feePreview:X,isFeePreviewLoading:ie,feePreviewError:at,canSubmit:ot,execute:Bt,isExecuting:D,step:ke,statusMsg:ge,txHash:_,paymentResult:ee,refreshAssets:Dt}}function md(e){return Jo({...e,amountMode:"exact-input"})}function gd(e){return Jo({...e,amountMode:"exact-output"})}function yd(e){return Jo({...e,amountMode:"exact-input"})}const $o=1500,Va="spiceflow-75f053db-70ab-4f37-83cc-abf68cb5b70d",xd={1:{chainId:1,domain:0,network:"mainnet"},42161:{chainId:42161,domain:3,network:"mainnet"},8453:{chainId:8453,domain:6,network:"mainnet"},11155111:{chainId:11155111,domain:0,network:"testnet"},421614:{chainId:421614,domain:3,network:"testnet"},84532:{chainId:84532,domain:6,network:"testnet"}};function qa(e,t,n){return(e*t+n-1n)/n}function Ka(e,t=$o){return qa(e,BigInt(1e4+t),10000n)}function Ya(e,t){return`evm:${e}:${We(t).toLowerCase()}`}function Ga(e){return xd[e]??null}function bd(e){return e==="testnet"?"https://iris-api-sandbox.circle.com":"https://iris-api.circle.com"}function wd(e){const t=typeof e=="number"?e.toString():typeof e=="string"?e:"0",[n,o=""]=t.trim().split("."),s=BigInt(n||"0"),r=BigInt((o+"00").slice(0,2)||"0");return s*100n+r}function Cd(e,t){const n=wd(t);return qa(e,n,1000000n)}async function kd(e){const t=e.transferMode??"fast",n=Ga(e.sourceChainId),o=Ga(e.destinationChainId);if(!n||!o||n.network!==o.network)throw new Error(`Unsupported CCTP route ${e.sourceChainId} -> ${e.destinationChainId}`);let s=0n;const r=t==="fast"?1e3:2e3;if(t==="fast"){const c=e.fetchImpl??fetch,d=`${bd(n.network)}/v2/burn/USDC/fees/${n.domain}/${o.domain}`,l=await c(d);if(!l.ok)throw new Error(`CCTP fee quote failed: ${l.status} ${l.statusText}`);const p=await l.json(),u=Array.isArray(p)?p:Array.isArray(p?.data)?p.data:[],m=u.find(h=>String(h.finalityThreshold??h.finalityThresholdExecuted??"")==="1000")??u[0];s=Cd(e.amountIn,m?.minimumFee??0)}const i=Ka(s,e.bufferBps);return{provider:"cctp",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:We(e.tokenIn),tokenOut:We(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:e.amountIn>s?e.amountIn-s:0n,quotedBridgeFee:s,bufferedBridgeFee:i,bufferBps:e.bufferBps??$o,minFinalityThreshold:r,metadata:{sourceDomain:n.domain,destinationDomain:o.domain,transferMode:t}}}function _o(e){return typeof e=="string"&&e.length>0?e:void 0}function es(e){return typeof e=="bigint"?e:typeof e=="number"&&Number.isFinite(e)?BigInt(Math.trunc(e)):typeof e=="string"&&/^\d+$/.test(e)?BigInt(e):null}function vd(e){const t=e.estimate;return es(t?.toAmountMin)??es(t?.toAmount)??es(e.toAmountMin)??es(e.toAmount)}async function Id(e){const t=e.integratorId??Va,n=e.fetchImpl??fetch,o=e.baseUrl??"https://v2.api.squidrouter.com",s=await n(`${o}/v2/route`,{method:"POST",headers:{"Content-Type":"application/json","x-integrator-id":t},body:JSON.stringify({fromAddress:We(e.fromAddress),fromChain:String(e.sourceChainId),fromToken:We(e.tokenIn),fromAmount:e.amountIn.toString(),toAddress:We(e.toAddress),toChain:String(e.destinationChainId),toToken:We(e.tokenOut),slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0})}),r=await s.json().catch(()=>null);if(!s.ok){const l=typeof r?.message=="string"?r.message:`${s.status} ${s.statusText}`;throw new Error(`Squid route quote failed: ${l}`)}const i=r?.route;if(!i)throw new Error("Squid route quote response did not include route");const c=vd(i);if(c===null)throw new Error("Squid route quote response did not include output amount");const d=e.amountIn>c?e.amountIn-c:0n;return{provider:"squid",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:We(e.tokenIn),tokenOut:We(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:c,quotedBridgeFee:d,bufferedBridgeFee:Ka(d,e.bufferBps),bufferBps:e.bufferBps??$o,..._o(i.quoteId)?{quoteId:_o(i.quoteId)}:{},..._o(s.headers.get("x-request-id"))?{route:_o(s.headers.get("x-request-id"))}:{},metadata:{requestId:s.headers.get("x-request-id")??void 0,slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0}}}function Ad(e){return{type:"rebalancing",version:1,reason:e.reason??"spiceflow-intent",bridge:{provider:e.bridgeQuote.provider,quoteId:e.bridgeQuote.quoteId,route:e.bridgeQuote.route,sourceChainId:e.bridgeQuote.sourceChainId,destinationChainId:e.bridgeQuote.destinationChainId,tokenIn:e.bridgeQuote.tokenIn,tokenOut:e.bridgeQuote.tokenOut,amountIn:e.bridgeQuote.amountIn.toString(),estimatedAmountOut:e.bridgeQuote.estimatedAmountOut.toString(),quotedBridgeFee:e.bridgeQuote.quotedBridgeFee.toString(),bufferedBridgeFee:e.bridgeQuote.bufferedBridgeFee.toString(),bufferBps:e.bridgeQuote.bufferBps,minFinalityThreshold:e.bridgeQuote.minFinalityThreshold,...e.bridgeQuote.metadata},sourceAsset:e.sourceAsset?{chainId:e.sourceAsset.chainId,token:e.sourceAsset.address,symbol:e.sourceAsset.symbol,decimals:e.sourceAsset.decimals}:void 0,...e.extra}}function Sd(e){return`0x72${bo(wo([{type:"address"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"}],[We(e.recipient),BigInt(e.fromChainId),We(e.fromToken),e.fromAmount,BigInt(e.toChainId),We(e.toToken),e.toAmountMin,e.salt??BigInt(Date.now())])).slice(4)}`}function Ed(e){const t=BigInt(Math.floor(Date.now()/1e3)),n=e.exp??t+3600n,o=e.nbf??0n,s=e.idempotenceKey??Sd({recipient:e.recipient,fromChainId:e.fromChainId,fromToken:e.fromToken,fromAmount:e.fromAmount,toChainId:e.toChainId,toToken:e.toToken,toAmountMin:e.toAmountMin});return{chainId:e.spicenetChainId,tokenTransfers:[],calls:[{to:"0x0000000000000000000000000000000000000000",value:0n,data:kt({abi:as,functionName:"createRebalancingRequest",args:[{idempotenceKey:s,nbf:o,exp:n,metadata:JSON.stringify(e.metadata??{}),recipient:We(e.recipient).toLowerCase(),fromChainToken:Ya(e.fromChainId,e.fromToken),fromChainTokenAmount:e.fromAmount,toChainToken:Ya(e.toChainId,e.toToken),toChainTokenAmountMin:e.toAmountMin}]})}]}}function Mo(e){try{return yi(e)}catch{throw new Ne("ROUTE_TOKEN_NOT_FOUND",`Token "${e[0]}" not found on chain ${e[1]} in the token registry.`,{symbol:e[0],chainId:e[1]})}}function Fd(e,t){if(e[0].toUpperCase()===t[0].toUpperCase()&&e[1]===t[1])return!0;let n,o;try{n=Mo(e),o=Mo(t)}catch{return!1}const s=new Set(pr(o.address).map(r=>r.toLowerCase()));return s.add(o.address.toLowerCase()),s.has(n.address.toLowerCase())}function Bd(){const e=[];for(const t of Object.keys(xi).map(Number))for(const n of ur(t))e.push([n.symbol,t]);return e}async function Td(e){const{action:t,inputToken:n,inputAmount:o,registry:s,userAddress:r,slippage:i,intermediaryCandidates:c}=e;if(t.calls.length===0)throw new Ne("INVALID_PARAMS","buildIntent: action.calls must not be empty.",{action:t});if(o<=0n)throw new Ne("INVALID_PARAMS","buildIntent: inputAmount must be greater than zero.",{inputAmount:o.toString()});const d=t.supportedInputTokens??Bd();if(!d.some(b=>Fd(n,b))){const b=d.map(([C,w])=>`${C} (chain ${w})`).join(", ");throw new Ne("ROUTE_UNSUPPORTED_INPUT",`Input token "${n[0]}" on chain ${n[1]} is not in the action's supported input tokens. Supported: ${b}.`,{inputToken:{symbol:n[0],chainId:n[1]},supportedInputTokens:d})}const l=Mo(n),p=Mo(t.outputToken),u=ca({sourceAsset:l,outputAsset:p,sourceChainId:l.chainId,destinationChainId:t.chainId,intermediaryCandidates:c}),{chainBatches:m,solverFrontToken:h,solverFrontAmount:f,resolvedSwaps:y}=await da({route:u,sourceAmount:o,userAddress:r,registry:s,actionCalls:t.calls,slippage:i});return{chainBatches:m,route:u,resolvedSwaps:y,resolvedInputToken:l,resolvedOutputToken:p,solverFrontToken:h,solverFrontAmount:f}}const Md=[0n,1n,30n],Rd=new Set(["ABORT","CONCURRENT_EXECUTION","WALLET_DISCONNECTED","WALLET_REJECTED","NO_VENUE_FOR_CHAIN"]);function Za(e,t){return t===0n?e:e*(1000n-t)/1000n}async function Dd(e,t){const{chainId:n,swapCalls:o,quoteAmountOut:s,buildActionCalls:r,tokenAddress:i,tokenTransferAmount:c,onProgress:d,signal:l,options:p,buffers:u=Md}=t;for(let m=0;m<u.length;m++){const h=u[m],f=Za(s,h),y=r(f),b=[{chainId:n,calls:[...o,...y]}];try{return await e(b,i,c,d,l,p)}catch(C){const w=typeof C?.message=="string"?C.message:String(C?.message??"");if(lr(C)&&Rd.has(C.code)||C.name==="AbortError"||l?.aborted||w.includes("User rejected")||w.includes("User denied")||C.code===4001||m>=u.length-1)throw C;const k=Number(u[m+1])/10;console.warn(`[SwapThenAction] Action attempt ${m+1} failed (buffer ${Number(h)/10}%), retrying with ${k}% buffer...`,C.message),d?.({step:"signing-delegation",message:`Adjusting action amount, retrying (${k}% buffer)...`})}}throw new Ne("ALL_ATTEMPTS_FAILED","All action attempts failed after exhausting buffer progression.",{attempts:u.length,chainId:n})}Ei();export{dd as AccountDisplay,Is as AddFundsLink,Br as CheckIcon,Un as ChevronIcon,io as CloseIcon,$o as DEFAULT_BRIDGE_FEE_BUFFER_BPS,Va as DEFAULT_SQUID_INTEGRATOR_ID,co as DetailRow,td as ExportWalletButton,tu as NATIVE_TOKEN_ADDRESS,Fs as ProviderLogin,er as SATSUMA_CITREA_CONFIG,nu as SPICENET_NATIVE_CHAIN_ID,ou as SPICE_COMBINED_FEE_RECIPIENT,su as SPICE_GAS_FEE_RECIPIENT,ru as SPICE_PLATFORM_FEE_RECIPIENT,au as SPICE_SOLVER_ADDRESS,ud as SdkErrorBoundary,us as SearchInput,Sl as SelectChainModal,xc as SpiceBalance,Pr as SpiceDeposit,Zd as SpiceFlowProvider,Xt as SpiceFlowProviderContext,ga as SpiceLock,ga as SpiceLockModal,ed as SpicePay,Oa as SpiceSupply,ua as SpiceWithdraw,Ne as SpiceflowError,On as Spinner,lo as StatusBanner,Da as UNIV3_BASE_CONFIG,Za as applyBuffer,iu as applySlippage,So as areEquivalentOnChains,Xd as buildDarkPalette,Td as buildIntent,Jd as buildLightPalette,qs as buildPayChainBatches,Ed as buildRebalancingBatch,Ad as buildRebalancingMetadata,da as buildRoutedBatches,Ks as buildSupplyChainBatches,lu as buildUniV3SwapCalls,Ma as create1inchVenue,Pa as createLiquidityRegistry,Na as createSatsumaVenue,mn as duration,tn as easing,Gs as estimateFeePreview,Ys as estimateRequiredGrossFunding,ya as estimateSupplyMaxAmount,Xs as executeDirectExternalAction,ka as executeNon7702Supply,Js as executePay,Zs as executeSupply,Dd as executeSwapThenAction,zn as findEquivalentOnChain,Ls as findTokenOnChain,gr as font,jo as getAssetChainTokenCandidates,Fa as getBestUniV3Quote,Re as getChainConfig,cu as getChainIdsByNetwork,hn as getChainName,du as getEscrowContractAddress,Ea as getUniV3Quote,uu as isNativeToken,lr as isSpiceflowError,pu as isSpicenetChainId,Sa as isSupportedSupplyAsset,Ba as isSwapIntent,fu as normalizeNativeTokenAddress,kd as quoteCctpFee,Id as quoteSquidFee,ds as radius,yt as relayerService,En as resolveAssetTokenAddressOnChain,qr as resolveFundedToken,_c as resolveInputSupplySwapQuote,ca as resolveRoute,$d as resolveTheme,Mo as resolveTokenRef,hu as spicenetAbi,mu as spicenetWithdrawalAbi,Kn as stripSpicenetFundingBatches,gn as transition,pd as useAssetInput,In as useEmbeddedWalletAddress,Bo as useGaslessExecution,_d as useIsUserWhitelisted,fd as useLockDuration,gd as usePay,yd as useRepay,hd as useSmartWallet,Jo as useSpiceAction,Eo as useSpiceAssets,wt as useSpiceBrand,Bo as useSpiceExecution,Ha as useSpicePendingDeposits,md as useSupply,$s as useSupplyAssets,tr as useSupplyQuote,vn as useWallet,_n as z};
108
+ `})]}),document.body):null;return g(fn,{children:[Ce,Et,S&&mr.createPortal(a(Nr,{isOpen:!0,onClose:q,supportedChains:[S.chainId],escrowOnly:!0,escrowTokenAddress:S.tokenAddress,escrowAmount:S.amount,escrowTokenDecimals:S.tokenDecimals,escrowTokenSymbol:S.tokenSymbol,styles:c,onDepositSuccess:ee}),document.body)]})},Qa=class or extends wn.Component{constructor(t){super(t),this.handleRetry=()=>{this.state.retryCount>=or.MAX_RETRIES||this.setState(n=>({hasError:!1,error:null,retryCount:n.retryCount+1}))},this.state={hasError:!1,error:null,retryCount:0}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error(`[SdkErrorBoundary] ${this.props.componentName||"SDK component"} failed:`,{message:t.message,componentStack:n.componentStack})}render(){if(this.state.hasError){if(this.props.fallback)return this.props.fallback;const t={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px",borderRadius:"8px",border:"1px solid rgba(239, 68, 68, 0.2)",backgroundColor:this.props.dark?"rgba(239, 68, 68, 0.08)":"rgba(239, 68, 68, 0.05)",gap:"12px"},n={fontSize:"14px",color:"#f87171",margin:0},o={fontSize:"12px",color:"#888",maxWidth:"280px",textAlign:"center",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical",margin:0},s={padding:"8px 16px",fontSize:"12px",borderRadius:"6px",backgroundColor:this.props.dark?"#2a2a2a":"#f3f4f6",color:this.props.dark?"#888":"#374151",border:this.props.dark?"1px solid #3a3a3a":"1px solid #d1d5db",cursor:"pointer",transition:"background-color 150ms ease"},r={fontSize:"12px",color:"#888",margin:0},i=or.MAX_RETRIES-this.state.retryCount;return g("div",{style:t,children:[g("p",{style:n,children:[this.props.componentName||"Component"," failed to load"]}),this.state.error&&a("p",{style:o,children:this.state.error.message}),i>0?g("button",{onClick:this.handleRetry,style:s,onMouseEnter:c=>{c.target.style.backgroundColor=this.props.dark?"#333":"#e5e7eb"},onMouseLeave:c=>{c.target.style.backgroundColor=this.props.dark?"#2a2a2a":"#f3f4f6"},children:["Try again (",i," left)"]}):a("p",{style:r,children:"Please refresh the page to try again"})]})}return this.props.children}};Qa.MAX_RETRIES=3;let ud=Qa;const pd=()=>{const[e,t]=M("0"),[n,o]=M(null);return{assetAmount:e,setAssetAmount:t,selectedAsset:n,setSelectedAsset:o}};function fd(e,t=0){const[n,o]=M(t),s=e[n]??e[0],r=te(()=>s?BigInt(Math.round(s.months*30*24*3600)):0n,[s?.months]);return{selectedDurationIdx:n,setSelectedDurationIdx:o,selectedDuration:s,durationSeconds:r}}function hd(){const{actions:e,isReady:t,isAuthenticated:n}=vn(),o=In(),s=le(!1),r=le(0),i=le(null),c=le(e),[d,l]=M(0);c.current=e,G(()=>{s.current=!1,r.current=0,i.current&&(clearTimeout(i.current),i.current=null)},[o]),G(()=>{if(!o||!t||!n||s.current)return;s.current=!0;let p=!1;return(async()=>{await new Promise(u=>setTimeout(u,2e3));try{await si(o,c.current.signMessage),r.current=0}catch(u){console.warn("[SmartWallet] Registration failed:",u),s.current=!1,!p&&r.current<3&&(r.current+=1,i.current=setTimeout(()=>{l(m=>m+1)},5e3))}})(),()=>{p=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[o,t,n,d])}function Jo(e){const{destinationToken:t,recipient:n,buildActionCalls:o,buildSpicenetBatch:s,amountMode:r,amount:i,sourceChains:c,supportedSourceAssets:d,feeExecutionMode:l="user-transfer",enabled:p=!0,onSuccess:u,onError:m}=e,h=r==="exact-output"?"output":"input",f=h==="output",y=t.chainId,b=an(Xt),C=(b?.mode||"7702")!=="7702",w=!!b?.isWhitelistGateActive,k=te(()=>c??b?.supportedChainIds??[],[c,b?.supportedChainIds]),I=te(()=>w?[]:d,[w,d]),x=vn(),{address:S,isConnected:A,isReady:T,isAuthenticated:F,provider:v}=x,{executeGasless:E,estimateGasless:B}=Bo(),{externalWallet:R,externalAddress:H,embeddedAddress:U}=$n(),j=In()||U,{displayAssets:Z,filteredSpiceAssets:W,embeddedWalletAddress:V,refreshSpiceAssets:K,refreshWalletAssets:O}=$s({destinationToken:t,supportedSourceAssets:I,sourceChains:k,enabled:p&&(C?!!H:!!j)}),P=Z,[N,ue]=M(null),[D,$]=M(!1),[ce,pe]=M(null),[ke,se]=M("idle"),[ge,z]=M(""),[_,q]=M(null),[ee,he]=M(null),[,Ae]=M(!1),[X,L]=M(null),[ie,me]=M(!1),[Pe,Ze]=M(!1),[at,Ke]=M(null),Te=le(N),Ce=le(!1),Et=le(null),Q=le(0),Ie=le(null),Me=le(null);G(()=>{Te.current=N},[N]);const Qe=f?i||"0":N?.amount||"0";G(()=>{p||(ue(null),pe(null),$(!1),se("idle"),z(""),q(null),he(null),Ae(!1),L(null),me(!1),Ze(!1),Ke(null),Ce.current=!1,Et.current&&(Et.current.abort(),Et.current=null))},[p]),G(()=>{f||ue(ye=>ye&&ye.amount!==i?{...ye,amount:i}:ye)},[i,f]);const it=de(ye=>{ue(ye),pe(null),Ke(null),Ze(!1)},[]),Ut=de(ye=>{ue(Wt=>({asset:ye,amount:Wt?.asset?.address===ye.address&&Wt?.asset?.chainId===ye.chainId&&Wt.amount||(f?"":i)})),pe(null),Ke(null),Ze(!1)},[i,f]),Qt=V||U||S,{isQuoting:bt,quoteError:Se,estimatedOutput:nn,estimatedInput:xn,resolvedSwap:Ot,exactOutputSwap:lt,quoteAmountOut:Vt,resolvedTokenIn:Oe,isDirect:Ft,needsSwap:Ue,selectedIsEquivalent:ft}=tr({direction:h,selectedAsset:N,destinationToken:t,chainId:y,recipient:Qt,paymentAmount:Qe}),He=f?parseFloat(Qe):parseFloat(N?.amount||"")||0,vt=N?.asset?._source==="wallet",Jt=!!N?.asset&&vt&&N.asset.chainId!==y,we=vt&&N?.asset?._fundingWallet==="external",Je=N?.asset?._source!=="spice"&&(C||we),It=te(()=>N?.asset?W.find(ye=>Fe(ye.address,N.asset.address))?.balanceFormatted??0:0,[N,W]),Lt=vt?N?.asset.balanceFormatted??0:It||(N?.asset.balanceFormatted??0),ve=te(()=>{if(!N?.asset)return!1;if(f)return X?Yn(X.grossAmount,X.decimals,N.asset.decimals)>N.asset.balance:ft||Ft?He>N.asset.balanceFormatted:lt?parseFloat(ht(lt.amountInMax,N.asset.decimals))>N.asset.balanceFormatted:!1;if(X){const ye=Yn(X.grossAmount,X.decimals,N.asset.decimals);return vt?ye>N.asset.balance:parseFloat(ht(ye,N.asset.decimals))>Lt}return He>Lt},[N,f,X,ft,He,lt,Lt,vt,Ft]),on=de(ye=>{se({building:"signing-delegation","signing-delegation":"signing-delegation","signing-intent":"signing-intent",submitting:"submitting",executing:"executing",success:"success",error:"error"}[ye.step]||"executing"),z(ye.message),ye.txHash&&q(ye.txHash)},[]),ct=te(()=>({currentPaymentAmount:Qe,destinationToken:t,embeddedWalletAddress:V,providerEmbeddedAddress:U,externalWalletAddress:H,address:S,recipient:n,isNon7702:Je,isPayMode:f,resolvedChainId:y,buildActionCalls:o,feeExecutionMode:l,buildSpicenetBatch:s,selectedAsset:N,needsSwap:Ue,resolvedSwap:Ot,exactOutputSwap:lt,quoteAmountOut:Vt,resolvedTokenIn:Oe}),[Qe,t,V,U,H,S,n,Je,f,y,o,l,s,N,Ue,Ot,lt,Vt,Oe]),Tt=de(ye=>qs(ct,ye),[ct]),zt=de(ye=>Ks(ct,ye),[ct]),sn=de((ye,Wt,qe,Kt)=>Ys(ye,Wt,qe,B,Kt),[B]),$t=te(()=>N?.asset?Ue&&Oe?Oe:N.asset.chainId===y?N.asset.address:Oe??En(N.asset,y)??t.address:t.address,[N,t.address,Ue,y,Oe]),$e=te(()=>N?.asset?Fe(N.asset.address,t.address)&&N.asset.chainId===t.chainId:!1,[N,t.address,t.chainId]),cn=Je&&$e,Le=cn&&He>0&&!!N?.asset,At=te(()=>!(!N?.asset||He<=0),[N,He]),Ht=te(()=>!p||D||ke!=="idle"||!At||Le||!N?.asset?null:[f?"pay":"supply",h,N.asset.address.toLowerCase(),N.asset.chainId,N.amount,Qe,t.address.toLowerCase(),t.chainId,y,Oe?.toLowerCase()??"",Ue?"swap":"direct",Ft?"direct-token":"routed-token",Je?"non7702":"7702",$e?"source-dest":"cross-chain",bt?"quoting":"quoted",n?.toLowerCase()??"",lt?.amountIn?.toString()??"",lt?.amountInMax?.toString()??"",lt?.venue??"",Ot?.amountOut?.toString()??"",Vt?.toString()??"",V??"",U??"",S??""].join("|"),[p,D,ke,At,Le,N,f,h,Qe,t,y,Oe,Ue,Ft,Je,$e,bt,n,lt,Ot,Vt,V,U,S]),_e=de(()=>Gs({selectedAsset:N,isPayMode:f,parsedAmount:He,needsSwap:Ue,exactOutputSwap:lt,isNon7702:Je,isSourceDestToken:$e,currentPaymentAmount:Qe,destinationToken:t,feeExecutionMode:l,resolvedTokenIn:Oe,embeddedWalletAddress:V,providerEmbeddedAddress:U,resolvedChainId:y,isConnected:A,address:S,ready:T,authenticated:F,isDirect:Ft,resolvedSwap:Ot,isQuoting:bt,executionTokenAddress:$t,buildPayChainBatches:Tt,buildSupplyChainBatches:zt,estimateGasless:B,estimateRequiredGrossFunding:sn}),[N,f,He,Ue,lt,Je,$e,Qe,t,l,Oe,V,U,sn,Tt,B,y,A,S,T,F,Ft,Ot,bt,zt,$t,n]);G(()=>{Ie.current=_e},[_e]),G(()=>{if(!p){me(!1),Ze(!1),Ke(null),L(null);return}if(D||ke!=="idle"){Q.current+=1,me(!1);return}if(!At){L(null),me(!1),Ze(!1),Ke(null);return}if(Le){L(null),me(!1),Ze(!0),Ke(null);return}if(bt){Q.current+=1,me(!1),Ze(!1);return}if(!Ht)return;let ye=!1;const Wt=async()=>{const Kt=++Q.current;Ke(null),me(!0);try{const Yt=await Ie.current?.();if(ye||Q.current!==Kt)return;Yt?(L(Yt),Ze(!0)):(L(null),Ze(!1)),Ke(null)}catch(Yt){if(ye||Q.current!==Kt)return;const rn=Cn(Yt,"Unable to calculate fees for this action.");L(null),Ze(!1),Ke(rn)}finally{!ye&&Q.current===Kt&&me(!1)}},qe=window.setTimeout(()=>{Wt()},250);return()=>{ye=!0,clearTimeout(qe),me(!1)}},[p,D,ke,At,Le,bt,Ht]),G(()=>{!f&&ke==="success"&&_&&(K(),u?.(_))},[f,ke,_,K,u]),G(()=>{if(!f||ee?.status!=="success"||Ce.current||!S)return;Ce.current=!0;const ye=Te.current;!ye?.asset||ye.asset?._source==="wallet"||K()},[f,ee?.status,S,K]);const dt=le(u),qt=le(m);G(()=>{dt.current=u},[u]),G(()=>{qt.current=m},[m]),G(()=>{f&&(ee?.status==="success"&&dt.current?.(ee.txHash||""),ee?.status==="failed"&&qt.current?.(new Error("Payment execution failed")))},[f,ee?.status]),G(()=>{p&&(K(),O())},[p,K,O]),Me.current={selectedAsset:N,parsedAmount:He,currentPaymentAmount:Qe,isInsufficientBalance:ve,isPayMode:f,isNon7702:Je,isSourceDestToken:$e,needsSwap:Ue,exactOutputSwap:lt,selectedIsEquivalent:ft,resolvedTokenIn:Oe,embeddedWalletAddress:V,providerEmbeddedAddress:U,externalWallet:R,externalWalletAddress:H,address:S,isConnected:A,ready:T,authenticated:F,provider:v,resolvedChainId:y,executionTokenAddress:$t,destinationToken:t,recipient:n,buildActionCalls:o,feeExecutionMode:l,buildSpicenetBatch:s,onError:m,gasless:{estimateGasless:B,executeGasless:E,buildPayChainBatches:Tt,buildSupplyChainBatches:zt,estimateRequiredGrossFunding:sn,onProgress:on},ui:{setError:pe,setStep:se,setStatusMsg:z,setTxHash:q,setIsExecuting:$,setShowStatusPanel:Ae,setPaymentResult:he},refs:{spiceDepositSubmittedRef:Ce,abortControllerRef:Et}};const Bt=de(async()=>{const ye=Me.current;ye&&(ye.isPayMode?await Js(ye):await Zs(ye))},[]),Ve=f&&He===0,ot=f?!!N?.asset&&He>=0&&!ve&&!D&&(Ve||Le||Pe)&&!at&&(Ve||!Ue||!!lt):!!N?.asset&&He>0&&!ve&&!D&&(cn||Pe)&&!at&&(Jt||Ft||!!Ot&&!bt),Dt=de(()=>{K(),O()},[K,O]);return{sources:P,selectedAsset:N,setSelectedAsset:it,selectAsset:Ut,quote:{isQuoting:bt,error:Se,estimatedInput:xn,estimatedOutput:nn,isDirect:Ft,needsSwap:Ue},feePreview:X,isFeePreviewLoading:ie,feePreviewError:at,canSubmit:ot,execute:Bt,isExecuting:D,step:ke,statusMsg:ge,txHash:_,paymentResult:ee,refreshAssets:Dt}}function md(e){return Jo({...e,amountMode:"exact-input"})}function gd(e){return Jo({...e,amountMode:"exact-output"})}function yd(e){return Jo({...e,amountMode:"exact-input"})}const $o=1500,Va="spiceflow-75f053db-70ab-4f37-83cc-abf68cb5b70d",xd={1:{chainId:1,domain:0,network:"mainnet"},42161:{chainId:42161,domain:3,network:"mainnet"},8453:{chainId:8453,domain:6,network:"mainnet"},11155111:{chainId:11155111,domain:0,network:"testnet"},421614:{chainId:421614,domain:3,network:"testnet"},84532:{chainId:84532,domain:6,network:"testnet"}};function qa(e,t,n){return(e*t+n-1n)/n}function Ka(e,t=$o){return qa(e,BigInt(1e4+t),10000n)}function Ya(e,t){return`evm:${e}:${We(t).toLowerCase()}`}function Ga(e){return xd[e]??null}function bd(e){return e==="testnet"?"https://iris-api-sandbox.circle.com":"https://iris-api.circle.com"}function wd(e){const t=typeof e=="number"?e.toString():typeof e=="string"?e:"0",[n,o=""]=t.trim().split("."),s=BigInt(n||"0"),r=BigInt((o+"00").slice(0,2)||"0");return s*100n+r}function Cd(e,t){const n=wd(t);return qa(e,n,1000000n)}async function kd(e){const t=e.transferMode??"fast",n=Ga(e.sourceChainId),o=Ga(e.destinationChainId);if(!n||!o||n.network!==o.network)throw new Error(`Unsupported CCTP route ${e.sourceChainId} -> ${e.destinationChainId}`);let s=0n;const r=t==="fast"?1e3:2e3;if(t==="fast"){const c=e.fetchImpl??fetch,d=`${bd(n.network)}/v2/burn/USDC/fees/${n.domain}/${o.domain}`,l=await c(d);if(!l.ok)throw new Error(`CCTP fee quote failed: ${l.status} ${l.statusText}`);const p=await l.json(),u=Array.isArray(p)?p:Array.isArray(p?.data)?p.data:[],m=u.find(h=>String(h.finalityThreshold??h.finalityThresholdExecuted??"")==="1000")??u[0];s=Cd(e.amountIn,m?.minimumFee??0)}const i=Ka(s,e.bufferBps);return{provider:"cctp",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:We(e.tokenIn),tokenOut:We(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:e.amountIn>s?e.amountIn-s:0n,quotedBridgeFee:s,bufferedBridgeFee:i,bufferBps:e.bufferBps??$o,minFinalityThreshold:r,metadata:{sourceDomain:n.domain,destinationDomain:o.domain,transferMode:t}}}function _o(e){return typeof e=="string"&&e.length>0?e:void 0}function es(e){return typeof e=="bigint"?e:typeof e=="number"&&Number.isFinite(e)?BigInt(Math.trunc(e)):typeof e=="string"&&/^\d+$/.test(e)?BigInt(e):null}function vd(e){const t=e.estimate;return es(t?.toAmountMin)??es(t?.toAmount)??es(e.toAmountMin)??es(e.toAmount)}async function Id(e){const t=e.integratorId??Va,n=e.fetchImpl??fetch,o=e.baseUrl??"https://v2.api.squidrouter.com",s=await n(`${o}/v2/route`,{method:"POST",headers:{"Content-Type":"application/json","x-integrator-id":t},body:JSON.stringify({fromAddress:We(e.fromAddress),fromChain:String(e.sourceChainId),fromToken:We(e.tokenIn),fromAmount:e.amountIn.toString(),toAddress:We(e.toAddress),toChain:String(e.destinationChainId),toToken:We(e.tokenOut),slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0})}),r=await s.json().catch(()=>null);if(!s.ok){const l=typeof r?.message=="string"?r.message:`${s.status} ${s.statusText}`;throw new Error(`Squid route quote failed: ${l}`)}const i=r?.route;if(!i)throw new Error("Squid route quote response did not include route");const c=vd(i);if(c===null)throw new Error("Squid route quote response did not include output amount");const d=e.amountIn>c?e.amountIn-c:0n;return{provider:"squid",sourceChainId:e.sourceChainId,destinationChainId:e.destinationChainId,tokenIn:We(e.tokenIn),tokenOut:We(e.tokenOut),amountIn:e.amountIn,estimatedAmountOut:c,quotedBridgeFee:d,bufferedBridgeFee:Ka(d,e.bufferBps),bufferBps:e.bufferBps??$o,..._o(i.quoteId)?{quoteId:_o(i.quoteId)}:{},..._o(s.headers.get("x-request-id"))?{route:_o(s.headers.get("x-request-id"))}:{},metadata:{requestId:s.headers.get("x-request-id")??void 0,slippage:e.slippage??1,quoteOnly:e.quoteOnly??!0}}}function Ad(e){return{type:"rebalancing",version:1,reason:e.reason??"spiceflow-intent",bridge:{provider:e.bridgeQuote.provider,quoteId:e.bridgeQuote.quoteId,route:e.bridgeQuote.route,sourceChainId:e.bridgeQuote.sourceChainId,destinationChainId:e.bridgeQuote.destinationChainId,tokenIn:e.bridgeQuote.tokenIn,tokenOut:e.bridgeQuote.tokenOut,amountIn:e.bridgeQuote.amountIn.toString(),estimatedAmountOut:e.bridgeQuote.estimatedAmountOut.toString(),quotedBridgeFee:e.bridgeQuote.quotedBridgeFee.toString(),bufferedBridgeFee:e.bridgeQuote.bufferedBridgeFee.toString(),bufferBps:e.bridgeQuote.bufferBps,minFinalityThreshold:e.bridgeQuote.minFinalityThreshold,...e.bridgeQuote.metadata},sourceAsset:e.sourceAsset?{chainId:e.sourceAsset.chainId,token:e.sourceAsset.address,symbol:e.sourceAsset.symbol,decimals:e.sourceAsset.decimals}:void 0,...e.extra}}function Sd(e){return`0x72${bo(wo([{type:"address"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"},{type:"address"},{type:"uint256"},{type:"uint256"}],[We(e.recipient),BigInt(e.fromChainId),We(e.fromToken),e.fromAmount,BigInt(e.toChainId),We(e.toToken),e.toAmountMin,e.salt??BigInt(Date.now())])).slice(4)}`}function Ed(e){const t=BigInt(Math.floor(Date.now()/1e3)),n=e.exp??t+3600n,o=e.nbf??0n,s=e.idempotenceKey??Sd({recipient:e.recipient,fromChainId:e.fromChainId,fromToken:e.fromToken,fromAmount:e.fromAmount,toChainId:e.toChainId,toToken:e.toToken,toAmountMin:e.toAmountMin});return{chainId:e.spicenetChainId,tokenTransfers:[],calls:[{to:"0x0000000000000000000000000000000000000000",value:0n,data:kt({abi:as,functionName:"createRebalancingRequest",args:[{idempotenceKey:s,nbf:o,exp:n,metadata:JSON.stringify(e.metadata??{}),recipient:We(e.recipient).toLowerCase(),fromChainToken:Ya(e.fromChainId,e.fromToken),fromChainTokenAmount:e.fromAmount,toChainToken:Ya(e.toChainId,e.toToken),toChainTokenAmountMin:e.toAmountMin}]})}]}}function Mo(e){try{return yi(e)}catch{throw new Ne("ROUTE_TOKEN_NOT_FOUND",`Token "${e[0]}" not found on chain ${e[1]} in the token registry.`,{symbol:e[0],chainId:e[1]})}}function Fd(e,t){if(e[0].toUpperCase()===t[0].toUpperCase()&&e[1]===t[1])return!0;let n,o;try{n=Mo(e),o=Mo(t)}catch{return!1}const s=new Set(pr(o.address).map(r=>r.toLowerCase()));return s.add(o.address.toLowerCase()),s.has(n.address.toLowerCase())}function Bd(){const e=[];for(const t of Object.keys(xi).map(Number))for(const n of ur(t))e.push([n.symbol,t]);return e}async function Td(e){const{action:t,inputToken:n,inputAmount:o,registry:s,userAddress:r,slippage:i,intermediaryCandidates:c}=e;if(t.calls.length===0)throw new Ne("INVALID_PARAMS","buildIntent: action.calls must not be empty.",{action:t});if(o<=0n)throw new Ne("INVALID_PARAMS","buildIntent: inputAmount must be greater than zero.",{inputAmount:o.toString()});const d=t.supportedInputTokens??Bd();if(!d.some(b=>Fd(n,b))){const b=d.map(([C,w])=>`${C} (chain ${w})`).join(", ");throw new Ne("ROUTE_UNSUPPORTED_INPUT",`Input token "${n[0]}" on chain ${n[1]} is not in the action's supported input tokens. Supported: ${b}.`,{inputToken:{symbol:n[0],chainId:n[1]},supportedInputTokens:d})}const l=Mo(n),p=Mo(t.outputToken),u=ca({sourceAsset:l,outputAsset:p,sourceChainId:l.chainId,destinationChainId:t.chainId,intermediaryCandidates:c}),{chainBatches:m,solverFrontToken:h,solverFrontAmount:f,resolvedSwaps:y}=await da({route:u,sourceAmount:o,userAddress:r,registry:s,actionCalls:t.calls,slippage:i});return{chainBatches:m,route:u,resolvedSwaps:y,resolvedInputToken:l,resolvedOutputToken:p,solverFrontToken:h,solverFrontAmount:f}}const Md=[0n,1n,30n],Rd=new Set(["ABORT","CONCURRENT_EXECUTION","WALLET_DISCONNECTED","WALLET_REJECTED","NO_VENUE_FOR_CHAIN"]);function Za(e,t){return t===0n?e:e*(1000n-t)/1000n}async function Dd(e,t){const{chainId:n,swapCalls:o,quoteAmountOut:s,buildActionCalls:r,tokenAddress:i,tokenTransferAmount:c,onProgress:d,signal:l,options:p,buffers:u=Md}=t;for(let m=0;m<u.length;m++){const h=u[m],f=Za(s,h),y=r(f),b=[{chainId:n,calls:[...o,...y]}];try{return await e(b,i,c,d,l,p)}catch(C){const w=typeof C?.message=="string"?C.message:String(C?.message??"");if(lr(C)&&Rd.has(C.code)||C.name==="AbortError"||l?.aborted||w.includes("User rejected")||w.includes("User denied")||C.code===4001||m>=u.length-1)throw C;const k=Number(u[m+1])/10;console.warn(`[SwapThenAction] Action attempt ${m+1} failed (buffer ${Number(h)/10}%), retrying with ${k}% buffer...`,C.message),d?.({step:"signing-delegation",message:`Adjusting action amount, retrying (${k}% buffer)...`})}}throw new Ne("ALL_ATTEMPTS_FAILED","All action attempts failed after exhausting buffer progression.",{attempts:u.length,chainId:n})}Ei();export{dd as AccountDisplay,Is as AddFundsLink,Br as CheckIcon,Un as ChevronIcon,io as CloseIcon,$o as DEFAULT_BRIDGE_FEE_BUFFER_BPS,Va as DEFAULT_SQUID_INTEGRATOR_ID,co as DetailRow,td as ExportWalletButton,tu as NATIVE_TOKEN_ADDRESS,Fs as ProviderLogin,er as SATSUMA_CITREA_CONFIG,nu as SPICENET_NATIVE_CHAIN_ID,ou as SPICE_COMBINED_FEE_RECIPIENT,su as SPICE_GAS_FEE_RECIPIENT,ru as SPICE_PLATFORM_FEE_RECIPIENT,au as SPICE_SOLVER_ADDRESS,ud as SdkErrorBoundary,us as SearchInput,Sl as SelectChainModal,xc as SpiceBalance,Pr as SpiceDeposit,Zd as SpiceFlowProvider,Xt as SpiceFlowProviderContext,ga as SpiceLock,ga as SpiceLockModal,ed as SpicePay,Oa as SpiceSupply,ua as SpiceWithdraw,Ne as SpiceflowError,On as Spinner,lo as StatusBanner,Da as UNIV3_BASE_CONFIG,Za as applyBuffer,iu as applySlippage,So as areEquivalentOnChains,Xd as buildDarkPalette,Td as buildIntent,Jd as buildLightPalette,qs as buildPayChainBatches,Ed as buildRebalancingBatch,Ad as buildRebalancingMetadata,da as buildRoutedBatches,Ks as buildSupplyChainBatches,lu as buildUniV3SwapCalls,Ma as create1inchVenue,Pa as createLiquidityRegistry,Na as createSatsumaVenue,mn as duration,tn as easing,Gs as estimateFeePreview,Ys as estimateRequiredGrossFunding,ya as estimateSupplyMaxAmount,Xs as executeDirectExternalAction,ka as executeNon7702Supply,Js as executePay,Zs as executeSupply,Dd as executeSwapThenAction,zn as findEquivalentOnChain,Ls as findTokenOnChain,gr as font,jo as getAssetChainTokenCandidates,Fa as getBestUniV3Quote,Re as getChainConfig,cu as getChainIdsByNetwork,hn as getChainName,du as getEscrowContractAddress,Ea as getUniV3Quote,uu as isNativeToken,lr as isSpiceflowError,pu as isSpicenetChainId,Sa as isSupportedSupplyAsset,Ba as isSwapIntent,fu as normalizeNativeTokenAddress,kd as quoteCctpFee,Id as quoteSquidFee,ds as radius,yt as relayerService,En as resolveAssetTokenAddressOnChain,qr as resolveFundedToken,_c as resolveInputSupplySwapQuote,ca as resolveRoute,$d as resolveTheme,Mo as resolveTokenRef,hu as spicenetAbi,mu as spicenetWithdrawalAbi,Kn as stripSpicenetFundingBatches,gn as transition,pd as useAssetInput,In as useEmbeddedWalletAddress,Bo as useGaslessExecution,_d as useIsUserWhitelisted,fd as useLockDuration,gd as usePay,yd as useRepay,hd as useSmartWallet,Jo as useSpiceAction,Eo as useSpiceAssets,wt as useSpiceBrand,Bo as useSpiceExecution,Ha as useSpicePendingDeposits,md as useSupply,$s as useSupplyAssets,tr as useSupplyQuote,vn as useWallet,_n as z};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicenet-io/spiceflow-ui",
3
- "version": "3.3.55-next.4",
3
+ "version": "3.3.55-next.6",
4
4
  "description": "Spiceflow UI SDK",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.13",