@oydual31/more-vaults-sdk 0.4.0 → 0.4.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.
- package/README.md +859 -215
- package/dist/react/index.cjs +644 -0
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +111 -2
- package/dist/react/index.d.ts +111 -2
- package/dist/react/index.js +638 -3
- package/dist/react/index.js.map +1 -1
- package/dist/{spokeRoutes-BIafSbQ3.d.cts → spokeRoutes-B8Lnk-t4.d.cts} +191 -2
- package/dist/{spokeRoutes-BIafSbQ3.d.ts → spokeRoutes-B8Lnk-t4.d.ts} +191 -2
- package/dist/viem/index.d.cts +4 -192
- package/dist/viem/index.d.ts +4 -192
- package/package.json +1 -1
- package/src/react/index.ts +25 -0
- package/src/react/useCuratorVaultStatus.ts +32 -0
- package/src/react/useExecuteActions.ts +23 -0
- package/src/react/useIsCurator.ts +30 -0
- package/src/react/usePendingActions.ts +33 -0
- package/src/react/useProtocolWhitelist.ts +30 -0
- package/src/react/useSubmitActions.ts +27 -0
- package/src/react/useVaultAnalysis.ts +32 -0
- package/src/react/useVaultAssetBreakdown.ts +32 -0
- package/src/react/useVetoActions.ts +23 -0
|
@@ -1,4 +1,193 @@
|
|
|
1
|
-
import { Address, PublicClient, WalletClient
|
|
1
|
+
import { Address, Hash, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
interface VaultAddresses {
|
|
4
|
+
/** Hub vault address (diamond proxy) */
|
|
5
|
+
vault: Address;
|
|
6
|
+
/** MoreVaultsEscrow — holds locked tokens during async cross-chain flows */
|
|
7
|
+
escrow?: Address;
|
|
8
|
+
/** OFTAdapter for vault shares (cross-chain redeem only) */
|
|
9
|
+
shareOFT?: Address;
|
|
10
|
+
/** OFT for USDC bridging (cross-chain deposits from spoke) */
|
|
11
|
+
usdcOFT?: Address;
|
|
12
|
+
/**
|
|
13
|
+
* Expected EVM chain ID of the hub. When provided, SDK functions will
|
|
14
|
+
* throw a clear WrongChainError if the walletClient is on a different chain.
|
|
15
|
+
* Prevents silent failures when MetaMask is connected to the wrong network.
|
|
16
|
+
*/
|
|
17
|
+
hubChainId?: number;
|
|
18
|
+
}
|
|
19
|
+
interface DepositResult {
|
|
20
|
+
txHash: Hash;
|
|
21
|
+
shares: bigint;
|
|
22
|
+
}
|
|
23
|
+
interface RedeemResult {
|
|
24
|
+
txHash: Hash;
|
|
25
|
+
assets: bigint;
|
|
26
|
+
}
|
|
27
|
+
interface AsyncRequestResult {
|
|
28
|
+
txHash: Hash;
|
|
29
|
+
/** Cross-chain request GUID to track via getRequestInfo / getFinalizationResult */
|
|
30
|
+
guid: `0x${string}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ActionType enum values matching MoreVaultsLib.ActionType on-chain.
|
|
34
|
+
* DEPOSIT=0, MINT=1, WITHDRAW=2, REDEEM=3, MULTI_ASSETS_DEPOSIT=4, ACCRUE_FEES=5
|
|
35
|
+
*/
|
|
36
|
+
declare const ActionType: {
|
|
37
|
+
readonly DEPOSIT: 0;
|
|
38
|
+
readonly MINT: 1;
|
|
39
|
+
readonly WITHDRAW: 2;
|
|
40
|
+
readonly REDEEM: 3;
|
|
41
|
+
readonly MULTI_ASSETS_DEPOSIT: 4;
|
|
42
|
+
readonly ACCRUE_FEES: 5;
|
|
43
|
+
};
|
|
44
|
+
type ActionTypeValue = (typeof ActionType)[keyof typeof ActionType];
|
|
45
|
+
/**
|
|
46
|
+
* Data needed to execute a pending LZ compose on the hub chain.
|
|
47
|
+
* Returned by `depositFromSpoke` when the OFT is a Stargate V2 pool,
|
|
48
|
+
* because Stargate cannot forward ETH to the compose executor.
|
|
49
|
+
* The SDK user must call `executeCompose()` with this data as a second TX on the hub.
|
|
50
|
+
*/
|
|
51
|
+
interface ComposeData {
|
|
52
|
+
/** LZ Endpoint address on the hub chain */
|
|
53
|
+
endpoint: Address;
|
|
54
|
+
/** The OFT/pool address that sent the compose (Stargate pool on hub) */
|
|
55
|
+
from: Address;
|
|
56
|
+
/** MoreVaultsComposer address on the hub */
|
|
57
|
+
to: Address;
|
|
58
|
+
/** LayerZero GUID from the original OFT.send() */
|
|
59
|
+
guid: `0x${string}`;
|
|
60
|
+
/** Compose index (always 0 for single-compose messages) */
|
|
61
|
+
index: number;
|
|
62
|
+
/** The full compose message bytes (reconstructed from composeMsg + OFT header) */
|
|
63
|
+
message: `0x${string}`;
|
|
64
|
+
/** Whether this is a Stargate OFT that requires a 2-TX flow */
|
|
65
|
+
isStargate: boolean;
|
|
66
|
+
/** Hub chain ID for creating the hub wallet/public client */
|
|
67
|
+
hubChainId: number;
|
|
68
|
+
/** Hub block number just before TX1 was sent — used as search start for ComposeSent events */
|
|
69
|
+
hubBlockStart: bigint;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Result from `depositFromSpoke`.
|
|
73
|
+
* When `composeData` is present, the user must call `executeCompose()` on the hub chain.
|
|
74
|
+
*/
|
|
75
|
+
interface SpokeDepositResult {
|
|
76
|
+
txHash: Hash;
|
|
77
|
+
guid: `0x${string}`;
|
|
78
|
+
/** Present when OFT is Stargate V2 — user must execute compose on hub as TX2 */
|
|
79
|
+
composeData?: ComposeData;
|
|
80
|
+
}
|
|
81
|
+
interface CrossChainRequestInfo {
|
|
82
|
+
initiator: Address;
|
|
83
|
+
timestamp: bigint;
|
|
84
|
+
actionType: number;
|
|
85
|
+
actionCallData: `0x${string}`;
|
|
86
|
+
fulfilled: boolean;
|
|
87
|
+
finalized: boolean;
|
|
88
|
+
refunded: boolean;
|
|
89
|
+
totalAssets: bigint;
|
|
90
|
+
finalizationResult: bigint;
|
|
91
|
+
amountLimit: bigint;
|
|
92
|
+
}
|
|
93
|
+
interface SwapParams {
|
|
94
|
+
targetContract: Address;
|
|
95
|
+
tokenIn: Address;
|
|
96
|
+
tokenOut: Address;
|
|
97
|
+
maxAmountIn: bigint;
|
|
98
|
+
minAmountOut: bigint;
|
|
99
|
+
swapCallData: `0x${string}`;
|
|
100
|
+
}
|
|
101
|
+
interface BatchSwapParams {
|
|
102
|
+
swaps: SwapParams[];
|
|
103
|
+
}
|
|
104
|
+
interface BridgeParams {
|
|
105
|
+
oftToken: Address;
|
|
106
|
+
dstEid: number;
|
|
107
|
+
amount: bigint;
|
|
108
|
+
dstVault: Address;
|
|
109
|
+
refundAddress: Address;
|
|
110
|
+
}
|
|
111
|
+
interface PendingAction {
|
|
112
|
+
nonce: bigint;
|
|
113
|
+
actionsData: `0x${string}`[];
|
|
114
|
+
pendingUntil: bigint;
|
|
115
|
+
isExecutable: boolean;
|
|
116
|
+
}
|
|
117
|
+
interface SubmitActionsResult {
|
|
118
|
+
txHash: `0x${string}`;
|
|
119
|
+
nonce: bigint;
|
|
120
|
+
}
|
|
121
|
+
type CuratorAction = {
|
|
122
|
+
type: 'swap';
|
|
123
|
+
params: SwapParams;
|
|
124
|
+
} | {
|
|
125
|
+
type: 'batchSwap';
|
|
126
|
+
params: BatchSwapParams;
|
|
127
|
+
} | {
|
|
128
|
+
type: 'erc4626Deposit';
|
|
129
|
+
vault: Address;
|
|
130
|
+
assets: bigint;
|
|
131
|
+
} | {
|
|
132
|
+
type: 'erc4626Redeem';
|
|
133
|
+
vault: Address;
|
|
134
|
+
shares: bigint;
|
|
135
|
+
} | {
|
|
136
|
+
type: 'erc7540RequestDeposit';
|
|
137
|
+
vault: Address;
|
|
138
|
+
assets: bigint;
|
|
139
|
+
} | {
|
|
140
|
+
type: 'erc7540Deposit';
|
|
141
|
+
vault: Address;
|
|
142
|
+
assets: bigint;
|
|
143
|
+
} | {
|
|
144
|
+
type: 'erc7540RequestRedeem';
|
|
145
|
+
vault: Address;
|
|
146
|
+
shares: bigint;
|
|
147
|
+
} | {
|
|
148
|
+
type: 'erc7540Redeem';
|
|
149
|
+
vault: Address;
|
|
150
|
+
shares: bigint;
|
|
151
|
+
};
|
|
152
|
+
interface CuratorVaultStatus {
|
|
153
|
+
curator: Address;
|
|
154
|
+
timeLockPeriod: bigint;
|
|
155
|
+
maxSlippagePercent: bigint;
|
|
156
|
+
currentNonce: bigint;
|
|
157
|
+
availableAssets: Address[];
|
|
158
|
+
lzAdapter: Address;
|
|
159
|
+
paused: boolean;
|
|
160
|
+
}
|
|
161
|
+
interface AssetInfo {
|
|
162
|
+
address: Address;
|
|
163
|
+
symbol: string;
|
|
164
|
+
name: string;
|
|
165
|
+
decimals: number;
|
|
166
|
+
}
|
|
167
|
+
interface VaultAnalysis {
|
|
168
|
+
/** All tokens the vault can hold/swap (curator-managed) */
|
|
169
|
+
availableAssets: AssetInfo[];
|
|
170
|
+
/** Tokens users can deposit */
|
|
171
|
+
depositableAssets: AssetInfo[];
|
|
172
|
+
/** Whether deposit whitelist is enabled (restricts who can deposit) */
|
|
173
|
+
depositWhitelistEnabled: boolean;
|
|
174
|
+
/** Registry address for global protocol whitelist checks */
|
|
175
|
+
registryAddress: Address | null;
|
|
176
|
+
}
|
|
177
|
+
interface AssetBalance extends AssetInfo {
|
|
178
|
+
/** Raw balance held by the vault */
|
|
179
|
+
balance: bigint;
|
|
180
|
+
}
|
|
181
|
+
interface VaultAssetBreakdown {
|
|
182
|
+
/** Per-asset balances held by the vault on the hub chain */
|
|
183
|
+
assets: AssetBalance[];
|
|
184
|
+
/** totalAssets() as reported by the vault (all positions converted to underlying) */
|
|
185
|
+
totalAssets: bigint;
|
|
186
|
+
/** totalSupply() of vault shares */
|
|
187
|
+
totalSupply: bigint;
|
|
188
|
+
/** Vault underlying token decimals */
|
|
189
|
+
underlyingDecimals: number;
|
|
190
|
+
}
|
|
2
191
|
|
|
3
192
|
/**
|
|
4
193
|
* Wait for a transaction receipt with generous timeout and retry logic.
|
|
@@ -629,4 +818,4 @@ declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<
|
|
|
629
818
|
*/
|
|
630
819
|
declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, amount: bigint, userAddress: Address): Promise<bigint>;
|
|
631
820
|
|
|
632
|
-
export { type
|
|
821
|
+
export { getUserBalancesForRoutes as $, type AsyncRequestResult as A, type BatchSwapParams as B, type ComposeData as C, type DepositResult as D, type VaultSummary as E, type VaultTopology as F, canDeposit as G, detectStargateOft as H, type InboundRoute as I, discoverVaultTopology as J, ensureAllowance as K, getAllVaultChainIds as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, type PendingAction as P, getAsyncRequestStatus as Q, type RedeemResult as R, type SpokeDepositResult as S, getAsyncRequestStatusLabel as T, type UserBalances as U, type VaultAddresses as V, getFullVaultTopology as W, getInboundRoutes as X, getMaxWithdrawable as Y, getOutboundRoutes as Z, getUserBalances as _, type CuratorVaultStatus as a, getUserPosition as a0, getUserPositionMultiChain as a1, getVaultDistribution as a2, getVaultDistributionWithTopology as a3, getVaultMetadata as a4, getVaultStatus as a5, getVaultSummary as a6, getVaultTopology as a7, isAsyncMode as a8, isOnHubChain as a9, previewDeposit as aa, previewRedeem as ab, quoteLzFee as ac, quoteRouteDepositFee as ad, waitForAsyncRequest as ae, waitForTx as af, type VaultAnalysis as b, type VaultAssetBreakdown as c, type CuratorAction as d, type SubmitActionsResult as e, ActionType as f, type ActionTypeValue as g, type AssetBalance as h, type AssetInfo as i, type AsyncRequestFinalResult as j, type AsyncRequestStatus as k, type AsyncRequestStatusInfo as l, type BridgeParams as m, type CrossChainRequestInfo as n, type DepositBlockReason as o, type DepositEligibility as p, type InboundRouteWithBalance as q, type MultiChainUserPosition as r, type OutboundRoute as s, type SpokeBalance as t, type SwapParams as u, type UserPosition as v, type VaultDistribution as w, type VaultMetadata as x, type VaultMode as y, type VaultStatus as z };
|
|
@@ -1,4 +1,193 @@
|
|
|
1
|
-
import { Address, PublicClient, WalletClient
|
|
1
|
+
import { Address, Hash, PublicClient, WalletClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
interface VaultAddresses {
|
|
4
|
+
/** Hub vault address (diamond proxy) */
|
|
5
|
+
vault: Address;
|
|
6
|
+
/** MoreVaultsEscrow — holds locked tokens during async cross-chain flows */
|
|
7
|
+
escrow?: Address;
|
|
8
|
+
/** OFTAdapter for vault shares (cross-chain redeem only) */
|
|
9
|
+
shareOFT?: Address;
|
|
10
|
+
/** OFT for USDC bridging (cross-chain deposits from spoke) */
|
|
11
|
+
usdcOFT?: Address;
|
|
12
|
+
/**
|
|
13
|
+
* Expected EVM chain ID of the hub. When provided, SDK functions will
|
|
14
|
+
* throw a clear WrongChainError if the walletClient is on a different chain.
|
|
15
|
+
* Prevents silent failures when MetaMask is connected to the wrong network.
|
|
16
|
+
*/
|
|
17
|
+
hubChainId?: number;
|
|
18
|
+
}
|
|
19
|
+
interface DepositResult {
|
|
20
|
+
txHash: Hash;
|
|
21
|
+
shares: bigint;
|
|
22
|
+
}
|
|
23
|
+
interface RedeemResult {
|
|
24
|
+
txHash: Hash;
|
|
25
|
+
assets: bigint;
|
|
26
|
+
}
|
|
27
|
+
interface AsyncRequestResult {
|
|
28
|
+
txHash: Hash;
|
|
29
|
+
/** Cross-chain request GUID to track via getRequestInfo / getFinalizationResult */
|
|
30
|
+
guid: `0x${string}`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* ActionType enum values matching MoreVaultsLib.ActionType on-chain.
|
|
34
|
+
* DEPOSIT=0, MINT=1, WITHDRAW=2, REDEEM=3, MULTI_ASSETS_DEPOSIT=4, ACCRUE_FEES=5
|
|
35
|
+
*/
|
|
36
|
+
declare const ActionType: {
|
|
37
|
+
readonly DEPOSIT: 0;
|
|
38
|
+
readonly MINT: 1;
|
|
39
|
+
readonly WITHDRAW: 2;
|
|
40
|
+
readonly REDEEM: 3;
|
|
41
|
+
readonly MULTI_ASSETS_DEPOSIT: 4;
|
|
42
|
+
readonly ACCRUE_FEES: 5;
|
|
43
|
+
};
|
|
44
|
+
type ActionTypeValue = (typeof ActionType)[keyof typeof ActionType];
|
|
45
|
+
/**
|
|
46
|
+
* Data needed to execute a pending LZ compose on the hub chain.
|
|
47
|
+
* Returned by `depositFromSpoke` when the OFT is a Stargate V2 pool,
|
|
48
|
+
* because Stargate cannot forward ETH to the compose executor.
|
|
49
|
+
* The SDK user must call `executeCompose()` with this data as a second TX on the hub.
|
|
50
|
+
*/
|
|
51
|
+
interface ComposeData {
|
|
52
|
+
/** LZ Endpoint address on the hub chain */
|
|
53
|
+
endpoint: Address;
|
|
54
|
+
/** The OFT/pool address that sent the compose (Stargate pool on hub) */
|
|
55
|
+
from: Address;
|
|
56
|
+
/** MoreVaultsComposer address on the hub */
|
|
57
|
+
to: Address;
|
|
58
|
+
/** LayerZero GUID from the original OFT.send() */
|
|
59
|
+
guid: `0x${string}`;
|
|
60
|
+
/** Compose index (always 0 for single-compose messages) */
|
|
61
|
+
index: number;
|
|
62
|
+
/** The full compose message bytes (reconstructed from composeMsg + OFT header) */
|
|
63
|
+
message: `0x${string}`;
|
|
64
|
+
/** Whether this is a Stargate OFT that requires a 2-TX flow */
|
|
65
|
+
isStargate: boolean;
|
|
66
|
+
/** Hub chain ID for creating the hub wallet/public client */
|
|
67
|
+
hubChainId: number;
|
|
68
|
+
/** Hub block number just before TX1 was sent — used as search start for ComposeSent events */
|
|
69
|
+
hubBlockStart: bigint;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Result from `depositFromSpoke`.
|
|
73
|
+
* When `composeData` is present, the user must call `executeCompose()` on the hub chain.
|
|
74
|
+
*/
|
|
75
|
+
interface SpokeDepositResult {
|
|
76
|
+
txHash: Hash;
|
|
77
|
+
guid: `0x${string}`;
|
|
78
|
+
/** Present when OFT is Stargate V2 — user must execute compose on hub as TX2 */
|
|
79
|
+
composeData?: ComposeData;
|
|
80
|
+
}
|
|
81
|
+
interface CrossChainRequestInfo {
|
|
82
|
+
initiator: Address;
|
|
83
|
+
timestamp: bigint;
|
|
84
|
+
actionType: number;
|
|
85
|
+
actionCallData: `0x${string}`;
|
|
86
|
+
fulfilled: boolean;
|
|
87
|
+
finalized: boolean;
|
|
88
|
+
refunded: boolean;
|
|
89
|
+
totalAssets: bigint;
|
|
90
|
+
finalizationResult: bigint;
|
|
91
|
+
amountLimit: bigint;
|
|
92
|
+
}
|
|
93
|
+
interface SwapParams {
|
|
94
|
+
targetContract: Address;
|
|
95
|
+
tokenIn: Address;
|
|
96
|
+
tokenOut: Address;
|
|
97
|
+
maxAmountIn: bigint;
|
|
98
|
+
minAmountOut: bigint;
|
|
99
|
+
swapCallData: `0x${string}`;
|
|
100
|
+
}
|
|
101
|
+
interface BatchSwapParams {
|
|
102
|
+
swaps: SwapParams[];
|
|
103
|
+
}
|
|
104
|
+
interface BridgeParams {
|
|
105
|
+
oftToken: Address;
|
|
106
|
+
dstEid: number;
|
|
107
|
+
amount: bigint;
|
|
108
|
+
dstVault: Address;
|
|
109
|
+
refundAddress: Address;
|
|
110
|
+
}
|
|
111
|
+
interface PendingAction {
|
|
112
|
+
nonce: bigint;
|
|
113
|
+
actionsData: `0x${string}`[];
|
|
114
|
+
pendingUntil: bigint;
|
|
115
|
+
isExecutable: boolean;
|
|
116
|
+
}
|
|
117
|
+
interface SubmitActionsResult {
|
|
118
|
+
txHash: `0x${string}`;
|
|
119
|
+
nonce: bigint;
|
|
120
|
+
}
|
|
121
|
+
type CuratorAction = {
|
|
122
|
+
type: 'swap';
|
|
123
|
+
params: SwapParams;
|
|
124
|
+
} | {
|
|
125
|
+
type: 'batchSwap';
|
|
126
|
+
params: BatchSwapParams;
|
|
127
|
+
} | {
|
|
128
|
+
type: 'erc4626Deposit';
|
|
129
|
+
vault: Address;
|
|
130
|
+
assets: bigint;
|
|
131
|
+
} | {
|
|
132
|
+
type: 'erc4626Redeem';
|
|
133
|
+
vault: Address;
|
|
134
|
+
shares: bigint;
|
|
135
|
+
} | {
|
|
136
|
+
type: 'erc7540RequestDeposit';
|
|
137
|
+
vault: Address;
|
|
138
|
+
assets: bigint;
|
|
139
|
+
} | {
|
|
140
|
+
type: 'erc7540Deposit';
|
|
141
|
+
vault: Address;
|
|
142
|
+
assets: bigint;
|
|
143
|
+
} | {
|
|
144
|
+
type: 'erc7540RequestRedeem';
|
|
145
|
+
vault: Address;
|
|
146
|
+
shares: bigint;
|
|
147
|
+
} | {
|
|
148
|
+
type: 'erc7540Redeem';
|
|
149
|
+
vault: Address;
|
|
150
|
+
shares: bigint;
|
|
151
|
+
};
|
|
152
|
+
interface CuratorVaultStatus {
|
|
153
|
+
curator: Address;
|
|
154
|
+
timeLockPeriod: bigint;
|
|
155
|
+
maxSlippagePercent: bigint;
|
|
156
|
+
currentNonce: bigint;
|
|
157
|
+
availableAssets: Address[];
|
|
158
|
+
lzAdapter: Address;
|
|
159
|
+
paused: boolean;
|
|
160
|
+
}
|
|
161
|
+
interface AssetInfo {
|
|
162
|
+
address: Address;
|
|
163
|
+
symbol: string;
|
|
164
|
+
name: string;
|
|
165
|
+
decimals: number;
|
|
166
|
+
}
|
|
167
|
+
interface VaultAnalysis {
|
|
168
|
+
/** All tokens the vault can hold/swap (curator-managed) */
|
|
169
|
+
availableAssets: AssetInfo[];
|
|
170
|
+
/** Tokens users can deposit */
|
|
171
|
+
depositableAssets: AssetInfo[];
|
|
172
|
+
/** Whether deposit whitelist is enabled (restricts who can deposit) */
|
|
173
|
+
depositWhitelistEnabled: boolean;
|
|
174
|
+
/** Registry address for global protocol whitelist checks */
|
|
175
|
+
registryAddress: Address | null;
|
|
176
|
+
}
|
|
177
|
+
interface AssetBalance extends AssetInfo {
|
|
178
|
+
/** Raw balance held by the vault */
|
|
179
|
+
balance: bigint;
|
|
180
|
+
}
|
|
181
|
+
interface VaultAssetBreakdown {
|
|
182
|
+
/** Per-asset balances held by the vault on the hub chain */
|
|
183
|
+
assets: AssetBalance[];
|
|
184
|
+
/** totalAssets() as reported by the vault (all positions converted to underlying) */
|
|
185
|
+
totalAssets: bigint;
|
|
186
|
+
/** totalSupply() of vault shares */
|
|
187
|
+
totalSupply: bigint;
|
|
188
|
+
/** Vault underlying token decimals */
|
|
189
|
+
underlyingDecimals: number;
|
|
190
|
+
}
|
|
2
191
|
|
|
3
192
|
/**
|
|
4
193
|
* Wait for a transaction receipt with generous timeout and retry logic.
|
|
@@ -629,4 +818,4 @@ declare function getOutboundRoutes(hubChainId: number, vault: Address): Promise<
|
|
|
629
818
|
*/
|
|
630
819
|
declare function quoteRouteDepositFee(route: InboundRoute, hubChainId: number, amount: bigint, userAddress: Address): Promise<bigint>;
|
|
631
820
|
|
|
632
|
-
export { type
|
|
821
|
+
export { getUserBalancesForRoutes as $, type AsyncRequestResult as A, type BatchSwapParams as B, type ComposeData as C, type DepositResult as D, type VaultSummary as E, type VaultTopology as F, canDeposit as G, detectStargateOft as H, type InboundRoute as I, discoverVaultTopology as J, ensureAllowance as K, getAllVaultChainIds as L, type MaxWithdrawable as M, NATIVE_SYMBOL as N, OMNI_FACTORY_ADDRESS as O, type PendingAction as P, getAsyncRequestStatus as Q, type RedeemResult as R, type SpokeDepositResult as S, getAsyncRequestStatusLabel as T, type UserBalances as U, type VaultAddresses as V, getFullVaultTopology as W, getInboundRoutes as X, getMaxWithdrawable as Y, getOutboundRoutes as Z, getUserBalances as _, type CuratorVaultStatus as a, getUserPosition as a0, getUserPositionMultiChain as a1, getVaultDistribution as a2, getVaultDistributionWithTopology as a3, getVaultMetadata as a4, getVaultStatus as a5, getVaultSummary as a6, getVaultTopology as a7, isAsyncMode as a8, isOnHubChain as a9, previewDeposit as aa, previewRedeem as ab, quoteLzFee as ac, quoteRouteDepositFee as ad, waitForAsyncRequest as ae, waitForTx as af, type VaultAnalysis as b, type VaultAssetBreakdown as c, type CuratorAction as d, type SubmitActionsResult as e, ActionType as f, type ActionTypeValue as g, type AssetBalance as h, type AssetInfo as i, type AsyncRequestFinalResult as j, type AsyncRequestStatus as k, type AsyncRequestStatusInfo as l, type BridgeParams as m, type CrossChainRequestInfo as n, type DepositBlockReason as o, type DepositEligibility as p, type InboundRouteWithBalance as q, type MultiChainUserPosition as r, type OutboundRoute as s, type SpokeBalance as t, type SwapParams as u, type UserPosition as v, type VaultDistribution as w, type VaultMetadata as x, type VaultMode as y, type VaultStatus as z };
|
package/dist/viem/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { V as VaultAddresses, A as AsyncRequestResult, D as DepositResult, S as SpokeDepositResult, C as ComposeData, R as RedeemResult, a as CuratorVaultStatus, P as PendingAction, b as VaultAnalysis, c as VaultAssetBreakdown, d as CuratorAction, e as SubmitActionsResult } from '../spokeRoutes-B8Lnk-t4.cjs';
|
|
2
|
+
export { f as ActionType, g as ActionTypeValue, h as AssetBalance, i as AssetInfo, j as AsyncRequestFinalResult, k as AsyncRequestStatus, l as AsyncRequestStatusInfo, B as BatchSwapParams, m as BridgeParams, n as CrossChainRequestInfo, o as DepositBlockReason, p as DepositEligibility, I as InboundRoute, q as InboundRouteWithBalance, M as MaxWithdrawable, r as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, s as OutboundRoute, t as SpokeBalance, u as SwapParams, U as UserBalances, v as UserPosition, w as VaultDistribution, x as VaultMetadata, y as VaultMode, z as VaultStatus, E as VaultSummary, F as VaultTopology, G as canDeposit, H as detectStargateOft, J as discoverVaultTopology, K as ensureAllowance, L as getAllVaultChainIds, Q as getAsyncRequestStatus, T as getAsyncRequestStatusLabel, W as getFullVaultTopology, X as getInboundRoutes, Y as getMaxWithdrawable, Z as getOutboundRoutes, _ as getUserBalances, $ as getUserBalancesForRoutes, a0 as getUserPosition, a1 as getUserPositionMultiChain, a2 as getVaultDistribution, a3 as getVaultDistributionWithTopology, a4 as getVaultMetadata, a5 as getVaultStatus, a6 as getVaultSummary, a7 as getVaultTopology, a8 as isAsyncMode, a9 as isOnHubChain, aa as previewDeposit, ab as previewRedeem, ac as quoteLzFee, ad as quoteRouteDepositFee, ae as waitForAsyncRequest, af as waitForTx } from '../spokeRoutes-B8Lnk-t4.cjs';
|
|
3
|
+
import { WalletClient, PublicClient, Address, Hash } from 'viem';
|
|
2
4
|
export { PublicClient as SdkPublicClient } from 'viem';
|
|
3
|
-
export { A as AsyncRequestFinalResult, a as AsyncRequestStatus, b as AsyncRequestStatusInfo, D as DepositBlockReason, c as DepositEligibility, I as InboundRoute, d as InboundRouteWithBalance, M as MaxWithdrawable, e as MultiChainUserPosition, N as NATIVE_SYMBOL, O as OMNI_FACTORY_ADDRESS, f as OutboundRoute, S as SpokeBalance, U as UserBalances, g as UserPosition, V as VaultDistribution, h as VaultMetadata, i as VaultMode, j as VaultStatus, k as VaultSummary, l as VaultTopology, m as canDeposit, n as detectStargateOft, o as discoverVaultTopology, p as ensureAllowance, q as getAllVaultChainIds, r as getAsyncRequestStatus, s as getAsyncRequestStatusLabel, t as getFullVaultTopology, u as getInboundRoutes, v as getMaxWithdrawable, w as getOutboundRoutes, x as getUserBalances, y as getUserBalancesForRoutes, z as getUserPosition, B as getUserPositionMultiChain, C as getVaultDistribution, E as getVaultDistributionWithTopology, F as getVaultMetadata, G as getVaultStatus, H as getVaultSummary, J as getVaultTopology, K as isAsyncMode, L as isOnHubChain, P as previewDeposit, Q as previewRedeem, R as quoteLzFee, T as quoteRouteDepositFee, W as waitForAsyncRequest, X as waitForTx } from '../spokeRoutes-BIafSbQ3.cjs';
|
|
4
5
|
|
|
5
6
|
/** EVM Chain IDs for chains supported by MoreVaults */
|
|
6
7
|
declare const CHAIN_IDS: {
|
|
@@ -1613,195 +1614,6 @@ declare const LZ_ENDPOINT_ABI: readonly [{
|
|
|
1613
1614
|
readonly stateMutability: "payable";
|
|
1614
1615
|
}];
|
|
1615
1616
|
|
|
1616
|
-
interface VaultAddresses {
|
|
1617
|
-
/** Hub vault address (diamond proxy) */
|
|
1618
|
-
vault: Address;
|
|
1619
|
-
/** MoreVaultsEscrow — holds locked tokens during async cross-chain flows */
|
|
1620
|
-
escrow?: Address;
|
|
1621
|
-
/** OFTAdapter for vault shares (cross-chain redeem only) */
|
|
1622
|
-
shareOFT?: Address;
|
|
1623
|
-
/** OFT for USDC bridging (cross-chain deposits from spoke) */
|
|
1624
|
-
usdcOFT?: Address;
|
|
1625
|
-
/**
|
|
1626
|
-
* Expected EVM chain ID of the hub. When provided, SDK functions will
|
|
1627
|
-
* throw a clear WrongChainError if the walletClient is on a different chain.
|
|
1628
|
-
* Prevents silent failures when MetaMask is connected to the wrong network.
|
|
1629
|
-
*/
|
|
1630
|
-
hubChainId?: number;
|
|
1631
|
-
}
|
|
1632
|
-
interface DepositResult {
|
|
1633
|
-
txHash: Hash;
|
|
1634
|
-
shares: bigint;
|
|
1635
|
-
}
|
|
1636
|
-
interface RedeemResult {
|
|
1637
|
-
txHash: Hash;
|
|
1638
|
-
assets: bigint;
|
|
1639
|
-
}
|
|
1640
|
-
interface AsyncRequestResult {
|
|
1641
|
-
txHash: Hash;
|
|
1642
|
-
/** Cross-chain request GUID to track via getRequestInfo / getFinalizationResult */
|
|
1643
|
-
guid: `0x${string}`;
|
|
1644
|
-
}
|
|
1645
|
-
/**
|
|
1646
|
-
* ActionType enum values matching MoreVaultsLib.ActionType on-chain.
|
|
1647
|
-
* DEPOSIT=0, MINT=1, WITHDRAW=2, REDEEM=3, MULTI_ASSETS_DEPOSIT=4, ACCRUE_FEES=5
|
|
1648
|
-
*/
|
|
1649
|
-
declare const ActionType: {
|
|
1650
|
-
readonly DEPOSIT: 0;
|
|
1651
|
-
readonly MINT: 1;
|
|
1652
|
-
readonly WITHDRAW: 2;
|
|
1653
|
-
readonly REDEEM: 3;
|
|
1654
|
-
readonly MULTI_ASSETS_DEPOSIT: 4;
|
|
1655
|
-
readonly ACCRUE_FEES: 5;
|
|
1656
|
-
};
|
|
1657
|
-
type ActionTypeValue = (typeof ActionType)[keyof typeof ActionType];
|
|
1658
|
-
/**
|
|
1659
|
-
* Data needed to execute a pending LZ compose on the hub chain.
|
|
1660
|
-
* Returned by `depositFromSpoke` when the OFT is a Stargate V2 pool,
|
|
1661
|
-
* because Stargate cannot forward ETH to the compose executor.
|
|
1662
|
-
* The SDK user must call `executeCompose()` with this data as a second TX on the hub.
|
|
1663
|
-
*/
|
|
1664
|
-
interface ComposeData {
|
|
1665
|
-
/** LZ Endpoint address on the hub chain */
|
|
1666
|
-
endpoint: Address;
|
|
1667
|
-
/** The OFT/pool address that sent the compose (Stargate pool on hub) */
|
|
1668
|
-
from: Address;
|
|
1669
|
-
/** MoreVaultsComposer address on the hub */
|
|
1670
|
-
to: Address;
|
|
1671
|
-
/** LayerZero GUID from the original OFT.send() */
|
|
1672
|
-
guid: `0x${string}`;
|
|
1673
|
-
/** Compose index (always 0 for single-compose messages) */
|
|
1674
|
-
index: number;
|
|
1675
|
-
/** The full compose message bytes (reconstructed from composeMsg + OFT header) */
|
|
1676
|
-
message: `0x${string}`;
|
|
1677
|
-
/** Whether this is a Stargate OFT that requires a 2-TX flow */
|
|
1678
|
-
isStargate: boolean;
|
|
1679
|
-
/** Hub chain ID for creating the hub wallet/public client */
|
|
1680
|
-
hubChainId: number;
|
|
1681
|
-
/** Hub block number just before TX1 was sent — used as search start for ComposeSent events */
|
|
1682
|
-
hubBlockStart: bigint;
|
|
1683
|
-
}
|
|
1684
|
-
/**
|
|
1685
|
-
* Result from `depositFromSpoke`.
|
|
1686
|
-
* When `composeData` is present, the user must call `executeCompose()` on the hub chain.
|
|
1687
|
-
*/
|
|
1688
|
-
interface SpokeDepositResult {
|
|
1689
|
-
txHash: Hash;
|
|
1690
|
-
guid: `0x${string}`;
|
|
1691
|
-
/** Present when OFT is Stargate V2 — user must execute compose on hub as TX2 */
|
|
1692
|
-
composeData?: ComposeData;
|
|
1693
|
-
}
|
|
1694
|
-
interface CrossChainRequestInfo {
|
|
1695
|
-
initiator: Address;
|
|
1696
|
-
timestamp: bigint;
|
|
1697
|
-
actionType: number;
|
|
1698
|
-
actionCallData: `0x${string}`;
|
|
1699
|
-
fulfilled: boolean;
|
|
1700
|
-
finalized: boolean;
|
|
1701
|
-
refunded: boolean;
|
|
1702
|
-
totalAssets: bigint;
|
|
1703
|
-
finalizationResult: bigint;
|
|
1704
|
-
amountLimit: bigint;
|
|
1705
|
-
}
|
|
1706
|
-
interface SwapParams {
|
|
1707
|
-
targetContract: Address;
|
|
1708
|
-
tokenIn: Address;
|
|
1709
|
-
tokenOut: Address;
|
|
1710
|
-
maxAmountIn: bigint;
|
|
1711
|
-
minAmountOut: bigint;
|
|
1712
|
-
swapCallData: `0x${string}`;
|
|
1713
|
-
}
|
|
1714
|
-
interface BatchSwapParams {
|
|
1715
|
-
swaps: SwapParams[];
|
|
1716
|
-
}
|
|
1717
|
-
interface BridgeParams {
|
|
1718
|
-
oftToken: Address;
|
|
1719
|
-
dstEid: number;
|
|
1720
|
-
amount: bigint;
|
|
1721
|
-
dstVault: Address;
|
|
1722
|
-
refundAddress: Address;
|
|
1723
|
-
}
|
|
1724
|
-
interface PendingAction {
|
|
1725
|
-
nonce: bigint;
|
|
1726
|
-
actionsData: `0x${string}`[];
|
|
1727
|
-
pendingUntil: bigint;
|
|
1728
|
-
isExecutable: boolean;
|
|
1729
|
-
}
|
|
1730
|
-
interface SubmitActionsResult {
|
|
1731
|
-
txHash: `0x${string}`;
|
|
1732
|
-
nonce: bigint;
|
|
1733
|
-
}
|
|
1734
|
-
type CuratorAction = {
|
|
1735
|
-
type: 'swap';
|
|
1736
|
-
params: SwapParams;
|
|
1737
|
-
} | {
|
|
1738
|
-
type: 'batchSwap';
|
|
1739
|
-
params: BatchSwapParams;
|
|
1740
|
-
} | {
|
|
1741
|
-
type: 'erc4626Deposit';
|
|
1742
|
-
vault: Address;
|
|
1743
|
-
assets: bigint;
|
|
1744
|
-
} | {
|
|
1745
|
-
type: 'erc4626Redeem';
|
|
1746
|
-
vault: Address;
|
|
1747
|
-
shares: bigint;
|
|
1748
|
-
} | {
|
|
1749
|
-
type: 'erc7540RequestDeposit';
|
|
1750
|
-
vault: Address;
|
|
1751
|
-
assets: bigint;
|
|
1752
|
-
} | {
|
|
1753
|
-
type: 'erc7540Deposit';
|
|
1754
|
-
vault: Address;
|
|
1755
|
-
assets: bigint;
|
|
1756
|
-
} | {
|
|
1757
|
-
type: 'erc7540RequestRedeem';
|
|
1758
|
-
vault: Address;
|
|
1759
|
-
shares: bigint;
|
|
1760
|
-
} | {
|
|
1761
|
-
type: 'erc7540Redeem';
|
|
1762
|
-
vault: Address;
|
|
1763
|
-
shares: bigint;
|
|
1764
|
-
};
|
|
1765
|
-
interface CuratorVaultStatus {
|
|
1766
|
-
curator: Address;
|
|
1767
|
-
timeLockPeriod: bigint;
|
|
1768
|
-
maxSlippagePercent: bigint;
|
|
1769
|
-
currentNonce: bigint;
|
|
1770
|
-
availableAssets: Address[];
|
|
1771
|
-
lzAdapter: Address;
|
|
1772
|
-
paused: boolean;
|
|
1773
|
-
}
|
|
1774
|
-
interface AssetInfo {
|
|
1775
|
-
address: Address;
|
|
1776
|
-
symbol: string;
|
|
1777
|
-
name: string;
|
|
1778
|
-
decimals: number;
|
|
1779
|
-
}
|
|
1780
|
-
interface VaultAnalysis {
|
|
1781
|
-
/** All tokens the vault can hold/swap (curator-managed) */
|
|
1782
|
-
availableAssets: AssetInfo[];
|
|
1783
|
-
/** Tokens users can deposit */
|
|
1784
|
-
depositableAssets: AssetInfo[];
|
|
1785
|
-
/** Whether deposit whitelist is enabled (restricts who can deposit) */
|
|
1786
|
-
depositWhitelistEnabled: boolean;
|
|
1787
|
-
/** Registry address for global protocol whitelist checks */
|
|
1788
|
-
registryAddress: Address | null;
|
|
1789
|
-
}
|
|
1790
|
-
interface AssetBalance extends AssetInfo {
|
|
1791
|
-
/** Raw balance held by the vault */
|
|
1792
|
-
balance: bigint;
|
|
1793
|
-
}
|
|
1794
|
-
interface VaultAssetBreakdown {
|
|
1795
|
-
/** Per-asset balances held by the vault on the hub chain */
|
|
1796
|
-
assets: AssetBalance[];
|
|
1797
|
-
/** totalAssets() as reported by the vault (all positions converted to underlying) */
|
|
1798
|
-
totalAssets: bigint;
|
|
1799
|
-
/** totalSupply() of vault shares */
|
|
1800
|
-
totalSupply: bigint;
|
|
1801
|
-
/** Vault underlying token decimals */
|
|
1802
|
-
underlyingDecimals: number;
|
|
1803
|
-
}
|
|
1804
|
-
|
|
1805
1617
|
/**
|
|
1806
1618
|
* Typed error classes for the MoreVaults SDK.
|
|
1807
1619
|
*
|
|
@@ -2705,4 +2517,4 @@ declare function buildUniswapV3Swap(params: {
|
|
|
2705
2517
|
*/
|
|
2706
2518
|
declare function asSdkClient(client: unknown): PublicClient;
|
|
2707
2519
|
|
|
2708
|
-
export {
|
|
2520
|
+
export { AsyncRequestResult, BRIDGE_ABI, BRIDGE_FACET_ABI, CCManagerNotConfiguredError, CHAIN_IDS, CHAIN_ID_TO_EID, CONFIG_ABI, CURATOR_CONFIG_ABI, CapacityFullError, ComposeData, CuratorAction, CuratorVaultStatus, DEX_ABI, DepositResult, EID_TO_CHAIN_ID, ERC20_ABI, ERC4626_FACET_ABI, ERC7540_FACET_ABI, EscrowNotConfiguredError, InsufficientLiquidityError, LZ_ADAPTER_ABI, LZ_EIDS, LZ_ENDPOINT_ABI, LZ_TIMEOUTS, METADATA_ABI, MULTICALL_ABI, MissingEscrowAddressError, MoreVaultsError, NotHubVaultError, NotWhitelistedError, OFT_ABI, OFT_ROUTES, PendingAction, REGISTRY_ABI, RedeemResult, STARGATE_TAXI_CMD, SpokeDepositResult, type SpokeRedeemRoute, SubmitActionsResult, UNISWAP_V3_ROUTERS, USDC_STARGATE_OFT, USDC_TOKEN, VAULT_ABI, VAULT_ANALYSIS_ABI, VaultAddresses, VaultAnalysis, VaultAssetBreakdown, VaultPausedError, WrongChainError, asSdkClient, bridgeAssetsToSpoke, bridgeSharesToHub, buildCuratorBatch, buildUniswapV3Swap, checkProtocolWhitelist, depositAsync, depositSimple as depositCrossChainOracleOn, depositFromSpoke, depositFromSpoke as depositFromSpokeAsync, depositMultiAsset, depositSimple, encodeCuratorAction, encodeUniswapV3SwapCalldata, executeActions, executeCompose, getCuratorVaultStatus, getPendingActions, getVaultAnalysis, getVaultAssetBreakdown, getWithdrawalRequest, isCurator, mintAsync, preflightAsync, preflightRedeemLiquidity, preflightSpokeDeposit, preflightSpokeRedeem, preflightSync, quoteComposeFee, quoteDepositFromSpokeFee, quoteShareBridgeFee, redeemAsync, redeemShares, requestRedeem, resolveRedeemAddresses, smartDeposit, smartRedeem, submitActions, vetoActions, waitForCompose, withdrawAssets };
|