@spicenet-io/spiceflow-ui 4.7.11 → 4.8.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/auth-privy.cjs.js +1 -1
  2. package/dist/auth-privy.js +1 -1
  3. package/dist/components/AccountDisplay/parts/AccountActions.d.ts +1 -0
  4. package/dist/components/AccountDisplay/parts/AccountPanel.d.ts +1 -0
  5. package/dist/components/SpiceSupply/lib/buildBatches.d.ts +1 -0
  6. package/dist/components/SpiceSupply/lib/executors.d.ts +2 -0
  7. package/dist/components/SpiceSupply/lib/feePreview.d.ts +2 -0
  8. package/dist/execution/fundEmbeddedWallet.d.ts +7 -0
  9. package/dist/hooks/index.d.ts +2 -0
  10. package/dist/hooks/useSpiceSupply.d.ts +59 -0
  11. package/dist/hooks/useSupplyAssets.d.ts +3 -1
  12. package/dist/hooks/useSupplyQuote.d.ts +4 -1
  13. package/dist/index.cjs.js +11 -11
  14. package/dist/index.d.ts +12 -11
  15. package/dist/index.js +13 -13
  16. package/dist/privy-Bmq5ZKsB.js +2 -0
  17. package/dist/privy-DB3mdjuj.js +2 -0
  18. package/dist/providers/SpiceFlowProvider.d.ts +0 -3
  19. package/dist/types/assets.d.ts +2 -0
  20. package/dist/types/deposit.d.ts +1 -51
  21. package/dist/types/supply.d.ts +2 -1
  22. package/dist/utils/crossChainRouter/algebra.d.ts +83 -0
  23. package/dist/utils/crossChainRouter/liquidityVenues.d.ts +5 -14
  24. package/dist/utils/crossChainRouter/uniV3.d.ts +7 -30
  25. package/dist/utils/crossChainRouter/uniV4.d.ts +0 -34
  26. package/dist/utils/fees.d.ts +7 -0
  27. package/dist/utils/spiceConstants.d.ts +2 -0
  28. package/dist/utils/spicenetBatch.d.ts +18 -0
  29. package/dist/utils/swapQuotes.d.ts +2 -3
  30. package/package.json +2 -3
  31. package/dist/components/SpiceDeposit/lib/swapper.d.ts +0 -35
  32. package/dist/components/SpiceDeposit/steps/SelectSourceModal.d.ts +0 -3
  33. package/dist/components/SpiceDeposit/steps/SwapperDepositModal.d.ts +0 -3
  34. package/dist/hooks/useSwapperEmbed.d.ts +0 -23
  35. package/dist/privy-BXdQgePJ.js +0 -2
  36. package/dist/privy-DinsCCJf.js +0 -2
  37. package/dist/utils/crossChainRouter/nativeWrap.d.ts +0 -6
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- "use strict";const r=require("./privy-BXdQgePJ.js");require("react/jsx-runtime"),require("react"),require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions"),require("@privy-io/react-auth"),require("wagmi"),require("@tanstack/react-query"),exports.PrivyLogin=r.PrivyLogin;
2
+ "use strict";const r=require("./privy-DB3mdjuj.js");require("react/jsx-runtime"),require("react"),require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions"),require("@privy-io/react-auth"),require("wagmi"),require("@tanstack/react-query"),exports.PrivyLogin=r.PrivyLogin;
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import{P as g}from"./privy-DinsCCJf.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@privy-io/react-auth";import"wagmi";import"@tanstack/react-query";export{g as PrivyLogin};
2
+ import{P as g}from"./privy-Bmq5ZKsB.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@privy-io/react-auth";import"wagmi";import"@tanstack/react-query";export{g as PrivyLogin};
@@ -2,6 +2,7 @@ import React from "react";
2
2
  interface AccountActionsProps {
3
3
  onDepositClick?: () => void;
4
4
  onWithdrawClick?: () => void;
5
+ onDisconnectClick: () => void;
5
6
  depositDisabled?: boolean;
6
7
  withdrawDisabled?: boolean;
7
8
  primaryColor?: string;
@@ -18,6 +18,7 @@ interface AccountPanelProps {
18
18
  notice?: AccountNotice | null;
19
19
  onDepositClick?: () => void;
20
20
  onWithdrawClick?: () => void;
21
+ onDisconnectClick: () => void;
21
22
  depositDisabled?: boolean;
22
23
  onCompleteDeposit?: (deposit: VerifiedPendingDeposit) => void;
23
24
  primaryColor?: string;
@@ -7,6 +7,7 @@ import type { ResolvedExactOutputSwap } from "../../../utils/swapQuotes";
7
7
  import type { ExecutionOptions } from "../../../hooks/useSpiceExecution";
8
8
  import type { FeeEstimateSummary } from "@spicenet-io/spiceflow-core";
9
9
  type EstimateFn = (chainBatches: ChainBatch[], tokenAddress: string, tokenTransferAmount: bigint, options?: ExecutionOptions) => Promise<FeeEstimateSummary>;
10
+ export declare function buildEmbeddedEscrowDepositBatch(token: Address, amount: bigint, chainId: number): ChainBatch;
10
11
  export declare function stripSpicenetFundingBatches(batches: ChainBatch[]): ChainBatch[];
11
12
  export declare function scaleTokenAmount(amount: bigint, fromDecimals: number, toDecimals: number): bigint;
12
13
  export interface BatchBuilderContext {
@@ -12,12 +12,14 @@ export type PaymentResult = {
12
12
  txHash?: string;
13
13
  error?: string;
14
14
  };
15
+ export declare function isExternalSource(asset: SelectedAsset["asset"] | null | undefined, isNon7702: boolean): boolean;
15
16
  export type ExecutorContext = {
16
17
  selectedAsset: SelectedAsset | null;
17
18
  parsedAmount: number;
18
19
  currentPaymentAmount: string;
19
20
  isInsufficientBalance: boolean;
20
21
  isPayMode: boolean;
22
+ isFeeInclusiveInput: boolean;
21
23
  isNon7702: boolean;
22
24
  isSourceDestToken: boolean;
23
25
  needsSwap: boolean;
@@ -36,6 +36,7 @@ export declare function estimatePayFunding(args: {
36
36
  export declare function estimateSupplyMaxAmount(ctx: {
37
37
  asset: Asset;
38
38
  isPayMode: boolean;
39
+ isFeeInclusiveInput?: boolean;
39
40
  isNon7702: boolean;
40
41
  needsSwap: boolean;
41
42
  isQuoting: boolean;
@@ -49,6 +50,7 @@ export interface FeePreviewContext {
49
50
  signal?: AbortSignal;
50
51
  selectedAsset: SelectedAsset | null;
51
52
  isPayMode: boolean;
53
+ isFeeInclusiveInput?: boolean;
52
54
  parsedAmount: number;
53
55
  needsSwap: boolean;
54
56
  exactOutputSwap: ResolvedExactOutputSwap | null;
@@ -6,6 +6,13 @@ export declare function sendTokenTransferTx(extWc: any, params: {
6
6
  amount: bigint;
7
7
  viemChain?: unknown;
8
8
  }): Promise<`0x${string}`>;
9
+ export declare function readEmbeddedShortfall(params: {
10
+ sourceClient: any;
11
+ holder: Address;
12
+ tokenAddr: Address;
13
+ isNative: boolean;
14
+ amount: bigint;
15
+ }): Promise<bigint>;
9
16
  export declare function fundEmbeddedWallet(params: {
10
17
  extWc: any;
11
18
  sourceClient: any;
@@ -19,3 +19,5 @@ export type { PartnerWhitelistCheckResponse, UseIsUserWhitelistedOptions, } from
19
19
  export { useSupplyAssets, isSupportedSupplyAsset } from "./useSupplyAssets";
20
20
  export { useSupplyQuote, resolveInputSupplySwapQuote } from "./useSupplyQuote";
21
21
  export type { UseSupplyQuoteOpts, SupplyQuoteResult } from "./useSupplyQuote";
22
+ export { useSpiceSupply } from "./useSpiceSupply";
23
+ export type { UseSpiceSupplyParams, UseSpiceSupplyResult, } from "./useSpiceSupply";
@@ -0,0 +1,59 @@
1
+ import { type Address } from "viem";
2
+ import { type PaymentResult, type SupplyStep } from "../components/SpiceSupply/lib/executors";
3
+ import { useSupplyAssets } from "./useSupplyAssets";
4
+ import { useSupplyQuote } from "./useSupplyQuote";
5
+ import type { LiquidityVenue } from "../utils/crossChainRouter/liquidityVenues";
6
+ import type { SpiceSupplyProps } from "../types/supply";
7
+ import type { Asset, SelectedAsset } from "../types/assets";
8
+ import type { FeePreview } from "../types/ui";
9
+ export interface UseSpiceSupplyParams extends Pick<SpiceSupplyProps, "destinationToken" | "sourceChains" | "supportedSourceAssets" | "includeExternalWalletAssets" | "buildActionCalls" | "feeExecutionMode" | "buildSpicenetBatch" | "onPayExecute" | "resolveExactOutputSwap" | "amountDirection" | "onSuccess" | "onError"> {
10
+ enabled: boolean;
11
+ selectedAsset: SelectedAsset | null;
12
+ paymentAmount?: string;
13
+ recipient?: Address;
14
+ maxSlippage?: number;
15
+ resolveInputSwap?: LiquidityVenue["resolve"];
16
+ prependSourceEscrow?: boolean;
17
+ isZeroAmountPay?: boolean;
18
+ }
19
+ export interface UseSpiceSupplyResult {
20
+ assets: ReturnType<typeof useSupplyAssets> & {
21
+ selectable: Asset[];
22
+ };
23
+ quote: ReturnType<typeof useSupplyQuote>;
24
+ fees: {
25
+ preview: FeePreview | null;
26
+ isLoading: boolean;
27
+ ready: boolean;
28
+ error: string | null;
29
+ };
30
+ amount: {
31
+ parsed: number;
32
+ isBelowMinimum: boolean;
33
+ isInsufficientBalance: boolean;
34
+ sourceBalance: number;
35
+ feesExceedAmount: boolean;
36
+ };
37
+ status: {
38
+ step: SupplyStep;
39
+ statusMsg: string;
40
+ txHash: string | null;
41
+ isExecuting: boolean;
42
+ error: string | null;
43
+ showStatusPanel: boolean;
44
+ paymentResult: PaymentResult | null;
45
+ };
46
+ flags: {
47
+ directExecutionFeeNote: boolean;
48
+ };
49
+ canExecute: boolean;
50
+ submitSupply: () => Promise<void>;
51
+ submitPay: () => Promise<void>;
52
+ fundEmbeddedSource: (amount: bigint) => Promise<void>;
53
+ retrySupply: () => void;
54
+ dismissPaymentStatus: () => void;
55
+ resolveMaxAmount: (asset: Asset) => Promise<string | null>;
56
+ resetAfterSuccess: () => void;
57
+ resetPaymentState: () => void;
58
+ }
59
+ export declare function useSpiceSupply(params: UseSpiceSupplyParams): UseSpiceSupplyResult;
@@ -1,6 +1,6 @@
1
1
  import { type Address } from "viem";
2
2
  import type { Asset } from "../types/assets";
3
- export declare function isSupportedSupplyAsset(asset: Pick<Asset, "address" | "chainTokens">, supportedSourceAssets?: string[]): boolean;
3
+ export declare function isSupportedSupplyAsset(asset: Pick<Asset, "address" | "chainTokens" | "isNative">, supportedSourceAssets?: string[]): boolean;
4
4
  type DestinationToken = {
5
5
  address: Address;
6
6
  decimals: number;
@@ -14,9 +14,11 @@ export declare function useSupplyAssets(opts: {
14
14
  supportedSourceAssets?: string[];
15
15
  sourceChains?: number[];
16
16
  enabled: boolean;
17
+ includeExternalWalletAssets?: boolean;
17
18
  }): {
18
19
  displayAssets: (Asset & {
19
20
  _source: "wallet" | "spice";
21
+ _fundingWallet?: "embedded" | "external";
20
22
  })[];
21
23
  filteredSpiceAssets: Asset[];
22
24
  walletAssets: Asset[];
@@ -1,5 +1,5 @@
1
1
  import { type Address } from "viem";
2
- import type { ResolvedSwap } from "../utils/crossChainRouter/liquidityVenues";
2
+ import type { LiquidityVenue, ResolvedSwap } from "../utils/crossChainRouter/liquidityVenues";
3
3
  import { type ExactOutputSwapIntent, type ResolvedExactOutputSwap } from "../utils/swapQuotes";
4
4
  import type { SelectedAsset } from "../types/assets";
5
5
  export interface UseSupplyQuoteOpts {
@@ -14,6 +14,8 @@ export interface UseSupplyQuoteOpts {
14
14
  chainId: number;
15
15
  recipient: Address | undefined;
16
16
  paymentAmount?: string;
17
+ maxSlippage?: number;
18
+ resolveInputSwap?: LiquidityVenue["resolve"];
17
19
  resolveExactOutputSwap?: (intent: ExactOutputSwapIntent, chainId: number, recipient: Address) => Promise<ResolvedExactOutputSwap | null>;
18
20
  }
19
21
  export interface SupplyQuoteResult {
@@ -35,5 +37,6 @@ export declare function resolveInputSupplySwapQuote(params: {
35
37
  tokenIn: Address;
36
38
  tokenOut: Address;
37
39
  amountIn: bigint;
40
+ maxSlippage?: number;
38
41
  }): Promise<ResolvedSwap>;
39
42
  export declare function useSupplyQuote(opts: UseSupplyQuoteOpts): SupplyQuoteResult;