@spicenet-io/spiceflow-ui 4.9.5 → 4.9.6-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--KTaTEam.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-DPYmDGGy.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,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,19 @@ export interface BatchBuilderContext {
31
32
  exactOutputSwap: ResolvedExactOutputSwap | null;
32
33
  quoteAmountOut: bigint | null;
33
34
  resolvedTokenIn: Address | null;
35
+ sourceSwap?: ResolvedSwap | null;
36
+ sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
37
+ resolveSourceExactOutputSwap?: (amountOut: bigint) => Promise<ResolvedExactOutputSwap>;
38
+ pivot?: PivotRoute | null;
34
39
  requestTimestampMs?: number;
35
40
  }
41
+ export declare function isPivotPay(ctx: Pick<BatchBuilderContext, "isPayMode" | "selectedAsset" | "resolvedChainId" | "pivot">): ctx is typeof ctx & {
42
+ pivot: PivotRoute;
43
+ };
44
+ export declare function isPivotSupply(ctx: Pick<BatchBuilderContext, "isPayMode" | "selectedAsset" | "resolvedChainId" | "sourceSwap" | "pivot">): ctx is typeof ctx & {
45
+ sourceSwap: ResolvedSwap;
46
+ pivot: PivotRoute;
47
+ };
36
48
  export declare function buildPayChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
37
49
  export declare function buildSupplyChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
38
50
  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,9 @@ export type ExecutorContext = {
25
26
  exactOutputSwap: ResolvedExactOutputSwap | null;
26
27
  selectedIsEquivalent: boolean;
27
28
  resolvedTokenIn: Address | null;
29
+ sourceSwap: ResolvedSwap | null;
30
+ sourceExactOutputSwap: ResolvedExactOutputSwap | null;
31
+ pivot: PivotRoute | null;
28
32
  embeddedWalletAddress: string | null | undefined;
29
33
  providerEmbeddedAddress: string | null | undefined;
30
34
  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,9 @@ export interface FeePreviewContext {
69
77
  authenticated: boolean;
70
78
  isDirect: boolean;
71
79
  resolvedSwap: ResolvedSwap | null;
80
+ sourceSwap?: ResolvedSwap | null;
81
+ sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
82
+ pivot?: PivotRoute | null;
72
83
  isQuoting: boolean;
73
84
  executionTokenAddress: Address;
74
85
  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;
@@ -8,10 +8,20 @@ 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, "address" | "chainId"> & {
16
+ _source?: string;
17
+ isNative?: boolean;
18
+ }, destinationChainId: number): boolean;
12
19
  export declare function isSpendableExternalAsset(asset: Pick<Asset, "address" | "chainTokens" | "chainId"> & {
13
20
  _source?: string;
14
- }, destinationToken: Pick<DestinationToken, "address" | "chainId">, supportedSourceAssets?: string[]): boolean;
21
+ isNative?: boolean;
22
+ }, destinationToken: Pick<DestinationToken, "address" | "chainId">, supportedSourceAssets?: string[], options?: {
23
+ allowPivot?: boolean;
24
+ }): boolean;
15
25
  type DestinationToken = {
16
26
  address: Address;
17
27
  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,9 @@ export interface SupplyQuoteResult {
34
35
  isDirect: boolean;
35
36
  needsSwap: boolean;
36
37
  selectedIsEquivalent: boolean;
38
+ sourceSwap: ResolvedSwap | null;
39
+ sourceExactOutputSwap: ResolvedExactOutputSwap | null;
40
+ pivot: PivotRoute | null;
37
41
  }
38
42
  export declare function resolveInputSupplySwapQuote(params: {
39
43
  chainId: number;
@@ -44,4 +48,13 @@ export declare function resolveInputSupplySwapQuote(params: {
44
48
  maxSlippage?: number;
45
49
  liquidityVenues?: LiquidityVenuesConfig;
46
50
  }): Promise<ResolvedSwap>;
51
+ export declare function resolveExactOutputSupplySwapQuote(params: {
52
+ chainId: number;
53
+ recipient: Address;
54
+ tokenIn: Address;
55
+ tokenOut: Address;
56
+ amountOut: bigint;
57
+ maxSlippage?: number;
58
+ liquidityVenues?: LiquidityVenuesConfig;
59
+ }): Promise<ResolvedExactOutputSwap | null>;
47
60
  export declare function useSupplyQuote(opts: UseSupplyQuoteOpts): SupplyQuoteResult;