@spicenet-io/spiceflow-ui 3.2.0 → 3.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Button-B--Fjq1m.js +2 -0
- package/dist/Button-dU4UsC56.js +2 -0
- package/dist/auth-dynamic.cjs.js +1 -1
- package/dist/auth-dynamic.js +1 -1
- package/dist/auth-privy.cjs.js +1 -1
- package/dist/auth-privy.js +1 -1
- package/dist/components/AssetSelector/AssetDropdown.d.ts +1 -11
- package/dist/components/AssetSelector/ChainIcon.d.ts +1 -7
- package/dist/components/AssetSelector/TokenIcon.d.ts +1 -7
- package/dist/components/AssetSelector/index.d.ts +1 -3
- package/dist/components/ExportWallet/ExportWalletButton.d.ts +2 -7
- package/dist/components/ProviderLogins/DynamicLogin.d.ts +2 -8
- package/dist/components/ProviderLogins/PrivyLogin.d.ts +2 -8
- package/dist/components/ProviderLogins/ProviderLogin.d.ts +2 -8
- package/dist/components/SpiceDeposit/DepositRecoveryPrompt.d.ts +1 -14
- package/dist/components/SpiceDeposit/DepositStatusModal.d.ts +4 -37
- package/dist/components/SpiceDeposit/SelectTokenModal.d.ts +1 -16
- package/dist/components/SpiceDeposit/SpiceDeposit.d.ts +2 -35
- package/dist/components/SpiceLockModal/LockSubComponents.d.ts +2 -45
- package/dist/components/SpicePay/SpicePay.d.ts +2 -29
- package/dist/components/SpiceSupply/SupplyEstimate.d.ts +2 -13
- package/dist/components/SpiceWithdraw/SelectPopover.d.ts +2 -7
- package/dist/components/SpiceWithdraw/SpiceWithdraw.d.ts +2 -26
- package/dist/components/StatusDisplay/StatusIcon.d.ts +1 -7
- package/dist/components/StatusDisplay/StatusPanel.d.ts +2 -31
- package/dist/components/StatusDisplay/StepItem.d.ts +1 -8
- package/dist/components/StatusDisplay/index.d.ts +1 -2
- package/dist/components/index.d.ts +0 -2
- package/dist/components/ui/AddFundsLink.d.ts +3 -0
- package/dist/components/ui/Button.d.ts +1 -11
- package/dist/components/ui/CloseIcon.d.ts +1 -6
- package/dist/components/ui/DetailRow.d.ts +3 -0
- package/dist/components/ui/FeeBreakdownCard.d.ts +2 -11
- package/dist/components/ui/Input.d.ts +1 -10
- package/dist/components/ui/Modal.d.ts +1 -10
- package/dist/components/ui/SearchInput.d.ts +15 -0
- package/dist/components/ui/SpiceModalShell.d.ts +1 -17
- package/dist/components/ui/Spinner.d.ts +1 -6
- package/dist/components/ui/StatusBanner.d.ts +1 -10
- package/dist/components/ui/icons.d.ts +13 -0
- package/dist/components/ui/index.d.ts +7 -8
- package/dist/index.cjs.js +31 -42
- package/dist/index.d.ts +10 -12
- package/dist/index.js +27 -38
- package/dist/providerWallet-DDywdl9_.js +2 -0
- package/dist/providerWallet-cDeDz-zR.js +2 -0
- package/dist/providers/custom.css +1 -1
- package/dist/types/assets.d.ts +23 -0
- package/dist/types/authorization.d.ts +5 -2
- package/dist/types/deposit.d.ts +95 -27
- package/dist/types/index.d.ts +2 -0
- package/dist/types/lock.d.ts +44 -0
- package/dist/types/pay.d.ts +30 -0
- package/dist/types/status.d.ts +41 -1
- package/dist/types/supply.d.ts +13 -0
- package/dist/types/ui.d.ts +95 -0
- package/dist/types/wallet.d.ts +31 -0
- package/dist/types/withdraw.d.ts +30 -0
- package/dist/utils/loadFonts.d.ts +1 -0
- package/dist/utils/relayer/index.d.ts +0 -20
- package/dist/utils/tokens.d.ts +43 -0
- package/package.json +1 -18
- package/dist/Button-D5zwqrrP.js +0 -2
- package/dist/Button-KtHGKIo6.js +0 -2
- package/dist/auth-starknet.cjs.js +0 -2
- package/dist/auth-starknet.d.ts +0 -6
- package/dist/auth-starknet.js +0 -2
- package/dist/components/Airdrop/Airdrop.d.ts +0 -28
- package/dist/components/Airdrop/index.d.ts +0 -2
- package/dist/components/DepositWidget/AssetInput.d.ts +0 -23
- package/dist/components/DepositWidget/CrossChainDepositModal.d.ts +0 -42
- package/dist/components/DepositWidget/DepositWidget.d.ts +0 -3
- package/dist/components/DepositWidget/DepositWidgetModal.d.ts +0 -11
- package/dist/components/DepositWidget/index.d.ts +0 -8
- package/dist/components/LpModal/AmountCard.d.ts +0 -11
- package/dist/components/LpModal/CompactAssetSelector.d.ts +0 -11
- package/dist/components/LpModal/LpModal.d.ts +0 -3
- package/dist/components/LpModal/PairInfoCard.d.ts +0 -14
- package/dist/components/LpModal/ProgressIndicators.d.ts +0 -4
- package/dist/components/LpModal/index.d.ts +0 -1
- package/dist/components/StarknetWallet/StarknetWalletButton.d.ts +0 -9
- package/dist/components/StarknetWallet/index.d.ts +0 -2
- package/dist/components/ui/Toast.d.ts +0 -10
- package/dist/hooks/useStarknetWallet.d.ts +0 -13
- package/dist/index-DJQ17ocQ.js +0 -2
- package/dist/index-WLbJouQ7.js +0 -2
- package/dist/providerWallet-DeNDXTJA.js +0 -2
- package/dist/providerWallet-DrwSLBof.js +0 -2
- package/dist/providers/StarknetWalletProvider.d.ts +0 -8
- package/dist/types/lp.d.ts +0 -43
- package/dist/useSpiceBrand-BBtUTOno.js +0 -2
- package/dist/useSpiceBrand-D-06ludX.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";const v=require("react/jsx-runtime"),h=require("react"),y=require("@spicenet-io/spiceflow-core"),b=require("viem"),se=require("viem/actions");class p extends Error{constructor(e,o,r={}){super(o),this.code=e,this.context=r,this.name="SpiceflowError",Error.captureStackTrace&&Error.captureStackTrace(this,p)}}function ie(t){return t instanceof p}const L=[{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"}],ce="0xcA11bde05977b3631167028862bE2a173976CA11",de={4114:"0x860aFc632a6D625B95d8B96f39ECC48E988c6962"},le=new Set([5115]);function ue(t){const e=de[t.id]??(le.has(t.id)?void 0:ce);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 pe=[1,8453,42161,4114,11155111,421614,84532,5115,123420001114,688688,688689],T=Object.fromEntries(pe.map(t=>y.getChainMeta(t)).filter(t=>t!=null).map(t=>[t.id,{...t,viemChain:ue(t),supportedTokens:y.getTokensForChain(t.id)}])),fe=T;let j={};const F=new Map,D=t=>{j={...t||{}},F.clear()},M=t=>{const e=j[t];return e&&typeof e=="string"&&e.length>0?e:T[t]?.rpcUrl},S=t=>T[t],k=t=>{const e=y.getChainMeta(t);return e?.displayName||e?.name||`Chain ${t}`},me=t=>{const e=y.getDelegateContract(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);return e},he=(t,e,o)=>{const r=S(t);return r?.blockExplorer?`${r.blockExplorer}/tx/${e}`:"#"},Y=t=>{const e=S(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);const o=M(t);if(!o)throw new Error(`No RPC URL configured for chain ID: ${t}`);const r=`${t}:${o}`,n=F.get(r);if(n)return n;const a=b.createPublicClient({chain:e.viemChain,transport:b.http(o,{timeout:15e3,retryCount:2,retryDelay:300}),batch:{multicall:{wait:16}}});return F.set(r,a),a},ge=()=>{const t={};return Object.values(T).forEach(e=>{t[e.id]={name:e.name,moralisName:e.moralisId||"",chain:e.viemChain,rpcUrl:M(e.id)||e.rpcUrl}}),t},ye=(t,e=[])=>{const o=S(t);if(!o)return[];const r=[];if(![11155111,421614,84532,688689].includes(t)){const a=e.find(i=>i.chainId===t&&i.isNative);a?r.push(a):r.push({address:y.ZERO_ADDRESS,name:o.nativeCurrency.name,symbol:o.nativeCurrency.symbol,decimals:o.nativeCurrency.decimals,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,logoURI:void 0,isNative:!0,chainId:t})}if(!o.supportedTokens)return r;const n=r.some(a=>a.isNative);return o.supportedTokens.forEach(a=>{if(n&&y.isNativeToken(a.address))return;const i=e.find(d=>d.chainId===t&&d.address.toLowerCase()===a.address.toLowerCase());i?r.push(i):r.push({address:a.address,name:a.name,symbol:a.symbol,decimals:a.decimals,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,logoURI:a.logo,isNative:!1,chainId:t})}),r},be=async(t,e)=>{const o=S(t);if(!o)throw new Error(`Unsupported chain ID: ${t}`);const r=e.toLowerCase();if(y.isNativeToken(r)){if(!o.nativeCurrency?.decimals)throw new Error(`Native currency decimals not configured for chain ${t}`);return o.nativeCurrency.decimals}if(o.supportedTokens){const n=o.supportedTokens.find(a=>a.address.toLowerCase()===r);if(n)return n.decimals}try{if(!b.isAddress(e,{strict:!1}))throw new Error(`Invalid token address: ${e}`);const n=b.getAddress(e),a=Y(t),i=await se.readContract(a,{address:n,abi:L,functionName:"decimals"});return Number(i)}catch{throw new Error(`Could not determine decimals for token ${e} on chain ${t}`)}},z=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io",H="__SPICEFLOW_RELAYER_API_URL__";function we(t,e){const o=e.match(/Output amount (\d+) is insufficient after fees (\d+) on chain (\d+)/);if(!o)return e;const[,r,n,a]=o,i=Number(a),d=BigInt(r),l=BigInt(n);let c;for(const u of t.intents){const B=u.chainBatches.find(R=>R.chainId===i);if(B){c=B;break}}const g=c?.tokenTransfers.find(u=>u.from==="escrow"&&u.to.toLowerCase()===t.user.toLowerCase()&&!y.isNativeToken(u.token));if(!g)return`Amount is too small to cover the estimated fee on ${k(i)}.`;const f=y.getTokenByAddress(g.token,i),w=f?.decimals??18,x=f?.symbol??"tokens",E=b.formatUnits(d,w),s=b.formatUnits(l,w);return`Amount is too small to cover the estimated fee on ${k(i)}. Amount: ${E} ${x}. Estimated fee: ${s} ${x}.`}function xe(){if(typeof globalThis>"u")return;const t=globalThis[H];return typeof t=="string"&&t.length>0?t:void 0}class Be{constructor(){this.baseUrl=z}setBaseUrl(e){this.baseUrl=e,typeof globalThis<"u"&&(globalThis[H]=e)}getBaseUrl(){return this.getEffectiveBaseUrl()}getEffectiveBaseUrl(){return xe()||this.baseUrl}async createAction(e){const o=await fetch(`${this.getEffectiveBaseUrl()}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(r,n)=>typeof n=="bigint"?n.toString():n)});if(!o.ok){const r=await o.text();throw new p("RELAYER_ERROR",`Relayer API error: ${o.status} - ${r}`,{httpStatus:o.status,responseBody:r,endpoint:"/actions"})}return await o.json()}async estimateActionFees(e){const o=await fetch(`${this.getEffectiveBaseUrl()}/actions/fees/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(n,a)=>typeof a=="bigint"?a.toString():a)}),r=await o.json();if(!o.ok||!r.success||!r.data?.feeEstimate){const n=r.error?.message||`Relayer fee estimate error: ${o.status}`,a=we(e,n);throw new p("RELAYER_ERROR",a,{httpStatus:o.status,responseBody:JSON.stringify(r),endpoint:"/actions/fees/estimate"})}return r.data.feeEstimate}async estimateBatchGas(e){const o=await fetch(`${this.getEffectiveBaseUrl()}/actions/gas/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(n,a)=>typeof a=="bigint"?a.toString():a)}),r=await o.json();if(!o.ok||!r.success||!r.data?.gasFee){const n=r.error?.message||`Relayer gas estimate error: ${o.status}`;throw new p("RELAYER_ERROR",n,{httpStatus:o.status,responseBody:JSON.stringify(r),endpoint:"/actions/gas/estimate"})}return{gasFee:BigInt(r.data.gasFee),gasQuoteSource:r.data.gasQuoteSource}}async executeStep(e,o,r,n){const a=`${this.getEffectiveBaseUrl()}/actions/${e}/intents/${o}/steps/${r}`,i=fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});let d;try{d=await Promise.race([i,new Promise((l,c)=>setTimeout(()=>c(new p("RELAYER_EXECUTE_ERROR",`Execute step request timed out after ${1e4/1e3}s`,{actionId:e,intentIndex:o,stepIndex:r,endpoint:`/actions/${e}/intents/${o}/steps/${r}`})),1e4))])}catch(l){throw l}if(!d.ok){const l=await d.text();throw new p("RELAYER_EXECUTE_ERROR",`Execute step error: ${d.status} - ${l}`,{httpStatus:d.status,responseBody:l,endpoint:`/actions/${e}/intents/${o}/steps/${r}`,actionId:e})}return{success:!0,transactionHash:(await d.json()).transactionHash}}async checkStepStatus(e,o){const r=e.split("/");let n="";if(r.length>=2){const d=r[0],l=r[1];n=`${this.getEffectiveBaseUrl()}/actions/${d}/intents/${l}/steps/${o}`}else n=`${this.getEffectiveBaseUrl()}/actions/${e}/intents/0/steps/${o}`;const a=await fetch(n);if(!a.ok)throw new p("RELAYER_STATUS_ERROR",`Intent step status check failed: ${a.status}`,{httpStatus:a.status,endpoint:n,intentId:e});const i=await a.json();return{success:!0,data:{status:i.status==="error"?"reverted":i.status,transactionHash:i.txid}}}async createWallet(e,o){const r=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)});if(!r.ok){const n=await r.text();throw new p("RELAYER_ERROR",`Create wallet error: ${r.status} - ${n}`,{httpStatus:r.status,endpoint:`/wallets/${e}`})}return r.json()}async getWallet(e){const o=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${e}`);if(!o.ok){const r=await o.text();throw new p("RELAYER_ERROR",`Get wallet error: ${o.status} - ${r}`,{httpStatus:o.status,endpoint:`/wallets/${e}`})}return o.json()}async createWithdrawal(e){const o=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(r,n)=>typeof n=="bigint"?n.toString():n)});if(!o.ok){const r=await o.text();throw new p("RELAYER_ERROR",`Create withdrawal error: ${o.status} - ${r}`,{httpStatus:o.status,endpoint:"/withdrawals"})}return o.json()}async getWithdrawal(e){const o=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals/${e}`);if(!o.ok){const r=await o.text();throw new p("RELAYER_ERROR",`Get withdrawal error: ${o.status} - ${r}`,{httpStatus:o.status,endpoint:`/withdrawals/${e}`})}return o.json()}async getRollupTimestamp(){const e=await fetch(`${this.getEffectiveBaseUrl()}/time`);if(!e.ok)throw new p("RELAYER_ERROR",`Get rollup timestamp error: ${e.status}`,{httpStatus:e.status,endpoint:"/time"});return e.json()}}const I=new Be,Ee=(t,e)=>{const o=n=>e?e(n):k(n),r=[];return t.forEach((n,a)=>{const i=n.calls&&n.calls.length>0,d=n.tokenTransfers&&n.tokenTransfers.length>0;if(i||d){const l={stepId:a,status:a===0?"processing":"pending",chainId:n.chainId,chainName:o(n.chainId),description:"Processing transaction"};r.push(l)}}),r},W="spiceflow-mode",J=()=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(W);return t==="embedded"?"7702":t==="external"?"ondemand":null}catch{return null}},$e=t=>{if(!(typeof window>"u"))try{window.localStorage.setItem(W,t==="7702"?"embedded":"external")}catch{}},Ce=()=>J()!==null,G=h.createContext(null),q=h.createContext(null),ve=({children:t,provider:e,supportedChainIds:o,network:r="testnet",mode:n="7702",skipFlow:a=[],nativeChainId:i,appName:d="Spicenet",apiUrl:l,theme:c,rpcOverrides:g})=>{h.useEffect(()=>{if(!l)return;const u=I.getBaseUrl();return I.setBaseUrl(l),()=>I.setBaseUrl(u)},[l]),h.useEffect(()=>(D(g),()=>D(void 0)),[g]);const f=o??y.getChainIdsByNetwork(r),w=c??null,[x,E]=h.useState(()=>J()??n),s=h.useCallback(u=>{E(u),$e(u)},[]);return v.jsx(G.Provider,{value:w,children:v.jsx(q.Provider,{value:{provider:e,supportedChainIds:f,skipFlow:a,mode:x,setMode:s,network:r,nativeChainId:i,appName:d,apiUrl:l,rpcOverrides:g},children:t})})},Se={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"}},Re={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"},Te={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"},X=(t="light")=>({mode:t,...Se,colors:t==="light"?Re:Te});function U(t,e){const o=t.replace("#",""),r=Math.max(0,Math.round(parseInt(o.substring(0,2),16)*(1-e))),n=Math.max(0,Math.round(parseInt(o.substring(2,4),16)*(1-e))),a=Math.max(0,Math.round(parseInt(o.substring(4,6),16)*(1-e)));return`#${r.toString(16).padStart(2,"0")}${n.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}`}function ke(t,e){return{shell:e?.shell??"#141414",shellBorder:e?.shellBorder??U(e?.shell??"#141414",.35),shellInnerBorder:e?.shellInnerBorder??U(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 Ie(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 Q(t,e){const o=e?{...t,...e}:t,r=o.dark??!1,n=o.primaryColor,a=o.shell??(r?"#141414":"#ffffff");return{primaryColor:n,dark:r,fontFamily:o.fontFamily??'"Helvetica Neue", sans-serif',appName:o.appName??"Spicenet",logo:o.logo,borderRadius:o.borderRadius??"8px",shell:a,shellBorder:U(a,r?.35:.085),shellInnerBorder:U(a,r?.55:.165),card:o.card??(r?"#1e1e1e":"#f9fafb"),input:r?"#171717":"#ffffff",hover:r?"#2a2a2a":"#f3f4f6",text:o.text??(r?"#ffffff":"#111827"),textMuted:o.textMuted??(r?"#888888":"#6b7280"),inputText:r?"#e0e0e0":"#111827",inputPlaceholder:r?"#555555":"#9ca3af",border:o.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"}}function Z(t,e){const o=h.useContext(G)??void 0;return h.useMemo(()=>{const r=o??{primaryColor:"#EA4B4B"},n={...t?.primaryColor?{primaryColor:t.primaryColor}:{},...t?.fontFamily?{fontFamily:t.fontFamily}:{},...e!==void 0?{dark:e}:{}},a=Q(r,n),{dark:i,primaryColor:d,appName:l}=a,c=X(i?"dark":"light"),g={...c,colors:{...c.colors,primary:d,primaryHover:`${d}dd`},typography:{...c.typography,fontFamily:a.fontFamily}},f={shell:a.shell,shellBorder:a.shellBorder,shellInnerBorder:a.shellInnerBorder,cardBg:a.card,inputBg:a.input,hoverBg:a.hover,textPrimary:a.text,textSecondary:a.textMuted,inputText:a.inputText,inputPlaceholder:a.inputPlaceholder,cardBorder:a.border,inputBorder:a.inputBorder,buttonBorder:a.buttonBorder,successBg:a.successBg,successBorder:a.successBorder,successText:a.successText,warningBg:a.warningBg,warningBorder:a.warningBorder,warningText:a.warningText,errorBg:a.errorBg,errorBorder:a.errorBorder,errorText:a.errorText,infoBg:a.infoBg,infoBorder:a.infoBorder,infoText:a.infoText};return{brand:o,theme:g,dark:i,appName:l,primaryColor:d,dk:f,palette:f}},[o,t,e])}const K="spiceflow-spinner-keyframes";function Ue(){if(typeof document>"u"||document.getElementById(K))return;const t=document.createElement("style");t.id=K,t.textContent="@keyframes spiceflow-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",document.head.appendChild(t)}const V=({size:t=16,borderWidth:e=2,color:o="currentColor",style:r})=>{const n=h.useRef(!1);return h.useEffect(()=>{n.current||(Ue(),n.current=!0)},[]),v.jsx("div",{role:"status","aria-label":"Loading",style:{width:`${t}px`,height:`${t}px`,border:`${e}px solid ${o}`,borderTop:`${e}px solid transparent`,borderRadius:"50%",animation:"spiceflow-spin 1s linear infinite",flexShrink:0,...r}})},Ae=({variant:t="primary",size:e="md",loading:o=!1,fullWidth:r=!1,disabled:n,children:a,className:i="",style:d,theme:l,styles:c,dark:g,...f})=>{const{theme:w,dark:x,palette:E}=Z(c,g),s=l||w,u=g??x,[B,R]=h.useState(!1),[A,N]=h.useState(!1),_=u?E.shell:"white",ee=()=>{switch(t){case"primary":return{backgroundColor:c?.button?.backgroundColor||s.colors.primary,color:c?.button?.color||"#ffffff",border:`1px solid ${c?.button?.backgroundColor||s.colors.primary}`};case"secondary":return{backgroundColor:s.colors.secondary,color:s.colors.text,border:`1px solid ${s.colors.border}`};case"success":return{backgroundColor:s.colors.success,color:s.colors.text,border:`1px solid ${s.colors.success}`};case"error":return{backgroundColor:s.colors.error,color:s.colors.text,border:`1px solid ${s.colors.error}`};case"ghost":return{backgroundColor:"transparent",color:s.colors.textSecondary,border:`1px solid ${s.colors.border}`};case"outline":{const m=c?.button?.backgroundColor||s.colors.primary,O=c?.button?.color||(u?"#ffffff":"#0e0d0b"),$=c?.button?.borderColor||(u?`${s.colors.primary}88`:"#0e0d0b"),C=n||o,oe=u?"1px":"1.5px",ae=c?.button?.disabledBackgroundColor||`${m}88`,ne=c?.button?.disabledColor||O;return{height:"56px",backgroundColor:C?ae:A?`${m}cc`:B?`${m}ee`:m,color:C?ne:O,border:`${oe} solid ${$}`,borderRadius:c?.button?.borderRadius||"12px",fontSize:"22px",fontWeight:500,fontFamily:'"IBM Plex Mono", monospace',opacity:C?.78:1,transform:C?"none":A?"scale(0.98)":B?"translateY(-2px)":"none",boxShadow:C?`3px 3px 0px ${_}, 4px 4px 0px ${$}`:A?`2px 2px 0px ${$}`:B?`5px 5px 0px ${_}, 6px 6px 0px ${$}`:`3px 3px 0px ${_}, 4px 4px 0px ${$}`,transition:"transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease, color 150ms ease"}}default:return{}}},te=()=>{if(t==="outline")return{};switch(e){case"sm":return{padding:`${s.spacing.sm} ${s.spacing.md}`,fontSize:s.typography.fontSize.sm};case"md":return{padding:`${s.spacing.md} ${s.spacing.lg}`,fontSize:s.typography.fontSize.base};case"lg":return{padding:`${s.spacing.lg} ${s.spacing.xl}`,fontSize:s.typography.fontSize.lg};default:return{}}},re={borderRadius:c?.button?.borderRadius||s.borderRadius.md,fontWeight:c?.button?.fontWeight||s.typography.fontWeight.medium,fontFamily:c?.button?.fontFamily||s.typography.fontFamily,fontSize:c?.button?.fontSize||void 0,transition:"background-color 150ms ease, border-color 150ms ease, color 150ms ease, opacity 150ms ease",cursor:n||o?"not-allowed":"pointer",opacity:(n||o)&&t!=="outline"?.6:1,width:r?"100%":"auto",display:"flex",alignItems:"center",justifyContent:"center",gap:s.spacing.sm,...ee(),...te(),...c?.button?.fontSize&&{fontSize:c.button.fontSize}},P=n||o;return v.jsxs("button",{type:f.type??"button","data-spiceflow-focus":!0,"aria-busy":o||void 0,"aria-disabled":P||void 0,style:{...re,...d},className:i,disabled:P,onMouseEnter:m=>{R(!0),f.onMouseEnter?.(m)},onMouseLeave:m=>{R(!1),N(!1),f.onMouseLeave?.(m)},onMouseDown:m=>{N(!0),f.onMouseDown?.(m)},onMouseUp:m=>{N(!1),f.onMouseUp?.(m)},...f,children:[o&&v.jsx(V,{size:16}),a]})};exports.Button=Ae,exports.CHAIN_CONFIGS=fe,exports.RELAYER_API_URL=z,exports.SpiceFlowProvider=ve,exports.SpiceFlowProviderContext=q,exports.SpiceflowError=p,exports.Spinner=V,exports.buildDarkPalette=ke,exports.buildLightPalette=Ie,exports.createInitialSteps=Ee,exports.createTheme=X,exports.getAllAssetsForChain=ye,exports.getChainConfig=S,exports.getChainName=k,exports.getChainsForAssets=ge,exports.getClientForChain=Y,exports.getDelegateContractAddress=me,exports.getExplorerUrl=he,exports.getRpcUrlForChain=M,exports.getTokenDecimals=be,exports.hasStoredSpiceFlowMode=Ce,exports.isSpiceflowError=ie,exports.j=L,exports.relayerService=I,exports.resolveTheme=Q,exports.useSpiceBrand=Z;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{jsx as v,jsxs as de}from"react/jsx-runtime";import{createContext as L,useEffect as A,useState as _,useCallback as le,useContext as ue,useMemo as fe,useRef as pe}from"react";import{getChainMeta as j,getTokensForChain as me,getDelegateContract as he,ZERO_ADDRESS as ge,isNativeToken as N,getTokenByAddress as ye,getChainIdsByNetwork as be}from"@spicenet-io/spiceflow-core";import{defineChain as we,createPublicClient as xe,http as Be,isAddress as $e,getAddress as Ee,formatUnits as D}from"viem";import{readContract as ve}from"viem/actions";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 Ce(t){return t instanceof f}const z=[{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"}],Re="0xcA11bde05977b3631167028862bE2a173976CA11",Se={4114:"0x860aFc632a6D625B95d8B96f39ECC48E988c6962"},ke=new Set([5115]);function Te(t){const e=Se[t.id]??(ke.has(t.id)?void 0:Re);return we({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 Ie=[1,8453,42161,4114,11155111,421614,84532,5115,123420001114,688688,688689],C=Object.fromEntries(Ie.map(t=>j(t)).filter(t=>t!=null).map(t=>[t.id,{...t,viemChain:Te(t),supportedTokens:me(t.id)}])),Ue=C;let Y={};const M=new Map,H=t=>{Y={...t||{}},M.clear()},O=t=>{const e=Y[t];return e&&typeof e=="string"&&e.length>0?e:C[t]?.rpcUrl},$=t=>C[t],R=t=>{const e=j(t);return e?.displayName||e?.name||`Chain ${t}`},Ae=t=>{const e=he(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);return e},_e=(t,e,a)=>{const r=$(t);return r?.blockExplorer?`${r.blockExplorer}/tx/${e}`:"#"},W=t=>{const e=$(t);if(!e)throw new Error(`Unsupported chain ID: ${t}`);const a=O(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 o=xe({chain:e.viemChain,transport:Be(a,{timeout:15e3,retryCount:2,retryDelay:300}),batch:{multicall:{wait:16}}});return M.set(r,o),o},Ne=()=>{const t={};return Object.values(C).forEach(e=>{t[e.id]={name:e.name,moralisName:e.moralisId||"",chain:e.viemChain,rpcUrl:O(e.id)||e.rpcUrl}}),t},Me=(t,e=[])=>{const a=$(t);if(!a)return[];const r=[];if(![11155111,421614,84532,688689].includes(t)){const o=e.find(i=>i.chainId===t&&i.isNative);o?r.push(o):r.push({address:ge,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(o=>o.isNative);return a.supportedTokens.forEach(o=>{if(s&&N(o.address))return;const i=e.find(d=>d.chainId===t&&d.address.toLowerCase()===o.address.toLowerCase());i?r.push(i):r.push({address:o.address,name:o.name,symbol:o.symbol,decimals:o.decimals,balance:BigInt(0),balanceFormatted:0,balanceUsd:0,logoURI:o.logo,isNative:!1,chainId:t})}),r},Oe=async(t,e)=>{const a=$(t);if(!a)throw new Error(`Unsupported chain ID: ${t}`);const r=e.toLowerCase();if(N(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(o=>o.address.toLowerCase()===r);if(s)return s.decimals}try{if(!$e(e,{strict:!1}))throw new Error(`Invalid token address: ${e}`);const s=Ee(e),o=W(t),i=await ve(o,{address:s,abi:z,functionName:"decimals"});return Number(i)}catch{throw new Error(`Could not determine decimals for token ${e} on chain ${t}`)}},J=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io",G="__SPICEFLOW_RELAYER_API_URL__";function Pe(t,e){const a=e.match(/Output amount (\d+) is insufficient after fees (\d+) on chain (\d+)/);if(!a)return e;const[,r,s,o]=a,i=Number(o),d=BigInt(r),l=BigInt(s);let c;for(const u of t.intents){const b=u.chainBatches.find(E=>E.chainId===i);if(b){c=b;break}}const h=c?.tokenTransfers.find(u=>u.from==="escrow"&&u.to.toLowerCase()===t.user.toLowerCase()&&!N(u.token));if(!h)return`Amount is too small to cover the estimated fee on ${R(i)}.`;const p=ye(h.token,i),g=p?.decimals??18,y=p?.symbol??"tokens",w=D(d,g),n=D(l,g);return`Amount is too small to cover the estimated fee on ${R(i)}. Amount: ${w} ${y}. Estimated fee: ${n} ${y}.`}function Fe(){if(typeof globalThis>"u")return;const t=globalThis[G];return typeof t=="string"&&t.length>0?t:void 0}class Le{constructor(){this.baseUrl=J}setBaseUrl(e){this.baseUrl=e,typeof globalThis<"u"&&(globalThis[G]=e)}getBaseUrl(){return this.getEffectiveBaseUrl()}getEffectiveBaseUrl(){return Fe()||this.baseUrl}async createAction(e){const a=await fetch(`${this.getEffectiveBaseUrl()}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s)});if(!a.ok){const r=await a.text();throw new f("RELAYER_ERROR",`Relayer API error: ${a.status} - ${r}`,{httpStatus:a.status,responseBody:r,endpoint:"/actions"})}return await a.json()}async estimateActionFees(e){const a=await fetch(`${this.getEffectiveBaseUrl()}/actions/fees/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(s,o)=>typeof o=="bigint"?o.toString():o)}),r=await a.json();if(!a.ok||!r.success||!r.data?.feeEstimate){const s=r.error?.message||`Relayer fee estimate error: ${a.status}`,o=Pe(e,s);throw new f("RELAYER_ERROR",o,{httpStatus:a.status,responseBody:JSON.stringify(r),endpoint:"/actions/fees/estimate"})}return r.data.feeEstimate}async estimateBatchGas(e){const a=await fetch(`${this.getEffectiveBaseUrl()}/actions/gas/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(s,o)=>typeof o=="bigint"?o.toString():o)}),r=await a.json();if(!a.ok||!r.success||!r.data?.gasFee){const s=r.error?.message||`Relayer gas estimate error: ${a.status}`;throw new f("RELAYER_ERROR",s,{httpStatus:a.status,responseBody:JSON.stringify(r),endpoint:"/actions/gas/estimate"})}return{gasFee:BigInt(r.data.gasFee),gasQuoteSource:r.data.gasQuoteSource}}async executeStep(e,a,r,s){const o=`${this.getEffectiveBaseUrl()}/actions/${e}/intents/${a}/steps/${r}`,i=fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});let d;try{d=await Promise.race([i,new Promise((l,c)=>setTimeout(()=>c(new f("RELAYER_EXECUTE_ERROR",`Execute step request timed out after ${1e4/1e3}s`,{actionId:e,intentIndex:a,stepIndex:r,endpoint:`/actions/${e}/intents/${a}/steps/${r}`})),1e4))])}catch(l){throw l}if(!d.ok){const l=await d.text();throw new f("RELAYER_EXECUTE_ERROR",`Execute step error: ${d.status} - ${l}`,{httpStatus:d.status,responseBody:l,endpoint:`/actions/${e}/intents/${a}/steps/${r}`,actionId:e})}return{success:!0,transactionHash:(await d.json()).transactionHash}}async checkStepStatus(e,a){const r=e.split("/");let s="";if(r.length>=2){const d=r[0],l=r[1];s=`${this.getEffectiveBaseUrl()}/actions/${d}/intents/${l}/steps/${a}`}else s=`${this.getEffectiveBaseUrl()}/actions/${e}/intents/0/steps/${a}`;const o=await fetch(s);if(!o.ok)throw new f("RELAYER_STATUS_ERROR",`Intent step status check failed: ${o.status}`,{httpStatus:o.status,endpoint:s,intentId:e});const i=await o.json();return{success:!0,data:{status:i.status==="error"?"reverted":i.status,transactionHash:i.txid}}}async createWallet(e,a){const r=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!r.ok){const s=await r.text();throw new f("RELAYER_ERROR",`Create wallet error: ${r.status} - ${s}`,{httpStatus:r.status,endpoint:`/wallets/${e}`})}return r.json()}async getWallet(e){const a=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${e}`);if(!a.ok){const r=await a.text();throw new f("RELAYER_ERROR",`Get wallet error: ${a.status} - ${r}`,{httpStatus:a.status,endpoint:`/wallets/${e}`})}return a.json()}async createWithdrawal(e){const a=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s)});if(!a.ok){const r=await a.text();throw new f("RELAYER_ERROR",`Create withdrawal error: ${a.status} - ${r}`,{httpStatus:a.status,endpoint:"/withdrawals"})}return a.json()}async getWithdrawal(e){const a=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals/${e}`);if(!a.ok){const r=await a.text();throw new f("RELAYER_ERROR",`Get withdrawal error: ${a.status} - ${r}`,{httpStatus:a.status,endpoint:`/withdrawals/${e}`})}return a.json()}async getRollupTimestamp(){const e=await fetch(`${this.getEffectiveBaseUrl()}/time`);if(!e.ok)throw new f("RELAYER_ERROR",`Get rollup timestamp error: ${e.status}`,{httpStatus:e.status,endpoint:"/time"});return e.json()}}const S=new Le,je=(t,e)=>{const a=s=>e?e(s):R(s),r=[];return t.forEach((s,o)=>{const i=s.calls&&s.calls.length>0,d=s.tokenTransfers&&s.tokenTransfers.length>0;if(i||d){const l={stepId:o,status:o===0?"processing":"pending",chainId:s.chainId,chainName:a(s.chainId),description:"Processing transaction"};r.push(l)}}),r},X="spiceflow-mode",q=()=>{if(typeof window>"u")return null;try{const t=window.localStorage.getItem(X);return t==="embedded"?"7702":t==="external"?"ondemand":null}catch{return null}},De=t=>{if(!(typeof window>"u"))try{window.localStorage.setItem(X,t==="7702"?"embedded":"external")}catch{}},ze=()=>q()!==null,Q=L(null),Z=L(null),Ye=({children:t,provider:e,supportedChainIds:a,network:r="testnet",mode:s="7702",skipFlow:o=[],nativeChainId:i,appName:d="Spicenet",apiUrl:l,theme:c,rpcOverrides:h})=>{A(()=>{if(!l)return;const u=S.getBaseUrl();return S.setBaseUrl(l),()=>S.setBaseUrl(u)},[l]),A(()=>(H(h),()=>H(void 0)),[h]);const p=a??be(r),g=c??null,[y,w]=_(()=>q()??s),n=le(u=>{w(u),De(u)},[]);return v(Q.Provider,{value:g,children:v(Z.Provider,{value:{provider:e,supportedChainIds:p,skipFlow:o,mode:y,setMode:n,network:r,nativeChainId:i,appName:d,apiUrl:l,rpcOverrides:h},children:t})})},He={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"}},We={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"},Je={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"},K=(t="light")=>({mode:t,...He,colors:t==="light"?We:Je});function k(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))),o=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")}${o.toString(16).padStart(2,"0")}`}function Ge(t,e){return{shell:e?.shell??"#141414",shellBorder:e?.shellBorder??k(e?.shell??"#141414",.35),shellInnerBorder:e?.shellInnerBorder??k(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 Xe(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 V(t,e){const a=e?{...t,...e}:t,r=a.dark??!1,s=a.primaryColor,o=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:o,shellBorder:k(o,r?.35:.085),shellInnerBorder:k(o,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"}}function ee(t,e){const a=ue(Q)??void 0;return fe(()=>{const r=a??{primaryColor:"#EA4B4B"},s={...t?.primaryColor?{primaryColor:t.primaryColor}:{},...t?.fontFamily?{fontFamily:t.fontFamily}:{},...e!==void 0?{dark:e}:{}},o=V(r,s),{dark:i,primaryColor:d,appName:l}=o,c=K(i?"dark":"light"),h={...c,colors:{...c.colors,primary:d,primaryHover:`${d}dd`},typography:{...c.typography,fontFamily:o.fontFamily}},p={shell:o.shell,shellBorder:o.shellBorder,shellInnerBorder:o.shellInnerBorder,cardBg:o.card,inputBg:o.input,hoverBg:o.hover,textPrimary:o.text,textSecondary:o.textMuted,inputText:o.inputText,inputPlaceholder:o.inputPlaceholder,cardBorder:o.border,inputBorder:o.inputBorder,buttonBorder:o.buttonBorder,successBg:o.successBg,successBorder:o.successBorder,successText:o.successText,warningBg:o.warningBg,warningBorder:o.warningBorder,warningText:o.warningText,errorBg:o.errorBg,errorBorder:o.errorBorder,errorText:o.errorText,infoBg:o.infoBg,infoBorder:o.infoBorder,infoText:o.infoText};return{brand:a,theme:h,dark:i,appName:l,primaryColor:d,dk:p,palette:p}},[a,t,e])}const te="spiceflow-spinner-keyframes";function qe(){if(typeof document>"u"||document.getElementById(te))return;const t=document.createElement("style");t.id=te,t.textContent="@keyframes spiceflow-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}",document.head.appendChild(t)}const re=({size:t=16,borderWidth:e=2,color:a="currentColor",style:r})=>{const s=pe(!1);return A(()=>{s.current||(qe(),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}})},Qe=({variant:t="primary",size:e="md",loading:a=!1,fullWidth:r=!1,disabled:s,children:o,className:i="",style:d,theme:l,styles:c,dark:h,...p})=>{const{theme:g,dark:y,palette:w}=ee(c,h),n=l||g,u=h??y,[b,E]=_(!1),[T,I]=_(!1),U=u?w.shell:"white",ae=()=>{switch(t){case"primary":return{backgroundColor:c?.button?.backgroundColor||n.colors.primary,color:c?.button?.color||"#ffffff",border:`1px solid ${c?.button?.backgroundColor||n.colors.primary}`};case"secondary":return{backgroundColor:n.colors.secondary,color:n.colors.text,border:`1px solid ${n.colors.border}`};case"success":return{backgroundColor:n.colors.success,color:n.colors.text,border:`1px solid ${n.colors.success}`};case"error":return{backgroundColor:n.colors.error,color:n.colors.text,border:`1px solid ${n.colors.error}`};case"ghost":return{backgroundColor:"transparent",color:n.colors.textSecondary,border:`1px solid ${n.colors.border}`};case"outline":{const m=c?.button?.backgroundColor||n.colors.primary,F=c?.button?.color||(u?"#ffffff":"#0e0d0b"),x=c?.button?.borderColor||(u?`${n.colors.primary}88`:"#0e0d0b"),B=s||a,ne=u?"1px":"1.5px",ie=c?.button?.disabledBackgroundColor||`${m}88`,ce=c?.button?.disabledColor||F;return{height:"56px",backgroundColor:B?ie:T?`${m}cc`:b?`${m}ee`:m,color:B?ce:F,border:`${ne} solid ${x}`,borderRadius:c?.button?.borderRadius||"12px",fontSize:"22px",fontWeight:500,fontFamily:'"IBM Plex Mono", monospace',opacity:B?.78:1,transform:B?"none":T?"scale(0.98)":b?"translateY(-2px)":"none",boxShadow:B?`3px 3px 0px ${U}, 4px 4px 0px ${x}`:T?`2px 2px 0px ${x}`:b?`5px 5px 0px ${U}, 6px 6px 0px ${x}`:`3px 3px 0px ${U}, 4px 4px 0px ${x}`,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:`${n.spacing.sm} ${n.spacing.md}`,fontSize:n.typography.fontSize.sm};case"md":return{padding:`${n.spacing.md} ${n.spacing.lg}`,fontSize:n.typography.fontSize.base};case"lg":return{padding:`${n.spacing.lg} ${n.spacing.xl}`,fontSize:n.typography.fontSize.lg};default:return{}}},se={borderRadius:c?.button?.borderRadius||n.borderRadius.md,fontWeight:c?.button?.fontWeight||n.typography.fontWeight.medium,fontFamily:c?.button?.fontFamily||n.typography.fontFamily,fontSize:c?.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:n.spacing.sm,...ae(),...oe(),...c?.button?.fontSize&&{fontSize:c.button.fontSize}},P=s||a;return de("button",{type:p.type??"button","data-spiceflow-focus":!0,"aria-busy":a||void 0,"aria-disabled":P||void 0,style:{...se,...d},className:i,disabled:P,onMouseEnter:m=>{E(!0),p.onMouseEnter?.(m)},onMouseLeave:m=>{E(!1),I(!1),p.onMouseLeave?.(m)},onMouseDown:m=>{I(!0),p.onMouseDown?.(m)},onMouseUp:m=>{I(!1),p.onMouseUp?.(m)},...p,children:[a&&v(re,{size:16}),o]})};export{Qe as B,Ue as C,J as R,re as S,Ne as a,W as b,K as c,Z as d,R as e,_e as f,$ as g,Me as h,Ce as i,z as j,O as k,Ae as l,Oe as m,je as n,f as o,ze as p,Ye as q,S as r,V as s,Ge as t,ee as u,Xe as v};
|
package/dist/auth-dynamic.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),c=require("react"),t=require("./Button-
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),c=require("react"),t=require("./Button-B--Fjq1m.js"),W=require("@dynamic-labs/sdk-react-core"),k=require("./providerWallet-cDeDz-zR.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;
|
package/dist/auth-dynamic.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e,jsxs as g}from"react/jsx-runtime";import A,{useState as
|
|
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-dU4UsC56.js";import{useDynamicContext as j}from"@dynamic-labs/sdk-react-core";import{g as z}from"./providerWallet-DDywdl9_.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};
|
package/dist/auth-privy.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const e=require("react/jsx-runtime"),o=require("react"),c=require("./Button-
|
|
2
|
+
"use strict";const e=require("react/jsx-runtime"),o=require("react"),c=require("./Button-B--Fjq1m.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;
|
package/dist/auth-privy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as r,jsxs as
|
|
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-dU4UsC56.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,13 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { Theme } from "../../types/theme";
|
|
4
|
-
export interface AssetDropdownProps {
|
|
5
|
-
selectedAsset?: SelectedAsset;
|
|
6
|
-
assets: Asset[];
|
|
7
|
-
onAssetSelect: (asset: Asset) => void;
|
|
8
|
-
showDropdown: boolean;
|
|
9
|
-
onToggleDropdown: () => void;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
theme?: Theme;
|
|
12
|
-
}
|
|
2
|
+
import type { AssetDropdownProps } from "../../types/assets";
|
|
13
3
|
export declare const AssetDropdown: React.FC<AssetDropdownProps>;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
export interface ChainIconProps {
|
|
4
|
-
chainId?: number;
|
|
5
|
-
name?: string;
|
|
6
|
-
size?: number;
|
|
7
|
-
theme?: Theme;
|
|
8
|
-
}
|
|
2
|
+
import type { ChainIconProps } from "../../types/assets";
|
|
9
3
|
export declare const ChainIcon: React.FC<ChainIconProps>;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
export interface TokenIconProps {
|
|
4
|
-
symbol: string;
|
|
5
|
-
logoURI?: string;
|
|
6
|
-
size?: number;
|
|
7
|
-
theme?: Theme;
|
|
8
|
-
}
|
|
2
|
+
import type { TokenIconProps } from "../../types/assets";
|
|
9
3
|
export declare const TokenIcon: React.FC<TokenIconProps>;
|
|
@@ -2,6 +2,4 @@ export { AssetSelector } from "./AssetSelector";
|
|
|
2
2
|
export { TokenIcon } from "./TokenIcon";
|
|
3
3
|
export { ChainIcon } from "./ChainIcon";
|
|
4
4
|
export { AssetDropdown } from "./AssetDropdown";
|
|
5
|
-
export type { TokenIconProps } from "
|
|
6
|
-
export type { ChainIconProps } from "./ChainIcon";
|
|
7
|
-
export type { AssetDropdownProps } from "./AssetDropdown";
|
|
5
|
+
export type { TokenIconProps, ChainIconProps, AssetDropdownProps, } from "../../types/assets";
|
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
style?: React.CSSProperties;
|
|
5
|
-
className?: string;
|
|
6
|
-
onExport?: () => void;
|
|
7
|
-
onError?: (error: string) => void;
|
|
8
|
-
}
|
|
2
|
+
import type { ExportWalletButtonProps } from "../../types/wallet";
|
|
3
|
+
export type { ExportWalletButtonProps };
|
|
9
4
|
export declare const ExportWalletButton: React.FC<ExportWalletButtonProps>;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
onAuthError?: (error: string) => void;
|
|
5
|
-
theme?: "light" | "dark";
|
|
6
|
-
className?: string;
|
|
7
|
-
buttonText?: string;
|
|
8
|
-
autoTrigger?: boolean;
|
|
9
|
-
}
|
|
2
|
+
import type { DynamicLoginProps } from "../../types/wallet";
|
|
3
|
+
export type { DynamicLoginProps };
|
|
10
4
|
export declare const DynamicLogin: React.FC<DynamicLoginProps>;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
onAuthError?: (error: string) => void;
|
|
5
|
-
theme?: "light" | "dark";
|
|
6
|
-
className?: string;
|
|
7
|
-
buttonText?: string;
|
|
8
|
-
autoTrigger?: boolean;
|
|
9
|
-
}
|
|
2
|
+
import type { PrivyLoginProps } from "../../types/wallet";
|
|
3
|
+
export type { PrivyLoginProps };
|
|
10
4
|
export declare const PrivyLogin: React.FC<PrivyLoginProps>;
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
onAuthError?: (error: string) => void;
|
|
5
|
-
theme?: "light" | "dark";
|
|
6
|
-
className?: string;
|
|
7
|
-
buttonText?: string;
|
|
8
|
-
autoTrigger?: boolean;
|
|
9
|
-
}
|
|
2
|
+
import type { ProviderLoginProps } from "../../types/wallet";
|
|
3
|
+
export type { ProviderLoginProps };
|
|
10
4
|
export declare const ProviderLogin: React.FC<ProviderLoginProps>;
|
|
@@ -1,16 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
|
|
4
|
-
export interface DepositRecoveryPromptProps {
|
|
5
|
-
isOpen: boolean;
|
|
6
|
-
onClose: () => void;
|
|
7
|
-
deposits: VerifiedPendingDeposit[];
|
|
8
|
-
onComplete: (deposit: VerifiedPendingDeposit) => void;
|
|
9
|
-
onCancel: (deposit: VerifiedPendingDeposit) => void;
|
|
10
|
-
onSkip: () => void;
|
|
11
|
-
onChangeWallet?: () => void;
|
|
12
|
-
isProcessing: boolean;
|
|
13
|
-
error?: string | null;
|
|
14
|
-
styles?: CustomStyles;
|
|
15
|
-
}
|
|
2
|
+
import type { DepositRecoveryPromptProps } from "../../types/deposit";
|
|
16
3
|
export declare const DepositRecoveryPrompt: React.FC<DepositRecoveryPromptProps>;
|
|
@@ -1,40 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export interface DepositConfirmationData {
|
|
5
|
-
network: string;
|
|
6
|
-
amount: string;
|
|
7
|
-
symbol: string;
|
|
8
|
-
chainId?: number;
|
|
9
|
-
creditedAmount?: string;
|
|
10
|
-
spicenetFee?: string;
|
|
11
|
-
networkFee?: string;
|
|
12
|
-
quoteSource?: string;
|
|
13
|
-
}
|
|
14
|
-
export interface DepositConfirmationModalProps {
|
|
15
|
-
isOpen: boolean;
|
|
16
|
-
onClose: () => void;
|
|
17
|
-
onConfirm: () => void;
|
|
18
|
-
data: DepositConfirmationData | null;
|
|
19
|
-
isExecuting?: boolean;
|
|
20
|
-
error?: string | null;
|
|
21
|
-
theme: Theme;
|
|
22
|
-
styles?: CustomStyles;
|
|
23
|
-
intentStatus?: IntentStatus | null;
|
|
24
|
-
postDepositStatus?: "idle" | "executing" | "success" | "error";
|
|
25
|
-
hasPostDepositInstruction?: boolean;
|
|
26
|
-
}
|
|
2
|
+
import type { DepositConfirmationData, DepositConfirmationModalProps } from "../../types/deposit";
|
|
3
|
+
export type { DepositConfirmationData, DepositConfirmationModalProps };
|
|
27
4
|
export declare const DepositConfirmationModal: React.FC<DepositConfirmationModalProps>;
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
postDepositSuccess?: boolean;
|
|
31
|
-
postDepositAmount?: string | null;
|
|
32
|
-
postDepositStatus?: "idle" | "executing" | "success" | "error";
|
|
33
|
-
depositActionLabel?: string;
|
|
34
|
-
sourceChainName?: string;
|
|
35
|
-
directDepositStatus?: "idle" | "processing" | "success";
|
|
36
|
-
directDepositTxHash?: string | null;
|
|
37
|
-
directDepositChainId?: number | null;
|
|
38
|
-
styles?: CustomStyles;
|
|
39
|
-
}
|
|
5
|
+
export type { StatusToastProps } from "../../types/deposit";
|
|
6
|
+
import type { StatusToastProps } from "../../types/deposit";
|
|
40
7
|
export declare const StatusToast: React.FC<StatusToastProps>;
|
|
@@ -1,18 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { Address } from "viem";
|
|
4
|
-
import { Asset } from "../../types/assets";
|
|
5
|
-
import { CustomStyles } from "../../types/theme";
|
|
6
|
-
export interface SelectTokenModalProps {
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
onClose: () => void;
|
|
9
|
-
onTokenSelect: (asset: Asset) => void;
|
|
10
|
-
walletAddress: Address;
|
|
11
|
-
supportedChainIds?: number[];
|
|
12
|
-
network?: Network;
|
|
13
|
-
prefetchedAssets?: Asset[] | null;
|
|
14
|
-
styles?: CustomStyles;
|
|
15
|
-
dark?: boolean;
|
|
16
|
-
allowedTokens?: string[];
|
|
17
|
-
}
|
|
2
|
+
import type { SelectTokenModalProps } from "../../types/deposit";
|
|
18
3
|
export declare const SelectTokenModal: React.FC<SelectTokenModalProps>;
|
|
@@ -1,37 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { ChainBatch } from "../../types/authorization";
|
|
5
|
-
export interface EscrowRecovery {
|
|
6
|
-
chainId: number;
|
|
7
|
-
tokenAddress: string;
|
|
8
|
-
tokenSymbol: string;
|
|
9
|
-
tokenDecimals: number;
|
|
10
|
-
amount: string;
|
|
11
|
-
}
|
|
12
|
-
export interface SpiceDepositProps {
|
|
13
|
-
isOpen: boolean;
|
|
14
|
-
onClose: () => void;
|
|
15
|
-
styles?: CustomStyles;
|
|
16
|
-
depositBatches?: ChainBatch[] | ((context: PostDepositContext) => Promise<ChainBatch[]>) | ((depositAmount: string, depositTokenAddress: string) => Promise<ChainBatch[]>);
|
|
17
|
-
allowedTokens?: string[];
|
|
18
|
-
onDepositAmountChange?: (amount: string) => void;
|
|
19
|
-
destinationChainId?: number;
|
|
20
|
-
destinationTokenAddress?: string;
|
|
21
|
-
onDepositExecute?: (bridgedAmount: string) => Promise<void> | void;
|
|
22
|
-
depositActionLabel?: string;
|
|
23
|
-
airdrop?: boolean;
|
|
24
|
-
sponsorGas?: boolean;
|
|
25
|
-
escrowRecovery?: EscrowRecovery;
|
|
26
|
-
skipTokenSelection?: boolean;
|
|
27
|
-
onDepositSuccess?: (detail: {
|
|
28
|
-
type: "deposit";
|
|
29
|
-
status: "success";
|
|
30
|
-
amount?: string;
|
|
31
|
-
asset?: string;
|
|
32
|
-
sourceChain?: string;
|
|
33
|
-
txHash?: string;
|
|
34
|
-
}) => void;
|
|
35
|
-
skipRecovery?: boolean;
|
|
36
|
-
}
|
|
2
|
+
import type { EscrowRecovery, SpiceDepositProps } from "../../types/deposit";
|
|
3
|
+
export type { EscrowRecovery, SpiceDepositProps };
|
|
37
4
|
export declare const SpiceDeposit: React.FC<SpiceDepositProps>;
|
|
@@ -1,50 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
options: SpiceLockModalProps["durationOptions"];
|
|
5
|
-
selectedIndex: number;
|
|
6
|
-
onSelect: (index: number) => void;
|
|
7
|
-
primaryColor: string;
|
|
8
|
-
dark?: boolean;
|
|
9
|
-
textPrimary?: string;
|
|
10
|
-
textSecondary?: string;
|
|
11
|
-
trackColor?: string;
|
|
12
|
-
}
|
|
2
|
+
import type { LockDurationSliderProps, LockExpiryRowProps, VotingPowerRowProps, LockConfirmationData, LockConfirmationPanelProps } from "../../types/lock";
|
|
3
|
+
export type { LockDurationSliderProps, LockExpiryRowProps, VotingPowerRowProps, LockConfirmationData, LockConfirmationPanelProps, };
|
|
13
4
|
export declare const LockDurationSlider: React.FC<LockDurationSliderProps>;
|
|
14
|
-
export interface LockExpiryRowProps {
|
|
15
|
-
durationMonths: number | undefined;
|
|
16
|
-
fontFamily: string;
|
|
17
|
-
dark?: boolean;
|
|
18
|
-
textPrimary?: string;
|
|
19
|
-
textSecondary?: string;
|
|
20
|
-
}
|
|
21
5
|
export declare const LockExpiryRow: React.FC<LockExpiryRowProps>;
|
|
22
|
-
export interface VotingPowerRowProps {
|
|
23
|
-
votes: number | undefined;
|
|
24
|
-
fontFamily: string;
|
|
25
|
-
dark?: boolean;
|
|
26
|
-
textPrimary?: string;
|
|
27
|
-
textSecondary?: string;
|
|
28
|
-
}
|
|
29
6
|
export declare const VotingPowerRow: React.FC<VotingPowerRowProps>;
|
|
30
|
-
export interface LockConfirmationData {
|
|
31
|
-
sourceNetwork: string;
|
|
32
|
-
depositedAmount: string;
|
|
33
|
-
depositedSymbol: string;
|
|
34
|
-
reppoReceived: string;
|
|
35
|
-
reppoSymbol: string;
|
|
36
|
-
txHash?: string;
|
|
37
|
-
explorerUrl?: string;
|
|
38
|
-
}
|
|
39
|
-
export interface LockConfirmationPanelProps {
|
|
40
|
-
isOpen: boolean;
|
|
41
|
-
data: LockConfirmationData | null;
|
|
42
|
-
isLocking: boolean;
|
|
43
|
-
lockError: string | null;
|
|
44
|
-
onContinue: () => void;
|
|
45
|
-
onClose: () => void;
|
|
46
|
-
primaryColor: string;
|
|
47
|
-
fontFamily: string;
|
|
48
|
-
dark?: boolean;
|
|
49
|
-
}
|
|
50
7
|
export declare const LockConfirmationPanel: React.FC<LockConfirmationPanelProps>;
|
|
@@ -1,31 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { CustomStyles } from "../../types/theme";
|
|
5
|
-
import type { BuildActionCallsContext, SpiceSupplyProps } from "../../types/supply";
|
|
6
|
-
export interface SpicePayProps {
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
onClose: () => void;
|
|
9
|
-
paymentTokenAddress: Address;
|
|
10
|
-
paymentTokenSymbol: string;
|
|
11
|
-
paymentTokenDecimals: number;
|
|
12
|
-
paymentTokenLogoURI?: string;
|
|
13
|
-
paymentChainId: number;
|
|
14
|
-
paymentAmount?: string;
|
|
15
|
-
amountInputMode?: "fixed" | "adjustable";
|
|
16
|
-
minPaymentAmount?: string;
|
|
17
|
-
maxPaymentAmount?: string;
|
|
18
|
-
onAmountChange?: (amount: string) => void;
|
|
19
|
-
buildActionCalls: (amount: bigint, ctx: BuildActionCallsContext) => Call[];
|
|
20
|
-
buildSpicenetBatch?: SpiceSupplyProps["buildSpicenetBatch"];
|
|
21
|
-
sourceChains?: number[];
|
|
22
|
-
onPaymentSuccess?: (txHash?: string) => void;
|
|
23
|
-
onPaymentError?: (error: Error) => void;
|
|
24
|
-
styles?: CustomStyles;
|
|
25
|
-
dark?: boolean;
|
|
26
|
-
title?: string;
|
|
27
|
-
subtitle?: React.ReactNode;
|
|
28
|
-
ctaLabel?: string;
|
|
29
|
-
onAddFunds?: () => void;
|
|
30
|
-
}
|
|
2
|
+
import type { SpicePayProps } from "../../types/pay";
|
|
3
|
+
export type { SpicePayProps };
|
|
31
4
|
export declare const SpicePay: React.FC<SpicePayProps>;
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
quoteError: string | null;
|
|
5
|
-
estimatedOutput: string | null;
|
|
6
|
-
destinationSymbol: string;
|
|
7
|
-
destinationLogoURI?: string;
|
|
8
|
-
textPrimary: string;
|
|
9
|
-
textSecondary: string;
|
|
10
|
-
cardBg: string;
|
|
11
|
-
cardBorder: string;
|
|
12
|
-
fontFamily: string;
|
|
13
|
-
primaryColor: string;
|
|
14
|
-
}
|
|
2
|
+
import type { SupplyEstimateProps } from "../../types/supply";
|
|
3
|
+
export type { SupplyEstimateProps };
|
|
15
4
|
export declare const SupplyEstimate: React.FC<SupplyEstimateProps>;
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
label: string;
|
|
5
|
-
icon?: string;
|
|
6
|
-
detail?: string;
|
|
7
|
-
}
|
|
2
|
+
import type { SelectPopoverItem } from "../../types/withdraw";
|
|
3
|
+
export type { SelectPopoverItem };
|
|
8
4
|
interface SelectPopoverProps {
|
|
9
5
|
isOpen: boolean;
|
|
10
6
|
position: {
|
|
@@ -18,4 +14,3 @@ interface SelectPopoverProps {
|
|
|
18
14
|
portalAttribute: string;
|
|
19
15
|
}
|
|
20
16
|
export declare const SelectPopover: React.FC<SelectPopoverProps>;
|
|
21
|
-
export {};
|
|
@@ -1,29 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { ChainBatch } from "../../types/authorization";
|
|
5
|
-
import { DestinationToken } from "../../types/withdraw";
|
|
6
|
-
export interface SpiceWithdrawProps {
|
|
7
|
-
isOpen: boolean;
|
|
8
|
-
onClose: () => void;
|
|
9
|
-
styles?: CustomStyles;
|
|
10
|
-
onWithdrawExecute?: (withdrawnAmount: string) => Promise<void> | void;
|
|
11
|
-
withdrawActionLabel?: string;
|
|
12
|
-
onWithdrawSuccess?: (data: {
|
|
13
|
-
token: string;
|
|
14
|
-
amount: string;
|
|
15
|
-
chainId: number;
|
|
16
|
-
}) => void;
|
|
17
|
-
onWithdrawError?: (error: string) => void;
|
|
18
|
-
autoCloseDelay?: number;
|
|
19
|
-
supportedChains?: number[];
|
|
20
|
-
availableTokens?: Record<number, DestinationToken[]>;
|
|
21
|
-
buildSpicenetBatch?: (params: {
|
|
22
|
-
destinationChainId: number;
|
|
23
|
-
deliveryToken: Address;
|
|
24
|
-
deliveryAmount: bigint;
|
|
25
|
-
deliveryRecipient: Address;
|
|
26
|
-
}) => ChainBatch | null;
|
|
27
|
-
}
|
|
2
|
+
import type { SpiceWithdrawProps } from "../../types/withdraw";
|
|
3
|
+
export type { SpiceWithdrawProps };
|
|
28
4
|
export declare const SpiceWithdrawFlow: React.FC<SpiceWithdrawProps>;
|
|
29
5
|
export declare const SpiceWithdraw: React.FC<SpiceWithdrawProps>;
|
|
@@ -1,9 +1,3 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { StepStatus, OverallStatus } from "../../types/status";
|
|
4
|
-
export interface StatusIconProps {
|
|
5
|
-
status: StepStatus | OverallStatus;
|
|
6
|
-
size?: number;
|
|
7
|
-
theme?: Theme;
|
|
8
|
-
}
|
|
2
|
+
import type { StatusIconProps } from "../../types/status";
|
|
9
3
|
export declare const StatusIcon: React.FC<StatusIconProps>;
|