@continuumdao/ctm-mpc-defi 0.1.4 → 0.2.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/dist/agent/catalog.cjs +878 -141
- package/dist/agent/catalog.cjs.map +1 -1
- package/dist/agent/catalog.d.cts +756 -12
- package/dist/agent/catalog.d.ts +756 -12
- package/dist/agent/catalog.js +829 -142
- package/dist/agent/catalog.js.map +1 -1
- package/dist/chains/evm/index.cjs +13 -0
- package/dist/chains/evm/index.cjs.map +1 -1
- package/dist/chains/evm/index.d.cts +3 -1
- package/dist/chains/evm/index.d.ts +3 -1
- package/dist/chains/evm/index.js +13 -1
- package/dist/chains/evm/index.js.map +1 -1
- package/dist/index.cjs +825 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +825 -142
- package/dist/index.js.map +1 -1
- package/dist/protocols/evm/aave-v4/index.cjs +1987 -0
- package/dist/protocols/evm/aave-v4/index.cjs.map +1 -0
- package/dist/protocols/evm/aave-v4/index.d.cts +500 -0
- package/dist/protocols/evm/aave-v4/index.d.ts +500 -0
- package/dist/protocols/evm/aave-v4/index.js +1943 -0
- package/dist/protocols/evm/aave-v4/index.js.map +1 -0
- package/dist/protocols/evm/ethena/index.cjs +965 -0
- package/dist/protocols/evm/ethena/index.cjs.map +1 -0
- package/dist/protocols/evm/ethena/index.d.cts +161 -0
- package/dist/protocols/evm/ethena/index.d.ts +161 -0
- package/dist/protocols/evm/ethena/index.js +943 -0
- package/dist/protocols/evm/ethena/index.js.map +1 -0
- package/dist/protocols/evm/euler-v2/index.cjs +2263 -0
- package/dist/protocols/evm/euler-v2/index.cjs.map +1 -0
- package/dist/protocols/evm/euler-v2/index.d.cts +317 -0
- package/dist/protocols/evm/euler-v2/index.d.ts +317 -0
- package/dist/protocols/evm/euler-v2/index.js +2238 -0
- package/dist/protocols/evm/euler-v2/index.js.map +1 -0
- package/dist/protocols/evm/lido/index.cjs +834 -0
- package/dist/protocols/evm/lido/index.cjs.map +1 -0
- package/dist/protocols/evm/lido/index.d.cts +120 -0
- package/dist/protocols/evm/lido/index.d.ts +120 -0
- package/dist/protocols/evm/lido/index.js +809 -0
- package/dist/protocols/evm/lido/index.js.map +1 -0
- package/dist/protocols/evm/maple/index.cjs +707 -0
- package/dist/protocols/evm/maple/index.cjs.map +1 -0
- package/dist/protocols/evm/maple/index.d.cts +109 -0
- package/dist/protocols/evm/maple/index.d.ts +109 -0
- package/dist/protocols/evm/maple/index.js +693 -0
- package/dist/protocols/evm/maple/index.js.map +1 -0
- package/dist/protocols/evm/sky/index.cjs +1254 -0
- package/dist/protocols/evm/sky/index.cjs.map +1 -0
- package/dist/protocols/evm/sky/index.d.cts +218 -0
- package/dist/protocols/evm/sky/index.d.ts +218 -0
- package/dist/protocols/evm/sky/index.js +1229 -0
- package/dist/protocols/evm/sky/index.js.map +1 -0
- package/package.json +37 -3
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
import { d as ProtocolModule } from '../../../types-Ce2qNHai.js';
|
|
2
|
+
import { Address } from 'viem';
|
|
3
|
+
import { K as KeyGenSubsetForPermit } from '../../../keygen-DsINazx8.js';
|
|
4
|
+
|
|
5
|
+
declare const AAVE_V4_GRAPHQL_URL = "https://api.v4.aave.com/graphql";
|
|
6
|
+
declare function aaveV4Gql<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
7
|
+
type ChainRowV4 = {
|
|
8
|
+
chainId: number;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
nativeWrappedToken?: string | null;
|
|
11
|
+
};
|
|
12
|
+
declare function fetchAaveV4Chains(): Promise<readonly ChainRowV4[]>;
|
|
13
|
+
/**
|
|
14
|
+
* Aave v4: supported EVM chain IDs (from {@link fetchAaveV4Chains}).
|
|
15
|
+
*/
|
|
16
|
+
declare function loadAaveV4SupportedChainIdsFromV4Api(): Promise<ReadonlySet<number>>;
|
|
17
|
+
type V4ReservesListRow = {
|
|
18
|
+
id: string;
|
|
19
|
+
onChainId?: string | null;
|
|
20
|
+
spoke?: {
|
|
21
|
+
address: string;
|
|
22
|
+
name?: string | null;
|
|
23
|
+
liquidationConfig?: {
|
|
24
|
+
targetHealthFactor: string;
|
|
25
|
+
healthFactorForMaxBonus: string;
|
|
26
|
+
} | null;
|
|
27
|
+
} | null;
|
|
28
|
+
summary: {
|
|
29
|
+
supplied: {
|
|
30
|
+
amount: {
|
|
31
|
+
value: string;
|
|
32
|
+
decimals: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
borrowed: {
|
|
36
|
+
amount: {
|
|
37
|
+
value: string;
|
|
38
|
+
decimals: number;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
suppliable: {
|
|
42
|
+
amount: {
|
|
43
|
+
value: string;
|
|
44
|
+
decimals: number;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
supplyApy: {
|
|
48
|
+
normalized: string;
|
|
49
|
+
value: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
userState: {
|
|
53
|
+
balance: {
|
|
54
|
+
amount: {
|
|
55
|
+
value: string;
|
|
56
|
+
decimals: number;
|
|
57
|
+
};
|
|
58
|
+
} | null;
|
|
59
|
+
borrowable?: {
|
|
60
|
+
amount: {
|
|
61
|
+
value: string;
|
|
62
|
+
decimals: number;
|
|
63
|
+
};
|
|
64
|
+
} | null;
|
|
65
|
+
} | null;
|
|
66
|
+
};
|
|
67
|
+
declare function aggregateV4SupplyDisplay(symbolForDisplay: string, rows: readonly V4ReservesListRow[]): {
|
|
68
|
+
depositedAmount: string;
|
|
69
|
+
apy: string;
|
|
70
|
+
totalDeposits: string;
|
|
71
|
+
availableLiquidity: string;
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Formats a token notional for display: uses k (≥1k) and M (≥1M) with a few decimal places, otherwise limited decimals.
|
|
75
|
+
* Safe to reuse outside the Aave V4 dialog (e.g. tables, tooltips).
|
|
76
|
+
*/
|
|
77
|
+
declare function formatAaveV4TokenAmount(n: number): string;
|
|
78
|
+
/**
|
|
79
|
+
* Human-readable notional for Aave v4 API decimal strings (reserve amounts, user debt, etc.).
|
|
80
|
+
* Use this for all “display from GraphQL `value`” paths so formatting stays consistent.
|
|
81
|
+
*/
|
|
82
|
+
declare function formatAaveV4AmountHumanFromApiString(raw: string | null | undefined): string;
|
|
83
|
+
/**
|
|
84
|
+
* Unnamed reserve liquidity: supplied − borrowed (both API decimal strings, same unit).
|
|
85
|
+
*/
|
|
86
|
+
declare function formatAaveV4ReserveLiquidityFromSummary(args: {
|
|
87
|
+
suppliedValue: string | null | undefined;
|
|
88
|
+
borrowedValue: string | null | undefined;
|
|
89
|
+
}): string;
|
|
90
|
+
declare function fetchAaveV4NativeWrappedToken(chainId: number): Promise<string | null>;
|
|
91
|
+
/**
|
|
92
|
+
* All underlying token addresses (lowercased checksummed form for lookup: store lowercase) listed as reserves on the chain.
|
|
93
|
+
*/
|
|
94
|
+
declare function fetchAaveV4SupportedUnderlyingAddressSet(chainId: number): Promise<ReadonlySet<string>>;
|
|
95
|
+
declare function fetchAaveV4ReservesForUnderlying(args: {
|
|
96
|
+
chainId: number;
|
|
97
|
+
underlying: `0x${string}`;
|
|
98
|
+
user?: `0x${string}` | null;
|
|
99
|
+
}): Promise<readonly V4ReservesListRow[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Reserve row for a hub asset on the same Aave v4 **Spoke** as the user’s collateral (same as {@link useAaveV4DepositCollateralInfo}’s `collateralForAsset`).
|
|
102
|
+
* Needed so borrow/repay multi-sign uses the same spoke as the user’s position.
|
|
103
|
+
*/
|
|
104
|
+
declare function pickAaveV4ReserveRowForSpoke(rows: readonly V4ReservesListRow[], spokeAddress: `0x${string}`): V4ReservesListRow | null;
|
|
105
|
+
declare function aaveV4KeyForNodeAssetRow(args: {
|
|
106
|
+
contractAddress: string;
|
|
107
|
+
nativeWrapped: string | null;
|
|
108
|
+
}): string | null;
|
|
109
|
+
type AaveV4ChainTokenCache = {
|
|
110
|
+
supportedUnderlying: ReadonlySet<string>;
|
|
111
|
+
nativeWrapped: string | null;
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Fetches and caches (per process) the list of Aave v4 underlying addresses on a chain and the wrapped native token.
|
|
115
|
+
*/
|
|
116
|
+
declare function ensureAaveV4ChainTokenCache(chainId: number): Promise<AaveV4ChainTokenCache>;
|
|
117
|
+
/** UI market segment; maps to Aave v4 `Hub` by name (e.g. Plus ≈ “Main”, Core, Prime ≈ “Bluechip”). */
|
|
118
|
+
type AaveV4UiMarketId = 'main' | 'core' | 'bluechip';
|
|
119
|
+
type AaveV4Hub = {
|
|
120
|
+
name: string;
|
|
121
|
+
address: `0x${string}`;
|
|
122
|
+
chain: {
|
|
123
|
+
chainId: number;
|
|
124
|
+
name?: string | null;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
/** `summary` is included for hub `reserves` (market borrow/supply TVL, APYs). */
|
|
128
|
+
type AaveV4HubReserveSummary = {
|
|
129
|
+
supplied: {
|
|
130
|
+
amount: {
|
|
131
|
+
value: string;
|
|
132
|
+
decimals: number;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
borrowed: {
|
|
136
|
+
amount: {
|
|
137
|
+
value: string;
|
|
138
|
+
decimals: number;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
suppliable: {
|
|
142
|
+
amount: {
|
|
143
|
+
value: string;
|
|
144
|
+
decimals: number;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
supplyApy: {
|
|
148
|
+
normalized: string;
|
|
149
|
+
value: string;
|
|
150
|
+
};
|
|
151
|
+
borrowApy: {
|
|
152
|
+
normalized: string;
|
|
153
|
+
value: string;
|
|
154
|
+
};
|
|
155
|
+
};
|
|
156
|
+
type AaveV4HubReserve = {
|
|
157
|
+
canBorrow: boolean;
|
|
158
|
+
canUseAsCollateral: boolean;
|
|
159
|
+
canSupply: boolean;
|
|
160
|
+
/** Spoke contract to call for `supply` on this reserve. */
|
|
161
|
+
spoke: {
|
|
162
|
+
address: string;
|
|
163
|
+
} | null;
|
|
164
|
+
settings: {
|
|
165
|
+
borrowable: boolean;
|
|
166
|
+
collateral: boolean;
|
|
167
|
+
collateralFactor: {
|
|
168
|
+
normalized: string;
|
|
169
|
+
value: string;
|
|
170
|
+
};
|
|
171
|
+
collateralRisk: {
|
|
172
|
+
normalized: string;
|
|
173
|
+
value: string;
|
|
174
|
+
};
|
|
175
|
+
};
|
|
176
|
+
asset: {
|
|
177
|
+
underlying: {
|
|
178
|
+
address: string;
|
|
179
|
+
info: {
|
|
180
|
+
name: string;
|
|
181
|
+
symbol: string;
|
|
182
|
+
icon: string | null;
|
|
183
|
+
} | null;
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
/** Present when using the extended hub reserves query (borrow tab, market TVL). */
|
|
187
|
+
summary?: AaveV4HubReserveSummary | null;
|
|
188
|
+
};
|
|
189
|
+
declare function fetchAaveV4HubsForChain(chainId: number): Promise<readonly AaveV4Hub[]>;
|
|
190
|
+
/**
|
|
191
|
+
* Resolves which Aave v4 hub (Core / Plus / Prime, etc.) a UI “market” refers to.
|
|
192
|
+
* Main → Plus, Core → Core, Bluechip → Prime.
|
|
193
|
+
*/
|
|
194
|
+
declare function resolveAaveV4HubForUiMarket(hubs: readonly AaveV4Hub[], market: AaveV4UiMarketId, chainId: number): AaveV4Hub | null;
|
|
195
|
+
/**
|
|
196
|
+
* Inverse of {@link resolveAaveV4HubForUiMarket} label mapping, for switching UI market when a hub is chosen by
|
|
197
|
+
* “first hub on chain that lists this underlying”.
|
|
198
|
+
*/
|
|
199
|
+
declare function aaveV4UiMarketIdForHubName(hubName: string): AaveV4UiMarketId;
|
|
200
|
+
/**
|
|
201
|
+
* The selected UI market maps to a single hub, but a token may only be listed in another hub (e.g. WETH in Core, not
|
|
202
|
+
* Plus on Ethereum). Returns a hub on this chain where this underlying appears in hub reserves, so Spoke and
|
|
203
|
+
* collateral can be resolved.
|
|
204
|
+
*
|
|
205
|
+
* **When no debt hint:** `preferHub` is tried first, then other hubs in {@link aaveV4HubAutoPickTiebreakOrder} order.
|
|
206
|
+
*
|
|
207
|
+
* **When `debtUnderlying` is set (user chose a debt asset on the borrow flow):** among hubs that list **both** the
|
|
208
|
+
* **collateral** and that **debt** as borrowable, the hub with the **lowest debt borrow APY** is chosen. If
|
|
209
|
+
* `debtBorrowAmountHumanForLiquidity` is a positive number string, we **prefer** hubs where `suppliable` on the debt
|
|
210
|
+
* reserve is at least that amount; if none satisfy that, the lowest-APY hub among all debt-backed candidates is
|
|
211
|
+
* used anyway.
|
|
212
|
+
*/
|
|
213
|
+
declare function findAaveV4HubReserveForChainUnderlying(args: {
|
|
214
|
+
chainId: number;
|
|
215
|
+
hubs: readonly AaveV4Hub[];
|
|
216
|
+
underlying: `0x${string}`;
|
|
217
|
+
/** Tried first; if the asset is not listed here, other hubs on the same chain are scanned. */
|
|
218
|
+
preferHub: AaveV4Hub;
|
|
219
|
+
/** If set, disambiguate using this debt asset’s `borrowAPY` (and optional liquidity) per hub. */
|
|
220
|
+
debtUnderlying?: `0x${string}` | null;
|
|
221
|
+
/**
|
|
222
|
+
* When set, used with `debtUnderlying` to prefer hubs with enough `suppliable` on the debt line for a borrow
|
|
223
|
+
* of that size (human amount; commas may be included).
|
|
224
|
+
*/
|
|
225
|
+
debtBorrowAmountHumanForLiquidity?: string | null;
|
|
226
|
+
}): Promise<{
|
|
227
|
+
hub: AaveV4Hub;
|
|
228
|
+
hubReserves: readonly AaveV4HubReserve[];
|
|
229
|
+
reserve: AaveV4HubReserve;
|
|
230
|
+
} | null>;
|
|
231
|
+
declare function fetchAaveV4HubReserves(args: {
|
|
232
|
+
chainId: number;
|
|
233
|
+
hubAddress: `0x${string}`;
|
|
234
|
+
}): Promise<readonly AaveV4HubReserve[]>;
|
|
235
|
+
/**
|
|
236
|
+
* LTV you can borrow against a unit of this asset, e.g. "90%".
|
|
237
|
+
*/
|
|
238
|
+
declare function formatAaveV4PercentDisplay(normalized: string | undefined, value: string | undefined): string;
|
|
239
|
+
/**
|
|
240
|
+
* Collateral / protocol risk on the same 0–100 style scale as the API, or a plain label if zero/empty.
|
|
241
|
+
*/
|
|
242
|
+
declare function formatAaveV4RiskDisplay(normalized: string | undefined, value: string | undefined): string;
|
|
243
|
+
declare function findHubReserveForUnderlying(list: readonly AaveV4HubReserve[], underlying: `0x${string}`): AaveV4HubReserve | null;
|
|
244
|
+
type AaveV4BorrowableDisplay = {
|
|
245
|
+
address: string;
|
|
246
|
+
symbol: string;
|
|
247
|
+
name: string;
|
|
248
|
+
icon: string | null;
|
|
249
|
+
};
|
|
250
|
+
/**
|
|
251
|
+
* De-duplicated borrowable debt assets in a hub (what users can borrow there).
|
|
252
|
+
*/
|
|
253
|
+
declare function borrowableAssetsFromHubReserves(rows: readonly AaveV4HubReserve[]): AaveV4BorrowableDisplay[];
|
|
254
|
+
/**
|
|
255
|
+
* Current variable-debt balance per underlying token for this user in the given hub (one entry per asset).
|
|
256
|
+
* Values are API decimal strings; format with {@link formatAaveV4AmountHumanFromApiString}.
|
|
257
|
+
*/
|
|
258
|
+
declare function fetchAaveV4UserBorrowsDebtByUnderlyingForHub(args: {
|
|
259
|
+
user: `0x${string}`;
|
|
260
|
+
chainId: number;
|
|
261
|
+
hubAddress: `0x${string}`;
|
|
262
|
+
}): Promise<ReadonlyMap<string, string>>;
|
|
263
|
+
type AaveV4BorrowTableRow = {
|
|
264
|
+
address: string;
|
|
265
|
+
symbol: string;
|
|
266
|
+
name: string;
|
|
267
|
+
icon: string | null;
|
|
268
|
+
yourBorrowedDisplay: string;
|
|
269
|
+
baseBorrowApyDisplay: string;
|
|
270
|
+
totalBorrowsDisplay: string;
|
|
271
|
+
liquidityDisplay: string;
|
|
272
|
+
};
|
|
273
|
+
/**
|
|
274
|
+
* One row per borrowable asset in the hub, using shared human-readable formatters.
|
|
275
|
+
*/
|
|
276
|
+
declare function buildAaveV4BorrowTableRowsFromHub(borrowable: readonly AaveV4BorrowableDisplay[], hubReserves: readonly AaveV4HubReserve[] | null,
|
|
277
|
+
/** `undefined` = not loaded or no wallet (show em dash for “your” column). */
|
|
278
|
+
debtByUnderlying: ReadonlyMap<string, string> | undefined): AaveV4BorrowTableRow[];
|
|
279
|
+
|
|
280
|
+
type AaveV4SpokeOnChainReserveStatus = {
|
|
281
|
+
reserveId: bigint;
|
|
282
|
+
/** From `getReserveConfig` — not a global Spoke `paused()`. */
|
|
283
|
+
paused: boolean;
|
|
284
|
+
frozen: boolean;
|
|
285
|
+
borrowable: boolean;
|
|
286
|
+
receiveSharesEnabled: boolean;
|
|
287
|
+
collateralRisk: number;
|
|
288
|
+
};
|
|
289
|
+
type SpokeReadArgs = {
|
|
290
|
+
rpcUrl: string;
|
|
291
|
+
chainId: number;
|
|
292
|
+
spoke: Address;
|
|
293
|
+
underlying: Address;
|
|
294
|
+
};
|
|
295
|
+
/**
|
|
296
|
+
* On-chain `reserveId` for an underlying on the Spoke (`getReserve` scan). Used for
|
|
297
|
+
* `supply(uint256 reserveId, uint256 amount, address onBehalfOf)` calldata.
|
|
298
|
+
*/
|
|
299
|
+
declare function fetchAaveV4SpokeReserveIdForUnderlying(args: SpokeReadArgs): Promise<bigint | null>;
|
|
300
|
+
/**
|
|
301
|
+
* Per-reserve pause/freeze from the Spoke (`getReserveConfig`), after resolving
|
|
302
|
+
* `reserveId` for `underlying` via `getReserve` / `getReserveCount`.
|
|
303
|
+
* Aave v4 does not expose a single contract-wide `paused()` on the Spoke for this.
|
|
304
|
+
*/
|
|
305
|
+
declare function fetchAaveV4SpokeReserveStatusForUnderlying(args: SpokeReadArgs): Promise<AaveV4SpokeOnChainReserveStatus | null>;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* `eth_estimateGas` can revert for complex Aave v4 `supply` calldata; same order of magnitude as Curve router.
|
|
309
|
+
* Exported for Get Sig / Execute fallbacks.
|
|
310
|
+
*/
|
|
311
|
+
declare const AAVE_V4_SPOKE_SUPPLY_DEFAULT_GAS_UNITS = 1200000n;
|
|
312
|
+
declare const AAVE_V4_SPOKE_WITHDRAW_DEFAULT_GAS_UNITS = 800000n;
|
|
313
|
+
declare const AAVE_V4_SPOKE_BORROW_DEFAULT_GAS_UNITS = 900000n;
|
|
314
|
+
declare const AAVE_V4_SPOKE_REPAY_DEFAULT_GAS_UNITS = 1000000n;
|
|
315
|
+
type ChainRow = {
|
|
316
|
+
legacy?: boolean;
|
|
317
|
+
gasLimit?: number;
|
|
318
|
+
gasMultiplier?: number;
|
|
319
|
+
gasPrice?: number;
|
|
320
|
+
baseFee?: number;
|
|
321
|
+
priorityFee?: number;
|
|
322
|
+
baseFeeMultiplier?: number;
|
|
323
|
+
};
|
|
324
|
+
/**
|
|
325
|
+
* Aave v4: optional WETH `deposit` (native path), exact ERC-20 `approve` to the spoke when needed, then
|
|
326
|
+
* `spoke.supply(reserveId, amount, onBehalfOf)`.
|
|
327
|
+
* Optionally appends `spoke.setUsingAsCollateral(reserveId, true, onBehalfOf)` in the same batch
|
|
328
|
+
* (same pattern as the Aave app’s “use as collateral” toggle after supply).
|
|
329
|
+
*/
|
|
330
|
+
declare function buildEvmMultisignBodyAaveV4DepositBatch(args: {
|
|
331
|
+
keyGen: KeyGenSubsetForPermit;
|
|
332
|
+
chainId: number;
|
|
333
|
+
rpcUrl: string;
|
|
334
|
+
chainDetail: ChainRow;
|
|
335
|
+
useCustomGas: boolean;
|
|
336
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
337
|
+
market: AaveV4UiMarketId;
|
|
338
|
+
/** Underlying to supply (e.g. WETH when user chose native, or the ERC-20). */
|
|
339
|
+
asset: Address;
|
|
340
|
+
isNativeIn: boolean;
|
|
341
|
+
/** Wrapped native; required when `isNativeIn`. */
|
|
342
|
+
nativeWrapped: Address;
|
|
343
|
+
amountHuman: string;
|
|
344
|
+
spoke: Address;
|
|
345
|
+
onBehalfOf: Address;
|
|
346
|
+
executorAddress: Address;
|
|
347
|
+
purposeText: string;
|
|
348
|
+
/**
|
|
349
|
+
* When true, add a final tx `setUsingAsCollateral(reserveId, true, onBehalfOf)` after `supply`
|
|
350
|
+
* so the new supply is enabled as borrow collateral (Aave v4 `ISpoke.setUsingAsCollateral`).
|
|
351
|
+
*/
|
|
352
|
+
enableAsCollateralAfterSupply?: boolean;
|
|
353
|
+
}): Promise<{
|
|
354
|
+
bodyForSign: Record<string, unknown>;
|
|
355
|
+
messageToSign: string;
|
|
356
|
+
}>;
|
|
357
|
+
/**
|
|
358
|
+
* `Spoke.withdraw` — one transaction (same sign-request shape as a single step of a deposit batch).
|
|
359
|
+
* Prefer passing {@link fetchAaveV4SpokeReserveIdForUnderlying} result via `reserveIdOnChain` when known.
|
|
360
|
+
*/
|
|
361
|
+
declare function buildEvmMultisignBodyAaveV4SpokeWithdraw(args: {
|
|
362
|
+
keyGen: KeyGenSubsetForPermit;
|
|
363
|
+
chainId: number;
|
|
364
|
+
rpcUrl: string;
|
|
365
|
+
chainDetail: ChainRow;
|
|
366
|
+
useCustomGas: boolean;
|
|
367
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
368
|
+
marketLabel: string;
|
|
369
|
+
spoke: Address;
|
|
370
|
+
underlying: Address;
|
|
371
|
+
amountHuman: string;
|
|
372
|
+
onBehalfOf: Address;
|
|
373
|
+
executorAddress: Address;
|
|
374
|
+
purposeText: string;
|
|
375
|
+
/** When set, avoids an extra on-chain getReserve for the id. */
|
|
376
|
+
reserveIdOnChain?: bigint | null;
|
|
377
|
+
}): Promise<{
|
|
378
|
+
bodyForSign: Record<string, unknown>;
|
|
379
|
+
messageToSign: string;
|
|
380
|
+
}>;
|
|
381
|
+
/**
|
|
382
|
+
* `Spoke.borrow` — one transaction, same shape as {@link buildEvmMultisignBodyAaveV4SpokeWithdraw}.
|
|
383
|
+
*/
|
|
384
|
+
declare function buildEvmMultisignBodyAaveV4SpokeBorrow(args: {
|
|
385
|
+
keyGen: KeyGenSubsetForPermit;
|
|
386
|
+
chainId: number;
|
|
387
|
+
rpcUrl: string;
|
|
388
|
+
chainDetail: ChainRow;
|
|
389
|
+
useCustomGas: boolean;
|
|
390
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
391
|
+
marketLabel: string;
|
|
392
|
+
spoke: Address;
|
|
393
|
+
underlying: Address;
|
|
394
|
+
amountHuman: string;
|
|
395
|
+
onBehalfOf: Address;
|
|
396
|
+
executorAddress: Address;
|
|
397
|
+
purposeText: string;
|
|
398
|
+
reserveIdOnChain?: bigint | null;
|
|
399
|
+
}): Promise<{
|
|
400
|
+
bodyForSign: Record<string, unknown>;
|
|
401
|
+
messageToSign: string;
|
|
402
|
+
}>;
|
|
403
|
+
/**
|
|
404
|
+
* `approve` (if required) and `Spoke.repay` — one or two transactions (same pattern as a deposit batch).
|
|
405
|
+
*/
|
|
406
|
+
declare function buildEvmMultisignBodyAaveV4SpokeRepay(args: {
|
|
407
|
+
keyGen: KeyGenSubsetForPermit;
|
|
408
|
+
chainId: number;
|
|
409
|
+
rpcUrl: string;
|
|
410
|
+
chainDetail: ChainRow;
|
|
411
|
+
useCustomGas: boolean;
|
|
412
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
413
|
+
market: AaveV4UiMarketId;
|
|
414
|
+
spoke: Address;
|
|
415
|
+
underlying: Address;
|
|
416
|
+
amountHuman: string;
|
|
417
|
+
onBehalfOf: Address;
|
|
418
|
+
executorAddress: Address;
|
|
419
|
+
purposeText: string;
|
|
420
|
+
reserveIdOnChain?: bigint | null;
|
|
421
|
+
}): Promise<{
|
|
422
|
+
bodyForSign: Record<string, unknown>;
|
|
423
|
+
messageToSign: string;
|
|
424
|
+
}>;
|
|
425
|
+
/**
|
|
426
|
+
* Merkl claim-rewards call from the Aave API (`claimRewards`) — one transaction to `to` with `data` / `value`.
|
|
427
|
+
*/
|
|
428
|
+
declare function buildEvmMultisignBodyAaveV4MerklClaimRewards(args: {
|
|
429
|
+
keyGen: KeyGenSubsetForPermit;
|
|
430
|
+
chainId: number;
|
|
431
|
+
rpcUrl: string;
|
|
432
|
+
chainDetail: ChainRow;
|
|
433
|
+
useCustomGas: boolean;
|
|
434
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
435
|
+
to: Address;
|
|
436
|
+
data: `0x${string}`;
|
|
437
|
+
valueWei: bigint;
|
|
438
|
+
rewardIdCount: number;
|
|
439
|
+
executorAddress: Address;
|
|
440
|
+
purposeText: string;
|
|
441
|
+
}): Promise<{
|
|
442
|
+
bodyForSign: Record<string, unknown>;
|
|
443
|
+
messageToSign: string;
|
|
444
|
+
}>;
|
|
445
|
+
/**
|
|
446
|
+
* Merkl `Distributor.claim` using calldata from {@link encodeMerklDistributorClaimData} / Merkl API proofs.
|
|
447
|
+
*/
|
|
448
|
+
declare function buildEvmMultisignBodyEulerV2MerklDistributorClaim(args: {
|
|
449
|
+
keyGen: KeyGenSubsetForPermit;
|
|
450
|
+
chainId: number;
|
|
451
|
+
rpcUrl: string;
|
|
452
|
+
chainDetail: ChainRow;
|
|
453
|
+
useCustomGas: boolean;
|
|
454
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
455
|
+
to: Address;
|
|
456
|
+
data: `0x${string}`;
|
|
457
|
+
valueWei: bigint;
|
|
458
|
+
claimLeafCount: number;
|
|
459
|
+
executorAddress: Address;
|
|
460
|
+
purposeText: string;
|
|
461
|
+
}): Promise<{
|
|
462
|
+
bodyForSign: Record<string, unknown>;
|
|
463
|
+
messageToSign: string;
|
|
464
|
+
}>;
|
|
465
|
+
/**
|
|
466
|
+
* rEUL (`RewardToken`) batched `withdrawToByLockTimestamps` → unwrap vested underlying (EUL) to `executorAddress`.
|
|
467
|
+
*/
|
|
468
|
+
declare function buildEvmMultisignBodyEulerV2ReulUnlock(args: {
|
|
469
|
+
keyGen: KeyGenSubsetForPermit;
|
|
470
|
+
chainId: number;
|
|
471
|
+
rpcUrl: string;
|
|
472
|
+
chainDetail: ChainRow;
|
|
473
|
+
useCustomGas: boolean;
|
|
474
|
+
customGasChainDetails?: Record<string, unknown> | null;
|
|
475
|
+
to: Address;
|
|
476
|
+
data: `0x${string}`;
|
|
477
|
+
valueWei: bigint;
|
|
478
|
+
lockTimestampCount: number;
|
|
479
|
+
allowRemainderLoss: boolean;
|
|
480
|
+
executorAddress: Address;
|
|
481
|
+
purposeText: string;
|
|
482
|
+
}): Promise<{
|
|
483
|
+
bodyForSign: Record<string, unknown>;
|
|
484
|
+
messageToSign: string;
|
|
485
|
+
}>;
|
|
486
|
+
/** Minimum gas floor for Execute preflight (same style as `MIN_CURVE_ROUTER_GAS_EXEC`). */
|
|
487
|
+
declare const MIN_AAVE_V4_DEPOSIT_GAS_EXEC = 400000n;
|
|
488
|
+
/**
|
|
489
|
+
* True when this sign request (or `batchMeta[batchIndex]`) is an Aave v4 deposit batch step.
|
|
490
|
+
*/
|
|
491
|
+
declare function isAaveV4DepositEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
|
|
492
|
+
/**
|
|
493
|
+
* Prefer `proposalTxParams[i]` / `batchMeta[i].aaveV4.gasBuildSupply` when `eth_estimateGas` reverts.
|
|
494
|
+
*/
|
|
495
|
+
declare function resolveAaveV4DepositGasUnitsFromSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): bigint | null;
|
|
496
|
+
|
|
497
|
+
declare const AAVE_V4_PROTOCOL_ID = "aave-v4";
|
|
498
|
+
declare const aaveV4ProtocolModule: ProtocolModule;
|
|
499
|
+
|
|
500
|
+
export { AAVE_V4_GRAPHQL_URL, AAVE_V4_PROTOCOL_ID, AAVE_V4_SPOKE_BORROW_DEFAULT_GAS_UNITS, AAVE_V4_SPOKE_REPAY_DEFAULT_GAS_UNITS, AAVE_V4_SPOKE_SUPPLY_DEFAULT_GAS_UNITS, AAVE_V4_SPOKE_WITHDRAW_DEFAULT_GAS_UNITS, type AaveV4BorrowTableRow, type AaveV4BorrowableDisplay, type AaveV4Hub, type AaveV4HubReserve, type AaveV4HubReserveSummary, type AaveV4SpokeOnChainReserveStatus, type AaveV4UiMarketId, MIN_AAVE_V4_DEPOSIT_GAS_EXEC, type V4ReservesListRow, aaveV4Gql, aaveV4KeyForNodeAssetRow, aaveV4ProtocolModule, aaveV4UiMarketIdForHubName, aggregateV4SupplyDisplay, borrowableAssetsFromHubReserves, buildAaveV4BorrowTableRowsFromHub, buildEvmMultisignBodyAaveV4DepositBatch, buildEvmMultisignBodyAaveV4MerklClaimRewards, buildEvmMultisignBodyAaveV4SpokeBorrow, buildEvmMultisignBodyAaveV4SpokeRepay, buildEvmMultisignBodyAaveV4SpokeWithdraw, buildEvmMultisignBodyEulerV2MerklDistributorClaim, buildEvmMultisignBodyEulerV2ReulUnlock, ensureAaveV4ChainTokenCache, fetchAaveV4Chains, fetchAaveV4HubReserves, fetchAaveV4HubsForChain, fetchAaveV4NativeWrappedToken, fetchAaveV4ReservesForUnderlying, fetchAaveV4SpokeReserveIdForUnderlying, fetchAaveV4SpokeReserveStatusForUnderlying, fetchAaveV4SupportedUnderlyingAddressSet, fetchAaveV4UserBorrowsDebtByUnderlyingForHub, findAaveV4HubReserveForChainUnderlying, findHubReserveForUnderlying, formatAaveV4AmountHumanFromApiString, formatAaveV4PercentDisplay, formatAaveV4ReserveLiquidityFromSummary, formatAaveV4RiskDisplay, formatAaveV4TokenAmount, isAaveV4DepositEvmSignRequest, loadAaveV4SupportedChainIdsFromV4Api, pickAaveV4ReserveRowForSpoke, resolveAaveV4DepositGasUnitsFromSignRequest, resolveAaveV4HubForUiMarket };
|