@continuumdao/ctm-mpc-defi 0.2.43 → 0.2.44

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.
@@ -38,6 +38,8 @@ Do **not** web-search Aave APRs, APYs, or reserves. Load the protocol and use th
38
38
  | Withdraw supplied balance | `ctm_aave_v4_build_withdraw_multisign` |
39
39
  | Borrow against collateral | `ctm_aave_v4_build_borrow_multisign` |
40
40
  | Repay debt | `ctm_aave_v4_build_repay_multisign` |
41
+ | List wallet-wide Merkl claimables | `ctm_aave_v4_fetch_merkl_rewards` |
42
+ | Claim Merkl rewards | `ctm_aave_v4_build_merkl_claim_multisign` |
41
43
 
42
44
  ## Common write inputs
43
45
 
@@ -103,6 +105,12 @@ Example: “How do Aave lending APRs compare to Compound on Ethereum?”
103
105
  2. **Borrow debt asset:** `ctm_aave_v4_build_borrow_multisign` with `underlying` = debt token (USDC), `amountHuman`, optional `collateralUnderlying` = collateral address.
104
106
  3. Explain: health factor must stay above liquidation thresholds; server may refuse or ask for risk acknowledgment.
105
107
 
108
+ ### Claim Merkl rewards
109
+
110
+ 1. Activate `defi:aave-v4:rewards` (or alias `aave:rewards`) after `load_defi_protocol aave-v4`.
111
+ 2. `ctm_aave_v4_fetch_merkl_rewards({ keyGenId, chainId })`.
112
+ 3. If `firstRootClaimableCount` > 0: `ctm_aave_v4_build_merkl_claim_multisign({ keyGenId, chainId })`. Repeat when `additionalRoots` > 0.
113
+
106
114
  ### Repay and withdraw
107
115
 
108
116
  1. **Repay:** reduce debt with repay tool (`underlying` = debt token).
@@ -154,4 +162,4 @@ After stETH is supplied:
154
162
 
155
163
  - Native supply uses wrapped native from `get_defi_protocol_supported_tokens` (`nativeWrapped`).
156
164
  - Token filter: `api_underlyings` — only API-listed underlyings are valid per chain.
157
- - Merkl rewards and advanced position actions are available in the node app UI, not as separate MCP tools today.
165
+ - Wallet-wide Merkl: `ctm_aave_v4_fetch_merkl_rewards` then `ctm_aave_v4_build_merkl_claim_multisign({ keyGenId, chainId })`. Not Aave-only — other venues’ campaigns on the same distributor can appear. Server fetches proofs; do not invent `claimData`. Call again if `additionalRoots` > 0. rEUL is omitted (Euler unlock). Advanced Aave position actions besides this claim stay in the node app UI.
@@ -8,3 +8,12 @@ description: Euler v2 isolated lend/borrow, vault withdraw, and collateral opera
8
8
  Supported chains from `get_defi_protocol_supported_chains` (Euler V3 API, Goldsky `euler-simple-*` fallback). Underlyings from `get_defi_protocol_supported_tokens` (V3 EVK / Earn vaults). Isolated lend: `ctm_euler_v2_fetch_lend_vaults`. Earn vaults (curated APY): `ctm_euler_v2_fetch_earn_vaults`. Do **not** web-search Euler APYs. Copy `evaultAddress` onto build tools.
9
9
 
10
10
  Tools include isolated lend/borrow, collateral deposit/withdraw, vault withdraw, borrow repay. All `ctm_euler_v2_build_*_multisign` tools return `{ requestId }` on success (shared gas/submit section appended by the server).
11
+
12
+ ## Merkl rewards
13
+
14
+ Activate **`defi:euler-v2:rewards`** (alias `euler:rewards` / `euler-v2:rewards`) after `load_defi_protocol euler-v2`.
15
+
16
+ 1. `ctm_euler_v2_fetch_merkl_rewards({ keyGenId, chainId })` — wallet-wide on that chain, not Euler-only.
17
+ 2. If `firstRootClaimableCount` > 0: `ctm_euler_v2_build_merkl_claim_multisign({ keyGenId, chainId })`. Server fetches proofs. Do not invent `claimData`. Repeat when `additionalRoots` > 0.
18
+
19
+ rEUL is omitted (`skippedReulCount`). Unlock vested EUL in the node app Euler Rewards tab — there is no MCP unlock tool.
@@ -1,6 +1,8 @@
1
1
  # Morpho
2
2
 
3
- Morpho integration: **listed earn vaults** (V1 + V2, unified), **Blue** variable-rate supply/borrow, **Midnight** fixed-rate/fixed-term books, **Coinbase B20 stock-backed loans** on Base, and **Merkl** rewards.
3
+ Morpho integration: **listed earn vaults** (V1 + V2, unified), **Lend** (Blue USDC supply + Midnight lend/offers + stock-backed books), **Blue borrow** (collateral/borrow/repay), **Midnight borrow**, **Coinbase B20 stock-backed loans** on Base, and **Merkl** rewards.
4
+
5
+ Tool families after `load_defi_protocol morpho` (then `activate_tool_group` / search): `defi:morpho:vault` (Earn), `defi:morpho:lend` (lend USDC / stock-backed supply), `defi:morpho:blue` (borrow against collateral), `defi:morpho:midnight` (fixed-rate borrow), `defi:morpho:rewards`. Alias `morpho:lend` → `defi:morpho:lend`.
4
6
 
5
7
  ## Data
6
8
 
@@ -77,6 +79,8 @@ Do **not** use `ctm_arcus_build_deposit_multisign` for yield — that funds perp
77
79
 
78
80
  ## Stock-backed loans (Base)
79
81
 
82
+ Activate **`defi:morpho:lend`** (alias `morpho:lend`) for stock-market reads plus Blue supply and Midnight lend. Borrow against stock stays on `defi:morpho:blue` / `defi:morpho:midnight`.
83
+
80
84
  Curators deployed isolated **Blue** (variable) and **Midnight** (fixed) markets on **Base (8453)** that take **Coinbase B20 tokenized stocks** as collateral and lend **USDC**. Morpho is the credit layer — not Aerodrome swap/LP, not Hyperliquid/Arcus trading, not Robinhood Earn (USDG on 4663).
81
85
 
82
86
  | Goal | Tool |
@@ -137,6 +141,7 @@ Server re-quotes at build time and fills `taker` / `maker` / `onBehalf` from the
137
141
  | `ctm_morpho_fetch_midnight_quote` | Quote Midnight fill |
138
142
  | `ctm_morpho_fetch_midnight_positions` | Midnight positions |
139
143
  | `ctm_morpho_fetch_midnight_offers` | Open Midnight lend offers |
144
+ | `ctm_morpho_fetch_merkl_rewards` | Wallet-wide Merkl claimables (`keyGenId` or `user` + `chainId`) |
140
145
  | `ctm_morpho_build_vault_deposit_multisign` | Vault deposit (listed V1 or V2) |
141
146
  | `ctm_morpho_build_vault_withdraw_multisign` | Vault withdraw |
142
147
  | `ctm_morpho_build_blue_collateral_deposit_multisign` | Blue supplyCollateral |
@@ -150,7 +155,7 @@ Server re-quotes at build time and fills `taker` / `maker` / `onBehalf` from the
150
155
  | `ctm_morpho_build_midnight_cancel_lend_offer_multisign` | Cancel Midnight lend offer |
151
156
  | `ctm_morpho_build_midnight_borrow_multisign` | Midnight borrow |
152
157
  | `ctm_morpho_build_midnight_repay_multisign` | Midnight repay + withdraw |
153
- | `ctm_morpho_build_merkl_claim_multisign` | Merkl claim |
158
+ | `ctm_morpho_build_merkl_claim_multisign` | Wallet-wide Merkl claim (`keyGenId` + `chainId`; server fetches proofs) |
154
159
 
155
160
  Pass `marketId` from Morpho API for Blue/Midnight tools (not recomputed on-chain).
156
161
  **Deposits** require a **Morpho-listed** vault (`ctm_morpho_fetch_earn_vaults`). Unlisted/test vaults are rejected.
@@ -163,6 +168,7 @@ Pass `marketId` from Morpho API for Blue/Midnight tools (not recomputed on-chain
163
168
  4. Blue: `marketId` from fetch; server resolves `marketParams`. Collateral + borrow, or supply/withdraw loan token (USDC).
164
169
  5. Stock-backed on Base: `ctm_morpho_fetch_stock_markets` then the same Blue/Midnight build tools.
165
170
  6. Midnight: books → quote → lend now, lend offer (earn until filled), borrow, or cancel/repay as above.
171
+ 7. Merkl: `ctm_morpho_fetch_merkl_rewards` then `ctm_morpho_build_merkl_claim_multisign({ keyGenId, chainId })`. Wallet-wide on that chain — not Morpho-only. Do not invent `claimData`. Call again if `additionalRoots` > 0.
166
172
 
167
173
  ## Troubleshooting
168
174
 
@@ -0,0 +1,65 @@
1
+ import { Address } from 'viem';
2
+
3
+ declare const MERKL_API_BASE = "https://api.merkl.xyz";
4
+ /**
5
+ * Canonical Merkl `Distributor.sol` on most EVM chains.
6
+ * https://docs.merkl.xyz/integrate-merkl/smart-contract-addresses
7
+ */
8
+ declare const MERKL_DISTRIBUTOR_ADDRESS: Address;
9
+ declare const MERKL_DISTRIBUTOR_CLAIM_GAS_FALLBACK = 500000n;
10
+ declare const MERKL_REWARDS_NOTES = "Wallet-wide Merkl on this chain (not protocol-filtered). Other venues\u2019 campaigns can appear. Claims the first Merkle root batch; call again if additionalRoots > 0. rEUL is omitted (Euler unlock flow). Merkl updates every 8\u201312 hours.";
11
+ type MerklDistributorClaimLeaf = {
12
+ root: string;
13
+ token: Address;
14
+ amountWei: bigint;
15
+ proofs: readonly `0x${string}`[];
16
+ symbol: string;
17
+ decimals: number;
18
+ };
19
+ type MerklRewardRow = {
20
+ symbol: string;
21
+ token: string;
22
+ amountHuman: string;
23
+ amountWei: string;
24
+ decimals: number;
25
+ root: string;
26
+ };
27
+ type MerklRewardsSummary = {
28
+ chainId: number;
29
+ user: string;
30
+ distributor: string;
31
+ claimable: MerklRewardRow[];
32
+ claimableCount: number;
33
+ firstRootClaimableCount: number;
34
+ additionalRoots: number;
35
+ skippedReulCount: number;
36
+ notes: string;
37
+ };
38
+ declare function merklUserRewardsUrl(addr: Address, chainId: number): string;
39
+ declare function loadMerklUserRewardsJson(args: {
40
+ chainId: number;
41
+ user: Address;
42
+ }): Promise<unknown>;
43
+ declare function parseMerklUserRewardsToLeaves(raw: unknown, args: {
44
+ chainId: number;
45
+ user: Address;
46
+ }): MerklDistributorClaimLeaf[];
47
+ declare function selectFirstRootMerklLeaves(collected: readonly MerklDistributorClaimLeaf[]): MerklDistributorClaimLeaf[];
48
+ declare function isMerklRewardEulLeaf(leaf: MerklDistributorClaimLeaf): boolean;
49
+ /** Non-rEUL leaves on the first remaining Merkle root (one Distributor.claim tx). */
50
+ declare function selectWalletWideMerklClaimLeaves(collected: readonly MerklDistributorClaimLeaf[]): MerklDistributorClaimLeaf[];
51
+ declare function fetchAllMerklDistributorClaimLeaves(args: {
52
+ chainId: number;
53
+ user: Address;
54
+ }): Promise<MerklDistributorClaimLeaf[]>;
55
+ declare function encodeMerklDistributorClaimData(args: {
56
+ user: Address;
57
+ leaves: readonly MerklDistributorClaimLeaf[];
58
+ }): `0x${string}`;
59
+ declare function merklLeafToRow(leaf: MerklDistributorClaimLeaf): MerklRewardRow;
60
+ declare function fetchMerklRewardsSummary(args: {
61
+ user: string;
62
+ chainId: number;
63
+ }): Promise<MerklRewardsSummary>;
64
+
65
+ export { MERKL_API_BASE as M, MERKL_DISTRIBUTOR_ADDRESS as a, MERKL_DISTRIBUTOR_CLAIM_GAS_FALLBACK as b, MERKL_REWARDS_NOTES as c, type MerklDistributorClaimLeaf as d, type MerklRewardRow as e, type MerklRewardsSummary as f, encodeMerklDistributorClaimData as g, fetchAllMerklDistributorClaimLeaves as h, fetchMerklRewardsSummary as i, isMerklRewardEulLeaf as j, merklUserRewardsUrl as k, loadMerklUserRewardsJson as l, merklLeafToRow as m, selectWalletWideMerklClaimLeaves as n, parseMerklUserRewardsToLeaves as p, selectFirstRootMerklLeaves as s };
@@ -0,0 +1,489 @@
1
+ import { Address } from 'viem';
2
+ import { b as KeyGenSubsetForPermit } from './types-lIfv59N1.js';
3
+
4
+ declare const AAVE_V4_GRAPHQL_URL = "https://api.v4.aave.com/graphql";
5
+ declare function aaveV4Gql<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
6
+ type ChainRowV4 = {
7
+ chainId: number;
8
+ name?: string | null;
9
+ nativeWrappedToken?: string | null;
10
+ };
11
+ declare function fetchAaveV4Chains(): Promise<readonly ChainRowV4[]>;
12
+ /**
13
+ * Aave v4: supported EVM chain IDs (from {@link fetchAaveV4Chains}).
14
+ */
15
+ declare function loadAaveV4SupportedChainIdsFromV4Api(): Promise<ReadonlySet<number>>;
16
+ type V4ReservesListRow = {
17
+ id: string;
18
+ onChainId?: string | null;
19
+ spoke?: {
20
+ address: string;
21
+ name?: string | null;
22
+ liquidationConfig?: {
23
+ targetHealthFactor: string;
24
+ healthFactorForMaxBonus: string;
25
+ } | null;
26
+ } | null;
27
+ summary: {
28
+ supplied: {
29
+ amount: {
30
+ value: string;
31
+ decimals: number;
32
+ };
33
+ };
34
+ borrowed: {
35
+ amount: {
36
+ value: string;
37
+ decimals: number;
38
+ };
39
+ };
40
+ suppliable: {
41
+ amount: {
42
+ value: string;
43
+ decimals: number;
44
+ };
45
+ };
46
+ supplyApy: {
47
+ normalized: string;
48
+ value: string;
49
+ };
50
+ };
51
+ userState: {
52
+ balance: {
53
+ amount: {
54
+ value: string;
55
+ decimals: number;
56
+ };
57
+ } | null;
58
+ borrowable?: {
59
+ amount: {
60
+ value: string;
61
+ decimals: number;
62
+ };
63
+ } | null;
64
+ } | null;
65
+ };
66
+ declare function aggregateV4SupplyDisplay(symbolForDisplay: string, rows: readonly V4ReservesListRow[]): {
67
+ depositedAmount: string;
68
+ apy: string;
69
+ totalDeposits: string;
70
+ availableLiquidity: string;
71
+ };
72
+ /**
73
+ * Formats a token notional for display: uses k (≥1k) and M (≥1M) with a few decimal places, otherwise limited decimals.
74
+ * Safe to reuse outside the Aave V4 dialog (e.g. tables, tooltips).
75
+ */
76
+ declare function formatAaveV4TokenAmount(n: number): string;
77
+ /**
78
+ * Human-readable notional for Aave v4 API decimal strings (reserve amounts, user debt, etc.).
79
+ * Use this for all “display from GraphQL `value`” paths so formatting stays consistent.
80
+ */
81
+ declare function formatAaveV4AmountHumanFromApiString(raw: string | null | undefined): string;
82
+ /**
83
+ * Unnamed reserve liquidity: supplied − borrowed (both API decimal strings, same unit).
84
+ */
85
+ declare function formatAaveV4ReserveLiquidityFromSummary(args: {
86
+ suppliedValue: string | null | undefined;
87
+ borrowedValue: string | null | undefined;
88
+ }): string;
89
+ declare function fetchAaveV4NativeWrappedToken(chainId: number): Promise<string | null>;
90
+ /**
91
+ * All underlying token addresses (lowercased checksummed form for lookup: store lowercase) listed as reserves on the chain.
92
+ */
93
+ declare function fetchAaveV4SupportedUnderlyingAddressSet(chainId: number): Promise<ReadonlySet<string>>;
94
+ declare function fetchAaveV4ReservesForUnderlying(args: {
95
+ chainId: number;
96
+ underlying: `0x${string}`;
97
+ user?: `0x${string}` | null;
98
+ }): Promise<readonly V4ReservesListRow[]>;
99
+ /**
100
+ * Reserve row for a hub asset on the same Aave v4 **Spoke** as the user’s collateral (same as {@link useAaveV4DepositCollateralInfo}’s `collateralForAsset`).
101
+ * Needed so borrow/repay multi-sign uses the same spoke as the user’s position.
102
+ */
103
+ declare function pickAaveV4ReserveRowForSpoke(rows: readonly V4ReservesListRow[], spokeAddress: `0x${string}`): V4ReservesListRow | null;
104
+ declare function aaveV4KeyForNodeAssetRow(args: {
105
+ contractAddress: string;
106
+ nativeWrapped: string | null;
107
+ }): string | null;
108
+ type AaveV4ChainTokenCache = {
109
+ supportedUnderlying: ReadonlySet<string>;
110
+ nativeWrapped: string | null;
111
+ };
112
+ /**
113
+ * Fetches and caches (per process) the list of Aave v4 underlying addresses on a chain and the wrapped native token.
114
+ */
115
+ declare function ensureAaveV4ChainTokenCache(chainId: number): Promise<AaveV4ChainTokenCache>;
116
+ /** UI market segment; maps to Aave v4 `Hub` by name (e.g. Plus ≈ “Main”, Core, Prime ≈ “Bluechip”). */
117
+ type AaveV4UiMarketId = 'main' | 'core' | 'bluechip';
118
+ type AaveV4Hub = {
119
+ name: string;
120
+ address: `0x${string}`;
121
+ chain: {
122
+ chainId: number;
123
+ name?: string | null;
124
+ };
125
+ };
126
+ /** `summary` is included for hub `reserves` (market borrow/supply TVL, APYs). */
127
+ type AaveV4HubReserveSummary = {
128
+ supplied: {
129
+ amount: {
130
+ value: string;
131
+ decimals: number;
132
+ };
133
+ };
134
+ borrowed: {
135
+ amount: {
136
+ value: string;
137
+ decimals: number;
138
+ };
139
+ };
140
+ suppliable: {
141
+ amount: {
142
+ value: string;
143
+ decimals: number;
144
+ };
145
+ };
146
+ supplyApy: {
147
+ normalized: string;
148
+ value: string;
149
+ };
150
+ borrowApy: {
151
+ normalized: string;
152
+ value: string;
153
+ };
154
+ };
155
+ type AaveV4HubReserve = {
156
+ canBorrow: boolean;
157
+ canUseAsCollateral: boolean;
158
+ canSupply: boolean;
159
+ /** Spoke contract to call for `supply` on this reserve. */
160
+ spoke: {
161
+ address: string;
162
+ } | null;
163
+ settings: {
164
+ borrowable: boolean;
165
+ collateral: boolean;
166
+ collateralFactor: {
167
+ normalized: string;
168
+ value: string;
169
+ };
170
+ collateralRisk: {
171
+ normalized: string;
172
+ value: string;
173
+ };
174
+ };
175
+ asset: {
176
+ underlying: {
177
+ address: string;
178
+ info: {
179
+ name: string;
180
+ symbol: string;
181
+ icon: string | null;
182
+ } | null;
183
+ };
184
+ };
185
+ /** Present when using the extended hub reserves query (borrow tab, market TVL). */
186
+ summary?: AaveV4HubReserveSummary | null;
187
+ };
188
+ declare function fetchAaveV4HubsForChain(chainId: number): Promise<readonly AaveV4Hub[]>;
189
+ /**
190
+ * Resolves which Aave v4 hub (Core / Plus / Prime, etc.) a UI “market” refers to.
191
+ * Main → Plus, Core → Core, Bluechip → Prime.
192
+ */
193
+ declare function resolveAaveV4HubForUiMarket(hubs: readonly AaveV4Hub[], market: AaveV4UiMarketId, chainId: number): AaveV4Hub | null;
194
+ /**
195
+ * Inverse of {@link resolveAaveV4HubForUiMarket} label mapping, for switching UI market when a hub is chosen by
196
+ * “first hub on chain that lists this underlying”.
197
+ */
198
+ declare function aaveV4UiMarketIdForHubName(hubName: string): AaveV4UiMarketId;
199
+ /**
200
+ * 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
201
+ * Plus on Ethereum). Returns a hub on this chain where this underlying appears in hub reserves, so Spoke and
202
+ * collateral can be resolved.
203
+ *
204
+ * **When no debt hint:** `preferHub` is tried first, then other hubs in {@link aaveV4HubAutoPickTiebreakOrder} order.
205
+ *
206
+ * **When `debtUnderlying` is set (user chose a debt asset on the borrow flow):** among hubs that list **both** the
207
+ * **collateral** and that **debt** as borrowable, the hub with the **lowest debt borrow APY** is chosen. If
208
+ * `debtBorrowAmountHumanForLiquidity` is a positive number string, we **prefer** hubs where `suppliable` on the debt
209
+ * reserve is at least that amount; if none satisfy that, the lowest-APY hub among all debt-backed candidates is
210
+ * used anyway.
211
+ */
212
+ declare function findAaveV4HubReserveForChainUnderlying(args: {
213
+ chainId: number;
214
+ hubs: readonly AaveV4Hub[];
215
+ underlying: `0x${string}`;
216
+ /** Tried first; if the asset is not listed here, other hubs on the same chain are scanned. */
217
+ preferHub: AaveV4Hub;
218
+ /** If set, disambiguate using this debt asset’s `borrowAPY` (and optional liquidity) per hub. */
219
+ debtUnderlying?: `0x${string}` | null;
220
+ /**
221
+ * When set, used with `debtUnderlying` to prefer hubs with enough `suppliable` on the debt line for a borrow
222
+ * of that size (human amount; commas may be included).
223
+ */
224
+ debtBorrowAmountHumanForLiquidity?: string | null;
225
+ }): Promise<{
226
+ hub: AaveV4Hub;
227
+ hubReserves: readonly AaveV4HubReserve[];
228
+ reserve: AaveV4HubReserve;
229
+ } | null>;
230
+ declare function fetchAaveV4HubReserves(args: {
231
+ chainId: number;
232
+ hubAddress: `0x${string}`;
233
+ }): Promise<readonly AaveV4HubReserve[]>;
234
+ /**
235
+ * LTV you can borrow against a unit of this asset, e.g. "90%".
236
+ */
237
+ declare function formatAaveV4PercentDisplay(normalized: string | undefined, value: string | undefined): string;
238
+ /**
239
+ * Collateral / protocol risk on the same 0–100 style scale as the API, or a plain label if zero/empty.
240
+ */
241
+ declare function formatAaveV4RiskDisplay(normalized: string | undefined, value: string | undefined): string;
242
+ declare function findHubReserveForUnderlying(list: readonly AaveV4HubReserve[], underlying: `0x${string}`): AaveV4HubReserve | null;
243
+ type AaveV4BorrowableDisplay = {
244
+ address: string;
245
+ symbol: string;
246
+ name: string;
247
+ icon: string | null;
248
+ };
249
+ /**
250
+ * De-duplicated borrowable debt assets in a hub (what users can borrow there).
251
+ */
252
+ declare function borrowableAssetsFromHubReserves(rows: readonly AaveV4HubReserve[]): AaveV4BorrowableDisplay[];
253
+ /**
254
+ * Current variable-debt balance per underlying token for this user in the given hub (one entry per asset).
255
+ * Values are API decimal strings; format with {@link formatAaveV4AmountHumanFromApiString}.
256
+ */
257
+ declare function fetchAaveV4UserBorrowsDebtByUnderlyingForHub(args: {
258
+ user: `0x${string}`;
259
+ chainId: number;
260
+ hubAddress: `0x${string}`;
261
+ }): Promise<ReadonlyMap<string, string>>;
262
+ type AaveV4BorrowTableRow = {
263
+ address: string;
264
+ symbol: string;
265
+ name: string;
266
+ icon: string | null;
267
+ yourBorrowedDisplay: string;
268
+ baseBorrowApyDisplay: string;
269
+ totalBorrowsDisplay: string;
270
+ liquidityDisplay: string;
271
+ };
272
+ /**
273
+ * One row per borrowable asset in the hub, using shared human-readable formatters.
274
+ */
275
+ declare function buildAaveV4BorrowTableRowsFromHub(borrowable: readonly AaveV4BorrowableDisplay[], hubReserves: readonly AaveV4HubReserve[] | null,
276
+ /** `undefined` = not loaded or no wallet (show em dash for “your” column). */
277
+ debtByUnderlying: ReadonlyMap<string, string> | undefined): AaveV4BorrowTableRow[];
278
+
279
+ /**
280
+ * `eth_estimateGas` can revert for complex Aave v4 `supply` calldata; same order of magnitude as Curve router.
281
+ * Exported for Get Sig / Execute fallbacks.
282
+ */
283
+ declare const AAVE_V4_SPOKE_SUPPLY_DEFAULT_GAS_UNITS = 1200000n;
284
+ declare const AAVE_V4_SPOKE_WITHDRAW_DEFAULT_GAS_UNITS = 800000n;
285
+ declare const AAVE_V4_SPOKE_BORROW_DEFAULT_GAS_UNITS = 900000n;
286
+ declare const AAVE_V4_SPOKE_REPAY_DEFAULT_GAS_UNITS = 1000000n;
287
+ type ChainRow = {
288
+ legacy?: boolean;
289
+ gasLimit?: number;
290
+ gasMultiplier?: number;
291
+ gasPrice?: number;
292
+ baseFee?: number;
293
+ priorityFee?: number;
294
+ baseFeeMultiplier?: number;
295
+ };
296
+ /**
297
+ * Aave v4: optional WETH `deposit` (native path), exact ERC-20 `approve` to the spoke when needed, then
298
+ * `spoke.supply(reserveId, amount, onBehalfOf)`.
299
+ * Optionally appends `spoke.setUsingAsCollateral(reserveId, true, onBehalfOf)` in the same batch
300
+ * (same pattern as the Aave app’s “use as collateral” toggle after supply).
301
+ */
302
+ declare function buildEvmMultisignBodyAaveV4DepositBatch(args: {
303
+ keyGen: KeyGenSubsetForPermit;
304
+ chainId: number;
305
+ rpcUrl: string;
306
+ chainDetail: ChainRow;
307
+ useCustomGas: boolean;
308
+ customGasChainDetails?: Record<string, unknown> | null;
309
+ market: AaveV4UiMarketId;
310
+ /** Underlying to supply (e.g. WETH when user chose native, or the ERC-20). */
311
+ asset: Address;
312
+ isNativeIn: boolean;
313
+ /** Wrapped native; required when `isNativeIn`. */
314
+ nativeWrapped: Address;
315
+ amountHuman: string;
316
+ spoke: Address;
317
+ onBehalfOf: Address;
318
+ executorAddress: Address;
319
+ purposeText: string;
320
+ /**
321
+ * When true, add a final tx `setUsingAsCollateral(reserveId, true, onBehalfOf)` after `supply`
322
+ * so the new supply is enabled as borrow collateral (Aave v4 `ISpoke.setUsingAsCollateral`).
323
+ */
324
+ enableAsCollateralAfterSupply?: boolean;
325
+ }): Promise<{
326
+ bodyForSign: Record<string, unknown>;
327
+ messageToSign: string;
328
+ }>;
329
+ /**
330
+ * `Spoke.withdraw` — one transaction (same sign-request shape as a single step of a deposit batch).
331
+ * Prefer passing {@link fetchAaveV4SpokeReserveIdForUnderlying} result via `reserveIdOnChain` when known.
332
+ */
333
+ declare function buildEvmMultisignBodyAaveV4SpokeWithdraw(args: {
334
+ keyGen: KeyGenSubsetForPermit;
335
+ chainId: number;
336
+ rpcUrl: string;
337
+ chainDetail: ChainRow;
338
+ useCustomGas: boolean;
339
+ customGasChainDetails?: Record<string, unknown> | null;
340
+ marketLabel: string;
341
+ spoke: Address;
342
+ underlying: Address;
343
+ amountHuman: string;
344
+ onBehalfOf: Address;
345
+ executorAddress: Address;
346
+ purposeText: string;
347
+ /** When set, avoids an extra on-chain getReserve for the id. */
348
+ reserveIdOnChain?: bigint | null;
349
+ }): Promise<{
350
+ bodyForSign: Record<string, unknown>;
351
+ messageToSign: string;
352
+ }>;
353
+ /**
354
+ * `Spoke.borrow` — one transaction, same shape as {@link buildEvmMultisignBodyAaveV4SpokeWithdraw}.
355
+ */
356
+ declare function buildEvmMultisignBodyAaveV4SpokeBorrow(args: {
357
+ keyGen: KeyGenSubsetForPermit;
358
+ chainId: number;
359
+ rpcUrl: string;
360
+ chainDetail: ChainRow;
361
+ useCustomGas: boolean;
362
+ customGasChainDetails?: Record<string, unknown> | null;
363
+ marketLabel: string;
364
+ spoke: Address;
365
+ underlying: Address;
366
+ amountHuman: string;
367
+ onBehalfOf: Address;
368
+ executorAddress: Address;
369
+ purposeText: string;
370
+ reserveIdOnChain?: bigint | null;
371
+ }): Promise<{
372
+ bodyForSign: Record<string, unknown>;
373
+ messageToSign: string;
374
+ }>;
375
+ /**
376
+ * `approve` (if required) and `Spoke.repay` — one or two transactions (same pattern as a deposit batch).
377
+ */
378
+ declare function buildEvmMultisignBodyAaveV4SpokeRepay(args: {
379
+ keyGen: KeyGenSubsetForPermit;
380
+ chainId: number;
381
+ rpcUrl: string;
382
+ chainDetail: ChainRow;
383
+ useCustomGas: boolean;
384
+ customGasChainDetails?: Record<string, unknown> | null;
385
+ market: AaveV4UiMarketId;
386
+ spoke: Address;
387
+ underlying: Address;
388
+ amountHuman: string;
389
+ onBehalfOf: Address;
390
+ executorAddress: Address;
391
+ purposeText: string;
392
+ reserveIdOnChain?: bigint | null;
393
+ }): Promise<{
394
+ bodyForSign: Record<string, unknown>;
395
+ messageToSign: string;
396
+ }>;
397
+ /**
398
+ * Merkl claim-rewards call from the Aave API (`claimRewards`) — one transaction to `to` with `data` / `value`.
399
+ */
400
+ declare function buildEvmMultisignBodyAaveV4MerklClaimRewards(args: {
401
+ keyGen: KeyGenSubsetForPermit;
402
+ chainId: number;
403
+ rpcUrl: string;
404
+ chainDetail: ChainRow;
405
+ useCustomGas: boolean;
406
+ customGasChainDetails?: Record<string, unknown> | null;
407
+ to: Address;
408
+ data: `0x${string}`;
409
+ valueWei: bigint;
410
+ rewardIdCount: number;
411
+ executorAddress: Address;
412
+ purposeText: string;
413
+ }): Promise<{
414
+ bodyForSign: Record<string, unknown>;
415
+ messageToSign: string;
416
+ }>;
417
+ /**
418
+ * Wallet-wide Merkl `Distributor.claim` (same proofs as Morpho / Euler).
419
+ */
420
+ declare function buildEvmMultisignBodyAaveV4MerklDistributorClaim(args: {
421
+ keyGen: KeyGenSubsetForPermit;
422
+ chainId: number;
423
+ rpcUrl: string;
424
+ chainDetail: ChainRow;
425
+ useCustomGas: boolean;
426
+ customGasChainDetails?: Record<string, unknown> | null;
427
+ to: Address;
428
+ data: `0x${string}`;
429
+ valueWei: bigint;
430
+ claimLeafCount: number;
431
+ executorAddress: Address;
432
+ purposeText: string;
433
+ }): Promise<{
434
+ bodyForSign: Record<string, unknown>;
435
+ messageToSign: string;
436
+ }>;
437
+ /**
438
+ * Merkl `Distributor.claim` using calldata from {@link encodeMerklDistributorClaimData} / Merkl API proofs.
439
+ */
440
+ declare function buildEvmMultisignBodyEulerV2MerklDistributorClaim(args: {
441
+ keyGen: KeyGenSubsetForPermit;
442
+ chainId: number;
443
+ rpcUrl: string;
444
+ chainDetail: ChainRow;
445
+ useCustomGas: boolean;
446
+ customGasChainDetails?: Record<string, unknown> | null;
447
+ to: Address;
448
+ data: `0x${string}`;
449
+ valueWei: bigint;
450
+ claimLeafCount: number;
451
+ executorAddress: Address;
452
+ purposeText: string;
453
+ }): Promise<{
454
+ bodyForSign: Record<string, unknown>;
455
+ messageToSign: string;
456
+ }>;
457
+ /**
458
+ * rEUL (`RewardToken`) batched `withdrawToByLockTimestamps` → unwrap vested underlying (EUL) to `executorAddress`.
459
+ */
460
+ declare function buildEvmMultisignBodyEulerV2ReulUnlock(args: {
461
+ keyGen: KeyGenSubsetForPermit;
462
+ chainId: number;
463
+ rpcUrl: string;
464
+ chainDetail: ChainRow;
465
+ useCustomGas: boolean;
466
+ customGasChainDetails?: Record<string, unknown> | null;
467
+ to: Address;
468
+ data: `0x${string}`;
469
+ valueWei: bigint;
470
+ lockTimestampCount: number;
471
+ allowRemainderLoss: boolean;
472
+ executorAddress: Address;
473
+ purposeText: string;
474
+ }): Promise<{
475
+ bodyForSign: Record<string, unknown>;
476
+ messageToSign: string;
477
+ }>;
478
+ /** Minimum gas floor for Execute preflight (same style as `MIN_CURVE_ROUTER_GAS_EXEC`). */
479
+ declare const MIN_AAVE_V4_DEPOSIT_GAS_EXEC = 400000n;
480
+ /**
481
+ * True when this sign request (or `batchMeta[batchIndex]`) is an Aave v4 deposit batch step.
482
+ */
483
+ declare function isAaveV4DepositEvmSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): boolean;
484
+ /**
485
+ * Prefer `proposalTxParams[i]` / `batchMeta[i].aaveV4.gasBuildSupply` when `eth_estimateGas` reverts.
486
+ */
487
+ declare function resolveAaveV4DepositGasUnitsFromSignRequest(detail: Record<string, unknown> | null | undefined, batchIndex?: number): bigint | null;
488
+
489
+ export { AAVE_V4_GRAPHQL_URL as A, fetchAaveV4HubReserves as B, fetchAaveV4HubsForChain as C, fetchAaveV4NativeWrappedToken as D, fetchAaveV4ReservesForUnderlying as E, fetchAaveV4SupportedUnderlyingAddressSet as F, fetchAaveV4UserBorrowsDebtByUnderlyingForHub as G, findAaveV4HubReserveForChainUnderlying as H, findHubReserveForUnderlying as I, formatAaveV4AmountHumanFromApiString as J, formatAaveV4PercentDisplay as K, formatAaveV4ReserveLiquidityFromSummary as L, MIN_AAVE_V4_DEPOSIT_GAS_EXEC as M, formatAaveV4RiskDisplay as N, formatAaveV4TokenAmount as O, isAaveV4DepositEvmSignRequest as P, loadAaveV4SupportedChainIdsFromV4Api as Q, pickAaveV4ReserveRowForSpoke as R, resolveAaveV4DepositGasUnitsFromSignRequest as S, resolveAaveV4HubForUiMarket as T, type V4ReservesListRow as V, AAVE_V4_SPOKE_BORROW_DEFAULT_GAS_UNITS as a, AAVE_V4_SPOKE_REPAY_DEFAULT_GAS_UNITS as b, AAVE_V4_SPOKE_SUPPLY_DEFAULT_GAS_UNITS as c, AAVE_V4_SPOKE_WITHDRAW_DEFAULT_GAS_UNITS as d, type AaveV4BorrowTableRow as e, type AaveV4BorrowableDisplay as f, type AaveV4Hub as g, type AaveV4HubReserve as h, type AaveV4HubReserveSummary as i, type AaveV4UiMarketId as j, aaveV4Gql as k, aaveV4KeyForNodeAssetRow as l, aaveV4UiMarketIdForHubName as m, aggregateV4SupplyDisplay as n, borrowableAssetsFromHubReserves as o, buildAaveV4BorrowTableRowsFromHub as p, buildEvmMultisignBodyAaveV4DepositBatch as q, buildEvmMultisignBodyAaveV4MerklClaimRewards as r, buildEvmMultisignBodyAaveV4MerklDistributorClaim as s, buildEvmMultisignBodyAaveV4SpokeBorrow as t, buildEvmMultisignBodyAaveV4SpokeRepay as u, buildEvmMultisignBodyAaveV4SpokeWithdraw as v, buildEvmMultisignBodyEulerV2MerklDistributorClaim as w, buildEvmMultisignBodyEulerV2ReulUnlock as x, ensureAaveV4ChainTokenCache as y, fetchAaveV4Chains as z };