@spicenet-io/spiceflow-ui 4.21.3 → 4.21.4-multiple-proceeds.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 +1 -0
- package/dist/auth-privy.js +1 -1
- package/dist/components/SpiceSupply/lib/actionProceeds.d.ts +3 -2
- package/dist/components/SpiceSupply/lib/executors.d.ts +2 -1
- package/dist/components/SpiceSupply/lib/feeFunding.d.ts +4 -1
- package/dist/components/SpiceSupply/lib/feePreview.d.ts +6 -1
- package/dist/hooks/useIsUserWhitelisted.d.ts +12 -12
- package/dist/hooks/useSpiceLock.d.ts +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/types/supply.d.ts +9 -3
- package/package.json +1 -1
- /package/dist/{privy-CM7w8_v6.js → privy-B1RVNGv7.js} +0 -0
package/README.md
CHANGED
|
@@ -560,6 +560,7 @@ during prewarming. The time available before typing determines how much work it
|
|
|
560
560
|
|
|
561
561
|
- 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`).
|
|
562
562
|
- 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.
|
|
563
|
+
- For multiple withdrawal outputs, pass `actionProceeds: { resolve: async (signal) => [{ token: token0, amount: amount0 }, { token: token1, amount: amount1 }] }`. Return each amount in its token’s base units, only for proceeds left in the execution wallet. The SDK prefers direct fee-token proceeds, then tries conversion routes for the other outputs before other balances. It rechecks the chosen token’s proceeds before signing; another output cannot cover a shortfall in an accepted plan. Existing `{ token, resolve }` declarations remain supported.
|
|
563
564
|
- 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.
|
|
564
565
|
- `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`.
|
|
565
566
|
- A `selectedAsset` on a fee-only action is an explicit host choice and funds the fee from that balance as before.
|
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-B1RVNGv7.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"@tanstack/react-query";import"viem";import"@privy-io/react-auth";import"wagmi";import"viem/actions";export{g as PrivyLogin};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
2
|
import type { ChainBatch } from "../../../types/authorization";
|
|
3
|
-
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
3
|
+
import type { SpiceSupplyProps, ActionProceeds, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
4
4
|
import type { SupplyFeeQuote } from "./feePreview";
|
|
5
5
|
export declare class InsufficientFeeFundingBalanceError extends Error {
|
|
6
6
|
readonly requiredAmount: bigint;
|
|
@@ -10,7 +10,7 @@ export declare class InsufficientFeeFundingBalanceError extends Error {
|
|
|
10
10
|
export declare function appendProceedsFees(batches: ChainBatch[], owner: Address, token: Address, gas: bigint, platform: bigint): ChainBatch[];
|
|
11
11
|
export declare function simulateProceedsBatch(batches: ChainBatch[], owner: Address, token: Address, signal?: AbortSignal, platformFeeMaximum?: bigint): Promise<bigint>;
|
|
12
12
|
export declare function estimateProceedsFunding(args: {
|
|
13
|
-
proceeds:
|
|
13
|
+
proceeds: ActionProceeds;
|
|
14
14
|
owner: Address;
|
|
15
15
|
token: Address;
|
|
16
16
|
signal?: AbortSignal;
|
|
@@ -20,3 +20,4 @@ export declare function estimateProceedsFunding(args: {
|
|
|
20
20
|
expiresAt?: number;
|
|
21
21
|
actionAmountFor?: (fee: bigint) => bigint;
|
|
22
22
|
}): Promise<SupplyFeeQuote>;
|
|
23
|
+
export declare function selectedActionProceeds(proceeds: SpiceSupplyProps["actionProceeds"], token?: Address): ActionProceeds | undefined;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ActionProceeds } from "../../../types/supply";
|
|
1
2
|
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
2
3
|
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
3
4
|
import { type Address } from "viem";
|
|
@@ -23,7 +24,7 @@ export type ExecutorContext = {
|
|
|
23
24
|
isFeeInclusiveInput?: boolean;
|
|
24
25
|
quotedInclusivePlatformFee?: boolean;
|
|
25
26
|
feeOnlyAction?: boolean;
|
|
26
|
-
actionProceeds?:
|
|
27
|
+
actionProceeds?: ActionProceeds;
|
|
27
28
|
validateFeeQuote?: () => void;
|
|
28
29
|
executionTokenDecimals?: number;
|
|
29
30
|
signal?: AbortSignal;
|
|
@@ -14,7 +14,10 @@ export declare function rankFeeFundingCandidates(args: {
|
|
|
14
14
|
proceeds?: {
|
|
15
15
|
token: Address;
|
|
16
16
|
amount: bigint;
|
|
17
|
-
}
|
|
17
|
+
} | {
|
|
18
|
+
token: Address;
|
|
19
|
+
amount: bigint;
|
|
20
|
+
}[];
|
|
18
21
|
balances: Asset[];
|
|
19
22
|
order?: FeeFundingLevel[];
|
|
20
23
|
reserve?: FeePreviewContext["feeFundingReserve"];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ActionProceeds } from "../../../types/supply";
|
|
1
2
|
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
2
3
|
import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
3
4
|
import { type Address } from "viem";
|
|
@@ -128,7 +129,11 @@ export interface FeePreviewContext {
|
|
|
128
129
|
resolveExactOutputSwap?: SpiceSupplyProps["resolveExactOutputSwap"];
|
|
129
130
|
feeOnlyAction?: boolean;
|
|
130
131
|
actionInput?: SpiceSupplyProps["actionInput"];
|
|
131
|
-
actionProceeds?:
|
|
132
|
+
actionProceeds?: ActionProceeds;
|
|
133
|
+
actionProceedsCandidates?: (signal?: AbortSignal) => Promise<{
|
|
134
|
+
token: Address;
|
|
135
|
+
amount: bigint;
|
|
136
|
+
}[]>;
|
|
132
137
|
feeFunding?: SpiceSupplyProps["feeFunding"];
|
|
133
138
|
feeFundingBalances?: Asset[];
|
|
134
139
|
feeFundingReserve?: {
|
|
@@ -43,8 +43,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
|
|
|
43
43
|
isRefetching: boolean;
|
|
44
44
|
isStale: boolean;
|
|
45
45
|
isEnabled: boolean;
|
|
46
|
-
refetch: (options?: import("@tanstack/
|
|
47
|
-
fetchStatus: import("@tanstack/
|
|
46
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
|
|
47
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
48
48
|
promise: Promise<PartnerWhitelistCheckResponse>;
|
|
49
49
|
isWhitelisted: boolean;
|
|
50
50
|
whitelistCheck: PartnerWhitelistCheckResponse | undefined;
|
|
@@ -82,8 +82,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
|
|
|
82
82
|
isRefetching: boolean;
|
|
83
83
|
isStale: boolean;
|
|
84
84
|
isEnabled: boolean;
|
|
85
|
-
refetch: (options?: import("@tanstack/
|
|
86
|
-
fetchStatus: import("@tanstack/
|
|
85
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
|
|
86
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
87
87
|
promise: Promise<PartnerWhitelistCheckResponse>;
|
|
88
88
|
isWhitelisted: boolean;
|
|
89
89
|
whitelistCheck: PartnerWhitelistCheckResponse | undefined;
|
|
@@ -121,8 +121,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
|
|
|
121
121
|
isRefetching: boolean;
|
|
122
122
|
isStale: boolean;
|
|
123
123
|
isEnabled: boolean;
|
|
124
|
-
refetch: (options?: import("@tanstack/
|
|
125
|
-
fetchStatus: import("@tanstack/
|
|
124
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
|
|
125
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
126
126
|
promise: Promise<PartnerWhitelistCheckResponse>;
|
|
127
127
|
isWhitelisted: boolean;
|
|
128
128
|
whitelistCheck: PartnerWhitelistCheckResponse | undefined;
|
|
@@ -160,8 +160,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
|
|
|
160
160
|
isRefetching: boolean;
|
|
161
161
|
isStale: boolean;
|
|
162
162
|
isEnabled: boolean;
|
|
163
|
-
refetch: (options?: import("@tanstack/
|
|
164
|
-
fetchStatus: import("@tanstack/
|
|
163
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
|
|
164
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
165
165
|
promise: Promise<PartnerWhitelistCheckResponse>;
|
|
166
166
|
isWhitelisted: boolean;
|
|
167
167
|
whitelistCheck: PartnerWhitelistCheckResponse | undefined;
|
|
@@ -199,8 +199,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
|
|
|
199
199
|
isRefetching: boolean;
|
|
200
200
|
isStale: boolean;
|
|
201
201
|
isEnabled: boolean;
|
|
202
|
-
refetch: (options?: import("@tanstack/
|
|
203
|
-
fetchStatus: import("@tanstack/
|
|
202
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
|
|
203
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
204
204
|
promise: Promise<PartnerWhitelistCheckResponse>;
|
|
205
205
|
isWhitelisted: boolean;
|
|
206
206
|
whitelistCheck: PartnerWhitelistCheckResponse | undefined;
|
|
@@ -238,8 +238,8 @@ export declare function useIsUserWhitelisted({ walletAddress, campaignId, campai
|
|
|
238
238
|
isRefetching: boolean;
|
|
239
239
|
isStale: boolean;
|
|
240
240
|
isEnabled: boolean;
|
|
241
|
-
refetch: (options?: import("@tanstack/
|
|
242
|
-
fetchStatus: import("@tanstack/
|
|
241
|
+
refetch: (options?: import("@tanstack/query-core").RefetchOptions) => Promise<import("@tanstack/query-core").QueryObserverResult<PartnerWhitelistCheckResponse, Error>>;
|
|
242
|
+
fetchStatus: import("@tanstack/query-core").FetchStatus;
|
|
243
243
|
promise: Promise<PartnerWhitelistCheckResponse>;
|
|
244
244
|
isWhitelisted: boolean;
|
|
245
245
|
whitelistCheck: PartnerWhitelistCheckResponse | undefined;
|
|
@@ -28,7 +28,7 @@ export declare function useSpiceLock(params: UseSpiceLockParams): {
|
|
|
28
28
|
exactOutputSwap: import("..").ResolvedExactOutputSwap | null;
|
|
29
29
|
sourceExactOutputSwap: import("..").ResolvedExactOutputSwap | null;
|
|
30
30
|
inputDecimals?: number | null;
|
|
31
|
-
resolvedTokenIn: import("
|
|
31
|
+
resolvedTokenIn: import("abitype").Address | null;
|
|
32
32
|
isDirect: boolean;
|
|
33
33
|
needsSwap: boolean;
|
|
34
34
|
selectedIsEquivalent: boolean;
|