@spicenet-io/spiceflow-ui 4.0.13 → 4.1.0

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.
Binary file
Binary file
@@ -1,3 +1,2 @@
1
1
  import { Theme, ThemeMode } from "../types/theme";
2
2
  export declare const createTheme: (mode?: ThemeMode) => Theme;
3
- export declare const defaultTheme: Theme;
@@ -20,7 +20,3 @@ export interface ChainBatch {
20
20
  calls: Call[];
21
21
  tokenTransfers?: TokenTransferConfig[];
22
22
  }
23
- export interface IntentAuthorization {
24
- signature: string;
25
- chainBatches: ChainBatch[];
26
- }
@@ -3,6 +3,7 @@ import { ChainBatch } from ".";
3
3
  import { UseAssetInputReturn } from "../hooks/useAssetInput";
4
4
  import { Asset } from "./assets";
5
5
  import { CustomStyles, Theme } from "./theme";
6
+ import type { RelayerErrorDetail } from "../utils/errors";
6
7
  import type { IntentStatus } from "./status";
7
8
  import type { Network } from "@spicenet-io/spiceflow-core";
8
9
  import type { VerifiedPendingDeposit } from "../hooks/usePendingDeposit";
@@ -16,23 +17,6 @@ export interface PostDepositContext {
16
17
  destinationAmount?: bigint;
17
18
  destinationTokenDecimals?: number;
18
19
  }
19
- export interface SpiceDepositRequest {
20
- user: string;
21
- txHash: string;
22
- sender: string;
23
- tokenAddress: string;
24
- chainId: number;
25
- amount: string;
26
- }
27
- export interface SpiceDepositResponse {
28
- success: boolean;
29
- data?: {
30
- creditedAmount?: string;
31
- };
32
- error?: {
33
- message: string;
34
- };
35
- }
36
20
  export interface DepositModalProps {
37
21
  isOpen: boolean;
38
22
  onClose: () => void;
@@ -41,8 +25,6 @@ export interface DepositModalProps {
41
25
  title?: string;
42
26
  depositBatches?: ChainBatch[] | ((context: PostDepositContext) => Promise<ChainBatch[]>) | ((depositAmount: string, depositTokenAddress: string) => Promise<ChainBatch[]>);
43
27
  supportedChains: number[];
44
- selectedSourceChainId?: number;
45
- skipChainSwitch?: boolean;
46
28
  styles?: CustomStyles;
47
29
  className?: string;
48
30
  onDepositAssetChange?: (asset: Asset | null) => void;
@@ -71,7 +53,7 @@ export interface DepositModalProps {
71
53
  sourceChain?: string;
72
54
  txHash?: string;
73
55
  }) => void;
74
- onDepositError?: (error: string) => void;
56
+ onDepositError?: (error: string, detail?: RelayerErrorDetail) => void;
75
57
  onViewAllAssets?: () => void;
76
58
  }
77
59
  export interface EscrowRecovery {
@@ -103,7 +85,7 @@ export interface SpiceDepositProps {
103
85
  sourceChain?: string;
104
86
  txHash?: string;
105
87
  }) => void;
106
- onDepositError?: (error: string) => void;
88
+ onDepositError?: (error: string, detail?: RelayerErrorDetail) => void;
107
89
  skipRecovery?: boolean;
108
90
  }
109
91
  export interface SelectTokenModalProps {
@@ -3,6 +3,6 @@ export * from "./withdraw";
3
3
  export * from "./assets";
4
4
  export * from "./theme";
5
5
  export * from "./status";
6
- export type { Authorization, ChainBatch, IntentAuthorization, } from "./authorization";
6
+ export type { Authorization, ChainBatch } from "./authorization";
7
7
  export * from "./wallet";
8
8
  export * from "./ui";
@@ -1,4 +1,5 @@
1
1
  import type { CustomStyles } from "./theme";
2
+ import type { RelayerErrorDetail } from "../utils/errors";
2
3
  import { Address } from "viem";
3
4
  import { ChainBatch } from ".";
4
5
  import { UseAssetInputReturn } from "../hooks/useAssetInput";
@@ -39,10 +40,9 @@ export interface SpiceLockModalProps {
39
40
  votingPowerEstimate?: (amount: number, months: number) => number;
40
41
  escrowAddress?: Address;
41
42
  onLockSuccess?: (txHash?: string) => void;
42
- onLockError?: (error: string) => void;
43
+ onLockError?: (error: string, detail?: RelayerErrorDetail) => void;
43
44
  onLockExecute?: (ctx: LockExecuteContext) => Promise<string | void>;
44
45
  sourceToDestinationConversionRate?: number;
45
- estimatedOutputAmount?: string;
46
46
  onAddFunds?: () => void;
47
47
  includeWalletAssets?: boolean;
48
48
  destinationTokenAddress?: Address;
@@ -3,6 +3,7 @@ import type { Address } from "viem";
3
3
  import type { Asset } from "./assets";
4
4
  import type { Call, ChainBatch } from "./authorization";
5
5
  import type { CustomStyles } from "./theme";
6
+ import type { RelayerErrorDetail } from "../utils/errors";
6
7
  import type { ExactOutputSwapIntent, ResolvedExactOutputSwap } from "../utils/swapQuotes";
7
8
  export interface DestinationTokenConfig {
8
9
  address: Address;
@@ -87,7 +88,7 @@ export interface SpiceSupplyProps {
87
88
  subtitle?: React.ReactNode;
88
89
  onAddFunds?: () => void;
89
90
  onSuccess?: (txHash: string) => void;
90
- onError?: (error: Error) => void;
91
+ onError?: (error: Error, detail?: RelayerErrorDetail) => void;
91
92
  }
92
93
  export interface SupplyEstimateProps {
93
94
  isQuoting: boolean;
@@ -20,15 +20,6 @@ export interface InputProps extends React.InputHTMLAttributes<HTMLInputElement>
20
20
  endAdornment?: React.ReactNode;
21
21
  theme?: Theme;
22
22
  }
23
- export interface ModalProps {
24
- isOpen: boolean;
25
- onClose: () => void;
26
- title?: string;
27
- children: React.ReactNode;
28
- maxWidth?: string;
29
- className?: string;
30
- theme?: Theme;
31
- }
32
23
  export interface SpinnerProps {
33
24
  size?: number;
34
25
  borderWidth?: number;
@@ -1,27 +1,5 @@
1
- import { Address } from "viem";
2
- import { Authorization } from "./authorization";
3
1
  import type { WalletProvider } from "../providers/SpiceFlowProvider";
4
2
  export type { WalletProvider };
5
- export interface WalletState {
6
- isReady: boolean;
7
- isAuthenticated: boolean;
8
- isConnected: boolean;
9
- address?: Address;
10
- provider: WalletProvider | null;
11
- }
12
- export interface WalletActions {
13
- signAuthorization: (params: {
14
- contractAddress: Address;
15
- chainId: number;
16
- nonce: number;
17
- }) => Promise<Authorization>;
18
- signMessage: (message: string) => Promise<{
19
- signature: string;
20
- }>;
21
- }
22
- export interface UseWalletReturn extends WalletState {
23
- actions: WalletActions;
24
- }
25
3
  export interface ProviderConfig {
26
4
  privy?: {
27
5
  appId: string;
@@ -30,12 +8,6 @@ export interface ProviderConfig {
30
8
  };
31
9
  };
32
10
  }
33
- export interface WalletProviderProps {
34
- children: React.ReactNode;
35
- provider: WalletProvider;
36
- defaultChain?: any;
37
- supportedChains?: any[];
38
- }
39
11
  export interface LoginProps {
40
12
  onAuthSuccess?: (address: string) => void;
41
13
  onAuthError?: (error: string) => void;
@@ -1,6 +1,7 @@
1
1
  import { Address } from "viem";
2
2
  import type { CustomStyles } from "./theme";
3
3
  import type { ChainBatch } from "./authorization";
4
+ import type { RelayerErrorDetail } from "../utils/errors";
4
5
  export interface DestinationToken {
5
6
  address: Address;
6
7
  symbol: string;
@@ -19,14 +20,12 @@ export interface SpiceWithdrawProps {
19
20
  closeOnBackdropClick?: boolean;
20
21
  styles?: CustomStyles;
21
22
  onWithdrawExecute?: (withdrawnAmount: string) => Promise<void> | void;
22
- withdrawActionLabel?: string;
23
23
  onWithdrawSuccess?: (data: {
24
24
  token: string;
25
25
  amount: string;
26
26
  chainId: number;
27
27
  }) => void;
28
- onWithdrawError?: (error: string) => void;
29
- autoCloseDelay?: number;
28
+ onWithdrawError?: (error: string, detail?: RelayerErrorDetail) => void;
30
29
  availableTokens?: Record<number, DestinationToken[]>;
31
30
  buildSpicenetBatch?: (params: {
32
31
  destinationChainId: number;
@@ -8,6 +8,13 @@ export declare class SpiceflowError extends Error {
8
8
  }
9
9
  export declare function isSpiceflowError(err: unknown): err is SpiceflowError;
10
10
  export declare const isUserRejection: (error: unknown) => boolean;
11
+ export interface RelayerErrorDetail {
12
+ requestId?: string;
13
+ httpStatus?: number;
14
+ responseBody?: string;
15
+ endpoint?: string;
16
+ }
17
+ export declare function getRelayerErrorDetail(message: string): RelayerErrorDetail | undefined;
11
18
  export declare const sanitizeError: (error: unknown, fallback?: string) => string;
12
19
  export declare function decodeRevertReason(input: unknown): string | undefined;
13
20
  export declare function formatFeeEstimateError(request: CreateActionRequest, message: string): string;
@@ -4,9 +4,7 @@ import phantomLogo from "../assets/icons/phantom.png";
4
4
  import spicenetLogo from "../assets/icons/spicenet-mark.svg";
5
5
  export { metamaskLogo, rabbyLogo, phantomLogo };
6
6
  export declare const ethLogo: string;
7
- export declare const arbLogo: string;
8
7
  export declare const usdcLogo: string;
9
- export declare const wbtcLogo: string;
10
8
  export { spicenetLogo };
11
9
  export declare const chainLogoMap: {
12
10
  [key: number]: string;
@@ -14,4 +14,3 @@ export declare const PENDING_DEPOSIT_STORAGE_EVENT = "spiceflow:pendingDepositCh
14
14
  export declare function savePendingDeposit(record: PendingDepositRecord): void;
15
15
  export declare function getPendingDeposits(embeddedWalletAddress: string): PendingDepositRecord[];
16
16
  export declare function clearPendingDeposit(embeddedWalletAddress: string, chainId: number, tokenAddress: string): void;
17
- export declare function clearAllPendingDeposits(embeddedWalletAddress: string): void;
@@ -3,11 +3,13 @@ import { SwapStep } from "../../types/status";
3
3
  import { ChainBatch, ChainAuthorization } from "../../types/authorization";
4
4
  import type { RollupBalanceEntry } from "../rollupBalances";
5
5
  export declare const RELAYER_API_URL: string;
6
+ export declare function relayerFetch(endpoint: string, init?: RequestInit): Promise<Response & {
7
+ requestId?: string;
8
+ }>;
6
9
  export declare class RelayerService {
7
10
  private baseUrl;
8
11
  setBaseUrl(url: string): void;
9
12
  getBaseUrl(): string;
10
- private postJson;
11
13
  createAction(request: CreateActionRequest): Promise<CreateActionResponse>;
12
14
  estimateActionFees(request: CreateActionRequest): Promise<FeeEstimateSummary>;
13
15
  estimateBatchGas(request: {
@@ -13,4 +13,3 @@ export interface RollupBalanceEntry {
13
13
  }
14
14
  export declare function getRollupBalanceForChainToken(entries: RollupBalanceEntry[], chainId: number, tokenAddress: Address, fallbackNames?: Array<string | undefined>): bigint;
15
15
  export declare function parseRollupBalanceEntry(token: RollupBalanceEntry, supportedChains?: number[]): Asset | null;
16
- export declare function fallbackRollupChainName(chainId: number): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicenet-io/spiceflow-ui",
3
- "version": "4.0.13",
3
+ "version": "4.1.0",
4
4
  "description": "Spiceflow UI SDK",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.3.13",
@@ -35,7 +35,9 @@
35
35
  "dev": "rollup -c rollup.config.mjs --watch",
36
36
  "dev:link": "bun run build && bun link && echo 'SDK linked globally. Run: bun link @spicenet-io/spiceflow-ui in your project'",
37
37
  "clean": "rm -rf dist",
38
- "prepublishOnly": "bun run build"
38
+ "format": "prettier --write . --ignore-unknown",
39
+ "prepublishOnly": "bun run build",
40
+ "prepare": "husky || true"
39
41
  },
40
42
  "keywords": [
41
43
  "react",
@@ -91,10 +93,10 @@
91
93
  "eslint-plugin-react-hooks": "4.6.2",
92
94
  "husky": "9.1.7",
93
95
  "jest": "29.7.0",
94
- "lint-staged": "16.2.6",
96
+ "lint-staged": "17.0.8",
95
97
  "postcss": "8.5.6",
96
98
  "postcss-import": "16.1.1",
97
- "prettier": "3.6.2",
99
+ "prettier": "3.9.5",
98
100
  "react": "18.3.1",
99
101
  "react-dom": "18.3.1",
100
102
  "rollup": "4.53.2",
@@ -109,6 +111,6 @@
109
111
  "wagmi": "2.19.5"
110
112
  },
111
113
  "lint-staged": {
112
- "*.{ts,tsx,js,jsx,json,md}": "prettier --write"
114
+ "**/*": "prettier --write --ignore-unknown"
113
115
  }
114
116
  }
@@ -1,5 +0,0 @@
1
- import React from "react";
2
- export declare const ModalHeader: React.FC<{
3
- title: string;
4
- onClose: () => void;
5
- }>;
@@ -1,4 +0,0 @@
1
- import React from "react";
2
- import type { SupplyEstimateProps } from "../../../types/supply";
3
- export type { SupplyEstimateProps };
4
- export declare const SupplyEstimate: React.FC<SupplyEstimateProps>;
@@ -1,5 +0,0 @@
1
- export * from "./AssetSelector";
2
- export * from "./StatusDisplay";
3
- export * from "./ProviderLogins";
4
- export * from "./SpiceWithdraw";
5
- export * from "./ui";
Binary file
Binary file
@@ -1,2 +0,0 @@
1
- export type { UIChainConfig as ChainConfig } from "../utils/chains/chainData";
2
- export type { Network } from "@spicenet-io/spiceflow-core";