@spicenet-io/spiceflow-ui 4.10.0-rc.0 → 4.10.0-rc.2

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 (34) hide show
  1. package/README.md +82 -6
  2. package/dist/auth-privy.cjs.js +2 -1
  3. package/dist/auth-privy.js +2 -1
  4. package/dist/components/SpiceAccount/SpiceAccount.d.ts +9 -0
  5. package/dist/components/SpiceAccount/index.d.ts +2 -0
  6. package/dist/components/SpiceSupply/lib/buildBatches.d.ts +2 -2
  7. package/dist/components/SpiceSupply/lib/executors.d.ts +3 -2
  8. package/dist/components/SpiceSupply/lib/feePreview.d.ts +3 -3
  9. package/dist/components/SpiceWithdraw/lib/useEmbeddedWithdraw.d.ts +2 -0
  10. package/dist/hooks/index.d.ts +1 -0
  11. package/dist/hooks/useDestinationToken.d.ts +6 -1
  12. package/dist/hooks/useSpiceAccount.d.ts +12 -0
  13. package/dist/hooks/useSpiceAction.d.ts +1 -1
  14. package/dist/hooks/useSpiceLock.d.ts +3 -1
  15. package/dist/hooks/useSpiceSupply.d.ts +5 -2
  16. package/dist/hooks/useSupplyAssets.d.ts +3 -2
  17. package/dist/hooks/useSupplyQuote.d.ts +2 -2
  18. package/dist/hooks/useWalletBalances.d.ts +2 -2
  19. package/dist/index.cjs.js +7 -6
  20. package/dist/index.d.ts +5 -2
  21. package/dist/index.js +7 -6
  22. package/dist/privy-BG9UqWrL.js +2 -0
  23. package/dist/privy-BMB5O4hI.js +2 -0
  24. package/dist/providers/SpiceFlowProvider.d.ts +3 -1
  25. package/dist/types/assets.d.ts +1 -1
  26. package/dist/types/deposit.d.ts +2 -0
  27. package/dist/types/lock.d.ts +1 -0
  28. package/dist/types/supply.d.ts +3 -1
  29. package/dist/utils/assetPolicy.d.ts +1 -1
  30. package/dist/utils/chains/index.d.ts +1 -0
  31. package/dist/utils/crossChainRouter/liquidityVenues.d.ts +3 -0
  32. package/package.json +1 -1
  33. package/dist/privy-DgLAdE7U.js +0 -2
  34. package/dist/privy-TGSRGTFo.js +0 -2
package/README.md CHANGED
@@ -24,9 +24,13 @@ The example is a prerelease selection, not a stable recommendation or a policy b
24
24
  Reuse compatible host-owned Privy, wagmi and QueryClient providers. Read the exact
25
25
  package's peer dependencies; do not replace the wallet stack as part of a version bump.
26
26
 
27
+ The SDK adds its stylesheet (spinner keyframes, focus ring, reduced-motion rule) to the
28
+ page when it loads, so no CSS import is needed. `@spicenet-io/spiceflow-ui/styles.css`
29
+ is still exported for a host whose Content Security Policy forbids inline styles;
30
+ importing it as well is harmless.
31
+
27
32
  ```tsx
28
33
  import { SpiceFlowProvider } from "@spicenet-io/spiceflow-ui";
29
- import "@spicenet-io/spiceflow-ui/styles.css";
30
34
 
31
35
  // Inside the host's existing WagmiProvider → QueryClientProvider → PrivyProvider stack.
32
36
  <SpiceFlowProvider
@@ -40,17 +44,29 @@ import "@spicenet-io/spiceflow-ui/styles.css";
40
44
  ```
41
45
 
42
46
  Configure Privy credentials/policy on the host's `PrivyProvider`. Supply client RPCs
43
- for every enabled source, conversion and destination chain, and keep the SDK/wallet
44
- chain sets aligned. Wallet-library transports alone do not configure SDK reads;
45
- there is no internal RPC fallback. Keep private credentials out of browser bundles.
47
+ through `rpcOverrides` for the chains you exercise, and keep the SDK/wallet chain sets
48
+ aligned. An entry in `rpcOverrides` always wins; a chain without one uses the chain's
49
+ built-in endpoint, so an integration that passes none keeps working. Wallet-library
50
+ transports alone do not configure SDK reads. Rollup price lookups read only a
51
+ host-configured RPC. Keep private credentials out of browser bundles.
46
52
 
47
53
  ## Integration ownership
48
54
 
49
55
  - Use stock components when they fit the approved UI; use `useSpiceSupply` for custom
50
56
  action forms. `useSpiceLock` and legacy `useSpiceAction` delegate to that controller.
57
+ - Declare the destination token by chain and address:
58
+ `destinationToken={{ chainId: 8453, address: USDC }}`. The SDK takes the symbol and
59
+ decimals from the chain's token registry, then from the token contract, and holds the
60
+ action until they are known. Decimals that cannot be read block the action; a symbol
61
+ that cannot be read falls back to the shortened address. Any field you pass wins, so a
62
+ full `{ address, symbol, decimals, chainId }` object behaves exactly as before.
51
63
  - Supply destination metadata, protocol `buildActionCalls` or destination-only
52
64
  `lockBatches`, beneficiary semantics, and awaited application updates. The SDK owns
53
65
  inventory, routing, Max, fees, accepted plans, funding, execution and recovery.
66
+ - For the account, use `useSpiceAccount()` instead of reading `SpiceFlowProviderContext`:
67
+ `mode` (`"embedded"` or `"external"`), `setMode`, `ownerAddress` for the current mode,
68
+ both wallet addresses and the whitelist state. A provider with a fixed `mode` prop
69
+ ignores `setMode`.
54
70
  - For custom holdings, use `useSpiceInventory` and `assetPositionId`. Keep raw balance,
55
71
  default visibility and spend eligibility separate. Preserve rows during refresh;
56
72
  stale/failed balances cannot authorize spending, and confirmed zero wins.
@@ -150,6 +166,36 @@ Rollup USD values use the host-configured RPC provider's pricing capability when
150
166
 
151
167
  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.
152
168
 
169
+ ### Host tokens
170
+
171
+ A token the SDK does not know (a protocol's own token, a receipt token) is declared
172
+ once on the provider. Every surface that lists balances then reads it: Supply, Pay,
173
+ Lock, the account panel and Withdraw.
174
+
175
+ ```tsx
176
+ <SpiceFlowProvider
177
+ additionalSourceTokens={[{ address: TOKEN, chainId: 8453, symbol: "TOKEN", decimals: 18 }]}
178
+ >
179
+ ```
180
+
181
+ A component's or hook's own `additionalSourceTokens` still works and is added to the
182
+ provider's list.
183
+
184
+ ### Host token prices
185
+
186
+ A host token usually has no price the SDK can find, so the account panel lists it
187
+ without a USD value. `AccountDisplay.tokenPrices` takes the host's own price for it,
188
+ keyed by `chainId:address`. The value counts toward the account total and the row
189
+ sorts with the rest.
190
+
191
+ ```tsx
192
+ <AccountDisplay tokenPrices={{ [`8453:${TOKEN}`]: tokenUsdPrice }} />
193
+ ```
194
+
195
+ The SDK's own price wins whenever it has one. A symbol key prices rollup balances
196
+ only: any wallet token can carry any symbol, so a wallet balance is matched by address
197
+ alone. The price is for display and never changes which balance an action spends.
198
+
153
199
  ### Host-supplied token logos
154
200
 
155
201
  `AccountDisplay.tokenLogos` maps a token symbol to a logo URL, the same key
@@ -162,6 +208,22 @@ wins when it has a logo.
162
208
  <AccountDisplay tokenLogos={{ TOKEN: tokenLogoUrl }} />
163
209
  ```
164
210
 
211
+ ### Account with Deposit and Withdraw
212
+
213
+ `SpiceAccount` renders `AccountDisplay` together with `SpiceDeposit` and
214
+ `SpiceWithdraw`, and owns their open state. Withdraw on an idle rollup balance opens
215
+ the modal with that balance selected. It takes every `AccountDisplay` prop except the
216
+ two click handlers; `depositProps` and `withdrawProps` pass through to the modals.
217
+ `styles` and `onDepositSuccess` are shared with the modals unless those props set
218
+ their own.
219
+
220
+ ```tsx
221
+ <SpiceAccount appName="MyApp" onDepositSuccess={refresh} />
222
+ ```
223
+
224
+ Use `AccountDisplay` directly to hide one of the buttons or to open your own flow
225
+ from them.
226
+
165
227
  ### Withdraw from an account balance
166
228
 
167
229
  `AccountDisplay.onWithdrawClick` receives the rollup receipt-token ID when a
@@ -185,14 +247,24 @@ const [withdrawAssetId, setWithdrawAssetId] = useState<string>();
185
247
  isOpen={withdrawOpen}
186
248
  onClose={() => setWithdrawOpen(false)}
187
249
  initialSourceAssetId={withdrawAssetId}
188
- buildSpicenetBatch={buildSpicenetWithdrawalBatch}
189
250
  />
190
251
  ```
191
252
 
192
- Keep the integration's existing withdrawal batch builder and callbacks.
253
+ `buildSpicenetBatch` defaults to the SDK's `buildSpicenetWithdrawalBatch`. An
254
+ integration that already passes a builder keeps it as an override, and its
255
+ callbacks are unchanged.
193
256
  `initialSourceAssetId` selects a current balance by ID; it does not supply a
194
257
  cached balance or change the receipt's supported withdrawal routes.
195
258
 
259
+ ### Funding sources
260
+
261
+ Supply, Pay and Lock list every balance that can fund the action: the embedded wallet
262
+ and rollup balances, and the connected external wallet, in either wallet mode. To keep a
263
+ mode to its own wallet, pass `includeExternalWalletAssets={false}` (Embedded mode) or
264
+ `includeCrossChainEmbeddedAssets={false}` (External mode). A user who holds the same
265
+ token in both wallets sees one row per wallet; a host that preselects a source should
266
+ match on `assetPositionId`, not on symbol or address alone.
267
+
196
268
  ### Action Fee Readiness
197
269
 
198
270
  - Routed Supply, Pay and Lock actions must surface fee estimation before enabling submission.
@@ -200,6 +272,8 @@ cached balance or change the receipt's supported withdrawal routes.
200
272
  - Deposit gas and rollup withdrawal semantics remain distinct from action intent fees. Preserve their existing quote/readiness requirements.
201
273
  - Account wallet withdrawal is a fee-only Supply action. Do not bypass its fee/readiness gates based on the label "withdraw".
202
274
  - Custom actions use the shared controller's `canExecute`; an available balance or old quote alone is insufficient.
275
+ - `onSubmit` on `SpiceSupply`, `SpiceLock`, `SpiceDeposit` and the shared controller fires once when the user submits and the SDK accepts it, before any wallet prompt. Use it for "transaction in progress" feedback instead of listening for clicks on SDK buttons.
276
+ - `max()` on the shared controller (`useSpiceSupply`, `useSpiceLock`) resolves the fee-aware Max for the selected source, or `null` when there is none or the action fixes its output. The host sets the result as the amount.
203
277
 
204
278
  ### Fee funding for fee-only actions
205
279
 
@@ -208,6 +282,8 @@ cached balance or change the receipt's supported withdrawal routes.
208
282
  - Declare `actionInput` for every token the action consumes and honour the amount passed to `buildActionCalls`: when fees come from an input, the action is built for the remainder. Declare `actionProceeds` for a token the action leaves in the wallet. Both are optional; with neither, only balances can pay. Omit `actionProceeds` when the output is delivered to another owner.
209
283
  - `feeFunding` overrides the level order per transaction, for example `["proceeds", "input", "balance"]`; the order inside the balance level is fixed. An empty list leaves the choice to the host's `selectedAsset`.
210
284
  - A `selectedAsset` on a fee-only action is an explicit host choice and funds the fee from that balance as before.
285
+ - `feeOnlyAction` alone declares the action: `amountDirection` defaults to `"output"` and `paymentAmount` to `"0"`. Explicit values still win.
286
+ - `submit()` on the controller runs the executor that matches `amountDirection`. `submitSupply()` and `submitPay()` remain for existing callers.
211
287
 
212
288
  ### Updating and releasing
213
289
 
@@ -1,2 +1,3 @@
1
1
  "use client";
2
- "use strict";const r=require("./privy-DgLAdE7U.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;
2
+ (function(){if(typeof document==="undefined"||document.getElementById("spiceflow-styles"))return;var s=document.createElement("style");s.id="spiceflow-styles";s.textContent="@keyframes spiceflow-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@media (prefers-reduced-motion:reduce){*,:after,:before{animation-duration:.001ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.001ms!important}}.spiceflow-focus-ring:focus-visible,[data-spiceflow-focus]:focus-visible{border-radius:4px;outline:2px solid currentColor;outline-offset:2px}@media (forced-colors:active){.spiceflow-focus-ring:focus-visible,[data-spiceflow-focus]:focus-visible{outline:2px solid Highlight}}.ibm-plex-mono-thin{font-weight:100}.ibm-plex-mono-extralight,.ibm-plex-mono-thin{font-family:IBM Plex Mono,monospace!important;font-style:normal}.ibm-plex-mono-extralight{font-weight:200}.ibm-plex-mono-light{font-weight:300}.ibm-plex-mono-light,.ibm-plex-mono-regular{font-family:IBM Plex Mono,monospace!important;font-style:normal}.ibm-plex-mono-regular{font-weight:400}.ibm-plex-mono-medium{font-weight:500}.ibm-plex-mono-medium,.ibm-plex-mono-semibold{font-family:IBM Plex Mono,monospace!important;font-style:normal}.ibm-plex-mono-semibold{font-weight:600}.ibm-plex-mono-bold{font-family:IBM Plex Mono,monospace!important;font-style:normal;font-weight:700}#privy-modal-content button{border-radius:6px;font-family:IBM Plex Mono,monospace!important;font-size:small;letter-spacing:-.5px;text-transform:uppercase}#privy-modal-content input{background:#fff;border-radius:6px;padding-top:5px!important}#privy-dialog-title{display:none!important;font-size:18px;padding-bottom:10px;padding-top:10px}.AppLogoContainer-sc-a206bd44-0{display:none}#privy-modal-content{background:var(--Neutral-0,#fafafa);border:6px solid var(--Neutral-1,#e9e9e9);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),0 330px 92px transparent,0 211px 84px rgba(0,0,0,.01),0 119px 71px rgba(0,0,0,.05),0 53px 53px rgba(0,0,0,.09),0 13px 29px rgba(0,0,0,.1);height:auto!important;padding-bottom:10px}.Subtitle-sc-ddbf22b4-4{font-size:12px;margin-top:-14px;opacity:.5}.StyledLink-sc-1c6127e5-0{background:none!important}.StyledLink-sc-c8577138-0,.login-method-button{font-family:IBM Plex Mono,monospace!important}.StyledLink-sc-c8577138-0{font-style:uppercase}#protected-by-privy{color:#000!important}";document.head.appendChild(s)})();
3
+ "use strict";const r=require("./privy-BG9UqWrL.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,3 @@
1
1
  "use client";
2
- import{P as g}from"./privy-TGSRGTFo.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};
2
+ (function(){if(typeof document==="undefined"||document.getElementById("spiceflow-styles"))return;var s=document.createElement("style");s.id="spiceflow-styles";s.textContent="@keyframes spiceflow-spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}@media (prefers-reduced-motion:reduce){*,:after,:before{animation-duration:.001ms!important;animation-iteration-count:1!important;scroll-behavior:auto!important;transition-duration:.001ms!important}}.spiceflow-focus-ring:focus-visible,[data-spiceflow-focus]:focus-visible{border-radius:4px;outline:2px solid currentColor;outline-offset:2px}@media (forced-colors:active){.spiceflow-focus-ring:focus-visible,[data-spiceflow-focus]:focus-visible{outline:2px solid Highlight}}.ibm-plex-mono-thin{font-weight:100}.ibm-plex-mono-extralight,.ibm-plex-mono-thin{font-family:IBM Plex Mono,monospace!important;font-style:normal}.ibm-plex-mono-extralight{font-weight:200}.ibm-plex-mono-light{font-weight:300}.ibm-plex-mono-light,.ibm-plex-mono-regular{font-family:IBM Plex Mono,monospace!important;font-style:normal}.ibm-plex-mono-regular{font-weight:400}.ibm-plex-mono-medium{font-weight:500}.ibm-plex-mono-medium,.ibm-plex-mono-semibold{font-family:IBM Plex Mono,monospace!important;font-style:normal}.ibm-plex-mono-semibold{font-weight:600}.ibm-plex-mono-bold{font-family:IBM Plex Mono,monospace!important;font-style:normal;font-weight:700}#privy-modal-content button{border-radius:6px;font-family:IBM Plex Mono,monospace!important;font-size:small;letter-spacing:-.5px;text-transform:uppercase}#privy-modal-content input{background:#fff;border-radius:6px;padding-top:5px!important}#privy-dialog-title{display:none!important;font-size:18px;padding-bottom:10px;padding-top:10px}.AppLogoContainer-sc-a206bd44-0{display:none}#privy-modal-content{background:var(--Neutral-0,#fafafa);border:6px solid var(--Neutral-1,#e9e9e9);box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),0 330px 92px transparent,0 211px 84px rgba(0,0,0,.01),0 119px 71px rgba(0,0,0,.05),0 53px 53px rgba(0,0,0,.09),0 13px 29px rgba(0,0,0,.1);height:auto!important;padding-bottom:10px}.Subtitle-sc-ddbf22b4-4{font-size:12px;margin-top:-14px;opacity:.5}.StyledLink-sc-1c6127e5-0{background:none!important}.StyledLink-sc-c8577138-0,.login-method-button{font-family:IBM Plex Mono,monospace!important}.StyledLink-sc-c8577138-0{font-style:uppercase}#protected-by-privy{color:#000!important}";document.head.appendChild(s)})();
3
+ import{P as g}from"./privy-BMB5O4hI.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};
@@ -0,0 +1,9 @@
1
+ import React from "react";
2
+ import type { SpiceDepositProps } from "../../types/deposit";
3
+ import type { SpiceWithdrawProps } from "../../types/withdraw";
4
+ import { type AccountDisplayProps } from "../AccountDisplay";
5
+ export interface SpiceAccountProps extends Omit<AccountDisplayProps, "onDepositClick" | "onWithdrawClick"> {
6
+ depositProps?: Omit<SpiceDepositProps, "isOpen" | "onClose">;
7
+ withdrawProps?: Omit<SpiceWithdrawProps, "isOpen" | "onClose" | "initialSourceAssetId">;
8
+ }
9
+ export declare const SpiceAccount: React.FC<SpiceAccountProps>;
@@ -0,0 +1,2 @@
1
+ export { SpiceAccount } from "./SpiceAccount";
2
+ export type { SpiceAccountProps } from "./SpiceAccount";
@@ -3,7 +3,7 @@ import { type Address } from "viem";
3
3
  import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
4
4
  import type { SelectedAsset } from "../../../types/assets";
5
5
  import type { ChainBatch } from "../../../types/authorization";
6
- import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
6
+ import type { DestinationTokenConfig, PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
7
7
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
8
8
  type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
9
9
  export declare function getPivotEscrowAmount(sourceSwap: Pick<ResolvedSwap, "amountOutMinimum">, gasSkim: bigint): bigint;
@@ -14,7 +14,7 @@ export interface BatchBuilderContext {
14
14
  isFeeInclusiveInput?: boolean;
15
15
  feeOnlyAction?: boolean;
16
16
  swapInputAmount?: bigint | null;
17
- destinationToken: SpiceSupplyProps["destinationToken"];
17
+ destinationToken: DestinationTokenConfig;
18
18
  embeddedWalletAddress: string | null | undefined;
19
19
  providerEmbeddedAddress: string | null | undefined;
20
20
  externalWalletAddress: string | null | undefined;
@@ -4,7 +4,7 @@ import { type Address } from "viem";
4
4
  import type { ExecutionRunner } from "../../../execution/runner";
5
5
  import type { ExecutionProgress } from "../../../hooks/useSpiceExecution";
6
6
  import type { SelectedAsset } from "../../../types/assets";
7
- import type { BuildPayBatchesFn, BuildSupplyBatchesFn, PivotRoute, SpiceSupplyProps } from "../../../types/supply";
7
+ import type { BuildPayBatchesFn, BuildSupplyBatchesFn, DestinationTokenConfig, PivotRoute, SpiceSupplyProps } from "../../../types/supply";
8
8
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
9
9
  import { type SupplyFeeQuote } from "./feePreview";
10
10
  export type SupplyStep = "idle" | "building" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
@@ -72,6 +72,7 @@ export type ExecutorContext = {
72
72
  spiceDepositSubmittedRef: MutableRefObject<boolean>;
73
73
  abortControllerRef: MutableRefObject<AbortController | null>;
74
74
  };
75
- } & Pick<SpiceSupplyProps, "destinationToken" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "onSuccess">;
75
+ destinationToken: DestinationTokenConfig;
76
+ } & Pick<SpiceSupplyProps, "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "onSuccess">;
76
77
  export declare function executeSupply(ctx: ExecutorContext): Promise<void>;
77
78
  export declare function executePay(ctx: ExecutorContext): Promise<void>;
@@ -4,7 +4,7 @@ import { type Address } from "viem";
4
4
  import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
5
5
  import type { Asset, SelectedAsset } from "../../../types/assets";
6
6
  import type { ChainBatch } from "../../../types/authorization";
7
- import type { FeeFundingSource, PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
7
+ import type { DestinationTokenConfig, FeeFundingSource, PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
8
8
  import type { FeePreview } from "../../../types/ui";
9
9
  import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
10
10
  import { type FundingConversion } from "./feeConversion";
@@ -32,7 +32,7 @@ export type SupplyFeeQuote = {
32
32
  };
33
33
  export declare function quoteDirectExternalAction(params: {
34
34
  selectedAsset: SelectedAsset;
35
- destinationToken: SpiceSupplyProps["destinationToken"];
35
+ destinationToken: DestinationTokenConfig;
36
36
  paymentAmount?: string;
37
37
  account: Address;
38
38
  beneficiary?: Address;
@@ -101,7 +101,7 @@ export interface FeePreviewContext {
101
101
  isNon7702: boolean;
102
102
  isSourceDestToken: boolean;
103
103
  currentPaymentAmount: string;
104
- destinationToken: SpiceSupplyProps["destinationToken"];
104
+ destinationToken: DestinationTokenConfig;
105
105
  feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
106
106
  resolvedTokenIn: Address | null;
107
107
  embeddedWalletAddress: string | null | undefined;
@@ -104,11 +104,13 @@ export declare function useSpiceEmbeddedWithdraw(params: {
104
104
  retryFinalization: () => void;
105
105
  fundEmbeddedSource: (amount: bigint) => Promise<void>;
106
106
  canExecute: boolean;
107
+ submit: () => Promise<void>;
107
108
  submitSupply: () => Promise<void>;
108
109
  submitPay: () => Promise<void>;
109
110
  retrySupply: () => void;
110
111
  dismissPaymentStatus: () => void;
111
112
  resolveMaxAmount: (asset: Asset) => Promise<string | null>;
113
+ max: () => Promise<string | null>;
112
114
  resetAfterSuccess: () => void;
113
115
  resetPaymentState: () => void;
114
116
  };
@@ -19,6 +19,7 @@ export type { PartnerWhitelistCheckResponse, UseIsUserWhitelistedOptions, } from
19
19
  export { isSupportedSupplyAsset, useSupplyAssets } from "./useSupplyAssets";
20
20
  export { resolveInputSupplySwapQuote, useSupplyQuote } from "./useSupplyQuote";
21
21
  export type { SupplyQuoteResult, UseSupplyQuoteOpts } from "./useSupplyQuote";
22
+ export { useSpiceAccount, type SpiceAccountMode } from "./useSpiceAccount";
22
23
  export { useSpiceInventory } from "./useSpiceInventory";
23
24
  export { useSpiceLock, type UseSpiceLockParams } from "./useSpiceLock";
24
25
  export { useSpiceSupply, type UseSpiceSupplyParams, type UseSpiceSupplyResult, } from "./useSpiceSupply";
@@ -1,10 +1,11 @@
1
1
  import { type Address } from "viem";
2
+ import type { DestinationTokenConfig, DestinationTokenDeclaration } from "../types/supply";
2
3
  export declare function useDestinationToken(params: {
3
4
  enabled: boolean;
4
5
  chainId: number;
5
6
  address?: Address;
6
7
  decimals?: number;
7
- symbol: string;
8
+ symbol?: string;
8
9
  logoURI?: string;
9
10
  }): {
10
11
  token: {
@@ -18,3 +19,7 @@ export declare function useDestinationToken(params: {
18
19
  ready: boolean;
19
20
  refresh: () => void;
20
21
  };
22
+ export declare function useDeclaredDestinationToken(declared: DestinationTokenDeclaration | undefined, enabled: boolean): {
23
+ token: DestinationTokenConfig | undefined;
24
+ error: string | null;
25
+ };
@@ -0,0 +1,12 @@
1
+ export type SpiceAccountMode = "embedded" | "external";
2
+ export declare function useSpiceAccount(): {
3
+ mode: SpiceAccountMode;
4
+ setMode: (next: SpiceAccountMode) => void | undefined;
5
+ ownerAddress: `0x${string}` | undefined;
6
+ embeddedAddress: `0x${string}` | undefined;
7
+ externalAddress: `0x${string}` | undefined;
8
+ isUserWhitelisted: boolean | null;
9
+ isWhitelistChecking: boolean;
10
+ isWhitelistGateActive: boolean;
11
+ whitelistCheck: import("./useIsUserWhitelisted").PartnerWhitelistCheckResponse | undefined;
12
+ };
@@ -3,7 +3,7 @@ import type { Asset, SelectedAsset } from "../types/assets";
3
3
  import type { DestinationTokenConfig, SpiceSupplyProps } from "../types/supply";
4
4
  export type SpiceActionSource = Asset;
5
5
  export interface UseSpiceActionOptions {
6
- destinationToken: DestinationTokenConfig;
6
+ destinationToken: DestinationTokenConfig | undefined;
7
7
  recipient?: Address;
8
8
  buildActionCalls: SpiceSupplyProps["buildActionCalls"];
9
9
  buildSpicenetBatch?: SpiceSupplyProps["buildSpicenetBatch"];
@@ -1,6 +1,6 @@
1
1
  import type { Asset, SelectedAsset } from "../types/assets";
2
2
  import type { SpiceLockModalProps } from "../types/lock";
3
- export interface UseSpiceLockParams extends Pick<SpiceLockModalProps, "lockBatches" | "lockChainId" | "lockTokenSymbol" | "lockTokenLogoURI" | "destinationTokenAddress" | "destinationTokenDecimals" | "beneficiary" | "onLockSuccess" | "onLockError" | "buildSpicenetBatch"> {
3
+ export interface UseSpiceLockParams extends Pick<SpiceLockModalProps, "lockBatches" | "lockChainId" | "lockTokenSymbol" | "lockTokenLogoURI" | "destinationTokenAddress" | "destinationTokenDecimals" | "beneficiary" | "onSubmit" | "onLockSuccess" | "onLockError" | "buildSpicenetBatch"> {
4
4
  enabled: boolean;
5
5
  selectedAsset: SelectedAsset | null;
6
6
  recoveryKey?: string;
@@ -105,11 +105,13 @@ export declare function useSpiceLock(params: UseSpiceLockParams): {
105
105
  };
106
106
  retryFinalization: () => void;
107
107
  fundEmbeddedSource: (amount: bigint) => Promise<void>;
108
+ submit: () => Promise<void>;
108
109
  submitSupply: () => Promise<void>;
109
110
  submitPay: () => Promise<void>;
110
111
  retrySupply: () => void;
111
112
  dismissPaymentStatus: () => void;
112
113
  resolveMaxAmount: (asset: Asset) => Promise<string | null>;
114
+ max: () => Promise<string | null>;
113
115
  resetAfterSuccess: () => void;
114
116
  resetPaymentState: () => void;
115
117
  };
@@ -2,10 +2,11 @@ import { type ResolvedSwap } from "@spicenet-io/spiceflow-core";
2
2
  import { type Address } from "viem";
3
3
  import { type PaymentResult, type SupplyStep } from "../components/SpiceSupply/lib/executors";
4
4
  import type { Asset, SelectedAsset } from "../types/assets";
5
- import type { SpiceSupplyProps } from "../types/supply";
5
+ import type { DestinationTokenDeclaration, SpiceSupplyProps } from "../types/supply";
6
6
  import type { FeePreview } from "../types/ui";
7
- export interface UseSpiceSupplyParams extends Pick<SpiceSupplyProps, "destinationToken" | "sourceChains" | "supportedSourceAssets" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "resolveExactOutputSwap" | "amountDirection" | "onSuccess" | "onError" | "additionalSourceTokens" | "includeExternalWalletAssets" | "includeCrossChainEmbeddedAssets" | "feeOnlyAction" | "actionInput" | "actionProceeds" | "feeFunding" | "maxSlippage" | "resolveInputSwap"> {
7
+ export interface UseSpiceSupplyParams extends Pick<SpiceSupplyProps, "sourceChains" | "supportedSourceAssets" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "resolveExactOutputSwap" | "amountDirection" | "onSubmit" | "onSuccess" | "onError" | "additionalSourceTokens" | "includeExternalWalletAssets" | "includeCrossChainEmbeddedAssets" | "feeOnlyAction" | "actionInput" | "actionProceeds" | "feeFunding" | "maxSlippage" | "resolveInputSwap"> {
8
8
  enabled: boolean;
9
+ destinationToken: DestinationTokenDeclaration | undefined;
9
10
  selectedAsset: SelectedAsset | null;
10
11
  paymentAmount?: string;
11
12
  recipient?: Address;
@@ -108,11 +109,13 @@ export declare function useSpiceSupply(params: UseSpiceSupplyParams): {
108
109
  retryFinalization: () => void;
109
110
  fundEmbeddedSource: (amount: bigint) => Promise<void>;
110
111
  canExecute: boolean;
112
+ submit: () => Promise<void>;
111
113
  submitSupply: () => Promise<void>;
112
114
  submitPay: () => Promise<void>;
113
115
  retrySupply: () => void;
114
116
  dismissPaymentStatus: () => void;
115
117
  resolveMaxAmount: (asset: Asset) => Promise<string | null>;
118
+ max: () => Promise<string | null>;
116
119
  resetAfterSuccess: () => void;
117
120
  resetPaymentState: () => void;
118
121
  };
@@ -2,6 +2,7 @@ import type { Asset } from "../types/assets";
2
2
  import type { DestinationTokenConfig } from "../types/supply";
3
3
  import { isSupportedSource } from "../utils/assetPolicy";
4
4
  import type { InventoryToken } from "../utils/inventoryStore";
5
+ export declare const NO_DESTINATION_TOKEN: DestinationTokenConfig;
5
6
  export declare function compareSupplyAssets(a: Asset & {
6
7
  _source?: string;
7
8
  }, b: Asset & {
@@ -19,8 +20,8 @@ export declare function isSpendableExternalAsset(asset: Parameters<typeof isSpen
19
20
  allowPivot?: boolean;
20
21
  }): boolean;
21
22
  export declare function useSupplyAssets(opts: {
22
- address: string | undefined;
23
- destinationToken: DestinationTokenConfig;
23
+ address?: string;
24
+ destinationToken: DestinationTokenConfig | undefined;
24
25
  supportedSourceAssets?: string[];
25
26
  sourceChains?: number[];
26
27
  enabled: boolean;
@@ -14,8 +14,8 @@ export interface UseSupplyQuoteOpts {
14
14
  decimals: number;
15
15
  chainId: number;
16
16
  };
17
- chainId: number;
18
- recipient: Address | undefined;
17
+ chainId?: number;
18
+ recipient?: Address;
19
19
  paymentAmount?: string;
20
20
  maxSlippage?: number;
21
21
  refreshIntervalMs?: number;
@@ -6,8 +6,8 @@ export declare const fetchUsdPricesForChain: (chainId: number, addresses: string
6
6
  export declare const fetchBalances: (walletAddress: Address, supportedChains?: number[], additionalTokens?: InventoryToken[], rpcOverrides?: Record<number, string>) => Promise<MultiChainBalances>;
7
7
  export interface UseAssetsConfig {
8
8
  address?: Address;
9
- supportedChains: number[];
10
- fetchBalances: typeof fetchBalances;
9
+ supportedChains?: number[];
10
+ fetchBalances?: typeof fetchBalances;
11
11
  additionalTokens?: InventoryToken[];
12
12
  enabled?: boolean;
13
13
  refreshInterval?: number;