@spicenet-io/spiceflow-ui 3.3.12 → 3.3.14

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.
Files changed (37) hide show
  1. package/dist/Button-CpPbEdQV.js +2 -0
  2. package/dist/Button-Dvhm0yVc.js +2 -0
  3. package/dist/auth-dynamic.cjs.js +1 -1
  4. package/dist/auth-dynamic.js +1 -1
  5. package/dist/auth-privy.cjs.js +1 -1
  6. package/dist/auth-privy.js +1 -1
  7. package/dist/components/SpiceDeposit/lib/feePreview.d.ts +8 -0
  8. package/dist/components/SpiceDeposit/parts/DepositAssetChooser.d.ts +1 -0
  9. package/dist/components/SpiceDeposit/steps/ConnectWalletModal.d.ts +1 -0
  10. package/dist/components/SpiceLock/lib/executors.d.ts +2 -2
  11. package/dist/components/SpiceLock/lib/helpers.d.ts +39 -0
  12. package/dist/components/SpiceSupply/lib/feePreview.d.ts +13 -1
  13. package/dist/components/SpiceWithdraw/lib/executors.d.ts +2 -2
  14. package/dist/components/SpiceWithdraw/lib/feePreview.d.ts +8 -0
  15. package/dist/components/SpiceWithdraw/lib/helpers.d.ts +2 -0
  16. package/dist/components/ui/AmountText.d.ts +28 -0
  17. package/dist/components/ui/index.d.ts +1 -0
  18. package/dist/hooks/useSpiceExecution.d.ts +6 -0
  19. package/dist/hooks/useStatus.d.ts +1 -0
  20. package/dist/index.cjs.js +12 -12
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +12 -12
  23. package/dist/{providerWallet-QdrPrEd_.js → providerWallet-Q1RM8u1X.js} +1 -1
  24. package/dist/{providerWallet-BC4uEdg8.js → providerWallet-q8k_N1C_.js} +1 -1
  25. package/dist/types/assets.d.ts +1 -0
  26. package/dist/types/deposit.d.ts +4 -0
  27. package/dist/types/lock.d.ts +1 -0
  28. package/dist/types/status.d.ts +1 -0
  29. package/dist/types/supply.d.ts +1 -0
  30. package/dist/types/ui.d.ts +1 -0
  31. package/dist/types/withdraw.d.ts +7 -0
  32. package/dist/utils/formatting/index.d.ts +1 -1
  33. package/dist/utils/relayer/index.d.ts +1 -0
  34. package/dist/utils/tokenResolution.d.ts +1 -0
  35. package/package.json +2 -2
  36. package/dist/Button-CAv7hfnV.js +0 -2
  37. package/dist/Button-Cs81k5Pq.js +0 -2
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";const I=require("react/jsx-runtime"),g=require("react"),x=require("@spicenet-io/spiceflow-core"),w=require("viem"),pe=require("viem/actions");function N(t,e){return!t||!e?!1:w.isAddress(t)&&w.isAddress(e)?w.getAddress(t)===w.getAddress(e):t.toLowerCase()===e.toLowerCase()}const J=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],fe="0xcA11bde05977b3631167028862bE2a173976CA11",me={4114:"0x860aFc632a6D625B95d8B96f39ECC48E988c6962"},he=new Set([5115]);function ye(t){const e=me[t.id]??(he.has(t.id)?void 0:fe);return w.defineChain({id:t.id,name:t.name,nativeCurrency:t.nativeCurrency,rpcUrls:{default:{http:[t.rpcUrl]}},blockExplorers:{default:{name:t.displayName,url:t.blockExplorer}},testnet:t.network==="testnet",...e?{contracts:{multicall3:{address:e}}}:{}})}const ge=[1,8453,42161,4114,11155111,421614,84532,5115,123420001114,688688,688689],U=Object.fromEntries(ge.map(t=>x.getChainMeta(t)).filter(t=>t!=null).map(t=>[t.id,{...t,viemChain:ye(t),supportedTokens:x.getTokensForChain(t.id)}])),be=U;let H={};const M=new Map,Y=t=>{H={...t||{}},M.clear()},P=t=>{const e=H[t];return e&&typeof e=="string"&&e.length>0?e:U[t]?.rpcUrl},$=t=>U[t],L=t=>{const e=x.getChainMeta(t);return e?.displayName||e?.name||`Chain ${t}`},we=t=>{const e=x.getDelegateContract(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);return e},xe=(t,e,a)=>{const r=$(t);return r?.blockExplorer?`${r.blockExplorer}/tx/${e}`:"#"};async function Be(t,e){const a=`0x${e.toString(16)}`;try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:a}]});return}catch(s){if(!(s?.code===4902||typeof s?.message=="string"&&s.message.includes("Unrecognized chain ID")))throw s}const r=$(e);if(!r)throw new Error(`Cannot add unknown chain ${e} to wallet`);await t.request({method:"wallet_addEthereumChain",params:[{chainId:a,chainName:r.name||`Chain ${e}`,nativeCurrency:r.nativeCurrency||{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:[P(e)||r.rpcUrl],blockExplorerUrls:r.blockExplorer?[r.blockExplorer]:void 0}]})}const q=t=>{const e=$(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);const a=P(t);if(!a)throw new Error(`No RPC URL configured for chain ID: ${t}`);const r=`${t}:${a}`,s=M.get(r);if(s)return s;const n=w.createPublicClient({chain:e.viemChain,transport:w.http(a,{timeout:15e3,retryCount:2,retryDelay:300}),batch:{multicall:{wait:16}}});return M.set(r,n),n},Ee=()=>{const t={};return Object.values(U).forEach(e=>{t[e.id]={name:e.name,moralisName:e.moralisId||"",chain:e.viemChain,rpcUrl:P(e.id)||e.rpcUrl}}),t},Ce=(t,e=[])=>{const a=$(t);if(!a)return[];const r=[];if(![11155111,421614,84532,688689].includes(t)){const n=e.find(c=>c.chainId===t&&c.isNative);n?r.push(n):r.push({address:x.ZERO_ADDRESS,name:a.nativeCurrency.name,symbol:a.nativeCurrency.symbol,decimals:a.nativeCurrency.decimals,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,logoURI:void 0,isNative:!0,chainId:t})}if(!a.supportedTokens)return r;const s=r.some(n=>n.isNative);return a.supportedTokens.forEach(n=>{if(s&&x.isNativeToken(n.address))return;const c=e.find(d=>d.chainId===t&&N(d.address,n.address));c?r.push(c):r.push({address:n.address,name:n.name,symbol:n.symbol,decimals:n.decimals,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,logoURI:n.logo,isNative:!1,chainId:t})}),r},Se=async(t,e)=>{const a=$(t);if(!a)throw new Error(`Unsupported chain ID: ${t}`);const r=e.toLowerCase();if(x.isNativeToken(r)){if(!a.nativeCurrency?.decimals)throw new Error(`Native currency decimals not configured for chain ${t}`);return a.nativeCurrency.decimals}if(a.supportedTokens){const s=a.supportedTokens.find(n=>N(n.address,r));if(s)return s.decimals}try{if(!w.isAddress(e,{strict:!1}))throw new Error(`Invalid token address: ${e}`);const s=w.getAddress(e),n=q(t),c=await pe.readContract(n,{address:s,abi:J,functionName:"decimals"});return Number(c)}catch{throw new Error(`Could not determine decimals for token ${e} on chain ${t}`)}};class f extends Error{constructor(e,a,r={}){super(a),this.code=e,this.context=r,this.name="SpiceflowError",Error.captureStackTrace&&Error.captureStackTrace(this,f)}}function j(t){return t instanceof f}const $e=["user rejected","user denied","user cancelled","rejected the request","action_rejected","4001"];function G(t){if(!t)return"";if(typeof t=="string")return t;const e=t,a=e.message||e.reason||"",r=e.details||"";return`${a} ${r}`.trim()}const X=t=>{if(j(t))return t.code==="WALLET_REJECTED";const e=G(t).toLowerCase();return $e.some(a=>e.includes(a))},Re=(t,e="Something went wrong. Please try again.")=>X(t)?"Transaction was rejected.":j(t)?t.message||e:G(t)||e;function ve(t,e){const a=e.match(/Output amount (\d+) is insufficient after fees (\d+) on chain (\d+)/);if(!a)return e;const[,r,s,n]=a,c=Number(n),d=BigInt(r),u=BigInt(s);let o;for(const h of t.intents){const R=h.chainBatches.find(v=>v.chainId===c);if(R){o=R;break}}const p=o?.tokenTransfers.find(h=>h.from==="escrow"&&N(h.to,t.user)&&!x.isNativeToken(h.token)),l=L(c);if(!p)return`Amount is too small to cover the estimated fee on ${l}.`;const m=x.getTokenByAddress(p.token,c),C=m?.decimals??18,S=m?.symbol??"tokens",i=w.formatUnits(d,C),B=w.formatUnits(u,C);return`Amount is too small to cover the estimated fee on ${l}. Amount: ${i} ${S}. Estimated fee: ${B} ${S}.`}const Q=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io";function A(t,e){return typeof e=="bigint"?e.toString():e}function b(t,e){return t&&(t.message||t.error?.message||(typeof t.error=="string"?t.error:""))||e}class ke{constructor(){this.baseUrl=Q}setBaseUrl(e){this.baseUrl=e}getBaseUrl(){return this.baseUrl}async createAction(e){const a=`${this.baseUrl}/actions`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,A)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",b(s,`Relayer API error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/actions"});return s}async estimateActionFees(e){const a=`${this.baseUrl}/actions/fees/estimate`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,A)}),s=await r.json();if(!r.ok||!s.success||!s.data?.feeEstimate){const n=b(s,`Relayer fee estimate error: ${r.status}`);throw new f("RELAYER_ERROR",ve(e,n),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/actions/fees/estimate"})}return s.data.feeEstimate}async estimateBatchGas(e){const a=`${this.baseUrl}/actions/gas/estimate`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,A)}),s=await r.json();if(!r.ok||!s.success||!s.data?.gasFee)throw new f("RELAYER_ERROR",b(s,`Relayer gas estimate error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/actions/gas/estimate"});return{gasFee:BigInt(s.data.gasFee),gasQuoteSource:s.data.gasQuoteSource}}async executeStep(e,a,r,s){const n=`${this.baseUrl}/actions/${e}/intents/${a}/steps/${r}`,c=`/actions/${e}/intents/${a}/steps/${r}`,d=1e4,u=new Promise((l,m)=>setTimeout(()=>m(new f("RELAYER_EXECUTE_ERROR",`Execute step request timed out after ${d/1e3}s`,{actionId:e,intentIndex:a,stepIndex:r,endpoint:c})),d)),o=await Promise.race([fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),u]),p=await o.json();if(!o.ok||p.success===!1)throw new f("RELAYER_EXECUTE_ERROR",b(p,`Execute step error: ${o.status}`),{httpStatus:o.status,responseBody:JSON.stringify(p),endpoint:c,actionId:e});if(p?.status==="error"||p?.status==="reverted"){const l=b(p,""),m=l?`: ${l}`:"";throw new f("RELAYER_EXECUTE_ERROR",`Step ${r} previously ${p.status}${m}`,{httpStatus:o.status,responseBody:JSON.stringify(p),endpoint:c,actionId:e,intentIndex:a,stepIndex:r,stepStatus:p.status})}return{success:!0,transactionHash:p.transactionHash}}async checkStepStatus(e,a){const r=e.split("/"),s=r[0],n=r.length>=2?r[1]:"0",c=`${this.baseUrl}/actions/${s}/intents/${n}/steps/${a}`,d=await fetch(c),u=await d.json();if(!d.ok||u.success===!1)throw new f("RELAYER_STATUS_ERROR",b(u,`Intent step status check failed: ${d.status}`),{httpStatus:d.status,responseBody:JSON.stringify(u),endpoint:c,intentId:e});return{success:!0,data:{status:u.status==="error"?"reverted":u.status,transactionHash:u.txid,error:b(u,"")}}}async createWallet(e,a){const r=`${this.baseUrl}/wallets/${e}`,s=await fetch(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),n=await s.json();if(!s.ok||n.success===!1)throw new f("RELAYER_ERROR",b(n,`Create wallet error: ${s.status}`),{httpStatus:s.status,responseBody:JSON.stringify(n),endpoint:`/wallets/${e}`});return n}async getWallet(e){const a=`${this.baseUrl}/wallets/${e}`,r=await fetch(a),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",b(s,`Get wallet error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:`/wallets/${e}`});return s}async createWithdrawal(e){const a=`${this.baseUrl}/withdrawals`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,A)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",b(s,`Create withdrawal error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/withdrawals"});return s}async getWithdrawal(e){const a=`${this.baseUrl}/withdrawals/${e}`,r=await fetch(a),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",b(s,`Get withdrawal error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:`/withdrawals/${e}`});return s}async getRollupTimestamp(){const e=`${this.baseUrl}/time`,a=await fetch(e),r=await a.json();if(!a.ok||r.success===!1)throw new f("RELAYER_ERROR",b(r,`Get rollup timestamp error: ${a.status}`),{httpStatus:a.status,responseBody:JSON.stringify(r),endpoint:"/time"});return r}}const E=new ke,D=new Map;async function Te(t,e){const a=t.toLowerCase(),r=D.get(a);if(r)return r;const s=(async()=>{try{await E.getWallet(t);return}catch{}const{unix_timestamp:n}=await E.getRollupTimestamp(),c=`I am creating a new smart wallet and adding an admin wallet ethereum:0x${t.slice(2).toLowerCase()}. Nonce: ${n}`,d=await e(c),u=typeof d=="string"?d:d.signature;if(!u)throw new Error("Wallet returned no smart wallet signature");await E.createWallet(t,{timestamp:n,signature:u})})();D.set(a,s);try{await s}finally{D.delete(a)}}const Ie=(t,e)=>{const a=s=>e?e(s):L(s),r=[];return t.forEach((s,n)=>{const c=s.calls&&s.calls.length>0,d=s.tokenTransfers&&s.tokenTransfers.length>0;!c&&!d||r.push({stepId:n,status:n===0?"processing":"pending",chainId:s.chainId,chainName:a(s.chainId),description:"Processing transaction"})}),r},V="spiceflow-mode",Z=()=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(V);return t==="embedded"?"7702":t==="external"?"ondemand":null}catch{return null}},Ne=t=>{if(!(typeof window>"u"))try{window.localStorage.setItem(V,t==="7702"?"embedded":"external")}catch{}},Ue=()=>Z()!==null,K=g.createContext(null),ee=g.createContext(null),Ae=({children:t,provider:e,supportedChainIds:a,allowedTokens:r,network:s="testnet",mode:n="7702",skipFlow:c=[],nativeChainId:d,appName:u="Spicenet",apiUrl:o,theme:p,rpcOverrides:l})=>{g.useEffect(()=>{if(!o)return;const h=E.getBaseUrl();return E.setBaseUrl(o),()=>E.setBaseUrl(h)},[o]),g.useEffect(()=>(Y(l),()=>Y(void 0)),[l]);const m=a??x.getChainIdsByNetwork(s),C=p??null,[S,i]=g.useState(()=>Z()??n),B=g.useCallback(h=>{i(h),Ne(h)},[]);return I.jsx(K.Provider,{value:C,children:I.jsx(ee.Provider,{value:{provider:e,supportedChainIds:m,allowedTokens:r,skipFlow:c,mode:S,setMode:B,network:s,nativeChainId:d,appName:u,apiUrl:o,rpcOverrides:l},children:t})})},Oe={spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},typography:{fontFamily:'"Helvetica Neue", sans-serif',fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.75rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1)"},animation:{fast:"150ms ease-in-out",normal:"200ms ease-in-out",slow:"300ms ease-in-out"}},_e={primary:"#EA4B4B",primaryHover:"#E43838",secondary:"#f3f4f6",background:"#ffffff",surface:"#f9fafb",surfaceHover:"#f3f4f6",border:"#e5e7eb",borderHover:"#d1d5db",text:"#111827",textSecondary:"#374151",textMuted:"#6b7280",success:"#10b981",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6"},Fe={primary:"#EA4B4B",primaryHover:"#E43838",secondary:"#171717",background:"#141414",surface:"#1e1e1e",surfaceHover:"#2a2a2a",border:"#2d2d2d",borderHover:"#3a3a3a",text:"#ffffff",textSecondary:"#888888",textMuted:"#666666",success:"#10b981",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6"},te=(t="light")=>({mode:t,...Oe,colors:t==="light"?_e:Fe});function O(t,e){const a=t.replace("#",""),r=Math.max(0,Math.round(parseInt(a.substring(0,2),16)*(1-e))),s=Math.max(0,Math.round(parseInt(a.substring(2,4),16)*(1-e))),n=Math.max(0,Math.round(parseInt(a.substring(4,6),16)*(1-e)));return`#${r.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}function Me(t,e){return{shell:e?.shell??"#141414",shellBorder:e?.shellBorder??O(e?.shell??"#141414",.35),shellInnerBorder:e?.shellInnerBorder??O(e?.shell??"#141414",.55),cardBg:e?.cardBg??"#1e1e1e",inputBg:e?.inputBg??"#171717",hoverBg:e?.hoverBg??"#2a2a2a",textPrimary:e?.textPrimary??"#ffffff",textSecondary:e?.textSecondary??"#888888",inputText:e?.inputText??"#e0e0e0",inputPlaceholder:e?.inputPlaceholder??"#555555",cardBorder:e?.cardBorder??"rgba(255,255,255,0.08)",inputBorder:e?.inputBorder??"rgba(255,255,255,0.10)",buttonBorder:e?.buttonBorder??"rgba(255,255,255,0.12)",successBg:e?.successBg??"#0a1f18",successBorder:e?.successBorder??"#1a4a3a",successText:e?.successText??"#6ee7b7",warningBg:e?.warningBg??"#1f1a0d",warningBorder:e?.warningBorder??"#4a3820",warningText:e?.warningText??"#fbbf24",errorBg:e?.errorBg??"#1f0d0d",errorBorder:e?.errorBorder??"#4a2020",errorText:e?.errorText??"#f87171",infoBg:e?.infoBg??"#0d1325",infoBorder:e?.infoBorder??"#2a3a5a",infoText:e?.infoText??"#60a5fa"}}function Pe(t){return{shell:"#ffffff",shellBorder:"#E9E9E9",shellInnerBorder:"#D5D5D5",cardBg:"#f9fafb",inputBg:"#ffffff",hoverBg:"#f3f4f6",textPrimary:"#111827",textSecondary:"#6b7280",inputText:"#111827",inputPlaceholder:"#9ca3af",cardBorder:"#e5e7eb",inputBorder:"#d1d5db",buttonBorder:"#0e0d0b",successBg:"#d1fae5",successBorder:"#6ee7b7",successText:"#065f46",warningBg:"#fef3c7",warningBorder:"#fde68a",warningText:"#92400e",errorBg:"#fef2f2",errorBorder:"#fecaca",errorText:"#dc2626",infoBg:"#dbeafe",infoBorder:"#93c5fd",infoText:"#1e40af"}}function re(t,e){const a=e?{...t,...e}:t,r=a.dark??!1,s=a.primaryColor,n=a.shell??(r?"#141414":"#ffffff");return{primaryColor:s,dark:r,fontFamily:a.fontFamily??'"Helvetica Neue", sans-serif',appName:a.appName??"Spicenet",logo:a.logo,borderRadius:a.borderRadius??"8px",shell:n,shellBorder:O(n,r?.35:.085),shellInnerBorder:O(n,r?.55:.165),card:a.card??(r?"#1e1e1e":"#f9fafb"),input:r?"#171717":"#ffffff",hover:r?"#2a2a2a":"#f3f4f6",text:a.text??(r?"#ffffff":"#111827"),textMuted:a.textMuted??(r?"#888888":"#6b7280"),inputText:r?"#e0e0e0":"#111827",inputPlaceholder:r?"#555555":"#9ca3af",border:a.border??(r?"rgba(255,255,255,0.08)":"#e5e7eb"),inputBorder:r?"rgba(255,255,255,0.10)":"#d1d5db",buttonBorder:r?"rgba(255,255,255,0.12)":"#0e0d0b",successBg:r?"#0a1f18":"#d1fae5",successBorder:r?"#1a4a3a":"#6ee7b7",successText:r?"#6ee7b7":"#065f46",warningBg:r?"#1f1a0d":"#fef3c7",warningBorder:r?"#4a3820":"#fde68a",warningText:r?"#fbbf24":"#92400e",errorBg:r?"#1f0d0d":"#fef2f2",errorBorder:r?"#4a2020":"#fecaca",errorText:r?"#f87171":"#dc2626",infoBg:r?"#0d1325":"#dbeafe",infoBorder:r?"#2a3a5a":"#93c5fd",infoText:r?"#60a5fa":"#1e40af"}}const Le='"IBM Plex Mono", monospace';function ae(t,e){const a=g.useContext(K)??void 0;return g.useMemo(()=>{const r=a??{primaryColor:"#EA4B4B"},s={...t?.primaryColor?{primaryColor:t.primaryColor}:{},...t?.fontFamily?{fontFamily:t.fontFamily}:{},...e!==void 0?{dark:e}:{}},n=re(r,s),{dark:c,primaryColor:d,appName:u}=n,o=te(c?"dark":"light"),p={...o,colors:{...o.colors,primary:d,primaryHover:`${d}dd`},typography:{...o.typography,fontFamily:n.fontFamily}},l={shell:n.shell,shellBorder:n.shellBorder,shellInnerBorder:n.shellInnerBorder,cardBg:n.card,inputBg:n.input,hoverBg:n.hover,textPrimary:n.text,textSecondary:n.textMuted,inputText:n.inputText,inputPlaceholder:n.inputPlaceholder,cardBorder:n.border,inputBorder:n.inputBorder,buttonBorder:n.buttonBorder,successBg:n.successBg,successBorder:n.successBorder,successText:n.successText,warningBg:n.warningBg,warningBorder:n.warningBorder,warningText:n.warningText,errorBg:n.errorBg,errorBorder:n.errorBorder,errorText:n.errorText,infoBg:n.infoBg,infoBorder:n.infoBorder,infoText:n.infoText},m=t?.inputVariant?t.inputVariant==="dark":c;return{brand:a,theme:p,dark:c,appName:u,primaryColor:d,dk:l,palette:l,fontFamily:n.fontFamily,monoFont:Le,inputDark:m,cardBg:m?l.cardBg:"#E9E9E9",cardBorder:m?l.cardBorder:"#C6C6C6",textPrimary:l.textPrimary,textSecondary:l.textSecondary,subtitleText:m?l.textSecondary:"#979AA0"}},[a,t,e])}const se="spiceflow-spinner-keyframes";function je(){if(typeof document>"u"||document.getElementById(se))return;const t=document.createElement("style");t.id=se,t.textContent="@keyframes spiceflow-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",document.head.appendChild(t)}const ne=({size:t=16,borderWidth:e=2,color:a="currentColor",style:r})=>{const s=g.useRef(!1);return g.useEffect(()=>{s.current||(je(),s.current=!0)},[]),I.jsx("div",{role:"status","aria-label":"Loading",style:{width:`${t}px`,height:`${t}px`,border:`${e}px solid ${a}`,borderTop:`${e}px solid transparent`,borderRadius:"50%",animation:"spiceflow-spin 1s linear infinite",flexShrink:0,...r}})},De=({variant:t="primary",size:e="md",loading:a=!1,fullWidth:r=!1,disabled:s,children:n,className:c="",style:d,theme:u,styles:o,dark:p,...l})=>{const{theme:m,dark:C,palette:S}=ae(o,p),i=u||m,B=p??C,[h,R]=g.useState(!1),[v,_]=g.useState(!1),F=B?S.shell:"white",oe=()=>{switch(t){case"primary":return{backgroundColor:o?.button?.backgroundColor||i.colors.primary,color:o?.button?.color||"#ffffff",border:`1px solid ${o?.button?.backgroundColor||i.colors.primary}`};case"secondary":return{backgroundColor:i.colors.secondary,color:i.colors.text,border:`1px solid ${i.colors.border}`};case"success":return{backgroundColor:i.colors.success,color:i.colors.text,border:`1px solid ${i.colors.success}`};case"error":return{backgroundColor:i.colors.error,color:i.colors.text,border:`1px solid ${i.colors.error}`};case"ghost":return{backgroundColor:"transparent",color:i.colors.textSecondary,border:`1px solid ${i.colors.border}`};case"outline":{const y=o?.button?.backgroundColor||i.colors.primary,z=o?.button?.color||(B?"#ffffff":"#0e0d0b"),k=o?.button?.borderColor||(B?`${i.colors.primary}88`:"#0e0d0b"),T=s||a,de=B?"1px":"1.5px",le=o?.button?.disabledBackgroundColor||`${y}88`,ue=o?.button?.disabledColor||z;return{height:"56px",backgroundColor:T?le:v?`${y}cc`:h?`${y}ee`:y,color:T?ue:z,border:`${de} solid ${k}`,borderRadius:o?.button?.borderRadius||"12px",fontSize:"22px",fontWeight:500,fontFamily:'"IBM Plex Mono", monospace',opacity:T?.78:1,transform:T?"none":v?"scale(0.98)":h?"translateY(-2px)":"none",boxShadow:T?`3px 3px 0px ${F}, 4px 4px 0px ${k}`:v?`2px 2px 0px ${k}`:h?`5px 5px 0px ${F}, 6px 6px 0px ${k}`:`3px 3px 0px ${F}, 4px 4px 0px ${k}`,transition:"transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease, color 150ms ease"}}default:return{}}},ie=()=>{if(t==="outline")return{};switch(e){case"sm":return{padding:`${i.spacing.sm} ${i.spacing.md}`,fontSize:i.typography.fontSize.sm};case"md":return{padding:`${i.spacing.md} ${i.spacing.lg}`,fontSize:i.typography.fontSize.base};case"lg":return{padding:`${i.spacing.lg} ${i.spacing.xl}`,fontSize:i.typography.fontSize.lg};default:return{}}},ce={borderRadius:o?.button?.borderRadius||i.borderRadius.md,fontWeight:o?.button?.fontWeight||i.typography.fontWeight.medium,fontFamily:o?.button?.fontFamily||i.typography.fontFamily,fontSize:o?.button?.fontSize||void 0,transition:"background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease",cursor:s||a?"not-allowed":"pointer",opacity:(s||a)&&t!=="outline"?.6:1,width:r?"100%":"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:i.spacing.sm,...oe(),...ie(),...o?.button?.fontSize&&{fontSize:o.button.fontSize}},W=s||a;return I.jsxs("button",{type:l.type??"button","data-spiceflow-focus":!0,"aria-busy":a||void 0,"aria-disabled":W||void 0,style:{...ce,...d},className:c,disabled:W,onMouseEnter:y=>{R(!0),l.onMouseEnter?.(y)},onMouseLeave:y=>{R(!1),_(!1),l.onMouseLeave?.(y)},onMouseDown:y=>{_(!0),l.onMouseDown?.(y)},onMouseUp:y=>{_(!1),l.onMouseUp?.(y)},...l,children:[a&&I.jsx(ne,{size:16}),n]})};exports.Button=De,exports.CHAIN_CONFIGS=be,exports.RELAYER_API_URL=Q,exports.SpiceFlowProvider=Ae,exports.SpiceFlowProviderContext=ee,exports.SpiceflowError=f,exports.Spinner=ne,exports._=J,exports.addressesEqual=N,exports.buildDarkPalette=Me,exports.buildLightPalette=Pe,exports.createInitialSteps=Ie,exports.createTheme=te,exports.ensureSmartWallet=Te,exports.ensureWalletOnChain=Be,exports.getAllAssetsForChain=Ce,exports.getChainConfig=$,exports.getChainName=L,exports.getChainsForAssets=Ee,exports.getClientForChain=q,exports.getDelegateContractAddress=we,exports.getExplorerUrl=xe,exports.getTokenDecimals=Se,exports.hasStoredSpiceFlowMode=Ue,exports.isSpiceflowError=j,exports.isUserRejection=X,exports.relayerService=E,exports.resolveTheme=re,exports.sanitizeError=Re,exports.useSpiceBrand=ae;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as v,jsxs as ge}from"react/jsx-runtime";import{createContext as Y,useEffect as A,useState as M,useCallback as be,useContext as we,useMemo as xe,useRef as Be}from"react";import{getChainMeta as q,getTokensForChain as Ee,getDelegateContract as $e,ZERO_ADDRESS as Se,isNativeToken as _,getTokenByAddress as Ce,getChainIdsByNetwork as Re}from"@spicenet-io/spiceflow-core";import{isAddress as P,getAddress as F,defineChain as ve,createPublicClient as ke,http as Te,formatUnits as G}from"viem";import{readContract as Ie}from"viem/actions";function k(t,e){return!t||!e?!1:P(t)&&P(e)?F(t)===F(e):t.toLowerCase()===e.toLowerCase()}const X=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],Ne="0xcA11bde05977b3631167028862bE2a173976CA11",Ue={4114:"0x860aFc632a6D625B95d8B96f39ECC48E988c6962"},Oe=new Set([5115]);function Ae(t){const e=Ue[t.id]??(Oe.has(t.id)?void 0:Ne);return ve({id:t.id,name:t.name,nativeCurrency:t.nativeCurrency,rpcUrls:{default:{http:[t.rpcUrl]}},blockExplorers:{default:{name:t.displayName,url:t.blockExplorer}},testnet:t.network==="testnet",...e?{contracts:{multicall3:{address:e}}}:{}})}const Me=[1,8453,42161,4114,11155111,421614,84532,5115,123420001114,688688,688689],T=Object.fromEntries(Me.map(t=>q(t)).filter(t=>t!=null).map(t=>[t.id,{...t,viemChain:Ae(t),supportedTokens:Ee(t.id)}])),_e=T;let Q={};const L=new Map,V=t=>{Q={...t||{}},L.clear()},j=t=>{const e=Q[t];return e&&typeof e=="string"&&e.length>0?e:T[t]?.rpcUrl},E=t=>T[t],D=t=>{const e=q(t);return e?.displayName||e?.name||`Chain ${t}`},Pe=t=>{const e=$e(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);return e},Fe=(t,e,a)=>{const r=E(t);return r?.blockExplorer?`${r.blockExplorer}/tx/${e}`:"#"};async function Le(t,e){const a=`0x${e.toString(16)}`;try{await t.request({method:"wallet_switchEthereumChain",params:[{chainId:a}]});return}catch(s){if(!(s?.code===4902||typeof s?.message=="string"&&s.message.includes("Unrecognized chain ID")))throw s}const r=E(e);if(!r)throw new Error(`Cannot add unknown chain ${e} to wallet`);await t.request({method:"wallet_addEthereumChain",params:[{chainId:a,chainName:r.name||`Chain ${e}`,nativeCurrency:r.nativeCurrency||{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:[j(e)||r.rpcUrl],blockExplorerUrls:r.blockExplorer?[r.blockExplorer]:void 0}]})}const Z=t=>{const e=E(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);const a=j(t);if(!a)throw new Error(`No RPC URL configured for chain ID: ${t}`);const r=`${t}:${a}`,s=L.get(r);if(s)return s;const n=ke({chain:e.viemChain,transport:Te(a,{timeout:15e3,retryCount:2,retryDelay:300}),batch:{multicall:{wait:16}}});return L.set(r,n),n},je=()=>{const t={};return Object.values(T).forEach(e=>{t[e.id]={name:e.name,moralisName:e.moralisId||"",chain:e.viemChain,rpcUrl:j(e.id)||e.rpcUrl}}),t},De=(t,e=[])=>{const a=E(t);if(!a)return[];const r=[];if(![11155111,421614,84532,688689].includes(t)){const n=e.find(c=>c.chainId===t&&c.isNative);n?r.push(n):r.push({address:Se,name:a.nativeCurrency.name,symbol:a.nativeCurrency.symbol,decimals:a.nativeCurrency.decimals,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,logoURI:void 0,isNative:!0,chainId:t})}if(!a.supportedTokens)return r;const s=r.some(n=>n.isNative);return a.supportedTokens.forEach(n=>{if(s&&_(n.address))return;const c=e.find(d=>d.chainId===t&&k(d.address,n.address));c?r.push(c):r.push({address:n.address,name:n.name,symbol:n.symbol,decimals:n.decimals,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,logoURI:n.logo,isNative:!1,chainId:t})}),r},ze=async(t,e)=>{const a=E(t);if(!a)throw new Error(`Unsupported chain ID: ${t}`);const r=e.toLowerCase();if(_(r)){if(!a.nativeCurrency?.decimals)throw new Error(`Native currency decimals not configured for chain ${t}`);return a.nativeCurrency.decimals}if(a.supportedTokens){const s=a.supportedTokens.find(n=>k(n.address,r));if(s)return s.decimals}try{if(!P(e,{strict:!1}))throw new Error(`Invalid token address: ${e}`);const s=F(e),n=Z(t),c=await Ie(n,{address:s,abi:X,functionName:"decimals"});return Number(c)}catch{throw new Error(`Could not determine decimals for token ${e} on chain ${t}`)}};class f extends Error{constructor(e,a,r={}){super(a),this.code=e,this.context=r,this.name="SpiceflowError",Error.captureStackTrace&&Error.captureStackTrace(this,f)}}function z(t){return t instanceof f}const Je=["user rejected","user denied","user cancelled","rejected the request","action_rejected","4001"];function K(t){if(!t)return"";if(typeof t=="string")return t;const e=t,a=e.message||e.reason||"",r=e.details||"";return`${a} ${r}`.trim()}const ee=t=>{if(z(t))return t.code==="WALLET_REJECTED";const e=K(t).toLowerCase();return Je.some(a=>e.includes(a))},We=(t,e="Something went wrong. Please try again.")=>ee(t)?"Transaction was rejected.":z(t)?t.message||e:K(t)||e;function He(t,e){const a=e.match(/Output amount (\d+) is insufficient after fees (\d+) on chain (\d+)/);if(!a)return e;const[,r,s,n]=a,c=Number(n),d=BigInt(r),u=BigInt(s);let o;for(const h of t.intents){const $=h.chainBatches.find(S=>S.chainId===c);if($){o=$;break}}const p=o?.tokenTransfers.find(h=>h.from==="escrow"&&k(h.to,t.user)&&!_(h.token)),l=D(c);if(!p)return`Amount is too small to cover the estimated fee on ${l}.`;const m=Ce(p.token,c),x=m?.decimals??18,B=m?.symbol??"tokens",i=G(d,x),b=G(u,x);return`Amount is too small to cover the estimated fee on ${l}. Amount: ${i} ${B}. Estimated fee: ${b} ${B}.`}const te=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io";function I(t,e){return typeof e=="bigint"?e.toString():e}function g(t,e){return t&&(t.message||t.error?.message||(typeof t.error=="string"?t.error:""))||e}class Ye{constructor(){this.baseUrl=te}setBaseUrl(e){this.baseUrl=e}getBaseUrl(){return this.baseUrl}async createAction(e){const a=`${this.baseUrl}/actions`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,I)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",g(s,`Relayer API error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/actions"});return s}async estimateActionFees(e){const a=`${this.baseUrl}/actions/fees/estimate`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,I)}),s=await r.json();if(!r.ok||!s.success||!s.data?.feeEstimate){const n=g(s,`Relayer fee estimate error: ${r.status}`);throw new f("RELAYER_ERROR",He(e,n),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/actions/fees/estimate"})}return s.data.feeEstimate}async estimateBatchGas(e){const a=`${this.baseUrl}/actions/gas/estimate`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,I)}),s=await r.json();if(!r.ok||!s.success||!s.data?.gasFee)throw new f("RELAYER_ERROR",g(s,`Relayer gas estimate error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/actions/gas/estimate"});return{gasFee:BigInt(s.data.gasFee),gasQuoteSource:s.data.gasQuoteSource}}async executeStep(e,a,r,s){const n=`${this.baseUrl}/actions/${e}/intents/${a}/steps/${r}`,c=`/actions/${e}/intents/${a}/steps/${r}`,d=1e4,u=new Promise((l,m)=>setTimeout(()=>m(new f("RELAYER_EXECUTE_ERROR",`Execute step request timed out after ${d/1e3}s`,{actionId:e,intentIndex:a,stepIndex:r,endpoint:c})),d)),o=await Promise.race([fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)}),u]),p=await o.json();if(!o.ok||p.success===!1)throw new f("RELAYER_EXECUTE_ERROR",g(p,`Execute step error: ${o.status}`),{httpStatus:o.status,responseBody:JSON.stringify(p),endpoint:c,actionId:e});if(p?.status==="error"||p?.status==="reverted"){const l=g(p,""),m=l?`: ${l}`:"";throw new f("RELAYER_EXECUTE_ERROR",`Step ${r} previously ${p.status}${m}`,{httpStatus:o.status,responseBody:JSON.stringify(p),endpoint:c,actionId:e,intentIndex:a,stepIndex:r,stepStatus:p.status})}return{success:!0,transactionHash:p.transactionHash}}async checkStepStatus(e,a){const r=e.split("/"),s=r[0],n=r.length>=2?r[1]:"0",c=`${this.baseUrl}/actions/${s}/intents/${n}/steps/${a}`,d=await fetch(c),u=await d.json();if(!d.ok||u.success===!1)throw new f("RELAYER_STATUS_ERROR",g(u,`Intent step status check failed: ${d.status}`),{httpStatus:d.status,responseBody:JSON.stringify(u),endpoint:c,intentId:e});return{success:!0,data:{status:u.status==="error"?"reverted":u.status,transactionHash:u.txid,error:g(u,"")}}}async createWallet(e,a){const r=`${this.baseUrl}/wallets/${e}`,s=await fetch(r,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)}),n=await s.json();if(!s.ok||n.success===!1)throw new f("RELAYER_ERROR",g(n,`Create wallet error: ${s.status}`),{httpStatus:s.status,responseBody:JSON.stringify(n),endpoint:`/wallets/${e}`});return n}async getWallet(e){const a=`${this.baseUrl}/wallets/${e}`,r=await fetch(a),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",g(s,`Get wallet error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:`/wallets/${e}`});return s}async createWithdrawal(e){const a=`${this.baseUrl}/withdrawals`,r=await fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,I)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",g(s,`Create withdrawal error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:"/withdrawals"});return s}async getWithdrawal(e){const a=`${this.baseUrl}/withdrawals/${e}`,r=await fetch(a),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",g(s,`Get withdrawal error: ${r.status}`),{httpStatus:r.status,responseBody:JSON.stringify(s),endpoint:`/withdrawals/${e}`});return s}async getRollupTimestamp(){const e=`${this.baseUrl}/time`,a=await fetch(e),r=await a.json();if(!a.ok||r.success===!1)throw new f("RELAYER_ERROR",g(r,`Get rollup timestamp error: ${a.status}`),{httpStatus:a.status,responseBody:JSON.stringify(r),endpoint:"/time"});return r}}const w=new Ye,J=new Map;async function qe(t,e){const a=t.toLowerCase(),r=J.get(a);if(r)return r;const s=(async()=>{try{await w.getWallet(t);return}catch{}const{unix_timestamp:n}=await w.getRollupTimestamp(),c=`I am creating a new smart wallet and adding an admin wallet ethereum:0x${t.slice(2).toLowerCase()}. Nonce: ${n}`,d=await e(c),u=typeof d=="string"?d:d.signature;if(!u)throw new Error("Wallet returned no smart wallet signature");await w.createWallet(t,{timestamp:n,signature:u})})();J.set(a,s);try{await s}finally{J.delete(a)}}const Ge=(t,e)=>{const a=s=>e?e(s):D(s),r=[];return t.forEach((s,n)=>{const c=s.calls&&s.calls.length>0,d=s.tokenTransfers&&s.tokenTransfers.length>0;!c&&!d||r.push({stepId:n,status:n===0?"processing":"pending",chainId:s.chainId,chainName:a(s.chainId),description:"Processing transaction"})}),r},re="spiceflow-mode",ae=()=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(re);return t==="embedded"?"7702":t==="external"?"ondemand":null}catch{return null}},Xe=t=>{if(!(typeof window>"u"))try{window.localStorage.setItem(re,t==="7702"?"embedded":"external")}catch{}},Qe=()=>ae()!==null,se=Y(null),ne=Y(null),Ve=({children:t,provider:e,supportedChainIds:a,allowedTokens:r,network:s="testnet",mode:n="7702",skipFlow:c=[],nativeChainId:d,appName:u="Spicenet",apiUrl:o,theme:p,rpcOverrides:l})=>{A(()=>{if(!o)return;const h=w.getBaseUrl();return w.setBaseUrl(o),()=>w.setBaseUrl(h)},[o]),A(()=>(V(l),()=>V(void 0)),[l]);const m=a??Re(s),x=p??null,[B,i]=M(()=>ae()??n),b=be(h=>{i(h),Xe(h)},[]);return v(se.Provider,{value:x,children:v(ne.Provider,{value:{provider:e,supportedChainIds:m,allowedTokens:r,skipFlow:c,mode:B,setMode:b,network:s,nativeChainId:d,appName:u,apiUrl:o,rpcOverrides:l},children:t})})},Ze={spacing:{xs:"0.25rem",sm:"0.5rem",md:"1rem",lg:"1.5rem",xl:"2rem"},borderRadius:{sm:"0.25rem",md:"0.5rem",lg:"0.75rem",full:"9999px"},typography:{fontFamily:'"Helvetica Neue", sans-serif',fontSize:{xs:"0.75rem",sm:"0.875rem",base:"1rem",lg:"1.125rem",xl:"1.25rem","2xl":"1.5rem","3xl":"1.75rem"},fontWeight:{normal:400,medium:500,semibold:600,bold:700}},shadows:{sm:"0 1px 2px 0 rgb(0 0 0 / 0.05)",md:"0 4px 6px -1px rgb(0 0 0 / 0.1)",lg:"0 10px 15px -3px rgb(0 0 0 / 0.1)"},animation:{fast:"150ms ease-in-out",normal:"200ms ease-in-out",slow:"300ms ease-in-out"}},Ke={primary:"#EA4B4B",primaryHover:"#E43838",secondary:"#f3f4f6",background:"#ffffff",surface:"#f9fafb",surfaceHover:"#f3f4f6",border:"#e5e7eb",borderHover:"#d1d5db",text:"#111827",textSecondary:"#374151",textMuted:"#6b7280",success:"#10b981",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6"},et={primary:"#EA4B4B",primaryHover:"#E43838",secondary:"#171717",background:"#141414",surface:"#1e1e1e",surfaceHover:"#2a2a2a",border:"#2d2d2d",borderHover:"#3a3a3a",text:"#ffffff",textSecondary:"#888888",textMuted:"#666666",success:"#10b981",error:"#ef4444",warning:"#f59e0b",info:"#3b82f6"},oe=(t="light")=>({mode:t,...Ze,colors:t==="light"?Ke:et});function N(t,e){const a=t.replace("#",""),r=Math.max(0,Math.round(parseInt(a.substring(0,2),16)*(1-e))),s=Math.max(0,Math.round(parseInt(a.substring(2,4),16)*(1-e))),n=Math.max(0,Math.round(parseInt(a.substring(4,6),16)*(1-e)));return`#${r.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}`}function tt(t,e){return{shell:e?.shell??"#141414",shellBorder:e?.shellBorder??N(e?.shell??"#141414",.35),shellInnerBorder:e?.shellInnerBorder??N(e?.shell??"#141414",.55),cardBg:e?.cardBg??"#1e1e1e",inputBg:e?.inputBg??"#171717",hoverBg:e?.hoverBg??"#2a2a2a",textPrimary:e?.textPrimary??"#ffffff",textSecondary:e?.textSecondary??"#888888",inputText:e?.inputText??"#e0e0e0",inputPlaceholder:e?.inputPlaceholder??"#555555",cardBorder:e?.cardBorder??"rgba(255,255,255,0.08)",inputBorder:e?.inputBorder??"rgba(255,255,255,0.10)",buttonBorder:e?.buttonBorder??"rgba(255,255,255,0.12)",successBg:e?.successBg??"#0a1f18",successBorder:e?.successBorder??"#1a4a3a",successText:e?.successText??"#6ee7b7",warningBg:e?.warningBg??"#1f1a0d",warningBorder:e?.warningBorder??"#4a3820",warningText:e?.warningText??"#fbbf24",errorBg:e?.errorBg??"#1f0d0d",errorBorder:e?.errorBorder??"#4a2020",errorText:e?.errorText??"#f87171",infoBg:e?.infoBg??"#0d1325",infoBorder:e?.infoBorder??"#2a3a5a",infoText:e?.infoText??"#60a5fa"}}function rt(t){return{shell:"#ffffff",shellBorder:"#E9E9E9",shellInnerBorder:"#D5D5D5",cardBg:"#f9fafb",inputBg:"#ffffff",hoverBg:"#f3f4f6",textPrimary:"#111827",textSecondary:"#6b7280",inputText:"#111827",inputPlaceholder:"#9ca3af",cardBorder:"#e5e7eb",inputBorder:"#d1d5db",buttonBorder:"#0e0d0b",successBg:"#d1fae5",successBorder:"#6ee7b7",successText:"#065f46",warningBg:"#fef3c7",warningBorder:"#fde68a",warningText:"#92400e",errorBg:"#fef2f2",errorBorder:"#fecaca",errorText:"#dc2626",infoBg:"#dbeafe",infoBorder:"#93c5fd",infoText:"#1e40af"}}function ie(t,e){const a=e?{...t,...e}:t,r=a.dark??!1,s=a.primaryColor,n=a.shell??(r?"#141414":"#ffffff");return{primaryColor:s,dark:r,fontFamily:a.fontFamily??'"Helvetica Neue", sans-serif',appName:a.appName??"Spicenet",logo:a.logo,borderRadius:a.borderRadius??"8px",shell:n,shellBorder:N(n,r?.35:.085),shellInnerBorder:N(n,r?.55:.165),card:a.card??(r?"#1e1e1e":"#f9fafb"),input:r?"#171717":"#ffffff",hover:r?"#2a2a2a":"#f3f4f6",text:a.text??(r?"#ffffff":"#111827"),textMuted:a.textMuted??(r?"#888888":"#6b7280"),inputText:r?"#e0e0e0":"#111827",inputPlaceholder:r?"#555555":"#9ca3af",border:a.border??(r?"rgba(255,255,255,0.08)":"#e5e7eb"),inputBorder:r?"rgba(255,255,255,0.10)":"#d1d5db",buttonBorder:r?"rgba(255,255,255,0.12)":"#0e0d0b",successBg:r?"#0a1f18":"#d1fae5",successBorder:r?"#1a4a3a":"#6ee7b7",successText:r?"#6ee7b7":"#065f46",warningBg:r?"#1f1a0d":"#fef3c7",warningBorder:r?"#4a3820":"#fde68a",warningText:r?"#fbbf24":"#92400e",errorBg:r?"#1f0d0d":"#fef2f2",errorBorder:r?"#4a2020":"#fecaca",errorText:r?"#f87171":"#dc2626",infoBg:r?"#0d1325":"#dbeafe",infoBorder:r?"#2a3a5a":"#93c5fd",infoText:r?"#60a5fa":"#1e40af"}}const at='"IBM Plex Mono", monospace';function ce(t,e){const a=we(se)??void 0;return xe(()=>{const r=a??{primaryColor:"#EA4B4B"},s={...t?.primaryColor?{primaryColor:t.primaryColor}:{},...t?.fontFamily?{fontFamily:t.fontFamily}:{},...e!==void 0?{dark:e}:{}},n=ie(r,s),{dark:c,primaryColor:d,appName:u}=n,o=oe(c?"dark":"light"),p={...o,colors:{...o.colors,primary:d,primaryHover:`${d}dd`},typography:{...o.typography,fontFamily:n.fontFamily}},l={shell:n.shell,shellBorder:n.shellBorder,shellInnerBorder:n.shellInnerBorder,cardBg:n.card,inputBg:n.input,hoverBg:n.hover,textPrimary:n.text,textSecondary:n.textMuted,inputText:n.inputText,inputPlaceholder:n.inputPlaceholder,cardBorder:n.border,inputBorder:n.inputBorder,buttonBorder:n.buttonBorder,successBg:n.successBg,successBorder:n.successBorder,successText:n.successText,warningBg:n.warningBg,warningBorder:n.warningBorder,warningText:n.warningText,errorBg:n.errorBg,errorBorder:n.errorBorder,errorText:n.errorText,infoBg:n.infoBg,infoBorder:n.infoBorder,infoText:n.infoText},m=t?.inputVariant?t.inputVariant==="dark":c;return{brand:a,theme:p,dark:c,appName:u,primaryColor:d,dk:l,palette:l,fontFamily:n.fontFamily,monoFont:at,inputDark:m,cardBg:m?l.cardBg:"#E9E9E9",cardBorder:m?l.cardBorder:"#C6C6C6",textPrimary:l.textPrimary,textSecondary:l.textSecondary,subtitleText:m?l.textSecondary:"#979AA0"}},[a,t,e])}const de="spiceflow-spinner-keyframes";function st(){if(typeof document>"u"||document.getElementById(de))return;const t=document.createElement("style");t.id=de,t.textContent="@keyframes spiceflow-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",document.head.appendChild(t)}const le=({size:t=16,borderWidth:e=2,color:a="currentColor",style:r})=>{const s=Be(!1);return A(()=>{s.current||(st(),s.current=!0)},[]),v("div",{role:"status","aria-label":"Loading",style:{width:`${t}px`,height:`${t}px`,border:`${e}px solid ${a}`,borderTop:`${e}px solid transparent`,borderRadius:"50%",animation:"spiceflow-spin 1s linear infinite",flexShrink:0,...r}})},nt=({variant:t="primary",size:e="md",loading:a=!1,fullWidth:r=!1,disabled:s,children:n,className:c="",style:d,theme:u,styles:o,dark:p,...l})=>{const{theme:m,dark:x,palette:B}=ce(o,p),i=u||m,b=p??x,[h,$]=M(!1),[S,U]=M(!1),O=b?B.shell:"white",ue=()=>{switch(t){case"primary":return{backgroundColor:o?.button?.backgroundColor||i.colors.primary,color:o?.button?.color||"#ffffff",border:`1px solid ${o?.button?.backgroundColor||i.colors.primary}`};case"secondary":return{backgroundColor:i.colors.secondary,color:i.colors.text,border:`1px solid ${i.colors.border}`};case"success":return{backgroundColor:i.colors.success,color:i.colors.text,border:`1px solid ${i.colors.success}`};case"error":return{backgroundColor:i.colors.error,color:i.colors.text,border:`1px solid ${i.colors.error}`};case"ghost":return{backgroundColor:"transparent",color:i.colors.textSecondary,border:`1px solid ${i.colors.border}`};case"outline":{const y=o?.button?.backgroundColor||i.colors.primary,H=o?.button?.color||(b?"#ffffff":"#0e0d0b"),C=o?.button?.borderColor||(b?`${i.colors.primary}88`:"#0e0d0b"),R=s||a,me=b?"1px":"1.5px",he=o?.button?.disabledBackgroundColor||`${y}88`,ye=o?.button?.disabledColor||H;return{height:"56px",backgroundColor:R?he:S?`${y}cc`:h?`${y}ee`:y,color:R?ye:H,border:`${me} solid ${C}`,borderRadius:o?.button?.borderRadius||"12px",fontSize:"22px",fontWeight:500,fontFamily:'"IBM Plex Mono", monospace',opacity:R?.78:1,transform:R?"none":S?"scale(0.98)":h?"translateY(-2px)":"none",boxShadow:R?`3px 3px 0px ${O}, 4px 4px 0px ${C}`:S?`2px 2px 0px ${C}`:h?`5px 5px 0px ${O}, 6px 6px 0px ${C}`:`3px 3px 0px ${O}, 4px 4px 0px ${C}`,transition:"transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease, color 150ms ease"}}default:return{}}},pe=()=>{if(t==="outline")return{};switch(e){case"sm":return{padding:`${i.spacing.sm} ${i.spacing.md}`,fontSize:i.typography.fontSize.sm};case"md":return{padding:`${i.spacing.md} ${i.spacing.lg}`,fontSize:i.typography.fontSize.base};case"lg":return{padding:`${i.spacing.lg} ${i.spacing.xl}`,fontSize:i.typography.fontSize.lg};default:return{}}},fe={borderRadius:o?.button?.borderRadius||i.borderRadius.md,fontWeight:o?.button?.fontWeight||i.typography.fontWeight.medium,fontFamily:o?.button?.fontFamily||i.typography.fontFamily,fontSize:o?.button?.fontSize||void 0,transition:"background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease",cursor:s||a?"not-allowed":"pointer",opacity:(s||a)&&t!=="outline"?.6:1,width:r?"100%":"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:i.spacing.sm,...ue(),...pe(),...o?.button?.fontSize&&{fontSize:o.button.fontSize}},W=s||a;return ge("button",{type:l.type??"button","data-spiceflow-focus":!0,"aria-busy":a||void 0,"aria-disabled":W||void 0,style:{...fe,...d},className:c,disabled:W,onMouseEnter:y=>{$(!0),l.onMouseEnter?.(y)},onMouseLeave:y=>{$(!1),U(!1),l.onMouseLeave?.(y)},onMouseDown:y=>{U(!0),l.onMouseDown?.(y)},onMouseUp:y=>{U(!1),l.onMouseUp?.(y)},...l,children:[a&&v(le,{size:16}),n]})};export{nt as B,_e as C,te as R,le as S,X as _,je as a,Z as b,oe as c,D as d,ne as e,qe as f,E as g,Fe as h,ee as i,k as j,Le as k,Pe as l,ze as m,Ge as n,De as o,f as p,Qe as q,w as r,We as s,z as t,ce as u,Ve as v,ie as w,tt as x,rt as y};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),c=require("react"),t=require("./Button-Cs81k5Pq.js"),W=require("@dynamic-labs/sdk-react-core"),k=require("./providerWallet-QdrPrEd_.js");require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions");const q=({onAuthSuccess:a,onAuthError:r,theme:h="light",className:i="",buttonText:o="Login with Dynamic",autoTrigger:l=!1})=>{const s=t.createTheme(h),[m,D]=c.useState(!1),[g,S]=c.useState(!1),w=W.useDynamicContext(),{user:E,primaryWallet:f,connectedWallets:b,handleLogOut:C,setShowAuthFlow:x,sdkHasLoaded:p,showAuthFlow:j}=w,n=(k.getDynamicEmbeddedWallet({connectedWallets:b,primaryWallet:f})||f)?.address,v=!!E,d=v&&!!n;c.useEffect(()=>{D(!0)},[]),c.useEffect(()=>{d&&n&&a&&a(n)},[d,n,a]),c.useEffect(()=>{l&&p&&m&&!d&&!j&&!g&&(S(!0),x(!0))},[l,p,m,d,j,g,x]);const N=()=>{try{x(!0)}catch(y){const u=`Dynamic login failed: ${String(y)}`;r?r(u):console.error(u)}},L=async()=>{try{await C()}catch(y){const u=`Dynamic logout failed: ${String(y)}`;r?r(u):console.error(u)}};return m?p?v&&!n?e.jsx("div",{className:i,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(t.Spinner,{size:40,borderWidth:3,color:s.colors.primary}),e.jsx("p",{style:{color:s.colors.textMuted,fontSize:"14px"},children:"Finishing wallet setup..."})]})}):d&&n?e.jsx("div",{className:i,children:e.jsxs(t.Button,{variant:"primary",onClick:L,theme:s,children:["Logout (",n.slice(0,6),"...",n.slice(-4),")"]})}):l?e.jsx("div",{className:i,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(t.Spinner,{size:40,borderWidth:3,color:s.colors.primary}),e.jsx("p",{style:{color:s.colors.textMuted,fontSize:"14px"},children:"Opening login..."})]})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",onClick:N,theme:s,children:o})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",disabled:!0,theme:s,children:"Loading..."})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",disabled:!0,theme:s,children:o})})};class B extends c.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}const F=a=>{const{theme:r="light",className:h="",buttonText:i="Login with Dynamic",onAuthError:o}=a,l=t.createTheme(r);return e.jsx(B,{fallback:e.jsx("div",{className:h,children:e.jsx(t.Button,{variant:"primary",onClick:()=>{o&&o('DynamicLogin must be used within SpiceFlowProvider provider="dynamic" and a mounted DynamicContextProvider.')},theme:l,children:i})}),children:e.jsx(q,{...a})})};exports.DynamicLogin=F;
2
+ "use strict";const e=require("react/jsx-runtime"),c=require("react"),t=require("./Button-CpPbEdQV.js"),W=require("@dynamic-labs/sdk-react-core"),k=require("./providerWallet-Q1RM8u1X.js");require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions");const q=({onAuthSuccess:a,onAuthError:r,theme:h="light",className:i="",buttonText:o="Login with Dynamic",autoTrigger:l=!1})=>{const s=t.createTheme(h),[m,D]=c.useState(!1),[g,S]=c.useState(!1),w=W.useDynamicContext(),{user:E,primaryWallet:f,connectedWallets:b,handleLogOut:C,setShowAuthFlow:x,sdkHasLoaded:p,showAuthFlow:j}=w,n=(k.getDynamicEmbeddedWallet({connectedWallets:b,primaryWallet:f})||f)?.address,v=!!E,d=v&&!!n;c.useEffect(()=>{D(!0)},[]),c.useEffect(()=>{d&&n&&a&&a(n)},[d,n,a]),c.useEffect(()=>{l&&p&&m&&!d&&!j&&!g&&(S(!0),x(!0))},[l,p,m,d,j,g,x]);const N=()=>{try{x(!0)}catch(y){const u=`Dynamic login failed: ${String(y)}`;r?r(u):console.error(u)}},L=async()=>{try{await C()}catch(y){const u=`Dynamic logout failed: ${String(y)}`;r?r(u):console.error(u)}};return m?p?v&&!n?e.jsx("div",{className:i,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(t.Spinner,{size:40,borderWidth:3,color:s.colors.primary}),e.jsx("p",{style:{color:s.colors.textMuted,fontSize:"14px"},children:"Finishing wallet setup..."})]})}):d&&n?e.jsx("div",{className:i,children:e.jsxs(t.Button,{variant:"primary",onClick:L,theme:s,children:["Logout (",n.slice(0,6),"...",n.slice(-4),")"]})}):l?e.jsx("div",{className:i,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(t.Spinner,{size:40,borderWidth:3,color:s.colors.primary}),e.jsx("p",{style:{color:s.colors.textMuted,fontSize:"14px"},children:"Opening login..."})]})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",onClick:N,theme:s,children:o})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",disabled:!0,theme:s,children:"Loading..."})}):e.jsx("div",{className:i,children:e.jsx(t.Button,{variant:"primary",disabled:!0,theme:s,children:o})})};class B extends c.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}const F=a=>{const{theme:r="light",className:h="",buttonText:i="Login with Dynamic",onAuthError:o}=a,l=t.createTheme(r);return e.jsx(B,{fallback:e.jsx("div",{className:h,children:e.jsx(t.Button,{variant:"primary",onClick:()=>{o&&o('DynamicLogin must be used within SpiceFlowProvider provider="dynamic" and a mounted DynamicContextProvider.')},theme:l,children:i})}),children:e.jsx(q,{...a})})};exports.DynamicLogin=F;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as e,jsxs as g}from"react/jsx-runtime";import A,{useState as N,useEffect as f}from"react";import{B as d,c as S,S as b}from"./Button-CAv7hfnV.js";import{useDynamicContext as j}from"@dynamic-labs/sdk-react-core";import{g as z}from"./providerWallet-BC4uEdg8.js";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";const M=({onAuthSuccess:a,onAuthError:r,theme:m="light",className:t="",buttonText:o="Login with Dynamic",autoTrigger:s=!1})=>{const i=S(m),[h,C]=N(!1),[x,E]=N(!1),L=j(),{user:W,primaryWallet:v,connectedWallets:k,handleLogOut:F,setShowAuthFlow:p,sdkHasLoaded:u,showAuthFlow:D}=L,n=(z({connectedWallets:k,primaryWallet:v})||v)?.address,w=!!W,l=w&&!!n;return f(()=>{C(!0)},[]),f(()=>{l&&n&&a&&a(n)},[l,n,a]),f(()=>{s&&u&&h&&!l&&!D&&!x&&(E(!0),p(!0))},[s,u,h,l,D,x,p]),h?u?w&&!n?e("div",{className:t,children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e(b,{size:40,borderWidth:3,color:i.colors.primary}),e("p",{style:{color:i.colors.textMuted,fontSize:"14px"},children:"Finishing wallet setup..."})]})}):l&&n?e("div",{className:t,children:g(d,{variant:"primary",onClick:async()=>{try{await F()}catch(y){const c=`Dynamic logout failed: ${String(y)}`;r?r(c):console.error(c)}},theme:i,children:["Logout (",n.slice(0,6),"...",n.slice(-4),")"]})}):s?e("div",{className:t,children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e(b,{size:40,borderWidth:3,color:i.colors.primary}),e("p",{style:{color:i.colors.textMuted,fontSize:"14px"},children:"Opening login..."})]})}):e("div",{className:t,children:e(d,{variant:"primary",onClick:()=>{try{p(!0)}catch(y){const c=`Dynamic login failed: ${String(y)}`;r?r(c):console.error(c)}},theme:i,children:o})}):e("div",{className:t,children:e(d,{variant:"primary",disabled:!0,theme:i,children:"Loading..."})}):e("div",{className:t,children:e(d,{variant:"primary",disabled:!0,theme:i,children:o})})};class T extends A.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}const B=a=>{const{theme:r="light",className:m="",buttonText:t="Login with Dynamic",onAuthError:o}=a,s=S(r);return e(T,{fallback:e("div",{className:m,children:e(d,{variant:"primary",onClick:()=>{o&&o('DynamicLogin must be used within SpiceFlowProvider provider="dynamic" and a mounted DynamicContextProvider.')},theme:s,children:t})}),children:e(M,{...a})})};export{B as DynamicLogin};
2
+ import{jsx as e,jsxs as g}from"react/jsx-runtime";import A,{useState as N,useEffect as f}from"react";import{B as d,c as S,S as b}from"./Button-Dvhm0yVc.js";import{useDynamicContext as j}from"@dynamic-labs/sdk-react-core";import{g as z}from"./providerWallet-q8k_N1C_.js";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";const M=({onAuthSuccess:a,onAuthError:r,theme:m="light",className:t="",buttonText:o="Login with Dynamic",autoTrigger:s=!1})=>{const i=S(m),[h,C]=N(!1),[x,E]=N(!1),L=j(),{user:W,primaryWallet:v,connectedWallets:k,handleLogOut:F,setShowAuthFlow:p,sdkHasLoaded:u,showAuthFlow:D}=L,n=(z({connectedWallets:k,primaryWallet:v})||v)?.address,w=!!W,l=w&&!!n;return f(()=>{C(!0)},[]),f(()=>{l&&n&&a&&a(n)},[l,n,a]),f(()=>{s&&u&&h&&!l&&!D&&!x&&(E(!0),p(!0))},[s,u,h,l,D,x,p]),h?u?w&&!n?e("div",{className:t,children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e(b,{size:40,borderWidth:3,color:i.colors.primary}),e("p",{style:{color:i.colors.textMuted,fontSize:"14px"},children:"Finishing wallet setup..."})]})}):l&&n?e("div",{className:t,children:g(d,{variant:"primary",onClick:async()=>{try{await F()}catch(y){const c=`Dynamic logout failed: ${String(y)}`;r?r(c):console.error(c)}},theme:i,children:["Logout (",n.slice(0,6),"...",n.slice(-4),")"]})}):s?e("div",{className:t,children:g("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e(b,{size:40,borderWidth:3,color:i.colors.primary}),e("p",{style:{color:i.colors.textMuted,fontSize:"14px"},children:"Opening login..."})]})}):e("div",{className:t,children:e(d,{variant:"primary",onClick:()=>{try{p(!0)}catch(y){const c=`Dynamic login failed: ${String(y)}`;r?r(c):console.error(c)}},theme:i,children:o})}):e("div",{className:t,children:e(d,{variant:"primary",disabled:!0,theme:i,children:"Loading..."})}):e("div",{className:t,children:e(d,{variant:"primary",disabled:!0,theme:i,children:o})})};class T extends A.Component{constructor(r){super(r),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}render(){return this.state.hasError?this.props.fallback:this.props.children}}const B=a=>{const{theme:r="light",className:m="",buttonText:t="Login with Dynamic",onAuthError:o}=a,s=S(r);return e(T,{fallback:e("div",{className:m,children:e(d,{variant:"primary",onClick:()=>{o&&o('DynamicLogin must be used within SpiceFlowProvider provider="dynamic" and a mounted DynamicContextProvider.')},theme:s,children:t})}),children:e(M,{...a})})};export{B as DynamicLogin};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),o=require("react"),c=require("./Button-Cs81k5Pq.js"),f=require("@privy-io/react-auth");require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions");const S=({onAuthSuccess:d,onAuthError:a,theme:v="light",className:l="",buttonText:g="Login with Privy",autoTrigger:h=!1})=>{const u=c.createTheme(v),[m,j]=o.useState(!1),[x,p]=o.useState(!1),{ready:i,authenticated:n,user:r}=f.usePrivy(),{login:L}=f.useLogin(),{logout:b}=f.useLogout();o.useEffect(()=>{j(!0)},[]),o.useEffect(()=>{h&&i&&!n&&m&&!x&&(p(!0),y())},[h,i,n,m,x]),o.useEffect(()=>{if(i&&n&&r&&d){const t=r.wallet?.address||r.email?.address;t&&d(t)}},[i,n,r,d]),o.useEffect(()=>{},[i,n,a]);const y=()=>{try{L()}catch(t){const s=`Login failed: ${String(t)}`;a?a(s):console.error(s)}},q=()=>{try{b()}catch(t){const s=`Logout failed: ${String(t)}`;a?a(s):console.error(s)}};if(!m)return e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",disabled:!0,theme:u,children:g})});if(!i)return e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",disabled:!0,theme:u,children:"Loading..."})});if(n&&r){const t=r.wallet?.address||r.email?.address,s=t?`${t.slice(0,6)}...${t.slice(-4)}`:"Connected";return e.jsx("div",{className:l,children:e.jsxs(c.Button,{variant:"primary",onClick:q,theme:u,children:["Logout (",s,")"]})})}return h?e.jsx("div",{className:l,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(c.Spinner,{size:40,borderWidth:3,color:"#3b82f6"}),e.jsx("p",{style:{color:"#6b7280",fontSize:"14px"},children:"Opening login..."})]})}):e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",onClick:y,theme:u,children:g})})};exports.PrivyLogin=S;
2
+ "use strict";const e=require("react/jsx-runtime"),o=require("react"),c=require("./Button-CpPbEdQV.js"),f=require("@privy-io/react-auth");require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions");const S=({onAuthSuccess:d,onAuthError:a,theme:v="light",className:l="",buttonText:g="Login with Privy",autoTrigger:h=!1})=>{const u=c.createTheme(v),[m,j]=o.useState(!1),[x,p]=o.useState(!1),{ready:i,authenticated:n,user:r}=f.usePrivy(),{login:L}=f.useLogin(),{logout:b}=f.useLogout();o.useEffect(()=>{j(!0)},[]),o.useEffect(()=>{h&&i&&!n&&m&&!x&&(p(!0),y())},[h,i,n,m,x]),o.useEffect(()=>{if(i&&n&&r&&d){const t=r.wallet?.address||r.email?.address;t&&d(t)}},[i,n,r,d]),o.useEffect(()=>{},[i,n,a]);const y=()=>{try{L()}catch(t){const s=`Login failed: ${String(t)}`;a?a(s):console.error(s)}},q=()=>{try{b()}catch(t){const s=`Logout failed: ${String(t)}`;a?a(s):console.error(s)}};if(!m)return e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",disabled:!0,theme:u,children:g})});if(!i)return e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",disabled:!0,theme:u,children:"Loading..."})});if(n&&r){const t=r.wallet?.address||r.email?.address,s=t?`${t.slice(0,6)}...${t.slice(-4)}`:"Connected";return e.jsx("div",{className:l,children:e.jsxs(c.Button,{variant:"primary",onClick:q,theme:u,children:["Logout (",s,")"]})})}return h?e.jsx("div",{className:l,children:e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[e.jsx(c.Spinner,{size:40,borderWidth:3,color:"#3b82f6"}),e.jsx("p",{style:{color:"#6b7280",fontSize:"14px"},children:"Opening login..."})]})}):e.jsx("div",{className:l,children:e.jsx(c.Button,{variant:"primary",onClick:y,theme:u,children:g})})};exports.PrivyLogin=S;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{jsx as r,jsxs as y}from"react/jsx-runtime";import{useState as v,useEffect as c}from"react";import{B as d,c as P,S as $}from"./Button-CAv7hfnV.js";import{usePrivy as j,useLogin as w,useLogout as B}from"@privy-io/react-auth";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";const T=({onAuthSuccess:m,onAuthError:n,theme:x="light",className:a="",buttonText:g="Login with Privy",autoTrigger:u=!1})=>{const l=P(x),[h,L]=v(!1),[p,b]=v(!1),{ready:o,authenticated:s,user:t}=j(),{login:S}=w(),{logout:N}=B();c(()=>{L(!0)},[]),c(()=>{u&&o&&!s&&h&&!p&&(b(!0),f())},[u,o,s,h,p]),c(()=>{if(o&&s&&t&&m){const e=t.wallet?.address||t.email?.address;e&&m(e)}},[o,s,t,m]),c(()=>{},[o,s,n]);const f=()=>{try{S()}catch(e){const i=`Login failed: ${String(e)}`;n?n(i):console.error(i)}},C=()=>{try{N()}catch(e){const i=`Logout failed: ${String(e)}`;n?n(i):console.error(i)}};if(!h)return r("div",{className:a,children:r(d,{variant:"primary",disabled:!0,theme:l,children:g})});if(!o)return r("div",{className:a,children:r(d,{variant:"primary",disabled:!0,theme:l,children:"Loading..."})});if(s&&t){const e=t.wallet?.address||t.email?.address,i=e?`${e.slice(0,6)}...${e.slice(-4)}`:"Connected";return r("div",{className:a,children:y(d,{variant:"primary",onClick:C,theme:l,children:["Logout (",i,")"]})})}return u?r("div",{className:a,children:y("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[r($,{size:40,borderWidth:3,color:"#3b82f6"}),r("p",{style:{color:"#6b7280",fontSize:"14px"},children:"Opening login..."})]})}):r("div",{className:a,children:r(d,{variant:"primary",onClick:f,theme:l,children:g})})};export{T as PrivyLogin};
2
+ import{jsx as r,jsxs as y}from"react/jsx-runtime";import{useState as v,useEffect as c}from"react";import{B as d,c as P,S as $}from"./Button-Dvhm0yVc.js";import{usePrivy as j,useLogin as w,useLogout as B}from"@privy-io/react-auth";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";const T=({onAuthSuccess:m,onAuthError:n,theme:x="light",className:a="",buttonText:g="Login with Privy",autoTrigger:u=!1})=>{const l=P(x),[h,L]=v(!1),[p,b]=v(!1),{ready:o,authenticated:s,user:t}=j(),{login:S}=w(),{logout:N}=B();c(()=>{L(!0)},[]),c(()=>{u&&o&&!s&&h&&!p&&(b(!0),f())},[u,o,s,h,p]),c(()=>{if(o&&s&&t&&m){const e=t.wallet?.address||t.email?.address;e&&m(e)}},[o,s,t,m]),c(()=>{},[o,s,n]);const f=()=>{try{S()}catch(e){const i=`Login failed: ${String(e)}`;n?n(i):console.error(i)}},C=()=>{try{N()}catch(e){const i=`Logout failed: ${String(e)}`;n?n(i):console.error(i)}};if(!h)return r("div",{className:a,children:r(d,{variant:"primary",disabled:!0,theme:l,children:g})});if(!o)return r("div",{className:a,children:r(d,{variant:"primary",disabled:!0,theme:l,children:"Loading..."})});if(s&&t){const e=t.wallet?.address||t.email?.address,i=e?`${e.slice(0,6)}...${e.slice(-4)}`:"Connected";return r("div",{className:a,children:y(d,{variant:"primary",onClick:C,theme:l,children:["Logout (",i,")"]})})}return u?r("div",{className:a,children:y("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",padding:"20px",flexDirection:"column",gap:"12px"},children:[r($,{size:40,borderWidth:3,color:"#3b82f6"}),r("p",{style:{color:"#6b7280",fontSize:"14px"},children:"Opening login..."})]})}):r("div",{className:a,children:r(d,{variant:"primary",onClick:f,theme:l,children:g})})};export{T as PrivyLogin};
@@ -12,4 +12,12 @@ export interface DepositFeePreviewContext {
12
12
  depositQuote: DepositQuote;
13
13
  escrowOnly: boolean;
14
14
  }
15
+ export declare function estimateDepositMaxAmount(ctx: {
16
+ asset: Asset;
17
+ assetIndex: number;
18
+ selectedAssetCount: number;
19
+ address: Address | undefined;
20
+ escrowOnly: boolean;
21
+ isNon7702: boolean;
22
+ }): Promise<string | null>;
15
23
  export declare function quoteDepositGas(ctx: DepositFeePreviewContext): Promise<DepositFee>;
@@ -15,6 +15,7 @@ interface AssetChooserListProps {
15
15
  onAmountChange: (amount: string, index: number) => void;
16
16
  onAdd: () => void;
17
17
  onRemove: (index: number) => void;
18
+ resolveMaxAmount?: (asset: Asset, index: number) => string | null | Promise<string | null>;
18
19
  onViewAllAssets?: () => void;
19
20
  }
20
21
  export declare const AssetChooserList: React.FC<AssetChooserListProps>;
@@ -3,6 +3,7 @@ import { CustomStyles } from "../../../types/theme";
3
3
  interface ConnectWalletModalProps {
4
4
  isOpen: boolean;
5
5
  onClose: () => void;
6
+ closeOnBackdropClick?: boolean;
6
7
  onWalletSelect?: (walletId: string) => void;
7
8
  onContinue?: () => void;
8
9
  requiredChainId?: number;
@@ -1,6 +1,6 @@
1
1
  import type { Dispatch, SetStateAction } from "react";
2
2
  import { type Address } from "viem";
3
- import type { ChainBatch } from "../../../types/authorization";
3
+ import type { Authorization, ChainBatch } from "../../../types/authorization";
4
4
  import type { SelectedAsset } from "../../../types/assets";
5
5
  import type { LockDurationOption, SpiceLockModalProps } from "../../../types/lock";
6
6
  import type { FeePreview } from "../../../types/ui";
@@ -44,7 +44,7 @@ export type LockExecutorContext = {
44
44
  setShowStatusPanel: Dispatch<SetStateAction<boolean>>;
45
45
  };
46
46
  } & Pick<SpiceLockModalProps, "onLockExecute" | "onLockSuccess" | "buildSpicenetBatch">;
47
- export declare function run7702LockIntent(ctx: LockExecutorContext, batches: ChainBatch[]): Promise<void>;
47
+ export declare function run7702LockIntent(ctx: LockExecutorContext, batches: ChainBatch[], preSignedAuthorizations?: Authorization[]): Promise<void>;
48
48
  export declare function executeLock(ctx: LockExecutorContext): Promise<void>;
49
49
  export declare function executeDirectDeposit(ctx: LockExecutorContext): Promise<void>;
50
50
  export declare function executeSemi7702Lock(ctx: LockExecutorContext): Promise<void>;
@@ -13,7 +13,37 @@ export declare function waitForSpiceBalanceIncrease({ apiBaseUrl, user, chainId,
13
13
  pollIntervalMs?: number;
14
14
  }): Promise<void>;
15
15
  export declare function build7702EstimateRequest(user: Address, batches: ChainBatch[]): {
16
+ intents: {
17
+ mode: "7702";
18
+ signatureType: "ecdsa";
19
+ signature: `0x${string}`;
20
+ nbf: number;
21
+ exp: number;
22
+ chainBatches: {
23
+ hash: any;
24
+ chainId: any;
25
+ tokenTransfers: import("../../..").TokenTransferConfig[];
26
+ calls: any;
27
+ }[];
28
+ }[];
29
+ chainAuthorizations?: {
30
+ r: `0x${string}`;
31
+ s: `0x${string}`;
32
+ yParity: number;
33
+ address: Address;
34
+ chainId: number;
35
+ nonce: number;
36
+ }[] | undefined;
16
37
  user: `0x${string}`;
38
+ };
39
+ export declare function build7702EstimateRequestWithAuthorizations(user: Address, batches: ChainBatch[], chainAuthorizations?: Array<{
40
+ r: `0x${string}`;
41
+ s: `0x${string}`;
42
+ yParity: number;
43
+ address: Address;
44
+ chainId: number;
45
+ nonce: number;
46
+ }>): {
17
47
  intents: {
18
48
  mode: "7702";
19
49
  signatureType: "ecdsa";
@@ -27,5 +57,14 @@ export declare function build7702EstimateRequest(user: Address, batches: ChainBa
27
57
  calls: any;
28
58
  }[];
29
59
  }[];
60
+ chainAuthorizations?: {
61
+ r: `0x${string}`;
62
+ s: `0x${string}`;
63
+ yParity: number;
64
+ address: Address;
65
+ chainId: number;
66
+ nonce: number;
67
+ }[] | undefined;
68
+ user: `0x${string}`;
30
69
  };
31
70
  export declare function withSpicenetFundingBatch(batches: ChainBatch[], userAddress: Address, feeEstimate?: FeeEstimateSummary): ChainBatch[];
@@ -2,7 +2,7 @@ import { type Address } from "viem";
2
2
  import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
3
3
  import type { FeePreview } from "../../../types/ui";
4
4
  import type { ChainBatch } from "../../../types/authorization";
5
- import type { SelectedAsset } from "../../../types/assets";
5
+ import type { Asset, SelectedAsset } from "../../../types/assets";
6
6
  import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
7
7
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
8
8
  import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
@@ -11,6 +11,18 @@ type EstimateGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, toke
11
11
  type BuildPayBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
12
12
  type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
13
13
  type EstimateRequiredGrossFundingFn = (requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, gaslessOptions?: Pick<GaslessExecutionOptions, "useCustomTransfers" | "userOverride">) => Promise<bigint>;
14
+ export declare function estimateSupplyMaxAmount(ctx: {
15
+ asset: Asset;
16
+ isPayMode: boolean;
17
+ isNon7702: boolean;
18
+ needsSwap: boolean;
19
+ isQuoting: boolean;
20
+ embeddedWalletAddress: string | null | undefined;
21
+ buildSupplyChainBatches: BuildSupplyBatchesFn;
22
+ estimateGasless: EstimateGaslessFn;
23
+ executionTokenAddress: Address;
24
+ feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
25
+ }): Promise<string | null>;
14
26
  export interface FeePreviewContext {
15
27
  selectedAsset: SelectedAsset | null;
16
28
  isPayMode: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { Dispatch, MutableRefObject, SetStateAction } from "react";
2
2
  import type { GaslessRunner } from "../../../execution/gasless";
3
- import type { DestinationToken, SpiceWithdrawProps } from "../../../types/withdraw";
3
+ import type { DestinationToken, SpiceWithdrawDeliveryTransfer, SpiceWithdrawProps } from "../../../types/withdraw";
4
4
  import type { ChainBatch } from "../../../types/authorization";
5
5
  import type { GaslessProgress } from "../../../hooks/useSpiceExecution";
6
6
  export type WithdrawalExecutionContext = {
@@ -19,7 +19,7 @@ export type WithdrawExecutorContext = {
19
19
  receiveAmountRaw: bigint;
20
20
  gasFee: bigint | null;
21
21
  isNon7702: boolean;
22
- buildWithdrawBatches: (spicenetFundingAmount?: bigint) => ChainBatch[];
22
+ buildWithdrawBatches: (withdrawalTransfersOrAmount?: bigint | SpiceWithdrawDeliveryTransfer[]) => ChainBatch[];
23
23
  gasless: GaslessRunner;
24
24
  ui: {
25
25
  setIsExecuting: Dispatch<SetStateAction<boolean>>;
@@ -0,0 +1,8 @@
1
+ import type { Address } from "viem";
2
+ import type { GaslessRunner } from "../../../execution/gasless";
3
+ import type { ChainBatch } from "../../../types/authorization";
4
+ export declare function estimateWithdrawGasFee(ctx: {
5
+ batches: ChainBatch[];
6
+ tokenAddress: Address;
7
+ estimateGasless: GaslessRunner["estimateGasless"];
8
+ }): Promise<bigint>;
@@ -1,6 +1,8 @@
1
1
  import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
2
+ import type { ChainBatch } from "../../../types/authorization";
2
3
  export declare function normalizeTokenLabel(value?: string | null): string;
3
4
  export declare function formatTokenAmount(rawAmount: bigint, decimals: number): string;
4
5
  export declare function scaleAmountBetweenDecimals(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
5
6
  export declare function estimateUsd(amount: number, symbol?: string): string;
7
+ export declare function buildWithdrawFeeEstimateKey(batches: ChainBatch[], tokenAddress?: string | null): string | null;
6
8
  export declare function getFeeAdjustedWithdrawFunding(feeEstimate: FeeEstimateSummary, fallbackChainId: number): bigint | null;
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ type AmountOverflow = "ellipsis" | "wrap" | "visible";
3
+ type AmountElement = "input" | "span" | "div";
4
+ type AmountTextProps = {
5
+ value: string;
6
+ element?: AmountElement;
7
+ placeholder?: string;
8
+ ariaLabel?: string;
9
+ ariaInvalid?: boolean;
10
+ disabled?: boolean;
11
+ onChange?: React.ChangeEventHandler<HTMLInputElement>;
12
+ inputMode?: React.HTMLAttributes<HTMLInputElement>["inputMode"];
13
+ autoComplete?: string;
14
+ dataSpiceflowFocus?: boolean;
15
+ fontFamily?: string;
16
+ fontWeight?: React.CSSProperties["fontWeight"];
17
+ color?: string;
18
+ textAlign?: React.CSSProperties["textAlign"];
19
+ lineHeight?: React.CSSProperties["lineHeight"];
20
+ maxFontSize?: number;
21
+ minFontSize?: number;
22
+ overflow?: AmountOverflow;
23
+ title?: string;
24
+ style?: React.CSSProperties;
25
+ };
26
+ export declare function getAmountTextFontSize(value: string, maxFontSize?: number, minFontSize?: number): number;
27
+ export declare const AmountText: React.FC<AmountTextProps>;
28
+ export {};
@@ -5,6 +5,7 @@ export { Spinner } from "./Spinner";
5
5
  export { StatusBanner } from "./StatusBanner";
6
6
  export { DetailRow } from "./DetailRow";
7
7
  export { AddFundsLink } from "./AddFundsLink";
8
+ export { AmountText, getAmountTextFontSize } from "./AmountText";
8
9
  export { CloseIcon } from "./CloseIcon";
9
10
  export { SearchInput } from "./SearchInput";
10
11
  export type { SearchInputProps } from "./SearchInput";
@@ -23,6 +23,12 @@ export interface GaslessExecutionOptions {
23
23
  userOverride?: Address;
24
24
  signAuthorizationsForEstimate?: boolean;
25
25
  feeExecutionMode?: "backend-transfer" | "user-transfer";
26
+ adjustBatchesForEstimate?: (args: {
27
+ feeEstimate: FeeEstimateSummary;
28
+ chainBatches: ChainBatch[];
29
+ }) => ChainBatch[] | null;
30
+ skipPreSubmitFeeEstimate?: boolean;
31
+ submittedFeeEstimate?: FeeEstimateSummary;
26
32
  }
27
33
  export declare function useSpiceExecution(): {
28
34
  executeGasless: (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, onProgress?: OnProgress, signal?: AbortSignal, options?: GaslessExecutionOptions) => Promise<string>;
@@ -5,6 +5,7 @@ export interface UseStatusConfig {
5
5
  data: {
6
6
  status: "created" | "executing" | "success" | "reverted" | "error";
7
7
  transactionHash?: string;
8
+ error?: string;
8
9
  };
9
10
  }>;
10
11
  pollingInterval?: number;