@spicenet-io/spiceflow-ui 3.3.8 → 3.3.10
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-CIf9le-W.js +2 -0
- package/dist/Button-CWv90szi.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/AccountDisplay/{AccountCustomSection.d.ts → parts/AccountCustomSection.d.ts} +2 -2
- package/dist/components/AccountDisplay/{AccountHeader.d.ts → parts/AccountHeader.d.ts} +1 -1
- package/dist/components/AccountDisplay/{AccountIdleBalances.d.ts → parts/AccountIdleBalances.d.ts} +2 -2
- package/dist/components/AccountDisplay/{AccountPanel.d.ts → parts/AccountPanel.d.ts} +3 -3
- package/dist/components/AccountDisplay/{AccountPendingDeposits.d.ts → parts/AccountPendingDeposits.d.ts} +2 -2
- package/dist/components/AssetSelector/index.d.ts +3 -3
- package/dist/components/AssetSelector/{AssetDropdown.d.ts → parts/AssetDropdown.d.ts} +1 -1
- package/dist/components/AssetSelector/{ChainIcon.d.ts → parts/ChainIcon.d.ts} +1 -1
- package/dist/components/AssetSelector/{TokenIcon.d.ts → parts/TokenIcon.d.ts} +1 -1
- package/dist/components/ProviderLogins/index.d.ts +4 -2
- package/dist/components/ProviderLogins/{DynamicLogin.d.ts → parts/DynamicLogin.d.ts} +1 -1
- package/dist/components/ProviderLogins/{PrivyLogin.d.ts → parts/PrivyLogin.d.ts} +1 -1
- package/dist/components/SpiceBalance/index.d.ts +2 -2
- package/dist/components/SpiceDeposit/index.d.ts +3 -3
- package/dist/components/SpiceDeposit/{depositBatches.d.ts → lib/depositBatches.d.ts} +3 -3
- package/dist/components/SpiceDeposit/{executors.d.ts → lib/executors.d.ts} +3 -3
- package/dist/components/SpiceDeposit/{feePreview.d.ts → lib/feePreview.d.ts} +1 -1
- package/dist/components/SpiceDeposit/{ConnectWalletModal.d.ts → steps/ConnectWalletModal.d.ts} +1 -1
- package/dist/components/SpiceDeposit/{DepositModal.d.ts → steps/DepositModal.d.ts} +1 -1
- package/dist/components/SpiceDeposit/{DepositRecoveryPrompt.d.ts → steps/DepositRecoveryPrompt.d.ts} +1 -1
- package/dist/components/SpiceDeposit/{DepositStatusModal.d.ts → steps/DepositStatusModal.d.ts} +3 -3
- package/dist/components/SpiceDeposit/{SelectChainModal.d.ts → steps/SelectChainModal.d.ts} +1 -1
- package/dist/components/SpiceDeposit/{SelectTokenModal.d.ts → steps/SelectTokenModal.d.ts} +1 -1
- package/dist/components/SpiceLock/{executors.d.ts → lib/executors.d.ts} +13 -14
- package/dist/components/SpiceLock/{helpers.d.ts → lib/helpers.d.ts} +2 -2
- package/dist/components/SpiceLock/{LockConfirmationPanel.d.ts → parts/LockConfirmationPanel.d.ts} +1 -1
- package/dist/components/SpiceLock/{LockDurationSlider.d.ts → parts/LockDurationSlider.d.ts} +1 -1
- package/dist/components/SpiceLock/{LockExpiryRow.d.ts → parts/LockExpiryRow.d.ts} +1 -1
- package/dist/components/SpiceLock/{VotingPowerRow.d.ts → parts/VotingPowerRow.d.ts} +1 -1
- package/dist/components/SpicePay/SpicePay.d.ts +1 -1
- package/dist/components/SpiceSupply/{buildBatches.d.ts → lib/buildBatches.d.ts} +12 -11
- package/dist/components/SpiceSupply/lib/executors.d.ts +71 -0
- package/dist/components/SpiceSupply/{feePreview.d.ts → lib/feePreview.d.ts} +13 -12
- package/dist/components/SpiceSupply/{DestinationEstimate.d.ts → parts/DestinationEstimate.d.ts} +2 -2
- package/dist/components/SpiceSupply/{SupplyEstimate.d.ts → parts/SupplyEstimate.d.ts} +1 -1
- package/dist/components/SpiceWithdraw/lib/executors.d.ts +34 -0
- package/dist/components/SpiceWithdraw/{SelectPopover.d.ts → parts/SelectPopover.d.ts} +1 -1
- package/dist/components/StatusDisplay/index.d.ts +3 -2
- package/dist/components/StatusDisplay/{StatusIcon.d.ts → parts/StatusIcon.d.ts} +1 -1
- package/dist/components/StatusDisplay/{StatusPanel.d.ts → parts/StatusPanel.d.ts} +1 -1
- package/dist/components/StatusDisplay/{StepItem.d.ts → parts/StepItem.d.ts} +1 -1
- package/dist/execution/gasless.d.ts +7 -0
- package/dist/execution/pollIntentStep.d.ts +29 -0
- package/dist/hooks/useSpiceExecution.d.ts +1 -0
- package/dist/index.cjs.js +12 -12
- package/dist/index.d.ts +2 -1
- package/dist/index.js +16 -16
- package/dist/{providerWallet-Ds1PM0vC.js → providerWallet-Cv_GlhF1.js} +1 -1
- package/dist/{providerWallet-6FpyLYqw.js → providerWallet-IDnLJm9s.js} +1 -1
- package/dist/providers/dynamic.d.ts +2 -2
- package/dist/providers/privy.d.ts +2 -2
- package/dist/types/supply.d.ts +15 -2
- package/dist/utils/spiceConstants.d.ts +3 -0
- package/package.json +2 -2
- package/dist/Button-CkSwrat1.js +0 -2
- package/dist/Button-jx5yrM-s.js +0 -2
- package/dist/components/SpiceDeposit/views/DepositSubtitle.d.ts +0 -9
- package/dist/components/SpiceSupply/executors.d.ts +0 -73
- package/dist/components/SpiceWithdraw/executors.d.ts +0 -50
- /package/dist/components/AccountDisplay/{AccountActions.d.ts → parts/AccountActions.d.ts} +0 -0
- /package/dist/components/SpiceBalance/{AccountItem.d.ts → parts/AccountItem.d.ts} +0 -0
- /package/dist/components/SpiceBalance/{BalanceSection.d.ts → parts/BalanceSection.d.ts} +0 -0
- /package/dist/components/SpiceDeposit/{views/AssetChooserList.d.ts → parts/DepositAssetChooser.d.ts} +0 -0
- /package/dist/components/SpiceDeposit/{ModalHeader.d.ts → parts/ModalHeader.d.ts} +0 -0
- /package/dist/components/SpiceWithdraw/{helpers.d.ts → lib/helpers.d.ts} +0 -0
- /package/dist/components/SpiceWithdraw/{views/BalancePopover.d.ts → parts/WithdrawBalancePopover.d.ts} +0 -0
- /package/dist/components/SpiceWithdraw/{views → parts}/WithdrawDetailsPanel.d.ts +0 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
|
+
import { type Address } from "viem";
|
|
3
|
+
import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
4
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
5
|
+
import type { SelectedAsset } from "../../../types/assets";
|
|
6
|
+
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
7
|
+
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
8
|
+
import type { GaslessExecutionOptions, GaslessProgress } from "../../../hooks/useSpiceExecution";
|
|
9
|
+
import type { GaslessRunner } from "../../../execution/gasless";
|
|
10
|
+
export type SupplyStep = "idle" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
|
|
11
|
+
export type PaymentResult = {
|
|
12
|
+
status: "processing" | "success" | "failed";
|
|
13
|
+
txHash?: string;
|
|
14
|
+
error?: string;
|
|
15
|
+
};
|
|
16
|
+
type BuildPayBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
17
|
+
type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
18
|
+
type EstimateRequiredGrossFundingFn = (requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, gaslessOptions?: Pick<GaslessExecutionOptions, "useCustomTransfers" | "userOverride">) => Promise<{
|
|
19
|
+
grossFunding: bigint;
|
|
20
|
+
feeEstimate: FeeEstimateSummary;
|
|
21
|
+
}>;
|
|
22
|
+
export type ExecutorContext = {
|
|
23
|
+
selectedAsset: SelectedAsset | null;
|
|
24
|
+
parsedAmount: number;
|
|
25
|
+
currentPaymentAmount: string;
|
|
26
|
+
isInsufficientBalance: boolean;
|
|
27
|
+
isPayMode: boolean;
|
|
28
|
+
isNon7702: boolean;
|
|
29
|
+
isSourceDestToken: boolean;
|
|
30
|
+
needsSwap: boolean;
|
|
31
|
+
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
32
|
+
selectedIsEquivalent: boolean;
|
|
33
|
+
resolvedTokenIn: Address | null;
|
|
34
|
+
embeddedWalletAddress: string | null | undefined;
|
|
35
|
+
providerEmbeddedAddress: string | null | undefined;
|
|
36
|
+
externalWallet: {
|
|
37
|
+
getEthereumProvider: () => Promise<any>;
|
|
38
|
+
} | null | undefined;
|
|
39
|
+
externalWalletAddress: string | null | undefined;
|
|
40
|
+
address: string | null | undefined;
|
|
41
|
+
isConnected: boolean;
|
|
42
|
+
ready: boolean;
|
|
43
|
+
authenticated: boolean;
|
|
44
|
+
provider: string | null | undefined;
|
|
45
|
+
resolvedChainId: number;
|
|
46
|
+
executionTokenAddress: Address;
|
|
47
|
+
gasless: GaslessRunner & {
|
|
48
|
+
buildPayChainBatches: BuildPayBatchesFn;
|
|
49
|
+
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
50
|
+
estimateRequiredGrossFunding: EstimateRequiredGrossFundingFn;
|
|
51
|
+
onProgress: (progress: GaslessProgress) => void;
|
|
52
|
+
};
|
|
53
|
+
ui: {
|
|
54
|
+
setError: Dispatch<SetStateAction<string | null>>;
|
|
55
|
+
setStep: Dispatch<SetStateAction<SupplyStep>>;
|
|
56
|
+
setStatusMsg: Dispatch<SetStateAction<string>>;
|
|
57
|
+
setTxHash: Dispatch<SetStateAction<string | null>>;
|
|
58
|
+
setIsExecuting: Dispatch<SetStateAction<boolean>>;
|
|
59
|
+
setShowStatusPanel: Dispatch<SetStateAction<boolean>>;
|
|
60
|
+
setPaymentResult: Dispatch<SetStateAction<PaymentResult | null>>;
|
|
61
|
+
};
|
|
62
|
+
refs: {
|
|
63
|
+
spiceDepositSubmittedRef: MutableRefObject<boolean>;
|
|
64
|
+
abortControllerRef: MutableRefObject<AbortController | null>;
|
|
65
|
+
};
|
|
66
|
+
} & Pick<SpiceSupplyProps, "destinationToken" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "onError">;
|
|
67
|
+
export declare function executeSupply(ctx: ExecutorContext): Promise<void>;
|
|
68
|
+
export declare function executeDirectExternalAction(ctx: ExecutorContext): Promise<`0x${string}` | undefined>;
|
|
69
|
+
export declare function executeNon7702Pay(ctx: ExecutorContext): Promise<string>;
|
|
70
|
+
export declare function executePay(ctx: ExecutorContext): Promise<void>;
|
|
71
|
+
export {};
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
2
|
import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
3
|
-
import type { FeePreview } from "
|
|
4
|
-
import type { ChainBatch } from "
|
|
5
|
-
import type { SelectedAsset } from "
|
|
6
|
-
import type { SpiceSupplyProps } from "
|
|
7
|
-
import type { ResolvedExactOutputSwap } from "
|
|
3
|
+
import type { FeePreview } from "../../../types/ui";
|
|
4
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
5
|
+
import type { SelectedAsset } from "../../../types/assets";
|
|
6
|
+
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
7
|
+
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
8
8
|
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
9
|
-
import type { GaslessExecutionOptions } from "
|
|
9
|
+
import type { GaslessExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
10
10
|
type EstimateGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: GaslessExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
11
|
-
type BuildPayBatchesFn = (options?:
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
type BuildPayBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
12
|
+
type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
13
|
+
type EstimateRequiredGrossFundingFn = (requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, gaslessOptions?: Pick<GaslessExecutionOptions, "useCustomTransfers" | "userOverride">) => Promise<{
|
|
14
|
+
grossFunding: bigint;
|
|
15
|
+
feeEstimate: FeeEstimateSummary;
|
|
16
|
+
}>;
|
|
17
17
|
export interface FeePreviewContext {
|
|
18
18
|
selectedAsset: SelectedAsset | null;
|
|
19
19
|
isPayMode: boolean;
|
|
@@ -24,6 +24,7 @@ export interface FeePreviewContext {
|
|
|
24
24
|
isSourceDestToken: boolean;
|
|
25
25
|
currentPaymentAmount: string;
|
|
26
26
|
destinationToken: SpiceSupplyProps["destinationToken"];
|
|
27
|
+
feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
|
|
27
28
|
resolvedTokenIn: Address | null;
|
|
28
29
|
embeddedWalletAddress: string | null | undefined;
|
|
29
30
|
providerEmbeddedAddress: string | null | undefined;
|
package/dist/components/SpiceSupply/{DestinationEstimate.d.ts → parts/DestinationEstimate.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ResolvedExactOutputSwap } from "
|
|
3
|
-
import type { ResolvedDarkPalette } from "
|
|
2
|
+
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
3
|
+
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
4
4
|
interface DestinationEstimateProps {
|
|
5
5
|
variant: "supply" | "pay";
|
|
6
6
|
destinationSymbol: string;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
|
+
import type { GaslessRunner } from "../../../execution/gasless";
|
|
3
|
+
import type { DestinationToken, SpiceWithdrawProps } from "../../../types/withdraw";
|
|
4
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
5
|
+
import type { GaslessProgress } from "../../../hooks/useSpiceExecution";
|
|
6
|
+
export type WithdrawalExecutionContext = {
|
|
7
|
+
actionId: string;
|
|
8
|
+
intentId: string;
|
|
9
|
+
intentIndex: number;
|
|
10
|
+
totalSteps: number;
|
|
11
|
+
};
|
|
12
|
+
export type WithdrawExecutorContext = {
|
|
13
|
+
batches: ChainBatch[];
|
|
14
|
+
walletAddress: string | null | undefined;
|
|
15
|
+
recipient: string | null | undefined;
|
|
16
|
+
token: DestinationToken | null;
|
|
17
|
+
chainId: number | null;
|
|
18
|
+
amount: string;
|
|
19
|
+
receiveAmountRaw: bigint;
|
|
20
|
+
gasFee: bigint | null;
|
|
21
|
+
isNon7702: boolean;
|
|
22
|
+
buildWithdrawBatches: (spicenetFundingAmount?: bigint) => ChainBatch[];
|
|
23
|
+
gasless: GaslessRunner;
|
|
24
|
+
ui: {
|
|
25
|
+
setIsExecuting: Dispatch<SetStateAction<boolean>>;
|
|
26
|
+
setExecutionError: Dispatch<SetStateAction<string | null>>;
|
|
27
|
+
setExecutionProgress: Dispatch<SetStateAction<GaslessProgress | null>>;
|
|
28
|
+
setLockedGasFee: Dispatch<SetStateAction<bigint | null>>;
|
|
29
|
+
};
|
|
30
|
+
executionContextRef: MutableRefObject<WithdrawalExecutionContext | null>;
|
|
31
|
+
isMountedRef: MutableRefObject<boolean>;
|
|
32
|
+
} & Pick<SpiceWithdrawProps, "onWithdrawExecute" | "onWithdrawSuccess" | "onWithdrawError" | "buildSpicenetBatch">;
|
|
33
|
+
export declare function executeWithdraw(ctx: WithdrawExecutorContext): Promise<void>;
|
|
34
|
+
export declare function retryWithdraw(ctx: WithdrawExecutorContext): Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { StatusDisplay } from "./StatusDisplay";
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { StatusPanel } from "./parts/StatusPanel";
|
|
3
|
+
export { StatusIcon } from "./parts/StatusIcon";
|
|
4
|
+
export { StepItem } from "./parts/StepItem";
|
|
4
5
|
export type { StatusIconProps, StepItemProps } from "../../types/status";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { StatusResultItem, StatusPanelProps } from "
|
|
2
|
+
import type { StatusResultItem, StatusPanelProps } from "../../../types/status";
|
|
3
3
|
export type { StatusResultItem, StatusPanelProps };
|
|
4
4
|
export declare const StatusPanel: React.FC<StatusPanelProps>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
2
|
+
import type { ChainBatch } from "../types/authorization";
|
|
3
|
+
import type { GaslessExecutionOptions, GaslessProgress } from "../hooks/useSpiceExecution";
|
|
4
|
+
export type GaslessRunner = {
|
|
5
|
+
estimateGasless: (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: GaslessExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
6
|
+
executeGasless: (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, onProgress?: (progress: GaslessProgress) => void, signal?: AbortSignal, options?: GaslessExecutionOptions) => Promise<string>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const FIRST_STEP_POLL_MS = 350;
|
|
2
|
+
export declare const STEP_POLL_MS = 1000;
|
|
3
|
+
export type PollIntentStepOptions = {
|
|
4
|
+
actionId: string;
|
|
5
|
+
intentIndex: number;
|
|
6
|
+
intentId: string;
|
|
7
|
+
stepIndex: number;
|
|
8
|
+
maxPolls?: number;
|
|
9
|
+
maxExecuteAttempts?: number;
|
|
10
|
+
pollsBeforeRetry?: number;
|
|
11
|
+
maxConsecutiveStatusErrors?: number;
|
|
12
|
+
onStatusMessage?: (message: string, txHash?: string) => void;
|
|
13
|
+
signal?: AbortSignal;
|
|
14
|
+
chainId?: number;
|
|
15
|
+
};
|
|
16
|
+
export declare function pollIntentStepUntilSuccess(options: PollIntentStepOptions): Promise<string | undefined>;
|
|
17
|
+
export declare function runAllIntentSteps(options: {
|
|
18
|
+
actionId: string;
|
|
19
|
+
intentIndex: number;
|
|
20
|
+
intentId: string;
|
|
21
|
+
totalSteps: number;
|
|
22
|
+
startStepIndex?: number;
|
|
23
|
+
delayBeforeSpicenetStepMs?: number;
|
|
24
|
+
isSpicenetStep?: (stepIndex: number) => boolean;
|
|
25
|
+
maxExecuteAttemptsForStep?: (stepIndex: number) => number;
|
|
26
|
+
maxPolls?: number;
|
|
27
|
+
onStatusMessage?: (message: string, txHash?: string) => void;
|
|
28
|
+
signal?: AbortSignal;
|
|
29
|
+
}): Promise<string | undefined>;
|
|
@@ -22,6 +22,7 @@ export interface GaslessExecutionOptions {
|
|
|
22
22
|
useCustomTransfers?: boolean;
|
|
23
23
|
userOverride?: Address;
|
|
24
24
|
signAuthorizationsForEstimate?: boolean;
|
|
25
|
+
feeExecutionMode?: "backend-transfer" | "user-transfer";
|
|
25
26
|
}
|
|
26
27
|
export declare function useSpiceExecution(): {
|
|
27
28
|
executeGasless: (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, onProgress?: OnProgress, signal?: AbortSignal, options?: GaslessExecutionOptions) => Promise<string>;
|