@spicenet-io/spiceflow-ui 4.10.0-dev.20260914.0 → 4.10.0-dev.20260916.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.
- package/README.md +100 -29
- package/dist/auth-privy.js +1 -1
- package/dist/components/SpiceSupply/lib/actionProceeds.d.ts +7 -0
- package/dist/components/SpiceSupply/lib/executors.d.ts +1 -0
- package/dist/components/SpiceSupply/lib/externalAction.d.ts +3 -66
- package/dist/components/SpiceSupply/lib/feeConversion.d.ts +13 -6
- package/dist/components/SpiceSupply/lib/feeFunding.d.ts +21 -0
- package/dist/components/SpiceSupply/lib/feePreview.d.ts +14 -2
- package/dist/components/SpiceWithdraw/lib/useEmbeddedWithdraw.d.ts +1 -13
- package/dist/execution/directExecution.d.ts +11 -0
- package/dist/execution/externalWalletClient.d.ts +5 -0
- package/dist/execution/pollIntentStep.d.ts +0 -1
- package/dist/execution/sourceFunding.d.ts +11 -28
- package/dist/hooks/useSpiceExecution.d.ts +0 -3
- package/dist/hooks/useSpiceLock.d.ts +1 -13
- package/dist/hooks/useSpiceSupply.d.ts +3 -16
- package/dist/index.cjs.js +10 -10
- package/dist/index.js +8 -8
- package/dist/{privy-CfCGXtaW.js → privy-CRczPd8g.js} +1 -1
- package/dist/types/supply.d.ts +13 -4
- package/dist/utils/actionDefinition.d.ts +1 -4
- package/dist/utils/pendingDeposit.d.ts +0 -30
- package/package.json +2 -2
- package/dist/components/SpiceSupply/parts/FundingQuoteReview.d.ts +0 -6
- package/dist/components/SpiceWithdraw/parts/PendingWalletWithdrawal.d.ts +0 -10
- package/dist/execution/fundedExecution.d.ts +0 -35
- package/dist/hooks/usePendingAction.d.ts +0 -7
package/README.md
CHANGED
|
@@ -2,39 +2,78 @@
|
|
|
2
2
|
|
|
3
3
|
A React component library for building DeFi swap interfaces with multi-chain support.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Version and migration
|
|
6
|
+
|
|
7
|
+
The shared inventory/action refactor merged in PR #103. As checked September 14, 2026,
|
|
8
|
+
`4.9.6-consistency.16` is published under `consistency`; npm `latest` remains `4.9.5`.
|
|
9
|
+
Check the actual registry tag and client pin before adopting it. See
|
|
10
|
+
[CONSISTENCY-MIGRATION.md](CONSISTENCY-MIGRATION.md) for migration breaks and candidate-specific evidence.
|
|
11
|
+
A merged source change does not publish npm or upgrade consuming apps.
|
|
12
|
+
|
|
13
|
+
The unified action controller in this source restores direct external execution for a wallet asset matching the destination token and chain. Clients keep one action definition across direct and routed execution. See [the migration guide](CONSISTENCY-MIGRATION.md#unreleased-direct-external-execution-in-the-unified-controller) for scope, gas, recovery and the unpublished release status.
|
|
14
|
+
|
|
15
|
+
## Installation and provider setup
|
|
16
|
+
|
|
17
|
+
Select an approved exact version, preserving the app's dependency-age and security policies:
|
|
6
18
|
|
|
7
19
|
```bash
|
|
8
|
-
|
|
20
|
+
bun add --exact @spicenet-io/spiceflow-ui@4.9.6-consistency.16
|
|
9
21
|
```
|
|
10
22
|
|
|
11
|
-
|
|
23
|
+
The example is a prerelease selection, not a stable recommendation or a policy bypass.
|
|
24
|
+
Reuse compatible host-owned Privy, wagmi and QueryClient providers. Read the exact
|
|
25
|
+
package's peer dependencies; do not replace the wallet stack as part of a version bump.
|
|
12
26
|
|
|
13
27
|
```tsx
|
|
14
|
-
import {
|
|
28
|
+
import { SpiceFlowProvider } from "@spicenet-io/spiceflow-ui";
|
|
15
29
|
import "@spicenet-io/spiceflow-ui/styles.css";
|
|
16
30
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<SwapWidget
|
|
27
|
-
swapBatches={swapBatches}
|
|
28
|
-
supportedChains={[1, 137, 42161]}
|
|
29
|
-
showSlippageSettings={true}
|
|
30
|
-
enableFlipSwap={true}
|
|
31
|
-
theme="dark"
|
|
32
|
-
/>
|
|
33
|
-
</SpiceFlowProvider>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
31
|
+
// Inside the host's existing WagmiProvider → QueryClientProvider → PrivyProvider stack.
|
|
32
|
+
<SpiceFlowProvider
|
|
33
|
+
provider="privy"
|
|
34
|
+
network="mainnet"
|
|
35
|
+
nativeChainId={8453}
|
|
36
|
+
rpcOverrides={clientRpcUrls}
|
|
37
|
+
>
|
|
38
|
+
{children}
|
|
39
|
+
</SpiceFlowProvider>;
|
|
36
40
|
```
|
|
37
41
|
|
|
42
|
+
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.
|
|
46
|
+
|
|
47
|
+
## Integration ownership
|
|
48
|
+
|
|
49
|
+
- Use stock components when they fit the approved UI; use `useSpiceSupply` for custom
|
|
50
|
+
action forms. `useSpiceLock` and legacy `useSpiceAction` delegate to that controller.
|
|
51
|
+
- Supply destination metadata, protocol `buildActionCalls` or destination-only
|
|
52
|
+
`lockBatches`, beneficiary semantics, and awaited application updates. The SDK owns
|
|
53
|
+
inventory, routing, Max, fees, accepted plans, funding, execution and recovery.
|
|
54
|
+
- For custom holdings, use `useSpiceInventory` and `assetPositionId`. Keep raw balance,
|
|
55
|
+
default visibility and spend eligibility separate. Preserve rows during refresh;
|
|
56
|
+
stale/failed balances cannot authorize spending, and confirmed zero wins.
|
|
57
|
+
- In this unreleased source, eligible External-mode actions with a matching wallet token
|
|
58
|
+
and destination chain execute directly from the external signer, without embedded funding.
|
|
59
|
+
Other assets/chains still use embedded funding and the shared routed executor.
|
|
60
|
+
`onPayExecute` and `onLockExecute` remain blocked. `actionExecution.wallet: "external"`
|
|
61
|
+
makes the external wallet the caller of the host's calls: a matching-token source executes
|
|
62
|
+
directly; any other ERC20 input source routes the delivery to that wallet first, then the
|
|
63
|
+
wallet signs the calls (nothing persisted between the two phases). Verify contract
|
|
64
|
+
caller/beneficiary and NFT receiver behavior.
|
|
65
|
+
Published `.16` does not contain this restoration.
|
|
66
|
+
- Supply `input` adds fees to principal; `input-inclusive` uses a total budget; Pay
|
|
67
|
+
`output` fixes the destination amount. Use controller readiness/Max/status instead of
|
|
68
|
+
constructing an executor context or duplicating fee arithmetic in the host.
|
|
69
|
+
- Use controller recovery for uncertain funding and `retryFinalization()` for failed
|
|
70
|
+
application updates after settlement. Preserve original host terms across reload.
|
|
71
|
+
- Deposit and rollup Withdraw retain distinct execution semantics while sharing
|
|
72
|
+
inventory/policy. Account wallet withdrawal uses the fee-only Supply path.
|
|
73
|
+
|
|
74
|
+
Inventory isolation does not establish support for simultaneous differently configured
|
|
75
|
+
providers: underlying quote/execution transports still have global state.
|
|
76
|
+
|
|
38
77
|
## Liquidity venues
|
|
39
78
|
|
|
40
79
|
When a flow has to swap on the destination chain, the SDK quotes every liquidity
|
|
@@ -123,7 +162,7 @@ that is not in the chain's configured token list. Provider metadata still
|
|
|
123
162
|
wins when it has a logo.
|
|
124
163
|
|
|
125
164
|
```tsx
|
|
126
|
-
<AccountDisplay tokenLogos={{
|
|
165
|
+
<AccountDisplay tokenLogos={{ TOKEN: tokenLogoUrl }} />
|
|
127
166
|
```
|
|
128
167
|
|
|
129
168
|
### Withdraw from an account balance
|
|
@@ -157,12 +196,44 @@ Keep the integration's existing withdrawal batch builder and callbacks.
|
|
|
157
196
|
`initialSourceAssetId` selects a current balance by ID; it does not supply a
|
|
158
197
|
cached balance or change the receipt's supported withdrawal routes.
|
|
159
198
|
|
|
160
|
-
### Fee
|
|
199
|
+
### Action Fee Readiness
|
|
200
|
+
|
|
201
|
+
- Routed Supply, Pay and Lock actions must surface fee estimation before enabling submission.
|
|
202
|
+
- Eligible direct external actions still require an accepted plan but charge no Spicenet fee. Network gas remains payable in the external wallet; native Max reserves gas.
|
|
203
|
+
- Deposit gas and rollup withdrawal semantics remain distinct from action intent fees. Preserve their existing quote/readiness requirements.
|
|
204
|
+
- Account wallet withdrawal is a fee-only Supply action. Do not bypass its fee/readiness gates based on the label "withdraw".
|
|
205
|
+
- Custom actions use the shared controller's `canExecute`; an available balance or old quote alone is insufficient.
|
|
206
|
+
|
|
207
|
+
### Fee funding for fee-only actions
|
|
208
|
+
|
|
209
|
+
- A fee-only action (`feeOnlyAction`) runs on what the executing wallet already holds; the SDK funds only the Spicenet fees, in the chain's fee token (`destinationToken`).
|
|
210
|
+
- With no `selectedAsset`, the SDK picks the fee source and the user is never asked. The action's input (`actionInput`) comes first, then its proceeds (`actionProceeds`), so the fee stays inside the action the user submitted; then other balances: same-chain embedded wallet before rollup, and within each, balances already in the fee token before balances that swap into it. The first source that simulates and covers the fee wins and is reported as `fees.fundingSource`; a source whose swap has no route, or that cannot cover the fee within slippage, is skipped for the next.
|
|
211
|
+
- 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.
|
|
212
|
+
- `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`.
|
|
213
|
+
- A `selectedAsset` on a fee-only action is an explicit host choice and funds the fee from that balance as before.
|
|
214
|
+
|
|
215
|
+
### Updating and releasing
|
|
216
|
+
|
|
217
|
+
Change the shared inventory/policy/controller owner and audit affected stock and custom
|
|
218
|
+
consumers. Use the central team's `workflow`, `ui-quality` and `shared/sdk.md` guidance;
|
|
219
|
+
keep skills in the skills repo rather than copying them here.
|
|
220
|
+
|
|
221
|
+
Read the central `shared/client-design-decisions.md` register before an upgrade. Map
|
|
222
|
+
applicable decision IDs to affected consumers and regression scenarios, and report each
|
|
223
|
+
result with exact candidate evidence. Preserve agreed behavior and ownership even when
|
|
224
|
+
types compile; a deliberate change needs an explicit product decision and migration plan.
|
|
225
|
+
|
|
226
|
+
Run focused regressions, `bun test`, `bun run typecheck` and `bun run build`, then validate
|
|
227
|
+
affected consumer builds and rendered/financial behavior on the exact candidate. Record
|
|
228
|
+
package identity, configuration, acceptance coverage and untested cases. Earlier candidate
|
|
229
|
+
results do not automatically apply to newer main or a new client.
|
|
161
230
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
231
|
+
If core/API changes are needed, resolve those dependencies before their UI/app consumers.
|
|
232
|
+
An inventory/controller-only change does not inherently require a core release. After
|
|
233
|
+
explicit release authorization, publish a prerelease with a non-`latest` tag, verify its
|
|
234
|
+
registry artifact, and pin/test that exact version in each adopting app. Stable promotion,
|
|
235
|
+
client deployment and docs targeting are separate release decisions. This refactor adds
|
|
236
|
+
no automatic npm publishing.
|
|
166
237
|
|
|
167
238
|
### Building the Library
|
|
168
239
|
|
package/dist/auth-privy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{P as g}from"./privy-
|
|
2
|
+
import{P as g}from"./privy-CRczPd8g.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,6 +2,11 @@ import { type Address } from "viem";
|
|
|
2
2
|
import type { ChainBatch } from "../../../types/authorization";
|
|
3
3
|
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
4
4
|
import type { SupplyFeeQuote } from "./feePreview";
|
|
5
|
+
export declare class InsufficientFeeFundingBalanceError extends Error {
|
|
6
|
+
readonly requiredAmount: bigint;
|
|
7
|
+
readonly balance: bigint;
|
|
8
|
+
constructor(requiredAmount: bigint, balance: bigint);
|
|
9
|
+
}
|
|
5
10
|
export declare function appendProceedsFees(batches: ChainBatch[], owner: Address, token: Address, gas: bigint, platform: bigint): ChainBatch[];
|
|
6
11
|
export declare function simulateProceedsBatch(batches: ChainBatch[], owner: Address, token: Address, signal?: AbortSignal, platformFeeMaximum?: bigint): Promise<bigint>;
|
|
7
12
|
export declare function estimateProceedsFunding(args: {
|
|
@@ -11,4 +16,6 @@ export declare function estimateProceedsFunding(args: {
|
|
|
11
16
|
signal?: AbortSignal;
|
|
12
17
|
baseline: () => Promise<SupplyFeeQuote | null>;
|
|
13
18
|
buildBatches: (amount: bigint, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
19
|
+
fundShortfall?: boolean;
|
|
20
|
+
actionAmountFor?: (fee: bigint) => bigint;
|
|
14
21
|
}): Promise<SupplyFeeQuote>;
|
|
@@ -1,68 +1,5 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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 | 3;
|
|
30
|
-
fundingIdentity?: string;
|
|
31
|
-
actionIdentity?: string;
|
|
32
|
-
scope: string;
|
|
33
|
-
destinationToken: Address;
|
|
34
|
-
destinationDecimals: number;
|
|
35
|
-
sourceKey: string;
|
|
36
|
-
phase: ExternalActionProgress["phase"];
|
|
37
|
-
amount?: string;
|
|
38
|
-
calls?: StoredCall[];
|
|
39
|
-
confirmedCalls: number;
|
|
40
|
-
sourceFunding?: SourceFundingState;
|
|
41
|
-
pendingCall?: PendingTransaction;
|
|
42
|
-
routeSubmitted: boolean;
|
|
43
|
-
route?: {
|
|
44
|
-
actionId: string;
|
|
45
|
-
intentId: string;
|
|
46
|
-
intentIndex: number;
|
|
47
|
-
spicenetSteps: boolean[];
|
|
48
|
-
};
|
|
49
|
-
lastHash?: `0x${string}`;
|
|
50
|
-
}
|
|
51
|
-
export declare function externalActionScope(network: string, chainId: number, external: string, embedded: string, recoveryKey: string): string;
|
|
52
|
-
export declare function readExternalAction(scope: string): ExternalActionRecord | null;
|
|
53
|
-
export declare function externalActionProgress(record: ExternalActionRecord): ExternalActionProgress;
|
|
54
|
-
export declare function reconcileExternalFunding(scope: string): Promise<boolean>;
|
|
55
|
-
export declare function clearCompletedExternalAction(scope: string): void;
|
|
2
|
+
import type { Call, ChainBatch } from "../../../types/authorization";
|
|
3
|
+
import type { BuildActionCallsContext } from "../../../types/supply";
|
|
56
4
|
export declare function buildExternalDeliveryCalls(amount: bigint, context: BuildActionCallsContext, recipient: Address): Call[];
|
|
57
|
-
export declare function
|
|
58
|
-
scope: string;
|
|
59
|
-
recovery?: "resume" | "balance";
|
|
60
|
-
ctx: ExecutorContext;
|
|
61
|
-
buildActionCalls: SpiceSupplyProps["buildActionCalls"];
|
|
62
|
-
onRecord: (record: ExternalActionRecord | null) => void;
|
|
63
|
-
isCurrent?: () => boolean;
|
|
64
|
-
fundingIdentity: string;
|
|
65
|
-
actionIdentity: string;
|
|
66
|
-
resumeRoute: () => Promise<string>;
|
|
67
|
-
}): Promise<void>;
|
|
68
|
-
export {};
|
|
5
|
+
export declare function externalDeliveryAmount(batches: ChainBatch[], token: Address, chainId: number, recipient: Address): bigint;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
3
|
+
export { InsufficientFeeFundingBalanceError } from "./actionProceeds";
|
|
2
4
|
import type { FeePreviewContext, SupplyFeeQuote } from "./feePreview";
|
|
3
5
|
export declare function resolveFeeFundingToken(asset: NonNullable<FeePreviewContext["selectedAsset"]>["asset"], chainId: number, feeToken: Address): Address | null;
|
|
4
6
|
export interface FundingConversion {
|
|
@@ -8,10 +10,15 @@ export interface FundingConversion {
|
|
|
8
10
|
amountOut: bigint;
|
|
9
11
|
sourceAmountMax: bigint;
|
|
10
12
|
fromProceeds?: boolean;
|
|
13
|
+
fromInput?: boolean;
|
|
11
14
|
}
|
|
12
|
-
export declare
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
export declare function simulateInPlaceFees(ctx: FeePreviewContext, owner: Address, tokenOut: Address, batches: ChainBatch[]): Promise<{
|
|
16
|
+
gasFee: bigint;
|
|
17
|
+
gasQuoteSource: string;
|
|
18
|
+
simulationVerified?: boolean;
|
|
19
|
+
platformFee?: bigint;
|
|
20
|
+
}>;
|
|
21
|
+
export declare function quoteConvertedFees(ctx: FeePreviewContext, input?: {
|
|
22
|
+
token: Address;
|
|
23
|
+
amount: bigint;
|
|
24
|
+
}): Promise<SupplyFeeQuote>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { Asset } from "../../../types/assets";
|
|
3
|
+
import type { FeeFundingLevel, FeeFundingSource, SpiceSupplyProps } from "../../../types/supply";
|
|
4
|
+
import type { FeePreviewContext, SupplyFeeQuote } from "./feePreview";
|
|
5
|
+
export declare const DEFAULT_FEE_FUNDING: FeeFundingLevel[];
|
|
6
|
+
type Candidate = FeeFundingSource & {
|
|
7
|
+
swap: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function rankFeeFundingCandidates(args: {
|
|
10
|
+
feeToken: Address;
|
|
11
|
+
chainId: number;
|
|
12
|
+
inputs?: SpiceSupplyProps["actionInput"];
|
|
13
|
+
proceeds?: {
|
|
14
|
+
token: Address;
|
|
15
|
+
amount: bigint;
|
|
16
|
+
};
|
|
17
|
+
balances: Asset[];
|
|
18
|
+
order?: FeeFundingLevel[];
|
|
19
|
+
}): Candidate[];
|
|
20
|
+
export declare function quoteFeeFunding(ctx: FeePreviewContext, estimateFeePreview: (ctx: FeePreviewContext) => Promise<SupplyFeeQuote | null>): Promise<SupplyFeeQuote | null>;
|
|
21
|
+
export {};
|
|
@@ -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 { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
7
|
+
import type { 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";
|
|
@@ -14,6 +14,7 @@ type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<Chain
|
|
|
14
14
|
export type SupplyFeeQuote = {
|
|
15
15
|
actionDefinition?: Parameters<NonNullable<SupplyBatchBuildOptions["onActionCalls"]>>[0];
|
|
16
16
|
fundingConversion?: FundingConversion;
|
|
17
|
+
fundingSource?: FeeFundingSource;
|
|
17
18
|
fundingBatches?: ChainBatch[];
|
|
18
19
|
proceedsAvailable?: bigint;
|
|
19
20
|
proceedsUsed?: bigint;
|
|
@@ -24,12 +25,20 @@ export type SupplyFeeQuote = {
|
|
|
24
25
|
swapInputAmount?: bigint;
|
|
25
26
|
destinationAmount?: bigint;
|
|
26
27
|
sourceSpendCap?: bigint;
|
|
27
|
-
expiresAt?: number;
|
|
28
28
|
preview: FeePreview;
|
|
29
29
|
feeEstimate: FeeEstimateSummary | null;
|
|
30
30
|
grossFundingAmount?: bigint;
|
|
31
31
|
sourceGasSkim?: bigint;
|
|
32
32
|
};
|
|
33
|
+
export declare function quoteDirectExternalAction(params: {
|
|
34
|
+
selectedAsset: SelectedAsset;
|
|
35
|
+
destinationToken: SpiceSupplyProps["destinationToken"];
|
|
36
|
+
paymentAmount?: string;
|
|
37
|
+
account: Address;
|
|
38
|
+
beneficiary?: Address;
|
|
39
|
+
buildActionCalls: SpiceSupplyProps["buildActionCalls"];
|
|
40
|
+
feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
|
|
41
|
+
}): Promise<SupplyFeeQuote>;
|
|
33
42
|
export declare function sizePivotSourceGasSkim(params: {
|
|
34
43
|
user: Address;
|
|
35
44
|
pivot: PivotRoute;
|
|
@@ -78,7 +87,10 @@ export interface FeePreviewContext {
|
|
|
78
87
|
maxSlippage?: number;
|
|
79
88
|
resolveExactOutputSwap?: SpiceSupplyProps["resolveExactOutputSwap"];
|
|
80
89
|
feeOnlyAction?: boolean;
|
|
90
|
+
actionInput?: SpiceSupplyProps["actionInput"];
|
|
81
91
|
actionProceeds?: SpiceSupplyProps["actionProceeds"];
|
|
92
|
+
feeFunding?: SpiceSupplyProps["feeFunding"];
|
|
93
|
+
feeFundingBalances?: Asset[];
|
|
82
94
|
signal?: AbortSignal;
|
|
83
95
|
selectedAsset: SelectedAsset | null;
|
|
84
96
|
isPayMode: boolean;
|
|
@@ -14,12 +14,6 @@ export declare function useSpiceEmbeddedWithdraw(params: {
|
|
|
14
14
|
}): {
|
|
15
15
|
supply: {
|
|
16
16
|
selectedAsset: import("../../..").SelectedAsset | null;
|
|
17
|
-
fundingQuoteReview: {
|
|
18
|
-
previousMinimum: bigint;
|
|
19
|
-
minimum: bigint;
|
|
20
|
-
accepting: boolean;
|
|
21
|
-
accept: () => Promise<void>;
|
|
22
|
-
} | null;
|
|
23
17
|
capability: {
|
|
24
18
|
eligible: boolean;
|
|
25
19
|
reason: string | null;
|
|
@@ -68,6 +62,7 @@ export declare function useSpiceEmbeddedWithdraw(params: {
|
|
|
68
62
|
};
|
|
69
63
|
fees: {
|
|
70
64
|
fundingConversion: import("../../SpiceSupply/lib/feeConversion").FundingConversion | undefined;
|
|
65
|
+
fundingSource: import("../../../types/supply").FeeFundingSource | undefined;
|
|
71
66
|
proceedsUsed: bigint | undefined;
|
|
72
67
|
fundingShortfall: bigint | undefined;
|
|
73
68
|
source: {
|
|
@@ -93,15 +88,8 @@ export declare function useSpiceEmbeddedWithdraw(params: {
|
|
|
93
88
|
feesExceedAmount: boolean;
|
|
94
89
|
};
|
|
95
90
|
status: {
|
|
96
|
-
sourceFunding: {
|
|
97
|
-
matchesPurpose: boolean;
|
|
98
|
-
matchesSelection: boolean;
|
|
99
|
-
phase: "funding" | "routing" | "complete";
|
|
100
|
-
amount: string;
|
|
101
|
-
} | null;
|
|
102
91
|
finalizing: boolean;
|
|
103
92
|
finalizationError: string | null;
|
|
104
|
-
externalAction: import("../../SpiceSupply/lib/externalAction").ExternalActionProgress | null;
|
|
105
93
|
step: import("../../..").SupplyStep;
|
|
106
94
|
statusMsg: string;
|
|
107
95
|
txHash: string | null;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { ActionDefinition } from "../utils/actionDefinition";
|
|
3
|
+
export declare function executeDirectCalls(params: {
|
|
4
|
+
definition: ActionDefinition;
|
|
5
|
+
account: Address;
|
|
6
|
+
chainId: number;
|
|
7
|
+
wallet?: {
|
|
8
|
+
getEthereumProvider: () => Promise<any>;
|
|
9
|
+
} | null;
|
|
10
|
+
assertCurrent: () => void | Promise<void>;
|
|
11
|
+
}): Promise<string>;
|
|
@@ -28,3 +28,8 @@ export declare function sendCallsWithExternalWallet(params: {
|
|
|
28
28
|
errorMessage: string;
|
|
29
29
|
observer?: TransactionObserver;
|
|
30
30
|
}): Promise<`0x${string}` | undefined>;
|
|
31
|
+
export declare function estimateExternalCallsGas(params: {
|
|
32
|
+
client: any;
|
|
33
|
+
account: Address;
|
|
34
|
+
calls: Call[];
|
|
35
|
+
}): Promise<bigint>;
|
|
@@ -19,7 +19,6 @@ type PollIntentStepOptions = {
|
|
|
19
19
|
};
|
|
20
20
|
export declare function pollIntentStepUntilSuccess(options: PollIntentStepOptions): Promise<string | undefined>;
|
|
21
21
|
export declare function runAllIntentSteps(options: {
|
|
22
|
-
resume?: boolean;
|
|
23
22
|
actionId: string;
|
|
24
23
|
intentIndex: number;
|
|
25
24
|
intentId: string;
|
|
@@ -1,29 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
export declare function isSourceFundingState(value: unknown): value is SourceFundingState;
|
|
14
|
-
export declare function fundSelectedExternalSource(params: {
|
|
15
|
-
identity: string;
|
|
16
|
-
state?: SourceFundingState;
|
|
17
|
-
onState: (state: SourceFundingState) => void;
|
|
18
|
-
createWallet: () => Promise<{
|
|
19
|
-
extWc: any;
|
|
20
|
-
viemChain?: any;
|
|
21
|
-
}>;
|
|
22
|
-
sourceClient: any;
|
|
23
|
-
recipient: Address;
|
|
24
|
-
tokenAddr: Address;
|
|
25
|
-
isNative: boolean;
|
|
26
|
-
requiredAmount: bigint;
|
|
27
|
-
reconcileOnly?: boolean;
|
|
28
|
-
observer?: TransactionObserver;
|
|
1
|
+
import type { Address } from "viem";
|
|
2
|
+
import type { Asset } from "../types/assets";
|
|
3
|
+
export declare function fundEmbeddedFromExternal(params: {
|
|
4
|
+
asset: Asset;
|
|
5
|
+
embedded: Address;
|
|
6
|
+
external?: Address;
|
|
7
|
+
externalWallet?: {
|
|
8
|
+
getEthereumProvider: () => Promise<any>;
|
|
9
|
+
} | null;
|
|
10
|
+
amount: bigint;
|
|
11
|
+
assertCurrent: () => void | Promise<void>;
|
|
29
12
|
}): Promise<void>;
|
|
@@ -18,11 +18,8 @@ export type OnProgress = (progress: ExecutionProgress) => void;
|
|
|
18
18
|
export interface ExecutionOptions {
|
|
19
19
|
requireDestinationReceipt?: boolean;
|
|
20
20
|
prepareForSigning?: (chainBatches: ChainBatch[]) => Promise<ChainBatch[]>;
|
|
21
|
-
prepareAfterAuthorization?: (chainBatches: ChainBatch[]) => Promise<ChainBatch[]>;
|
|
22
21
|
resolveActionOutputCredits?: () => Promise<ActionOutputCredit[]>;
|
|
23
22
|
validateBeforeSubmit?: (batches: ChainBatch[]) => void | Promise<void>;
|
|
24
|
-
beforeActionSubmit?: () => void | Promise<void>;
|
|
25
|
-
onActionCreated?: (intentId: string, stepCount: number, recovery: NonNullable<import("../utils/pendingDeposit").PendingDepositRecord["actionFunding"]>["recovery"]) => void;
|
|
26
23
|
depositToEscrow?: {
|
|
27
24
|
token: Address;
|
|
28
25
|
amount: bigint;
|
|
@@ -44,12 +44,6 @@ export declare function useSpiceLock(params: UseSpiceLockParams): {
|
|
|
44
44
|
metadataError: string | null;
|
|
45
45
|
canExecute: boolean;
|
|
46
46
|
selectedAsset: SelectedAsset | null;
|
|
47
|
-
fundingQuoteReview: {
|
|
48
|
-
previousMinimum: bigint;
|
|
49
|
-
minimum: bigint;
|
|
50
|
-
accepting: boolean;
|
|
51
|
-
accept: () => Promise<void>;
|
|
52
|
-
} | null;
|
|
53
47
|
capability: {
|
|
54
48
|
eligible: boolean;
|
|
55
49
|
reason: string | null;
|
|
@@ -70,6 +64,7 @@ export declare function useSpiceLock(params: UseSpiceLockParams): {
|
|
|
70
64
|
};
|
|
71
65
|
fees: {
|
|
72
66
|
fundingConversion: import("../components/SpiceSupply/lib/feeConversion").FundingConversion | undefined;
|
|
67
|
+
fundingSource: import("../types/supply").FeeFundingSource | undefined;
|
|
73
68
|
proceedsUsed: bigint | undefined;
|
|
74
69
|
fundingShortfall: bigint | undefined;
|
|
75
70
|
source: {
|
|
@@ -95,15 +90,8 @@ export declare function useSpiceLock(params: UseSpiceLockParams): {
|
|
|
95
90
|
feesExceedAmount: boolean;
|
|
96
91
|
};
|
|
97
92
|
status: {
|
|
98
|
-
sourceFunding: {
|
|
99
|
-
matchesPurpose: boolean;
|
|
100
|
-
matchesSelection: boolean;
|
|
101
|
-
phase: "funding" | "routing" | "complete";
|
|
102
|
-
amount: string;
|
|
103
|
-
} | null;
|
|
104
93
|
finalizing: boolean;
|
|
105
94
|
finalizationError: string | null;
|
|
106
|
-
externalAction: import("../components/SpiceSupply/lib/externalAction").ExternalActionProgress | null;
|
|
107
95
|
step: import("..").SupplyStep;
|
|
108
96
|
statusMsg: string;
|
|
109
97
|
txHash: string | null;
|
|
@@ -4,27 +4,20 @@ import { type PaymentResult, type SupplyStep } from "../components/SpiceSupply/l
|
|
|
4
4
|
import type { Asset, SelectedAsset } from "../types/assets";
|
|
5
5
|
import type { 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" | "
|
|
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"> {
|
|
8
8
|
enabled: boolean;
|
|
9
9
|
selectedAsset: SelectedAsset | null;
|
|
10
10
|
paymentAmount?: string;
|
|
11
11
|
recipient?: Address;
|
|
12
12
|
isZeroAmountPay?: boolean;
|
|
13
|
-
sourceFundingRecoveryKey?: string;
|
|
14
13
|
actionExecution?: {
|
|
15
14
|
wallet: "external";
|
|
16
|
-
recoveryKey
|
|
15
|
+
recoveryKey?: string;
|
|
17
16
|
};
|
|
18
17
|
prependSourceEscrow?: boolean;
|
|
19
18
|
}
|
|
20
19
|
export declare function useSpiceSupply(params: UseSpiceSupplyParams): {
|
|
21
20
|
selectedAsset: SelectedAsset | null;
|
|
22
|
-
fundingQuoteReview: {
|
|
23
|
-
previousMinimum: bigint;
|
|
24
|
-
minimum: bigint;
|
|
25
|
-
accepting: boolean;
|
|
26
|
-
accept: () => Promise<void>;
|
|
27
|
-
} | null;
|
|
28
21
|
capability: {
|
|
29
22
|
eligible: boolean;
|
|
30
23
|
reason: string | null;
|
|
@@ -73,6 +66,7 @@ export declare function useSpiceSupply(params: UseSpiceSupplyParams): {
|
|
|
73
66
|
};
|
|
74
67
|
fees: {
|
|
75
68
|
fundingConversion: import("../components/SpiceSupply/lib/feeConversion").FundingConversion | undefined;
|
|
69
|
+
fundingSource: import("../types/supply").FeeFundingSource | undefined;
|
|
76
70
|
proceedsUsed: bigint | undefined;
|
|
77
71
|
fundingShortfall: bigint | undefined;
|
|
78
72
|
source: {
|
|
@@ -98,15 +92,8 @@ export declare function useSpiceSupply(params: UseSpiceSupplyParams): {
|
|
|
98
92
|
feesExceedAmount: boolean;
|
|
99
93
|
};
|
|
100
94
|
status: {
|
|
101
|
-
sourceFunding: {
|
|
102
|
-
matchesPurpose: boolean;
|
|
103
|
-
matchesSelection: boolean;
|
|
104
|
-
phase: "funding" | "routing" | "complete";
|
|
105
|
-
amount: string;
|
|
106
|
-
} | null;
|
|
107
95
|
finalizing: boolean;
|
|
108
96
|
finalizationError: string | null;
|
|
109
|
-
externalAction: import("../components/SpiceSupply/lib/externalAction").ExternalActionProgress | null;
|
|
110
97
|
step: SupplyStep;
|
|
111
98
|
statusMsg: string;
|
|
112
99
|
txHash: string | null;
|