@spicenet-io/spiceflow-ui 4.9.3-extmode.5 → 4.9.3-xchain.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{P as g}from"./privy-DsMpmEiz.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@privy-io/react-auth";import"wagmi";import"@tanstack/react-query";export{g as PrivyLogin};
2
+ import{P as g}from"./privy-BKkDy7CR.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@privy-io/react-auth";import"wagmi";import"@tanstack/react-query";export{g as PrivyLogin};
@@ -0,0 +1,2 @@
1
+ import type { Asset } from "../../../types/assets";
2
+ export declare function isEscrowCreditable(asset: Pick<Asset, "address" | "chainId" | "isNative">): boolean;
@@ -2,11 +2,12 @@ import { type Address } from "viem";
2
2
  import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
3
3
  import type { ChainBatch } from "../../../types/authorization";
4
4
  import type { SelectedAsset } from "../../../types/assets";
5
- import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
5
+ import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
6
6
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
7
7
  import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
8
8
  import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
9
9
  type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
10
+ export declare function getPivotEscrowAmount(sourceSwap: Pick<ResolvedSwap, "amountOutMinimum">, gasSkim: bigint): bigint;
10
11
  export declare function isExternalInPlacePaySource(selectedAsset: SelectedAsset | null, isNon7702: boolean, resolvedChainId: number): boolean;
11
12
  export declare function stripSpicenetFundingBatches(batches: ChainBatch[]): ChainBatch[];
12
13
  export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
@@ -31,8 +32,14 @@ export interface BatchBuilderContext {
31
32
  exactOutputSwap: ResolvedExactOutputSwap | null;
32
33
  quoteAmountOut: bigint | null;
33
34
  resolvedTokenIn: Address | null;
35
+ sourceSwap?: ResolvedSwap | null;
36
+ pivot?: PivotRoute | null;
34
37
  requestTimestampMs?: number;
35
38
  }
39
+ export declare function isPivotSupply(ctx: Pick<BatchBuilderContext, "isPayMode" | "selectedAsset" | "resolvedChainId" | "sourceSwap" | "pivot">): ctx is typeof ctx & {
40
+ sourceSwap: ResolvedSwap;
41
+ pivot: PivotRoute;
42
+ };
36
43
  export declare function buildPayChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
37
44
  export declare function buildSupplyChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
38
45
  export declare function estimateRequiredGrossFunding(requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, estimate: EstimateFn, executionOptions?: Pick<ExecutionOptions, "useCustomTransfers" | "userOverride">): Promise<bigint>;
@@ -1,7 +1,8 @@
1
1
  import type { Dispatch, MutableRefObject, SetStateAction } from "react";
2
2
  import { type Address } from "viem";
3
3
  import type { SelectedAsset } from "../../../types/assets";
4
- import type { BuildPayBatchesFn, BuildSupplyBatchesFn, SpiceSupplyProps } from "../../../types/supply";
4
+ import type { BuildPayBatchesFn, BuildSupplyBatchesFn, PivotRoute, SpiceSupplyProps } from "../../../types/supply";
5
+ import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
5
6
  import { type SupplyFeeQuote } from "./feePreview";
6
7
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
7
8
  import type { ExecutionProgress } from "../../../hooks/useSpiceExecution";
@@ -25,6 +26,8 @@ export type ExecutorContext = {
25
26
  exactOutputSwap: ResolvedExactOutputSwap | null;
26
27
  selectedIsEquivalent: boolean;
27
28
  resolvedTokenIn: Address | null;
29
+ sourceSwap: ResolvedSwap | null;
30
+ pivot: PivotRoute | null;
28
31
  embeddedWalletAddress: string | null | undefined;
29
32
  providerEmbeddedAddress: string | null | undefined;
30
33
  recipient?: Address;
@@ -3,7 +3,7 @@ import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
3
3
  import type { FeePreview } from "../../../types/ui";
4
4
  import type { ChainBatch } from "../../../types/authorization";
5
5
  import type { Asset, SelectedAsset } from "../../../types/assets";
6
- import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
6
+ import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
7
7
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
8
8
  import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
9
9
  import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
@@ -14,7 +14,14 @@ export type SupplyFeeQuote = {
14
14
  preview: FeePreview;
15
15
  feeEstimate: FeeEstimateSummary | null;
16
16
  grossFundingAmount?: bigint;
17
+ sourceGasSkim?: bigint;
17
18
  };
19
+ export declare function sizePivotSourceGasSkim(params: {
20
+ user: Address;
21
+ pivot: PivotRoute;
22
+ buildSupplyChainBatches: BuildSupplyBatchesFn;
23
+ signal?: AbortSignal;
24
+ }): Promise<bigint>;
18
25
  export declare function solveGrossFunding(fees: Pick<FeePreview, "grossAmount" | "gasFee" | "spicenetFee" | "bridgeFee">, requiredNetFunding: bigint): bigint;
19
26
  export declare function estimatePayFunding(args: {
20
27
  requiredNetFunding: bigint;
@@ -39,6 +46,7 @@ export declare function estimateSupplyMaxAmount(ctx: {
39
46
  isNon7702: boolean;
40
47
  needsSwap: boolean;
41
48
  isQuoting: boolean;
49
+ pivot?: PivotRoute | null;
42
50
  embeddedWalletAddress: string | null | undefined;
43
51
  buildSupplyChainBatches: BuildSupplyBatchesFn;
44
52
  estimate: EstimateFn;
@@ -69,6 +77,8 @@ export interface FeePreviewContext {
69
77
  authenticated: boolean;
70
78
  isDirect: boolean;
71
79
  resolvedSwap: ResolvedSwap | null;
80
+ sourceSwap?: ResolvedSwap | null;
81
+ pivot?: PivotRoute | null;
72
82
  isQuoting: boolean;
73
83
  executionTokenAddress: Address;
74
84
  buildPayChainBatches: BuildPayBatchesFn;
@@ -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>;
@@ -24,6 +24,7 @@ export declare function runAllIntentSteps(options: {
24
24
  totalSteps: number;
25
25
  delayBeforeSpicenetStepMs?: number;
26
26
  isSpicenetStep?: (stepIndex: number) => boolean;
27
+ beforeStep?: (stepIndex: number) => Promise<void>;
27
28
  maxExecuteAttemptsForStep?: (stepIndex: number) => number;
28
29
  maxPolls?: number;
29
30
  onStatusMessage?: (message: string, txHash?: string) => void;
@@ -43,8 +43,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
43
43
  isRefetching: boolean;
44
44
  isStale: boolean;
45
45
  isEnabled: boolean;
46
- refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
47
- fetchStatus: import("@tanstack/query-core").FetchStatus;
46
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
47
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
48
48
  promise: Promise<PartnerWhitelistCheckResponse>;
49
49
  isWhitelisted: boolean;
50
50
  whitelistCheck: PartnerWhitelistCheckResponse | undefined;
@@ -82,8 +82,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
82
82
  isRefetching: boolean;
83
83
  isStale: boolean;
84
84
  isEnabled: boolean;
85
- refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
86
- fetchStatus: import("@tanstack/query-core").FetchStatus;
85
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
86
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
87
87
  promise: Promise<PartnerWhitelistCheckResponse>;
88
88
  isWhitelisted: boolean;
89
89
  whitelistCheck: PartnerWhitelistCheckResponse | undefined;
@@ -121,8 +121,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
121
121
  isRefetching: boolean;
122
122
  isStale: boolean;
123
123
  isEnabled: boolean;
124
- refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
125
- fetchStatus: import("@tanstack/query-core").FetchStatus;
124
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
125
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
126
126
  promise: Promise<PartnerWhitelistCheckResponse>;
127
127
  isWhitelisted: boolean;
128
128
  whitelistCheck: PartnerWhitelistCheckResponse | undefined;
@@ -160,8 +160,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
160
160
  isRefetching: boolean;
161
161
  isStale: boolean;
162
162
  isEnabled: boolean;
163
- refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
164
- fetchStatus: import("@tanstack/query-core").FetchStatus;
163
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
164
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
165
165
  promise: Promise<PartnerWhitelistCheckResponse>;
166
166
  isWhitelisted: boolean;
167
167
  whitelistCheck: PartnerWhitelistCheckResponse | undefined;
@@ -199,8 +199,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
199
199
  isRefetching: boolean;
200
200
  isStale: boolean;
201
201
  isEnabled: boolean;
202
- refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
203
- fetchStatus: import("@tanstack/query-core").FetchStatus;
202
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
203
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
204
204
  promise: Promise<PartnerWhitelistCheckResponse>;
205
205
  isWhitelisted: boolean;
206
206
  whitelistCheck: PartnerWhitelistCheckResponse | undefined;
@@ -238,8 +238,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
238
238
  isRefetching: boolean;
239
239
  isStale: boolean;
240
240
  isEnabled: boolean;
241
- refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
242
- fetchStatus: import("@tanstack/query-core").FetchStatus;
241
+ refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
242
+ fetchStatus: import("@tanstack/react-query").FetchStatus;
243
243
  promise: Promise<PartnerWhitelistCheckResponse>;
244
244
  isWhitelisted: boolean;
245
245
  whitelistCheck: PartnerWhitelistCheckResponse | undefined;
@@ -8,10 +8,19 @@ export declare function compareSupplyAssets(a: Asset & {
8
8
  export declare function isSupportedSupplyAsset(asset: Pick<Asset, "address" | "chainTokens">, supportedSourceAssets?: string[]): boolean;
9
9
  export declare function isSpendableSupplyAsset(asset: Pick<Asset, "address" | "chainTokens" | "chainId"> & {
10
10
  _source?: string;
11
- }, destinationChainId: number, supportedSourceAssets?: string[]): boolean;
11
+ isNative?: boolean;
12
+ }, destinationChainId: number, supportedSourceAssets?: string[], options?: {
13
+ allowPivot?: boolean;
14
+ }): boolean;
15
+ export declare function isSpendablePayAsset(asset: Pick<Asset, "chainId"> & {
16
+ _source?: string;
17
+ }, destinationChainId: number): boolean;
12
18
  export declare function isSpendableExternalAsset(asset: Pick<Asset, "address" | "chainTokens" | "chainId"> & {
13
19
  _source?: string;
14
- }, destinationToken: Pick<DestinationToken, "address" | "chainId">, supportedSourceAssets?: string[]): boolean;
20
+ isNative?: boolean;
21
+ }, destinationToken: Pick<DestinationToken, "address" | "chainId">, supportedSourceAssets?: string[], options?: {
22
+ allowPivot?: boolean;
23
+ }): boolean;
15
24
  type DestinationToken = {
16
25
  address: Address;
17
26
  decimals: number;
@@ -3,6 +3,7 @@ import { type LiquidityVenuesConfig } from "../utils/crossChainRouter/venueConfi
3
3
  import type { ResolvedSwap } from "../utils/crossChainRouter/liquidityVenues";
4
4
  import { type ExactOutputSwapIntent, type ResolvedExactOutputSwap } from "../utils/swapQuotes";
5
5
  import type { SelectedAsset } from "../types/assets";
6
+ import type { PivotRoute } from "../types/supply";
6
7
  export interface UseSupplyQuoteOpts {
7
8
  direction: "input" | "output";
8
9
  selectedAsset: SelectedAsset | null;
@@ -34,6 +35,8 @@ export interface SupplyQuoteResult {
34
35
  isDirect: boolean;
35
36
  needsSwap: boolean;
36
37
  selectedIsEquivalent: boolean;
38
+ sourceSwap: ResolvedSwap | null;
39
+ pivot: PivotRoute | null;
37
40
  }
38
41
  export declare function resolveInputSupplySwapQuote(params: {
39
42
  chainId: number;