@spicenet-io/spiceflow-ui 4.9.4 → 4.9.6-consistency.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.
- package/dist/auth-privy.cjs.js +1 -1
- package/dist/auth-privy.js +1 -1
- package/dist/components/AccountDisplay/parts/AccountCustomSection.d.ts +1 -1
- package/dist/components/AccountDisplay/parts/AccountIdleBalances.d.ts +2 -2
- package/dist/components/AccountDisplay/parts/AccountPanel.d.ts +2 -2
- package/dist/components/AccountDisplay/types.d.ts +15 -4
- package/dist/components/SpiceSupply/lib/actionProceeds.d.ts +14 -0
- package/dist/components/SpiceSupply/lib/buildBatches.d.ts +21 -8
- package/dist/components/SpiceSupply/lib/executors.d.ts +13 -4
- package/dist/components/SpiceSupply/lib/feeConversion.d.ts +17 -0
- package/dist/components/SpiceSupply/lib/feeOnlyExecution.d.ts +6 -0
- package/dist/components/SpiceSupply/lib/feePreview.d.ts +43 -6
- package/dist/components/SpiceSupply/lib/payFundingBatches.d.ts +6 -0
- package/dist/components/SpiceWithdraw/lib/useEmbeddedWithdraw.d.ts +165 -0
- package/dist/components/SpiceWithdraw/parts/WithdrawDestinationCard.d.ts +4 -2
- package/dist/components/SpiceWithdraw/parts/WithdrawDetailsPanel.d.ts +4 -2
- package/dist/components/SpiceWithdraw/parts/WithdrawSourceCard.d.ts +4 -2
- package/dist/components/StatusDisplay/parts/StatusPanel.d.ts +2 -2
- package/dist/execution/escrowCredit.d.ts +18 -0
- package/dist/execution/externalWalletClient.d.ts +9 -0
- package/dist/execution/fundEmbeddedWallet.d.ts +12 -0
- package/dist/execution/fundedExecution.d.ts +24 -0
- package/dist/execution/pollIntentStep.d.ts +2 -0
- package/dist/execution/sourceFunding.d.ts +29 -0
- package/dist/execution/transactionReceipt.d.ts +12 -0
- package/dist/hooks/index.d.ts +9 -6
- package/dist/hooks/useDestinationToken.d.ts +20 -0
- package/dist/hooks/useInventoryResource.d.ts +21 -0
- package/dist/hooks/useLockWalletAssets.d.ts +1 -1
- package/dist/hooks/usePendingAction.d.ts +7 -0
- package/dist/hooks/useSpiceAction.d.ts +46 -0
- package/dist/hooks/useSpiceAssets.d.ts +2 -0
- package/dist/hooks/useSpiceExecution.d.ts +8 -2
- package/dist/hooks/useSpiceInventory.d.ts +31 -0
- package/dist/hooks/useSpiceLock.d.ts +129 -0
- package/dist/hooks/useSpiceLockQuote.d.ts +34 -3
- package/dist/hooks/useSpiceRollupPrices.d.ts +7 -0
- package/dist/hooks/useSpiceSupply.d.ts +133 -0
- package/dist/hooks/useSupplyAssets.d.ts +22 -20
- package/dist/hooks/useSupplyQuote.d.ts +20 -2
- package/dist/hooks/useWalletBalances.d.ts +8 -4
- package/dist/index.cjs.js +14 -27
- package/dist/index.d.ts +51 -41
- package/dist/index.js +18 -31
- package/dist/privy-B3kX5909.js +2 -0
- package/dist/privy-BIQ0yO8R.js +2 -0
- package/dist/providers/SpiceFlowProvider.d.ts +5 -3
- package/dist/types/assets.d.ts +10 -1
- package/dist/types/lock.d.ts +7 -3
- package/dist/types/supply.d.ts +43 -4
- package/dist/types/withdraw.d.ts +8 -3
- package/dist/utils/actionDefinition.d.ts +5 -0
- package/dist/utils/amounts.d.ts +2 -0
- package/dist/utils/assetDisplay.d.ts +8 -0
- package/dist/utils/assetPolicy.d.ts +14 -0
- package/dist/utils/chains/index.d.ts +4 -4
- package/dist/utils/crossChainRouter/liquidityVenues.d.ts +7 -1
- package/dist/utils/crossChainRouter/uniV3.d.ts +9 -5
- package/dist/utils/inventoryStore.d.ts +27 -0
- package/dist/utils/pendingDeposit.d.ts +30 -0
- package/dist/utils/relayer/index.d.ts +6 -2
- package/dist/utils/rollupBalances.d.ts +4 -0
- package/dist/utils/spiceConstants.d.ts +1 -0
- package/dist/utils/spicenetBatch.d.ts +18 -0
- package/dist/utils/theme.d.ts +3 -3
- package/dist/utils/tokenResolution.d.ts +27 -2
- package/package.json +1 -1
- package/dist/components/SpiceLock/lib/executors.d.ts +0 -76
- package/dist/hooks/useDirectWithdraw.d.ts +0 -18
- package/dist/privy-8_x0Dkgt.js +0 -2
- package/dist/privy-Sgm0uuL6.js +0 -2
|
@@ -18,12 +18,14 @@ type PollIntentStepOptions = {
|
|
|
18
18
|
};
|
|
19
19
|
export declare function pollIntentStepUntilSuccess(options: PollIntentStepOptions): Promise<string | undefined>;
|
|
20
20
|
export declare function runAllIntentSteps(options: {
|
|
21
|
+
resume?: boolean;
|
|
21
22
|
actionId: string;
|
|
22
23
|
intentIndex: number;
|
|
23
24
|
intentId: string;
|
|
24
25
|
totalSteps: number;
|
|
25
26
|
delayBeforeSpicenetStepMs?: number;
|
|
26
27
|
isSpicenetStep?: (stepIndex: number) => boolean;
|
|
28
|
+
beforeStep?: (stepIndex: number) => Promise<void>;
|
|
27
29
|
maxExecuteAttemptsForStep?: (stepIndex: number) => number;
|
|
28
30
|
maxPolls?: number;
|
|
29
31
|
onStatusMessage?: (message: string, txHash?: string) => void;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { TransactionObserver } from "./externalWalletClient";
|
|
3
|
+
export interface SourceFundingState {
|
|
4
|
+
version: 1;
|
|
5
|
+
identity: string;
|
|
6
|
+
baseline: string;
|
|
7
|
+
confirmedAmount: string;
|
|
8
|
+
pending?: {
|
|
9
|
+
amount: string;
|
|
10
|
+
hash?: `0x${string}`;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function isSourceFundingState(value: unknown): value is SourceFundingState;
|
|
14
|
+
export declare function fundSelectedExternalSource(params: {
|
|
15
|
+
identity: string;
|
|
16
|
+
state?: SourceFundingState;
|
|
17
|
+
onState: (state: SourceFundingState) => void;
|
|
18
|
+
createWallet: () => Promise<{
|
|
19
|
+
extWc: any;
|
|
20
|
+
viemChain?: any;
|
|
21
|
+
}>;
|
|
22
|
+
sourceClient: any;
|
|
23
|
+
recipient: Address;
|
|
24
|
+
tokenAddr: Address;
|
|
25
|
+
isNative: boolean;
|
|
26
|
+
requiredAmount: bigint;
|
|
27
|
+
reconcileOnly?: boolean;
|
|
28
|
+
observer?: TransactionObserver;
|
|
29
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Call } from "../types/authorization";
|
|
2
|
+
export declare function confirmDestinationReceipt(client: any, hash: string | undefined): Promise<string>;
|
|
3
|
+
export declare function waitForExpectedTransactionReceipt(params: {
|
|
4
|
+
client: any;
|
|
5
|
+
hash: `0x${string}`;
|
|
6
|
+
call: Call;
|
|
7
|
+
onRepriced?: (hash: `0x${string}`) => void;
|
|
8
|
+
onCancelled?: () => void;
|
|
9
|
+
}): Promise<{
|
|
10
|
+
receipt: any;
|
|
11
|
+
hash: `0x${string}`;
|
|
12
|
+
}>;
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { fetchBalances, useWalletBalances } from "./useWalletBalances";
|
|
2
2
|
export { useAssetInput } from "./useAssetInput";
|
|
3
3
|
export type { UseAssetInputReturn } from "./useAssetInput";
|
|
4
4
|
export { useWallet } from "./useWallet";
|
|
5
|
-
export type { UseWalletReturn,
|
|
5
|
+
export type { UseWalletReturn, WalletActions, WalletState } from "./useWallet";
|
|
6
6
|
export { useSpiceAssets } from "./useSpiceAssets";
|
|
7
7
|
export type { UseSpiceAssetsConfig, UseSpiceAssetsReturn, } from "./useSpiceAssets";
|
|
8
8
|
export { useSpiceExecution } from "./useSpiceExecution";
|
|
9
|
-
export type { ExecutionProgress, ExecutionStep,
|
|
9
|
+
export type { ExecutionOptions, ExecutionProgress, ExecutionStep, OnProgress, } from "./useSpiceExecution";
|
|
10
10
|
export { useLockDuration } from "./useLockDuration";
|
|
11
11
|
export type { UseLockDurationReturn } from "./useLockDuration";
|
|
12
12
|
export type { VerifiedPendingDeposit } from "./usePendingDeposit";
|
|
@@ -16,6 +16,9 @@ export { useSpiceBrand } from "./useSpiceBrand";
|
|
|
16
16
|
export { useSmartWallet } from "./useSmartWallet";
|
|
17
17
|
export { useIsUserWhitelisted } from "./useIsUserWhitelisted";
|
|
18
18
|
export type { PartnerWhitelistCheckResponse, UseIsUserWhitelistedOptions, } from "./useIsUserWhitelisted";
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export type {
|
|
19
|
+
export { isSupportedSupplyAsset, useSupplyAssets } from "./useSupplyAssets";
|
|
20
|
+
export { resolveInputSupplySwapQuote, useSupplyQuote } from "./useSupplyQuote";
|
|
21
|
+
export type { SupplyQuoteResult, UseSupplyQuoteOpts } from "./useSupplyQuote";
|
|
22
|
+
export { useSpiceInventory } from "./useSpiceInventory";
|
|
23
|
+
export { useSpiceLock, type UseSpiceLockParams } from "./useSpiceLock";
|
|
24
|
+
export { useSpiceSupply, type UseSpiceSupplyParams, type UseSpiceSupplyResult, } from "./useSpiceSupply";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
export declare function useDestinationToken(params: {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
chainId: number;
|
|
5
|
+
address?: Address;
|
|
6
|
+
decimals?: number;
|
|
7
|
+
symbol: string;
|
|
8
|
+
logoURI?: string;
|
|
9
|
+
}): {
|
|
10
|
+
token: {
|
|
11
|
+
address: `0x${string}`;
|
|
12
|
+
chainId: number;
|
|
13
|
+
decimals: number;
|
|
14
|
+
symbol: string;
|
|
15
|
+
logoURI: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
error: string | null;
|
|
18
|
+
ready: boolean;
|
|
19
|
+
refresh: () => void;
|
|
20
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type InventoryRead, type InventoryStore } from "../utils/inventoryStore";
|
|
2
|
+
export declare function useInventoryStore(): {
|
|
3
|
+
entry(key: string): {
|
|
4
|
+
snapshot: () => import("../utils/inventoryStore").InventorySnapshot;
|
|
5
|
+
refresh: () => Promise<void>;
|
|
6
|
+
invalidate: () => Promise<void>;
|
|
7
|
+
subscribe(notify: () => void, fetch: () => Promise<InventoryRead>, interval: number): () => void;
|
|
8
|
+
};
|
|
9
|
+
fetcherId(fetcher: Function): number;
|
|
10
|
+
registerTokens(additional: import("../utils/inventoryStore").InventoryToken[]): void;
|
|
11
|
+
tokens: () => import("../utils/inventoryStore").InventoryToken[];
|
|
12
|
+
invalidate: () => Promise<void>;
|
|
13
|
+
};
|
|
14
|
+
export declare function useInventoryResource(key: string, read: () => Promise<InventoryRead>, enabled: boolean, interval: number, providedStore?: InventoryStore): {
|
|
15
|
+
refresh: () => Promise<void>;
|
|
16
|
+
assets: import("..").Asset[];
|
|
17
|
+
loading: boolean;
|
|
18
|
+
refreshing: boolean;
|
|
19
|
+
error: string | null;
|
|
20
|
+
updatedAt: number | null;
|
|
21
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SelectedAsset } from "../types/assets";
|
|
2
|
+
import { type PendingDepositRecord } from "../utils/pendingDeposit";
|
|
3
|
+
export declare function usePendingAction(embedded: string | null | undefined, purpose: string): {
|
|
4
|
+
record: PendingDepositRecord | undefined;
|
|
5
|
+
selection: SelectedAsset | undefined;
|
|
6
|
+
error: string | undefined;
|
|
7
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { Asset, SelectedAsset } from "../types/assets";
|
|
3
|
+
import type { DestinationTokenConfig, SpiceSupplyProps } from "../types/supply";
|
|
4
|
+
export type SpiceActionSource = Asset;
|
|
5
|
+
export interface UseSpiceActionOptions {
|
|
6
|
+
destinationToken: DestinationTokenConfig;
|
|
7
|
+
recipient?: Address;
|
|
8
|
+
buildActionCalls: SpiceSupplyProps["buildActionCalls"];
|
|
9
|
+
buildSpicenetBatch?: SpiceSupplyProps["buildSpicenetBatch"];
|
|
10
|
+
amount: string;
|
|
11
|
+
sourceChains?: number[];
|
|
12
|
+
supportedSourceAssets?: string[];
|
|
13
|
+
feeExecutionMode?: SpiceSupplyProps["feeExecutionMode"];
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
onSuccess?: SpiceSupplyProps["onSuccess"];
|
|
16
|
+
onError?: SpiceSupplyProps["onError"];
|
|
17
|
+
}
|
|
18
|
+
export declare function useSpiceAction({ amount, enabled, ...options }: UseSpiceActionOptions): {
|
|
19
|
+
sources: Asset[];
|
|
20
|
+
selectedAsset: SelectedAsset | null;
|
|
21
|
+
setSelectedAsset: import("react").Dispatch<import("react").SetStateAction<SelectedAsset | null>>;
|
|
22
|
+
selectAsset: (asset: Asset) => void;
|
|
23
|
+
quote: {
|
|
24
|
+
isQuoting: boolean;
|
|
25
|
+
error: string | null;
|
|
26
|
+
estimatedInput: string | null;
|
|
27
|
+
estimatedOutput: string | null;
|
|
28
|
+
estimatedMinOutput: string | null;
|
|
29
|
+
isDirect: boolean;
|
|
30
|
+
needsSwap: boolean;
|
|
31
|
+
};
|
|
32
|
+
feePreview: import("../types").FeePreview | null;
|
|
33
|
+
isFeePreviewLoading: boolean;
|
|
34
|
+
feePreviewError: string | null;
|
|
35
|
+
canSubmit: boolean;
|
|
36
|
+
execute: () => Promise<void>;
|
|
37
|
+
isExecuting: boolean;
|
|
38
|
+
step: import("..").SupplyStep;
|
|
39
|
+
statusMsg: string;
|
|
40
|
+
txHash: string | null;
|
|
41
|
+
refreshAssets: () => Promise<void>;
|
|
42
|
+
resolveMaxAmount: (asset: Asset) => Promise<string | null>;
|
|
43
|
+
retryFinalization: () => void;
|
|
44
|
+
};
|
|
45
|
+
export type UseSpiceActionResult = ReturnType<typeof useSpiceAction>;
|
|
46
|
+
export type SpiceActionQuote = UseSpiceActionResult["quote"];
|
|
@@ -10,6 +10,8 @@ export interface UseSpiceAssetsConfig {
|
|
|
10
10
|
export interface UseSpiceAssetsReturn {
|
|
11
11
|
assets: Asset[];
|
|
12
12
|
loading: boolean;
|
|
13
|
+
refreshing?: boolean;
|
|
14
|
+
updatedAt?: number | null;
|
|
13
15
|
error: string | null;
|
|
14
16
|
hasBalance: boolean;
|
|
15
17
|
refetch: () => Promise<void>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Address } from "viem";
|
|
2
|
-
import { ChainBatch, Call } from "../types/authorization";
|
|
3
1
|
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
2
|
+
import { Address } from "viem";
|
|
3
|
+
import { Call, ChainBatch } from "../types/authorization";
|
|
4
4
|
import { type ActionOutputCredit } from "../utils/actionOutputEscrowFunding";
|
|
5
5
|
export type { Call, ChainBatch };
|
|
6
6
|
export type ExecutionStep = "idle" | "building" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "confirming-rollup" | "success" | "error";
|
|
@@ -16,6 +16,12 @@ export interface ExecutionProgress {
|
|
|
16
16
|
}
|
|
17
17
|
export type OnProgress = (progress: ExecutionProgress) => void;
|
|
18
18
|
export interface ExecutionOptions {
|
|
19
|
+
requireDestinationReceipt?: boolean;
|
|
20
|
+
prepareForSigning?: (chainBatches: ChainBatch[]) => Promise<ChainBatch[]>;
|
|
21
|
+
resolveActionOutputCredits?: () => Promise<ActionOutputCredit[]>;
|
|
22
|
+
validateBeforeSubmit?: (batches: ChainBatch[]) => void | Promise<void>;
|
|
23
|
+
beforeActionSubmit?: () => void | Promise<void>;
|
|
24
|
+
onActionCreated?: (intentId: string, stepCount: number, recovery: NonNullable<import("../utils/pendingDeposit").PendingDepositRecord["actionFunding"]>["recovery"]) => void;
|
|
19
25
|
depositToEscrow?: {
|
|
20
26
|
token: Address;
|
|
21
27
|
amount: bigint;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { Asset } from "../types/assets";
|
|
3
|
+
import type { DestinationTokenConfig } from "../types/supply";
|
|
4
|
+
import { type AssetRole } from "../utils/assetPolicy";
|
|
5
|
+
import type { InventoryToken } from "../utils/inventoryStore";
|
|
6
|
+
export declare function useSpiceInventory(options: {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
owner?: Address;
|
|
9
|
+
role?: AssetRole;
|
|
10
|
+
destination?: DestinationTokenConfig;
|
|
11
|
+
sourceChains?: number[];
|
|
12
|
+
supportedSourceAssets?: string[];
|
|
13
|
+
additionalSourceTokens?: InventoryToken[];
|
|
14
|
+
includeWalletAssets?: boolean;
|
|
15
|
+
includeRollupAssets?: boolean;
|
|
16
|
+
requiresEscrow?: boolean;
|
|
17
|
+
}): {
|
|
18
|
+
positions: {
|
|
19
|
+
eligible: boolean;
|
|
20
|
+
reason: string | null;
|
|
21
|
+
policyExcluded?: boolean;
|
|
22
|
+
asset: Asset;
|
|
23
|
+
}[];
|
|
24
|
+
assets: Asset[];
|
|
25
|
+
walletAssets: Asset[];
|
|
26
|
+
rollupAssets: Asset[];
|
|
27
|
+
loading: boolean;
|
|
28
|
+
refreshing: boolean | undefined;
|
|
29
|
+
error: string | null;
|
|
30
|
+
refresh: () => Promise<void>;
|
|
31
|
+
};
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import type { Asset, SelectedAsset } from "../types/assets";
|
|
2
|
+
import type { SpiceLockModalProps } from "../types/lock";
|
|
3
|
+
export interface UseSpiceLockParams extends Pick<SpiceLockModalProps, "lockBatches" | "lockChainId" | "lockTokenSymbol" | "lockTokenLogoURI" | "destinationTokenAddress" | "destinationTokenDecimals" | "beneficiary" | "onLockSuccess" | "onLockError" | "buildSpicenetBatch"> {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
selectedAsset: SelectedAsset | null;
|
|
6
|
+
recoveryKey?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function useSpiceLock(params: UseSpiceLockParams): {
|
|
9
|
+
quote: {
|
|
10
|
+
refreshQuote: () => void;
|
|
11
|
+
resolvedSwap: import("@spicenet-io/spiceflow-core").ResolvedSwap | null;
|
|
12
|
+
inputAmount?: bigint | null;
|
|
13
|
+
estimatedOutput: string | null;
|
|
14
|
+
hasSourceConversion: boolean;
|
|
15
|
+
executionInput: {
|
|
16
|
+
address: `0x${string}`;
|
|
17
|
+
chainId: number;
|
|
18
|
+
decimals: number;
|
|
19
|
+
amount: bigint;
|
|
20
|
+
} | null;
|
|
21
|
+
inputDecimals?: number | null;
|
|
22
|
+
quoteKey: string | null;
|
|
23
|
+
quoteExpiresAt: number | null;
|
|
24
|
+
isQuoting: boolean;
|
|
25
|
+
quoteError: string | null;
|
|
26
|
+
estimatedInput: string | null;
|
|
27
|
+
exactOutputSwap: import("..").ResolvedExactOutputSwap | null;
|
|
28
|
+
quoteAmountOut: bigint | null;
|
|
29
|
+
resolvedTokenIn: import("viem").Address | null;
|
|
30
|
+
isDirect: boolean;
|
|
31
|
+
needsSwap: boolean;
|
|
32
|
+
selectedIsEquivalent: boolean;
|
|
33
|
+
sourceSwap: import("@spicenet-io/spiceflow-core").ResolvedSwap | null;
|
|
34
|
+
sourceExactOutputSwap: import("..").ResolvedExactOutputSwap | null;
|
|
35
|
+
pivot: import("../types/supply").PivotRoute | null;
|
|
36
|
+
};
|
|
37
|
+
destination: {
|
|
38
|
+
address: `0x${string}`;
|
|
39
|
+
chainId: number;
|
|
40
|
+
decimals: number;
|
|
41
|
+
symbol: string;
|
|
42
|
+
logoURI: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
metadataError: string | null;
|
|
45
|
+
canExecute: boolean;
|
|
46
|
+
selectedAsset: SelectedAsset | null;
|
|
47
|
+
capability: {
|
|
48
|
+
eligible: boolean;
|
|
49
|
+
reason: string | null;
|
|
50
|
+
policyExcluded?: boolean;
|
|
51
|
+
} | null;
|
|
52
|
+
assets: {
|
|
53
|
+
selectable: Asset[];
|
|
54
|
+
displayAssets: Asset[];
|
|
55
|
+
filteredSpiceAssets: Asset[];
|
|
56
|
+
embeddedWalletAddress: `0x${string}` | undefined;
|
|
57
|
+
externalAddress: `0x${string}` | undefined;
|
|
58
|
+
isNon7702: boolean;
|
|
59
|
+
refreshSpiceAssets: () => Promise<void>;
|
|
60
|
+
refreshWalletAssets: () => Promise<void>;
|
|
61
|
+
loading: boolean;
|
|
62
|
+
refreshing: boolean | undefined;
|
|
63
|
+
error: string | null;
|
|
64
|
+
};
|
|
65
|
+
fees: {
|
|
66
|
+
fundingConversion: import("../components/SpiceSupply/lib/feeConversion").FundingConversion | undefined;
|
|
67
|
+
proceedsUsed: bigint | undefined;
|
|
68
|
+
fundingShortfall: bigint | undefined;
|
|
69
|
+
source: {
|
|
70
|
+
address: `0x${string}`;
|
|
71
|
+
chainId: number;
|
|
72
|
+
symbol: string;
|
|
73
|
+
decimals: number;
|
|
74
|
+
gasFee: bigint;
|
|
75
|
+
spicenetFee: bigint;
|
|
76
|
+
} | null;
|
|
77
|
+
destinationAmount: bigint | undefined;
|
|
78
|
+
sourceSpendCap: bigint | undefined;
|
|
79
|
+
preview: import("../types").FeePreview | null;
|
|
80
|
+
isLoading: boolean;
|
|
81
|
+
ready: boolean;
|
|
82
|
+
error: string | null;
|
|
83
|
+
};
|
|
84
|
+
amount: {
|
|
85
|
+
sourceRequiredAmount: bigint | null;
|
|
86
|
+
parsed: number;
|
|
87
|
+
isInsufficientBalance: boolean;
|
|
88
|
+
sourceBalance: number;
|
|
89
|
+
feesExceedAmount: boolean;
|
|
90
|
+
};
|
|
91
|
+
status: {
|
|
92
|
+
sourceFunding: {
|
|
93
|
+
matchesPurpose: boolean;
|
|
94
|
+
matchesSelection: boolean;
|
|
95
|
+
phase: "complete" | "routing" | "funding";
|
|
96
|
+
amount: string;
|
|
97
|
+
} | null;
|
|
98
|
+
finalizing: boolean;
|
|
99
|
+
finalizationError: string | null;
|
|
100
|
+
externalAction: {
|
|
101
|
+
destinationToken: import("viem").Address;
|
|
102
|
+
destinationDecimals: number;
|
|
103
|
+
amount?: string;
|
|
104
|
+
phase: "funding" | "routing" | "action" | "complete";
|
|
105
|
+
confirmedCalls: number;
|
|
106
|
+
totalCalls: number;
|
|
107
|
+
requiresRecovery: boolean;
|
|
108
|
+
} | null;
|
|
109
|
+
step: import("..").SupplyStep;
|
|
110
|
+
statusMsg: string;
|
|
111
|
+
txHash: string | null;
|
|
112
|
+
isExecuting: boolean;
|
|
113
|
+
error: string | null;
|
|
114
|
+
showStatusPanel: boolean;
|
|
115
|
+
paymentResult: import("..").PaymentResult | null;
|
|
116
|
+
};
|
|
117
|
+
flags: {
|
|
118
|
+
directExecutionFeeNote: boolean;
|
|
119
|
+
};
|
|
120
|
+
retryFinalization: () => void;
|
|
121
|
+
fundEmbeddedSource: (amount: bigint) => Promise<void>;
|
|
122
|
+
submitSupply: () => Promise<void>;
|
|
123
|
+
submitPay: () => Promise<void>;
|
|
124
|
+
retrySupply: () => void;
|
|
125
|
+
dismissPaymentStatus: () => void;
|
|
126
|
+
resolveMaxAmount: (asset: Asset) => Promise<string | null>;
|
|
127
|
+
resetAfterSuccess: () => void;
|
|
128
|
+
resetPaymentState: () => void;
|
|
129
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Address } from "viem";
|
|
2
2
|
import type { Asset, SelectedAsset } from "../types/assets";
|
|
3
3
|
export declare function useSpiceLockQuote(params: {
|
|
4
4
|
enabled: boolean;
|
|
@@ -10,7 +10,38 @@ export declare function useSpiceLockQuote(params: {
|
|
|
10
10
|
recipient?: Address;
|
|
11
11
|
}): {
|
|
12
12
|
conversion: {
|
|
13
|
-
input:
|
|
13
|
+
input: {
|
|
14
|
+
address: `0x${string}`;
|
|
15
|
+
decimals: number;
|
|
16
|
+
isNative: boolean;
|
|
17
|
+
_fundingWallet?: "external" | "embedded";
|
|
18
|
+
owner?: Address;
|
|
19
|
+
location?: "external" | "embedded" | "rollup";
|
|
20
|
+
positionId?: string;
|
|
21
|
+
_source?: "wallet" | "spice";
|
|
22
|
+
symbol: string;
|
|
23
|
+
name: string;
|
|
24
|
+
chainId: number;
|
|
25
|
+
balance: bigint;
|
|
26
|
+
balanceError?: string;
|
|
27
|
+
balanceStatus?: "stale";
|
|
28
|
+
_wrapFromNative?: boolean;
|
|
29
|
+
balanceFormatted: number;
|
|
30
|
+
balanceUsd: number;
|
|
31
|
+
priceStatus?: "fresh" | "stale" | "unavailable";
|
|
32
|
+
logoURI?: string;
|
|
33
|
+
displaySymbol?: string;
|
|
34
|
+
displayName?: string;
|
|
35
|
+
displayChainName?: string;
|
|
36
|
+
receiptTokenId?: string;
|
|
37
|
+
receiptTokenName?: string;
|
|
38
|
+
receiptTokenDecimals?: number;
|
|
39
|
+
chainTokens?: Record<string, {
|
|
40
|
+
name?: string;
|
|
41
|
+
decimals?: number;
|
|
42
|
+
}>;
|
|
43
|
+
isUniversal?: boolean;
|
|
44
|
+
};
|
|
14
45
|
amountIn: bigint;
|
|
15
46
|
output: Asset;
|
|
16
47
|
minimum: bigint;
|
|
@@ -18,7 +49,7 @@ export declare function useSpiceLockQuote(params: {
|
|
|
18
49
|
key: string;
|
|
19
50
|
expiresAt: number | null;
|
|
20
51
|
} | null;
|
|
21
|
-
error: string | null;
|
|
22
52
|
retryQuote: () => void;
|
|
53
|
+
error: string | null;
|
|
23
54
|
isQuoting: boolean;
|
|
24
55
|
};
|
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
import type { Asset } from "../types/assets";
|
|
2
|
+
type PriceConfig = {
|
|
3
|
+
supportedChains?: number[];
|
|
4
|
+
nativeChainId?: number;
|
|
5
|
+
rpcOverrides?: Record<number, string>;
|
|
6
|
+
};
|
|
7
|
+
export declare function priceRollupAssets(assets: Asset[], config: PriceConfig): Promise<Asset[]>;
|
|
2
8
|
export declare function useSpiceRollupPrices(assets: Asset[], enabled: boolean, supportedChains?: number[]): Asset[];
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import { type PaymentResult, type SupplyStep } from "../components/SpiceSupply/lib/executors";
|
|
3
|
+
import type { Asset, SelectedAsset } from "../types/assets";
|
|
4
|
+
import type { SpiceSupplyProps } from "../types/supply";
|
|
5
|
+
import type { FeePreview } from "../types/ui";
|
|
6
|
+
export interface UseSpiceSupplyParams extends Pick<SpiceSupplyProps, "destinationToken" | "sourceChains" | "supportedSourceAssets" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "resolveExactOutputSwap" | "amountDirection" | "onSuccess" | "onError" | "additionalSourceTokens" | "includeExternalWalletAssets" | "includeCrossChainEmbeddedAssets" | "sourceFundingRecovery" | "feeOnlyAction" | "actionProceeds" | "maxSlippage" | "resolveInputSwap"> {
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
selectedAsset: SelectedAsset | null;
|
|
9
|
+
paymentAmount?: string;
|
|
10
|
+
recipient?: Address;
|
|
11
|
+
isZeroAmountPay?: boolean;
|
|
12
|
+
sourceFundingRecoveryKey?: string;
|
|
13
|
+
actionExecution?: {
|
|
14
|
+
wallet: "external";
|
|
15
|
+
recoveryKey: string;
|
|
16
|
+
};
|
|
17
|
+
prependSourceEscrow?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare function useSpiceSupply(params: UseSpiceSupplyParams): {
|
|
20
|
+
selectedAsset: SelectedAsset | null;
|
|
21
|
+
capability: {
|
|
22
|
+
eligible: boolean;
|
|
23
|
+
reason: string | null;
|
|
24
|
+
policyExcluded?: boolean;
|
|
25
|
+
} | null;
|
|
26
|
+
assets: {
|
|
27
|
+
selectable: Asset[];
|
|
28
|
+
displayAssets: Asset[];
|
|
29
|
+
filteredSpiceAssets: Asset[];
|
|
30
|
+
embeddedWalletAddress: `0x${string}` | undefined;
|
|
31
|
+
externalAddress: `0x${string}` | undefined;
|
|
32
|
+
isNon7702: boolean;
|
|
33
|
+
refreshSpiceAssets: () => Promise<void>;
|
|
34
|
+
refreshWalletAssets: () => Promise<void>;
|
|
35
|
+
loading: boolean;
|
|
36
|
+
refreshing: boolean | undefined;
|
|
37
|
+
error: string | null;
|
|
38
|
+
};
|
|
39
|
+
quote: {
|
|
40
|
+
resolvedSwap: import("@spicenet-io/spiceflow-core").ResolvedSwap | null;
|
|
41
|
+
inputAmount?: bigint | null;
|
|
42
|
+
estimatedOutput: string | null;
|
|
43
|
+
hasSourceConversion: boolean;
|
|
44
|
+
executionInput: {
|
|
45
|
+
address: `0x${string}`;
|
|
46
|
+
chainId: number;
|
|
47
|
+
decimals: number;
|
|
48
|
+
amount: bigint;
|
|
49
|
+
} | null;
|
|
50
|
+
inputDecimals?: number | null;
|
|
51
|
+
quoteKey: string | null;
|
|
52
|
+
quoteExpiresAt: number | null;
|
|
53
|
+
refreshQuote: () => void;
|
|
54
|
+
isQuoting: boolean;
|
|
55
|
+
quoteError: string | null;
|
|
56
|
+
estimatedInput: string | null;
|
|
57
|
+
exactOutputSwap: import("..").ResolvedExactOutputSwap | null;
|
|
58
|
+
quoteAmountOut: bigint | null;
|
|
59
|
+
resolvedTokenIn: Address | null;
|
|
60
|
+
isDirect: boolean;
|
|
61
|
+
needsSwap: boolean;
|
|
62
|
+
selectedIsEquivalent: boolean;
|
|
63
|
+
sourceSwap: import("@spicenet-io/spiceflow-core").ResolvedSwap | null;
|
|
64
|
+
sourceExactOutputSwap: import("..").ResolvedExactOutputSwap | null;
|
|
65
|
+
pivot: import("../types/supply").PivotRoute | null;
|
|
66
|
+
};
|
|
67
|
+
fees: {
|
|
68
|
+
fundingConversion: import("../components/SpiceSupply/lib/feeConversion").FundingConversion | undefined;
|
|
69
|
+
proceedsUsed: bigint | undefined;
|
|
70
|
+
fundingShortfall: bigint | undefined;
|
|
71
|
+
source: {
|
|
72
|
+
address: `0x${string}`;
|
|
73
|
+
chainId: number;
|
|
74
|
+
symbol: string;
|
|
75
|
+
decimals: number;
|
|
76
|
+
gasFee: bigint;
|
|
77
|
+
spicenetFee: bigint;
|
|
78
|
+
} | null;
|
|
79
|
+
destinationAmount: bigint | undefined;
|
|
80
|
+
sourceSpendCap: bigint | undefined;
|
|
81
|
+
preview: FeePreview | null;
|
|
82
|
+
isLoading: boolean;
|
|
83
|
+
ready: boolean;
|
|
84
|
+
error: string | null;
|
|
85
|
+
};
|
|
86
|
+
amount: {
|
|
87
|
+
sourceRequiredAmount: bigint | null;
|
|
88
|
+
parsed: number;
|
|
89
|
+
isInsufficientBalance: boolean;
|
|
90
|
+
sourceBalance: number;
|
|
91
|
+
feesExceedAmount: boolean;
|
|
92
|
+
};
|
|
93
|
+
status: {
|
|
94
|
+
sourceFunding: {
|
|
95
|
+
matchesPurpose: boolean;
|
|
96
|
+
matchesSelection: boolean;
|
|
97
|
+
phase: "complete" | "routing" | "funding";
|
|
98
|
+
amount: string;
|
|
99
|
+
} | null;
|
|
100
|
+
finalizing: boolean;
|
|
101
|
+
finalizationError: string | null;
|
|
102
|
+
externalAction: {
|
|
103
|
+
destinationToken: Address;
|
|
104
|
+
destinationDecimals: number;
|
|
105
|
+
amount?: string;
|
|
106
|
+
phase: "funding" | "routing" | "action" | "complete";
|
|
107
|
+
confirmedCalls: number;
|
|
108
|
+
totalCalls: number;
|
|
109
|
+
requiresRecovery: boolean;
|
|
110
|
+
} | null;
|
|
111
|
+
step: SupplyStep;
|
|
112
|
+
statusMsg: string;
|
|
113
|
+
txHash: string | null;
|
|
114
|
+
isExecuting: boolean;
|
|
115
|
+
error: string | null;
|
|
116
|
+
showStatusPanel: boolean;
|
|
117
|
+
paymentResult: PaymentResult | null;
|
|
118
|
+
};
|
|
119
|
+
flags: {
|
|
120
|
+
directExecutionFeeNote: boolean;
|
|
121
|
+
};
|
|
122
|
+
retryFinalization: () => void;
|
|
123
|
+
fundEmbeddedSource: (amount: bigint) => Promise<void>;
|
|
124
|
+
canExecute: boolean;
|
|
125
|
+
submitSupply: () => Promise<void>;
|
|
126
|
+
submitPay: () => Promise<void>;
|
|
127
|
+
retrySupply: () => void;
|
|
128
|
+
dismissPaymentStatus: () => void;
|
|
129
|
+
resolveMaxAmount: (asset: Asset) => Promise<string | null>;
|
|
130
|
+
resetAfterSuccess: () => void;
|
|
131
|
+
resetPaymentState: () => void;
|
|
132
|
+
};
|
|
133
|
+
export type UseSpiceSupplyResult = ReturnType<typeof useSpiceSupply>;
|
|
@@ -1,40 +1,42 @@
|
|
|
1
|
-
import { type Address } from "viem";
|
|
2
1
|
import type { Asset } from "../types/assets";
|
|
2
|
+
import type { DestinationTokenConfig } from "../types/supply";
|
|
3
|
+
import { isSupportedSource } from "../utils/assetPolicy";
|
|
4
|
+
import type { InventoryToken } from "../utils/inventoryStore";
|
|
3
5
|
export declare function compareSupplyAssets(a: Asset & {
|
|
4
6
|
_source?: string;
|
|
5
7
|
}, b: Asset & {
|
|
6
8
|
_source?: string;
|
|
7
9
|
}, destToken: string, destChain: number): number;
|
|
8
|
-
export declare
|
|
9
|
-
export declare function isSpendableSupplyAsset(asset: Pick<Asset, "address" | "
|
|
10
|
+
export declare const isSupportedSupplyAsset: typeof isSupportedSource;
|
|
11
|
+
export declare function isSpendableSupplyAsset(asset: Pick<Asset, "address" | "chainId" | "chainTokens"> & {
|
|
10
12
|
_source?: string;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
chainId: number;
|
|
20
|
-
logoURI?: string;
|
|
21
|
-
};
|
|
13
|
+
isNative?: boolean;
|
|
14
|
+
}, destinationChainId: number, supportedSourceAssets?: string[], _options?: {
|
|
15
|
+
allowPivot?: boolean;
|
|
16
|
+
}): boolean;
|
|
17
|
+
export declare const isSpendablePayAsset: typeof isSpendableSupplyAsset;
|
|
18
|
+
export declare function isSpendableExternalAsset(asset: Parameters<typeof isSpendableSupplyAsset>[0], destinationToken: Pick<DestinationTokenConfig, "address" | "chainId">, supportedSourceAssets?: string[], options?: {
|
|
19
|
+
allowPivot?: boolean;
|
|
20
|
+
}): boolean;
|
|
22
21
|
export declare function useSupplyAssets(opts: {
|
|
23
22
|
address: string | undefined;
|
|
24
|
-
destinationToken:
|
|
23
|
+
destinationToken: DestinationTokenConfig;
|
|
25
24
|
supportedSourceAssets?: string[];
|
|
26
25
|
sourceChains?: number[];
|
|
27
26
|
enabled: boolean;
|
|
27
|
+
includeExternalWalletAssets?: boolean;
|
|
28
|
+
includeCrossChainEmbeddedAssets?: boolean;
|
|
29
|
+
additionalSourceTokens?: InventoryToken[];
|
|
28
30
|
}): {
|
|
29
|
-
displayAssets:
|
|
30
|
-
_source: "wallet" | "spice";
|
|
31
|
-
})[];
|
|
31
|
+
displayAssets: Asset[];
|
|
32
32
|
filteredSpiceAssets: Asset[];
|
|
33
33
|
walletAssets: Asset[];
|
|
34
34
|
embeddedWalletAddress: `0x${string}` | undefined;
|
|
35
35
|
externalAddress: `0x${string}` | undefined;
|
|
36
36
|
isNon7702: boolean;
|
|
37
37
|
refreshSpiceAssets: () => Promise<void>;
|
|
38
|
-
refreshWalletAssets: () => void
|
|
38
|
+
refreshWalletAssets: () => Promise<void>;
|
|
39
|
+
loading: boolean;
|
|
40
|
+
refreshing: boolean | undefined;
|
|
41
|
+
error: string | null;
|
|
39
42
|
};
|
|
40
|
-
export {};
|