@spicenet-io/spiceflow-ui 3.3.6 → 3.3.7

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 (77) hide show
  1. package/dist/Button-CkSwrat1.js +2 -0
  2. package/dist/Button-jx5yrM-s.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/AccountDisplay/{parts/AccountCustomSection.d.ts → AccountCustomSection.d.ts} +2 -2
  8. package/dist/components/AccountDisplay/{parts/AccountHeader.d.ts → AccountHeader.d.ts} +1 -1
  9. package/dist/components/AccountDisplay/{parts/AccountIdleBalances.d.ts → AccountIdleBalances.d.ts} +2 -2
  10. package/dist/components/AccountDisplay/{parts/AccountPanel.d.ts → AccountPanel.d.ts} +3 -3
  11. package/dist/components/AccountDisplay/{parts/AccountPendingDeposits.d.ts → AccountPendingDeposits.d.ts} +2 -2
  12. package/dist/components/AccountDisplay/types.d.ts +0 -1
  13. package/dist/components/AssetSelector/{parts/AssetDropdown.d.ts → AssetDropdown.d.ts} +1 -1
  14. package/dist/components/AssetSelector/{parts/ChainIcon.d.ts → ChainIcon.d.ts} +1 -1
  15. package/dist/components/AssetSelector/{parts/TokenIcon.d.ts → TokenIcon.d.ts} +1 -1
  16. package/dist/components/AssetSelector/index.d.ts +3 -3
  17. package/dist/components/ProviderLogins/{parts/DynamicLogin.d.ts → DynamicLogin.d.ts} +1 -1
  18. package/dist/components/ProviderLogins/{parts/PrivyLogin.d.ts → PrivyLogin.d.ts} +1 -1
  19. package/dist/components/ProviderLogins/index.d.ts +2 -4
  20. package/dist/components/SpiceBalance/index.d.ts +2 -2
  21. package/dist/components/SpiceDeposit/{steps/ConnectWalletModal.d.ts → ConnectWalletModal.d.ts} +1 -1
  22. package/dist/components/SpiceDeposit/{steps/DepositModal.d.ts → DepositModal.d.ts} +1 -1
  23. package/dist/components/SpiceDeposit/{steps/DepositRecoveryPrompt.d.ts → DepositRecoveryPrompt.d.ts} +1 -1
  24. package/dist/components/SpiceDeposit/{steps/DepositStatusModal.d.ts → DepositStatusModal.d.ts} +3 -3
  25. package/dist/components/SpiceDeposit/{steps/SelectChainModal.d.ts → SelectChainModal.d.ts} +1 -1
  26. package/dist/components/SpiceDeposit/{steps/SelectTokenModal.d.ts → SelectTokenModal.d.ts} +1 -1
  27. package/dist/components/SpiceDeposit/{lib/depositBatches.d.ts → depositBatches.d.ts} +3 -3
  28. package/dist/components/SpiceDeposit/{lib/executors.d.ts → executors.d.ts} +3 -3
  29. package/dist/components/SpiceDeposit/{lib/feePreview.d.ts → feePreview.d.ts} +1 -1
  30. package/dist/components/SpiceDeposit/index.d.ts +3 -3
  31. package/dist/components/SpiceDeposit/views/DepositSubtitle.d.ts +9 -0
  32. package/dist/components/SpiceLock/{parts/LockConfirmationPanel.d.ts → LockConfirmationPanel.d.ts} +1 -1
  33. package/dist/components/SpiceLock/{parts/LockDurationSlider.d.ts → LockDurationSlider.d.ts} +1 -1
  34. package/dist/components/SpiceLock/{parts/LockExpiryRow.d.ts → LockExpiryRow.d.ts} +1 -1
  35. package/dist/components/SpiceLock/{parts/VotingPowerRow.d.ts → VotingPowerRow.d.ts} +1 -1
  36. package/dist/components/SpiceLock/{lib/executors.d.ts → executors.d.ts} +14 -13
  37. package/dist/components/SpiceLock/{lib/helpers.d.ts → helpers.d.ts} +2 -2
  38. package/dist/components/SpiceSupply/{parts/DestinationEstimate.d.ts → DestinationEstimate.d.ts} +2 -2
  39. package/dist/components/SpiceSupply/{parts/SupplyEstimate.d.ts → SupplyEstimate.d.ts} +1 -1
  40. package/dist/components/SpiceSupply/{lib/buildBatches.d.ts → buildBatches.d.ts} +10 -8
  41. package/dist/components/SpiceSupply/executors.d.ts +73 -0
  42. package/dist/components/SpiceSupply/{lib/feePreview.d.ts → feePreview.d.ts} +11 -9
  43. package/dist/components/SpiceWithdraw/{parts/SelectPopover.d.ts → SelectPopover.d.ts} +1 -1
  44. package/dist/components/SpiceWithdraw/executors.d.ts +50 -0
  45. package/dist/components/StatusDisplay/{parts/StatusIcon.d.ts → StatusIcon.d.ts} +1 -1
  46. package/dist/components/StatusDisplay/{parts/StatusPanel.d.ts → StatusPanel.d.ts} +1 -1
  47. package/dist/components/StatusDisplay/{parts/StepItem.d.ts → StepItem.d.ts} +1 -1
  48. package/dist/components/StatusDisplay/index.d.ts +2 -3
  49. package/dist/hooks/useSpiceExecution.d.ts +0 -1
  50. package/dist/index.cjs.js +14 -14
  51. package/dist/index.d.ts +1 -2
  52. package/dist/index.js +14 -14
  53. package/dist/{providerWallet-Ddncx8s5.js → providerWallet-6FpyLYqw.js} +1 -1
  54. package/dist/{providerWallet-B7SytehJ.js → providerWallet-Ds1PM0vC.js} +1 -1
  55. package/dist/providers/SpiceFlowProvider.d.ts +2 -0
  56. package/dist/providers/dynamic.d.ts +2 -2
  57. package/dist/providers/privy.d.ts +2 -2
  58. package/dist/types/deposit.d.ts +0 -3
  59. package/dist/types/lock.d.ts +0 -2
  60. package/dist/types/supply.d.ts +0 -15
  61. package/dist/types/withdraw.d.ts +0 -1
  62. package/package.json +2 -2
  63. package/dist/Button-E8Ln6miF.js +0 -2
  64. package/dist/Button-RzLL2mKv.js +0 -2
  65. package/dist/components/SpiceSupply/lib/executors.d.ts +0 -67
  66. package/dist/components/SpiceWithdraw/lib/executors.d.ts +0 -34
  67. package/dist/execution/gasless.d.ts +0 -7
  68. package/dist/execution/pollIntentStep.d.ts +0 -28
  69. package/dist/utils/spiceConstants.d.ts +0 -3
  70. /package/dist/components/AccountDisplay/{parts/AccountActions.d.ts → AccountActions.d.ts} +0 -0
  71. /package/dist/components/SpiceBalance/{parts/AccountItem.d.ts → AccountItem.d.ts} +0 -0
  72. /package/dist/components/SpiceBalance/{parts/BalanceSection.d.ts → BalanceSection.d.ts} +0 -0
  73. /package/dist/components/SpiceDeposit/{parts/ModalHeader.d.ts → ModalHeader.d.ts} +0 -0
  74. /package/dist/components/SpiceDeposit/{parts/DepositAssetChooser.d.ts → views/AssetChooserList.d.ts} +0 -0
  75. /package/dist/components/SpiceWithdraw/{lib/helpers.d.ts → helpers.d.ts} +0 -0
  76. /package/dist/components/SpiceWithdraw/{parts/WithdrawBalancePopover.d.ts → views/BalancePopover.d.ts} +0 -0
  77. /package/dist/components/SpiceWithdraw/{parts → views}/WithdrawDetailsPanel.d.ts +0 -0
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ "use strict";const T=require("react/jsx-runtime"),y=require("react"),w=require("@spicenet-io/spiceflow-core"),b=require("viem"),ue=require("viem/actions");function I(t,e){return!t||!e?!1:b.isAddress(t)&&b.isAddress(e)?b.getAddress(t)===b.getAddress(e):t.toLowerCase()===e.toLowerCase()}const W=[{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"}],pe="0xcA11bde05977b3631167028862bE2a173976CA11",fe={4114:"0x860aFc632a6D625B95d8B96f39ECC48E988c6962"},me=new Set([5115]);function he(t){const e=fe[t.id]??(me.has(t.id)?void 0:pe);return b.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],N=Object.fromEntries(ge.map(t=>w.getChainMeta(t)).filter(t=>t!=null).map(t=>[t.id,{...t,viemChain:he(t),supportedTokens:w.getTokensForChain(t.id)}])),ye=N;let J={};const M=new Map,H=t=>{J={...t||{}},M.clear()},P=t=>{const e=J[t];return e&&typeof e=="string"&&e.length>0?e:N[t]?.rpcUrl},S=t=>N[t],_=t=>{const e=w.getChainMeta(t);return e?.displayName||e?.name||`Chain ${t}`},be=t=>{const e=w.getDelegateContract(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);return e},we=(t,e,a)=>{const r=S(t);return r?.blockExplorer?`${r.blockExplorer}/tx/${e}`:"#"};async function xe(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=S(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 Y=t=>{const e=S(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=b.createPublicClient({chain:e.viemChain,transport:b.http(a,{timeout:15e3,retryCount:2,retryDelay:300}),batch:{multicall:{wait:16}}});return M.set(r,n),n},Be=()=>{const t={};return Object.values(N).forEach(e=>{t[e.id]={name:e.name,moralisName:e.moralisId||"",chain:e.viemChain,rpcUrl:P(e.id)||e.rpcUrl}}),t},Ee=(t,e=[])=>{const a=S(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:w.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&&w.isNativeToken(n.address))return;const c=e.find(d=>d.chainId===t&&I(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},Ce=async(t,e)=>{const a=S(t);if(!a)throw new Error(`Unsupported chain ID: ${t}`);const r=e.toLowerCase();if(w.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=>I(n.address,r));if(s)return s.decimals}try{if(!b.isAddress(e,{strict:!1}))throw new Error(`Invalid token address: ${e}`);const s=b.getAddress(e),n=Y(t),c=await ue.readContract(n,{address:s,abi:W,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 L(t){return t instanceof f}const Se=["user rejected","user denied","user cancelled","rejected the request","action_rejected","4001"];function q(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 G=t=>{if(L(t))return t.code==="WALLET_REJECTED";const e=q(t).toLowerCase();return Se.some(a=>e.includes(a))},$e=(t,e="Something went wrong. Please try again.")=>G(t)?"Transaction was rejected.":L(t)?t.message||e:q(t)||e;function Re(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),p=BigInt(s);let o;for(const m of t.intents){const $=m.chainBatches.find(R=>R.chainId===c);if($){o=$;break}}const u=o?.tokenTransfers.find(m=>m.from==="escrow"&&I(m.to,t.user)&&!w.isNativeToken(m.token)),l=_(c);if(!u)return`Amount is too small to cover the estimated fee on ${l}.`;const h=w.getTokenByAddress(u.token,c),E=h?.decimals??18,C=h?.symbol??"tokens",i=b.formatUnits(d,E),x=b.formatUnits(p,E);return`Amount is too small to cover the estimated fee on ${l}. Amount: ${i} ${C}. Estimated fee: ${x} ${C}.`}const X=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io";function U(t,e){return typeof e=="bigint"?e.toString():e}class ve{constructor(){this.baseUrl=X}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,U)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",s.error?.message||`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,U)}),s=await r.json();if(!r.ok||!s.success||!s.data?.feeEstimate){const n=s.error?.message||`Relayer fee estimate error: ${r.status}`;throw new f("RELAYER_ERROR",Re(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,U)}),s=await r.json();if(!r.ok||!s.success||!s.data?.gasFee)throw new f("RELAYER_ERROR",s.error?.message||`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,p=new Promise((l,h)=>setTimeout(()=>h(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)}),p]),u=await o.json();if(!o.ok||u.success===!1)throw new f("RELAYER_EXECUTE_ERROR",u.error?.message||`Execute step error: ${o.status}`,{httpStatus:o.status,responseBody:JSON.stringify(u),endpoint:c,actionId:e});if(u?.status==="error"||u?.status==="reverted"){const l=u?.error?`: ${u.error}`:"";throw new f("RELAYER_EXECUTE_ERROR",`Step ${r} previously ${u.status}${l}`,{httpStatus:o.status,responseBody:JSON.stringify(u),endpoint:c,actionId:e,intentIndex:a,stepIndex:r,stepStatus:u.status})}return{success:!0,transactionHash:u.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),p=await d.json();if(!d.ok||p.success===!1)throw new f("RELAYER_STATUS_ERROR",p.error?.message||`Intent step status check failed: ${d.status}`,{httpStatus:d.status,responseBody:JSON.stringify(p),endpoint:c,intentId:e});return{success:!0,data:{status:p.status==="error"?"reverted":p.status,transactionHash:p.txid}}}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",n.error?.message||`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",s.error?.message||`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,U)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",s.error?.message||`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",s.error?.message||`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",r.error?.message||`Get rollup timestamp error: ${a.status}`,{httpStatus:a.status,responseBody:JSON.stringify(r),endpoint:"/time"});return r}}const B=new ve,j=new Map;async function ke(t,e){const a=t.toLowerCase(),r=j.get(a);if(r)return r;const s=(async()=>{try{await B.getWallet(t);return}catch{}const{unix_timestamp:n}=await B.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),p=typeof d=="string"?d:d.signature;if(!p)throw new Error("Wallet returned no smart wallet signature");await B.createWallet(t,{timestamp:n,signature:p})})();j.set(a,s);try{await s}finally{j.delete(a)}}const Te=(t,e)=>{const a=s=>e?e(s):_(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},Q="spiceflow-mode",V=()=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(Q);return t==="embedded"?"7702":t==="external"?"ondemand":null}catch{return null}},Ie=t=>{if(!(typeof window>"u"))try{window.localStorage.setItem(Q,t==="7702"?"embedded":"external")}catch{}},Ne=()=>V()!==null,Z=y.createContext(null),K=y.createContext(null),Ue=({children:t,provider:e,supportedChainIds:a,allowedTokens:r,network:s="testnet",mode:n="7702",skipFlow:c=[],nativeChainId:d,appName:p="Spicenet",apiUrl:o,theme:u,rpcOverrides:l})=>{y.useEffect(()=>{if(!o)return;const m=B.getBaseUrl();return B.setBaseUrl(o),()=>B.setBaseUrl(m)},[o]),y.useEffect(()=>(H(l),()=>H(void 0)),[l]);const h=a??w.getChainIdsByNetwork(s),E=u??null,[C,i]=y.useState(()=>V()??n),x=y.useCallback(m=>{i(m),Ie(m)},[]);return T.jsx(Z.Provider,{value:E,children:T.jsx(K.Provider,{value:{provider:e,supportedChainIds:h,allowedTokens:r,skipFlow:c,mode:C,setMode:x,network:s,nativeChainId:d,appName:p,apiUrl:o,rpcOverrides:l},children:t})})},Ae={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"}},Oe={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"},ee=(t="light")=>({mode:t,...Ae,colors:t==="light"?Oe:Fe});function A(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??A(e?.shell??"#141414",.35),shellInnerBorder:e?.shellInnerBorder??A(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 te(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:A(n,r?.35:.085),shellInnerBorder:A(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 _e='"IBM Plex Mono", monospace';function re(t,e){const a=y.useContext(Z)??void 0;return y.useMemo(()=>{const r=a??{primaryColor:"#EA4B4B"},s={...t?.primaryColor?{primaryColor:t.primaryColor}:{},...t?.fontFamily?{fontFamily:t.fontFamily}:{},...e!==void 0?{dark:e}:{}},n=te(r,s),{dark:c,primaryColor:d,appName:p}=n,o=ee(c?"dark":"light"),u={...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},h=t?.inputVariant?t.inputVariant==="dark":c;return{brand:a,theme:u,dark:c,appName:p,primaryColor:d,dk:l,palette:l,fontFamily:n.fontFamily,monoFont:_e,inputDark:h,cardBg:h?l.cardBg:"#E9E9E9",cardBorder:h?l.cardBorder:"#C6C6C6",textPrimary:l.textPrimary,textSecondary:l.textSecondary,subtitleText:h?l.textSecondary:"#979AA0"}},[a,t,e])}const ae="spiceflow-spinner-keyframes";function Le(){if(typeof document>"u"||document.getElementById(ae))return;const t=document.createElement("style");t.id=ae,t.textContent="@keyframes spiceflow-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",document.head.appendChild(t)}const se=({size:t=16,borderWidth:e=2,color:a="currentColor",style:r})=>{const s=y.useRef(!1);return y.useEffect(()=>{s.current||(Le(),s.current=!0)},[]),T.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}})},je=({variant:t="primary",size:e="md",loading:a=!1,fullWidth:r=!1,disabled:s,children:n,className:c="",style:d,theme:p,styles:o,dark:u,...l})=>{const{theme:h,dark:E,palette:C}=re(o,u),i=p||h,x=u??E,[m,$]=y.useState(!1),[R,O]=y.useState(!1),F=x?C.shell:"white",ne=()=>{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 g=o?.button?.backgroundColor||i.colors.primary,z=o?.button?.color||(x?"#ffffff":"#0e0d0b"),v=o?.button?.borderColor||(x?`${i.colors.primary}88`:"#0e0d0b"),k=s||a,ce=x?"1px":"1.5px",de=o?.button?.disabledBackgroundColor||`${g}88`,le=o?.button?.disabledColor||z;return{height:"56px",backgroundColor:k?de:R?`${g}cc`:m?`${g}ee`:g,color:k?le:z,border:`${ce} solid ${v}`,borderRadius:o?.button?.borderRadius||"12px",fontSize:"22px",fontWeight:500,fontFamily:'"IBM Plex Mono", monospace',opacity:k?.78:1,transform:k?"none":R?"scale(0.98)":m?"translateY(-2px)":"none",boxShadow:k?`3px 3px 0px ${F}, 4px 4px 0px ${v}`:R?`2px 2px 0px ${v}`:m?`5px 5px 0px ${F}, 6px 6px 0px ${v}`:`3px 3px 0px ${F}, 4px 4px 0px ${v}`,transition:"transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease, color 150ms ease"}}default:return{}}},oe=()=>{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{}}},ie={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,...ne(),...oe(),...o?.button?.fontSize&&{fontSize:o.button.fontSize}},D=s||a;return T.jsxs("button",{type:l.type??"button","data-spiceflow-focus":!0,"aria-busy":a||void 0,"aria-disabled":D||void 0,style:{...ie,...d},className:c,disabled:D,onMouseEnter:g=>{$(!0),l.onMouseEnter?.(g)},onMouseLeave:g=>{$(!1),O(!1),l.onMouseLeave?.(g)},onMouseDown:g=>{O(!0),l.onMouseDown?.(g)},onMouseUp:g=>{O(!1),l.onMouseUp?.(g)},...l,children:[a&&T.jsx(se,{size:16}),n]})};exports.Button=je,exports.CHAIN_CONFIGS=ye,exports.RELAYER_API_URL=X,exports.SpiceFlowProvider=Ue,exports.SpiceFlowProviderContext=K,exports.SpiceflowError=f,exports.Spinner=se,exports.addressesEqual=I,exports.buildDarkPalette=Me,exports.buildLightPalette=Pe,exports.createInitialSteps=Te,exports.createTheme=ee,exports.ensureSmartWallet=ke,exports.ensureWalletOnChain=xe,exports.getAllAssetsForChain=Ee,exports.getChainConfig=S,exports.getChainName=_,exports.getChainsForAssets=Be,exports.getClientForChain=Y,exports.getDelegateContractAddress=be,exports.getExplorerUrl=we,exports.getTokenDecimals=Ce,exports.hasStoredSpiceFlowMode=Ne,exports.isSpiceflowError=L,exports.isUserRejection=G,exports.relayerService=B,exports.resolveTheme=te,exports.sanitizeError=$e,exports.useSpiceBrand=re,exports.z=W;
@@ -0,0 +1,2 @@
1
+ "use client";
2
+ import{jsx as R,jsxs as ye}from"react/jsx-runtime";import{createContext as H,useEffect as O,useState as A,useCallback as ge,useContext as be,useMemo as we,useRef as xe}from"react";import{getChainMeta as Y,getTokensForChain as Be,getDelegateContract as Ee,ZERO_ADDRESS as $e,isNativeToken as M,getTokenByAddress as Se,getChainIdsByNetwork as Ce}from"@spicenet-io/spiceflow-core";import{isAddress as _,getAddress as P,defineChain as Re,createPublicClient as ve,http as ke,formatUnits as q}from"viem";import{readContract as Te}from"viem/actions";function v(t,e){return!t||!e?!1:_(t)&&_(e)?P(t)===P(e):t.toLowerCase()===e.toLowerCase()}const G=[{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"}],Ie="0xcA11bde05977b3631167028862bE2a173976CA11",Ne={4114:"0x860aFc632a6D625B95d8B96f39ECC48E988c6962"},Ue=new Set([5115]);function Oe(t){const e=Ne[t.id]??(Ue.has(t.id)?void 0:Ie);return Re({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 Ae=[1,8453,42161,4114,11155111,421614,84532,5115,123420001114,688688,688689],k=Object.fromEntries(Ae.map(t=>Y(t)).filter(t=>t!=null).map(t=>[t.id,{...t,viemChain:Oe(t),supportedTokens:Be(t.id)}])),Me=k;let X={};const F=new Map,Q=t=>{X={...t||{}},F.clear()},L=t=>{const e=X[t];return e&&typeof e=="string"&&e.length>0?e:k[t]?.rpcUrl},B=t=>k[t],j=t=>{const e=Y(t);return e?.displayName||e?.name||`Chain ${t}`},_e=t=>{const e=Ee(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);return e},Pe=(t,e,a)=>{const r=B(t);return r?.blockExplorer?`${r.blockExplorer}/tx/${e}`:"#"};async function Fe(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=B(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:[L(e)||r.rpcUrl],blockExplorerUrls:r.blockExplorer?[r.blockExplorer]:void 0}]})}const V=t=>{const e=B(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);const a=L(t);if(!a)throw new Error(`No RPC URL configured for chain ID: ${t}`);const r=`${t}:${a}`,s=F.get(r);if(s)return s;const n=ve({chain:e.viemChain,transport:ke(a,{timeout:15e3,retryCount:2,retryDelay:300}),batch:{multicall:{wait:16}}});return F.set(r,n),n},Le=()=>{const t={};return Object.values(k).forEach(e=>{t[e.id]={name:e.name,moralisName:e.moralisId||"",chain:e.viemChain,rpcUrl:L(e.id)||e.rpcUrl}}),t},je=(t,e=[])=>{const a=B(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:$e,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&&M(n.address))return;const c=e.find(d=>d.chainId===t&&v(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},De=async(t,e)=>{const a=B(t);if(!a)throw new Error(`Unsupported chain ID: ${t}`);const r=e.toLowerCase();if(M(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=>v(n.address,r));if(s)return s.decimals}try{if(!_(e,{strict:!1}))throw new Error(`Invalid token address: ${e}`);const s=P(e),n=V(t),c=await Te(n,{address:s,abi:G,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 D(t){return t instanceof f}const ze=["user rejected","user denied","user cancelled","rejected the request","action_rejected","4001"];function Z(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 K=t=>{if(D(t))return t.code==="WALLET_REJECTED";const e=Z(t).toLowerCase();return ze.some(a=>e.includes(a))},Je=(t,e="Something went wrong. Please try again.")=>K(t)?"Transaction was rejected.":D(t)?t.message||e:Z(t)||e;function We(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),p=BigInt(s);let o;for(const m of t.intents){const E=m.chainBatches.find($=>$.chainId===c);if(E){o=E;break}}const u=o?.tokenTransfers.find(m=>m.from==="escrow"&&v(m.to,t.user)&&!M(m.token)),l=j(c);if(!u)return`Amount is too small to cover the estimated fee on ${l}.`;const h=Se(u.token,c),w=h?.decimals??18,x=h?.symbol??"tokens",i=q(d,w),g=q(p,w);return`Amount is too small to cover the estimated fee on ${l}. Amount: ${i} ${x}. Estimated fee: ${g} ${x}.`}const ee=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io";function T(t,e){return typeof e=="bigint"?e.toString():e}class He{constructor(){this.baseUrl=ee}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,T)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",s.error?.message||`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,T)}),s=await r.json();if(!r.ok||!s.success||!s.data?.feeEstimate){const n=s.error?.message||`Relayer fee estimate error: ${r.status}`;throw new f("RELAYER_ERROR",We(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,T)}),s=await r.json();if(!r.ok||!s.success||!s.data?.gasFee)throw new f("RELAYER_ERROR",s.error?.message||`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,p=new Promise((l,h)=>setTimeout(()=>h(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)}),p]),u=await o.json();if(!o.ok||u.success===!1)throw new f("RELAYER_EXECUTE_ERROR",u.error?.message||`Execute step error: ${o.status}`,{httpStatus:o.status,responseBody:JSON.stringify(u),endpoint:c,actionId:e});if(u?.status==="error"||u?.status==="reverted"){const l=u?.error?`: ${u.error}`:"";throw new f("RELAYER_EXECUTE_ERROR",`Step ${r} previously ${u.status}${l}`,{httpStatus:o.status,responseBody:JSON.stringify(u),endpoint:c,actionId:e,intentIndex:a,stepIndex:r,stepStatus:u.status})}return{success:!0,transactionHash:u.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),p=await d.json();if(!d.ok||p.success===!1)throw new f("RELAYER_STATUS_ERROR",p.error?.message||`Intent step status check failed: ${d.status}`,{httpStatus:d.status,responseBody:JSON.stringify(p),endpoint:c,intentId:e});return{success:!0,data:{status:p.status==="error"?"reverted":p.status,transactionHash:p.txid}}}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",n.error?.message||`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",s.error?.message||`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,T)}),s=await r.json();if(!r.ok||s.success===!1)throw new f("RELAYER_ERROR",s.error?.message||`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",s.error?.message||`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",r.error?.message||`Get rollup timestamp error: ${a.status}`,{httpStatus:a.status,responseBody:JSON.stringify(r),endpoint:"/time"});return r}}const b=new He,z=new Map;async function Ye(t,e){const a=t.toLowerCase(),r=z.get(a);if(r)return r;const s=(async()=>{try{await b.getWallet(t);return}catch{}const{unix_timestamp:n}=await b.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),p=typeof d=="string"?d:d.signature;if(!p)throw new Error("Wallet returned no smart wallet signature");await b.createWallet(t,{timestamp:n,signature:p})})();z.set(a,s);try{await s}finally{z.delete(a)}}const qe=(t,e)=>{const a=s=>e?e(s):j(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},te="spiceflow-mode",re=()=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(te);return t==="embedded"?"7702":t==="external"?"ondemand":null}catch{return null}},Ge=t=>{if(!(typeof window>"u"))try{window.localStorage.setItem(te,t==="7702"?"embedded":"external")}catch{}},Xe=()=>re()!==null,ae=H(null),se=H(null),Qe=({children:t,provider:e,supportedChainIds:a,allowedTokens:r,network:s="testnet",mode:n="7702",skipFlow:c=[],nativeChainId:d,appName:p="Spicenet",apiUrl:o,theme:u,rpcOverrides:l})=>{O(()=>{if(!o)return;const m=b.getBaseUrl();return b.setBaseUrl(o),()=>b.setBaseUrl(m)},[o]),O(()=>(Q(l),()=>Q(void 0)),[l]);const h=a??Ce(s),w=u??null,[x,i]=A(()=>re()??n),g=ge(m=>{i(m),Ge(m)},[]);return R(ae.Provider,{value:w,children:R(se.Provider,{value:{provider:e,supportedChainIds:h,allowedTokens:r,skipFlow:c,mode:x,setMode:g,network:s,nativeChainId:d,appName:p,apiUrl:o,rpcOverrides:l},children:t})})},Ve={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"}},Ze={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"},Ke={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"},ne=(t="light")=>({mode:t,...Ve,colors:t==="light"?Ze:Ke});function I(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 et(t,e){return{shell:e?.shell??"#141414",shellBorder:e?.shellBorder??I(e?.shell??"#141414",.35),shellInnerBorder:e?.shellInnerBorder??I(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 tt(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 oe(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:I(n,r?.35:.085),shellInnerBorder:I(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 rt='"IBM Plex Mono", monospace';function ie(t,e){const a=be(ae)??void 0;return we(()=>{const r=a??{primaryColor:"#EA4B4B"},s={...t?.primaryColor?{primaryColor:t.primaryColor}:{},...t?.fontFamily?{fontFamily:t.fontFamily}:{},...e!==void 0?{dark:e}:{}},n=oe(r,s),{dark:c,primaryColor:d,appName:p}=n,o=ne(c?"dark":"light"),u={...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},h=t?.inputVariant?t.inputVariant==="dark":c;return{brand:a,theme:u,dark:c,appName:p,primaryColor:d,dk:l,palette:l,fontFamily:n.fontFamily,monoFont:rt,inputDark:h,cardBg:h?l.cardBg:"#E9E9E9",cardBorder:h?l.cardBorder:"#C6C6C6",textPrimary:l.textPrimary,textSecondary:l.textSecondary,subtitleText:h?l.textSecondary:"#979AA0"}},[a,t,e])}const ce="spiceflow-spinner-keyframes";function at(){if(typeof document>"u"||document.getElementById(ce))return;const t=document.createElement("style");t.id=ce,t.textContent="@keyframes spiceflow-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",document.head.appendChild(t)}const de=({size:t=16,borderWidth:e=2,color:a="currentColor",style:r})=>{const s=xe(!1);return O(()=>{s.current||(at(),s.current=!0)},[]),R("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}})},st=({variant:t="primary",size:e="md",loading:a=!1,fullWidth:r=!1,disabled:s,children:n,className:c="",style:d,theme:p,styles:o,dark:u,...l})=>{const{theme:h,dark:w,palette:x}=ie(o,u),i=p||h,g=u??w,[m,E]=A(!1),[$,N]=A(!1),U=g?x.shell:"white",le=()=>{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,W=o?.button?.color||(g?"#ffffff":"#0e0d0b"),S=o?.button?.borderColor||(g?`${i.colors.primary}88`:"#0e0d0b"),C=s||a,fe=g?"1px":"1.5px",me=o?.button?.disabledBackgroundColor||`${y}88`,he=o?.button?.disabledColor||W;return{height:"56px",backgroundColor:C?me:$?`${y}cc`:m?`${y}ee`:y,color:C?he:W,border:`${fe} solid ${S}`,borderRadius:o?.button?.borderRadius||"12px",fontSize:"22px",fontWeight:500,fontFamily:'"IBM Plex Mono", monospace',opacity:C?.78:1,transform:C?"none":$?"scale(0.98)":m?"translateY(-2px)":"none",boxShadow:C?`3px 3px 0px ${U}, 4px 4px 0px ${S}`:$?`2px 2px 0px ${S}`:m?`5px 5px 0px ${U}, 6px 6px 0px ${S}`:`3px 3px 0px ${U}, 4px 4px 0px ${S}`,transition:"transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease, color 150ms ease"}}default:return{}}},ue=()=>{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{}}},pe={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,...le(),...ue(),...o?.button?.fontSize&&{fontSize:o.button.fontSize}},J=s||a;return ye("button",{type:l.type??"button","data-spiceflow-focus":!0,"aria-busy":a||void 0,"aria-disabled":J||void 0,style:{...pe,...d},className:c,disabled:J,onMouseEnter:y=>{E(!0),l.onMouseEnter?.(y)},onMouseLeave:y=>{E(!1),N(!1),l.onMouseLeave?.(y)},onMouseDown:y=>{N(!0),l.onMouseDown?.(y)},onMouseUp:y=>{N(!1),l.onMouseUp?.(y)},...l,children:[a&&R(de,{size:16}),n]})};export{st as B,Me as C,ee as R,de as S,Le as a,V as b,ne as c,se as d,Ye as e,Pe as f,B as g,v as h,K as i,Fe as j,_e as k,j as l,De as m,qe as n,je as o,f as p,Xe as q,b as r,Je as s,D as t,ie as u,Qe as v,oe as w,et as x,tt as y,G as z};
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const e=require("react/jsx-runtime"),c=require("react"),t=require("./Button-RzLL2mKv.js"),W=require("@dynamic-labs/sdk-react-core"),k=require("./providerWallet-Ddncx8s5.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-CkSwrat1.js"),W=require("@dynamic-labs/sdk-react-core"),k=require("./providerWallet-6FpyLYqw.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-E8Ln6miF.js";import{useDynamicContext as j}from"@dynamic-labs/sdk-react-core";import{g as z}from"./providerWallet-B7SytehJ.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-jx5yrM-s.js";import{useDynamicContext as j}from"@dynamic-labs/sdk-react-core";import{g as z}from"./providerWallet-Ds1PM0vC.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-RzLL2mKv.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-CkSwrat1.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-E8Ln6miF.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-jx5yrM-s.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};
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { CustomSection } from "../types";
3
- import type { ResolvedDarkPalette } from "../../../utils/theme";
2
+ import { CustomSection } from "./types";
3
+ import type { ResolvedDarkPalette } from "../../utils/theme";
4
4
  interface AccountCustomSectionProps {
5
5
  section: CustomSection;
6
6
  dk: ResolvedDarkPalette;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { ResolvedDarkPalette } from "../../../utils/theme";
2
+ import type { ResolvedDarkPalette } from "../../utils/theme";
3
3
  interface AccountHeaderProps {
4
4
  appName: string;
5
5
  status: "active" | "inactive";
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { SpiceAsset } from "../types";
3
- import type { ResolvedDarkPalette } from "../../../utils/theme";
2
+ import { SpiceAsset } from "./types";
3
+ import type { ResolvedDarkPalette } from "../../utils/theme";
4
4
  interface AccountIdleBalancesProps {
5
5
  spiceAssets: SpiceAsset[];
6
6
  loading: boolean;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { SpiceAsset, CustomSection } from "../types";
3
- import { VerifiedPendingDeposit } from "../../../hooks/usePendingDeposit";
4
- import type { ResolvedDarkPalette } from "../../../utils/theme";
2
+ import { SpiceAsset, CustomSection } from "./types";
3
+ import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
4
+ import type { ResolvedDarkPalette } from "../../utils/theme";
5
5
  interface AccountPanelProps {
6
6
  appName: string;
7
7
  status: "active" | "inactive";
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import { VerifiedPendingDeposit } from "../../../hooks/usePendingDeposit";
3
- import type { ResolvedDarkPalette } from "../../../utils/theme";
2
+ import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
3
+ import type { ResolvedDarkPalette } from "../../utils/theme";
4
4
  interface AccountPendingDepositsProps {
5
5
  pendingDeposits: VerifiedPendingDeposit[];
6
6
  onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
@@ -37,7 +37,6 @@ export interface AccountDisplayProps {
37
37
  extraAssets?: SpiceAsset[];
38
38
  tokenPrices?: Record<string, number>;
39
39
  breakdownLabels?: BreakdownLabel[];
40
- supportedChains?: number[];
41
40
  styles?: CustomStyles;
42
41
  dark?: boolean;
43
42
  onDepositSuccess?: () => void;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- import type { AssetDropdownProps } from "../../../types/assets";
2
+ import type { AssetDropdownProps } from "../../types/assets";
3
3
  export declare const AssetDropdown: React.FC<AssetDropdownProps>;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- import type { ChainIconProps } from "../../../types/assets";
2
+ import type { ChainIconProps } from "../../types/assets";
3
3
  export declare const ChainIcon: React.FC<ChainIconProps>;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- import type { TokenIconProps } from "../../../types/assets";
2
+ import type { TokenIconProps } from "../../types/assets";
3
3
  export declare const TokenIcon: React.FC<TokenIconProps>;
@@ -1,5 +1,5 @@
1
1
  export { AssetSelector } from "./AssetSelector";
2
- export { TokenIcon } from "./parts/TokenIcon";
3
- export { ChainIcon } from "./parts/ChainIcon";
4
- export { AssetDropdown } from "./parts/AssetDropdown";
2
+ export { TokenIcon } from "./TokenIcon";
3
+ export { ChainIcon } from "./ChainIcon";
4
+ export { AssetDropdown } from "./AssetDropdown";
5
5
  export type { TokenIconProps, ChainIconProps, AssetDropdownProps, } from "../../types/assets";
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { DynamicLoginProps } from "../../../types/wallet";
2
+ import type { DynamicLoginProps } from "../../types/wallet";
3
3
  export type { DynamicLoginProps };
4
4
  export declare const DynamicLogin: React.FC<DynamicLoginProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { PrivyLoginProps } from "../../../types/wallet";
2
+ import type { PrivyLoginProps } from "../../types/wallet";
3
3
  export type { PrivyLoginProps };
4
4
  export declare const PrivyLogin: React.FC<PrivyLoginProps>;
@@ -1,6 +1,4 @@
1
1
  export { ProviderLogin } from "./ProviderLogin";
2
- export { PrivyLogin } from "./parts/PrivyLogin";
3
- export { DynamicLogin } from "./parts/DynamicLogin";
2
+ export { PrivyLogin } from "./PrivyLogin";
4
3
  export type { ProviderLoginProps } from "./ProviderLogin";
5
- export type { PrivyLoginProps } from "./parts/PrivyLogin";
6
- export type { DynamicLoginProps } from "./parts/DynamicLogin";
4
+ export type { PrivyLoginProps } from "./PrivyLogin";
@@ -1,4 +1,4 @@
1
1
  export { SpiceBalance } from "./SpiceBalance";
2
- export { BalanceSection } from "./parts/BalanceSection";
3
- export { AccountItem } from "./parts/AccountItem";
2
+ export { BalanceSection } from "./BalanceSection";
3
+ export { AccountItem } from "./AccountItem";
4
4
  export type { SpiceBalanceProps, BalanceData, TradingAccount, BalanceSectionConfig, SpiceBalanceApiResponse, } from "./types";
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { CustomStyles } from "../../../types/theme";
2
+ import { CustomStyles } from "../../types/theme";
3
3
  interface ConnectWalletModalProps {
4
4
  isOpen: boolean;
5
5
  onClose: () => void;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- import { DepositModalProps } from "../../../types";
2
+ import { DepositModalProps } from "../../types";
3
3
  export declare const DepositModal: React.FC<DepositModalProps>;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- import type { DepositRecoveryPromptProps } from "../../../types/deposit";
2
+ import type { DepositRecoveryPromptProps } from "../../types/deposit";
3
3
  export declare const DepositRecoveryPrompt: React.FC<DepositRecoveryPromptProps>;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import type { DepositConfirmationData, DepositConfirmationModalProps } from "../../../types/deposit";
2
+ import type { DepositConfirmationData, DepositConfirmationModalProps } from "../../types/deposit";
3
3
  export type { DepositConfirmationData, DepositConfirmationModalProps };
4
4
  export declare const DepositConfirmationModal: React.FC<DepositConfirmationModalProps>;
5
- export type { StatusToastProps } from "../../../types/deposit";
6
- import type { StatusToastProps } from "../../../types/deposit";
5
+ export type { StatusToastProps } from "../../types/deposit";
6
+ import type { StatusToastProps } from "../../types/deposit";
7
7
  export declare const StatusToast: React.FC<StatusToastProps>;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { CustomStyles } from "../../../types/theme";
2
+ import { CustomStyles } from "../../types/theme";
3
3
  interface SelectChainModalProps {
4
4
  isOpen: boolean;
5
5
  onClose: () => void;
@@ -1,3 +1,3 @@
1
1
  import React from "react";
2
- import type { SelectTokenModalProps } from "../../../types/deposit";
2
+ import type { SelectTokenModalProps } from "../../types/deposit";
3
3
  export declare const SelectTokenModal: React.FC<SelectTokenModalProps>;
@@ -1,6 +1,6 @@
1
- import type { ChainBatch } from "../../../types/authorization";
2
- import type { SelectedAsset } from "../../../types/assets";
3
- import type { DepositModalProps, PostDepositContext } from "../../../types/deposit";
1
+ import type { ChainBatch } from "../../types/authorization";
2
+ import type { SelectedAsset } from "../../types/assets";
3
+ import type { DepositModalProps, PostDepositContext } from "../../types/deposit";
4
4
  export declare function buildPostDepositContext({ sourceChainId, selectedAsset, destinationChainId, destinationTokenAddress, isCrossDenomination, convertedUsdAmount, }: {
5
5
  sourceChainId: number;
6
6
  selectedAsset: SelectedAsset;
@@ -1,7 +1,7 @@
1
1
  import { Address } from "viem";
2
- import { SelectedAsset } from "../../../types/assets";
3
- import type { DepositConfirmationData } from "../steps/DepositStatusModal";
4
- import type { DepositModalProps } from "../../../types";
2
+ import { SelectedAsset } from "../../types/assets";
3
+ import type { DepositConfirmationData } from "./DepositStatusModal";
4
+ import type { DepositModalProps } from "../../types";
5
5
  export interface DepositFee {
6
6
  fee: bigint;
7
7
  net: bigint;
@@ -1,5 +1,5 @@
1
1
  import { Address } from "viem";
2
- import type { Asset } from "../../../types/assets";
2
+ import type { Asset } from "../../types/assets";
3
3
  import type { DepositFee } from "./executors";
4
4
  export interface DepositQuote {
5
5
  asset: Asset;
@@ -1,5 +1,5 @@
1
- import { SelectTokenModal } from "./steps/SelectTokenModal";
2
- import { ConnectWalletModal } from "./steps/ConnectWalletModal";
3
- import { DepositModal } from "./steps/DepositModal";
1
+ import { SelectTokenModal } from "./SelectTokenModal";
2
+ import { ConnectWalletModal } from "./ConnectWalletModal";
3
+ import { DepositModal } from "./DepositModal";
4
4
  import { SpiceDeposit } from "./SpiceDeposit";
5
5
  export { SelectTokenModal, ConnectWalletModal, DepositModal, SpiceDeposit };
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { ResolvedDarkPalette } from "../../../utils/theme";
3
+ interface DepositSubtitleProps {
4
+ appName: string;
5
+ dark: boolean;
6
+ dk: ResolvedDarkPalette;
7
+ }
8
+ export declare const DepositSubtitle: React.FC<DepositSubtitleProps>;
9
+ export {};
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { LockConfirmationData, LockConfirmationPanelProps } from "../../../types/lock";
2
+ import type { LockConfirmationData, LockConfirmationPanelProps } from "../../types/lock";
3
3
  export type { LockConfirmationData, LockConfirmationPanelProps };
4
4
  export declare const LockConfirmationPanel: React.FC<LockConfirmationPanelProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { LockDurationSliderProps } from "../../../types/lock";
2
+ import type { LockDurationSliderProps } from "../../types/lock";
3
3
  export type { LockDurationSliderProps };
4
4
  export declare const LockDurationSlider: React.FC<LockDurationSliderProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { LockExpiryRowProps } from "../../../types/lock";
2
+ import type { LockExpiryRowProps } from "../../types/lock";
3
3
  export type { LockExpiryRowProps };
4
4
  export declare const LockExpiryRow: React.FC<LockExpiryRowProps>;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { VotingPowerRowProps } from "../../../types/lock";
2
+ import type { VotingPowerRowProps } from "../../types/lock";
3
3
  export type { VotingPowerRowProps };
4
4
  export declare const VotingPowerRow: React.FC<VotingPowerRowProps>;
@@ -1,12 +1,12 @@
1
1
  import type { Dispatch, SetStateAction } from "react";
2
2
  import { type Address } from "viem";
3
- import type { ChainBatch } from "../../../types/authorization";
4
- import type { SelectedAsset } from "../../../types/assets";
5
- import type { LockDurationOption, SpiceLockModalProps } from "../../../types/lock";
6
- import type { FeePreview } from "../../../types/ui";
7
- import type { WalletActions } from "../../../hooks/useWallet";
8
- import type { SwapStep } from "../../../types/status";
9
- export type LockExecutorContext = {
3
+ import type { ChainBatch } from "../../types/authorization";
4
+ import type { SelectedAsset } from "../../types/assets";
5
+ import type { LockDurationOption, SpiceLockModalProps } from "../../types/lock";
6
+ import type { FeePreview } from "../../types/ui";
7
+ import type { WalletActions } from "../../hooks/useWallet";
8
+ import type { SwapStep } from "../../types/status";
9
+ export interface LockExecutorContext {
10
10
  selectedAsset: SelectedAsset | null;
11
11
  parsedAmount: number;
12
12
  selectedDuration: LockDurationOption | undefined;
@@ -29,6 +29,9 @@ export type LockExecutorContext = {
29
29
  actions: WalletActions;
30
30
  lockChainId: number;
31
31
  escrowAddress?: Address;
32
+ onLockExecute?: SpiceLockModalProps["onLockExecute"];
33
+ onLockSuccess?: SpiceLockModalProps["onLockSuccess"];
34
+ buildSpicenetBatch?: SpiceLockModalProps["buildSpicenetBatch"];
32
35
  resolveLockBatches: (override?: {
33
36
  amount: string;
34
37
  amountWei: bigint;
@@ -38,12 +41,10 @@ export type LockExecutorContext = {
38
41
  startStatusPolling: (intentId: string, steps: SwapStep[]) => void;
39
42
  refreshSpiceAssets: () => void;
40
43
  refreshWalletAssets: () => void;
41
- ui: {
42
- setError: Dispatch<SetStateAction<string | null>>;
43
- setIsExecuting: Dispatch<SetStateAction<boolean>>;
44
- setShowStatusPanel: Dispatch<SetStateAction<boolean>>;
45
- };
46
- } & Pick<SpiceLockModalProps, "onLockExecute" | "onLockSuccess" | "buildSpicenetBatch">;
44
+ setError: Dispatch<SetStateAction<string | null>>;
45
+ setIsExecuting: Dispatch<SetStateAction<boolean>>;
46
+ setShowStatusPanel: Dispatch<SetStateAction<boolean>>;
47
+ }
47
48
  export declare function run7702LockIntent(ctx: LockExecutorContext, batches: ChainBatch[]): Promise<void>;
48
49
  export declare function executeLock(ctx: LockExecutorContext): Promise<void>;
49
50
  export declare function executeDirectDeposit(ctx: LockExecutorContext): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { type Address } from "viem";
2
2
  import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
3
- import type { ChainBatch } from "../../../types/authorization";
3
+ import type { ChainBatch } from "../../types/authorization";
4
4
  export declare function sumRollupBalanceForChainToken(balances: unknown, chainId: number, tokenAddress: string): bigint;
5
5
  export declare function fetchSpiceBalanceForChainToken(apiBaseUrl: string, user: Address, chainId: number, tokenAddress: string): Promise<bigint>;
6
6
  export declare function waitForSpiceBalanceIncrease({ apiBaseUrl, user, chainId, tokenAddress, prevBalance, timeoutMs, pollIntervalMs, }: {
@@ -23,7 +23,7 @@ export declare function build7702EstimateRequest(user: Address, batches: ChainBa
23
23
  chainBatches: {
24
24
  hash: any;
25
25
  chainId: any;
26
- tokenTransfers: import("../../..").TokenTransferConfig[];
26
+ tokenTransfers: import("../..").TokenTransferConfig[];
27
27
  calls: any;
28
28
  }[];
29
29
  }[];
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
- import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
3
- import type { ResolvedDarkPalette } from "../../../utils/theme";
2
+ import type { ResolvedExactOutputSwap } from "../../utils/swapQuotes";
3
+ import type { ResolvedDarkPalette } from "../../utils/theme";
4
4
  interface DestinationEstimateProps {
5
5
  variant: "supply" | "pay";
6
6
  destinationSymbol: string;
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
- import type { SupplyEstimateProps } from "../../../types/supply";
2
+ import type { SupplyEstimateProps } from "../../types/supply";
3
3
  export type { SupplyEstimateProps };
4
4
  export declare const SupplyEstimate: React.FC<SupplyEstimateProps>;
@@ -1,10 +1,10 @@
1
1
  import { type Address } from "viem";
2
2
  import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
3
- import type { ChainBatch } from "../../../types/authorization";
4
- import type { SelectedAsset } from "../../../types/assets";
5
- import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
6
- import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
7
- import type { GaslessExecutionOptions } from "../../../hooks/useSpiceExecution";
3
+ import type { ChainBatch } from "../../types/authorization";
4
+ import type { SelectedAsset } from "../../types/assets";
5
+ import type { SpiceSupplyProps } from "../../types/supply";
6
+ import type { ResolvedExactOutputSwap } from "../../utils/swapQuotes";
7
+ import type { GaslessExecutionOptions } from "../../hooks/useSpiceExecution";
8
8
  import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
9
9
  type EstimateGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: GaslessExecutionOptions) => Promise<FeeEstimateSummary>;
10
10
  export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
@@ -18,7 +18,6 @@ export interface BatchBuilderContext {
18
18
  isPayMode: boolean;
19
19
  resolvedChainId: number;
20
20
  buildActionCalls: SpiceSupplyProps["buildActionCalls"];
21
- feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
22
21
  buildSpicenetBatch: SpiceSupplyProps["buildSpicenetBatch"];
23
22
  selectedAsset: SelectedAsset | null;
24
23
  needsSwap: boolean;
@@ -27,7 +26,10 @@ export interface BatchBuilderContext {
27
26
  quoteAmountOut: bigint | null;
28
27
  resolvedTokenIn: Address | null;
29
28
  }
30
- export declare function buildPayChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
31
- export declare function buildSupplyChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
29
+ export declare function buildPayChainBatches(ctx: BatchBuilderContext, options?: {
30
+ actionAmountOverride?: bigint;
31
+ fundingAmountOverride?: bigint;
32
+ }): Promise<ChainBatch[]>;
33
+ export declare function buildSupplyChainBatches(ctx: BatchBuilderContext, spicenetFundingAmount?: bigint): Promise<ChainBatch[]>;
32
34
  export declare function estimateRequiredGrossFunding(requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, estimateGasless: EstimateGaslessFn, gaslessOptions?: Pick<GaslessExecutionOptions, "useCustomTransfers" | "userOverride">): Promise<bigint>;
33
35
  export {};