@spicenet-io/spiceflow-ui 3.3.5 → 3.3.6
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-E8Ln6miF.js +2 -0
- package/dist/Button-RzLL2mKv.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/AccountDisplay.d.ts +1 -1
- package/dist/components/AccountDisplay/index.d.ts +2 -2
- 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/{types/account.d.ts → components/AccountDisplay/types.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/SpiceBalance.d.ts +1 -1
- package/dist/components/SpiceBalance/index.d.ts +3 -3
- package/dist/{types/balance.d.ts → components/SpiceBalance/types.d.ts} +1 -1
- 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/lib/executors.d.ts +64 -0
- package/dist/components/SpiceDeposit/lib/feePreview.d.ts +15 -0
- package/dist/components/SpiceDeposit/parts/DepositAssetChooser.d.ts +21 -0
- 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/{SpiceLockModal/SpiceLockModal.d.ts → SpiceLock/SpiceLock.d.ts} +1 -1
- package/dist/components/SpiceLock/index.d.ts +2 -0
- package/dist/components/SpiceLock/lib/executors.d.ts +53 -0
- package/dist/components/SpiceLock/lib/helpers.d.ts +31 -0
- package/dist/components/SpiceLock/parts/LockConfirmationPanel.d.ts +4 -0
- package/dist/components/SpiceLock/parts/LockDurationSlider.d.ts +4 -0
- package/dist/components/SpiceLock/parts/LockExpiryRow.d.ts +4 -0
- package/dist/components/SpiceLock/parts/VotingPowerRow.d.ts +4 -0
- package/dist/components/SpicePay/SpicePay.d.ts +12 -2
- package/dist/components/SpiceSupply/lib/buildBatches.d.ts +33 -0
- package/dist/components/SpiceSupply/lib/executors.d.ts +67 -0
- package/dist/components/SpiceSupply/lib/feePreview.d.ts +43 -0
- 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/lib/helpers.d.ts +6 -0
- package/dist/components/SpiceWithdraw/{SelectPopover.d.ts → parts/SelectPopover.d.ts} +1 -1
- package/dist/components/SpiceWithdraw/parts/WithdrawBalancePopover.d.ts +15 -0
- package/dist/components/SpiceWithdraw/parts/WithdrawDetailsPanel.d.ts +39 -0
- 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 +28 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/{useLockDuration/index.d.ts → useLockDuration.d.ts} +1 -1
- package/dist/hooks/{useSpiceAssets/index.d.ts → useSpiceAssets.d.ts} +1 -1
- package/dist/hooks/useSpiceBrand.d.ts +9 -1
- package/dist/hooks/{useGaslessExecution/index.d.ts → useSpiceExecution.d.ts} +3 -2
- package/dist/hooks/{useStatus/index.d.ts → useStatus.d.ts} +1 -1
- package/dist/hooks/{useAssets/index.d.ts → useWalletBalances.d.ts} +1 -1
- package/dist/index.cjs.js +12 -12
- package/dist/index.d.ts +15 -12
- package/dist/index.js +12 -12
- package/dist/{providerWallet-CVHyIqiI.js → providerWallet-B7SytehJ.js} +1 -1
- package/dist/{providerWallet-CIbQEcIP.js → providerWallet-Ddncx8s5.js} +1 -1
- package/dist/providers/dynamic.d.ts +3 -0
- package/dist/providers/privy.d.ts +3 -0
- package/dist/types/index.d.ts +0 -4
- package/dist/types/supply.d.ts +15 -0
- package/dist/types/theme.d.ts +20 -90
- package/dist/types/ui.d.ts +1 -1
- package/dist/types/wallet.d.ts +5 -24
- package/dist/utils/addresses.d.ts +1 -0
- package/dist/utils/chains/index.d.ts +7 -0
- package/dist/utils/crossChainRouter/executeSwapThenAction.d.ts +1 -1
- package/dist/utils/errors.d.ts +11 -1
- package/dist/utils/fees.d.ts +18 -1
- package/dist/utils/relayer/index.d.ts +2 -6
- package/dist/utils/spiceConstants.d.ts +3 -0
- package/package.json +4 -4
- package/dist/Button-BXgazUZN.js +0 -2
- package/dist/Button-d9wfO_xs.js +0 -2
- package/dist/auth-dynamic.d.ts +0 -3
- package/dist/auth-privy.d.ts +0 -3
- package/dist/components/SpiceLockModal/LockSubComponents.d.ts +0 -7
- package/dist/components/SpiceLockModal/index.d.ts +0 -1
- package/dist/errors.d.ts +0 -8
- package/dist/types/pay.d.ts +0 -30
- package/dist/types/rollup.d.ts +0 -50
- package/dist/types/unified.d.ts +0 -85
- package/dist/utils/abis/spicenet.d.ts +0 -115
- package/dist/utils/abis/spicenetWalletManager.d.ts +0 -566
- /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/{ModalHeader.d.ts → parts/ModalHeader.d.ts} +0 -0
- /package/dist/hooks/{useAssetInput/index.d.ts → useAssetInput.d.ts} +0 -0
- /package/dist/utils/{loadFonts.d.ts → fonts.d.ts} +0 -0
- /package/dist/utils/{resolveTheme.d.ts → theme.d.ts} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
3
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
4
|
+
export declare function sumRollupBalanceForChainToken(balances: unknown, chainId: number, tokenAddress: string): bigint;
|
|
5
|
+
export declare function fetchSpiceBalanceForChainToken(apiBaseUrl: string, user: Address, chainId: number, tokenAddress: string): Promise<bigint>;
|
|
6
|
+
export declare function waitForSpiceBalanceIncrease({ apiBaseUrl, user, chainId, tokenAddress, prevBalance, timeoutMs, pollIntervalMs, }: {
|
|
7
|
+
apiBaseUrl: string;
|
|
8
|
+
user: Address;
|
|
9
|
+
chainId: number;
|
|
10
|
+
tokenAddress: string;
|
|
11
|
+
prevBalance: bigint;
|
|
12
|
+
timeoutMs?: number;
|
|
13
|
+
pollIntervalMs?: number;
|
|
14
|
+
}): Promise<void>;
|
|
15
|
+
export declare function build7702EstimateRequest(user: Address, batches: ChainBatch[]): {
|
|
16
|
+
user: `0x${string}`;
|
|
17
|
+
intents: {
|
|
18
|
+
mode: "7702";
|
|
19
|
+
signatureType: "ecdsa";
|
|
20
|
+
signature: `0x${string}`;
|
|
21
|
+
nbf: number;
|
|
22
|
+
exp: number;
|
|
23
|
+
chainBatches: {
|
|
24
|
+
hash: any;
|
|
25
|
+
chainId: any;
|
|
26
|
+
tokenTransfers: import("../../..").TokenTransferConfig[];
|
|
27
|
+
calls: any;
|
|
28
|
+
}[];
|
|
29
|
+
}[];
|
|
30
|
+
};
|
|
31
|
+
export declare function withSpicenetFundingBatch(batches: ChainBatch[], userAddress: Address, feeEstimate?: FeeEstimateSummary): ChainBatch[];
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import type { SpiceSupplyProps } from "../../types/supply";
|
|
4
|
+
export type SpicePayProps = Omit<SpiceSupplyProps, "amountDirection" | "destinationToken" | "actionLabel" | "swapDescription" | "directDescription" | "supportedSourceAssets" | "onSuccess" | "onError"> & {
|
|
5
|
+
paymentTokenAddress: Address;
|
|
6
|
+
paymentTokenSymbol: string;
|
|
7
|
+
paymentTokenDecimals: number;
|
|
8
|
+
paymentTokenLogoURI?: string;
|
|
9
|
+
paymentChainId: number;
|
|
10
|
+
ctaLabel?: string;
|
|
11
|
+
onPaymentSuccess?: (txHash?: string) => void;
|
|
12
|
+
onPaymentError?: (error: Error) => void;
|
|
13
|
+
};
|
|
4
14
|
export declare const SpicePay: React.FC<SpicePayProps>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
3
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
4
|
+
import type { SelectedAsset } from "../../../types/assets";
|
|
5
|
+
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
6
|
+
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
7
|
+
import type { GaslessExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
8
|
+
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
9
|
+
type EstimateGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: GaslessExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
10
|
+
export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
|
|
11
|
+
export interface BatchBuilderContext {
|
|
12
|
+
currentPaymentAmount: string;
|
|
13
|
+
destinationToken: SpiceSupplyProps["destinationToken"];
|
|
14
|
+
embeddedWalletAddress: string | null | undefined;
|
|
15
|
+
providerEmbeddedAddress: string | null | undefined;
|
|
16
|
+
address: string | null | undefined;
|
|
17
|
+
isNon7702: boolean;
|
|
18
|
+
isPayMode: boolean;
|
|
19
|
+
resolvedChainId: number;
|
|
20
|
+
buildActionCalls: SpiceSupplyProps["buildActionCalls"];
|
|
21
|
+
feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
|
|
22
|
+
buildSpicenetBatch: SpiceSupplyProps["buildSpicenetBatch"];
|
|
23
|
+
selectedAsset: SelectedAsset | null;
|
|
24
|
+
needsSwap: boolean;
|
|
25
|
+
resolvedSwap: ResolvedSwap | null;
|
|
26
|
+
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
27
|
+
quoteAmountOut: bigint | null;
|
|
28
|
+
resolvedTokenIn: Address | null;
|
|
29
|
+
}
|
|
30
|
+
export declare function buildPayChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
|
|
31
|
+
export declare function buildSupplyChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
|
|
32
|
+
export declare function estimateRequiredGrossFunding(requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, estimateGasless: EstimateGaslessFn, gaslessOptions?: Pick<GaslessExecutionOptions, "useCustomTransfers" | "userOverride">): Promise<bigint>;
|
|
33
|
+
export {};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
|
+
import { type Address } from "viem";
|
|
3
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
4
|
+
import type { SelectedAsset } from "../../../types/assets";
|
|
5
|
+
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
6
|
+
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
7
|
+
import type { GaslessExecutionOptions, GaslessProgress } from "../../../hooks/useSpiceExecution";
|
|
8
|
+
import type { GaslessRunner } from "../../../execution/gasless";
|
|
9
|
+
export type SupplyStep = "idle" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
|
|
10
|
+
export type PaymentResult = {
|
|
11
|
+
status: "processing" | "success" | "failed";
|
|
12
|
+
txHash?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
};
|
|
15
|
+
type BuildPayBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
16
|
+
type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
17
|
+
type EstimateRequiredGrossFundingFn = (requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, gaslessOptions?: Pick<GaslessExecutionOptions, "useCustomTransfers" | "userOverride">) => Promise<bigint>;
|
|
18
|
+
export type ExecutorContext = {
|
|
19
|
+
selectedAsset: SelectedAsset | null;
|
|
20
|
+
parsedAmount: number;
|
|
21
|
+
currentPaymentAmount: string;
|
|
22
|
+
isInsufficientBalance: boolean;
|
|
23
|
+
isPayMode: boolean;
|
|
24
|
+
isNon7702: boolean;
|
|
25
|
+
isSourceDestToken: boolean;
|
|
26
|
+
needsSwap: boolean;
|
|
27
|
+
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
28
|
+
selectedIsEquivalent: boolean;
|
|
29
|
+
resolvedTokenIn: Address | null;
|
|
30
|
+
embeddedWalletAddress: string | null | undefined;
|
|
31
|
+
providerEmbeddedAddress: string | null | undefined;
|
|
32
|
+
externalWallet: {
|
|
33
|
+
getEthereumProvider: () => Promise<any>;
|
|
34
|
+
} | null | undefined;
|
|
35
|
+
externalWalletAddress: string | null | undefined;
|
|
36
|
+
address: string | null | undefined;
|
|
37
|
+
isConnected: boolean;
|
|
38
|
+
ready: boolean;
|
|
39
|
+
authenticated: boolean;
|
|
40
|
+
provider: string | null | undefined;
|
|
41
|
+
resolvedChainId: number;
|
|
42
|
+
executionTokenAddress: Address;
|
|
43
|
+
gasless: GaslessRunner & {
|
|
44
|
+
buildPayChainBatches: BuildPayBatchesFn;
|
|
45
|
+
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
46
|
+
estimateRequiredGrossFunding: EstimateRequiredGrossFundingFn;
|
|
47
|
+
onProgress: (progress: GaslessProgress) => void;
|
|
48
|
+
};
|
|
49
|
+
ui: {
|
|
50
|
+
setError: Dispatch<SetStateAction<string | null>>;
|
|
51
|
+
setStep: Dispatch<SetStateAction<SupplyStep>>;
|
|
52
|
+
setStatusMsg: Dispatch<SetStateAction<string>>;
|
|
53
|
+
setTxHash: Dispatch<SetStateAction<string | null>>;
|
|
54
|
+
setIsExecuting: Dispatch<SetStateAction<boolean>>;
|
|
55
|
+
setShowStatusPanel: Dispatch<SetStateAction<boolean>>;
|
|
56
|
+
setPaymentResult: Dispatch<SetStateAction<PaymentResult | null>>;
|
|
57
|
+
};
|
|
58
|
+
refs: {
|
|
59
|
+
spiceDepositSubmittedRef: MutableRefObject<boolean>;
|
|
60
|
+
abortControllerRef: MutableRefObject<AbortController | null>;
|
|
61
|
+
};
|
|
62
|
+
} & Pick<SpiceSupplyProps, "destinationToken" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "onError">;
|
|
63
|
+
export declare function executeSupply(ctx: ExecutorContext): Promise<void>;
|
|
64
|
+
export declare function executeDirectExternalAction(ctx: ExecutorContext): Promise<`0x${string}` | undefined>;
|
|
65
|
+
export declare function executeNon7702Pay(ctx: ExecutorContext): Promise<string>;
|
|
66
|
+
export declare function executePay(ctx: ExecutorContext): Promise<void>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
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
|
+
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
9
|
+
import type { GaslessExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
10
|
+
type EstimateGaslessFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: GaslessExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
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<bigint>;
|
|
14
|
+
export interface FeePreviewContext {
|
|
15
|
+
selectedAsset: SelectedAsset | null;
|
|
16
|
+
isPayMode: boolean;
|
|
17
|
+
parsedAmount: number;
|
|
18
|
+
needsSwap: boolean;
|
|
19
|
+
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
20
|
+
isNon7702: boolean;
|
|
21
|
+
isSourceDestToken: boolean;
|
|
22
|
+
currentPaymentAmount: string;
|
|
23
|
+
destinationToken: SpiceSupplyProps["destinationToken"];
|
|
24
|
+
feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
|
|
25
|
+
resolvedTokenIn: Address | null;
|
|
26
|
+
embeddedWalletAddress: string | null | undefined;
|
|
27
|
+
providerEmbeddedAddress: string | null | undefined;
|
|
28
|
+
resolvedChainId: number;
|
|
29
|
+
isConnected: boolean;
|
|
30
|
+
address: string | null | undefined;
|
|
31
|
+
ready: boolean;
|
|
32
|
+
authenticated: boolean;
|
|
33
|
+
isDirect: boolean;
|
|
34
|
+
resolvedSwap: ResolvedSwap | null;
|
|
35
|
+
isQuoting: boolean;
|
|
36
|
+
executionTokenAddress: Address;
|
|
37
|
+
buildPayChainBatches: BuildPayBatchesFn;
|
|
38
|
+
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
39
|
+
estimateGasless: EstimateGaslessFn;
|
|
40
|
+
estimateRequiredGrossFunding: EstimateRequiredGrossFundingFn;
|
|
41
|
+
}
|
|
42
|
+
export declare function estimateFeePreview(ctx: FeePreviewContext): Promise<FeePreview | null>;
|
|
43
|
+
export {};
|
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>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
2
|
+
export declare function normalizeTokenLabel(value?: string | null): string;
|
|
3
|
+
export declare function formatTokenAmount(rawAmount: bigint, decimals: number): string;
|
|
4
|
+
export declare function scaleAmountBetweenDecimals(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
|
|
5
|
+
export declare function estimateUsd(amount: number, symbol?: string): string;
|
|
6
|
+
export declare function getFeeAdjustedWithdrawFunding(feeEstimate: FeeEstimateSummary, fallbackChainId: number): bigint | null;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
3
|
+
interface BalancePopoverProps {
|
|
4
|
+
show: boolean;
|
|
5
|
+
position: {
|
|
6
|
+
top: number;
|
|
7
|
+
left: number;
|
|
8
|
+
} | null;
|
|
9
|
+
popoverRef: React.RefObject<HTMLDivElement>;
|
|
10
|
+
spiceAssets: any[] | null | undefined;
|
|
11
|
+
dark: boolean;
|
|
12
|
+
dk: ResolvedDarkPalette;
|
|
13
|
+
}
|
|
14
|
+
export declare const BalancePopover: React.FC<BalancePopoverProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
3
|
+
import type { Theme, CustomStyles } from "../../../types/theme";
|
|
4
|
+
interface WithdrawDetailsPanelProps {
|
|
5
|
+
show: boolean;
|
|
6
|
+
onToggle: () => void;
|
|
7
|
+
showCustomAddress: boolean;
|
|
8
|
+
setShowCustomAddress: React.Dispatch<React.SetStateAction<boolean>>;
|
|
9
|
+
customRecipient: string;
|
|
10
|
+
setCustomRecipient: (value: string) => void;
|
|
11
|
+
externalAddress: string | null | undefined;
|
|
12
|
+
recipientAddress: string | null | undefined;
|
|
13
|
+
destChainName: string;
|
|
14
|
+
destChainLogo: string | null;
|
|
15
|
+
compatibleDestinationChains: number[];
|
|
16
|
+
txDetailsChainSwitchRef: React.RefObject<HTMLButtonElement>;
|
|
17
|
+
onOpenNetworkPopover: (anchor: HTMLButtonElement | null) => void;
|
|
18
|
+
sourceChainLabel: string;
|
|
19
|
+
sourceDetailsLogo: string | null | undefined;
|
|
20
|
+
sourceTokenLabel: string;
|
|
21
|
+
amount: string;
|
|
22
|
+
totalSourceDebitDisplay: string;
|
|
23
|
+
receiveAmountDisplay: string;
|
|
24
|
+
destTokenSymbol: string;
|
|
25
|
+
shouldQuoteWithdrawGas: boolean;
|
|
26
|
+
estimatingFee: boolean;
|
|
27
|
+
feeError: string | null;
|
|
28
|
+
displayedGasFee: bigint | null;
|
|
29
|
+
selectedDestToken: {
|
|
30
|
+
decimals: number;
|
|
31
|
+
symbol: string;
|
|
32
|
+
} | null;
|
|
33
|
+
theme: Theme;
|
|
34
|
+
styles: CustomStyles | undefined;
|
|
35
|
+
dark: boolean;
|
|
36
|
+
dk: ResolvedDarkPalette;
|
|
37
|
+
}
|
|
38
|
+
export declare const WithdrawDetailsPanel: React.FC<WithdrawDetailsPanelProps>;
|
|
39
|
+
export {};
|
|
@@ -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,28 @@
|
|
|
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
|
+
delayBeforeSpicenetStepMs?: number;
|
|
23
|
+
isSpicenetStep?: (stepIndex: number) => boolean;
|
|
24
|
+
maxExecuteAttemptsForStep?: (stepIndex: number) => number;
|
|
25
|
+
maxPolls?: number;
|
|
26
|
+
onStatusMessage?: (message: string, txHash?: string) => void;
|
|
27
|
+
signal?: AbortSignal;
|
|
28
|
+
}): Promise<string | undefined>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { useWalletBalances, fetchBalances } from "./
|
|
1
|
+
export { useWalletBalances, fetchBalances } from "./useWalletBalances";
|
|
2
2
|
export { useAssetInput } from "./useAssetInput";
|
|
3
3
|
export type { UseAssetInputReturn } from "./useAssetInput";
|
|
4
4
|
export { useWallet } from "./useWallet";
|
|
@@ -6,9 +6,9 @@ export type { UseWalletReturn, WalletState, WalletActions } from "./useWallet";
|
|
|
6
6
|
export { useEmbeddedWalletAddress } from "./useEmbeddedWalletAddress";
|
|
7
7
|
export { useSpiceAssets } from "./useSpiceAssets";
|
|
8
8
|
export type { UseSpiceAssetsConfig, UseSpiceAssetsReturn, } from "./useSpiceAssets";
|
|
9
|
-
export { useSpiceExecution } from "./
|
|
10
|
-
export { useSpiceExecution as useGaslessExecution } from "./
|
|
11
|
-
export type { GaslessProgress, GaslessStep, GaslessExecutionOptions, OnProgress, } from "./
|
|
9
|
+
export { useSpiceExecution } from "./useSpiceExecution";
|
|
10
|
+
export { useSpiceExecution as useGaslessExecution } from "./useSpiceExecution";
|
|
11
|
+
export type { GaslessProgress, GaslessStep, GaslessExecutionOptions, OnProgress, } from "./useSpiceExecution";
|
|
12
12
|
export { useLockDuration } from "./useLockDuration";
|
|
13
13
|
export type { UseLockDurationReturn } from "./useLockDuration";
|
|
14
14
|
export type { VerifiedPendingDeposit } from "./usePendingDeposit";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResolvedDarkPalette } from "../utils/
|
|
1
|
+
import type { ResolvedDarkPalette } from "../utils/theme";
|
|
2
2
|
import type { Theme, SpiceTheme, CustomStyles } from "../types/theme";
|
|
3
3
|
export interface UseSpiceBrandResult {
|
|
4
4
|
brand: SpiceTheme | undefined;
|
|
@@ -8,5 +8,13 @@ export interface UseSpiceBrandResult {
|
|
|
8
8
|
primaryColor: string;
|
|
9
9
|
dk: ResolvedDarkPalette;
|
|
10
10
|
palette: ResolvedDarkPalette;
|
|
11
|
+
fontFamily: string;
|
|
12
|
+
monoFont: string;
|
|
13
|
+
inputDark: boolean;
|
|
14
|
+
cardBg: string;
|
|
15
|
+
cardBorder: string;
|
|
16
|
+
textPrimary: string;
|
|
17
|
+
textSecondary: string;
|
|
18
|
+
subtitleText: string;
|
|
11
19
|
}
|
|
12
20
|
export declare function useSpiceBrand(componentStyles?: CustomStyles, componentDark?: boolean): UseSpiceBrandResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
|
-
import { ChainBatch, Call } from "
|
|
3
|
-
import type { FeeEstimateSummary } from "
|
|
2
|
+
import { ChainBatch, Call } from "../types/authorization";
|
|
3
|
+
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
4
4
|
export type { Call, ChainBatch };
|
|
5
5
|
export type GaslessStep = "idle" | "building" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "confirming-rollup" | "success" | "error";
|
|
6
6
|
export interface GaslessProgress {
|
|
@@ -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>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Address } from "viem";
|
|
2
|
-
import { Asset, MultiChainBalances } from "
|
|
2
|
+
import { Asset, MultiChainBalances } from "../types/assets";
|
|
3
3
|
export declare const fetchBalances: (walletAddress: Address, supportedChains?: number[]) => Promise<MultiChainBalances>;
|
|
4
4
|
export interface UseAssetsConfig {
|
|
5
5
|
address?: Address;
|