@spicenet-io/spiceflow-ui 3.0.2 → 3.0.3
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.cjs.js +1 -1
- package/dist/auth-dynamic.js +1 -1
- package/dist/auth-starknet.cjs.js +1 -1
- package/dist/auth-starknet.js +1 -1
- package/dist/components/AccountDisplay/AccountActions.d.ts +1 -1
- package/dist/components/ProviderLogins/index.d.ts +0 -2
- package/dist/components/SpiceDeposit/DepositRecoveryPrompt.d.ts +1 -0
- package/dist/components/SpiceDeposit/DepositStatusModal.d.ts +4 -0
- package/dist/components/SpiceWithdraw/SpiceWithdraw.d.ts +7 -0
- package/dist/components/ui/SpiceModalShell.d.ts +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useGaslessExecution/index.d.ts +4 -1
- package/dist/hooks/useSmartWallet.d.ts +1 -0
- package/dist/index-BliUKoV3.js +2 -0
- package/dist/index-DfIyc-i4.js +2 -0
- package/dist/index.cjs.js +13 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -9
- package/dist/providerWallet-BkoKGNWP.js +2 -0
- package/dist/providerWallet-BxQfn50I.js +2 -0
- package/dist/providers/SpiceFlowProvider.d.ts +2 -0
- package/dist/types/account.d.ts +3 -0
- package/dist/types/assets.d.ts +11 -0
- package/dist/types/authorization.d.ts +1 -0
- package/dist/types/deposit.d.ts +46 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/rollup.d.ts +50 -0
- package/dist/types/supply.d.ts +7 -1
- package/dist/types/unified.d.ts +32 -0
- package/dist/useSpiceBrand-BXIOIB0Z.js +2 -0
- package/dist/useSpiceBrand-rUjSu3Za.js +2 -0
- package/dist/utils/abis/spicenet.d.ts +49 -0
- package/dist/utils/abis/spicenetWalletManager.d.ts +566 -0
- package/dist/utils/assetDisplay.d.ts +4 -0
- package/dist/utils/chains/index.d.ts +2 -0
- package/dist/utils/logos.d.ts +2 -0
- package/dist/utils/relayer/index.d.ts +20 -4
- package/dist/utils/rollupBalances.d.ts +14 -0
- package/package.json +2 -2
- package/dist/auth-dynamic-CG0Ou9V1.js +0 -2
- package/dist/auth-dynamic-CaSspPic.js +0 -2
- package/dist/index-BOMLw4PF.js +0 -2
- package/dist/index-DFMaR3pe.js +0 -2
- package/dist/useSpiceBrand-Dk9KS_yU.js +0 -2
- package/dist/useSpiceBrand-QbPbGjw5.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";const o=require("viem"),c=require("./index-DfIyc-i4.js"),a=e=>{if(!e)return!1;const t=e.connector;if(!t)return!1;if(t.isEmbeddedWallet===!0)return!0;const r=(t.key||t.connectorKey||"").toLowerCase();if(r.includes("embedded")||r.includes("turnkey"))return!0;const n=(t.name||e.walletName||"").toLowerCase();return!!(n.includes("embedded")||n.includes("turnkey"))},s=e=>(e?.connectedWallets||[]).find(t=>a(t))||(a(e?.primaryWallet)?e.primaryWallet:null),u=e=>(e?.connectedWallets||[]).find(t=>t?.address&&t?.connector&&!a(t))||null,l=async(e,t)=>{if(!e?.address)throw new Error("Wallet not available");if(typeof e.getWalletClient=="function"){const r=t===void 0?[void 0]:[String(t),t,void 0];let n=null;for(const d of r)try{const i=await e.getWalletClient(d);if(i)return i}catch(i){n=i}if(n)throw n}if(typeof e.getEthereumProvider=="function"){const r=await e.getEthereumProvider(),n=t?c.getChainConfig(t)?.viemChain:void 0;return o.createWalletClient({account:e.address,chain:n,transport:o.custom(r)})}throw new Error("Wallet client not available")},m=async(e,t)=>{if(!e?.address)throw new Error("Wallet not available");if(typeof e.getEthereumProvider=="function")return e.getEthereumProvider();const r=await l(e,t);return{request:n=>r.request(n)}},f=(e,t)=>({address:e?.address||t.address,chainId:Number(e?.chainId??t.chainId),contractAddress:e?.contractAddress||e?.delegate||t.contractAddress,nonce:BigInt(e?.nonce??t.nonce),r:e?.r,s:e?.s,yParity:(()=>{if(typeof e?.yParity=="number")return e.yParity;const r=Number(e?.v??27);return Number.isFinite(r)?r>=27?r-27:r:0})()});exports.getDynamicEmbeddedWallet=s,exports.getDynamicExternalWallet=u,exports.getProviderEthereumProvider=m,exports.getProviderWalletClient=l,exports.normalizeAuthorization=f;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{createWalletClient as l,custom as d}from"viem";import{g as c}from"./index-BliUKoV3.js";const o=t=>{if(!t)return!1;const e=t.connector;if(!e)return!1;if(e.isEmbeddedWallet===!0)return!0;const r=(e.key||e.connectorKey||"").toLowerCase();if(r.includes("embedded")||r.includes("turnkey"))return!0;const n=(e.name||t.walletName||"").toLowerCase();return!!(n.includes("embedded")||n.includes("turnkey"))},u=t=>(t?.connectedWallets||[]).find(e=>o(e))||(o(t?.primaryWallet)?t.primaryWallet:null),f=t=>(t?.connectedWallets||[]).find(e=>e?.address&&e?.connector&&!o(e))||null,i=async(t,e)=>{if(!t?.address)throw new Error("Wallet not available");if(typeof t.getWalletClient=="function"){const r=e===void 0?[void 0]:[String(e),e,void 0];let n=null;for(const s of r)try{const a=await t.getWalletClient(s);if(a)return a}catch(a){n=a}if(n)throw n}if(typeof t.getEthereumProvider=="function"){const r=await t.getEthereumProvider(),n=e?c(e)?.viemChain:void 0;return l({account:t.address,chain:n,transport:d(r)})}throw new Error("Wallet client not available")},m=async(t,e)=>{if(!t?.address)throw new Error("Wallet not available");if(typeof t.getEthereumProvider=="function")return t.getEthereumProvider();const r=await i(t,e);return{request:n=>r.request(n)}},y=(t,e)=>({address:t?.address||e.address,chainId:Number(t?.chainId??e.chainId),contractAddress:t?.contractAddress||t?.delegate||e.contractAddress,nonce:BigInt(t?.nonce??e.nonce),r:t?.r,s:t?.s,yParity:(()=>{if(typeof t?.yParity=="number")return t.yParity;const r=Number(t?.v??27);return Number.isFinite(r)?r>=27?r-27:r:0})()});export{m as a,f as b,i as c,u as g,y as n};
|
|
@@ -15,6 +15,7 @@ export declare const SpiceFlowProviderContext: React.Context<{
|
|
|
15
15
|
nativeChainId?: number;
|
|
16
16
|
appName?: string;
|
|
17
17
|
apiUrl?: string;
|
|
18
|
+
rpcOverrides?: Record<number, string>;
|
|
18
19
|
} | null>;
|
|
19
20
|
export interface SpiceFlowProviderProps {
|
|
20
21
|
children: React.ReactNode;
|
|
@@ -32,5 +33,6 @@ export interface SpiceFlowProviderProps {
|
|
|
32
33
|
appName?: string;
|
|
33
34
|
apiUrl?: string;
|
|
34
35
|
theme?: SpiceTheme;
|
|
36
|
+
rpcOverrides?: Record<number, string>;
|
|
35
37
|
}
|
|
36
38
|
export declare const SpiceFlowProvider: React.FC<SpiceFlowProviderProps>;
|
package/dist/types/account.d.ts
CHANGED
|
@@ -15,8 +15,11 @@ export interface CustomSection {
|
|
|
15
15
|
export interface SpiceAsset {
|
|
16
16
|
tokenAddress: string;
|
|
17
17
|
tokenSymbol: string;
|
|
18
|
+
tokenDisplaySymbol?: string;
|
|
19
|
+
tokenDisplayName?: string;
|
|
18
20
|
tokenDecimals: number;
|
|
19
21
|
chainId: number;
|
|
22
|
+
chainDisplayName?: string;
|
|
20
23
|
balance: string;
|
|
21
24
|
balanceFormatted: number;
|
|
22
25
|
usdValue: number;
|
package/dist/types/assets.d.ts
CHANGED
|
@@ -11,6 +11,17 @@ export interface Asset {
|
|
|
11
11
|
balanceUsd: number;
|
|
12
12
|
isNative: boolean;
|
|
13
13
|
logoURI?: string;
|
|
14
|
+
displaySymbol?: string;
|
|
15
|
+
displayName?: string;
|
|
16
|
+
displayChainName?: string;
|
|
17
|
+
receiptTokenId?: string;
|
|
18
|
+
receiptTokenName?: string;
|
|
19
|
+
receiptTokenDecimals?: number;
|
|
20
|
+
chainTokens?: Record<string, {
|
|
21
|
+
name?: string;
|
|
22
|
+
decimals?: number;
|
|
23
|
+
}>;
|
|
24
|
+
isUniversal?: boolean;
|
|
14
25
|
}
|
|
15
26
|
export interface SelectedAsset {
|
|
16
27
|
asset: Asset;
|
package/dist/types/deposit.d.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { Asset } from "./assets";
|
|
2
|
-
import { CustomStyles, ThemeMode } from "./theme";
|
|
3
|
-
import { UseAssetInputReturn } from "../hooks/useAssetInput";
|
|
4
1
|
import { Address } from "viem";
|
|
5
2
|
import { ChainBatch } from ".";
|
|
3
|
+
import { UseAssetInputReturn } from "../hooks/useAssetInput";
|
|
4
|
+
import { Asset } from "./assets";
|
|
5
|
+
import { CustomStyles, ThemeMode } from "./theme";
|
|
6
|
+
export interface PostDepositContext {
|
|
7
|
+
sourceChainId: number;
|
|
8
|
+
depositTokenAddress: Address;
|
|
9
|
+
depositAmount: string;
|
|
10
|
+
depositTokenDecimals: number;
|
|
11
|
+
destinationTokenAddress?: Address;
|
|
12
|
+
destinationChainId?: number;
|
|
13
|
+
destinationAmount?: bigint;
|
|
14
|
+
destinationTokenDecimals?: number;
|
|
15
|
+
}
|
|
6
16
|
export interface SpiceDepositRequest {
|
|
7
17
|
user: string;
|
|
8
18
|
txHash: string;
|
|
@@ -10,13 +20,43 @@ export interface SpiceDepositRequest {
|
|
|
10
20
|
tokenAddress: string;
|
|
11
21
|
chainId: number;
|
|
12
22
|
amount: string;
|
|
23
|
+
amountMode?: "gross_input" | "net_input";
|
|
13
24
|
}
|
|
14
25
|
export interface SpiceDepositResponse {
|
|
15
26
|
success: boolean;
|
|
27
|
+
data?: {
|
|
28
|
+
creditedAmount?: string;
|
|
29
|
+
feeEstimate?: {
|
|
30
|
+
amountMode: "gross_input" | "net_input";
|
|
31
|
+
intents: Array<{
|
|
32
|
+
intentIndex: number;
|
|
33
|
+
batches: Array<{
|
|
34
|
+
chainId: number;
|
|
35
|
+
amountMode: "gross_input" | "net_input";
|
|
36
|
+
outputToken: string;
|
|
37
|
+
grossOutput: string;
|
|
38
|
+
netOutput: string;
|
|
39
|
+
totalFee: string;
|
|
40
|
+
gasQuoteSource: "estimated" | "configured_fallback" | "static_zero";
|
|
41
|
+
feeBreakdown: {
|
|
42
|
+
spicenetFee: string;
|
|
43
|
+
gasFee: string;
|
|
44
|
+
};
|
|
45
|
+
}>;
|
|
46
|
+
}>;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
16
49
|
error?: {
|
|
17
50
|
message: string;
|
|
18
51
|
};
|
|
19
52
|
}
|
|
53
|
+
export interface SpiceDepositFeeEstimateRequest {
|
|
54
|
+
user: string;
|
|
55
|
+
chainId: number;
|
|
56
|
+
tokenAddress: string;
|
|
57
|
+
amount: string;
|
|
58
|
+
amountMode?: "gross_input" | "net_input";
|
|
59
|
+
}
|
|
20
60
|
export interface DepositWidgetProps {
|
|
21
61
|
depositBatches: ChainBatch[];
|
|
22
62
|
tokenAddress: Address;
|
|
@@ -47,8 +87,10 @@ export interface DepositModalProps {
|
|
|
47
87
|
onClose: () => void;
|
|
48
88
|
onDepositSelect?: (asset: Asset) => void;
|
|
49
89
|
title?: string;
|
|
50
|
-
depositBatches?: ChainBatch[] | ((depositAmount: string, depositTokenAddress: string) => Promise<ChainBatch[]>);
|
|
90
|
+
depositBatches?: ChainBatch[] | ((context: PostDepositContext) => Promise<ChainBatch[]>) | ((depositAmount: string, depositTokenAddress: string) => Promise<ChainBatch[]>);
|
|
51
91
|
supportedChains: number[];
|
|
92
|
+
selectedSourceChainId?: number;
|
|
93
|
+
skipChainSwitch?: boolean;
|
|
52
94
|
styles?: CustomStyles;
|
|
53
95
|
className?: string;
|
|
54
96
|
onDepositAssetChange?: (asset: Asset | null) => void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Address, Hex } from "viem";
|
|
2
|
+
export interface CreateWalletRequest {
|
|
3
|
+
timestamp: number;
|
|
4
|
+
signature: Hex;
|
|
5
|
+
}
|
|
6
|
+
export interface WalletInfo {
|
|
7
|
+
address: string;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}
|
|
10
|
+
export interface WithdrawalIntent {
|
|
11
|
+
chainId: string;
|
|
12
|
+
signatureType: "ecdsa";
|
|
13
|
+
signature: Hex;
|
|
14
|
+
nbf: number;
|
|
15
|
+
exp: number;
|
|
16
|
+
chainBatches: Array<{
|
|
17
|
+
hash: Hex;
|
|
18
|
+
chainId: number;
|
|
19
|
+
calls: Array<{
|
|
20
|
+
to: Address;
|
|
21
|
+
value: bigint;
|
|
22
|
+
data: Hex;
|
|
23
|
+
}>;
|
|
24
|
+
}>;
|
|
25
|
+
}
|
|
26
|
+
export interface CreateWithdrawalRequest {
|
|
27
|
+
user?: Address;
|
|
28
|
+
intent: WithdrawalIntent;
|
|
29
|
+
}
|
|
30
|
+
export interface CreateWithdrawalResponse {
|
|
31
|
+
txHash?: string;
|
|
32
|
+
requestId?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface WithdrawalStatus {
|
|
35
|
+
state: "created" | "successful" | "failed" | "cancelled" | string;
|
|
36
|
+
idempotenceKey: string;
|
|
37
|
+
chain: string;
|
|
38
|
+
forUser: string;
|
|
39
|
+
reason?: string;
|
|
40
|
+
error?: string;
|
|
41
|
+
transfers: Array<{
|
|
42
|
+
tokenIn: string;
|
|
43
|
+
tokenOut: string;
|
|
44
|
+
recipient: string;
|
|
45
|
+
amount: number;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
export interface RollupTimestamp {
|
|
49
|
+
unix_timestamp: number;
|
|
50
|
+
}
|
package/dist/types/supply.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from "react";
|
|
2
2
|
import type { Address } from "viem";
|
|
3
|
-
import type { Call } from "./authorization";
|
|
3
|
+
import type { Call, ChainBatch } from "./authorization";
|
|
4
4
|
import type { CustomStyles } from "./theme";
|
|
5
5
|
export interface DestinationTokenConfig {
|
|
6
6
|
address: Address;
|
|
@@ -19,6 +19,12 @@ export interface SpiceSupplyProps {
|
|
|
19
19
|
onClose: () => void;
|
|
20
20
|
destinationToken: DestinationTokenConfig;
|
|
21
21
|
buildActionCalls: (amount: bigint, ctx: BuildActionCallsContext) => Call[];
|
|
22
|
+
buildSpicenetBatch?: (params: {
|
|
23
|
+
userAddress: Address;
|
|
24
|
+
destinationChainId: number;
|
|
25
|
+
deliveryToken: Address;
|
|
26
|
+
deliveryAmount: bigint;
|
|
27
|
+
}) => ChainBatch | null;
|
|
22
28
|
actionLabel: string;
|
|
23
29
|
amountDirection?: "input" | "output";
|
|
24
30
|
swapDescription?: string;
|
package/dist/types/unified.d.ts
CHANGED
|
@@ -35,9 +35,41 @@ export interface CreateActionRequest {
|
|
|
35
35
|
}[];
|
|
36
36
|
intents: (Intent7702 | IntentNon7702OnDemand)[];
|
|
37
37
|
}
|
|
38
|
+
export interface FeeEstimateBatch {
|
|
39
|
+
chainId: number;
|
|
40
|
+
amountMode: "gross_input" | "net_input";
|
|
41
|
+
outputToken: Address;
|
|
42
|
+
grossOutput: string;
|
|
43
|
+
netOutput: string;
|
|
44
|
+
totalFee: string;
|
|
45
|
+
gasQuoteSource: "estimated" | "configured_fallback" | "static_zero";
|
|
46
|
+
feeBreakdown: {
|
|
47
|
+
spicenetFee: string;
|
|
48
|
+
gasFee: string;
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
export interface FeeEstimateIntent {
|
|
52
|
+
intentIndex: number;
|
|
53
|
+
batches: FeeEstimateBatch[];
|
|
54
|
+
}
|
|
55
|
+
export interface FeeEstimateSummary {
|
|
56
|
+
amountMode: "gross_input" | "net_input";
|
|
57
|
+
intents: FeeEstimateIntent[];
|
|
58
|
+
}
|
|
38
59
|
export interface CreateActionResponse {
|
|
39
60
|
actionId: string;
|
|
40
61
|
intentIds: string[];
|
|
62
|
+
feeEstimate?: FeeEstimateSummary;
|
|
63
|
+
}
|
|
64
|
+
export interface EstimateActionFeesResponse {
|
|
65
|
+
success: boolean;
|
|
66
|
+
data?: {
|
|
67
|
+
feeEstimate: FeeEstimateSummary;
|
|
68
|
+
};
|
|
69
|
+
error?: {
|
|
70
|
+
message: string;
|
|
71
|
+
code?: string;
|
|
72
|
+
};
|
|
41
73
|
}
|
|
42
74
|
export interface ExecuteStepExecuteRequest {
|
|
43
75
|
action: "execute";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import{createContext as B,useEffect as w,useState as U,useCallback as k,useContext as C,useMemo as P}from"react";import{jsx as m}from"react/jsx-runtime";import{getChainIdsByNetwork as O}from"@spicenet-io/spiceflow-core";import{a as A,s as y}from"./index-BliUKoV3.js";import{c as _}from"./Button-DjsYc4v4.js";class c extends Error{constructor(t,r,e={}){super(r),this.code=t,this.context=e,this.name="SpiceflowError",Error.captureStackTrace&&Error.captureStackTrace(this,c)}}function j(o){return o instanceof c}const E=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io",x="__SPICEFLOW_RELAYER_API_URL__";function N(){if(typeof globalThis>"u")return;const o=globalThis[x];return typeof o=="string"&&o.length>0?o:void 0}class F{constructor(){this.baseUrl=E}setBaseUrl(t){this.baseUrl=t,typeof globalThis<"u"&&(globalThis[x]=t)}getBaseUrl(){return this.getEffectiveBaseUrl()}getEffectiveBaseUrl(){return N()||this.baseUrl}async createAction(t){console.log("[SpiceRelayer] createAction:start",{baseUrl:this.getEffectiveBaseUrl(),intentCount:t.intents.length,chainAuthorizationCount:t.chainAuthorizations?.length??0});const r=await fetch(`${this.getEffectiveBaseUrl()}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(a,s)=>typeof s=="bigint"?s.toString():s)});if(!r.ok){const a=await r.text();throw console.log("[SpiceRelayer] createAction:error",{baseUrl:this.getEffectiveBaseUrl(),status:r.status,errorText:a}),new c("RELAYER_ERROR",`Relayer API error: ${r.status} - ${a}`,{httpStatus:r.status,responseBody:a,endpoint:"/actions"})}const e=await r.json();return console.log("[SpiceRelayer] createAction:success",{intentIds:e.intentIds}),e}async estimateActionFees(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/actions/fees/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(a,s)=>typeof s=="bigint"?s.toString():s)}),e=await r.json();if(!r.ok||!e.success||!e.data?.feeEstimate){const a=e.error?.message||`Relayer fee estimate error: ${r.status}`;throw new c("RELAYER_ERROR",a,{httpStatus:r.status,responseBody:JSON.stringify(e),endpoint:"/actions/fees/estimate"})}return e.data.feeEstimate}async estimateSpiceDepositFees(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/spicedeposit/fees/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(a,s)=>typeof s=="bigint"?s.toString():s)}),e=await r.json();if(!r.ok||!e.success||!e.data?.feeEstimate){const a=e.error?.message||`Deposit fee estimate error: ${r.status}`;throw new c("RELAYER_ERROR",a,{httpStatus:r.status,responseBody:JSON.stringify(e),endpoint:"/spicedeposit/fees/estimate"})}return e.data.feeEstimate}async executeStep(t,r,e,a){const s=`${this.getEffectiveBaseUrl()}/actions/${t}/intents/${r}/steps/${e}`,d=fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});let n;try{n=await Promise.race([d,new Promise((i,f)=>setTimeout(()=>f(new c("RELAYER_EXECUTE_ERROR",`Execute step request timed out after ${1e4/1e3}s`,{actionId:t,intentIndex:r,stepIndex:e,endpoint:`/actions/${t}/intents/${r}/steps/${e}`})),1e4))])}catch(i){throw i}if(!n.ok){const i=await n.text();throw new c("RELAYER_EXECUTE_ERROR",`Execute step error: ${n.status} - ${i}`,{httpStatus:n.status,responseBody:i,endpoint:`/actions/${t}/intents/${r}/steps/${e}`,actionId:t})}return{success:!0,transactionHash:(await n.json()).transactionHash}}async checkStepStatus(t,r){const e=t.split("/");let a="";if(e.length>=2){const n=e[0],i=e[1];a=`${this.getEffectiveBaseUrl()}/actions/${n}/intents/${i}/steps/${r}`}else a=`${this.getEffectiveBaseUrl()}/actions/${t}/intents/0/steps/${r}`;const s=await fetch(a);if(!s.ok)throw new c("RELAYER_STATUS_ERROR",`Intent step status check failed: ${s.status}`,{httpStatus:s.status,endpoint:a,intentId:t});const d=await s.json();return{success:!0,data:{status:d.status==="error"?"reverted":d.status,transactionHash:d.txid}}}async submitSpiceDeposit(t){const r=t.isDeposit?"deposit":"withdrawal";try{const e=await fetch(`${this.getEffectiveBaseUrl()}/spicedeposit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await e.json();return!e.ok||!a.success?(console.error(`Failed to submit ${r} request to API:`,a.error?.message),{success:!1,error:a.error}):a}catch(e){return console.error(`Error submitting ${r} request to API:`,e),{success:!1,error:{message:e instanceof Error?e.message:"Unknown error"}}}}async requestSpiceUsdAirdrop(t){try{const r=await fetch(`${this.getEffectiveBaseUrl()}/airdrop/${t.chainId}/spiceUsd`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet:t.address})}),e=await r.json().catch(()=>({}));if(!r.ok){const a=e&&(e.error||e.message)||"Failed to request airdrop";return{success:!1,errorMessage:String(a)}}return e&&typeof e.error=="string"?{success:!1,errorMessage:e.error}:e&&(e.txHash||e.amount)?{success:!0,txHash:e.txHash,amount:e.amount}:{success:!0}}catch(r){return{success:!1,errorMessage:r?.message&&typeof r.message=="string"?r.message:"Failed to request airdrop"}}}async requestAirdrop(t){try{const r=await fetch(`${this.getEffectiveBaseUrl()}/airdrop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:t.tag||"default",airdrops:[{chainId:t.chainId,tokenId:t.tokenId,wallet:t.wallet,amount:t.amount||"0.0001"}]})}),e=await r.json().catch(()=>({}));if(!r.ok){const s=e?.message||e?.errors?.[0]?.error||"Failed to request airdrop";return{success:!1,errorMessage:String(s)}}const a=e?.airdrops?.[t.chainId]?.[t.tokenId]?.txHash;return e.errors&&e.errors.length>0?{success:!1,errorMessage:e.errors[0].error}:{success:!0,txHash:a}}catch(r){return{success:!1,errorMessage:r?.message&&typeof r.message=="string"?r.message:"Failed to request airdrop"}}}async createWallet(t,r){const e=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!e.ok){const a=await e.text();throw new c("RELAYER_ERROR",`Create wallet error: ${e.status} - ${a}`,{httpStatus:e.status,endpoint:`/wallets/${t}`})}return e.json()}async getWallet(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${t}`);if(!r.ok){const e=await r.text();throw new c("RELAYER_ERROR",`Get wallet error: ${r.status} - ${e}`,{httpStatus:r.status,endpoint:`/wallets/${t}`})}return r.json()}async createWithdrawal(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(e,a)=>typeof a=="bigint"?a.toString():a)});if(!r.ok){const e=await r.text();throw new c("RELAYER_ERROR",`Create withdrawal error: ${r.status} - ${e}`,{httpStatus:r.status,endpoint:"/withdrawals"})}return r.json()}async getWithdrawal(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals/${t}`);if(!r.ok){const e=await r.text();throw new c("RELAYER_ERROR",`Get withdrawal error: ${r.status} - ${e}`,{httpStatus:r.status,endpoint:`/withdrawals/${t}`})}return r.json()}async getRollupTimestamp(){const t=await fetch(`${this.getEffectiveBaseUrl()}/time`);if(!t.ok)throw new c("RELAYER_ERROR",`Get rollup timestamp error: ${t.status}`,{httpStatus:t.status,endpoint:"/time"});return t.json()}}const p=new F,L=(o,t)=>{const r=a=>t?t(a):A(a),e=[];return o.forEach((a,s)=>{const d=a.calls&&a.calls.length>0,n=a.tokenTransfers&&a.tokenTransfers.length>0;if(d||n){const i={stepId:s,status:s===0?"processing":"pending",chainId:a.chainId,chainName:r(a.chainId),description:"Processing transaction"};e.push(i)}}),e},R=B(null),S=B(null),M=({children:o,provider:t,supportedChainIds:r,network:e="testnet",mode:a="7702",skipFlow:s=[],nativeChainId:d,appName:n="Spicenet",apiUrl:i,theme:f,rpcOverrides:l})=>{w(()=>{if(!i)return;const g=p.getBaseUrl();return p.setBaseUrl(i),()=>p.setBaseUrl(g)},[i]),w(()=>(y(l),()=>y(void 0)),[l]);const u=r??O(e),T=f??null,[$,v]=U(a),I=k(g=>v(g),[]);return m(R.Provider,{value:T,children:m(S.Provider,{value:{provider:t,supportedChainIds:u,skipFlow:s,mode:$,setMode:I,network:e,nativeChainId:d,appName:n,apiUrl:i,rpcOverrides:l},children:o})})};function h(o,t){const r=o.replace("#",""),e=Math.max(0,Math.round(parseInt(r.substring(0,2),16)*(1-t))),a=Math.max(0,Math.round(parseInt(r.substring(2,4),16)*(1-t))),s=Math.max(0,Math.round(parseInt(r.substring(4,6),16)*(1-t)));return`#${e.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`}function Y(o,t){return{shell:t?.shell??"#141414",shellBorder:t?.shellBorder??h(t?.shell??"#141414",.35),shellInnerBorder:t?.shellInnerBorder??h(t?.shell??"#141414",.55),cardBg:t?.cardBg??"#1e1e1e",inputBg:t?.inputBg??"#171717",hoverBg:t?.hoverBg??"#2a2a2a",textPrimary:t?.textPrimary??"#ffffff",textSecondary:t?.textSecondary??"#888888",inputText:t?.inputText??"#e0e0e0",inputPlaceholder:t?.inputPlaceholder??"#555555",cardBorder:t?.cardBorder??"rgba(255,255,255,0.08)",inputBorder:t?.inputBorder??"rgba(255,255,255,0.10)",buttonBorder:t?.buttonBorder??"rgba(255,255,255,0.12)",successBg:t?.successBg??"#0a1f18",successBorder:t?.successBorder??"#1a4a3a",successText:t?.successText??"#6ee7b7",warningBg:t?.warningBg??"#1f1a0d",warningBorder:t?.warningBorder??"#4a3820",warningText:t?.warningText??"#fbbf24",errorBg:t?.errorBg??"#1f0d0d",errorBorder:t?.errorBorder??"#4a2020",errorText:t?.errorText??"#f87171",infoBg:t?.infoBg??"#0d1325",infoBorder:t?.infoBorder??"#2a3a5a",infoText:t?.infoText??"#60a5fa"}}function J(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 b(o,t){const r=t?{...o,...t}:o,e=r.dark??!1,a=r.primaryColor,s=r.shell??(e?"#141414":"#ffffff");return{primaryColor:a,dark:e,fontFamily:r.fontFamily??'"Helvetica Neue", sans-serif',appName:r.appName??"Spicenet",logo:r.logo,borderRadius:r.borderRadius??"8px",shell:s,shellBorder:h(s,e?.35:.085),shellInnerBorder:h(s,e?.55:.165),card:r.card??(e?"#1e1e1e":"#f9fafb"),input:e?"#171717":"#ffffff",hover:e?"#2a2a2a":"#f3f4f6",text:r.text??(e?"#ffffff":"#111827"),textMuted:r.textMuted??(e?"#888888":"#6b7280"),inputText:e?"#e0e0e0":"#111827",inputPlaceholder:e?"#555555":"#9ca3af",border:r.border??(e?"rgba(255,255,255,0.08)":"#E0E0E0"),inputBorder:e?"rgba(255,255,255,0.10)":"#d1d5db",buttonBorder:e?"rgba(255,255,255,0.12)":"#0e0d0b",successBg:e?"#0a1f18":"#d1fae5",successBorder:e?"#1a4a3a":"#6ee7b7",successText:e?"#6ee7b7":"#065f46",warningBg:e?"#1f1a0d":"#fef3c7",warningBorder:e?"#4a3820":"#fcd34d",warningText:e?"#fbbf24":"#92400e",errorBg:e?"#1f0d0d":"#fee2e2",errorBorder:e?"#4a2020":"#fca5a5",errorText:e?"#f87171":"#dc2626",infoBg:e?"#0d1325":"#dbeafe",infoBorder:e?"#2a3a5a":"#93c5fd",infoText:e?"#60a5fa":"#1e40af"}}function H(o,t){const r=C(R)??void 0;return P(()=>{const e=r??{primaryColor:"#EA4B4B"},a={...o?.primaryColor?{primaryColor:o.primaryColor}:{},...o?.fontFamily?{fontFamily:o.fontFamily}:{},...t!==void 0?{dark:t}:{}},s=b(e,a),{dark:d,primaryColor:n,appName:i}=s,f=_(d?"dark":"light"),l={...f,colors:{...f.colors,primary:n,primaryHover:`${n}dd`},typography:{...f.typography,fontFamily:s.fontFamily}},u={shell:s.shell,shellBorder:s.shellBorder,shellInnerBorder:s.shellInnerBorder,cardBg:s.card,inputBg:s.input,hoverBg:s.hover,textPrimary:s.text,textSecondary:s.textMuted,inputText:s.inputText,inputPlaceholder:s.inputPlaceholder,cardBorder:s.border,inputBorder:s.inputBorder,buttonBorder:s.buttonBorder,successBg:s.successBg,successBorder:s.successBorder,successText:s.successText,warningBg:s.warningBg,warningBorder:s.warningBorder,warningText:s.warningText,errorBg:s.errorBg,errorBorder:s.errorBorder,errorText:s.errorText,infoBg:s.infoBg,infoBorder:s.infoBorder,infoText:s.infoText};return{brand:r,theme:l,dark:d,appName:i,primaryColor:n,dk:u,palette:u}},[r,o,t])}export{E as R,S,J as a,Y as b,L as c,c as d,M as e,b as f,j as i,p as r,H as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use strict";const l=require("react"),y=require("react/jsx-runtime"),I=require("@spicenet-io/spiceflow-core"),w=require("./index-DfIyc-i4.js"),P=require("./Button-B_UpyUH-.js");class c extends Error{constructor(t,r,e={}){super(r),this.code=t,this.context=e,this.name="SpiceflowError",Error.captureStackTrace&&Error.captureStackTrace(this,c)}}function U(o){return o instanceof c}const m=typeof process<"u"&&process.env?.NEXT_PUBLIC_RELAYER_API_URL||"https://tx-api-devserver.spicenet.io",E="__SPICEFLOW_RELAYER_API_URL__";function C(){if(typeof globalThis>"u")return;const o=globalThis[E];return typeof o=="string"&&o.length>0?o:void 0}class k{constructor(){this.baseUrl=m}setBaseUrl(t){this.baseUrl=t,typeof globalThis<"u"&&(globalThis[E]=t)}getBaseUrl(){return this.getEffectiveBaseUrl()}getEffectiveBaseUrl(){return C()||this.baseUrl}async createAction(t){console.log("[SpiceRelayer] createAction:start",{baseUrl:this.getEffectiveBaseUrl(),intentCount:t.intents.length,chainAuthorizationCount:t.chainAuthorizations?.length??0});const r=await fetch(`${this.getEffectiveBaseUrl()}/actions`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(a,s)=>typeof s=="bigint"?s.toString():s)});if(!r.ok){const a=await r.text();throw console.log("[SpiceRelayer] createAction:error",{baseUrl:this.getEffectiveBaseUrl(),status:r.status,errorText:a}),new c("RELAYER_ERROR",`Relayer API error: ${r.status} - ${a}`,{httpStatus:r.status,responseBody:a,endpoint:"/actions"})}const e=await r.json();return console.log("[SpiceRelayer] createAction:success",{intentIds:e.intentIds}),e}async estimateActionFees(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/actions/fees/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(a,s)=>typeof s=="bigint"?s.toString():s)}),e=await r.json();if(!r.ok||!e.success||!e.data?.feeEstimate){const a=e.error?.message||`Relayer fee estimate error: ${r.status}`;throw new c("RELAYER_ERROR",a,{httpStatus:r.status,responseBody:JSON.stringify(e),endpoint:"/actions/fees/estimate"})}return e.data.feeEstimate}async estimateSpiceDepositFees(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/spicedeposit/fees/estimate`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(a,s)=>typeof s=="bigint"?s.toString():s)}),e=await r.json();if(!r.ok||!e.success||!e.data?.feeEstimate){const a=e.error?.message||`Deposit fee estimate error: ${r.status}`;throw new c("RELAYER_ERROR",a,{httpStatus:r.status,responseBody:JSON.stringify(e),endpoint:"/spicedeposit/fees/estimate"})}return e.data.feeEstimate}async executeStep(t,r,e,a){const s=`${this.getEffectiveBaseUrl()}/actions/${t}/intents/${r}/steps/${e}`,d=fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(a)});let n;try{n=await Promise.race([d,new Promise((i,f)=>setTimeout(()=>f(new c("RELAYER_EXECUTE_ERROR",`Execute step request timed out after ${1e4/1e3}s`,{actionId:t,intentIndex:r,stepIndex:e,endpoint:`/actions/${t}/intents/${r}/steps/${e}`})),1e4))])}catch(i){throw i}if(!n.ok){const i=await n.text();throw new c("RELAYER_EXECUTE_ERROR",`Execute step error: ${n.status} - ${i}`,{httpStatus:n.status,responseBody:i,endpoint:`/actions/${t}/intents/${r}/steps/${e}`,actionId:t})}return{success:!0,transactionHash:(await n.json()).transactionHash}}async checkStepStatus(t,r){const e=t.split("/");let a="";if(e.length>=2){const n=e[0],i=e[1];a=`${this.getEffectiveBaseUrl()}/actions/${n}/intents/${i}/steps/${r}`}else a=`${this.getEffectiveBaseUrl()}/actions/${t}/intents/0/steps/${r}`;const s=await fetch(a);if(!s.ok)throw new c("RELAYER_STATUS_ERROR",`Intent step status check failed: ${s.status}`,{httpStatus:s.status,endpoint:a,intentId:t});const d=await s.json();return{success:!0,data:{status:d.status==="error"?"reverted":d.status,transactionHash:d.txid}}}async submitSpiceDeposit(t){const r=t.isDeposit?"deposit":"withdrawal";try{const e=await fetch(`${this.getEffectiveBaseUrl()}/spicedeposit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),a=await e.json();return!e.ok||!a.success?(console.error(`Failed to submit ${r} request to API:`,a.error?.message),{success:!1,error:a.error}):a}catch(e){return console.error(`Error submitting ${r} request to API:`,e),{success:!1,error:{message:e instanceof Error?e.message:"Unknown error"}}}}async requestSpiceUsdAirdrop(t){try{const r=await fetch(`${this.getEffectiveBaseUrl()}/airdrop/${t.chainId}/spiceUsd`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wallet:t.address})}),e=await r.json().catch(()=>({}));if(!r.ok){const a=e&&(e.error||e.message)||"Failed to request airdrop";return{success:!1,errorMessage:String(a)}}return e&&typeof e.error=="string"?{success:!1,errorMessage:e.error}:e&&(e.txHash||e.amount)?{success:!0,txHash:e.txHash,amount:e.amount}:{success:!0}}catch(r){return{success:!1,errorMessage:r?.message&&typeof r.message=="string"?r.message:"Failed to request airdrop"}}}async requestAirdrop(t){try{const r=await fetch(`${this.getEffectiveBaseUrl()}/airdrop`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({tag:t.tag||"default",airdrops:[{chainId:t.chainId,tokenId:t.tokenId,wallet:t.wallet,amount:t.amount||"0.0001"}]})}),e=await r.json().catch(()=>({}));if(!r.ok){const s=e?.message||e?.errors?.[0]?.error||"Failed to request airdrop";return{success:!1,errorMessage:String(s)}}const a=e?.airdrops?.[t.chainId]?.[t.tokenId]?.txHash;return e.errors&&e.errors.length>0?{success:!1,errorMessage:e.errors[0].error}:{success:!0,txHash:a}}catch(r){return{success:!1,errorMessage:r?.message&&typeof r.message=="string"?r.message:"Failed to request airdrop"}}}async createWallet(t,r){const e=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${t}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!e.ok){const a=await e.text();throw new c("RELAYER_ERROR",`Create wallet error: ${e.status} - ${a}`,{httpStatus:e.status,endpoint:`/wallets/${t}`})}return e.json()}async getWallet(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/wallets/${t}`);if(!r.ok){const e=await r.text();throw new c("RELAYER_ERROR",`Get wallet error: ${r.status} - ${e}`,{httpStatus:r.status,endpoint:`/wallets/${t}`})}return r.json()}async createWithdrawal(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t,(e,a)=>typeof a=="bigint"?a.toString():a)});if(!r.ok){const e=await r.text();throw new c("RELAYER_ERROR",`Create withdrawal error: ${r.status} - ${e}`,{httpStatus:r.status,endpoint:"/withdrawals"})}return r.json()}async getWithdrawal(t){const r=await fetch(`${this.getEffectiveBaseUrl()}/withdrawals/${t}`);if(!r.ok){const e=await r.text();throw new c("RELAYER_ERROR",`Get withdrawal error: ${r.status} - ${e}`,{httpStatus:r.status,endpoint:`/withdrawals/${t}`})}return r.json()}async getRollupTimestamp(){const t=await fetch(`${this.getEffectiveBaseUrl()}/time`);if(!t.ok)throw new c("RELAYER_ERROR",`Get rollup timestamp error: ${t.status}`,{httpStatus:t.status,endpoint:"/time"});return t.json()}}const h=new k,O=(o,t)=>{const r=a=>t?t(a):w.getChainName(a),e=[];return o.forEach((a,s)=>{const d=a.calls&&a.calls.length>0,n=a.tokenTransfers&&a.tokenTransfers.length>0;if(d||n){const i={stepId:s,status:s===0?"processing":"pending",chainId:a.chainId,chainName:r(a.chainId),description:"Processing transaction"};e.push(i)}}),e},x=l.createContext(null),R=l.createContext(null),A=({children:o,provider:t,supportedChainIds:r,network:e="testnet",mode:a="7702",skipFlow:s=[],nativeChainId:d,appName:n="Spicenet",apiUrl:i,theme:f,rpcOverrides:u})=>{l.useEffect(()=>{if(!i)return;const B=h.getBaseUrl();return h.setBaseUrl(i),()=>h.setBaseUrl(B)},[i]),l.useEffect(()=>(w.setRpcOverrides(u),()=>w.setRpcOverrides(void 0)),[u]);const p=r??I.getChainIdsByNetwork(e),b=f??null,[T,$]=l.useState(a),v=l.useCallback(B=>$(B),[]);return y.jsx(x.Provider,{value:b,children:y.jsx(R.Provider,{value:{provider:t,supportedChainIds:p,skipFlow:s,mode:T,setMode:v,network:e,nativeChainId:d,appName:n,apiUrl:i,rpcOverrides:u},children:o})})};function g(o,t){const r=o.replace("#",""),e=Math.max(0,Math.round(parseInt(r.substring(0,2),16)*(1-t))),a=Math.max(0,Math.round(parseInt(r.substring(2,4),16)*(1-t))),s=Math.max(0,Math.round(parseInt(r.substring(4,6),16)*(1-t)));return`#${e.toString(16).padStart(2,"0")}${a.toString(16).padStart(2,"0")}${s.toString(16).padStart(2,"0")}`}function _(o,t){return{shell:t?.shell??"#141414",shellBorder:t?.shellBorder??g(t?.shell??"#141414",.35),shellInnerBorder:t?.shellInnerBorder??g(t?.shell??"#141414",.55),cardBg:t?.cardBg??"#1e1e1e",inputBg:t?.inputBg??"#171717",hoverBg:t?.hoverBg??"#2a2a2a",textPrimary:t?.textPrimary??"#ffffff",textSecondary:t?.textSecondary??"#888888",inputText:t?.inputText??"#e0e0e0",inputPlaceholder:t?.inputPlaceholder??"#555555",cardBorder:t?.cardBorder??"rgba(255,255,255,0.08)",inputBorder:t?.inputBorder??"rgba(255,255,255,0.10)",buttonBorder:t?.buttonBorder??"rgba(255,255,255,0.12)",successBg:t?.successBg??"#0a1f18",successBorder:t?.successBorder??"#1a4a3a",successText:t?.successText??"#6ee7b7",warningBg:t?.warningBg??"#1f1a0d",warningBorder:t?.warningBorder??"#4a3820",warningText:t?.warningText??"#fbbf24",errorBg:t?.errorBg??"#1f0d0d",errorBorder:t?.errorBorder??"#4a2020",errorText:t?.errorText??"#f87171",infoBg:t?.infoBg??"#0d1325",infoBorder:t?.infoBorder??"#2a3a5a",infoText:t?.infoText??"#60a5fa"}}function j(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 S(o,t){const r=t?{...o,...t}:o,e=r.dark??!1,a=r.primaryColor,s=r.shell??(e?"#141414":"#ffffff");return{primaryColor:a,dark:e,fontFamily:r.fontFamily??'"Helvetica Neue", sans-serif',appName:r.appName??"Spicenet",logo:r.logo,borderRadius:r.borderRadius??"8px",shell:s,shellBorder:g(s,e?.35:.085),shellInnerBorder:g(s,e?.55:.165),card:r.card??(e?"#1e1e1e":"#f9fafb"),input:e?"#171717":"#ffffff",hover:e?"#2a2a2a":"#f3f4f6",text:r.text??(e?"#ffffff":"#111827"),textMuted:r.textMuted??(e?"#888888":"#6b7280"),inputText:e?"#e0e0e0":"#111827",inputPlaceholder:e?"#555555":"#9ca3af",border:r.border??(e?"rgba(255,255,255,0.08)":"#E0E0E0"),inputBorder:e?"rgba(255,255,255,0.10)":"#d1d5db",buttonBorder:e?"rgba(255,255,255,0.12)":"#0e0d0b",successBg:e?"#0a1f18":"#d1fae5",successBorder:e?"#1a4a3a":"#6ee7b7",successText:e?"#6ee7b7":"#065f46",warningBg:e?"#1f1a0d":"#fef3c7",warningBorder:e?"#4a3820":"#fcd34d",warningText:e?"#fbbf24":"#92400e",errorBg:e?"#1f0d0d":"#fee2e2",errorBorder:e?"#4a2020":"#fca5a5",errorText:e?"#f87171":"#dc2626",infoBg:e?"#0d1325":"#dbeafe",infoBorder:e?"#2a3a5a":"#93c5fd",infoText:e?"#60a5fa":"#1e40af"}}function L(o,t){const r=l.useContext(x)??void 0;return l.useMemo(()=>{const e=r??{primaryColor:"#EA4B4B"},a={...o?.primaryColor?{primaryColor:o.primaryColor}:{},...o?.fontFamily?{fontFamily:o.fontFamily}:{},...t!==void 0?{dark:t}:{}},s=S(e,a),{dark:d,primaryColor:n,appName:i}=s,f=P.createTheme(d?"dark":"light"),u={...f,colors:{...f.colors,primary:n,primaryHover:`${n}dd`},typography:{...f.typography,fontFamily:s.fontFamily}},p={shell:s.shell,shellBorder:s.shellBorder,shellInnerBorder:s.shellInnerBorder,cardBg:s.card,inputBg:s.input,hoverBg:s.hover,textPrimary:s.text,textSecondary:s.textMuted,inputText:s.inputText,inputPlaceholder:s.inputPlaceholder,cardBorder:s.border,inputBorder:s.inputBorder,buttonBorder:s.buttonBorder,successBg:s.successBg,successBorder:s.successBorder,successText:s.successText,warningBg:s.warningBg,warningBorder:s.warningBorder,warningText:s.warningText,errorBg:s.errorBg,errorBorder:s.errorBorder,errorText:s.errorText,infoBg:s.infoBg,infoBorder:s.infoBorder,infoText:s.infoText};return{brand:r,theme:u,dark:d,appName:i,primaryColor:n,dk:p,palette:p}},[r,o,t])}exports.RELAYER_API_URL=m,exports.SpiceFlowProvider=A,exports.SpiceFlowProviderContext=R,exports.SpiceflowError=c,exports.buildDarkPalette=_,exports.buildLightPalette=j,exports.createInitialSteps=O,exports.isSpiceflowError=U,exports.relayerService=h,exports.resolveTheme=S,exports.useSpiceBrand=L;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const spicenetAbi: readonly [{
|
|
2
|
+
readonly type: "function";
|
|
3
|
+
readonly name: "createWithdrawalRequest";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly name: "request";
|
|
6
|
+
readonly type: "tuple";
|
|
7
|
+
readonly internalType: "struct Spicenet.CreateWithdrawalRequestArgs";
|
|
8
|
+
readonly components: readonly [{
|
|
9
|
+
readonly name: "chainId";
|
|
10
|
+
readonly type: "string";
|
|
11
|
+
readonly internalType: "string";
|
|
12
|
+
}, {
|
|
13
|
+
readonly name: "idempotenceKey";
|
|
14
|
+
readonly type: "bytes32";
|
|
15
|
+
readonly internalType: "bytes32";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "nbf";
|
|
18
|
+
readonly type: "uint256";
|
|
19
|
+
readonly internalType: "uint256";
|
|
20
|
+
}, {
|
|
21
|
+
readonly name: "exp";
|
|
22
|
+
readonly type: "uint256";
|
|
23
|
+
readonly internalType: "uint256";
|
|
24
|
+
}, {
|
|
25
|
+
readonly name: "metadata";
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly internalType: "string";
|
|
28
|
+
}, {
|
|
29
|
+
readonly name: "transfers";
|
|
30
|
+
readonly type: "tuple[]";
|
|
31
|
+
readonly internalType: "struct Spicenet.CreateTokenTransfer[]";
|
|
32
|
+
readonly components: readonly [{
|
|
33
|
+
readonly name: "token";
|
|
34
|
+
readonly type: "string";
|
|
35
|
+
readonly internalType: "string";
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "to";
|
|
38
|
+
readonly type: "string";
|
|
39
|
+
readonly internalType: "string";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "amount";
|
|
42
|
+
readonly type: "uint256";
|
|
43
|
+
readonly internalType: "uint256";
|
|
44
|
+
}];
|
|
45
|
+
}];
|
|
46
|
+
}];
|
|
47
|
+
readonly outputs: readonly [];
|
|
48
|
+
readonly stateMutability: "nonpayable";
|
|
49
|
+
}];
|