@spicenet-io/spiceflow-ui 4.10.0-dev.20260909.6 → 4.10.0-dev.20260914.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 +49 -0
- package/dist/auth-privy.cjs.js +1 -1
- package/dist/auth-privy.js +1 -1
- package/dist/components/AccountDisplay/parts/AccountCustomSection.d.ts +1 -1
- package/dist/components/AccountDisplay/parts/AccountHeader.d.ts +0 -1
- package/dist/components/AccountDisplay/parts/AccountIdleBalances.d.ts +3 -6
- package/dist/components/AccountDisplay/parts/AccountPanel.d.ts +3 -4
- package/dist/components/AccountDisplay/types.d.ts +17 -3
- package/dist/components/SpiceDeposit/lib/escrowCredit.d.ts +2 -0
- package/dist/components/SpiceLock/lib/helpers.d.ts +1 -0
- package/dist/components/SpiceSupply/lib/actionProceeds.d.ts +2 -2
- package/dist/components/SpiceSupply/lib/buildBatches.d.ts +22 -14
- package/dist/components/SpiceSupply/lib/executors.d.ts +10 -20
- package/dist/components/SpiceSupply/lib/externalAction.d.ts +6 -1
- package/dist/components/SpiceSupply/lib/feeConversion.d.ts +2 -1
- package/dist/components/SpiceSupply/lib/feeOnlyExecution.d.ts +1 -1
- package/dist/components/SpiceSupply/lib/feePreview.d.ts +40 -16
- package/dist/components/SpiceSupply/lib/payFundingBatches.d.ts +2 -1
- package/dist/components/SpiceSupply/parts/FundingQuoteReview.d.ts +6 -0
- package/dist/components/SpiceWithdraw/lib/helpers.d.ts +1 -2
- package/dist/components/SpiceWithdraw/lib/useEmbeddedWithdraw.d.ts +124 -5
- package/dist/components/SpiceWithdraw/parts/PendingWalletWithdrawal.d.ts +10 -0
- package/dist/components/SpiceWithdraw/parts/WithdrawBalanceCardHeader.d.ts +2 -3
- package/dist/components/SpiceWithdraw/parts/WithdrawDestinationCard.d.ts +4 -2
- package/dist/components/SpiceWithdraw/parts/WithdrawDetailsPanel.d.ts +4 -2
- package/dist/components/SpiceWithdraw/parts/WithdrawSourceCard.d.ts +4 -2
- package/dist/components/StatusDisplay/parts/StatusPanel.d.ts +2 -2
- package/dist/execution/escrowCredit.d.ts +18 -0
- package/dist/execution/fundEmbeddedWallet.d.ts +9 -1
- package/dist/execution/fundedExecution.d.ts +35 -0
- package/dist/execution/pollIntentStep.d.ts +2 -0
- package/dist/execution/transactionReceipt.d.ts +1 -0
- package/dist/hooks/index.d.ts +9 -8
- package/dist/hooks/useDestinationToken.d.ts +20 -0
- package/dist/hooks/useInventoryResource.d.ts +21 -0
- package/dist/hooks/useIsUserWhitelisted.d.ts +12 -12
- package/dist/hooks/useLockWalletAssets.d.ts +1 -1
- package/dist/hooks/usePendingAction.d.ts +7 -0
- package/dist/hooks/useSpiceAction.d.ts +46 -0
- package/dist/hooks/useSpiceAssets.d.ts +4 -1
- package/dist/hooks/useSpiceExecution.d.ts +9 -7
- package/dist/hooks/useSpiceInventory.d.ts +31 -0
- package/dist/hooks/useSpiceLock.d.ts +127 -0
- package/dist/hooks/useSpiceLockQuote.d.ts +35 -3
- package/dist/hooks/useSpiceRollupPrices.d.ts +9 -0
- package/dist/hooks/useSpiceSupply.d.ts +75 -28
- package/dist/hooks/useSupplyAssets.d.ts +23 -18
- package/dist/hooks/useSupplyQuote.d.ts +19 -5
- package/dist/hooks/useWalletBalances.d.ts +10 -4
- package/dist/index.cjs.js +16 -29
- package/dist/index.d.ts +53 -47
- package/dist/index.js +14 -27
- package/dist/privy-BJzR0dpS.js +2 -0
- package/dist/privy-CfCGXtaW.js +2 -0
- package/dist/providers/SpiceFlowProvider.d.ts +5 -3
- package/dist/types/assets.d.ts +12 -4
- package/dist/types/lock.d.ts +7 -3
- package/dist/types/supply.d.ts +35 -4
- package/dist/types/withdraw.d.ts +8 -7
- package/dist/utils/actionDefinition.d.ts +5 -0
- package/dist/utils/amounts.d.ts +2 -0
- package/dist/utils/assetDisplay.d.ts +8 -0
- package/dist/utils/assetPolicy.d.ts +16 -0
- package/dist/utils/chains/index.d.ts +4 -4
- package/dist/utils/crossChainRouter/liquidityVenues.d.ts +11 -7
- package/dist/utils/crossChainRouter/uniV3.d.ts +9 -5
- package/dist/utils/directWithdraw.d.ts +0 -4
- package/dist/utils/fees.d.ts +6 -1
- package/dist/utils/inventoryStore.d.ts +27 -0
- package/dist/utils/pendingDeposit.d.ts +30 -0
- package/dist/utils/prices/providerPrices.d.ts +12 -0
- package/dist/utils/relayer/index.d.ts +2 -3
- package/dist/utils/rollupBalances.d.ts +4 -0
- package/dist/utils/theme.d.ts +3 -3
- package/dist/utils/tokenResolution.d.ts +27 -2
- package/package.json +6 -1
- package/dist/components/AccountDisplay/tokenPrices.d.ts +0 -7
- package/dist/components/SpiceLock/lib/executors.d.ts +0 -76
- package/dist/components/SpiceSupply/lib/controlledFunding.d.ts +0 -54
- package/dist/components/SpiceSupply/lib/sourceConversion.d.ts +0 -13
- package/dist/components/SpiceWithdraw/parts/WithdrawBalancePopover.d.ts +0 -15
- package/dist/hooks/useDirectWithdraw.d.ts +0 -12
- package/dist/hooks/useSourceFundingConversion.d.ts +0 -22
- package/dist/privy-CFe_UmVo.js +0 -2
- package/dist/privy-oeYmzC_W.js +0 -2
- package/dist/utils/crossChainRouter/sourceFundingQuote.d.ts +0 -58
package/README.md
CHANGED
|
@@ -108,6 +108,55 @@ it becomes a `protocol` everyone can name.
|
|
|
108
108
|
|
|
109
109
|
## Development
|
|
110
110
|
|
|
111
|
+
### Rollup balance pricing
|
|
112
|
+
|
|
113
|
+
Rollup USD values use the host-configured RPC provider's pricing capability when the balance API has no valid value. The built-in account panel and withdrawal modal enable this while open; custom `useSpiceAssets` consumers can opt in with `priceEnabled`. Quantities arrive independently. Lookups follow receipt mappings, prefer `nativeChainId`, and fall back to other supported chains with a configured Alchemy endpoint. Explicit account `tokenPrices` overrides still take precedence over provider quotes.
|
|
114
|
+
|
|
115
|
+
Wallet discovery and rollup balances share a one-minute quote cache. Pricing polls only while the view is open and the page is visible. A failed refresh can retain a marked stale quote for up to five minutes; an unavailable quote displays `—`. No extra key, internal RPC, or symbol-based ERC-20 price fallback is used.
|
|
116
|
+
|
|
117
|
+
### Host-supplied token logos
|
|
118
|
+
|
|
119
|
+
`AccountDisplay.tokenLogos` maps a token symbol to a logo URL, the same key
|
|
120
|
+
shape `tokenPrices` uses. A discovered embedded-wallet balance falls back to
|
|
121
|
+
it when the RPC provider returns no logo, which is what happens for a token
|
|
122
|
+
that is not in the chain's configured token list. Provider metadata still
|
|
123
|
+
wins when it has a logo.
|
|
124
|
+
|
|
125
|
+
```tsx
|
|
126
|
+
<AccountDisplay tokenLogos={{ REPPO: reppoLogoUrl }} />
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Withdraw from an account balance
|
|
130
|
+
|
|
131
|
+
`AccountDisplay.onWithdrawClick` receives the rollup receipt-token ID when a
|
|
132
|
+
user clicks Withdraw on an idle rollup balance. The main Withdraw button calls
|
|
133
|
+
it without an ID. Pass the ID to `SpiceWithdraw.initialSourceAssetId` to open
|
|
134
|
+
the existing modal with that asset selected; the user chooses the destination
|
|
135
|
+
network inside the modal. Existing callbacks that take no arguments continue
|
|
136
|
+
to work.
|
|
137
|
+
|
|
138
|
+
```tsx
|
|
139
|
+
const [withdrawOpen, setWithdrawOpen] = useState(false);
|
|
140
|
+
const [withdrawAssetId, setWithdrawAssetId] = useState<string>();
|
|
141
|
+
|
|
142
|
+
<AccountDisplay
|
|
143
|
+
onWithdrawClick={(receiptTokenId) => {
|
|
144
|
+
setWithdrawAssetId(receiptTokenId);
|
|
145
|
+
setWithdrawOpen(true);
|
|
146
|
+
}}
|
|
147
|
+
/>
|
|
148
|
+
<SpiceWithdraw
|
|
149
|
+
isOpen={withdrawOpen}
|
|
150
|
+
onClose={() => setWithdrawOpen(false)}
|
|
151
|
+
initialSourceAssetId={withdrawAssetId}
|
|
152
|
+
buildSpicenetBatch={buildSpicenetWithdrawalBatch}
|
|
153
|
+
/>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Keep the integration's existing withdrawal batch builder and callbacks.
|
|
157
|
+
`initialSourceAssetId` selects a current balance by ID; it does not supply a
|
|
158
|
+
cached balance or change the receipt's supported withdrawal routes.
|
|
159
|
+
|
|
111
160
|
### Fee-Charging Intent Flows
|
|
112
161
|
|
|
113
162
|
- `SpiceSupply` and `SpicePay` are fee-charging intent-execution flows and must surface fee estimation before enabling submission.
|
package/dist/auth-privy.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const r=require("./privy-
|
|
2
|
+
"use strict";const r=require("./privy-BJzR0dpS.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;
|
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-CfCGXtaW.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 React from "react";
|
|
2
|
-
import { CustomSection } from "../types";
|
|
3
2
|
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
3
|
+
import { CustomSection } from "../types";
|
|
4
4
|
interface AccountCustomSectionProps {
|
|
5
5
|
section: CustomSection;
|
|
6
6
|
dk: ResolvedDarkPalette;
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SpiceAsset } from "../types";
|
|
3
2
|
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
step: "pending" | "error";
|
|
7
|
-
message?: string;
|
|
8
|
-
}
|
|
3
|
+
import type { DirectWithdrawState } from "../types";
|
|
4
|
+
import { SpiceAsset } from "../types";
|
|
9
5
|
interface AccountIdleBalancesProps {
|
|
10
6
|
spiceAssets: SpiceAsset[];
|
|
11
7
|
loading: boolean;
|
|
@@ -14,6 +10,7 @@ interface AccountIdleBalancesProps {
|
|
|
14
10
|
canDirectWithdraw?: boolean;
|
|
15
11
|
onDirectWithdraw?: (asset: SpiceAsset) => void;
|
|
16
12
|
directWithdrawState?: DirectWithdrawState | null;
|
|
13
|
+
onWithdrawClick?: (receiptTokenId?: string) => void;
|
|
17
14
|
}
|
|
18
15
|
export declare const AccountIdleBalances: React.NamedExoticComponent<AccountIdleBalancesProps>;
|
|
19
16
|
export {};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { SpiceAsset, CustomSection, AccountNotice } from "../types";
|
|
3
2
|
import { VerifiedPendingDeposit } from "../../../hooks/usePendingDeposit";
|
|
4
3
|
import type { ResolvedDarkPalette } from "../../../utils/theme";
|
|
5
|
-
import {
|
|
4
|
+
import type { DirectWithdrawState } from "../types";
|
|
5
|
+
import { AccountNotice, CustomSection, SpiceAsset } from "../types";
|
|
6
6
|
interface AccountPanelProps {
|
|
7
7
|
appName: string;
|
|
8
8
|
status: "active" | "inactive";
|
|
9
9
|
statusLabel?: string;
|
|
10
10
|
totalUsdValue: number;
|
|
11
|
-
hasUnpricedAssets?: boolean;
|
|
12
11
|
breakdownSubtitle: string;
|
|
13
12
|
showUsdSummary?: boolean;
|
|
14
13
|
address?: string;
|
|
@@ -18,7 +17,7 @@ interface AccountPanelProps {
|
|
|
18
17
|
customSections: CustomSection[];
|
|
19
18
|
notice?: AccountNotice | null;
|
|
20
19
|
onDepositClick?: () => void;
|
|
21
|
-
onWithdrawClick?: () => void;
|
|
20
|
+
onWithdrawClick?: (receiptTokenId?: string) => void;
|
|
22
21
|
depositDisabled?: boolean;
|
|
23
22
|
onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
|
|
24
23
|
primaryColor?: string;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import type { CustomStyles } from "../../types/theme";
|
|
2
|
-
import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
|
|
3
1
|
import type React from "react";
|
|
2
|
+
import { VerifiedPendingDeposit } from "../../hooks/usePendingDeposit";
|
|
3
|
+
import type { CustomStyles } from "../../types/theme";
|
|
4
4
|
export interface CustomSectionItem {
|
|
5
5
|
tokenSymbol: string;
|
|
6
6
|
tokenLogoURI?: string;
|
|
7
7
|
label: React.ReactNode;
|
|
8
8
|
displayValue: string;
|
|
9
9
|
valueColor?: "green" | "red" | "default";
|
|
10
|
+
onClick?: () => void;
|
|
10
11
|
}
|
|
11
12
|
export interface CustomSection {
|
|
12
13
|
title: string;
|
|
@@ -14,6 +15,9 @@ export interface CustomSection {
|
|
|
14
15
|
totalValue?: number;
|
|
15
16
|
}
|
|
16
17
|
export interface SpiceAsset {
|
|
18
|
+
owner?: string;
|
|
19
|
+
location?: "external" | "embedded" | "rollup";
|
|
20
|
+
positionId?: string;
|
|
17
21
|
tokenAddress: string;
|
|
18
22
|
tokenSymbol: string;
|
|
19
23
|
tokenDisplaySymbol?: string;
|
|
@@ -24,7 +28,9 @@ export interface SpiceAsset {
|
|
|
24
28
|
balance: string;
|
|
25
29
|
balanceFormatted: number;
|
|
26
30
|
usdValue: number;
|
|
31
|
+
priceStatus?: "fresh" | "stale" | "unavailable";
|
|
27
32
|
logoURI?: string;
|
|
33
|
+
receiptTokenId?: string;
|
|
28
34
|
directWithdraw?: boolean;
|
|
29
35
|
}
|
|
30
36
|
export interface BreakdownLabel {
|
|
@@ -42,15 +48,23 @@ export interface AccountDisplayProps {
|
|
|
42
48
|
customSections?: CustomSection[];
|
|
43
49
|
extraAssets?: SpiceAsset[];
|
|
44
50
|
tokenPrices?: Record<string, number>;
|
|
51
|
+
tokenLogos?: Record<string, string>;
|
|
45
52
|
breakdownLabels?: BreakdownLabel[];
|
|
46
53
|
notice?: AccountNotice | null;
|
|
47
54
|
styles?: CustomStyles;
|
|
48
55
|
dark?: boolean;
|
|
49
56
|
onDepositSuccess?: () => void;
|
|
50
57
|
onDepositClick?: () => void;
|
|
51
|
-
onWithdrawClick?: () => void;
|
|
58
|
+
onWithdrawClick?: (receiptTokenId?: string) => void;
|
|
52
59
|
onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
|
|
53
60
|
showModeToggle?: boolean;
|
|
54
61
|
defaultMode?: "7702" | "non7702";
|
|
55
62
|
showUsdSummary?: boolean;
|
|
63
|
+
alwaysShowEmbeddedIdle?: boolean;
|
|
64
|
+
showDisconnect?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface DirectWithdrawState {
|
|
67
|
+
key: string;
|
|
68
|
+
step: "pending" | "error";
|
|
69
|
+
message?: string;
|
|
56
70
|
}
|
|
@@ -3,6 +3,7 @@ import { type FeeEstimateSummary, type ResolvedSwap } from "@spicenet-io/spicefl
|
|
|
3
3
|
import type { ChainAuthorization, ChainBatch } from "../../../types/authorization";
|
|
4
4
|
import type { Asset } from "../../../types/assets";
|
|
5
5
|
export declare function isDirectLockSource(asset: Asset, lockChainId: number): boolean;
|
|
6
|
+
export declare function isInPlaceLockSource(asset: Asset, lockChainId: number): boolean;
|
|
6
7
|
export declare function composeLockSwapBatches(batches: ChainBatch[], params: {
|
|
7
8
|
chainId: number;
|
|
8
9
|
recipient: Address;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
2
|
import type { ChainBatch } from "../../../types/authorization";
|
|
3
|
-
import type { SpiceSupplyProps } from "../../../types/supply";
|
|
3
|
+
import type { SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
4
4
|
import type { SupplyFeeQuote } from "./feePreview";
|
|
5
5
|
export declare function appendProceedsFees(batches: ChainBatch[], owner: Address, token: Address, gas: bigint, platform: bigint): ChainBatch[];
|
|
6
6
|
export declare function simulateProceedsBatch(batches: ChainBatch[], owner: Address, token: Address, signal?: AbortSignal, platformFeeMaximum?: bigint): Promise<bigint>;
|
|
@@ -10,5 +10,5 @@ export declare function estimateProceedsFunding(args: {
|
|
|
10
10
|
token: Address;
|
|
11
11
|
signal?: AbortSignal;
|
|
12
12
|
baseline: () => Promise<SupplyFeeQuote | null>;
|
|
13
|
-
buildBatches: (amount: bigint) => Promise<ChainBatch[]>;
|
|
13
|
+
buildBatches: (amount: bigint, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
14
14
|
}): Promise<SupplyFeeQuote>;
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
+
import type { FeeEstimateSummary, ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
1
2
|
import { type Address } from "viem";
|
|
2
|
-
import type {
|
|
3
|
-
import type { ChainBatch } from "../../../types/authorization";
|
|
3
|
+
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
4
4
|
import type { SelectedAsset } from "../../../types/assets";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
6
|
+
import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
6
7
|
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
7
|
-
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
8
|
-
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
9
8
|
type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
10
|
-
export declare function
|
|
11
|
-
export declare function isExternalSource(asset: SelectedAsset["asset"] | null | undefined, isNon7702: boolean): boolean;
|
|
9
|
+
export declare function getPivotEscrowAmount(sourceSwap: Pick<ResolvedSwap, "amountOutMinimum">, gasSkim: bigint): bigint;
|
|
12
10
|
export declare function stripSpicenetFundingBatches(batches: ChainBatch[]): ChainBatch[];
|
|
13
11
|
export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
|
|
14
|
-
export declare function resolveSupplyTokenDecimals(asset: SelectedAsset["asset"], destination: SpiceSupplyProps["destinationToken"], token: Address): Promise<number>;
|
|
15
12
|
export interface BatchBuilderContext {
|
|
16
13
|
currentPaymentAmount: string;
|
|
14
|
+
isFeeInclusiveInput?: boolean;
|
|
15
|
+
feeOnlyAction?: boolean;
|
|
16
|
+
swapInputAmount?: bigint | null;
|
|
17
17
|
destinationToken: SpiceSupplyProps["destinationToken"];
|
|
18
18
|
embeddedWalletAddress: string | null | undefined;
|
|
19
19
|
providerEmbeddedAddress: string | null | undefined;
|
|
20
20
|
externalWalletAddress: string | null | undefined;
|
|
21
21
|
address: string | null | undefined;
|
|
22
22
|
recipient?: Address;
|
|
23
|
-
swapOutputRecipient?: Address;
|
|
24
23
|
isNon7702: boolean;
|
|
25
24
|
isPayMode: boolean;
|
|
26
|
-
isFeeInclusiveInput?: boolean;
|
|
27
|
-
swapInputAmount?: bigint | null;
|
|
28
|
-
feeOnlyAction?: boolean;
|
|
29
25
|
resolvedChainId: number;
|
|
30
26
|
buildActionCalls: SpiceSupplyProps["buildActionCalls"];
|
|
31
27
|
feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
|
|
@@ -33,12 +29,24 @@ export interface BatchBuilderContext {
|
|
|
33
29
|
selectedAsset: SelectedAsset | null;
|
|
34
30
|
needsSwap: boolean;
|
|
35
31
|
resolvedSwap: ResolvedSwap | null;
|
|
32
|
+
resolveInputSwap?: (amountIn: bigint, selectedSwap?: ResolvedSwap) => Promise<ResolvedSwap>;
|
|
36
33
|
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
37
34
|
quoteAmountOut: bigint | null;
|
|
38
35
|
resolvedTokenIn: Address | null;
|
|
36
|
+
sourceSwap?: ResolvedSwap | null;
|
|
37
|
+
sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
|
|
38
|
+
resolveSourceExactOutputSwap?: (amountOut: bigint) => Promise<ResolvedExactOutputSwap>;
|
|
39
|
+
pivot?: PivotRoute | null;
|
|
39
40
|
requestTimestampMs?: number;
|
|
40
41
|
}
|
|
41
|
-
export declare function
|
|
42
|
-
|
|
42
|
+
export declare function isPivotPay(ctx: Pick<BatchBuilderContext, "isPayMode" | "selectedAsset" | "resolvedChainId" | "pivot">): ctx is typeof ctx & {
|
|
43
|
+
pivot: PivotRoute;
|
|
44
|
+
};
|
|
45
|
+
export declare function isPivotSupply(ctx: Pick<BatchBuilderContext, "isPayMode" | "selectedAsset" | "resolvedChainId" | "sourceSwap" | "pivot">): ctx is typeof ctx & {
|
|
46
|
+
sourceSwap: ResolvedSwap;
|
|
47
|
+
pivot: PivotRoute;
|
|
48
|
+
};
|
|
49
|
+
export declare const buildPayChainBatches: (ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
50
|
+
export declare const buildSupplyChainBatches: (ctx: BatchBuilderContext, options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
43
51
|
export declare function estimateRequiredGrossFunding(requiredNetFunding: bigint, buildBatches: (grossFundingAmount: bigint) => ChainBatch[] | Promise<ChainBatch[]>, fundingToken: Address, estimate: EstimateFn, executionOptions?: Pick<ExecutionOptions, "useCustomTransfers" | "userOverride">): Promise<bigint>;
|
|
44
52
|
export {};
|
|
@@ -1,40 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
2
2
|
import type { Dispatch, MutableRefObject, SetStateAction } from "react";
|
|
3
3
|
import { type Address } from "viem";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import type { ExecutionRunner } from "../../../execution/runner";
|
|
5
|
+
import type { ExecutionProgress } from "../../../hooks/useSpiceExecution";
|
|
6
6
|
import type { SelectedAsset } from "../../../types/assets";
|
|
7
|
-
import type { BuildPayBatchesFn, BuildSupplyBatchesFn, SpiceSupplyProps } from "../../../types/supply";
|
|
8
|
-
import { type SupplyFeeQuote } from "./feePreview";
|
|
7
|
+
import type { BuildPayBatchesFn, BuildSupplyBatchesFn, PivotRoute, SpiceSupplyProps } from "../../../types/supply";
|
|
9
8
|
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
10
|
-
import type
|
|
11
|
-
import type { ExecutionRunner } from "../../../execution/runner";
|
|
9
|
+
import { type SupplyFeeQuote } from "./feePreview";
|
|
12
10
|
export type SupplyStep = "idle" | "building" | "signing-delegation" | "signing-intent" | "submitting" | "executing" | "success" | "error";
|
|
13
11
|
export type PaymentResult = {
|
|
14
12
|
status: "processing" | "success" | "failed";
|
|
15
13
|
txHash?: string;
|
|
16
14
|
error?: string;
|
|
17
15
|
};
|
|
18
|
-
export { isExternalSource } from "./buildBatches";
|
|
19
16
|
export type ExecutorContext = {
|
|
20
|
-
signal?: AbortSignal;
|
|
21
17
|
selectedAsset: SelectedAsset | null;
|
|
22
18
|
parsedAmount: number;
|
|
23
19
|
currentPaymentAmount: string;
|
|
24
20
|
isInsufficientBalance: boolean;
|
|
25
21
|
isPayMode: boolean;
|
|
26
22
|
isFeeInclusiveInput?: boolean;
|
|
27
|
-
swapInputAmount?: bigint | null;
|
|
28
23
|
feeOnlyAction?: boolean;
|
|
29
24
|
actionProceeds?: SpiceSupplyProps["actionProceeds"];
|
|
30
25
|
validateFeeQuote?: () => void;
|
|
31
|
-
|
|
26
|
+
executionTokenDecimals?: number;
|
|
27
|
+
signal?: AbortSignal;
|
|
32
28
|
isNon7702: boolean;
|
|
33
29
|
isSourceDestToken: boolean;
|
|
34
30
|
needsSwap: boolean;
|
|
35
31
|
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
36
32
|
selectedIsEquivalent: boolean;
|
|
37
33
|
resolvedTokenIn: Address | null;
|
|
34
|
+
sourceSwap: ResolvedSwap | null;
|
|
35
|
+
sourceExactOutputSwap: ResolvedExactOutputSwap | null;
|
|
36
|
+
pivot: PivotRoute | null;
|
|
38
37
|
embeddedWalletAddress: string | null | undefined;
|
|
39
38
|
providerEmbeddedAddress: string | null | undefined;
|
|
40
39
|
recipient?: Address;
|
|
@@ -53,14 +52,7 @@ export type ExecutorContext = {
|
|
|
53
52
|
provider: string | null | undefined;
|
|
54
53
|
resolvedChainId: number;
|
|
55
54
|
executionTokenAddress: Address;
|
|
56
|
-
executionTokenDecimals?: number;
|
|
57
55
|
feeQuote: SupplyFeeQuote | null;
|
|
58
|
-
fundingObserver?: TransactionObserver;
|
|
59
|
-
sourceFunding?: SourceFundingState;
|
|
60
|
-
sourceFundingRecoveryKey?: string;
|
|
61
|
-
sourceConversion?: SourceConversionExecution;
|
|
62
|
-
sourceConversionRequired?: boolean;
|
|
63
|
-
onSourceFundingChange?: (state: SourceFundingState) => void;
|
|
64
56
|
execution: ExecutionRunner & {
|
|
65
57
|
buildPayChainBatches: BuildPayBatchesFn;
|
|
66
58
|
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
@@ -80,7 +72,5 @@ export type ExecutorContext = {
|
|
|
80
72
|
abortControllerRef: MutableRefObject<AbortController | null>;
|
|
81
73
|
};
|
|
82
74
|
} & Pick<SpiceSupplyProps, "destinationToken" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "onSuccess">;
|
|
83
|
-
export declare function sourceFundingSelection(ctx: ExecutorContext): SelectedAsset | null;
|
|
84
|
-
export declare function sourceFundingIdentity(ctx: ExecutorContext): string;
|
|
85
75
|
export declare function executeSupply(ctx: ExecutorContext): Promise<void>;
|
|
86
76
|
export declare function executePay(ctx: ExecutorContext): Promise<void>;
|
|
@@ -26,7 +26,9 @@ type StoredCall = {
|
|
|
26
26
|
data: `0x${string}`;
|
|
27
27
|
};
|
|
28
28
|
export interface ExternalActionRecord {
|
|
29
|
-
version: 2;
|
|
29
|
+
version: 2 | 3;
|
|
30
|
+
fundingIdentity?: string;
|
|
31
|
+
actionIdentity?: string;
|
|
30
32
|
scope: string;
|
|
31
33
|
destinationToken: Address;
|
|
32
34
|
destinationDecimals: number;
|
|
@@ -59,5 +61,8 @@ export declare function executeExternalActionSupply(params: {
|
|
|
59
61
|
buildActionCalls: SpiceSupplyProps["buildActionCalls"];
|
|
60
62
|
onRecord: (record: ExternalActionRecord | null) => void;
|
|
61
63
|
isCurrent?: () => boolean;
|
|
64
|
+
fundingIdentity: string;
|
|
65
|
+
actionIdentity: string;
|
|
66
|
+
resumeRoute: () => Promise<string>;
|
|
62
67
|
}): Promise<void>;
|
|
63
68
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Address } from "viem";
|
|
2
2
|
import type { FeePreviewContext, SupplyFeeQuote } from "./feePreview";
|
|
3
3
|
export declare function resolveFeeFundingToken(asset: NonNullable<FeePreviewContext["selectedAsset"]>["asset"], chainId: number, feeToken: Address): Address | null;
|
|
4
4
|
export interface FundingConversion {
|
|
@@ -7,6 +7,7 @@ export interface FundingConversion {
|
|
|
7
7
|
amountInMax: bigint;
|
|
8
8
|
amountOut: bigint;
|
|
9
9
|
sourceAmountMax: bigint;
|
|
10
|
+
fromProceeds?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export declare class InsufficientFeeFundingBalanceError extends Error {
|
|
12
13
|
readonly requiredAmount: bigint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
-
import type { ChainBatch } from "../../../types/authorization";
|
|
3
2
|
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
3
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
4
4
|
import type { ExecutorContext } from "./executors";
|
|
5
5
|
export declare function stripFeeOnlyCalls(batches: ChainBatch[], chainId: number, token: Address): ChainBatch[];
|
|
6
6
|
export declare function feeOnlyExecutionOptions(ctx: ExecutorContext, token: Address, fundingCap: bigint): Pick<ExecutionOptions, "prepareForSigning" | "validateBeforeSubmit" | "resolveActionOutputCredits">;
|
|
@@ -1,26 +1,41 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { LiquidityVenuesConfig } from "../../../utils/crossChainRouter/venueConfig";
|
|
3
|
-
import { type Address } from "viem";
|
|
1
|
+
import type { ResolvedSwap } from "@spicenet-io/spiceflow-core";
|
|
4
2
|
import { type FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
5
|
-
import type
|
|
6
|
-
import type {
|
|
3
|
+
import { type Address } from "viem";
|
|
4
|
+
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
7
5
|
import type { Asset, SelectedAsset } from "../../../types/assets";
|
|
8
|
-
import type {
|
|
6
|
+
import type { ChainBatch } from "../../../types/authorization";
|
|
7
|
+
import type { PivotRoute, SpiceSupplyProps, SupplyBatchBuildOptions } from "../../../types/supply";
|
|
8
|
+
import type { FeePreview } from "../../../types/ui";
|
|
9
9
|
import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
|
|
10
|
-
import type
|
|
11
|
-
import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
|
|
10
|
+
import { type FundingConversion } from "./feeConversion";
|
|
12
11
|
type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
|
|
13
12
|
type BuildPayBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
14
13
|
type BuildSupplyBatchesFn = (options?: SupplyBatchBuildOptions) => Promise<ChainBatch[]>;
|
|
15
14
|
export type SupplyFeeQuote = {
|
|
15
|
+
actionDefinition?: Parameters<NonNullable<SupplyBatchBuildOptions["onActionCalls"]>>[0];
|
|
16
|
+
fundingConversion?: FundingConversion;
|
|
17
|
+
fundingBatches?: ChainBatch[];
|
|
18
|
+
proceedsAvailable?: bigint;
|
|
19
|
+
proceedsUsed?: bigint;
|
|
20
|
+
batches?: ChainBatch[];
|
|
21
|
+
actionContext?: Partial<import("../../../types/supply").BuildActionCallsContext>;
|
|
22
|
+
fundingAmount?: bigint;
|
|
23
|
+
destinationSwap?: ResolvedSwap;
|
|
24
|
+
swapInputAmount?: bigint;
|
|
25
|
+
destinationAmount?: bigint;
|
|
26
|
+
sourceSpendCap?: bigint;
|
|
27
|
+
expiresAt?: number;
|
|
16
28
|
preview: FeePreview;
|
|
17
29
|
feeEstimate: FeeEstimateSummary | null;
|
|
18
30
|
grossFundingAmount?: bigint;
|
|
19
|
-
|
|
20
|
-
proceedsAvailable?: bigint;
|
|
21
|
-
fundingConversion?: FundingConversion;
|
|
22
|
-
fundingBatches?: ChainBatch[];
|
|
31
|
+
sourceGasSkim?: bigint;
|
|
23
32
|
};
|
|
33
|
+
export declare function sizePivotSourceGasSkim(params: {
|
|
34
|
+
user: Address;
|
|
35
|
+
pivot: PivotRoute;
|
|
36
|
+
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
37
|
+
signal?: AbortSignal;
|
|
38
|
+
}): Promise<bigint>;
|
|
24
39
|
export declare function solveGrossFunding(fees: Pick<FeePreview, "grossAmount" | "gasFee" | "spicenetFee" | "bridgeFee">, requiredNetFunding: bigint): bigint;
|
|
25
40
|
export declare function estimatePayFunding(args: {
|
|
26
41
|
requiredNetFunding: bigint;
|
|
@@ -40,13 +55,18 @@ export declare function estimatePayFunding(args: {
|
|
|
40
55
|
feeEstimate: FeeEstimateSummary;
|
|
41
56
|
grossFundingAmount: bigint;
|
|
42
57
|
}>;
|
|
58
|
+
export declare function estimateMaximumSupplyInput(params: {
|
|
59
|
+
balance: bigint;
|
|
60
|
+
decimals: number;
|
|
61
|
+
planForAmount: (rawAmount: bigint) => Promise<SupplyFeeQuote | null>;
|
|
62
|
+
}): Promise<string>;
|
|
43
63
|
export declare function estimateSupplyMaxAmount(ctx: {
|
|
44
64
|
asset: Asset;
|
|
45
65
|
isPayMode: boolean;
|
|
46
|
-
isFeeInclusiveInput?: boolean;
|
|
47
66
|
isNon7702: boolean;
|
|
48
67
|
needsSwap: boolean;
|
|
49
68
|
isQuoting: boolean;
|
|
69
|
+
pivot?: PivotRoute | null;
|
|
50
70
|
embeddedWalletAddress: string | null | undefined;
|
|
51
71
|
buildSupplyChainBatches: BuildSupplyBatchesFn;
|
|
52
72
|
estimate: EstimateFn;
|
|
@@ -54,15 +74,15 @@ export declare function estimateSupplyMaxAmount(ctx: {
|
|
|
54
74
|
feeExecutionMode: SpiceSupplyProps["feeExecutionMode"];
|
|
55
75
|
}): Promise<string | null>;
|
|
56
76
|
export interface FeePreviewContext {
|
|
57
|
-
liquidityVenues?: LiquidityVenuesConfig;
|
|
77
|
+
liquidityVenues?: import("../../../utils/crossChainRouter/venueConfig").LiquidityVenuesConfig;
|
|
58
78
|
maxSlippage?: number;
|
|
59
79
|
resolveExactOutputSwap?: SpiceSupplyProps["resolveExactOutputSwap"];
|
|
80
|
+
feeOnlyAction?: boolean;
|
|
81
|
+
actionProceeds?: SpiceSupplyProps["actionProceeds"];
|
|
60
82
|
signal?: AbortSignal;
|
|
61
83
|
selectedAsset: SelectedAsset | null;
|
|
62
84
|
isPayMode: boolean;
|
|
63
85
|
isFeeInclusiveInput?: boolean;
|
|
64
|
-
feeOnlyAction?: boolean;
|
|
65
|
-
actionProceeds?: SpiceSupplyProps["actionProceeds"];
|
|
66
86
|
parsedAmount: number;
|
|
67
87
|
needsSwap: boolean;
|
|
68
88
|
exactOutputSwap: ResolvedExactOutputSwap | null;
|
|
@@ -82,6 +102,9 @@ export interface FeePreviewContext {
|
|
|
82
102
|
authenticated: boolean;
|
|
83
103
|
isDirect: boolean;
|
|
84
104
|
resolvedSwap: ResolvedSwap | null;
|
|
105
|
+
sourceSwap?: ResolvedSwap | null;
|
|
106
|
+
sourceExactOutputSwap?: ResolvedExactOutputSwap | null;
|
|
107
|
+
pivot?: PivotRoute | null;
|
|
85
108
|
isQuoting: boolean;
|
|
86
109
|
executionTokenAddress: Address;
|
|
87
110
|
buildPayChainBatches: BuildPayBatchesFn;
|
|
@@ -89,4 +112,5 @@ export interface FeePreviewContext {
|
|
|
89
112
|
estimate: EstimateFn;
|
|
90
113
|
}
|
|
91
114
|
export declare function estimateFeePreview(ctx: FeePreviewContext): Promise<SupplyFeeQuote | null>;
|
|
115
|
+
export declare function supplyContextForFees(fees: FeePreview, amount: bigint, inclusive: boolean, mode: SpiceSupplyProps["feeExecutionMode"]): Required<Pick<import("../../../types/supply").BuildActionCallsContext, "grossAmount" | "netAmount" | "combinedFeeAmount" | "feeExecutionMode" | "feeBreakdown">>;
|
|
92
116
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Address } from "viem";
|
|
2
1
|
import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
|
|
2
|
+
import type { Address } from "viem";
|
|
3
3
|
import type { ChainBatch } from "../../../types/authorization";
|
|
4
4
|
export declare function wrapPayWithSpicenet(raw: ChainBatch[], fundingRecipient: Address, feeEstimate?: FeeEstimateSummary, opts?: {
|
|
5
5
|
payoutAlreadyGross?: boolean;
|
|
6
|
+
requestTimestampMs?: number;
|
|
6
7
|
}): ChainBatch[];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { UseSpiceSupplyResult } from "../../../hooks/useSpiceSupply";
|
|
2
|
+
import type { Asset } from "../../../types/assets";
|
|
3
|
+
export declare function FundingQuoteReview({ review, destination, }: {
|
|
4
|
+
review: NonNullable<UseSpiceSupplyResult["fundingQuoteReview"]>;
|
|
5
|
+
destination: Pick<Asset, "symbol" | "decimals">;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ChainBatch } from "../../../types/authorization";
|
|
2
|
-
export declare function formatWithdrawError(message: string): string;
|
|
3
2
|
export declare function normalizeTokenLabel(value?: string | null): string;
|
|
4
3
|
export declare function formatTokenAmount(rawAmount: bigint, decimals: number): string;
|
|
5
4
|
export declare function scaleAmountBetweenDecimals(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
|
|
6
|
-
export declare function estimateUsd(amount: number,
|
|
5
|
+
export declare function estimateUsd(amount: number, price?: number, stale?: boolean): string;
|
|
7
6
|
export declare function buildWithdrawFeeEstimateKey(batches: ChainBatch[], tokenAddress?: string | null): string | null;
|