@spicenet-io/spiceflow-ui 4.23.2-fee-conversion.0 → 4.23.2-prefund.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 +33 -21
- package/dist/auth-privy.cjs +1 -1
- package/dist/auth-privy.js +1 -1
- package/dist/components/SpiceDeposit/lib/normalizedCredit.d.ts +2 -0
- package/dist/components/SpiceDeposit/steps/NormalizedDepositModal.d.ts +6 -0
- package/dist/components/SpiceSupply/lib/actionProceeds.d.ts +2 -1
- package/dist/components/SpiceSupply/lib/buildBatches.d.ts +1 -0
- package/dist/components/SpiceSupply/lib/feeConversion.d.ts +1 -1
- package/dist/components/SpiceSupply/lib/feePreview.d.ts +1 -0
- package/dist/execution/conditionalBundle.d.ts +29 -0
- package/dist/hooks/useSpiceConditionalIntents.d.ts +3 -1
- package/dist/hooks/useSpiceLimitOrders.d.ts +2 -0
- package/dist/hooks/useSpiceSupply.d.ts +1 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +1 -3
- package/dist/index.js +7 -7
- package/dist/privy-BJ_OA9ve.js +2 -0
- package/dist/privy-CBW14wMQ.cjs +1 -0
- package/dist/types/conditionalIntents.d.ts +28 -0
- package/dist/types/deposit.d.ts +2 -0
- package/dist/utils/crossChainRouter/venueConfig.d.ts +0 -5
- package/package.json +1 -1
- package/dist/privy-CDtAaiTV.js +0 -2
- package/dist/privy-D01MvNL9.cjs +0 -1
- package/dist/utils/crossChainRouter/metric.d.ts +0 -93
package/README.md
CHANGED
|
@@ -125,8 +125,8 @@ providers: underlying quote/execution transports still have global state.
|
|
|
125
125
|
|
|
126
126
|
When a flow has to swap on the destination chain, the SDK quotes every liquidity
|
|
127
127
|
venue that covers that chain and takes the best fill: the most output on a
|
|
128
|
-
supply, the least input on a pay. Routing is decided
|
|
129
|
-
|
|
128
|
+
supply, the least input on a pay. Routing is decided here, on your RPC. The
|
|
129
|
+
solver only executes the calls the winning quote produced.
|
|
130
130
|
|
|
131
131
|
Leave `liquidityVenues` off and you get the built-in venues. Declare it once on
|
|
132
132
|
the provider to add your own, and every component picks them up.
|
|
@@ -166,24 +166,6 @@ spacings) and hub currencies.
|
|
|
166
166
|
| `uniswap-v3` | `chainId`, `swapRouter`, `quoterV2` | `name`, `feeTiers`, `hubCurrencies`, `routerHasDeadline` |
|
|
167
167
|
| `uniswap-v4` | `chainId`, `quoter`, `universalRouter`, `permit2` | `name`, `hubCurrencies` |
|
|
168
168
|
| `aerodrome-slipstream` | `chainId`, `swapRouter`, `quoterV2` | `name`, `tickSpacings`, `hubCurrencies` |
|
|
169
|
-
| `metric` | `chainId` | `name`, `apiUrl`, `swapRouter` |
|
|
170
|
-
|
|
171
|
-
Metric uses the tx API's `/liquidity/metric` proxy when running inside
|
|
172
|
-
`SpiceFlowProvider`, derived from its existing `apiUrl`. The backend injects
|
|
173
|
-
`METRIC_API_KEY`; no credential is included in the browser or SDK config.
|
|
174
|
-
Deploy the backend proxy and configure its secret before adopting this SDK.
|
|
175
|
-
|
|
176
|
-
Partner defaults cover Ethereum, BSC, Polygon, Monad, HyperEVM, MegaETH,
|
|
177
|
-
Robinhood, Base, Arbitrum, and Avalanche. This adds venue coverage only: the
|
|
178
|
-
app's supported chains, token policy and `includeDefaults: false` remain intact.
|
|
179
|
-
Standalone factories without a proxy retain the three public-chain defaults.
|
|
180
|
-
Set `liquidityVenues.metricApiUrl` to override the proxy base URL, or set a
|
|
181
|
-
Metric venue's `apiUrl` for that individual venue. Both exact-input and
|
|
182
|
-
exact-output use the same proxy and selected-pool metadata. Split routes are
|
|
183
|
-
not requested; the SDK encodes v1 router calls with recipient/slippage bounds.
|
|
184
|
-
A quote is not execution proof: pool extensions and oracle freshness can reject
|
|
185
|
-
a swap, and Ethereum conditional-update pools require compatible submission
|
|
186
|
-
ordering. Verify the actual caller and submission path before release.
|
|
187
169
|
|
|
188
170
|
`name` is the label shown to the user as "via <name>" once a swap is quoted, so
|
|
189
171
|
give it the name people know the venue by. It defaults to the protocol, which
|
|
@@ -385,13 +367,39 @@ a failed application callback after the external action has confirmed.
|
|
|
385
367
|
- `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.
|
|
386
368
|
- `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.
|
|
387
369
|
|
|
370
|
+
### USDC cash deposits
|
|
371
|
+
|
|
372
|
+
In 7702 mode, `<SpiceDeposit normalizeToUsdc />` converts non-USDC wallet
|
|
373
|
+
assets into the source chain's supported USDC and deposits the result into
|
|
374
|
+
escrow. This opt-in is for standalone Add cash flows. It uses the existing
|
|
375
|
+
source chooser, Supply quote/execution controller and backend recovery. It
|
|
376
|
+
keeps ordinary supported-USDC deposits on the existing gas-only deposit path.
|
|
377
|
+
Other wallet modes and consumers that omit the option retain their defaults.
|
|
378
|
+
|
|
379
|
+
Conversions include quoted conversion/intent fees within the entered source
|
|
380
|
+
budget. The form shows the minimum USDC cash received before submission.
|
|
381
|
+
Conversion success requires a successful USDC transfer from the embedded wallet
|
|
382
|
+
to the configured escrow and observed rollup credit; delayed credit can be
|
|
383
|
+
checked again without executing the transaction again. Do not combine this
|
|
384
|
+
standalone cash option with `depositBatches` or `onDepositExecute` actions.
|
|
385
|
+
|
|
386
|
+
Local rehearsal: `bun test tests/hooks/useSpiceSupply.test.tsx --test-name-pattern
|
|
387
|
+
'normalizes a deposit'` (external source, embedded source, delayed credit and
|
|
388
|
+
wallet-only receipt). Receipt negatives are in
|
|
389
|
+
`tests/components/SpiceDeposit/normalizedCredit.test.ts`. These offline fixtures
|
|
390
|
+
do not establish funded dev acceptance or live liquidity.
|
|
391
|
+
|
|
388
392
|
### Combined Cash balance
|
|
389
393
|
|
|
390
394
|
`SpiceDeposit` opens a new Add cash flow by default, even when the embedded
|
|
391
395
|
wallet holds leftover funds. With combined Cash enabled, those funds remain
|
|
392
396
|
available to Cash actions.
|
|
393
397
|
Clients that still need the legacy incomplete-deposit prompt can set
|
|
394
|
-
`skipRecovery={false}
|
|
398
|
+
`skipRecovery={false}`. This also discovers existing escrow-eligible wallet balances
|
|
399
|
+
by default. Set `discoverWalletBalances={false}` alongside `skipRecovery={false}`
|
|
400
|
+
to retain recorded incomplete-deposit recovery without prompting to deposit
|
|
401
|
+
ordinary wallet inventory. This option does not disable execution recovery or
|
|
402
|
+
change explicit deposits.
|
|
395
403
|
|
|
396
404
|
Set `combineSourceBalances: true` on `SpiceSupply`, `SpiceLock`, `useSpiceSupply`,
|
|
397
405
|
`useSpiceLock` or `useSpiceAction` to show a token in the embedded wallet and its
|
|
@@ -715,3 +723,7 @@ The playground will automatically pick up the new example and display it as a ta
|
|
|
715
723
|
## License
|
|
716
724
|
|
|
717
725
|
MIT
|
|
726
|
+
|
|
727
|
+
### Stocks prerelease line
|
|
728
|
+
|
|
729
|
+
Stocks prereleases accumulate on `update/stocks-prerelease` and publish under the npm `stocks` tag (`4.23.2-stocks.N`). Continue from the latest published commit on that branch and preserve all preceding Stocks changes, including deposit discovery/loading, normalized cash conversion/recovery and combined wallet/escrow funding. Do not restart a Stocks fix from main or publish it as an isolated fix line. Consumers pin the verified exact version; eventual main integration includes the entire cumulative branch.
|
package/dist/auth-privy.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(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)})();
|
|
2
|
-
"use strict";const r=require("./privy-
|
|
2
|
+
"use strict";const r=require("./privy-CBW14wMQ.cjs");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;
|
package/dist/auth-privy.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
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-
|
|
3
|
+
import{P as g}from"./privy-BJ_OA9ve.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,6 @@
|
|
|
1
|
+
import type { Asset } from "../../../types/assets";
|
|
2
|
+
import type { SpiceDepositProps } from "../../../types/deposit";
|
|
3
|
+
export declare function NormalizedDepositModal({ asset, recovery, isOpen, onClose, styles, closeOnBackdropClick, onDepositAmountChange, onSubmit, onDepositSuccess, onDepositError, }: Pick<SpiceDepositProps, "isOpen" | "onClose" | "styles" | "closeOnBackdropClick" | "onDepositAmountChange" | "onSubmit" | "onDepositSuccess" | "onDepositError"> & {
|
|
4
|
+
asset: Asset;
|
|
5
|
+
recovery: boolean;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,12 +8,13 @@ export declare class InsufficientFeeFundingBalanceError extends Error {
|
|
|
8
8
|
constructor(requiredAmount: bigint, balance: bigint);
|
|
9
9
|
}
|
|
10
10
|
export declare function appendProceedsFees(batches: ChainBatch[], owner: Address, token: Address, gas: bigint, platform: bigint): ChainBatch[];
|
|
11
|
-
export declare function simulateProceedsBatch(batches: ChainBatch[], owner: Address, token: Address, signal?: AbortSignal, platformFeeMaximum?: bigint): Promise<bigint>;
|
|
11
|
+
export declare function simulateProceedsBatch(batches: ChainBatch[], owner: Address, token: Address, signal?: AbortSignal, platformFeeMaximum?: bigint, prefundedPreview?: boolean): Promise<bigint>;
|
|
12
12
|
export declare function estimateProceedsFunding(args: {
|
|
13
13
|
proceeds: ActionProceeds;
|
|
14
14
|
owner: Address;
|
|
15
15
|
token: Address;
|
|
16
16
|
signal?: AbortSignal;
|
|
17
|
+
prefundedPreview?: boolean;
|
|
17
18
|
baseline: () => Promise<SupplyFeeQuote | null>;
|
|
18
19
|
buildBatches: (amount: bigint, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
19
20
|
fundShortfall?: boolean;
|
|
@@ -14,6 +14,7 @@ export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, t
|
|
|
14
14
|
export interface BatchBuilderContext {
|
|
15
15
|
combinedSourceGroup?: CombinedSourceGroup;
|
|
16
16
|
currentPaymentAmount: string;
|
|
17
|
+
convertBeforeEscrow?: boolean;
|
|
17
18
|
isFeeInclusiveInput?: boolean;
|
|
18
19
|
feeOnlyAction?: boolean;
|
|
19
20
|
swapInputAmount?: bigint | null;
|
|
@@ -12,7 +12,7 @@ export interface FundingConversion {
|
|
|
12
12
|
fromProceeds?: boolean;
|
|
13
13
|
fromInput?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare function simulateInPlaceFees(ctx: Pick<FeePreviewContext, "signal">, owner: Address, tokenOut: Address, batches: ChainBatch[]): Promise<{
|
|
15
|
+
export declare function simulateInPlaceFees(ctx: Pick<FeePreviewContext, "signal" | "prefundedPreview">, owner: Address, tokenOut: Address, batches: ChainBatch[]): Promise<{
|
|
16
16
|
gasFee: bigint;
|
|
17
17
|
gasQuoteSource: string;
|
|
18
18
|
simulationVerified?: boolean;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type Address } from "viem";
|
|
2
|
+
import type { ConditionalBundleDraft, ConditionalBundleStep } from "../types/conditionalIntents";
|
|
3
|
+
import type { Asset } from "../types/assets";
|
|
4
|
+
import type { ChainBatch } from "../types/authorization";
|
|
5
|
+
import { type FeePreviewContext } from "../components/SpiceSupply/lib/feePreview";
|
|
6
|
+
export declare function bundleFunding(steps: ConditionalBundleStep[]): {
|
|
7
|
+
required: Map<`0x${string}`, bigint>;
|
|
8
|
+
net: Map<`0x${string}`, bigint>;
|
|
9
|
+
consumedBalances: Set<`0x${string}`>;
|
|
10
|
+
};
|
|
11
|
+
export declare function prepareConditionalBundleBatches(input: ConditionalBundleDraft, owner: Address, balances: Asset[], estimate: FeePreviewContext["estimate"]): Promise<{
|
|
12
|
+
batches: ChainBatch[];
|
|
13
|
+
walletRequirements: Map<`0x${string}`, bigint>;
|
|
14
|
+
validateQuotes: () => Promise<void>;
|
|
15
|
+
actionOutputCredits: {
|
|
16
|
+
chainId: number;
|
|
17
|
+
token: `0x${string}`;
|
|
18
|
+
amount: bigint;
|
|
19
|
+
}[];
|
|
20
|
+
swapAmountIn: bigint | undefined;
|
|
21
|
+
feeFundingSource: import("../types/supply").FeeFundingSource | undefined;
|
|
22
|
+
feeSourceAmount: bigint | undefined;
|
|
23
|
+
fees: {
|
|
24
|
+
token: `0x${string}`;
|
|
25
|
+
symbol: string;
|
|
26
|
+
decimals: number;
|
|
27
|
+
amount: bigint;
|
|
28
|
+
};
|
|
29
|
+
}>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type ConditionalIntentStatus, type RegisterConditionalIntentResponse } from "@spicenet-io/spiceflow-core";
|
|
2
|
-
import type { ConditionalIntentDraft, ConditionalSwapDraft, PreparedConditionalIntent } from "../types/conditionalIntents";
|
|
2
|
+
import type { ConditionalIntentDraft, ConditionalSwapDraft, ConditionalBundleDraft, ConditionalSequenceDraft, PreparedConditionalIntent } from "../types/conditionalIntents";
|
|
3
3
|
export declare function useSpiceConditionalIntents(): {
|
|
4
4
|
prepare: (draft: ConditionalIntentDraft) => Promise<PreparedConditionalIntent>;
|
|
5
5
|
prepareSwap: (draft: ConditionalSwapDraft) => Promise<PreparedConditionalIntent>;
|
|
6
|
+
prepareBundle: (draft: ConditionalBundleDraft, walletOnly?: boolean) => Promise<PreparedConditionalIntent>;
|
|
7
|
+
prepareSequence: (draft: ConditionalSequenceDraft) => Promise<PreparedConditionalIntent>;
|
|
6
8
|
sign: (value: PreparedConditionalIntent) => Promise<PreparedConditionalIntent>;
|
|
7
9
|
register: (value: PreparedConditionalIntent) => Promise<RegisterConditionalIntentResponse>;
|
|
8
10
|
authorizeRead: (serviceId: string) => Promise<string>;
|
|
@@ -11,6 +11,8 @@ export declare function useSpiceLimitOrders(options?: {
|
|
|
11
11
|
register(value: PreparedConditionalIntent): Promise<RegisterConditionalIntentResponse>;
|
|
12
12
|
prepare: (draft: ConditionalIntentDraft) => Promise<PreparedConditionalIntent>;
|
|
13
13
|
prepareSwap: (draft: import(".").ConditionalSwapDraft) => Promise<PreparedConditionalIntent>;
|
|
14
|
+
prepareBundle: (draft: import("..").ConditionalBundleDraft, walletOnly?: boolean) => Promise<PreparedConditionalIntent>;
|
|
15
|
+
prepareSequence: (draft: import("..").ConditionalSequenceDraft) => Promise<PreparedConditionalIntent>;
|
|
14
16
|
authorizeRead: (serviceId: string) => Promise<string>;
|
|
15
17
|
get: (id: string, serviceId: string) => Promise<import("@spicenet-io/spiceflow-core").ConditionalIntentStatus>;
|
|
16
18
|
list: (serviceId: string, options?: {
|
|
@@ -20,6 +20,7 @@ export interface UseSpiceSupplyParams extends Pick<SpiceSupplyProps, "sourceChai
|
|
|
20
20
|
recoveryKey: string;
|
|
21
21
|
};
|
|
22
22
|
prependSourceEscrow?: boolean;
|
|
23
|
+
convertBeforeEscrow?: boolean;
|
|
23
24
|
}
|
|
24
25
|
export declare function useSpiceSupply(params: UseSpiceSupplyParams): {
|
|
25
26
|
operationKey: `0x${string}`;
|