@spicenet-io/spiceflow-ui 4.0.12 → 4.0.13-next.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.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{P as g}from"./privy-2vbGci0p.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@privy-io/react-auth";import"wagmi";import"@tanstack/react-query";export{g as PrivyLogin};
2
+ import{P as g}from"./privy-D2mpwstS.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@privy-io/react-auth";import"wagmi";import"@tanstack/react-query";export{g as PrivyLogin};
@@ -7,6 +7,7 @@ export interface CustomSectionItem {
7
7
  label: string;
8
8
  displayValue: string;
9
9
  valueColor?: "green" | "red" | "default";
10
+ onClick?: () => void;
10
11
  }
11
12
  export interface CustomSection {
12
13
  title: string;
@@ -52,4 +53,5 @@ export interface AccountDisplayProps {
52
53
  onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
53
54
  showModeToggle?: boolean;
54
55
  defaultMode?: "7702" | "non7702";
56
+ alwaysShowEmbeddedIdle?: boolean;
55
57
  }
@@ -19,3 +19,5 @@ export type { PartnerWhitelistCheckResponse, UseIsUserWhitelistedOptions, } from
19
19
  export { useSupplyAssets, isSupportedSupplyAsset } from "./useSupplyAssets";
20
20
  export { useSupplyQuote, resolveInputSupplySwapQuote } from "./useSupplyQuote";
21
21
  export type { UseSupplyQuoteOpts, SupplyQuoteResult } from "./useSupplyQuote";
22
+ export { useSpiceAction } from "./useSpiceAction";
23
+ export type { SpiceActionQuote, SpiceActionSource, UseSpiceActionOptions, UseSpiceActionResult, } from "./useSpiceAction";
@@ -0,0 +1,48 @@
1
+ import { type Address } from "viem";
2
+ import { type SupplyStep } from "../components/SpiceSupply/lib/executors";
3
+ import type { Asset, SelectedAsset } from "../types/assets";
4
+ import type { DestinationTokenConfig, SpiceSupplyProps } from "../types/supply";
5
+ import type { FeePreview } from "../types/ui";
6
+ export type SpiceActionSource = Asset & {
7
+ _source?: "wallet" | "spice";
8
+ _fundingWallet?: "embedded" | "external";
9
+ };
10
+ export interface UseSpiceActionOptions {
11
+ destinationToken: DestinationTokenConfig;
12
+ recipient?: Address;
13
+ buildActionCalls: SpiceSupplyProps["buildActionCalls"];
14
+ buildSpicenetBatch?: SpiceSupplyProps["buildSpicenetBatch"];
15
+ amount: string;
16
+ sourceChains?: number[];
17
+ supportedSourceAssets?: string[];
18
+ feeExecutionMode?: SpiceSupplyProps["feeExecutionMode"];
19
+ enabled?: boolean;
20
+ onSuccess?: (txHash: string) => void;
21
+ onError?: (error: Error) => void;
22
+ }
23
+ export interface SpiceActionQuote {
24
+ isQuoting: boolean;
25
+ error: string | null;
26
+ estimatedInput: string | null;
27
+ estimatedOutput: string | null;
28
+ isDirect: boolean;
29
+ needsSwap: boolean;
30
+ }
31
+ export interface UseSpiceActionResult {
32
+ sources: SpiceActionSource[];
33
+ selectedAsset: SelectedAsset | null;
34
+ setSelectedAsset: (selected: SelectedAsset | null) => void;
35
+ selectAsset: (asset: Asset) => void;
36
+ quote: SpiceActionQuote;
37
+ feePreview: FeePreview | null;
38
+ isFeePreviewLoading: boolean;
39
+ feePreviewError: string | null;
40
+ canSubmit: boolean;
41
+ execute: () => Promise<void>;
42
+ isExecuting: boolean;
43
+ step: SupplyStep;
44
+ statusMsg: string;
45
+ txHash: string | null;
46
+ refreshAssets: () => void;
47
+ }
48
+ export declare function useSpiceAction({ destinationToken, recipient, buildActionCalls, buildSpicenetBatch, amount, sourceChains: sourceChainsProp, supportedSourceAssets: supportedSourceAssetsProp, feeExecutionMode, enabled, onSuccess, onError, }: UseSpiceActionOptions): UseSpiceActionResult;
@@ -1,6 +1,10 @@
1
1
  import { type Address } from "viem";
2
2
  import type { Asset } from "../types/assets";
3
- export declare function isSupportedSupplyAsset(asset: Pick<Asset, "address" | "chainTokens">, supportedSourceAssets?: string[]): boolean;
3
+ type FundingWallet = "embedded" | "external";
4
+ type WalletSourcedAsset = Asset & {
5
+ _fundingWallet: FundingWallet;
6
+ };
7
+ export declare function isSupportedSupplyAsset(asset: Pick<Asset, "address" | "chainTokens"> & Partial<Pick<Asset, "chainId" | "symbol">>, supportedSourceAssets?: string[]): boolean;
4
8
  type DestinationToken = {
5
9
  address: Address;
6
10
  decimals: number;
@@ -14,12 +18,14 @@ export declare function useSupplyAssets(opts: {
14
18
  supportedSourceAssets?: string[];
15
19
  sourceChains?: number[];
16
20
  enabled: boolean;
21
+ includeAllFundingWallets?: boolean;
17
22
  }): {
18
23
  displayAssets: (Asset & {
19
24
  _source: "wallet" | "spice";
25
+ _fundingWallet?: FundingWallet;
20
26
  })[];
21
27
  filteredSpiceAssets: Asset[];
22
- walletAssets: Asset[];
28
+ walletAssets: WalletSourcedAsset[];
23
29
  embeddedWalletAddress: `0x${string}` | undefined;
24
30
  externalAddress: `0x${string}` | undefined;
25
31
  isNon7702: boolean;