@spicenet-io/spiceflow-ui 4.10.0-dev.20260909.5 → 4.10.0-dev.20260914.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.
Files changed (86) hide show
  1. package/README.md +49 -0
  2. package/dist/auth-privy.cjs.js +1 -1
  3. package/dist/auth-privy.js +1 -1
  4. package/dist/components/AccountDisplay/parts/AccountCustomSection.d.ts +1 -1
  5. package/dist/components/AccountDisplay/parts/AccountHeader.d.ts +0 -1
  6. package/dist/components/AccountDisplay/parts/AccountIdleBalances.d.ts +3 -6
  7. package/dist/components/AccountDisplay/parts/AccountPanel.d.ts +3 -4
  8. package/dist/components/AccountDisplay/types.d.ts +17 -3
  9. package/dist/components/SpiceDeposit/lib/escrowCredit.d.ts +2 -0
  10. package/dist/components/SpiceLock/lib/helpers.d.ts +1 -0
  11. package/dist/components/SpiceSupply/lib/actionProceeds.d.ts +2 -2
  12. package/dist/components/SpiceSupply/lib/buildBatches.d.ts +22 -14
  13. package/dist/components/SpiceSupply/lib/executors.d.ts +10 -20
  14. package/dist/components/SpiceSupply/lib/externalAction.d.ts +6 -1
  15. package/dist/components/SpiceSupply/lib/feeConversion.d.ts +2 -1
  16. package/dist/components/SpiceSupply/lib/feeOnlyExecution.d.ts +1 -1
  17. package/dist/components/SpiceSupply/lib/feePreview.d.ts +40 -16
  18. package/dist/components/SpiceSupply/lib/payFundingBatches.d.ts +2 -1
  19. package/dist/components/SpiceSupply/parts/FundingQuoteReview.d.ts +6 -0
  20. package/dist/components/SpiceWithdraw/lib/helpers.d.ts +1 -2
  21. package/dist/components/SpiceWithdraw/lib/useEmbeddedWithdraw.d.ts +124 -5
  22. package/dist/components/SpiceWithdraw/parts/PendingWalletWithdrawal.d.ts +10 -0
  23. package/dist/components/SpiceWithdraw/parts/WithdrawBalanceCardHeader.d.ts +2 -3
  24. package/dist/components/SpiceWithdraw/parts/WithdrawDestinationCard.d.ts +4 -2
  25. package/dist/components/SpiceWithdraw/parts/WithdrawDetailsPanel.d.ts +4 -2
  26. package/dist/components/SpiceWithdraw/parts/WithdrawSourceCard.d.ts +4 -2
  27. package/dist/components/StatusDisplay/parts/StatusPanel.d.ts +2 -2
  28. package/dist/execution/escrowCredit.d.ts +18 -0
  29. package/dist/execution/fundEmbeddedWallet.d.ts +9 -1
  30. package/dist/execution/fundedExecution.d.ts +35 -0
  31. package/dist/execution/pollIntentStep.d.ts +2 -0
  32. package/dist/execution/transactionReceipt.d.ts +1 -0
  33. package/dist/hooks/index.d.ts +9 -8
  34. package/dist/hooks/useDestinationToken.d.ts +20 -0
  35. package/dist/hooks/useInventoryResource.d.ts +21 -0
  36. package/dist/hooks/useIsUserWhitelisted.d.ts +12 -12
  37. package/dist/hooks/useLockWalletAssets.d.ts +1 -1
  38. package/dist/hooks/usePendingAction.d.ts +7 -0
  39. package/dist/hooks/useSpiceAction.d.ts +46 -0
  40. package/dist/hooks/useSpiceAssets.d.ts +4 -1
  41. package/dist/hooks/useSpiceExecution.d.ts +9 -7
  42. package/dist/hooks/useSpiceInventory.d.ts +31 -0
  43. package/dist/hooks/useSpiceLock.d.ts +127 -0
  44. package/dist/hooks/useSpiceLockQuote.d.ts +35 -3
  45. package/dist/hooks/useSpiceRollupPrices.d.ts +9 -0
  46. package/dist/hooks/useSpiceSupply.d.ts +75 -28
  47. package/dist/hooks/useSupplyAssets.d.ts +23 -18
  48. package/dist/hooks/useSupplyQuote.d.ts +19 -5
  49. package/dist/hooks/useWalletBalances.d.ts +10 -4
  50. package/dist/index.cjs.js +16 -29
  51. package/dist/index.d.ts +53 -47
  52. package/dist/index.js +14 -27
  53. package/dist/privy-BJzR0dpS.js +2 -0
  54. package/dist/privy-CfCGXtaW.js +2 -0
  55. package/dist/providers/SpiceFlowProvider.d.ts +5 -3
  56. package/dist/types/assets.d.ts +12 -4
  57. package/dist/types/lock.d.ts +7 -3
  58. package/dist/types/supply.d.ts +35 -4
  59. package/dist/types/withdraw.d.ts +8 -7
  60. package/dist/utils/actionDefinition.d.ts +5 -0
  61. package/dist/utils/amounts.d.ts +2 -0
  62. package/dist/utils/assetDisplay.d.ts +8 -0
  63. package/dist/utils/assetPolicy.d.ts +16 -0
  64. package/dist/utils/chains/index.d.ts +4 -4
  65. package/dist/utils/crossChainRouter/liquidityVenues.d.ts +11 -7
  66. package/dist/utils/crossChainRouter/uniV3.d.ts +9 -5
  67. package/dist/utils/directWithdraw.d.ts +0 -4
  68. package/dist/utils/fees.d.ts +6 -1
  69. package/dist/utils/inventoryStore.d.ts +27 -0
  70. package/dist/utils/pendingDeposit.d.ts +30 -0
  71. package/dist/utils/prices/providerPrices.d.ts +12 -0
  72. package/dist/utils/relayer/index.d.ts +2 -3
  73. package/dist/utils/rollupBalances.d.ts +4 -0
  74. package/dist/utils/theme.d.ts +3 -3
  75. package/dist/utils/tokenResolution.d.ts +27 -2
  76. package/package.json +6 -1
  77. package/dist/components/AccountDisplay/tokenPrices.d.ts +0 -7
  78. package/dist/components/SpiceLock/lib/executors.d.ts +0 -76
  79. package/dist/components/SpiceSupply/lib/controlledFunding.d.ts +0 -54
  80. package/dist/components/SpiceSupply/lib/sourceConversion.d.ts +0 -13
  81. package/dist/components/SpiceWithdraw/parts/WithdrawBalancePopover.d.ts +0 -15
  82. package/dist/hooks/useDirectWithdraw.d.ts +0 -12
  83. package/dist/hooks/useSourceFundingConversion.d.ts +0 -22
  84. package/dist/privy-BuN11dsA.js +0 -2
  85. package/dist/privy-CDEv1O2j.js +0 -2
  86. package/dist/utils/crossChainRouter/sourceFundingQuote.d.ts +0 -58
package/README.md CHANGED
@@ -108,6 +108,55 @@ it becomes a `protocol` everyone can name.
108
108
 
109
109
  ## Development
110
110
 
111
+ ### Rollup balance pricing
112
+
113
+ Rollup USD values use the host-configured RPC provider's pricing capability when the balance API has no valid value. The built-in account panel and withdrawal modal enable this while open; custom `useSpiceAssets` consumers can opt in with `priceEnabled`. Quantities arrive independently. Lookups follow receipt mappings, prefer `nativeChainId`, and fall back to other supported chains with a configured Alchemy endpoint. Explicit account `tokenPrices` overrides still take precedence over provider quotes.
114
+
115
+ Wallet discovery and rollup balances share a one-minute quote cache. Pricing polls only while the view is open and the page is visible. A failed refresh can retain a marked stale quote for up to five minutes; an unavailable quote displays `—`. No extra key, internal RPC, or symbol-based ERC-20 price fallback is used.
116
+
117
+ ### Host-supplied token logos
118
+
119
+ `AccountDisplay.tokenLogos` maps a token symbol to a logo URL, the same key
120
+ shape `tokenPrices` uses. A discovered embedded-wallet balance falls back to
121
+ it when the RPC provider returns no logo, which is what happens for a token
122
+ that is not in the chain's configured token list. Provider metadata still
123
+ wins when it has a logo.
124
+
125
+ ```tsx
126
+ <AccountDisplay tokenLogos={{ REPPO: reppoLogoUrl }} />
127
+ ```
128
+
129
+ ### Withdraw from an account balance
130
+
131
+ `AccountDisplay.onWithdrawClick` receives the rollup receipt-token ID when a
132
+ user clicks Withdraw on an idle rollup balance. The main Withdraw button calls
133
+ it without an ID. Pass the ID to `SpiceWithdraw.initialSourceAssetId` to open
134
+ the existing modal with that asset selected; the user chooses the destination
135
+ network inside the modal. Existing callbacks that take no arguments continue
136
+ to work.
137
+
138
+ ```tsx
139
+ const [withdrawOpen, setWithdrawOpen] = useState(false);
140
+ const [withdrawAssetId, setWithdrawAssetId] = useState<string>();
141
+
142
+ <AccountDisplay
143
+ onWithdrawClick={(receiptTokenId) => {
144
+ setWithdrawAssetId(receiptTokenId);
145
+ setWithdrawOpen(true);
146
+ }}
147
+ />
148
+ <SpiceWithdraw
149
+ isOpen={withdrawOpen}
150
+ onClose={() => setWithdrawOpen(false)}
151
+ initialSourceAssetId={withdrawAssetId}
152
+ buildSpicenetBatch={buildSpicenetWithdrawalBatch}
153
+ />
154
+ ```
155
+
156
+ Keep the integration's existing withdrawal batch builder and callbacks.
157
+ `initialSourceAssetId` selects a current balance by ID; it does not supply a
158
+ cached balance or change the receipt's supported withdrawal routes.
159
+
111
160
  ### Fee-Charging Intent Flows
112
161
 
113
162
  - `SpiceSupply` and `SpicePay` are fee-charging intent-execution flows and must surface fee estimation before enabling submission.
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const r=require("./privy-CDEv1O2j.js");require("react/jsx-runtime"),require("react"),require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions"),require("@privy-io/react-auth"),require("wagmi"),require("@tanstack/react-query"),exports.PrivyLogin=r.PrivyLogin;
2
+ "use strict";const r=require("./privy-BJzR0dpS.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;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{P as g}from"./privy-BuN11dsA.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-CfCGXtaW.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;
@@ -5,7 +5,6 @@ interface AccountHeaderProps {
5
5
  status: "active" | "inactive";
6
6
  statusLabel?: string;
7
7
  totalUsdValue: number;
8
- hasUnpricedAssets?: boolean;
9
8
  breakdownSubtitle: string;
10
9
  showUsdSummary?: boolean;
11
10
  address?: string;
@@ -1,11 +1,7 @@
1
1
  import React from "react";
2
- import { SpiceAsset } from "../types";
3
2
  import type { ResolvedDarkPalette } from "../../../utils/theme";
4
- export interface DirectWithdrawState {
5
- key: string;
6
- step: "pending" | "error";
7
- message?: string;
8
- }
3
+ import type { DirectWithdrawState } from "../types";
4
+ import { SpiceAsset } from "../types";
9
5
  interface AccountIdleBalancesProps {
10
6
  spiceAssets: SpiceAsset[];
11
7
  loading: boolean;
@@ -14,6 +10,7 @@ interface AccountIdleBalancesProps {
14
10
  canDirectWithdraw?: boolean;
15
11
  onDirectWithdraw?: (asset: SpiceAsset) => void;
16
12
  directWithdrawState?: DirectWithdrawState | null;
13
+ onWithdrawClick?: (receiptTokenId?: string) => void;
17
14
  }
18
15
  export declare const AccountIdleBalances: React.NamedExoticComponent<AccountIdleBalancesProps>;
19
16
  export {};
@@ -1,14 +1,13 @@
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 "./AccountIdleBalances";
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";
9
9
  statusLabel?: string;
10
10
  totalUsdValue: number;
11
- hasUnpricedAssets?: boolean;
12
11
  breakdownSubtitle: string;
13
12
  showUsdSummary?: boolean;
14
13
  address?: string;
@@ -18,7 +17,7 @@ interface AccountPanelProps {
18
17
  customSections: CustomSection[];
19
18
  notice?: AccountNotice | null;
20
19
  onDepositClick?: () => void;
21
- onWithdrawClick?: () => void;
20
+ onWithdrawClick?: (receiptTokenId?: string) => void;
22
21
  depositDisabled?: boolean;
23
22
  onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
24
23
  primaryColor?: string;
@@ -1,12 +1,13 @@
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
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;
@@ -14,6 +15,9 @@ export interface CustomSection {
14
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;
@@ -24,7 +28,9 @@ export interface SpiceAsset {
24
28
  balance: string;
25
29
  balanceFormatted: number;
26
30
  usdValue: number;
31
+ priceStatus?: "fresh" | "stale" | "unavailable";
27
32
  logoURI?: string;
33
+ receiptTokenId?: string;
28
34
  directWithdraw?: boolean;
29
35
  }
30
36
  export interface BreakdownLabel {
@@ -42,15 +48,23 @@ export interface AccountDisplayProps {
42
48
  customSections?: CustomSection[];
43
49
  extraAssets?: SpiceAsset[];
44
50
  tokenPrices?: Record<string, number>;
51
+ tokenLogos?: Record<string, string>;
45
52
  breakdownLabels?: BreakdownLabel[];
46
53
  notice?: AccountNotice | null;
47
54
  styles?: CustomStyles;
48
55
  dark?: boolean;
49
56
  onDepositSuccess?: () => void;
50
57
  onDepositClick?: () => void;
51
- onWithdrawClick?: () => void;
58
+ onWithdrawClick?: (receiptTokenId?: string) => void;
52
59
  onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
53
60
  showModeToggle?: boolean;
54
61
  defaultMode?: "7702" | "non7702";
55
62
  showUsdSummary?: boolean;
63
+ alwaysShowEmbeddedIdle?: boolean;
64
+ showDisconnect?: boolean;
65
+ }
66
+ export interface DirectWithdrawState {
67
+ key: string;
68
+ step: "pending" | "error";
69
+ message?: string;
56
70
  }
@@ -0,0 +1,2 @@
1
+ import type { Asset } from "../../../types/assets";
2
+ export declare function isEscrowCreditable(asset: Pick<Asset, "address" | "chainId" | "isNative">): boolean;
@@ -3,6 +3,7 @@ import { type FeeEstimateSummary, type ResolvedSwap } from "@spicenet-io/spicefl
3
3
  import type { ChainAuthorization, ChainBatch } from "../../../types/authorization";
4
4
  import type { Asset } from "../../../types/assets";
5
5
  export declare function isDirectLockSource(asset: Asset, lockChainId: number): boolean;
6
+ export declare function isInPlaceLockSource(asset: Asset, lockChainId: number): boolean;
6
7
  export declare function composeLockSwapBatches(batches: ChainBatch[], params: {
7
8
  chainId: number;
8
9
  recipient: Address;
@@ -1,6 +1,6 @@
1
1
  import { type Address } from "viem";
2
2
  import type { ChainBatch } from "../../../types/authorization";
3
- import type { SpiceSupplyProps } from "../../../types/supply";
3
+ import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
4
4
  import type { SupplyFeeQuote } from "./feePreview";
5
5
  export declare function appendProceedsFees(batches: ChainBatch[], owner: Address, token: Address, gas: bigint, platform: bigint): ChainBatch[];
6
6
  export declare function simulateProceedsBatch(batches: ChainBatch[], owner: Address, token: Address, signal?: AbortSignal, platformFeeMaximum?: bigint): Promise<bigint>;
@@ -10,5 +10,5 @@ export declare function estimateProceedsFunding(args: {
10
10
  token: Address;
11
11
  signal?: AbortSignal;
12
12
  baseline: () => Promise<SupplyFeeQuote | null>;
13
- buildBatches: (amount: bigint) => Promise<ChainBatch[]>;
13
+ buildBatches: (amount: bigint, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
14
14
  }): Promise<SupplyFeeQuote>;
@@ -1,31 +1,27 @@
1
+ import type { FeeEstimateSummary, ResolvedSwap } from "@spicenet-io/spiceflow-core";
1
2
  import { type Address } from "viem";
2
- import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
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 { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
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 buildEmbeddedEscrowDepositBatch(token: Address, amount: bigint, chainId: number): ChainBatch;
11
- export declare function isExternalSource(asset: SelectedAsset["asset"] | null | undefined, isNon7702: boolean): boolean;
9
+ export declare function getPivotEscrowAmount(sourceSwap: Pick<ResolvedSwap, "amountOutMinimum">, gasSkim: bigint): bigint;
12
10
  export declare function stripSpicenetFundingBatches(batches: ChainBatch[]): ChainBatch[];
13
11
  export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
14
- export declare function resolveSupplyTokenDecimals(asset: SelectedAsset["asset"], destination: SpiceSupplyProps["destinationToken"], token: Address): Promise<number>;
15
12
  export interface BatchBuilderContext {
16
13
  currentPaymentAmount: string;
14
+ isFeeInclusiveInput?: boolean;
15
+ feeOnlyAction?: boolean;
16
+ swapInputAmount?: bigint | null;
17
17
  destinationToken: SpiceSupplyProps["destinationToken"];
18
18
  embeddedWalletAddress: string | null | undefined;
19
19
  providerEmbeddedAddress: string | null | undefined;
20
20
  externalWalletAddress: string | null | undefined;
21
21
  address: string | null | undefined;
22
22
  recipient?: Address;
23
- swapOutputRecipient?: Address;
24
23
  isNon7702: boolean;
25
24
  isPayMode: boolean;
26
- isFeeInclusiveInput?: boolean;
27
- swapInputAmount?: bigint | null;
28
- feeOnlyAction?: boolean;
29
25
  resolvedChainId: number;
30
26
  buildActionCalls: SpiceSupplyProps["buildActionCalls"];
31
27
  feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
@@ -33,12 +29,24 @@ export interface BatchBuilderContext {
33
29
  selectedAsset: SelectedAsset | null;
34
30
  needsSwap: boolean;
35
31
  resolvedSwap: ResolvedSwap | null;
32
+ resolveInputSwap?: (amountIn: bigint, selectedSwap?: ResolvedSwap) => Promise<ResolvedSwap>;
36
33
  exactOutputSwap: ResolvedExactOutputSwap | null;
37
34
  quoteAmountOut: bigint | null;
38
35
  resolvedTokenIn: Address | null;
36
+ sourceSwap?: ResolvedSwap | null;
37
+ sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
38
+ resolveSourceExactOutputSwap?: (amountOut: bigint) => Promise<ResolvedExactOutputSwap>;
39
+ pivot?: PivotRoute | null;
39
40
  requestTimestampMs?: number;
40
41
  }
41
- export declare function buildPayChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
42
- export declare function buildSupplyChainBatches(ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions): Promise<ChainBatch[]>;
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[]>;
43
51
  export declare function estimateRequiredGrossFunding(requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, estimate: EstimateFn, executionOptions?: Pick<ExecutionOptions, "useCustomTransfers" | "userOverride">): Promise<bigint>;
44
52
  export {};
@@ -1,40 +1,39 @@
1
- import { type SourceConversionExecution } from "./sourceConversion";
1
+ import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
2
2
  import type { Dispatch, MutableRefObject, SetStateAction } from "react";
3
3
  import { type Address } from "viem";
4
- import { type TransactionObserver } from "../../../execution/externalWalletClient";
5
- import { type SourceFundingState } from "../../../execution/sourceFunding";
4
+ import type { ExecutionRunner } from "../../../execution/runner";
5
+ import type { ExecutionProgress } from "../../../hooks/useSpiceExecution";
6
6
  import type { SelectedAsset } from "../../../types/assets";
7
- import type { BuildPayBatchesFn, BuildSupplyBatchesFn, SpiceSupplyProps } from "../../../types/supply";
8
- import { type SupplyFeeQuote } from "./feePreview";
7
+ import type { BuildPayBatchesFn, BuildSupplyBatchesFn, PivotRoute, SpiceSupplyProps } from "../../../types/supply";
9
8
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
10
- import type { ExecutionProgress } from "../../../hooks/useSpiceExecution";
11
- import type { ExecutionRunner } from "../../../execution/runner";
9
+ import { type SupplyFeeQuote } from "./feePreview";
12
10
  export type SupplyStep = "idle" | "building" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
13
11
  export type PaymentResult = {
14
12
  status: "processing" | "success" | "failed";
15
13
  txHash?: string;
16
14
  error?: string;
17
15
  };
18
- export { isExternalSource } from "./buildBatches";
19
16
  export type ExecutorContext = {
20
- signal?: AbortSignal;
21
17
  selectedAsset: SelectedAsset | null;
22
18
  parsedAmount: number;
23
19
  currentPaymentAmount: string;
24
20
  isInsufficientBalance: boolean;
25
21
  isPayMode: boolean;
26
22
  isFeeInclusiveInput?: boolean;
27
- swapInputAmount?: bigint | null;
28
23
  feeOnlyAction?: boolean;
29
24
  actionProceeds?: SpiceSupplyProps["actionProceeds"];
30
25
  validateFeeQuote?: () => void;
31
- onFeeQuoteChanged?: (quote: SupplyFeeQuote) => void;
26
+ executionTokenDecimals?: number;
27
+ signal?: AbortSignal;
32
28
  isNon7702: boolean;
33
29
  isSourceDestToken: boolean;
34
30
  needsSwap: boolean;
35
31
  exactOutputSwap: ResolvedExactOutputSwap | null;
36
32
  selectedIsEquivalent: boolean;
37
33
  resolvedTokenIn: Address | null;
34
+ sourceSwap: ResolvedSwap | null;
35
+ sourceExactOutputSwap: ResolvedExactOutputSwap | null;
36
+ pivot: PivotRoute | null;
38
37
  embeddedWalletAddress: string | null | undefined;
39
38
  providerEmbeddedAddress: string | null | undefined;
40
39
  recipient?: Address;
@@ -53,14 +52,7 @@ export type ExecutorContext = {
53
52
  provider: string | null | undefined;
54
53
  resolvedChainId: number;
55
54
  executionTokenAddress: Address;
56
- executionTokenDecimals?: number;
57
55
  feeQuote: SupplyFeeQuote | null;
58
- fundingObserver?: TransactionObserver;
59
- sourceFunding?: SourceFundingState;
60
- sourceFundingRecoveryKey?: string;
61
- sourceConversion?: SourceConversionExecution;
62
- sourceConversionRequired?: boolean;
63
- onSourceFundingChange?: (state: SourceFundingState) => void;
64
56
  execution: ExecutionRunner & {
65
57
  buildPayChainBatches: BuildPayBatchesFn;
66
58
  buildSupplyChainBatches: BuildSupplyBatchesFn;
@@ -80,7 +72,5 @@ export type ExecutorContext = {
80
72
  abortControllerRef: MutableRefObject<AbortController | null>;
81
73
  };
82
74
  } & Pick<SpiceSupplyProps, "destinationToken" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "onSuccess">;
83
- export declare function sourceFundingSelection(ctx: ExecutorContext): SelectedAsset | null;
84
- export declare function sourceFundingIdentity(ctx: ExecutorContext): string;
85
75
  export declare function executeSupply(ctx: ExecutorContext): Promise<void>;
86
76
  export declare function executePay(ctx: ExecutorContext): Promise<void>;
@@ -26,7 +26,9 @@ type StoredCall = {
26
26
  data: `0x${string}`;
27
27
  };
28
28
  export interface ExternalActionRecord {
29
- version: 2;
29
+ version: 2 | 3;
30
+ fundingIdentity?: string;
31
+ actionIdentity?: string;
30
32
  scope: string;
31
33
  destinationToken: Address;
32
34
  destinationDecimals: number;
@@ -59,5 +61,8 @@ export declare function executeExternalActionSupply(params: {
59
61
  buildActionCalls: SpiceSupplyProps["buildActionCalls"];
60
62
  onRecord: (record: ExternalActionRecord | null) => void;
61
63
  isCurrent?: () => boolean;
64
+ fundingIdentity: string;
65
+ actionIdentity: string;
66
+ resumeRoute: () => Promise<string>;
62
67
  }): Promise<void>;
63
68
  export {};
@@ -1,4 +1,4 @@
1
- import type { Address } from "viem";
1
+ import { type Address } from "viem";
2
2
  import type { FeePreviewContext, SupplyFeeQuote } from "./feePreview";
3
3
  export declare function resolveFeeFundingToken(asset: NonNullable<FeePreviewContext["selectedAsset"]>["asset"], chainId: number, feeToken: Address): Address | null;
4
4
  export interface FundingConversion {
@@ -7,6 +7,7 @@ export interface FundingConversion {
7
7
  amountInMax: bigint;
8
8
  amountOut: bigint;
9
9
  sourceAmountMax: bigint;
10
+ fromProceeds?: boolean;
10
11
  }
11
12
  export declare class InsufficientFeeFundingBalanceError extends Error {
12
13
  readonly requiredAmount: bigint;
@@ -1,6 +1,6 @@
1
1
  import { type Address } from "viem";
2
- import type { ChainBatch } from "../../../types/authorization";
3
2
  import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
3
+ import type { ChainBatch } from "../../../types/authorization";
4
4
  import type { ExecutorContext } from "./executors";
5
5
  export declare function stripFeeOnlyCalls(batches: ChainBatch[], chainId: number, token: Address): ChainBatch[];
6
6
  export declare function feeOnlyExecutionOptions(ctx: ExecutorContext, token: Address, fundingCap: bigint): Pick<ExecutionOptions, "prepareForSigning" | "validateBeforeSubmit" | "resolveActionOutputCredits">;
@@ -1,26 +1,41 @@
1
- import { type FundingConversion } from "./feeConversion";
2
- import type { LiquidityVenuesConfig } from "../../../utils/crossChainRouter/venueConfig";
3
- import { type Address } from "viem";
1
+ import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
4
2
  import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
5
- import type { FeePreview } from "../../../types/ui";
6
- import type { ChainBatch } from "../../../types/authorization";
3
+ import { type Address } from "viem";
4
+ import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
7
5
  import type { Asset, SelectedAsset } from "../../../types/assets";
8
- import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
6
+ import type { ChainBatch } from "../../../types/authorization";
7
+ import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
8
+ import type { FeePreview } from "../../../types/ui";
9
9
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
10
- import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
11
- import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
10
+ import { type FundingConversion } from "./feeConversion";
12
11
  type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
13
12
  type BuildPayBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
14
13
  type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
15
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;
16
28
  preview: FeePreview;
17
29
  feeEstimate: FeeEstimateSummary | null;
18
30
  grossFundingAmount?: bigint;
19
- proceedsUsed?: bigint;
20
- proceedsAvailable?: bigint;
21
- fundingConversion?: FundingConversion;
22
- fundingBatches?: ChainBatch[];
31
+ sourceGasSkim?: bigint;
23
32
  };
33
+ export declare function sizePivotSourceGasSkim(params: {
34
+ user: Address;
35
+ pivot: PivotRoute;
36
+ buildSupplyChainBatches: BuildSupplyBatchesFn;
37
+ signal?: AbortSignal;
38
+ }): Promise<bigint>;
24
39
  export declare function solveGrossFunding(fees: Pick<FeePreview, "grossAmount" | "gasFee" | "spicenetFee" | "bridgeFee">, requiredNetFunding: bigint): bigint;
25
40
  export declare function estimatePayFunding(args: {
26
41
  requiredNetFunding: bigint;
@@ -40,13 +55,18 @@ export declare function estimatePayFunding(args: {
40
55
  feeEstimate: FeeEstimateSummary;
41
56
  grossFundingAmount: bigint;
42
57
  }>;
58
+ export declare function estimateMaximumSupplyInput(params: {
59
+ balance: bigint;
60
+ decimals: number;
61
+ planForAmount: (rawAmount: bigint) => Promise<SupplyFeeQuote | null>;
62
+ }): Promise<string>;
43
63
  export declare function estimateSupplyMaxAmount(ctx: {
44
64
  asset: Asset;
45
65
  isPayMode: boolean;
46
- isFeeInclusiveInput?: boolean;
47
66
  isNon7702: boolean;
48
67
  needsSwap: boolean;
49
68
  isQuoting: boolean;
69
+ pivot?: PivotRoute | null;
50
70
  embeddedWalletAddress: string | null | undefined;
51
71
  buildSupplyChainBatches: BuildSupplyBatchesFn;
52
72
  estimate: EstimateFn;
@@ -54,15 +74,15 @@ export declare function estimateSupplyMaxAmount(ctx: {
54
74
  feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
55
75
  }): Promise<string | null>;
56
76
  export interface FeePreviewContext {
57
- liquidityVenues?: LiquidityVenuesConfig;
77
+ liquidityVenues?: import("../../../utils/crossChainRouter/venueConfig").LiquidityVenuesConfig;
58
78
  maxSlippage?: number;
59
79
  resolveExactOutputSwap?: SpiceSupplyProps["resolveExactOutputSwap"];
80
+ feeOnlyAction?: boolean;
81
+ actionProceeds?: SpiceSupplyProps["actionProceeds"];
60
82
  signal?: AbortSignal;
61
83
  selectedAsset: SelectedAsset | null;
62
84
  isPayMode: boolean;
63
85
  isFeeInclusiveInput?: boolean;
64
- feeOnlyAction?: boolean;
65
- actionProceeds?: SpiceSupplyProps["actionProceeds"];
66
86
  parsedAmount: number;
67
87
  needsSwap: boolean;
68
88
  exactOutputSwap: ResolvedExactOutputSwap | null;
@@ -82,6 +102,9 @@ export interface FeePreviewContext {
82
102
  authenticated: boolean;
83
103
  isDirect: boolean;
84
104
  resolvedSwap: ResolvedSwap | null;
105
+ sourceSwap?: ResolvedSwap | null;
106
+ sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
107
+ pivot?: PivotRoute | null;
85
108
  isQuoting: boolean;
86
109
  executionTokenAddress: Address;
87
110
  buildPayChainBatches: BuildPayBatchesFn;
@@ -89,4 +112,5 @@ export interface FeePreviewContext {
89
112
  estimate: EstimateFn;
90
113
  }
91
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">>;
92
116
  export {};
@@ -1,6 +1,7 @@
1
- import type { Address } from "viem";
2
1
  import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
2
+ import type { Address } from "viem";
3
3
  import type { ChainBatch } from "../../../types/authorization";
4
4
  export declare function wrapPayWithSpicenet(raw: ChainBatch[], fundingRecipient: Address, feeEstimate?: FeeEstimateSummary, opts?: {
5
5
  payoutAlreadyGross?: boolean;
6
+ requestTimestampMs?: number;
6
7
  }): ChainBatch[];
@@ -0,0 +1,6 @@
1
+ import type { UseSpiceSupplyResult } from "../../../hooks/useSpiceSupply";
2
+ import type { Asset } from "../../../types/assets";
3
+ export declare function FundingQuoteReview({ review, destination, }: {
4
+ review: NonNullable<UseSpiceSupplyResult["fundingQuoteReview"]>;
5
+ destination: Pick<Asset, "symbol" | "decimals">;
6
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import type { ChainBatch } from "../../../types/authorization";
2
- export declare function formatWithdrawError(message: string): string;
3
2
  export declare function normalizeTokenLabel(value?: string | null): string;
4
3
  export declare function formatTokenAmount(rawAmount: bigint, decimals: number): string;
5
4
  export declare function scaleAmountBetweenDecimals(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
6
- export declare function estimateUsd(amount: number, symbol?: string): string;
5
+ export declare function estimateUsd(amount: number, price?: number, stale?: boolean): string;
7
6
  export declare function buildWithdrawFeeEstimateKey(batches: ChainBatch[], tokenAddress?: string | null): string | null;