@spicenet-io/spiceflow-ui 4.9.5 → 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 +2 -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--KTaTEam.js +0 -2
- package/dist/privy-8_x0Dkgt.js +0 -2
package/dist/auth-privy.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const r=require("./privy-
|
|
2
|
+
"use strict";const r=require("./privy-B3kX5909.js");require("react/jsx-runtime"),require("react"),require("@spicenet-io/spiceflow-core"),require("@tanstack/react-query"),require("viem"),require("@privy-io/react-auth"),require("wagmi"),require("viem/actions"),exports.PrivyLogin=r.PrivyLogin;
|
package/dist/auth-privy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{P as g}from"./privy
|
|
2
|
+
import{P as g}from"./privy-BIQ0yO8R.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"@tanstack/react-query";import"viem";import"@privy-io/react-auth";import"wagmi";import"viem/actions";export{g as PrivyLogin};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { CustomSection } from "../types";
|
|
3
2
|
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
3
|
+
import { CustomSection } from "../types";
|
|
4
4
|
interface AccountCustomSectionProps {
|
|
5
5
|
section: CustomSection;
|
|
6
6
|
dk: ResolvedDarkPalette;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SpiceAsset } from "../types";
|
|
3
2
|
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
4
|
-
import type { DirectWithdrawState } from "
|
|
3
|
+
import type { DirectWithdrawState } from "../types";
|
|
4
|
+
import { SpiceAsset } from "../types";
|
|
5
5
|
interface AccountIdleBalancesProps {
|
|
6
6
|
spiceAssets: SpiceAsset[];
|
|
7
7
|
loading: boolean;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SpiceAsset, CustomSection, AccountNotice } from "../types";
|
|
3
2
|
import { VerifiedPendingDeposit } from "../../../hooks/usePendingDeposit";
|
|
4
3
|
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
5
|
-
import type { DirectWithdrawState } from "
|
|
4
|
+
import type { DirectWithdrawState } from "../types";
|
|
5
|
+
import { AccountNotice, CustomSection, SpiceAsset } from "../types";
|
|
6
6
|
interface AccountPanelProps {
|
|
7
7
|
appName: string;
|
|
8
8
|
status: "active" | "inactive";
|
|
@@ -1,19 +1,23 @@
|
|
|
1
|
-
import type { CustomStyles } from "../../types/theme";
|
|
2
|
-
import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
|
|
3
1
|
import type React from "react";
|
|
2
|
+
import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
|
|
3
|
+
import type { CustomStyles } from "../../types/theme";
|
|
4
4
|
export interface CustomSectionItem {
|
|
5
5
|
tokenSymbol: string;
|
|
6
6
|
tokenLogoURI?: string;
|
|
7
|
-
label:
|
|
7
|
+
label: React.ReactNode;
|
|
8
8
|
displayValue: string;
|
|
9
9
|
valueColor?: "green" | "red" | "default";
|
|
10
|
+
onClick?: () => void;
|
|
10
11
|
}
|
|
11
12
|
export interface CustomSection {
|
|
12
13
|
title: string;
|
|
13
14
|
items: CustomSectionItem[];
|
|
14
|
-
totalValue
|
|
15
|
+
totalValue?: number;
|
|
15
16
|
}
|
|
16
17
|
export interface SpiceAsset {
|
|
18
|
+
owner?: string;
|
|
19
|
+
location?: "external" | "embedded" | "rollup";
|
|
20
|
+
positionId?: string;
|
|
17
21
|
tokenAddress: string;
|
|
18
22
|
tokenSymbol: string;
|
|
19
23
|
tokenDisplaySymbol?: string;
|
|
@@ -56,4 +60,11 @@ export interface AccountDisplayProps {
|
|
|
56
60
|
showModeToggle?: boolean;
|
|
57
61
|
defaultMode?: "7702" | "non7702";
|
|
58
62
|
showUsdSummary?: boolean;
|
|
63
|
+
alwaysShowEmbeddedIdle?: boolean;
|
|
64
|
+
showDisconnect?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface DirectWithdrawState {
|
|
67
|
+
key: string;
|
|
68
|
+
step: "pending" | "error";
|
|
69
|
+
message?: string;
|
|
59
70
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
3
|
+
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
4
|
+
import type { SupplyFeeQuote } from "./feePreview";
|
|
5
|
+
export declare function appendProceedsFees(batches: ChainBatch[], owner: Address, token: Address, gas: bigint, platform: bigint): ChainBatch[];
|
|
6
|
+
export declare function simulateProceedsBatch(batches: ChainBatch[], owner: Address, token: Address, signal?: AbortSignal, platformFeeMaximum?: bigint): Promise<bigint>;
|
|
7
|
+
export declare function estimateProceedsFunding(args: {
|
|
8
|
+
proceeds: NonNullable<SpiceSupplyProps["actionProceeds"]>;
|
|
9
|
+
owner: Address;
|
|
10
|
+
token: Address;
|
|
11
|
+
signal?: AbortSignal;
|
|
12
|
+
baseline: () => Promise<SupplyFeeQuote | null>;
|
|
13
|
+
buildBatches: (amount: bigint, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
14
|
+
}): Promise<SupplyFeeQuote>;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import type { FeeEstimateSummary, ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
1
2
|
import { type Address } from "viem";
|
|
2
|
-
import type {
|
|
3
|
-
import type { ChainBatch } from "../../../types/authorization";
|
|
3
|
+
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
4
4
|
import type { SelectedAsset } from "../../../types/assets";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
6
|
+
import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
6
7
|
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
7
|
-
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
8
|
-
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
9
8
|
type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
10
|
-
export declare function
|
|
9
|
+
export declare function getPivotEscrowAmount(sourceSwap: Pick<ResolvedSwap, "amountOutMinimum">, gasSkim: bigint): bigint;
|
|
11
10
|
export declare function stripSpicenetFundingBatches(batches: ChainBatch[]): ChainBatch[];
|
|
12
11
|
export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
|
|
13
12
|
export interface BatchBuilderContext {
|
|
14
13
|
currentPaymentAmount: string;
|
|
14
|
+
isFeeInclusiveInput?: boolean;
|
|
15
|
+
feeOnlyAction?: boolean;
|
|
16
|
+
swapInputAmount?: bigint | null;
|
|
15
17
|
destinationToken: SpiceSupplyProps["destinationToken"];
|
|
16
18
|
embeddedWalletAddress: string | null | undefined;
|
|
17
19
|
providerEmbeddedAddress: string | null | undefined;
|
|
@@ -31,9 +33,20 @@ export interface BatchBuilderContext {
|
|
|
31
33
|
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
32
34
|
quoteAmountOut: bigint | null;
|
|
33
35
|
resolvedTokenIn: Address | null;
|
|
36
|
+
sourceSwap?: ResolvedSwap | null;
|
|
37
|
+
sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
|
|
38
|
+
resolveSourceExactOutputSwap?: (amountOut: bigint) => Promise<ResolvedExactOutputSwap>;
|
|
39
|
+
pivot?: PivotRoute | null;
|
|
34
40
|
requestTimestampMs?: number;
|
|
35
41
|
}
|
|
36
|
-
export declare function
|
|
37
|
-
|
|
42
|
+
export declare function isPivotPay(ctx: Pick<BatchBuilderContext, "isPayMode" | "selectedAsset" | "resolvedChainId" | "pivot">): ctx is typeof ctx & {
|
|
43
|
+
pivot: PivotRoute;
|
|
44
|
+
};
|
|
45
|
+
export declare function isPivotSupply(ctx: Pick<BatchBuilderContext, "isPayMode" | "selectedAsset" | "resolvedChainId" | "sourceSwap" | "pivot">): ctx is typeof ctx & {
|
|
46
|
+
sourceSwap: ResolvedSwap;
|
|
47
|
+
pivot: PivotRoute;
|
|
48
|
+
};
|
|
49
|
+
export declare const buildPayChainBatches: (ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
50
|
+
export declare const buildSupplyChainBatches: (ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
38
51
|
export declare function estimateRequiredGrossFunding(requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, estimate: EstimateFn, executionOptions?: Pick<ExecutionOptions, "useCustomTransfers" | "userOverride">): Promise<bigint>;
|
|
39
52
|
export {};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
1
2
|
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
2
3
|
import { type Address } from "viem";
|
|
4
|
+
import type { ExecutionRunner } from "../../../execution/runner";
|
|
5
|
+
import type { ExecutionProgress } from "../../../hooks/useSpiceExecution";
|
|
3
6
|
import type { SelectedAsset } from "../../../types/assets";
|
|
4
|
-
import type { BuildPayBatchesFn, BuildSupplyBatchesFn, SpiceSupplyProps } from "../../../types/supply";
|
|
5
|
-
import { type SupplyFeeQuote } from "./feePreview";
|
|
7
|
+
import type { BuildPayBatchesFn, BuildSupplyBatchesFn, PivotRoute, SpiceSupplyProps } from "../../../types/supply";
|
|
6
8
|
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
7
|
-
import type
|
|
8
|
-
import type { ExecutionRunner } from "../../../execution/runner";
|
|
9
|
+
import { type SupplyFeeQuote } from "./feePreview";
|
|
9
10
|
export type SupplyStep = "idle" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
|
|
10
11
|
export type PaymentResult = {
|
|
11
12
|
status: "processing" | "success" | "failed";
|
|
@@ -19,12 +20,20 @@ export type ExecutorContext = {
|
|
|
19
20
|
isInsufficientBalance: boolean;
|
|
20
21
|
isPayMode: boolean;
|
|
21
22
|
isFeeInclusiveInput?: boolean;
|
|
23
|
+
feeOnlyAction?: boolean;
|
|
24
|
+
actionProceeds?: SpiceSupplyProps["actionProceeds"];
|
|
25
|
+
validateFeeQuote?: () => void;
|
|
26
|
+
executionTokenDecimals?: number;
|
|
27
|
+
signal?: AbortSignal;
|
|
22
28
|
isNon7702: boolean;
|
|
23
29
|
isSourceDestToken: boolean;
|
|
24
30
|
needsSwap: boolean;
|
|
25
31
|
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
26
32
|
selectedIsEquivalent: boolean;
|
|
27
33
|
resolvedTokenIn: Address | null;
|
|
34
|
+
sourceSwap: ResolvedSwap | null;
|
|
35
|
+
sourceExactOutputSwap: ResolvedExactOutputSwap | null;
|
|
36
|
+
pivot: PivotRoute | null;
|
|
28
37
|
embeddedWalletAddress: string | null | undefined;
|
|
29
38
|
providerEmbeddedAddress: string | null | undefined;
|
|
30
39
|
recipient?: Address;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { FeePreviewContext, SupplyFeeQuote } from "./feePreview";
|
|
3
|
+
export declare function resolveFeeFundingToken(asset: NonNullable<FeePreviewContext["selectedAsset"]>["asset"], chainId: number, feeToken: Address): Address | null;
|
|
4
|
+
export interface FundingConversion {
|
|
5
|
+
tokenIn: Address;
|
|
6
|
+
tokenOut: Address;
|
|
7
|
+
amountInMax: bigint;
|
|
8
|
+
amountOut: bigint;
|
|
9
|
+
sourceAmountMax: bigint;
|
|
10
|
+
fromProceeds?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare class InsufficientFeeFundingBalanceError extends Error {
|
|
13
|
+
readonly requiredAmount: bigint;
|
|
14
|
+
readonly balance: bigint;
|
|
15
|
+
constructor(requiredAmount: bigint, balance: bigint);
|
|
16
|
+
}
|
|
17
|
+
export declare function quoteConvertedFees(ctx: FeePreviewContext): Promise<SupplyFeeQuote>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
3
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
4
|
+
import type { ExecutorContext } from "./executors";
|
|
5
|
+
export declare function stripFeeOnlyCalls(batches: ChainBatch[], chainId: number, token: Address): ChainBatch[];
|
|
6
|
+
export declare function feeOnlyExecutionOptions(ctx: ExecutorContext, token: Address, fundingCap: bigint): Pick<ExecutionOptions, "prepareForSigning" | "validateBeforeSubmit" | "resolveActionOutputCredits">;
|
|
@@ -1,23 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
2
2
|
import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
3
|
-
import type
|
|
4
|
-
import type {
|
|
3
|
+
import { type Address } from "viem";
|
|
4
|
+
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
5
5
|
import type { Asset, SelectedAsset } from "../../../types/assets";
|
|
6
|
-
import type {
|
|
6
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
7
|
+
import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
8
|
+
import type { FeePreview } from "../../../types/ui";
|
|
7
9
|
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
8
|
-
import type
|
|
9
|
-
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
10
|
+
import { type FundingConversion } from "./feeConversion";
|
|
10
11
|
type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
11
12
|
type BuildPayBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
12
13
|
type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
13
14
|
export type SupplyFeeQuote = {
|
|
15
|
+
actionDefinition?: Parameters<NonNullable<SupplyBatchBuildOptions["onActionCalls"]>>[0];
|
|
16
|
+
fundingConversion?: FundingConversion;
|
|
17
|
+
fundingBatches?: ChainBatch[];
|
|
18
|
+
proceedsAvailable?: bigint;
|
|
19
|
+
proceedsUsed?: bigint;
|
|
20
|
+
batches?: ChainBatch[];
|
|
21
|
+
actionContext?: Partial<import("../../../types/supply").BuildActionCallsContext>;
|
|
22
|
+
fundingAmount?: bigint;
|
|
23
|
+
destinationSwap?: ResolvedSwap;
|
|
24
|
+
swapInputAmount?: bigint;
|
|
25
|
+
destinationAmount?: bigint;
|
|
26
|
+
sourceSpendCap?: bigint;
|
|
27
|
+
expiresAt?: number;
|
|
14
28
|
preview: FeePreview;
|
|
15
29
|
feeEstimate: FeeEstimateSummary | null;
|
|
16
30
|
grossFundingAmount?: bigint;
|
|
31
|
+
sourceGasSkim?: bigint;
|
|
17
32
|
};
|
|
33
|
+
export declare function sizePivotSourceGasSkim(params: {
|
|
34
|
+
user: Address;
|
|
35
|
+
pivot: PivotRoute;
|
|
36
|
+
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}): Promise<bigint>;
|
|
18
39
|
export declare function solveGrossFunding(fees: Pick<FeePreview, "grossAmount" | "gasFee" | "spicenetFee" | "bridgeFee">, requiredNetFunding: bigint): bigint;
|
|
19
40
|
export declare function estimatePayFunding(args: {
|
|
20
41
|
requiredNetFunding: bigint;
|
|
42
|
+
feeOnlyAction?: boolean;
|
|
21
43
|
buildBatches: (gross: bigint) => ChainBatch[] | Promise<ChainBatch[]>;
|
|
22
44
|
fundingToken: Address;
|
|
23
45
|
estimate: EstimateFn;
|
|
@@ -33,12 +55,18 @@ export declare function estimatePayFunding(args: {
|
|
|
33
55
|
feeEstimate: FeeEstimateSummary;
|
|
34
56
|
grossFundingAmount: bigint;
|
|
35
57
|
}>;
|
|
58
|
+
export declare function estimateMaximumSupplyInput(params: {
|
|
59
|
+
balance: bigint;
|
|
60
|
+
decimals: number;
|
|
61
|
+
planForAmount: (rawAmount: bigint) => Promise<SupplyFeeQuote | null>;
|
|
62
|
+
}): Promise<string>;
|
|
36
63
|
export declare function estimateSupplyMaxAmount(ctx: {
|
|
37
64
|
asset: Asset;
|
|
38
65
|
isPayMode: boolean;
|
|
39
66
|
isNon7702: boolean;
|
|
40
67
|
needsSwap: boolean;
|
|
41
68
|
isQuoting: boolean;
|
|
69
|
+
pivot?: PivotRoute | null;
|
|
42
70
|
embeddedWalletAddress: string | null | undefined;
|
|
43
71
|
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
44
72
|
estimate: EstimateFn;
|
|
@@ -46,6 +74,11 @@ export declare function estimateSupplyMaxAmount(ctx: {
|
|
|
46
74
|
feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
|
|
47
75
|
}): Promise<string | null>;
|
|
48
76
|
export interface FeePreviewContext {
|
|
77
|
+
liquidityVenues?: import("../../../utils/crossChainRouter/venueConfig").LiquidityVenuesConfig;
|
|
78
|
+
maxSlippage?: number;
|
|
79
|
+
resolveExactOutputSwap?: SpiceSupplyProps["resolveExactOutputSwap"];
|
|
80
|
+
feeOnlyAction?: boolean;
|
|
81
|
+
actionProceeds?: SpiceSupplyProps["actionProceeds"];
|
|
49
82
|
signal?: AbortSignal;
|
|
50
83
|
selectedAsset: SelectedAsset | null;
|
|
51
84
|
isPayMode: boolean;
|
|
@@ -69,6 +102,9 @@ export interface FeePreviewContext {
|
|
|
69
102
|
authenticated: boolean;
|
|
70
103
|
isDirect: boolean;
|
|
71
104
|
resolvedSwap: ResolvedSwap | null;
|
|
105
|
+
sourceSwap?: ResolvedSwap | null;
|
|
106
|
+
sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
|
|
107
|
+
pivot?: PivotRoute | null;
|
|
72
108
|
isQuoting: boolean;
|
|
73
109
|
executionTokenAddress: Address;
|
|
74
110
|
buildPayChainBatches: BuildPayBatchesFn;
|
|
@@ -76,4 +112,5 @@ export interface FeePreviewContext {
|
|
|
76
112
|
estimate: EstimateFn;
|
|
77
113
|
}
|
|
78
114
|
export declare function estimateFeePreview(ctx: FeePreviewContext): Promise<SupplyFeeQuote | null>;
|
|
115
|
+
export declare function supplyContextForFees(fees: FeePreview, amount: bigint, inclusive: boolean, mode: SpiceSupplyProps["feeExecutionMode"]): Required<Pick<import("../../../types/supply").BuildActionCallsContext, "grossAmount" | "netAmount" | "combinedFeeAmount" | "feeExecutionMode" | "feeBreakdown">>;
|
|
79
116
|
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
4
|
+
export declare function wrapPayWithSpicenet(raw: ChainBatch[], fundingRecipient: Address, feeEstimate?: FeeEstimateSummary, opts?: {
|
|
5
|
+
payoutAlreadyGross?: boolean;
|
|
6
|
+
}): ChainBatch[];
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { Asset } from "../../../types/assets";
|
|
3
|
+
import type { SpiceWithdrawProps } from "../../../types/withdraw";
|
|
4
|
+
import { assetPositionId } from "../../../utils/assetPolicy";
|
|
5
|
+
export declare function useSpiceEmbeddedWithdraw(params: {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
asset: Asset | null;
|
|
8
|
+
amount: bigint;
|
|
9
|
+
recipient?: Address;
|
|
10
|
+
owner?: Address;
|
|
11
|
+
sourceChains?: number[];
|
|
12
|
+
onSuccess?: SpiceWithdrawProps["onWithdrawSuccess"];
|
|
13
|
+
onError?: SpiceWithdrawProps["onWithdrawError"];
|
|
14
|
+
}): {
|
|
15
|
+
supply: {
|
|
16
|
+
selectedAsset: import("../../..").SelectedAsset | null;
|
|
17
|
+
capability: {
|
|
18
|
+
eligible: boolean;
|
|
19
|
+
reason: string | null;
|
|
20
|
+
policyExcluded?: boolean;
|
|
21
|
+
} | null;
|
|
22
|
+
assets: {
|
|
23
|
+
selectable: Asset[];
|
|
24
|
+
displayAssets: Asset[];
|
|
25
|
+
filteredSpiceAssets: Asset[];
|
|
26
|
+
embeddedWalletAddress: `0x${string}` | undefined;
|
|
27
|
+
externalAddress: `0x${string}` | undefined;
|
|
28
|
+
isNon7702: boolean;
|
|
29
|
+
refreshSpiceAssets: () => Promise<void>;
|
|
30
|
+
refreshWalletAssets: () => Promise<void>;
|
|
31
|
+
loading: boolean;
|
|
32
|
+
refreshing: boolean | undefined;
|
|
33
|
+
error: string | null;
|
|
34
|
+
};
|
|
35
|
+
quote: {
|
|
36
|
+
resolvedSwap: import("@spicenet-io/spiceflow-core").ResolvedSwap | null;
|
|
37
|
+
inputAmount?: bigint | null;
|
|
38
|
+
estimatedOutput: string | null;
|
|
39
|
+
hasSourceConversion: boolean;
|
|
40
|
+
executionInput: {
|
|
41
|
+
address: `0x${string}`;
|
|
42
|
+
chainId: number;
|
|
43
|
+
decimals: number;
|
|
44
|
+
amount: bigint;
|
|
45
|
+
} | null;
|
|
46
|
+
inputDecimals?: number | null;
|
|
47
|
+
quoteKey: string | null;
|
|
48
|
+
quoteExpiresAt: number | null;
|
|
49
|
+
refreshQuote: () => void;
|
|
50
|
+
isQuoting: boolean;
|
|
51
|
+
quoteError: string | null;
|
|
52
|
+
estimatedInput: string | null;
|
|
53
|
+
exactOutputSwap: import("../../..").ResolvedExactOutputSwap | null;
|
|
54
|
+
quoteAmountOut: bigint | null;
|
|
55
|
+
resolvedTokenIn: Address | null;
|
|
56
|
+
isDirect: boolean;
|
|
57
|
+
needsSwap: boolean;
|
|
58
|
+
selectedIsEquivalent: boolean;
|
|
59
|
+
sourceSwap: import("@spicenet-io/spiceflow-core").ResolvedSwap | null;
|
|
60
|
+
sourceExactOutputSwap: import("../../..").ResolvedExactOutputSwap | null;
|
|
61
|
+
pivot: import("../../../types/supply").PivotRoute | null;
|
|
62
|
+
};
|
|
63
|
+
fees: {
|
|
64
|
+
fundingConversion: import("../../SpiceSupply/lib/feeConversion").FundingConversion | undefined;
|
|
65
|
+
proceedsUsed: bigint | undefined;
|
|
66
|
+
fundingShortfall: bigint | undefined;
|
|
67
|
+
source: {
|
|
68
|
+
address: `0x${string}`;
|
|
69
|
+
chainId: number;
|
|
70
|
+
symbol: string;
|
|
71
|
+
decimals: number;
|
|
72
|
+
gasFee: bigint;
|
|
73
|
+
spicenetFee: bigint;
|
|
74
|
+
} | null;
|
|
75
|
+
destinationAmount: bigint | undefined;
|
|
76
|
+
sourceSpendCap: bigint | undefined;
|
|
77
|
+
preview: import("../../../types").FeePreview | null;
|
|
78
|
+
isLoading: boolean;
|
|
79
|
+
ready: boolean;
|
|
80
|
+
error: string | null;
|
|
81
|
+
};
|
|
82
|
+
amount: {
|
|
83
|
+
sourceRequiredAmount: bigint | null;
|
|
84
|
+
parsed: number;
|
|
85
|
+
isInsufficientBalance: boolean;
|
|
86
|
+
sourceBalance: number;
|
|
87
|
+
feesExceedAmount: boolean;
|
|
88
|
+
};
|
|
89
|
+
status: {
|
|
90
|
+
sourceFunding: {
|
|
91
|
+
matchesPurpose: boolean;
|
|
92
|
+
matchesSelection: boolean;
|
|
93
|
+
phase: "complete" | "routing" | "funding";
|
|
94
|
+
amount: string;
|
|
95
|
+
} | null;
|
|
96
|
+
finalizing: boolean;
|
|
97
|
+
finalizationError: string | null;
|
|
98
|
+
externalAction: {
|
|
99
|
+
destinationToken: Address;
|
|
100
|
+
destinationDecimals: number;
|
|
101
|
+
amount?: string;
|
|
102
|
+
phase: "funding" | "routing" | "action" | "complete";
|
|
103
|
+
confirmedCalls: number;
|
|
104
|
+
totalCalls: number;
|
|
105
|
+
requiresRecovery: boolean;
|
|
106
|
+
} | null;
|
|
107
|
+
step: import("../../..").SupplyStep;
|
|
108
|
+
statusMsg: string;
|
|
109
|
+
txHash: string | null;
|
|
110
|
+
isExecuting: boolean;
|
|
111
|
+
error: string | null;
|
|
112
|
+
showStatusPanel: boolean;
|
|
113
|
+
paymentResult: import("../../..").PaymentResult | null;
|
|
114
|
+
};
|
|
115
|
+
flags: {
|
|
116
|
+
directExecutionFeeNote: boolean;
|
|
117
|
+
};
|
|
118
|
+
retryFinalization: () => void;
|
|
119
|
+
fundEmbeddedSource: (amount: bigint) => Promise<void>;
|
|
120
|
+
canExecute: boolean;
|
|
121
|
+
submitSupply: () => Promise<void>;
|
|
122
|
+
submitPay: () => Promise<void>;
|
|
123
|
+
retrySupply: () => void;
|
|
124
|
+
dismissPaymentStatus: () => void;
|
|
125
|
+
resolveMaxAmount: (asset: Asset) => Promise<string | null>;
|
|
126
|
+
resetAfterSuccess: () => void;
|
|
127
|
+
resetPaymentState: () => void;
|
|
128
|
+
};
|
|
129
|
+
candidates: {
|
|
130
|
+
balance: bigint;
|
|
131
|
+
balanceFormatted: number;
|
|
132
|
+
_fundingWallet?: "external" | "embedded";
|
|
133
|
+
owner?: Address;
|
|
134
|
+
location?: "external" | "embedded" | "rollup";
|
|
135
|
+
positionId?: string;
|
|
136
|
+
_source?: "wallet" | "spice";
|
|
137
|
+
address: Address;
|
|
138
|
+
symbol: string;
|
|
139
|
+
name: string;
|
|
140
|
+
decimals: number;
|
|
141
|
+
chainId: number;
|
|
142
|
+
balanceError?: string;
|
|
143
|
+
balanceStatus?: "stale";
|
|
144
|
+
_wrapFromNative?: boolean;
|
|
145
|
+
balanceUsd: number;
|
|
146
|
+
priceStatus?: "fresh" | "stale" | "unavailable";
|
|
147
|
+
isNative: boolean;
|
|
148
|
+
logoURI?: string;
|
|
149
|
+
displaySymbol?: string;
|
|
150
|
+
displayName?: string;
|
|
151
|
+
displayChainName?: string;
|
|
152
|
+
receiptTokenId?: string;
|
|
153
|
+
receiptTokenName?: string;
|
|
154
|
+
receiptTokenDecimals?: number;
|
|
155
|
+
chainTokens?: Record<string, {
|
|
156
|
+
name?: string;
|
|
157
|
+
decimals?: number;
|
|
158
|
+
}>;
|
|
159
|
+
isUniversal?: boolean;
|
|
160
|
+
}[];
|
|
161
|
+
source: Asset | null;
|
|
162
|
+
setSource: import("react").Dispatch<import("react").SetStateAction<Asset | null>>;
|
|
163
|
+
feeToken: import("@spicenet-io/spiceflow-core").Token | undefined;
|
|
164
|
+
sourceKey: typeof assetPositionId;
|
|
165
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
3
2
|
import type { DestinationToken } from "../../../types/withdraw";
|
|
3
|
+
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
4
4
|
interface WithdrawDestinationCardProps {
|
|
5
5
|
header: React.ReactNode;
|
|
6
6
|
amount: string;
|
|
@@ -11,7 +11,9 @@ interface WithdrawDestinationCardProps {
|
|
|
11
11
|
destChainName: string;
|
|
12
12
|
destChainLogo: string | null;
|
|
13
13
|
compatibleDestinationChains: number[];
|
|
14
|
-
networkSwitchRef:
|
|
14
|
+
networkSwitchRef: {
|
|
15
|
+
readonly current: HTMLButtonElement | null;
|
|
16
|
+
};
|
|
15
17
|
onOpenNetworkPopover: (anchor: HTMLButtonElement | null) => void;
|
|
16
18
|
showNetworkPopover: boolean;
|
|
17
19
|
setShowNetworkPopover: React.Dispatch<React.SetStateAction<boolean>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { CustomStyles, Theme } from "../../../types/theme";
|
|
2
3
|
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
3
|
-
import type { Theme, CustomStyles } from "../../../types/theme";
|
|
4
4
|
interface WithdrawDetailsPanelProps {
|
|
5
5
|
show: boolean;
|
|
6
6
|
onToggle: () => void;
|
|
@@ -13,7 +13,9 @@ interface WithdrawDetailsPanelProps {
|
|
|
13
13
|
destChainName: string;
|
|
14
14
|
destChainLogo: string | null;
|
|
15
15
|
compatibleDestinationChains: number[];
|
|
16
|
-
txDetailsChainSwitchRef:
|
|
16
|
+
txDetailsChainSwitchRef: {
|
|
17
|
+
readonly current: HTMLButtonElement | null;
|
|
18
|
+
};
|
|
17
19
|
onOpenNetworkPopover: (anchor: HTMLButtonElement | null) => void;
|
|
18
20
|
sourceChainLabel: string;
|
|
19
21
|
sourceDetailsLogo: string | null | undefined;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
3
2
|
import type { Asset } from "../../../types/assets";
|
|
3
|
+
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
4
4
|
interface WithdrawSourceCardProps {
|
|
5
5
|
header: React.ReactNode;
|
|
6
6
|
amount: string;
|
|
@@ -25,7 +25,9 @@ interface WithdrawSourceCardProps {
|
|
|
25
25
|
top: number;
|
|
26
26
|
left: number;
|
|
27
27
|
} | null>>;
|
|
28
|
-
tokenTriggerRef:
|
|
28
|
+
tokenTriggerRef: {
|
|
29
|
+
readonly current: HTMLDivElement | null;
|
|
30
|
+
};
|
|
29
31
|
primaryColor: string;
|
|
30
32
|
dark: boolean;
|
|
31
33
|
dk: ResolvedDarkPalette;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type {
|
|
3
|
-
export type {
|
|
2
|
+
import type { StatusPanelProps, StatusResultItem } from "../../../types/status";
|
|
3
|
+
export type { StatusPanelProps, StatusResultItem };
|
|
4
4
|
export declare const StatusPanel: React.FC<StatusPanelProps>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { ChainBatch } from "../types/authorization";
|
|
3
|
+
import { type RollupBalanceEntry } from "../utils/rollupBalances";
|
|
4
|
+
export interface EscrowDeposit {
|
|
5
|
+
chainId: number;
|
|
6
|
+
token: Address;
|
|
7
|
+
amount: bigint;
|
|
8
|
+
}
|
|
9
|
+
export declare function collectEscrowDeposits(chainBatches: ChainBatch[]): EscrowDeposit[];
|
|
10
|
+
export declare function waitForEscrowCredit(params: {
|
|
11
|
+
deposits: EscrowDeposit[];
|
|
12
|
+
baseline: RollupBalanceEntry[];
|
|
13
|
+
fetchEntries: () => Promise<RollupBalanceEntry[]>;
|
|
14
|
+
timeoutMs?: number;
|
|
15
|
+
intervalMs?: number;
|
|
16
|
+
signal?: AbortSignal;
|
|
17
|
+
wait?: (ms: number) => Promise<void>;
|
|
18
|
+
}): Promise<boolean>;
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
2
|
import type { Call } from "../types/authorization";
|
|
3
|
+
export interface TransactionObserver {
|
|
4
|
+
onSending?: (index: number) => void | Promise<void>;
|
|
5
|
+
onSubmitted?: (index: number, hash: `0x${string}`) => void;
|
|
6
|
+
onConfirmed?: (index: number, hash: `0x${string}`) => void;
|
|
7
|
+
onReverted?: (index: number, hash: `0x${string}`) => void;
|
|
8
|
+
onRejected?: (index: number) => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function isWalletRejection(error: unknown): boolean;
|
|
3
11
|
export declare function createExternalWalletClient(params: {
|
|
4
12
|
wallet?: {
|
|
5
13
|
getEthereumProvider: () => Promise<any>;
|
|
@@ -18,4 +26,5 @@ export declare function sendCallsWithExternalWallet(params: {
|
|
|
18
26
|
calls: Call[];
|
|
19
27
|
viemChain?: any;
|
|
20
28
|
errorMessage: string;
|
|
29
|
+
observer?: TransactionObserver;
|
|
21
30
|
}): Promise<`0x${string}` | undefined>;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
+
import type { Call } from "../types/authorization";
|
|
3
|
+
import { type TransactionObserver } from "./externalWalletClient";
|
|
4
|
+
export declare function tokenTransferCall(recipient: Address, tokenAddr: Address, isNative: boolean, amount: bigint): Call;
|
|
5
|
+
export declare function estimateSourceTransferGas(params: {
|
|
6
|
+
client: any;
|
|
7
|
+
account: Address;
|
|
8
|
+
recipient: Address;
|
|
9
|
+
token: Address;
|
|
10
|
+
isNative: boolean;
|
|
11
|
+
amount: bigint;
|
|
12
|
+
}): Promise<bigint>;
|
|
2
13
|
export declare function sendTokenTransferTx(extWc: any, params: {
|
|
3
14
|
recipient: Address;
|
|
4
15
|
tokenAddr: Address;
|
|
@@ -14,4 +25,5 @@ export declare function fundEmbeddedWallet(params: {
|
|
|
14
25
|
isNative: boolean;
|
|
15
26
|
amount: bigint;
|
|
16
27
|
viemChain?: unknown;
|
|
28
|
+
observer?: TransactionObserver;
|
|
17
29
|
}): Promise<void>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { Asset, SelectedAsset } from "../types/assets";
|
|
3
|
+
import { type PendingDepositRecord } from "../utils/pendingDeposit";
|
|
4
|
+
import type { ExecutionRunner } from "./runner";
|
|
5
|
+
export declare function reconcileFundedAction(record: PendingDepositRecord): Promise<string>;
|
|
6
|
+
export declare function executeFundedPlan(params: {
|
|
7
|
+
asset?: Asset;
|
|
8
|
+
embedded: Address;
|
|
9
|
+
external?: Address;
|
|
10
|
+
externalWallet?: {
|
|
11
|
+
getEthereumProvider: () => Promise<any>;
|
|
12
|
+
} | null;
|
|
13
|
+
fundExternal: boolean;
|
|
14
|
+
sourceSpendCap: bigint;
|
|
15
|
+
identity: string;
|
|
16
|
+
purpose?: string;
|
|
17
|
+
selection?: SelectedAsset | null;
|
|
18
|
+
minimumDestinationAmount?: bigint;
|
|
19
|
+
actionDefinition?: string;
|
|
20
|
+
fundOnly?: boolean;
|
|
21
|
+
assertCurrent: () => void | Promise<void>;
|
|
22
|
+
run: (options: Parameters<ExecutionRunner["execute"]>[5]) => Promise<string>;
|
|
23
|
+
onFunding?: () => void;
|
|
24
|
+
}): Promise<string>;
|