@spicenet-io/spiceflow-ui 4.18.1 → 4.18.2

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.
@@ -73,6 +73,7 @@ export interface AssetSelectorProps {
73
73
  canAddAsset?: boolean;
74
74
  maxAmount?: string;
75
75
  resolveMaxAmount?: (asset: Asset) => string | null | Promise<string | null>;
76
+ getAvailableBalance?: (asset: Asset) => bigint | undefined;
76
77
  hideAmountInput?: boolean;
77
78
  displayAmount?: string;
78
79
  dark?: boolean;
@@ -102,4 +103,5 @@ export interface AssetDropdownProps {
102
103
  disabled?: boolean;
103
104
  theme?: Theme;
104
105
  onViewAllAssets?: () => void;
106
+ getAvailableBalance?: (asset: Asset) => bigint | undefined;
105
107
  }
@@ -16,12 +16,18 @@ export type PreparedLimitOrder = {
16
16
  amountIn: bigint;
17
17
  minimumOutput: bigint;
18
18
  feeAmount: bigint;
19
+ funding?: {
20
+ sourceSpendCap: bigint;
21
+ depositAmount: bigint;
22
+ feeAmount: bigint;
23
+ };
24
+ fundingWarning?: "insufficient_balance";
19
25
  path: Hex;
20
26
  };
21
27
  export type LimitOrder = {
22
28
  id: string;
23
29
  user: string;
24
- status: "open" | "executing" | "filled" | "cancelled" | "expired" | "needs_attention";
30
+ status: "open" | "executing" | "filled" | "cancelled" | "expired" | "failed" | "needs_attention";
25
31
  receiptToken: string;
26
32
  reservedAmount: string;
27
33
  expiresAt: string;
@@ -34,4 +40,5 @@ export type LimitOrder = {
34
40
  actionId: string | null;
35
41
  transactionHash: string | null;
36
42
  lastError: string | null;
43
+ warning?: "insufficient_balance" | null;
37
44
  };
@@ -53,6 +53,7 @@ export interface SpiceLockModalProps {
53
53
  destinationTokenDecimals?: number;
54
54
  beneficiary?: Address;
55
55
  feeFunding?: SpiceSupplyProps["feeFunding"];
56
+ combineSourceBalances?: SpiceSupplyProps["combineSourceBalances"];
56
57
  buildSpicenetBatch?: (params: {
57
58
  userAddress: Address;
58
59
  destinationChainId: number;
@@ -50,6 +50,8 @@ export interface BuildActionCallsContext {
50
50
  };
51
51
  }
52
52
  export interface SupplyBatchBuildOptions {
53
+ onSourceAllocation?: (allocation: import("../utils/combinedSourceBalances").CombinedSourceAllocation) => void;
54
+ combinedSourceGroupOverride?: import("../utils/combinedSourceBalances").CombinedSourceGroup | null;
53
55
  sourceSpendCap?: bigint;
54
56
  fundingTokenOverride?: Address;
55
57
  minimumDestinationAmount?: bigint;
@@ -113,6 +115,7 @@ export interface SpiceSupplyProps {
113
115
  additionalSourceTokens?: DestinationTokenConfig[];
114
116
  includeExternalWalletAssets?: boolean;
115
117
  includeCrossChainEmbeddedAssets?: boolean;
118
+ combineSourceBalances?: boolean;
116
119
  sourceFundingRecoveryKey?: string;
117
120
  sourceFundingRecovery?: "resume" | "balance";
118
121
  recipient?: Address;
@@ -0,0 +1,56 @@
1
+ import type { Address } from "viem";
2
+ import type { Asset } from "../types/assets";
3
+ type CombinedPosition = {
4
+ positionId: string;
5
+ asset: Asset;
6
+ amount: bigint;
7
+ reservedAmount: bigint;
8
+ availableAmount: bigint;
9
+ };
10
+ type SourceReserve = {
11
+ asset: Asset;
12
+ amount: bigint;
13
+ };
14
+ type SavedReserve = {
15
+ positionId: string;
16
+ amount: bigint;
17
+ };
18
+ export type CombinedSourceGroup = {
19
+ wallet: Asset;
20
+ escrow: Asset;
21
+ owner: Address;
22
+ chainId: number;
23
+ token: Address;
24
+ decimals: number;
25
+ representativePositionId: string;
26
+ representativeDecimals: number;
27
+ walletAvailable: bigint;
28
+ escrowAvailable: bigint;
29
+ availableBalance: bigint;
30
+ reserve?: {
31
+ positionId: string;
32
+ amount: bigint;
33
+ };
34
+ reserves: SavedReserve[];
35
+ };
36
+ export type CombinedSourceAllocation = {
37
+ owner: Address;
38
+ chainId: number;
39
+ token: Address;
40
+ decimals: number;
41
+ representativePositionId: string;
42
+ representativeDecimals: number;
43
+ route: "escrow" | "in-place";
44
+ grossAmount: bigint;
45
+ positions: CombinedPosition[];
46
+ insufficient: boolean;
47
+ walletDeposit: bigint;
48
+ escrowWithdrawal: bigint;
49
+ walletInPlace: bigint;
50
+ };
51
+ export declare function getCombinedSourceGroup(asset: Asset, assets: Asset[], owner: string | undefined, chainId: number, escrowAvailable?: bigint, reserve?: SourceReserve | SourceReserve[]): CombinedSourceGroup | undefined;
52
+ export declare function allocateCombinedSource(group: CombinedSourceGroup, grossAmount: bigint, route: "escrow" | "in-place", options?: {
53
+ quoteOnly?: boolean;
54
+ }): CombinedSourceAllocation;
55
+ export declare function assertCombinedSourceAllocation(allocation: CombinedSourceAllocation, assets: Asset[], owner: string | undefined, chainId: number, escrowAvailable?: bigint): void;
56
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spicenet-io/spiceflow-ui",
3
- "version": "4.18.1",
3
+ "version": "4.18.2",
4
4
  "description": "Spiceflow UI SDK",
5
5
  "type": "module",
6
6
  "workspaces": [
File without changes