@spicenet-io/spiceflow-ui 2.4.3 → 2.4.4
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/{auth-dynamic-BvFKjvyL.js → auth-dynamic-C6UW-gM4.js} +1 -1
- package/dist/auth-dynamic.js +1 -1
- package/dist/auth-privy.js +1 -1
- package/dist/auth-starknet.js +1 -1
- package/dist/index.cjs.js +6 -6
- package/dist/index.js +9 -9
- package/dist/{useSpiceBrand-Bh0l5V10.js → useSpiceBrand-CViwDprf.js} +1 -1
- package/package.json +1 -1
- /package/dist/{Button-DjsYc4v4.js → Button-CaguAr48.js} +0 -0
- /package/dist/{index-qMc4tFxj.js → index-BBac-tQW.js} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{createContext as h,useContext as w,useMemo as T}from"react";import{jsx as g}from"react/jsx-runtime";import{getChainIdsByNetwork as S}from"@spicenet-io/spiceflow-core";import{g as E}from"./index-
|
|
2
|
+
import{createContext as h,useContext as w,useMemo as T}from"react";import{jsx as g}from"react/jsx-runtime";import{getChainIdsByNetwork as S}from"@spicenet-io/spiceflow-core";import{g as E}from"./index-BBac-tQW.js";import{c as I}from"./Button-CaguAr48.js";class d extends Error{constructor(e,s,r={}){super(s),this.code=e,this.context=r,this.name="SpiceflowError",Error.captureStackTrace&&Error.captureStackTrace(this,d)}}function k(o){return o instanceof d}const B=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-submission-api-dev.spicenet.io";class ${constructor(){this.baseUrl=B}setBaseUrl(e){this.baseUrl=e}async createAction(e){const s=await fetch(`${this.baseUrl}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e,(r,a)=>typeof a=="bigint"?a.toString():a)});if(!s.ok){const r=await s.text();throw new d("RELAYER_ERROR",`Relayer API error: ${s.status} - ${r}`,{httpStatus:s.status,responseBody:r,endpoint:"/actions"})}return s.json()}async executeStep(e,s,r,a){const t=await fetch(`${this.baseUrl}/actions/${e}/intents/${s}/steps/${r}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});if(!t.ok){const n=await t.text();throw new d("RELAYER_EXECUTE_ERROR",`Execute step error: ${t.status} - ${n}`,{httpStatus:t.status,responseBody:n,endpoint:`/actions/${e}/intents/${s}/steps/${r}`,actionId:e})}return{success:!0,transactionHash:(await t.json()).transactionHash}}async checkStepStatus(e,s){const r=e.split("/");let a="";if(r.length>=2){const i=r[0],c=r[1];a=`${this.baseUrl}/actions/${i}/intents/${c}/steps/${s}`}else a=`${this.baseUrl}/actions/${e}/intents/0/steps/${s}`;const t=await fetch(a);if(!t.ok)throw new d("RELAYER_STATUS_ERROR",`Intent step status check failed: ${t.status}`,{httpStatus:t.status,endpoint:a,intentId:e});const n=await t.json();return{success:!0,data:{status:n.status==="error"?"reverted":n.status,transactionHash:n.txid}}}async submitSpiceDeposit(e){const s=e.isDeposit?"deposit":"withdrawal";try{const r=await fetch(`${this.baseUrl}/spicedeposit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),a=await r.json();return!r.ok||!a.success?(console.error(`Failed to submit ${s} request to API:`,a.error?.message),{success:!1,error:a.error}):a}catch(r){return console.error(`Error submitting ${s} request to API:`,r),{success:!1,error:{message:r instanceof Error?r.message:"Unknown error"}}}}async requestAirdrop(e){try{const s=await fetch(`${this.baseUrl}/airdrop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:e.tag||"default",airdrops:[{chainId:e.chainId,tokenId:e.tokenId,wallet:e.wallet,amount:e.amount||"0.0001"}]})}),r=await s.json().catch(()=>({}));if(!s.ok){const t=r?.message||r?.errors?.[0]?.error||"Failed to request airdrop";return{success:!1,errorMessage:String(t)}}const a=r?.airdrops?.[e.chainId]?.[e.tokenId]?.txHash;return r.errors&&r.errors.length>0?{success:!1,errorMessage:r.errors[0].error}:{success:!0,txHash:a}}catch(s){return{success:!1,errorMessage:s?.message&&typeof s.message=="string"?s.message:"Failed to request airdrop"}}}}const m=new $,v=(o,e)=>{const s=a=>e?e(a):E(a),r=[];return o.forEach((a,t)=>{const n=a.calls&&a.calls.length>0,i=a.tokenTransfers&&a.tokenTransfers.length>0;if(n||i){const c={stepId:t,status:t===0?"processing":"pending",chainId:a.chainId,chainName:s(a.chainId),description:"Processing transaction"};r.push(c)}}),r},x=h(null),b=h(null),P=({children:o,provider:e,supportedChainIds:s,network:r="testnet",mode:a="7702",skipFlow:t=[],nativeChainId:n,appName:i="Spicenet",apiUrl:c,theme:f})=>{c&&m.setBaseUrl(c);const p=s??S(r),l=f??null;return g(x.Provider,{value:l,children:g(b.Provider,{value:{provider:e,supportedChainIds:p,skipFlow:t,mode:a,network:r,nativeChainId:n,appName:i,apiUrl:c},children:o})})};function u(o,e){const s=o.replace("#",""),r=Math.max(0,Math.round(parseInt(s.substring(0,2),16)*(1-e))),a=Math.max(0,Math.round(parseInt(s.substring(2,4),16)*(1-e))),t=Math.max(0,Math.round(parseInt(s.substring(4,6),16)*(1-e)));return`#${r.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${t.toString(16).padStart(2,"0")}`}function R(o,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 C(o){return{shell:"#ffffff",shellBorder:"#E9E9E9",shellInnerBorder:"#D5D5D5",cardBg:"#f9fafb",inputBg:"#ffffff",hoverBg:"#f3f4f6",textPrimary:"#111827",textSecondary:"#6b7280",inputText:"#111827",inputPlaceholder:"#9ca3af",cardBorder:"#E0E0E0",inputBorder:"#d1d5db",buttonBorder:"#0e0d0b",successBg:"#d1fae5",successBorder:"#6ee7b7",successText:"#065f46",warningBg:"#fef3c7",warningBorder:"#fcd34d",warningText:"#92400e",errorBg:"#fee2e2",errorBorder:"#fca5a5",errorText:"#dc2626",infoBg:"#dbeafe",infoBorder:"#93c5fd",infoText:"#1e40af"}}function y(o,e){const s=e?{...o,...e}:o,r=s.dark??!1,a=s.primaryColor,t=s.shell??(r?"#141414":"#ffffff");return{primaryColor:a,dark:r,fontFamily:s.fontFamily??'"Helvetica Neue", sans-serif',appName:s.appName??"Spicenet",logo:s.logo,borderRadius:s.borderRadius??"8px",shell:t,shellBorder:u(t,r?.35:.085),shellInnerBorder:u(t,r?.55:.165),card:s.card??(r?"#1e1e1e":"#f9fafb"),input:r?"#171717":"#ffffff",hover:r?"#2a2a2a":"#f3f4f6",text:s.text??(r?"#ffffff":"#111827"),textMuted:s.textMuted??(r?"#888888":"#6b7280"),inputText:r?"#e0e0e0":"#111827",inputPlaceholder:r?"#555555":"#9ca3af",border:s.border??(r?"rgba(255,255,255,0.08)":"#E0E0E0"),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":"#fcd34d",warningText:r?"#fbbf24":"#92400e",errorBg:r?"#1f0d0d":"#fee2e2",errorBorder:r?"#4a2020":"#fca5a5",errorText:r?"#f87171":"#dc2626",infoBg:r?"#0d1325":"#dbeafe",infoBorder:r?"#2a3a5a":"#93c5fd",infoText:r?"#60a5fa":"#1e40af"}}function U(o,e){const s=w(x)??void 0;return T(()=>{const r=s??{primaryColor:"#EA4B4B"},a={...o?.primaryColor?{primaryColor:o.primaryColor}:{},...o?.fontFamily?{fontFamily:o.fontFamily}:{},...e!==void 0?{dark:e}:{}},t=y(r,a),{dark:n,primaryColor:i,appName:c}=t,f=I(n?"dark":"light"),p={...f,colors:{...f.colors,primary:i,primaryHover:`${i}dd`},typography:{...f.typography,fontFamily:t.fontFamily}},l={shell:t.shell,shellBorder:t.shellBorder,shellInnerBorder:t.shellInnerBorder,cardBg:t.card,inputBg:t.input,hoverBg:t.hover,textPrimary:t.text,textSecondary:t.textMuted,inputText:t.inputText,inputPlaceholder:t.inputPlaceholder,cardBorder:t.border,inputBorder:t.inputBorder,buttonBorder:t.buttonBorder,successBg:t.successBg,successBorder:t.successBorder,successText:t.successText,warningBg:t.warningBg,warningBorder:t.warningBorder,warningText:t.warningText,errorBg:t.errorBg,errorBorder:t.errorBorder,errorText:t.errorText,infoBg:t.infoBg,infoBorder:t.infoBorder,infoText:t.infoText};return{brand:s,theme:p,dark:n,appName:c,primaryColor:i,dk:l,palette:l}},[s,o,e])}export{B as R,b as S,C as a,R as b,v as c,d,P as e,y as f,k as i,m as r,U as u};
|
package/package.json
CHANGED
|
File without changes
|
|
File without changes
|