@spicenet-io/spiceflow-ui 4.9.6-embedded-balances.0 → 4.10.0-dev.20260909.1

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 (65) hide show
  1. package/README.md +0 -49
  2. package/dist/auth-privy.cjs.js +1 -1
  3. package/dist/auth-privy.js +1 -1
  4. package/dist/components/AccountDisplay/parts/AccountHeader.d.ts +1 -0
  5. package/dist/components/AccountDisplay/parts/AccountIdleBalances.d.ts +5 -2
  6. package/dist/components/AccountDisplay/parts/AccountPanel.d.ts +3 -2
  7. package/dist/components/AccountDisplay/tokenPrices.d.ts +7 -0
  8. package/dist/components/AccountDisplay/types.d.ts +3 -6
  9. package/dist/components/SpiceLock/lib/helpers.d.ts +0 -1
  10. package/dist/components/SpiceSupply/lib/actionProceeds.d.ts +14 -0
  11. package/dist/components/SpiceSupply/lib/buildBatches.d.ts +7 -2
  12. package/dist/components/SpiceSupply/lib/controlledFunding.d.ts +55 -0
  13. package/dist/components/SpiceSupply/lib/executors.d.ts +19 -1
  14. package/dist/components/SpiceSupply/lib/externalAction.d.ts +63 -0
  15. package/dist/components/SpiceSupply/lib/feeConversion.d.ts +16 -0
  16. package/dist/components/SpiceSupply/lib/feeOnlyExecution.d.ts +6 -0
  17. package/dist/components/SpiceSupply/lib/feePreview.d.ts +13 -0
  18. package/dist/components/SpiceSupply/lib/payFundingBatches.d.ts +6 -0
  19. package/dist/components/SpiceSupply/lib/sourceConversion.d.ts +12 -0
  20. package/dist/components/SpiceWithdraw/lib/helpers.d.ts +1 -1
  21. package/dist/components/SpiceWithdraw/parts/WithdrawBalanceCardHeader.d.ts +1 -0
  22. package/dist/components/SpiceWithdraw/parts/WithdrawBalancePopover.d.ts +15 -0
  23. package/dist/execution/externalWalletClient.d.ts +9 -0
  24. package/dist/execution/fundEmbeddedWallet.d.ts +4 -0
  25. package/dist/execution/intentSigning.d.ts +3 -2
  26. package/dist/execution/pollIntentStep.d.ts +7 -10
  27. package/dist/execution/sourceFunding.d.ts +29 -0
  28. package/dist/execution/transactionReceipt.d.ts +11 -0
  29. package/dist/hooks/index.d.ts +2 -0
  30. package/dist/hooks/useDirectWithdraw.d.ts +2 -8
  31. package/dist/hooks/useIsUserWhitelisted.d.ts +12 -12
  32. package/dist/hooks/useSourceFundingConversion.d.ts +22 -0
  33. package/dist/hooks/useSpiceAssets.d.ts +1 -2
  34. package/dist/hooks/useSpiceExecution.d.ts +4 -0
  35. package/dist/hooks/useSpiceSupply.d.ts +85 -0
  36. package/dist/hooks/useSupplyAssets.d.ts +9 -12
  37. package/dist/hooks/useSupplyQuote.d.ts +6 -1
  38. package/dist/hooks/useWallet.d.ts +3 -2
  39. package/dist/hooks/useWalletBalances.d.ts +1 -3
  40. package/dist/index.cjs.js +13 -13
  41. package/dist/index.d.ts +12 -8
  42. package/dist/index.js +15 -15
  43. package/dist/privy-BV1FYtxg.js +2 -0
  44. package/dist/privy-CDEv1O2j.js +2 -0
  45. package/dist/types/assets.d.ts +3 -1
  46. package/dist/types/supply.d.ts +13 -1
  47. package/dist/types/withdraw.d.ts +0 -1
  48. package/dist/utils/assetDisplay.d.ts +0 -6
  49. package/dist/utils/crossChainRouter/algebra.d.ts +83 -0
  50. package/dist/utils/crossChainRouter/liquidityVenues.d.ts +7 -0
  51. package/dist/utils/crossChainRouter/nativeWrap.d.ts +2 -2
  52. package/dist/utils/crossChainRouter/sourceFundingQuote.d.ts +58 -0
  53. package/dist/utils/directWithdraw.d.ts +4 -0
  54. package/dist/utils/fees.d.ts +1 -6
  55. package/dist/utils/relayer/index.d.ts +7 -0
  56. package/dist/utils/spiceConstants.d.ts +1 -0
  57. package/dist/utils/spicenetBatch.d.ts +18 -0
  58. package/dist/utils/swapQuotes.d.ts +1 -0
  59. package/dist/utils/tokenResolution.d.ts +1 -0
  60. package/package.json +2 -5
  61. package/dist/components/SpiceDeposit/lib/escrowCredit.d.ts +0 -2
  62. package/dist/hooks/useSpiceRollupPrices.d.ts +0 -2
  63. package/dist/privy-5n1m7sMG.js +0 -2
  64. package/dist/privy-8_x0Dkgt.js +0 -2
  65. package/dist/utils/prices/providerPrices.d.ts +0 -12
package/README.md CHANGED
@@ -108,55 +108,6 @@ 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
-
160
111
  ### Fee-Charging Intent Flows
161
112
 
162
113
  - `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-8_x0Dkgt.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-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;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{P as g}from"./privy-5n1m7sMG.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-BV1FYtxg.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};
@@ -5,6 +5,7 @@ interface AccountHeaderProps {
5
5
  status: "active" | "inactive";
6
6
  statusLabel?: string;
7
7
  totalUsdValue: number;
8
+ hasUnpricedAssets?: boolean;
8
9
  breakdownSubtitle: string;
9
10
  showUsdSummary?: boolean;
10
11
  address?: string;
@@ -1,7 +1,11 @@
1
1
  import React from "react";
2
2
  import { SpiceAsset } from "../types";
3
3
  import type { ResolvedDarkPalette } from "../../../utils/theme";
4
- import type { DirectWithdrawState } from "../../../hooks/useDirectWithdraw";
4
+ export interface DirectWithdrawState {
5
+ key: string;
6
+ step: "pending" | "error";
7
+ message?: string;
8
+ }
5
9
  interface AccountIdleBalancesProps {
6
10
  spiceAssets: SpiceAsset[];
7
11
  loading: boolean;
@@ -10,7 +14,6 @@ interface AccountIdleBalancesProps {
10
14
  canDirectWithdraw?: boolean;
11
15
  onDirectWithdraw?: (asset: SpiceAsset) => void;
12
16
  directWithdrawState?: DirectWithdrawState | null;
13
- onWithdrawClick?: (receiptTokenId?: string) => void;
14
17
  }
15
18
  export declare const AccountIdleBalances: React.NamedExoticComponent<AccountIdleBalancesProps>;
16
19
  export {};
@@ -2,12 +2,13 @@ import React from "react";
2
2
  import { SpiceAsset, CustomSection, AccountNotice } from "../types";
3
3
  import { VerifiedPendingDeposit } from "../../../hooks/usePendingDeposit";
4
4
  import type { ResolvedDarkPalette } from "../../../utils/theme";
5
- import type { DirectWithdrawState } from "../../../hooks/useDirectWithdraw";
5
+ import { type DirectWithdrawState } from "./AccountIdleBalances";
6
6
  interface AccountPanelProps {
7
7
  appName: string;
8
8
  status: "active" | "inactive";
9
9
  statusLabel?: string;
10
10
  totalUsdValue: number;
11
+ hasUnpricedAssets?: boolean;
11
12
  breakdownSubtitle: string;
12
13
  showUsdSummary?: boolean;
13
14
  address?: string;
@@ -17,7 +18,7 @@ interface AccountPanelProps {
17
18
  customSections: CustomSection[];
18
19
  notice?: AccountNotice | null;
19
20
  onDepositClick?: () => void;
20
- onWithdrawClick?: (receiptTokenId?: string) => void;
21
+ onWithdrawClick?: () => void;
21
22
  depositDisabled?: boolean;
22
23
  onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
23
24
  primaryColor?: string;
@@ -0,0 +1,7 @@
1
+ import type { Asset } from "../../types/assets";
2
+ type PriceableAsset = Pick<Asset, "symbol" | "name" | "displaySymbol" | "displayName" | "receiptTokenName"> & {
3
+ chainId: number;
4
+ address: string;
5
+ };
6
+ export declare function getTokenPrice(asset: PriceableAsset, tokenPrices: Record<string, number>): number;
7
+ export {};
@@ -4,14 +4,14 @@ import type React from "react";
4
4
  export interface CustomSectionItem {
5
5
  tokenSymbol: string;
6
6
  tokenLogoURI?: string;
7
- label: string;
7
+ label: React.ReactNode;
8
8
  displayValue: string;
9
9
  valueColor?: "green" | "red" | "default";
10
10
  }
11
11
  export interface CustomSection {
12
12
  title: string;
13
13
  items: CustomSectionItem[];
14
- totalValue: number;
14
+ totalValue?: number;
15
15
  }
16
16
  export interface SpiceAsset {
17
17
  tokenAddress: string;
@@ -24,9 +24,7 @@ export interface SpiceAsset {
24
24
  balance: string;
25
25
  balanceFormatted: number;
26
26
  usdValue: number;
27
- priceStatus?: "fresh" | "stale" | "unavailable";
28
27
  logoURI?: string;
29
- receiptTokenId?: string;
30
28
  directWithdraw?: boolean;
31
29
  }
32
30
  export interface BreakdownLabel {
@@ -44,14 +42,13 @@ export interface AccountDisplayProps {
44
42
  customSections?: CustomSection[];
45
43
  extraAssets?: SpiceAsset[];
46
44
  tokenPrices?: Record<string, number>;
47
- tokenLogos?: Record<string, string>;
48
45
  breakdownLabels?: BreakdownLabel[];
49
46
  notice?: AccountNotice | null;
50
47
  styles?: CustomStyles;
51
48
  dark?: boolean;
52
49
  onDepositSuccess?: () => void;
53
50
  onDepositClick?: () => void;
54
- onWithdrawClick?: (receiptTokenId?: string) => void;
51
+ onWithdrawClick?: () => void;
55
52
  onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
56
53
  showModeToggle?: boolean;
57
54
  defaultMode?: "7702" | "non7702";
@@ -3,7 +3,6 @@ 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;
7
6
  export declare function composeLockSwapBatches(batches: ChainBatch[], params: {
8
7
  chainId: number;
9
8
  recipient: Address;
@@ -0,0 +1,14 @@
1
+ import { type Address } from "viem";
2
+ import type { ChainBatch } from "../../../types/authorization";
3
+ import type { SpiceSupplyProps } 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) => Promise<ChainBatch[]>;
14
+ }): Promise<SupplyFeeQuote>;
@@ -7,9 +7,11 @@ 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 isExternalInPlacePaySource(selectedAsset: SelectedAsset | null, isNon7702: boolean, resolvedChainId: number): boolean;
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;
11
12
  export declare function stripSpicenetFundingBatches(batches: ChainBatch[]): ChainBatch[];
12
13
  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>;
13
15
  export interface BatchBuilderContext {
14
16
  currentPaymentAmount: string;
15
17
  destinationToken: SpiceSupplyProps["destinationToken"];
@@ -18,8 +20,12 @@ export interface BatchBuilderContext {
18
20
  externalWalletAddress: string | null | undefined;
19
21
  address: string | null | undefined;
20
22
  recipient?: Address;
23
+ swapOutputRecipient?: Address;
21
24
  isNon7702: boolean;
22
25
  isPayMode: boolean;
26
+ isFeeInclusiveInput?: boolean;
27
+ swapInputAmount?: bigint | null;
28
+ feeOnlyAction?: boolean;
23
29
  resolvedChainId: number;
24
30
  buildActionCalls: SpiceSupplyProps["buildActionCalls"];
25
31
  feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
@@ -27,7 +33,6 @@ export interface BatchBuilderContext {
27
33
  selectedAsset: SelectedAsset | null;
28
34
  needsSwap: boolean;
29
35
  resolvedSwap: ResolvedSwap | null;
30
- resolveInputSwap?: (amountIn: bigint) => Promise<ResolvedSwap>;
31
36
  exactOutputSwap: ResolvedExactOutputSwap | null;
32
37
  quoteAmountOut: bigint | null;
33
38
  resolvedTokenIn: Address | null;
@@ -0,0 +1,55 @@
1
+ import { type SourceFundingState } from "../../../execution/sourceFunding";
2
+ import { type ExecutorContext } from "./executors";
3
+ import type { Asset, SelectedAsset } from "../../../types/assets";
4
+ import type { DestinationTokenConfig } from "../../../types/supply";
5
+ export declare const SOURCE_FUNDING_EVENT = "spiceflow:source-funding";
6
+ type StoredSelectedAsset = {
7
+ asset: Omit<Asset, "balance"> & {
8
+ balance: string;
9
+ };
10
+ amount: string;
11
+ };
12
+ export interface SourceFundingProgress {
13
+ feeOnlyAction: boolean;
14
+ phase: "funding" | "routing";
15
+ confirmedAmount: string;
16
+ matchesSelection: boolean;
17
+ matchesPurpose: boolean;
18
+ requiresRecovery: boolean;
19
+ recoveryKey: string;
20
+ selectedAsset: SelectedAsset;
21
+ destinationToken: DestinationTokenConfig;
22
+ paymentAmount: string;
23
+ amountDirection: "input" | "input-inclusive" | "output";
24
+ }
25
+ export interface FundingRecord {
26
+ feeOnlyAction?: boolean;
27
+ version: 2;
28
+ scope: string;
29
+ identity: string;
30
+ funding: SourceFundingState;
31
+ submitted: boolean;
32
+ recoveryKey: string;
33
+ selectedAsset: StoredSelectedAsset;
34
+ destinationToken: DestinationTokenConfig;
35
+ paymentAmount: string;
36
+ amountDirection: SourceFundingProgress["amountDirection"];
37
+ route?: {
38
+ actionId: string;
39
+ intentId: string;
40
+ intentIndex: number;
41
+ spicenetSteps: boolean[];
42
+ };
43
+ }
44
+ export declare function controlledFundingProgress(record: FundingRecord, ctx: ExecutorContext): SourceFundingProgress;
45
+ export declare function readControlledFunding(scope: string): FundingRecord | null;
46
+ export declare function reconcileControlledFunding(scope: string): Promise<boolean>;
47
+ export declare function executeWithSourceFunding(params: {
48
+ scope: string;
49
+ recovery?: "resume" | "balance";
50
+ ctx: ExecutorContext;
51
+ run: (ctx: ExecutorContext) => Promise<void>;
52
+ isCurrent: () => boolean;
53
+ onRecord?: (record: FundingRecord | null) => void;
54
+ }): Promise<void>;
55
+ export {};
@@ -1,24 +1,33 @@
1
+ import { type SourceConversionExecution } from "./sourceConversion";
1
2
  import type { Dispatch, MutableRefObject, SetStateAction } from "react";
2
3
  import { type Address } from "viem";
4
+ import { type TransactionObserver } from "../../../execution/externalWalletClient";
5
+ import { type SourceFundingState } from "../../../execution/sourceFunding";
3
6
  import type { SelectedAsset } from "../../../types/assets";
4
7
  import type { BuildPayBatchesFn, BuildSupplyBatchesFn, SpiceSupplyProps } from "../../../types/supply";
5
8
  import { type SupplyFeeQuote } from "./feePreview";
6
9
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
7
10
  import type { ExecutionProgress } from "../../../hooks/useSpiceExecution";
8
11
  import type { ExecutionRunner } from "../../../execution/runner";
9
- export type SupplyStep = "idle" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
12
+ export type SupplyStep = "idle" | "building" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
10
13
  export type PaymentResult = {
11
14
  status: "processing" | "success" | "failed";
12
15
  txHash?: string;
13
16
  error?: string;
14
17
  };
18
+ export { isExternalSource } from "./buildBatches";
15
19
  export type ExecutorContext = {
20
+ signal?: AbortSignal;
16
21
  selectedAsset: SelectedAsset | null;
17
22
  parsedAmount: number;
18
23
  currentPaymentAmount: string;
19
24
  isInsufficientBalance: boolean;
20
25
  isPayMode: boolean;
21
26
  isFeeInclusiveInput?: boolean;
27
+ swapInputAmount?: bigint | null;
28
+ feeOnlyAction?: boolean;
29
+ actionProceeds?: SpiceSupplyProps["actionProceeds"];
30
+ validateFeeQuote?: () => void;
22
31
  isNon7702: boolean;
23
32
  isSourceDestToken: boolean;
24
33
  needsSwap: boolean;
@@ -43,7 +52,14 @@ export type ExecutorContext = {
43
52
  provider: string | null | undefined;
44
53
  resolvedChainId: number;
45
54
  executionTokenAddress: Address;
55
+ executionTokenDecimals?: number;
46
56
  feeQuote: SupplyFeeQuote | null;
57
+ fundingObserver?: TransactionObserver;
58
+ sourceFunding?: SourceFundingState;
59
+ sourceFundingRecoveryKey?: string;
60
+ sourceConversion?: SourceConversionExecution;
61
+ sourceConversionRequired?: boolean;
62
+ onSourceFundingChange?: (state: SourceFundingState) => void;
47
63
  execution: ExecutionRunner & {
48
64
  buildPayChainBatches: BuildPayBatchesFn;
49
65
  buildSupplyChainBatches: BuildSupplyBatchesFn;
@@ -63,5 +79,7 @@ export type ExecutorContext = {
63
79
  abortControllerRef: MutableRefObject<AbortController | null>;
64
80
  };
65
81
  } & Pick<SpiceSupplyProps, "destinationToken" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "onSuccess">;
82
+ export declare function sourceFundingSelection(ctx: ExecutorContext): SelectedAsset | null;
83
+ export declare function sourceFundingIdentity(ctx: ExecutorContext): string;
66
84
  export declare function executeSupply(ctx: ExecutorContext): Promise<void>;
67
85
  export declare function executePay(ctx: ExecutorContext): Promise<void>;
@@ -0,0 +1,63 @@
1
+ import { type Address } from "viem";
2
+ import { type SourceFundingState } from "../../../execution/sourceFunding";
3
+ import { type ExecutorContext } from "./executors";
4
+ import type { BuildActionCallsContext, SpiceSupplyProps } from "../../../types/supply";
5
+ import type { Call } from "../../../types/authorization";
6
+ export type ExternalActionExecution = {
7
+ wallet: "external";
8
+ recoveryKey: string;
9
+ };
10
+ export interface ExternalActionProgress {
11
+ destinationToken: Address;
12
+ destinationDecimals: number;
13
+ phase: "funding" | "routing" | "action" | "complete";
14
+ confirmedCalls: number;
15
+ totalCalls: number;
16
+ amount?: string;
17
+ requiresRecovery: boolean;
18
+ }
19
+ type PendingTransaction = {
20
+ chainId: number;
21
+ hash?: `0x${string}`;
22
+ };
23
+ type StoredCall = {
24
+ to: Address;
25
+ value: string;
26
+ data: `0x${string}`;
27
+ };
28
+ export interface ExternalActionRecord {
29
+ version: 2;
30
+ scope: string;
31
+ destinationToken: Address;
32
+ destinationDecimals: number;
33
+ sourceKey: string;
34
+ phase: ExternalActionProgress["phase"];
35
+ amount?: string;
36
+ calls?: StoredCall[];
37
+ confirmedCalls: number;
38
+ sourceFunding?: SourceFundingState;
39
+ pendingCall?: PendingTransaction;
40
+ routeSubmitted: boolean;
41
+ route?: {
42
+ actionId: string;
43
+ intentId: string;
44
+ intentIndex: number;
45
+ spicenetSteps: boolean[];
46
+ };
47
+ lastHash?: `0x${string}`;
48
+ }
49
+ export declare function externalActionScope(network: string, chainId: number, external: string, embedded: string, recoveryKey: string): string;
50
+ export declare function readExternalAction(scope: string): ExternalActionRecord | null;
51
+ export declare function externalActionProgress(record: ExternalActionRecord): ExternalActionProgress;
52
+ export declare function reconcileExternalFunding(scope: string): Promise<boolean>;
53
+ export declare function clearCompletedExternalAction(scope: string): void;
54
+ export declare function buildExternalDeliveryCalls(amount: bigint, context: BuildActionCallsContext, recipient: Address): Call[];
55
+ export declare function executeExternalActionSupply(params: {
56
+ scope: string;
57
+ recovery?: "resume" | "balance";
58
+ ctx: ExecutorContext;
59
+ buildActionCalls: SpiceSupplyProps["buildActionCalls"];
60
+ onRecord: (record: ExternalActionRecord | null) => void;
61
+ isCurrent?: () => boolean;
62
+ }): Promise<void>;
63
+ export {};
@@ -0,0 +1,16 @@
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
+ }
11
+ export declare class InsufficientFeeFundingBalanceError extends Error {
12
+ readonly requiredAmount: bigint;
13
+ readonly balance: bigint;
14
+ constructor(requiredAmount: bigint, balance: bigint);
15
+ }
16
+ export declare function quoteConvertedFees(ctx: FeePreviewContext): Promise<SupplyFeeQuote>;
@@ -0,0 +1,6 @@
1
+ import { type Address } from "viem";
2
+ import type { ChainBatch } from "../../../types/authorization";
3
+ import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
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,3 +1,5 @@
1
+ import { type FundingConversion } from "./feeConversion";
2
+ import type { LiquidityVenuesConfig } from "../../../utils/crossChainRouter/venueConfig";
1
3
  import { type Address } from "viem";
2
4
  import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
3
5
  import type { FeePreview } from "../../../types/ui";
@@ -14,10 +16,15 @@ export type SupplyFeeQuote = {
14
16
  preview: FeePreview;
15
17
  feeEstimate: FeeEstimateSummary | null;
16
18
  grossFundingAmount?: bigint;
19
+ proceedsUsed?: bigint;
20
+ proceedsAvailable?: bigint;
21
+ fundingConversion?: FundingConversion;
22
+ fundingBatches?: ChainBatch[];
17
23
  };
18
24
  export declare function solveGrossFunding(fees: Pick<FeePreview, "grossAmount" | "gasFee" | "spicenetFee" | "bridgeFee">, requiredNetFunding: bigint): bigint;
19
25
  export declare function estimatePayFunding(args: {
20
26
  requiredNetFunding: bigint;
27
+ feeOnlyAction?: boolean;
21
28
  buildBatches: (gross: bigint) => ChainBatch[] | Promise<ChainBatch[]>;
22
29
  fundingToken: Address;
23
30
  estimate: EstimateFn;
@@ -36,6 +43,7 @@ export declare function estimatePayFunding(args: {
36
43
  export declare function estimateSupplyMaxAmount(ctx: {
37
44
  asset: Asset;
38
45
  isPayMode: boolean;
46
+ isFeeInclusiveInput?: boolean;
39
47
  isNon7702: boolean;
40
48
  needsSwap: boolean;
41
49
  isQuoting: boolean;
@@ -46,10 +54,15 @@ export declare function estimateSupplyMaxAmount(ctx: {
46
54
  feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
47
55
  }): Promise<string | null>;
48
56
  export interface FeePreviewContext {
57
+ liquidityVenues?: LiquidityVenuesConfig;
58
+ maxSlippage?: number;
59
+ resolveExactOutputSwap?: SpiceSupplyProps["resolveExactOutputSwap"];
49
60
  signal?: AbortSignal;
50
61
  selectedAsset: SelectedAsset | null;
51
62
  isPayMode: boolean;
52
63
  isFeeInclusiveInput?: boolean;
64
+ feeOnlyAction?: boolean;
65
+ actionProceeds?: SpiceSupplyProps["actionProceeds"];
53
66
  parsedAmount: number;
54
67
  needsSwap: boolean;
55
68
  exactOutputSwap: ResolvedExactOutputSwap | null;
@@ -0,0 +1,6 @@
1
+ import type { Address } from "viem";
2
+ import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
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,12 @@
1
+ import type { ExecutorContext } from "./executors";
2
+ import type { ChainBatch } from "../../../types/authorization";
3
+ import type { SelectedAsset } from "../../../types/assets";
4
+ import type { SourceFundingExecutionPlan } from "../../../utils/crossChainRouter/sourceFundingQuote";
5
+ export interface SourceConversionExecution {
6
+ virtualSelectedAsset: SelectedAsset;
7
+ acceptedSourceAmountInMax: bigint;
8
+ getPlan: (batches: ChainBatch[]) => SourceFundingExecutionPlan | undefined;
9
+ isCurrent: () => boolean;
10
+ }
11
+ export declare function sourceBatchKey(batch: ChainBatch): string;
12
+ export declare function executeSourceConversion(ctx: ExecutorContext, run: (ctx: ExecutorContext) => Promise<void>, fundExternal: (amount: bigint) => Promise<void>): Promise<void>;
@@ -2,5 +2,5 @@ import type { ChainBatch } from "../../../types/authorization";
2
2
  export declare function normalizeTokenLabel(value?: string | null): string;
3
3
  export declare function formatTokenAmount(rawAmount: bigint, decimals: number): string;
4
4
  export declare function scaleAmountBetweenDecimals(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
5
- export declare function estimateUsd(amount: number, price?: number, stale?: boolean): string;
5
+ export declare function estimateUsd(amount: number, symbol?: string): string;
6
6
  export declare function buildWithdrawFeeEstimateKey(batches: ChainBatch[], tokenAddress?: string | null): string | null;
@@ -4,6 +4,7 @@ interface WithdrawBalanceCardHeaderProps {
4
4
  label: string;
5
5
  spiceAssetsLoading: boolean;
6
6
  totalSelectedBalance: number;
7
+ onOpenBalancePopover: (anchor: HTMLElement | null) => void;
7
8
  dark: boolean;
8
9
  dk: ResolvedDarkPalette;
9
10
  }
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+ import type { ResolvedDarkPalette } from "../../../utils/theme";
3
+ interface BalancePopoverProps {
4
+ show: boolean;
5
+ position: {
6
+ top: number;
7
+ left: number;
8
+ } | null;
9
+ popoverRef: React.RefObject<HTMLDivElement>;
10
+ spiceAssets: any[] | null | undefined;
11
+ dark: boolean;
12
+ dk: ResolvedDarkPalette;
13
+ }
14
+ export declare const BalancePopover: React.FC<BalancePopoverProps>;
15
+ export {};
@@ -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,7 @@
1
1
  import { type Address } from "viem";
2
+ import { type TransactionObserver } from "./externalWalletClient";
3
+ import type { Call } from "../types/authorization";
4
+ export declare function tokenTransferCall(recipient: Address, tokenAddr: Address, isNative: boolean, amount: bigint): Call;
2
5
  export declare function sendTokenTransferTx(extWc: any, params: {
3
6
  recipient: Address;
4
7
  tokenAddr: Address;
@@ -14,4 +17,5 @@ export declare function fundEmbeddedWallet(params: {
14
17
  isNative: boolean;
15
18
  amount: bigint;
16
19
  viemChain?: unknown;
20
+ observer?: TransactionObserver;
17
21
  }): Promise<void>;
@@ -2,11 +2,12 @@ import { type Address, type Hex } from "viem";
2
2
  import type { ChainAuthorization, ChainBatch } from "../types/authorization";
3
3
  import type { WalletActions } from "../hooks/useWallet";
4
4
  export declare function build7702IntentDigest(chainBatches: ChainBatch[], exp: bigint): `0x${string}`;
5
- export declare function sign7702IntentDigest(actions: Pick<WalletActions, "signMessage">, chainBatches: ChainBatch[], exp: bigint, signal?: AbortSignal): Promise<Hex>;
5
+ export declare function sign7702IntentDigest(actions: Pick<WalletActions, "signMessage">, chainBatches: ChainBatch[], exp: bigint, signal?: AbortSignal, onSignatureRequested?: () => void): Promise<Hex>;
6
6
  export declare function getChainAuthorizations(params: {
7
7
  chainBatches: ChainBatch[];
8
8
  signingAddress: Address;
9
- actions: Pick<WalletActions, "signAuthorization">;
9
+ actions: Pick<WalletActions, "signAuthorization" | "prepareSigning">;
10
10
  cache?: Map<string, ChainAuthorization>;
11
11
  signal?: AbortSignal;
12
+ onSignatureRequested?: () => void;
12
13
  }): Promise<ChainAuthorization[]>;
@@ -1,3 +1,8 @@
1
+ type StepResult = {
2
+ status: string;
3
+ transactionHash?: string;
4
+ error?: string;
5
+ };
1
6
  type PollIntentStepOptions = {
2
7
  actionId: string;
3
8
  intentIndex: number;
@@ -8,11 +13,7 @@ type PollIntentStepOptions = {
8
13
  pollsBeforeRetry?: number;
9
14
  maxConsecutiveStatusErrors?: number;
10
15
  onStatusMessage?: (message: string, txHash?: string) => void;
11
- onStepUpdate?: (result: {
12
- status: string;
13
- transactionHash?: string;
14
- error?: string;
15
- }) => void;
16
+ onStepUpdate?: (result: StepResult) => void;
16
17
  signal?: AbortSignal;
17
18
  chainId?: number;
18
19
  };
@@ -27,11 +28,7 @@ export declare function runAllIntentSteps(options: {
27
28
  maxExecuteAttemptsForStep?: (stepIndex: number) => number;
28
29
  maxPolls?: number;
29
30
  onStatusMessage?: (message: string, txHash?: string) => void;
30
- onStepUpdate?: (stepIndex: number, result: {
31
- status: string;
32
- transactionHash?: string;
33
- error?: string;
34
- }) => void;
31
+ onStepUpdate?: (stepIndex: number, result: StepResult) => void;
35
32
  signal?: AbortSignal;
36
33
  }): Promise<string | undefined>;
37
34
  export {};