@peridot-agent/agent-kit 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/README.md +414 -0
- package/dist/adapters/langchain/index.cjs +1753 -0
- package/dist/adapters/langchain/index.cjs.map +1 -0
- package/dist/adapters/langchain/index.d.cts +29 -0
- package/dist/adapters/langchain/index.d.ts +29 -0
- package/dist/adapters/langchain/index.js +1725 -0
- package/dist/adapters/langchain/index.js.map +1 -0
- package/dist/adapters/mcp/server.cjs +1777 -0
- package/dist/adapters/mcp/server.cjs.map +1 -0
- package/dist/adapters/mcp/server.d.cts +1 -0
- package/dist/adapters/mcp/server.d.ts +1 -0
- package/dist/adapters/mcp/server.js +1756 -0
- package/dist/adapters/mcp/server.js.map +1 -0
- package/dist/adapters/vercel-ai/index.cjs +1751 -0
- package/dist/adapters/vercel-ai/index.cjs.map +1 -0
- package/dist/adapters/vercel-ai/index.d.cts +34 -0
- package/dist/adapters/vercel-ai/index.d.ts +34 -0
- package/dist/adapters/vercel-ai/index.js +1723 -0
- package/dist/adapters/vercel-ai/index.js.map +1 -0
- package/dist/index.cjs +1806 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +880 -0
- package/dist/index.d.ts +880 -0
- package/dist/index.js +1737 -0
- package/dist/index.js.map +1 -0
- package/dist/types-Cg95um6s.d.cts +212 -0
- package/dist/types-Cg95um6s.d.ts +212 -0
- package/package.json +95 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,880 @@
|
|
|
1
|
+
import { T as ToolDefinition, P as PeridotConfig, L as LiquidatablePositions, C as ComposeRequest, B as BiconomyResponse, a as TransactionStatus, M as MarketSummary, b as LeaderboardEntry, c as MarketRates, U as UserPosition, S as SimulateBorrowResult, A as AccountLiquidity, H as HubTransactionIntent, d as CrossChainIntent } from './types-Cg95um6s.cjs';
|
|
2
|
+
export { e as ComposeFlow, f as ToolCategory, g as TransactionCall, h as TransactionIntent } from './types-Cg95um6s.cjs';
|
|
3
|
+
import { Address } from 'viem';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Lending feature tool registry.
|
|
8
|
+
*
|
|
9
|
+
* Adding a new tool:
|
|
10
|
+
* 1. Implement the function in the appropriate read/ or intents/ subdirectory
|
|
11
|
+
* 2. Add an entry to the `lendingTools` array below
|
|
12
|
+
* 3. It will automatically appear in the MCP server and all framework adapters
|
|
13
|
+
*
|
|
14
|
+
* Adding a new feature (e.g. margin):
|
|
15
|
+
* Create src/features/margin/tools.ts with the same pattern, then add it to
|
|
16
|
+
* src/adapters/mcp/server.ts's `allTools` array.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
declare const lendingTools: ToolDefinition<any, any>[];
|
|
20
|
+
|
|
21
|
+
interface RawMarketMetric {
|
|
22
|
+
utilizationPct: number;
|
|
23
|
+
tvlUsd: number;
|
|
24
|
+
liquidityUnderlying: number;
|
|
25
|
+
liquidityUsd: number;
|
|
26
|
+
priceUsd: number;
|
|
27
|
+
collateral_factor_pct: number;
|
|
28
|
+
updatedAt: string;
|
|
29
|
+
chainId: number;
|
|
30
|
+
}
|
|
31
|
+
/** Shape of one entry from `/api/apy` (from `apy_latest_mainnet` table). */
|
|
32
|
+
interface RawMarketApy {
|
|
33
|
+
supplyApy: number;
|
|
34
|
+
borrowApy: number;
|
|
35
|
+
peridotSupplyApy: number;
|
|
36
|
+
peridotBorrowApy: number;
|
|
37
|
+
boostSourceSupplyApy: number;
|
|
38
|
+
boostRewardsSupplyApy: number;
|
|
39
|
+
totalSupplyApy: number;
|
|
40
|
+
netBorrowApy: number;
|
|
41
|
+
timestamp: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Full response from `/api/apy`.
|
|
45
|
+
* Keys are lowercase asset IDs (e.g. "usdc"), values are a map of chainId → APY data.
|
|
46
|
+
*/
|
|
47
|
+
type RawApyResponse = Record<string, Record<number, RawMarketApy>>;
|
|
48
|
+
/** Shape of one leaderboard entry from `/api/leaderboard`. */
|
|
49
|
+
interface RawTransaction {
|
|
50
|
+
txHash: string;
|
|
51
|
+
chainId: number;
|
|
52
|
+
blockNumber: number;
|
|
53
|
+
actionType: string;
|
|
54
|
+
tokenSymbol: string | null;
|
|
55
|
+
amount: number;
|
|
56
|
+
usdValue: number;
|
|
57
|
+
pointsAwarded: number;
|
|
58
|
+
verifiedAt: string;
|
|
59
|
+
contractAddress: string;
|
|
60
|
+
}
|
|
61
|
+
interface RawTransactionsResponse {
|
|
62
|
+
transactions: RawTransaction[];
|
|
63
|
+
total: number;
|
|
64
|
+
}
|
|
65
|
+
interface RawLeaderboardEntry {
|
|
66
|
+
rank: number;
|
|
67
|
+
address: string;
|
|
68
|
+
totalPoints: number;
|
|
69
|
+
supplyCount: number;
|
|
70
|
+
borrowCount: number;
|
|
71
|
+
repayCount: number;
|
|
72
|
+
redeemCount: number;
|
|
73
|
+
updatedAt: string;
|
|
74
|
+
}
|
|
75
|
+
interface RawLeaderboardResponse {
|
|
76
|
+
entries: RawLeaderboardEntry[];
|
|
77
|
+
total: number;
|
|
78
|
+
}
|
|
79
|
+
interface RawUserPortfolio {
|
|
80
|
+
portfolio: {
|
|
81
|
+
currentValue: number;
|
|
82
|
+
totalSupplied: number;
|
|
83
|
+
totalBorrowed: number;
|
|
84
|
+
netApy: number;
|
|
85
|
+
/** Note: simplified ratio (totalSupplied / totalBorrowed), not liquidation HF */
|
|
86
|
+
healthFactor: number;
|
|
87
|
+
};
|
|
88
|
+
assets: Array<{
|
|
89
|
+
assetId: string;
|
|
90
|
+
supplied: number;
|
|
91
|
+
borrowed: number;
|
|
92
|
+
net: number;
|
|
93
|
+
percentage: number;
|
|
94
|
+
}>;
|
|
95
|
+
transactions: {
|
|
96
|
+
totalCount: number;
|
|
97
|
+
supplyCount: number;
|
|
98
|
+
borrowCount: number;
|
|
99
|
+
repayCount: number;
|
|
100
|
+
redeemCount: number;
|
|
101
|
+
};
|
|
102
|
+
earnings: {
|
|
103
|
+
effectiveApy: number;
|
|
104
|
+
totalLifetimeEarnings: number;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
declare class PeridotApiClient {
|
|
108
|
+
private readonly baseUrl;
|
|
109
|
+
private readonly biconomyApiKey;
|
|
110
|
+
constructor(config: PeridotConfig);
|
|
111
|
+
/**
|
|
112
|
+
* Fetches all market metrics. Returns a record keyed by `${ASSET}:${chainId}`.
|
|
113
|
+
* Example key: `USDC:56`
|
|
114
|
+
*/
|
|
115
|
+
getMarketMetrics(): Promise<Record<string, RawMarketMetric>>;
|
|
116
|
+
/**
|
|
117
|
+
* Fetches the portfolio overview for a wallet address.
|
|
118
|
+
* Uses the platform's portfolio-data endpoint which aggregates DB snapshots.
|
|
119
|
+
*/
|
|
120
|
+
getUserPortfolio(address: string): Promise<RawUserPortfolio>;
|
|
121
|
+
/**
|
|
122
|
+
* Fetches the latest APY snapshot for all markets (or a specific chain).
|
|
123
|
+
* Calls `/api/apy` — backed by the `apy_latest_mainnet` DB table.
|
|
124
|
+
*
|
|
125
|
+
* Returns a record keyed by lowercase asset ID, then by chainId.
|
|
126
|
+
* Example: `data["usdc"][56].totalSupplyApy`
|
|
127
|
+
*/
|
|
128
|
+
getMarketApy(chainId?: number): Promise<RawApyResponse>;
|
|
129
|
+
/**
|
|
130
|
+
* Fetches the Peridot leaderboard (top users by points).
|
|
131
|
+
* Optionally filters by chainId and limits the result set.
|
|
132
|
+
*/
|
|
133
|
+
getLeaderboard(options?: {
|
|
134
|
+
limit?: number;
|
|
135
|
+
chainId?: number;
|
|
136
|
+
}): Promise<RawLeaderboardResponse>;
|
|
137
|
+
/**
|
|
138
|
+
* Fetches accounts that are currently underwater (shortfall_usd > 0) and
|
|
139
|
+
* eligible for liquidation. Data is sourced from the account health scanner.
|
|
140
|
+
*/
|
|
141
|
+
getLiquidatablePositions(options?: {
|
|
142
|
+
chainId?: number;
|
|
143
|
+
minShortfall?: number;
|
|
144
|
+
limit?: number;
|
|
145
|
+
}): Promise<LiquidatablePositions>;
|
|
146
|
+
/**
|
|
147
|
+
* Fetches verified transaction history for a wallet address.
|
|
148
|
+
* Optionally filters by chainId and/or actionType.
|
|
149
|
+
*/
|
|
150
|
+
getUserTransactions(address: string, options?: {
|
|
151
|
+
limit?: number;
|
|
152
|
+
chainId?: number;
|
|
153
|
+
actionType?: 'supply' | 'borrow' | 'repay' | 'redeem';
|
|
154
|
+
}): Promise<RawTransactionsResponse>;
|
|
155
|
+
/**
|
|
156
|
+
* Calls Biconomy MEE /compose to build a cross-chain transaction payload.
|
|
157
|
+
* Does NOT execute — the returned instructions must be signed by the user.
|
|
158
|
+
*/
|
|
159
|
+
biconomyCompose(request: ComposeRequest): Promise<BiconomyResponse>;
|
|
160
|
+
/** Polls Biconomy for the status of a submitted super-transaction. */
|
|
161
|
+
biconomyGetStatus(superTxHash: string): Promise<TransactionStatus>;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
declare const BSC_MAINNET_CHAIN_ID = 56;
|
|
165
|
+
declare const BSC_TESTNET_CHAIN_ID = 97;
|
|
166
|
+
declare const MONAD_MAINNET_CHAIN_ID = 143;
|
|
167
|
+
declare const SOMNIA_MAINNET_CHAIN_ID = 1868;
|
|
168
|
+
/** Spoke chains — users bridge to the hub to interact with the protocol. */
|
|
169
|
+
declare const ARBITRUM_CHAIN_ID = 42161;
|
|
170
|
+
declare const BASE_CHAIN_ID = 8453;
|
|
171
|
+
declare const ETHEREUM_CHAIN_ID = 1;
|
|
172
|
+
declare function isHubChain(chainId: number): boolean;
|
|
173
|
+
/** For spoke chains, returns the hub chain that hosts the markets. */
|
|
174
|
+
declare function resolveHubChainId(chainId: number, network?: 'mainnet' | 'testnet'): number;
|
|
175
|
+
declare const PERIDOT_CONTROLLER: Partial<Record<number, Address>>;
|
|
176
|
+
/** pToken market addresses per hub chain, keyed by asset symbol (uppercase). */
|
|
177
|
+
declare const PERIDOT_MARKETS: Partial<Record<number, Partial<Record<string, Address>>>>;
|
|
178
|
+
/** Underlying ERC-20 token addresses on BSC Mainnet. */
|
|
179
|
+
declare const BSC_UNDERLYING_TOKENS: Partial<Record<string, Address>>;
|
|
180
|
+
/** Token addresses on spoke chains, keyed by chainId then asset symbol. */
|
|
181
|
+
declare const SPOKE_TOKENS: Partial<Record<number, Partial<Record<string, Address>>>>;
|
|
182
|
+
/** ERC-20 decimal places by asset symbol. */
|
|
183
|
+
declare const ASSET_DECIMALS: Record<string, number>;
|
|
184
|
+
declare function getPTokenAddress(chainId: number, asset: string): Address;
|
|
185
|
+
declare function getUnderlyingTokenAddress(chainId: number, asset: string): Address;
|
|
186
|
+
declare function getControllerAddress(chainId: number): Address;
|
|
187
|
+
declare function getAssetDecimals(asset: string): number;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Minimal ABI for pToken (Compound V2-style cToken) markets.
|
|
191
|
+
* Only includes functions used by the agent-kit.
|
|
192
|
+
*/
|
|
193
|
+
declare const PTOKEN_ABI: readonly [{
|
|
194
|
+
readonly name: "mint";
|
|
195
|
+
readonly type: "function";
|
|
196
|
+
readonly stateMutability: "nonpayable";
|
|
197
|
+
readonly inputs: readonly [{
|
|
198
|
+
readonly type: "uint256";
|
|
199
|
+
readonly name: "mintAmount";
|
|
200
|
+
}];
|
|
201
|
+
readonly outputs: readonly [{
|
|
202
|
+
readonly type: "uint256";
|
|
203
|
+
}];
|
|
204
|
+
}, {
|
|
205
|
+
readonly name: "redeem";
|
|
206
|
+
readonly type: "function";
|
|
207
|
+
readonly stateMutability: "nonpayable";
|
|
208
|
+
readonly inputs: readonly [{
|
|
209
|
+
readonly type: "uint256";
|
|
210
|
+
readonly name: "redeemTokens";
|
|
211
|
+
}];
|
|
212
|
+
readonly outputs: readonly [{
|
|
213
|
+
readonly type: "uint256";
|
|
214
|
+
}];
|
|
215
|
+
}, {
|
|
216
|
+
readonly name: "redeemUnderlying";
|
|
217
|
+
readonly type: "function";
|
|
218
|
+
readonly stateMutability: "nonpayable";
|
|
219
|
+
readonly inputs: readonly [{
|
|
220
|
+
readonly type: "uint256";
|
|
221
|
+
readonly name: "redeemAmount";
|
|
222
|
+
}];
|
|
223
|
+
readonly outputs: readonly [{
|
|
224
|
+
readonly type: "uint256";
|
|
225
|
+
}];
|
|
226
|
+
}, {
|
|
227
|
+
readonly name: "borrow";
|
|
228
|
+
readonly type: "function";
|
|
229
|
+
readonly stateMutability: "nonpayable";
|
|
230
|
+
readonly inputs: readonly [{
|
|
231
|
+
readonly type: "uint256";
|
|
232
|
+
readonly name: "borrowAmount";
|
|
233
|
+
}];
|
|
234
|
+
readonly outputs: readonly [{
|
|
235
|
+
readonly type: "uint256";
|
|
236
|
+
}];
|
|
237
|
+
}, {
|
|
238
|
+
readonly name: "repayBorrow";
|
|
239
|
+
readonly type: "function";
|
|
240
|
+
readonly stateMutability: "nonpayable";
|
|
241
|
+
readonly inputs: readonly [{
|
|
242
|
+
readonly type: "uint256";
|
|
243
|
+
readonly name: "repayAmount";
|
|
244
|
+
}];
|
|
245
|
+
readonly outputs: readonly [{
|
|
246
|
+
readonly type: "uint256";
|
|
247
|
+
}];
|
|
248
|
+
}, {
|
|
249
|
+
readonly name: "repayBorrowBehalf";
|
|
250
|
+
readonly type: "function";
|
|
251
|
+
readonly stateMutability: "nonpayable";
|
|
252
|
+
readonly inputs: readonly [{
|
|
253
|
+
readonly type: "address";
|
|
254
|
+
readonly name: "borrower";
|
|
255
|
+
}, {
|
|
256
|
+
readonly type: "uint256";
|
|
257
|
+
readonly name: "repayAmount";
|
|
258
|
+
}];
|
|
259
|
+
readonly outputs: readonly [{
|
|
260
|
+
readonly type: "uint256";
|
|
261
|
+
}];
|
|
262
|
+
}, {
|
|
263
|
+
readonly name: "liquidateBorrow";
|
|
264
|
+
readonly type: "function";
|
|
265
|
+
readonly stateMutability: "nonpayable";
|
|
266
|
+
readonly inputs: readonly [{
|
|
267
|
+
readonly type: "address";
|
|
268
|
+
readonly name: "borrower";
|
|
269
|
+
}, {
|
|
270
|
+
readonly type: "uint256";
|
|
271
|
+
readonly name: "repayAmount";
|
|
272
|
+
}, {
|
|
273
|
+
readonly type: "address";
|
|
274
|
+
readonly name: "pTokenCollateral";
|
|
275
|
+
}];
|
|
276
|
+
readonly outputs: readonly [{
|
|
277
|
+
readonly type: "uint256";
|
|
278
|
+
}];
|
|
279
|
+
}, {
|
|
280
|
+
readonly name: "balanceOf";
|
|
281
|
+
readonly type: "function";
|
|
282
|
+
readonly stateMutability: "view";
|
|
283
|
+
readonly inputs: readonly [{
|
|
284
|
+
readonly type: "address";
|
|
285
|
+
readonly name: "owner";
|
|
286
|
+
}];
|
|
287
|
+
readonly outputs: readonly [{
|
|
288
|
+
readonly type: "uint256";
|
|
289
|
+
}];
|
|
290
|
+
}, {
|
|
291
|
+
readonly name: "borrowBalanceStored";
|
|
292
|
+
readonly type: "function";
|
|
293
|
+
readonly stateMutability: "view";
|
|
294
|
+
readonly inputs: readonly [{
|
|
295
|
+
readonly type: "address";
|
|
296
|
+
readonly name: "account";
|
|
297
|
+
}];
|
|
298
|
+
readonly outputs: readonly [{
|
|
299
|
+
readonly type: "uint256";
|
|
300
|
+
}];
|
|
301
|
+
}, {
|
|
302
|
+
readonly name: "supplyRatePerBlock";
|
|
303
|
+
readonly type: "function";
|
|
304
|
+
readonly stateMutability: "view";
|
|
305
|
+
readonly inputs: readonly [];
|
|
306
|
+
readonly outputs: readonly [{
|
|
307
|
+
readonly type: "uint256";
|
|
308
|
+
}];
|
|
309
|
+
}, {
|
|
310
|
+
readonly name: "borrowRatePerBlock";
|
|
311
|
+
readonly type: "function";
|
|
312
|
+
readonly stateMutability: "view";
|
|
313
|
+
readonly inputs: readonly [];
|
|
314
|
+
readonly outputs: readonly [{
|
|
315
|
+
readonly type: "uint256";
|
|
316
|
+
}];
|
|
317
|
+
}, {
|
|
318
|
+
readonly name: "exchangeRateStored";
|
|
319
|
+
readonly type: "function";
|
|
320
|
+
readonly stateMutability: "view";
|
|
321
|
+
readonly inputs: readonly [];
|
|
322
|
+
readonly outputs: readonly [{
|
|
323
|
+
readonly type: "uint256";
|
|
324
|
+
}];
|
|
325
|
+
}, {
|
|
326
|
+
readonly name: "underlying";
|
|
327
|
+
readonly type: "function";
|
|
328
|
+
readonly stateMutability: "view";
|
|
329
|
+
readonly inputs: readonly [];
|
|
330
|
+
readonly outputs: readonly [{
|
|
331
|
+
readonly type: "address";
|
|
332
|
+
}];
|
|
333
|
+
}];
|
|
334
|
+
/**
|
|
335
|
+
* Minimal ABI for the Peridottroller (Compound V2-style Comptroller).
|
|
336
|
+
*/
|
|
337
|
+
declare const COMPTROLLER_ABI: readonly [{
|
|
338
|
+
readonly name: "enterMarkets";
|
|
339
|
+
readonly type: "function";
|
|
340
|
+
readonly stateMutability: "nonpayable";
|
|
341
|
+
readonly inputs: readonly [{
|
|
342
|
+
readonly type: "address[]";
|
|
343
|
+
readonly name: "pTokens";
|
|
344
|
+
}];
|
|
345
|
+
readonly outputs: readonly [{
|
|
346
|
+
readonly type: "uint256[]";
|
|
347
|
+
}];
|
|
348
|
+
}, {
|
|
349
|
+
readonly name: "exitMarket";
|
|
350
|
+
readonly type: "function";
|
|
351
|
+
readonly stateMutability: "nonpayable";
|
|
352
|
+
readonly inputs: readonly [{
|
|
353
|
+
readonly type: "address";
|
|
354
|
+
readonly name: "pTokenAddress";
|
|
355
|
+
}];
|
|
356
|
+
readonly outputs: readonly [{
|
|
357
|
+
readonly type: "uint256";
|
|
358
|
+
}];
|
|
359
|
+
}, {
|
|
360
|
+
readonly name: "getAccountLiquidity";
|
|
361
|
+
readonly type: "function";
|
|
362
|
+
readonly stateMutability: "view";
|
|
363
|
+
readonly inputs: readonly [{
|
|
364
|
+
readonly type: "address";
|
|
365
|
+
readonly name: "account";
|
|
366
|
+
}];
|
|
367
|
+
readonly outputs: readonly [{
|
|
368
|
+
readonly type: "uint256";
|
|
369
|
+
readonly name: "errorCode";
|
|
370
|
+
}, {
|
|
371
|
+
readonly type: "uint256";
|
|
372
|
+
readonly name: "liquidity";
|
|
373
|
+
}, {
|
|
374
|
+
readonly type: "uint256";
|
|
375
|
+
readonly name: "shortfall";
|
|
376
|
+
}];
|
|
377
|
+
}, {
|
|
378
|
+
readonly name: "getAllMarkets";
|
|
379
|
+
readonly type: "function";
|
|
380
|
+
readonly stateMutability: "view";
|
|
381
|
+
readonly inputs: readonly [];
|
|
382
|
+
readonly outputs: readonly [{
|
|
383
|
+
readonly type: "address[]";
|
|
384
|
+
}];
|
|
385
|
+
}, {
|
|
386
|
+
readonly name: "markets";
|
|
387
|
+
readonly type: "function";
|
|
388
|
+
readonly stateMutability: "view";
|
|
389
|
+
readonly inputs: readonly [{
|
|
390
|
+
readonly type: "address";
|
|
391
|
+
readonly name: "pToken";
|
|
392
|
+
}];
|
|
393
|
+
readonly outputs: readonly [{
|
|
394
|
+
readonly type: "bool";
|
|
395
|
+
readonly name: "isListed";
|
|
396
|
+
}, {
|
|
397
|
+
readonly type: "uint256";
|
|
398
|
+
readonly name: "collateralFactorMantissa";
|
|
399
|
+
}, {
|
|
400
|
+
readonly type: "bool";
|
|
401
|
+
readonly name: "isComped";
|
|
402
|
+
}];
|
|
403
|
+
}, {
|
|
404
|
+
readonly name: "checkMembership";
|
|
405
|
+
readonly type: "function";
|
|
406
|
+
readonly stateMutability: "view";
|
|
407
|
+
readonly inputs: readonly [{
|
|
408
|
+
readonly type: "address";
|
|
409
|
+
readonly name: "account";
|
|
410
|
+
}, {
|
|
411
|
+
readonly type: "address";
|
|
412
|
+
readonly name: "pToken";
|
|
413
|
+
}];
|
|
414
|
+
readonly outputs: readonly [{
|
|
415
|
+
readonly type: "bool";
|
|
416
|
+
}];
|
|
417
|
+
}];
|
|
418
|
+
/**
|
|
419
|
+
* Standard ERC-20 ABI subset used for approvals and balance checks.
|
|
420
|
+
*/
|
|
421
|
+
declare const ERC20_ABI: readonly [{
|
|
422
|
+
readonly name: "approve";
|
|
423
|
+
readonly type: "function";
|
|
424
|
+
readonly stateMutability: "nonpayable";
|
|
425
|
+
readonly inputs: readonly [{
|
|
426
|
+
readonly type: "address";
|
|
427
|
+
readonly name: "spender";
|
|
428
|
+
}, {
|
|
429
|
+
readonly type: "uint256";
|
|
430
|
+
readonly name: "amount";
|
|
431
|
+
}];
|
|
432
|
+
readonly outputs: readonly [{
|
|
433
|
+
readonly type: "bool";
|
|
434
|
+
}];
|
|
435
|
+
}, {
|
|
436
|
+
readonly name: "allowance";
|
|
437
|
+
readonly type: "function";
|
|
438
|
+
readonly stateMutability: "view";
|
|
439
|
+
readonly inputs: readonly [{
|
|
440
|
+
readonly type: "address";
|
|
441
|
+
readonly name: "owner";
|
|
442
|
+
}, {
|
|
443
|
+
readonly type: "address";
|
|
444
|
+
readonly name: "spender";
|
|
445
|
+
}];
|
|
446
|
+
readonly outputs: readonly [{
|
|
447
|
+
readonly type: "uint256";
|
|
448
|
+
}];
|
|
449
|
+
}, {
|
|
450
|
+
readonly name: "balanceOf";
|
|
451
|
+
readonly type: "function";
|
|
452
|
+
readonly stateMutability: "view";
|
|
453
|
+
readonly inputs: readonly [{
|
|
454
|
+
readonly type: "address";
|
|
455
|
+
readonly name: "owner";
|
|
456
|
+
}];
|
|
457
|
+
readonly outputs: readonly [{
|
|
458
|
+
readonly type: "uint256";
|
|
459
|
+
}];
|
|
460
|
+
}, {
|
|
461
|
+
readonly name: "transfer";
|
|
462
|
+
readonly type: "function";
|
|
463
|
+
readonly stateMutability: "nonpayable";
|
|
464
|
+
readonly inputs: readonly [{
|
|
465
|
+
readonly type: "address";
|
|
466
|
+
readonly name: "to";
|
|
467
|
+
}, {
|
|
468
|
+
readonly type: "uint256";
|
|
469
|
+
readonly name: "amount";
|
|
470
|
+
}];
|
|
471
|
+
readonly outputs: readonly [{
|
|
472
|
+
readonly type: "bool";
|
|
473
|
+
}];
|
|
474
|
+
}];
|
|
475
|
+
|
|
476
|
+
declare const listMarketsSchema: z.ZodObject<{
|
|
477
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
478
|
+
}, "strip", z.ZodTypeAny, {
|
|
479
|
+
chainId?: number | undefined;
|
|
480
|
+
}, {
|
|
481
|
+
chainId?: number | undefined;
|
|
482
|
+
}>;
|
|
483
|
+
type ListMarketsInput = z.infer<typeof listMarketsSchema>;
|
|
484
|
+
declare function listMarkets(input: ListMarketsInput, config: PeridotConfig): Promise<{
|
|
485
|
+
markets: MarketSummary[];
|
|
486
|
+
count: number;
|
|
487
|
+
}>;
|
|
488
|
+
|
|
489
|
+
declare const getLeaderboardSchema: z.ZodObject<{
|
|
490
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
491
|
+
chainId: z.ZodOptional<z.ZodNumber>;
|
|
492
|
+
}, "strip", z.ZodTypeAny, {
|
|
493
|
+
limit?: number | undefined;
|
|
494
|
+
chainId?: number | undefined;
|
|
495
|
+
}, {
|
|
496
|
+
limit?: number | undefined;
|
|
497
|
+
chainId?: number | undefined;
|
|
498
|
+
}>;
|
|
499
|
+
type GetLeaderboardInput = z.infer<typeof getLeaderboardSchema>;
|
|
500
|
+
declare function getLeaderboard(input: GetLeaderboardInput, config: PeridotConfig): Promise<{
|
|
501
|
+
entries: LeaderboardEntry[];
|
|
502
|
+
total: number;
|
|
503
|
+
}>;
|
|
504
|
+
|
|
505
|
+
declare const getMarketRatesSchema: z.ZodObject<{
|
|
506
|
+
asset: z.ZodString;
|
|
507
|
+
chainId: z.ZodDefault<z.ZodNumber>;
|
|
508
|
+
}, "strip", z.ZodTypeAny, {
|
|
509
|
+
chainId: number;
|
|
510
|
+
asset: string;
|
|
511
|
+
}, {
|
|
512
|
+
asset: string;
|
|
513
|
+
chainId?: number | undefined;
|
|
514
|
+
}>;
|
|
515
|
+
type GetMarketRatesInput = z.infer<typeof getMarketRatesSchema>;
|
|
516
|
+
declare function getMarketRates(input: GetMarketRatesInput, config: PeridotConfig): Promise<MarketRates>;
|
|
517
|
+
|
|
518
|
+
declare const getUserPositionSchema: z.ZodObject<{
|
|
519
|
+
address: z.ZodString;
|
|
520
|
+
}, "strip", z.ZodTypeAny, {
|
|
521
|
+
address: string;
|
|
522
|
+
}, {
|
|
523
|
+
address: string;
|
|
524
|
+
}>;
|
|
525
|
+
type GetUserPositionInput = z.infer<typeof getUserPositionSchema>;
|
|
526
|
+
declare function getUserPosition(input: GetUserPositionInput, config: PeridotConfig): Promise<UserPosition>;
|
|
527
|
+
|
|
528
|
+
declare const simulateBorrowSchema: z.ZodObject<{
|
|
529
|
+
address: z.ZodString;
|
|
530
|
+
asset: z.ZodString;
|
|
531
|
+
amount: z.ZodString;
|
|
532
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
533
|
+
}, "strip", z.ZodTypeAny, {
|
|
534
|
+
chainId: number;
|
|
535
|
+
address: string;
|
|
536
|
+
asset: string;
|
|
537
|
+
amount: string;
|
|
538
|
+
}, {
|
|
539
|
+
address: string;
|
|
540
|
+
asset: string;
|
|
541
|
+
amount: string;
|
|
542
|
+
chainId?: number | undefined;
|
|
543
|
+
}>;
|
|
544
|
+
type SimulateBorrowInput = z.infer<typeof simulateBorrowSchema>;
|
|
545
|
+
declare function simulateBorrow(input: SimulateBorrowInput, config: PeridotConfig): Promise<SimulateBorrowResult>;
|
|
546
|
+
|
|
547
|
+
declare const getAccountLiquiditySchema: z.ZodObject<{
|
|
548
|
+
address: z.ZodString;
|
|
549
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
550
|
+
}, "strip", z.ZodTypeAny, {
|
|
551
|
+
chainId: number;
|
|
552
|
+
address: string;
|
|
553
|
+
}, {
|
|
554
|
+
address: string;
|
|
555
|
+
chainId?: number | undefined;
|
|
556
|
+
}>;
|
|
557
|
+
type GetAccountLiquidityInput = z.infer<typeof getAccountLiquiditySchema>;
|
|
558
|
+
/**
|
|
559
|
+
* Reads account liquidity directly from the Peridottroller contract.
|
|
560
|
+
* Returns the precise USD liquidity (excess borrowing power) and shortfall.
|
|
561
|
+
*
|
|
562
|
+
* This is the authoritative source for liquidation risk — more accurate than
|
|
563
|
+
* the portfolio-data API which uses a simplified health factor.
|
|
564
|
+
*
|
|
565
|
+
* Requires an RPC URL for the hub chain (uses public fallback if not configured).
|
|
566
|
+
*/
|
|
567
|
+
declare function getAccountLiquidity(input: GetAccountLiquidityInput, config: PeridotConfig): Promise<AccountLiquidity>;
|
|
568
|
+
|
|
569
|
+
declare const hubSupplySchema: z.ZodObject<{
|
|
570
|
+
userAddress: z.ZodString;
|
|
571
|
+
asset: z.ZodString;
|
|
572
|
+
amount: z.ZodString;
|
|
573
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
574
|
+
enableAsCollateral: z.ZodDefault<z.ZodBoolean>;
|
|
575
|
+
}, "strip", z.ZodTypeAny, {
|
|
576
|
+
chainId: number;
|
|
577
|
+
asset: string;
|
|
578
|
+
amount: string;
|
|
579
|
+
userAddress: string;
|
|
580
|
+
enableAsCollateral: boolean;
|
|
581
|
+
}, {
|
|
582
|
+
asset: string;
|
|
583
|
+
amount: string;
|
|
584
|
+
userAddress: string;
|
|
585
|
+
chainId?: number | undefined;
|
|
586
|
+
enableAsCollateral?: boolean | undefined;
|
|
587
|
+
}>;
|
|
588
|
+
type HubSupplyInput = z.input<typeof hubSupplySchema>;
|
|
589
|
+
/**
|
|
590
|
+
* Builds the transaction calls to supply an asset to a Peridot hub-chain market.
|
|
591
|
+
*
|
|
592
|
+
* Call sequence:
|
|
593
|
+
* 1. approve(pToken, amount) — allow pToken to spend your underlying
|
|
594
|
+
* 2. mint(amount) — supply underlying, receive pTokens
|
|
595
|
+
* 3. enterMarkets([pToken]) — (optional) enable as collateral
|
|
596
|
+
*/
|
|
597
|
+
declare function buildHubSupplyIntent(input: HubSupplyInput, _config: PeridotConfig): HubTransactionIntent;
|
|
598
|
+
|
|
599
|
+
declare const hubBorrowSchema: z.ZodObject<{
|
|
600
|
+
userAddress: z.ZodString;
|
|
601
|
+
borrowAsset: z.ZodString;
|
|
602
|
+
borrowAmount: z.ZodString;
|
|
603
|
+
collateralAssets: z.ZodArray<z.ZodString, "many">;
|
|
604
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
605
|
+
}, "strip", z.ZodTypeAny, {
|
|
606
|
+
chainId: number;
|
|
607
|
+
borrowAmount: string;
|
|
608
|
+
userAddress: string;
|
|
609
|
+
borrowAsset: string;
|
|
610
|
+
collateralAssets: string[];
|
|
611
|
+
}, {
|
|
612
|
+
borrowAmount: string;
|
|
613
|
+
userAddress: string;
|
|
614
|
+
borrowAsset: string;
|
|
615
|
+
collateralAssets: string[];
|
|
616
|
+
chainId?: number | undefined;
|
|
617
|
+
}>;
|
|
618
|
+
type HubBorrowInput = z.infer<typeof hubBorrowSchema>;
|
|
619
|
+
/**
|
|
620
|
+
* Builds the transaction calls to borrow from a Peridot hub-chain market.
|
|
621
|
+
*
|
|
622
|
+
* Call sequence:
|
|
623
|
+
* 1. enterMarkets(collateralPTokens) — ensure collateral is active
|
|
624
|
+
* 2. borrow(amount) — borrow from the market
|
|
625
|
+
*
|
|
626
|
+
* Prerequisites:
|
|
627
|
+
* - Collateral must already be supplied (use build_hub_supply_intent first)
|
|
628
|
+
* - Borrow amount must not exceed borrowing capacity (use simulate_borrow first)
|
|
629
|
+
*/
|
|
630
|
+
declare function buildHubBorrowIntent(input: HubBorrowInput, _config: PeridotConfig): HubTransactionIntent;
|
|
631
|
+
|
|
632
|
+
declare const hubRepaySchema: z.ZodObject<{
|
|
633
|
+
userAddress: z.ZodString;
|
|
634
|
+
asset: z.ZodString;
|
|
635
|
+
amount: z.ZodEffects<z.ZodString, string, string>;
|
|
636
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
637
|
+
}, "strip", z.ZodTypeAny, {
|
|
638
|
+
chainId: number;
|
|
639
|
+
asset: string;
|
|
640
|
+
amount: string;
|
|
641
|
+
userAddress: string;
|
|
642
|
+
}, {
|
|
643
|
+
asset: string;
|
|
644
|
+
amount: string;
|
|
645
|
+
userAddress: string;
|
|
646
|
+
chainId?: number | undefined;
|
|
647
|
+
}>;
|
|
648
|
+
type HubRepayInput = z.infer<typeof hubRepaySchema>;
|
|
649
|
+
/**
|
|
650
|
+
* Builds the transaction calls to repay a borrow on a Peridot hub-chain market.
|
|
651
|
+
*
|
|
652
|
+
* Call sequence:
|
|
653
|
+
* 1. approve(pToken, amount) — allow pToken to pull repayment tokens
|
|
654
|
+
* 2. repayBorrow(amount) — repay outstanding debt
|
|
655
|
+
*
|
|
656
|
+
* Use amount = "max" to repay the full debt (passes uint256 max to the contract,
|
|
657
|
+
* which the pToken interprets as "repay all").
|
|
658
|
+
*/
|
|
659
|
+
declare function buildHubRepayIntent(input: HubRepayInput, _config: PeridotConfig): HubTransactionIntent;
|
|
660
|
+
|
|
661
|
+
declare const hubWithdrawSchema: z.ZodObject<{
|
|
662
|
+
userAddress: z.ZodString;
|
|
663
|
+
asset: z.ZodString;
|
|
664
|
+
amount: z.ZodString;
|
|
665
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
666
|
+
}, "strip", z.ZodTypeAny, {
|
|
667
|
+
chainId: number;
|
|
668
|
+
asset: string;
|
|
669
|
+
amount: string;
|
|
670
|
+
userAddress: string;
|
|
671
|
+
}, {
|
|
672
|
+
asset: string;
|
|
673
|
+
amount: string;
|
|
674
|
+
userAddress: string;
|
|
675
|
+
chainId?: number | undefined;
|
|
676
|
+
}>;
|
|
677
|
+
type HubWithdrawInput = z.infer<typeof hubWithdrawSchema>;
|
|
678
|
+
/**
|
|
679
|
+
* Builds the transaction call to withdraw (redeem) a supplied asset.
|
|
680
|
+
* Uses redeemUnderlying so the user specifies the exact underlying amount to receive.
|
|
681
|
+
*
|
|
682
|
+
* Will revert on-chain if the withdrawal would cause the user's health factor
|
|
683
|
+
* to drop below the liquidation threshold (i.e., they still have open borrows).
|
|
684
|
+
*/
|
|
685
|
+
declare function buildHubWithdrawIntent(input: HubWithdrawInput, _config: PeridotConfig): HubTransactionIntent;
|
|
686
|
+
|
|
687
|
+
declare const hubEnableCollateralSchema: z.ZodObject<{
|
|
688
|
+
userAddress: z.ZodString;
|
|
689
|
+
assets: z.ZodArray<z.ZodString, "many">;
|
|
690
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
691
|
+
}, "strip", z.ZodTypeAny, {
|
|
692
|
+
chainId: number;
|
|
693
|
+
assets: string[];
|
|
694
|
+
userAddress: string;
|
|
695
|
+
}, {
|
|
696
|
+
assets: string[];
|
|
697
|
+
userAddress: string;
|
|
698
|
+
chainId?: number | undefined;
|
|
699
|
+
}>;
|
|
700
|
+
type HubEnableCollateralInput = z.infer<typeof hubEnableCollateralSchema>;
|
|
701
|
+
/**
|
|
702
|
+
* Builds the enterMarkets call to enable one or more supplied assets as collateral.
|
|
703
|
+
* Must be called after supplying assets if they were not enabled during supply.
|
|
704
|
+
* Enabling collateral is required before borrowing against that asset.
|
|
705
|
+
*/
|
|
706
|
+
declare function buildHubEnableCollateralIntent(input: HubEnableCollateralInput, _config: PeridotConfig): HubTransactionIntent;
|
|
707
|
+
|
|
708
|
+
declare const hubDisableCollateralSchema: z.ZodObject<{
|
|
709
|
+
userAddress: z.ZodString;
|
|
710
|
+
asset: z.ZodString;
|
|
711
|
+
chainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
712
|
+
}, "strip", z.ZodTypeAny, {
|
|
713
|
+
chainId: number;
|
|
714
|
+
asset: string;
|
|
715
|
+
userAddress: string;
|
|
716
|
+
}, {
|
|
717
|
+
asset: string;
|
|
718
|
+
userAddress: string;
|
|
719
|
+
chainId?: number | undefined;
|
|
720
|
+
}>;
|
|
721
|
+
type HubDisableCollateralInput = z.infer<typeof hubDisableCollateralSchema>;
|
|
722
|
+
/**
|
|
723
|
+
* Builds the exitMarket call to disable a supplied asset as collateral.
|
|
724
|
+
*
|
|
725
|
+
* Will revert on-chain if disabling this collateral would make existing borrows
|
|
726
|
+
* undercollateralized. Repay borrows or add more collateral first.
|
|
727
|
+
*/
|
|
728
|
+
declare function buildHubDisableCollateralIntent(input: HubDisableCollateralInput, _config: PeridotConfig): HubTransactionIntent;
|
|
729
|
+
|
|
730
|
+
declare const crossChainSupplySchema: z.ZodObject<{
|
|
731
|
+
userAddress: z.ZodString;
|
|
732
|
+
sourceChainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
733
|
+
asset: z.ZodString;
|
|
734
|
+
amount: z.ZodString;
|
|
735
|
+
enableAsCollateral: z.ZodDefault<z.ZodBoolean>;
|
|
736
|
+
slippage: z.ZodDefault<z.ZodNumber>;
|
|
737
|
+
}, "strip", z.ZodTypeAny, {
|
|
738
|
+
asset: string;
|
|
739
|
+
amount: string;
|
|
740
|
+
userAddress: string;
|
|
741
|
+
enableAsCollateral: boolean;
|
|
742
|
+
sourceChainId: number;
|
|
743
|
+
slippage: number;
|
|
744
|
+
}, {
|
|
745
|
+
asset: string;
|
|
746
|
+
amount: string;
|
|
747
|
+
userAddress: string;
|
|
748
|
+
enableAsCollateral?: boolean | undefined;
|
|
749
|
+
sourceChainId?: number | undefined;
|
|
750
|
+
slippage?: number | undefined;
|
|
751
|
+
}>;
|
|
752
|
+
type CrossChainSupplyInput = z.input<typeof crossChainSupplySchema>;
|
|
753
|
+
/**
|
|
754
|
+
* Builds a cross-chain supply intent using Biconomy MEE.
|
|
755
|
+
*
|
|
756
|
+
* Biconomy orchestrates all steps atomically from a single user signature:
|
|
757
|
+
* 1. Bridge asset from source chain → BSC (via Axelar/Squid internally)
|
|
758
|
+
* 2. Approve p{Asset} to spend underlying on BSC
|
|
759
|
+
* 3. mint(amount) — supply to Peridot, receive pTokens
|
|
760
|
+
* 4. enterMarkets([]) — (optional) enable as collateral
|
|
761
|
+
* 5. transfer pTokens — return pTokens to user's EOA on BSC
|
|
762
|
+
*
|
|
763
|
+
* Returns a CrossChainIntent — the user's dApp must pass biconomyInstructions
|
|
764
|
+
* to POST /api/biconomy/execute (or directly to Biconomy's execute endpoint).
|
|
765
|
+
*/
|
|
766
|
+
declare function buildCrossChainSupplyIntent(input: CrossChainSupplyInput, config: PeridotConfig): Promise<CrossChainIntent>;
|
|
767
|
+
|
|
768
|
+
declare const crossChainBorrowSchema: z.ZodObject<{
|
|
769
|
+
userAddress: z.ZodString;
|
|
770
|
+
collateralAssets: z.ZodArray<z.ZodString, "many">;
|
|
771
|
+
borrowAsset: z.ZodString;
|
|
772
|
+
borrowAmount: z.ZodString;
|
|
773
|
+
targetChainId: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, number | undefined>;
|
|
774
|
+
slippage: z.ZodDefault<z.ZodNumber>;
|
|
775
|
+
}, "strip", z.ZodTypeAny, {
|
|
776
|
+
borrowAmount: string;
|
|
777
|
+
userAddress: string;
|
|
778
|
+
borrowAsset: string;
|
|
779
|
+
collateralAssets: string[];
|
|
780
|
+
slippage: number;
|
|
781
|
+
targetChainId?: number | undefined;
|
|
782
|
+
}, {
|
|
783
|
+
borrowAmount: string;
|
|
784
|
+
userAddress: string;
|
|
785
|
+
borrowAsset: string;
|
|
786
|
+
collateralAssets: string[];
|
|
787
|
+
slippage?: number | undefined;
|
|
788
|
+
targetChainId?: number | undefined;
|
|
789
|
+
}>;
|
|
790
|
+
type CrossChainBorrowInput = z.input<typeof crossChainBorrowSchema>;
|
|
791
|
+
/**
|
|
792
|
+
* Borrows from Peridot hub and optionally bridges the proceeds to a spoke chain.
|
|
793
|
+
*
|
|
794
|
+
* Call sequence (via Biconomy MEE):
|
|
795
|
+
* 1. enterMarkets(collateralPTokens) — ensure collateral is active
|
|
796
|
+
* 2. borrow(amount) — borrow from pToken market on hub
|
|
797
|
+
* 3a. Bridge borrowed tokens → target chain (if targetChainId provided), OR
|
|
798
|
+
* 3b. Transfer borrowed tokens to user's EOA on hub chain
|
|
799
|
+
*/
|
|
800
|
+
declare function buildCrossChainBorrowIntent(input: CrossChainBorrowInput, config: PeridotConfig): Promise<CrossChainIntent>;
|
|
801
|
+
|
|
802
|
+
declare const crossChainRepaySchema: z.ZodObject<{
|
|
803
|
+
userAddress: z.ZodString;
|
|
804
|
+
sourceChainId: z.ZodEffects<z.ZodDefault<z.ZodNumber>, number, number | undefined>;
|
|
805
|
+
asset: z.ZodString;
|
|
806
|
+
amount: z.ZodString;
|
|
807
|
+
repayForAddress: z.ZodOptional<z.ZodString>;
|
|
808
|
+
slippage: z.ZodDefault<z.ZodNumber>;
|
|
809
|
+
}, "strip", z.ZodTypeAny, {
|
|
810
|
+
asset: string;
|
|
811
|
+
amount: string;
|
|
812
|
+
userAddress: string;
|
|
813
|
+
sourceChainId: number;
|
|
814
|
+
slippage: number;
|
|
815
|
+
repayForAddress?: string | undefined;
|
|
816
|
+
}, {
|
|
817
|
+
asset: string;
|
|
818
|
+
amount: string;
|
|
819
|
+
userAddress: string;
|
|
820
|
+
sourceChainId?: number | undefined;
|
|
821
|
+
slippage?: number | undefined;
|
|
822
|
+
repayForAddress?: string | undefined;
|
|
823
|
+
}>;
|
|
824
|
+
type CrossChainRepayInput = z.input<typeof crossChainRepaySchema>;
|
|
825
|
+
/**
|
|
826
|
+
* Repays a Peridot borrow from a spoke chain using Biconomy MEE.
|
|
827
|
+
*
|
|
828
|
+
* Call sequence:
|
|
829
|
+
* 1. Bridge repayment tokens from source chain → BSC hub
|
|
830
|
+
* 2. Approve p{Asset} to pull repayment tokens
|
|
831
|
+
* 3. repayBorrow(amount) — or repayBorrowBehalf if repayForAddress set
|
|
832
|
+
* 4. Return any excess tokens to user's EOA on BSC
|
|
833
|
+
*/
|
|
834
|
+
declare function buildCrossChainRepayIntent(input: CrossChainRepayInput, config: PeridotConfig): Promise<CrossChainIntent>;
|
|
835
|
+
|
|
836
|
+
declare const crossChainWithdrawSchema: z.ZodObject<{
|
|
837
|
+
userAddress: z.ZodString;
|
|
838
|
+
asset: z.ZodString;
|
|
839
|
+
amount: z.ZodString;
|
|
840
|
+
targetChainId: z.ZodEffects<z.ZodOptional<z.ZodNumber>, number | undefined, number | undefined>;
|
|
841
|
+
slippage: z.ZodDefault<z.ZodNumber>;
|
|
842
|
+
}, "strip", z.ZodTypeAny, {
|
|
843
|
+
asset: string;
|
|
844
|
+
amount: string;
|
|
845
|
+
userAddress: string;
|
|
846
|
+
slippage: number;
|
|
847
|
+
targetChainId?: number | undefined;
|
|
848
|
+
}, {
|
|
849
|
+
asset: string;
|
|
850
|
+
amount: string;
|
|
851
|
+
userAddress: string;
|
|
852
|
+
slippage?: number | undefined;
|
|
853
|
+
targetChainId?: number | undefined;
|
|
854
|
+
}>;
|
|
855
|
+
type CrossChainWithdrawInput = z.input<typeof crossChainWithdrawSchema>;
|
|
856
|
+
/**
|
|
857
|
+
* Withdraws from Peridot hub and optionally bridges proceeds to a spoke chain.
|
|
858
|
+
*
|
|
859
|
+
* Call sequence (via Biconomy MEE):
|
|
860
|
+
* 1. redeemUnderlying(amount) — redeem pTokens for underlying on hub
|
|
861
|
+
* 2a. Bridge underlying → target spoke chain (if targetChainId set), OR
|
|
862
|
+
* 2b. Transfer to user's EOA on hub chain
|
|
863
|
+
*/
|
|
864
|
+
declare function buildCrossChainWithdrawIntent(input: CrossChainWithdrawInput, config: PeridotConfig): Promise<CrossChainIntent>;
|
|
865
|
+
|
|
866
|
+
declare const checkTransactionStatusSchema: z.ZodObject<{
|
|
867
|
+
superTxHash: z.ZodString;
|
|
868
|
+
}, "strip", z.ZodTypeAny, {
|
|
869
|
+
superTxHash: string;
|
|
870
|
+
}, {
|
|
871
|
+
superTxHash: string;
|
|
872
|
+
}>;
|
|
873
|
+
type CheckTransactionStatusInput = z.infer<typeof checkTransactionStatusSchema>;
|
|
874
|
+
/**
|
|
875
|
+
* Polls Biconomy for the status of a cross-chain super-transaction.
|
|
876
|
+
* Call this after the user has signed and submitted a CrossChainIntent.
|
|
877
|
+
*/
|
|
878
|
+
declare function checkTransactionStatus(input: CheckTransactionStatusInput, config: PeridotConfig): Promise<TransactionStatus>;
|
|
879
|
+
|
|
880
|
+
export { ARBITRUM_CHAIN_ID, ASSET_DECIMALS, AccountLiquidity, BASE_CHAIN_ID, BSC_MAINNET_CHAIN_ID, BSC_TESTNET_CHAIN_ID, BSC_UNDERLYING_TOKENS, BiconomyResponse, COMPTROLLER_ABI, ComposeRequest, CrossChainIntent, ERC20_ABI, ETHEREUM_CHAIN_ID, HubTransactionIntent, LeaderboardEntry, MONAD_MAINNET_CHAIN_ID, MarketRates, MarketSummary, PERIDOT_CONTROLLER, PERIDOT_MARKETS, PTOKEN_ABI, PeridotApiClient, PeridotConfig, SOMNIA_MAINNET_CHAIN_ID, SPOKE_TOKENS, SimulateBorrowResult, ToolDefinition, TransactionStatus, UserPosition, buildCrossChainBorrowIntent, buildCrossChainRepayIntent, buildCrossChainSupplyIntent, buildCrossChainWithdrawIntent, buildHubBorrowIntent, buildHubDisableCollateralIntent, buildHubEnableCollateralIntent, buildHubRepayIntent, buildHubSupplyIntent, buildHubWithdrawIntent, checkTransactionStatus, getAccountLiquidity, getAssetDecimals, getControllerAddress, getLeaderboard, getMarketRates, getPTokenAddress, getUnderlyingTokenAddress, getUserPosition, isHubChain, lendingTools, listMarkets, resolveHubChainId, simulateBorrow };
|