@lit-protocol/vincent-ability-morpho 0.1.18-mma → 1.0.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/CHANGELOG.md +15 -0
- package/README.md +15 -15
- package/dist/CHANGELOG.md +15 -0
- package/dist/README.md +15 -15
- package/dist/package.json +2 -7
- package/dist/src/generated/lit-action.js +2 -2
- package/dist/src/generated/vincent-ability-metadata.json +1 -1
- package/dist/src/generated/vincent-bundled-ability.d.ts +10 -16
- package/dist/src/generated/vincent-bundled-ability.d.ts.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/lib/helpers/index.d.ts +26 -363
- package/dist/src/lib/helpers/index.d.ts.map +1 -1
- package/dist/src/lib/helpers/index.js +155 -983
- package/dist/src/lib/helpers/index.js.map +1 -1
- package/dist/src/lib/schemas.d.ts +11 -16
- package/dist/src/lib/schemas.d.ts.map +1 -1
- package/dist/src/lib/schemas.js +16 -14
- package/dist/src/lib/schemas.js.map +1 -1
- package/dist/src/lib/vincent-ability.d.ts +10 -16
- package/dist/src/lib/vincent-ability.d.ts.map +1 -1
- package/dist/src/lib/vincent-ability.js +98 -115
- package/dist/src/lib/vincent-ability.js.map +1 -1
- package/package.json +4 -9
- package/dist/ethers-v6-shim.js +0 -12
|
@@ -4,11 +4,9 @@
|
|
|
4
4
|
export declare const bundledVincentAbility: import("@lit-protocol/vincent-ability-sdk").BundledVincentAbility<import("@lit-protocol/vincent-ability-sdk").VincentAbility<import("zod").ZodObject<{
|
|
5
5
|
operation: import("zod").ZodNativeEnum<typeof import("..").MorphoOperation>;
|
|
6
6
|
vaultAddress: import("zod").ZodString;
|
|
7
|
-
amount: import("zod").
|
|
7
|
+
amount: import("zod").ZodString;
|
|
8
8
|
chain: import("zod").ZodString;
|
|
9
9
|
rpcUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
10
|
-
bundlerStepsLimit: import("zod").ZodDefault<import("zod").ZodNumber>;
|
|
11
|
-
skipRevertOnPermit: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
12
10
|
alchemyGasSponsor: import("zod").ZodDefault<import("zod").ZodOptional<import("zod").ZodBoolean>>;
|
|
13
11
|
alchemyGasSponsorApiKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
14
12
|
alchemyGasSponsorPolicyId: import("zod").ZodOptional<import("zod").ZodString>;
|
|
@@ -17,8 +15,6 @@ export declare const bundledVincentAbility: import("@lit-protocol/vincent-abilit
|
|
|
17
15
|
vaultAddress: string;
|
|
18
16
|
amount: string;
|
|
19
17
|
chain: string;
|
|
20
|
-
bundlerStepsLimit: number;
|
|
21
|
-
skipRevertOnPermit: boolean;
|
|
22
18
|
alchemyGasSponsor: boolean;
|
|
23
19
|
rpcUrl?: string | undefined;
|
|
24
20
|
alchemyGasSponsorApiKey?: string | undefined;
|
|
@@ -29,29 +25,21 @@ export declare const bundledVincentAbility: import("@lit-protocol/vincent-abilit
|
|
|
29
25
|
amount: string;
|
|
30
26
|
chain: string;
|
|
31
27
|
rpcUrl?: string | undefined;
|
|
32
|
-
bundlerStepsLimit?: number | undefined;
|
|
33
|
-
skipRevertOnPermit?: boolean | undefined;
|
|
34
28
|
alchemyGasSponsor?: boolean | undefined;
|
|
35
29
|
alchemyGasSponsorApiKey?: string | undefined;
|
|
36
30
|
alchemyGasSponsorPolicyId?: string | undefined;
|
|
37
31
|
}>, string, import("node_modules/@lit-protocol/vincent-ability-sdk/dist/src/lib/abilityCore/helpers").AbilityPolicyMap<readonly [], never>, {}, import("zod").ZodObject<{
|
|
38
32
|
txHash: import("zod").ZodString;
|
|
39
|
-
operation: import("zod").ZodNativeEnum<typeof import("..").MorphoOperation>;
|
|
40
33
|
vaultAddress: import("zod").ZodString;
|
|
41
34
|
amount: import("zod").ZodString;
|
|
42
|
-
timestamp: import("zod").ZodNumber;
|
|
43
35
|
}, "strip", import("zod").ZodTypeAny, {
|
|
44
|
-
operation: import("..").MorphoOperation;
|
|
45
36
|
vaultAddress: string;
|
|
46
37
|
amount: string;
|
|
47
38
|
txHash: string;
|
|
48
|
-
timestamp: number;
|
|
49
39
|
}, {
|
|
50
|
-
operation: import("..").MorphoOperation;
|
|
51
40
|
vaultAddress: string;
|
|
52
41
|
amount: string;
|
|
53
42
|
txHash: string;
|
|
54
|
-
timestamp: number;
|
|
55
43
|
}>, import("zod").ZodObject<{
|
|
56
44
|
error: import("zod").ZodString;
|
|
57
45
|
}, "strip", import("zod").ZodTypeAny, {
|
|
@@ -62,19 +50,25 @@ export declare const bundledVincentAbility: import("@lit-protocol/vincent-abilit
|
|
|
62
50
|
operationValid: import("zod").ZodBoolean;
|
|
63
51
|
vaultValid: import("zod").ZodBoolean;
|
|
64
52
|
amountValid: import("zod").ZodBoolean;
|
|
65
|
-
userBalance: import("zod").
|
|
53
|
+
userBalance: import("zod").ZodString;
|
|
54
|
+
allowance: import("zod").ZodOptional<import("zod").ZodString>;
|
|
66
55
|
vaultShares: import("zod").ZodOptional<import("zod").ZodString>;
|
|
56
|
+
estimatedGas: import("zod").ZodString;
|
|
67
57
|
}, "strip", import("zod").ZodTypeAny, {
|
|
68
58
|
operationValid: boolean;
|
|
69
59
|
vaultValid: boolean;
|
|
70
60
|
amountValid: boolean;
|
|
71
|
-
userBalance
|
|
61
|
+
userBalance: string;
|
|
62
|
+
estimatedGas: string;
|
|
63
|
+
allowance?: string | undefined;
|
|
72
64
|
vaultShares?: string | undefined;
|
|
73
65
|
}, {
|
|
74
66
|
operationValid: boolean;
|
|
75
67
|
vaultValid: boolean;
|
|
76
68
|
amountValid: boolean;
|
|
77
|
-
userBalance
|
|
69
|
+
userBalance: string;
|
|
70
|
+
estimatedGas: string;
|
|
71
|
+
allowance?: string | undefined;
|
|
78
72
|
vaultShares?: string | undefined;
|
|
79
73
|
}>, import("zod").ZodObject<{
|
|
80
74
|
error: import("zod").ZodString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vincent-bundled-ability.d.ts","sourceRoot":"","sources":["../../../src/generated/vincent-bundled-ability.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"vincent-bundled-ability.d.ts","sourceRoot":"","sources":["../../../src/generated/vincent-bundled-ability.ts"],"names":[],"mappings":"AAAA;;GAEG;AAUH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAA4D,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import '../ethers-v6-shim.js';
|
|
2
1
|
export { bundledVincentAbility } from './generated/vincent-bundled-ability';
|
|
3
2
|
export { MorphoOperation } from './lib/schemas';
|
|
3
|
+
export { getMorphoVaultByAddress, type MorphoVaultInfo } from './lib/helpers';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,uBAAuB,EAAE,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MorphoOperation = exports.bundledVincentAbility = void 0;
|
|
4
|
-
require("../ethers-v6-shim.js");
|
|
3
|
+
exports.getMorphoVaultByAddress = exports.MorphoOperation = exports.bundledVincentAbility = void 0;
|
|
5
4
|
var vincent_bundled_ability_1 = require("./generated/vincent-bundled-ability");
|
|
6
5
|
Object.defineProperty(exports, "bundledVincentAbility", { enumerable: true, get: function () { return vincent_bundled_ability_1.bundledVincentAbility; } });
|
|
7
6
|
var schemas_1 = require("./lib/schemas");
|
|
8
7
|
Object.defineProperty(exports, "MorphoOperation", { enumerable: true, get: function () { return schemas_1.MorphoOperation; } });
|
|
8
|
+
var helpers_1 = require("./lib/helpers");
|
|
9
|
+
Object.defineProperty(exports, "getMorphoVaultByAddress", { enumerable: true, get: function () { return helpers_1.getMorphoVaultByAddress; } });
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,+EAA4E;AAAnE,gIAAA,qBAAqB,OAAA;AAC9B,yCAAgD;AAAvC,0GAAA,eAAe,OAAA;AACxB,yCAA8E;AAArE,kHAAA,uBAAuB,OAAA"}
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { ethers } from 'ethers';
|
|
2
|
-
|
|
2
|
+
import { MorphoOperation } from '../schemas';
|
|
3
|
+
interface PKPInfo {
|
|
4
|
+
tokenId: string;
|
|
5
|
+
ethAddress: string;
|
|
6
|
+
publicKey: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Supported chain IDs and their names
|
|
10
|
+
*/
|
|
11
|
+
export declare const SUPPORTED_CHAINS: {
|
|
12
|
+
readonly 1: "ethereum";
|
|
13
|
+
readonly 8453: "base";
|
|
14
|
+
readonly 42161: "arbitrum";
|
|
15
|
+
readonly 10: "optimism";
|
|
16
|
+
readonly 137: "polygon";
|
|
17
|
+
};
|
|
3
18
|
/**
|
|
4
19
|
* Chain names to IDs mapping for backwards compatibility
|
|
5
20
|
*/
|
|
@@ -10,103 +25,18 @@ export declare const CHAIN_IDS: {
|
|
|
10
25
|
readonly optimism: 10;
|
|
11
26
|
readonly polygon: 137;
|
|
12
27
|
};
|
|
13
|
-
/**
|
|
14
|
-
* Supported chain IDs and their names
|
|
15
|
-
*/
|
|
16
|
-
export declare const SUPPORTED_CHAINS: Record<ValueOf<typeof CHAIN_IDS>, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Well-known token addresses across different chains
|
|
19
|
-
* Using official Circle USDC and canonical WETH addresses
|
|
20
|
-
*/
|
|
21
|
-
export declare const WELL_KNOWN_TOKENS: Record<ValueOf<typeof CHAIN_IDS>, any>;
|
|
22
|
-
/**
|
|
23
|
-
* ERC4626 Vault ABI - Essential methods for Morpho vaults
|
|
24
|
-
*/
|
|
25
|
-
export declare const ERC4626_VAULT_ABI: any[];
|
|
26
28
|
/**
|
|
27
29
|
* ERC20 Token ABI - Essential methods only
|
|
28
30
|
*/
|
|
29
31
|
export declare const ERC20_ABI: any[];
|
|
30
|
-
export declare const BUNDLER_ABI: any[];
|
|
31
|
-
export declare const BUNDLER_ADDRESSES: {
|
|
32
|
-
readonly 1: "0x6566194141eefa99Af43Bb5Aa71460Ca2Dc90245";
|
|
33
|
-
readonly 8453: "0x6BFd8137e702540E7A42B74178A4a49Ba43920C4";
|
|
34
|
-
readonly 42161: "0x1FA4431bC113D308beE1d46B0e98Cb805FB48C13";
|
|
35
|
-
readonly 10: "0xFBCd3C258feB131D8E038F2A3a670A7bE0507C05";
|
|
36
|
-
readonly 137: "0x2d9C3A9E67c966C711208cc78b34fB9E9f8db589";
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Supported chain type
|
|
40
|
-
*/
|
|
41
|
-
export type SupportedChainId = keyof typeof WELL_KNOWN_TOKENS;
|
|
42
|
-
export type SupportedChainName = keyof typeof CHAIN_IDS;
|
|
43
32
|
/**
|
|
44
|
-
*
|
|
45
|
-
*/
|
|
46
|
-
export type TokenSymbol = 'USDC' | 'WETH' | 'USDT';
|
|
47
|
-
/**
|
|
48
|
-
* Supported sorting fields for vault queries
|
|
49
|
-
*/
|
|
50
|
-
export type VaultSortBy = 'netApy' | 'totalAssets' | 'totalAssetsUsd' | 'creationTimestamp';
|
|
51
|
-
/**
|
|
52
|
-
* Sort order options
|
|
53
|
-
*/
|
|
54
|
-
export type SortOrder = 'asc' | 'desc';
|
|
55
|
-
/**
|
|
56
|
-
* Chain identifier (can be chain ID number or chain name string)
|
|
57
|
-
*/
|
|
58
|
-
export type ChainIdentifier = number | string;
|
|
59
|
-
/**
|
|
60
|
-
* Common vault filtering presets for quick searches
|
|
61
|
-
*/
|
|
62
|
-
export type VaultFilterPresets = {
|
|
63
|
-
/** Find high-yield vaults across all chains */
|
|
64
|
-
highYield: VaultFilterOptions;
|
|
65
|
-
/** Find stable, low-risk vaults */
|
|
66
|
-
stable: VaultFilterOptions;
|
|
67
|
-
/** Find vaults with high TVL */
|
|
68
|
-
highTvl: VaultFilterOptions;
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Pre-configured filter presets for common use cases
|
|
72
|
-
*/
|
|
73
|
-
export declare const VAULT_FILTER_PRESETS: VaultFilterPresets;
|
|
74
|
-
/**
|
|
75
|
-
* Get well-known token addresses for a specific chain
|
|
76
|
-
*/
|
|
77
|
-
export declare function getTokenAddresses(chainId: number): any;
|
|
78
|
-
/**
|
|
79
|
-
* Get token address for a specific token symbol and chain
|
|
80
|
-
*/
|
|
81
|
-
export declare function getTokenAddress(symbol: string, chainId: number): string;
|
|
82
|
-
/**
|
|
83
|
-
* Check if a chain is supported by Morpho
|
|
84
|
-
*/
|
|
85
|
-
export declare function isSupportedChain(chainId: number): boolean;
|
|
86
|
-
/**
|
|
87
|
-
* Get all supported chain IDs
|
|
88
|
-
*/
|
|
89
|
-
export declare function getSupportedChainIds(): number[];
|
|
90
|
-
/**
|
|
91
|
-
* Get chain name from chain ID
|
|
92
|
-
*/
|
|
93
|
-
export declare function getChainName(chainId: number): string;
|
|
94
|
-
/**
|
|
95
|
-
* Utility function to validate Ethereum address
|
|
96
|
-
*/
|
|
97
|
-
export declare function isValidAddress(address: string): boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Utility function to parse amount with decimals
|
|
100
|
-
*/
|
|
101
|
-
export declare function parseAmount(amount: string, decimals?: number): string;
|
|
102
|
-
/**
|
|
103
|
-
* Utility function to format amount from wei
|
|
33
|
+
* ERC4626 Vault ABI - Essential methods for Morpho vaults
|
|
104
34
|
*/
|
|
105
|
-
export declare
|
|
35
|
+
export declare const ERC4626_VAULT_ABI: any[];
|
|
106
36
|
/**
|
|
107
37
|
* Validate operation-specific requirements for Morpho vaults
|
|
108
38
|
*/
|
|
109
|
-
export declare function validateOperationRequirements(operation:
|
|
39
|
+
export declare function validateOperationRequirements(operation: MorphoOperation, userBalance: ethers.BigNumber, allowance: ethers.BigNumber, vaultShares: ethers.BigNumber, amount: ethers.BigNumber): Promise<{
|
|
110
40
|
valid: boolean;
|
|
111
41
|
error?: string;
|
|
112
42
|
}>;
|
|
@@ -179,292 +109,25 @@ export interface MorphoVaultInfo {
|
|
|
179
109
|
whitelisted: boolean;
|
|
180
110
|
/** Vault creation timestamp */
|
|
181
111
|
creationTimestamp: number;
|
|
182
|
-
/** Whether vault has low activity (< $100 TVL) */
|
|
183
|
-
isIdle?: boolean;
|
|
184
|
-
}
|
|
185
|
-
/**
|
|
186
|
-
* Unified Vault Filter Options for the getVaults() function
|
|
187
|
-
*
|
|
188
|
-
* Supports comprehensive filtering by asset, chain, performance metrics, and more.
|
|
189
|
-
* All filters use server-side GraphQL queries for optimal performance.
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* ```typescript
|
|
193
|
-
* // Find high-yield USDC vaults on Base
|
|
194
|
-
* const vaults = await getVaults({
|
|
195
|
-
* assetSymbol: "USDC",
|
|
196
|
-
* chainId: 8453,
|
|
197
|
-
* minNetApy: 0.05,
|
|
198
|
-
* sortBy: "netApy",
|
|
199
|
-
* sortOrder: "desc",
|
|
200
|
-
* limit: 10
|
|
201
|
-
* });
|
|
202
|
-
* ```
|
|
203
|
-
*/
|
|
204
|
-
export interface VaultFilterOptions {
|
|
205
|
-
/** Filter by token symbol (e.g., "USDC", "WETH", "USDT") */
|
|
206
|
-
assetSymbol?: TokenSymbol | string;
|
|
207
|
-
/** Filter by specific token contract address */
|
|
208
|
-
assetAddress?: string;
|
|
209
|
-
/** Chain identifier - supports chain name or ID */
|
|
210
|
-
chain?: string | number;
|
|
211
|
-
/** Specific chain ID (1=Ethereum, 8453=Base, 42161=Arbitrum, etc.) */
|
|
212
|
-
chainId?: number;
|
|
213
|
-
/** Minimum Net APY percentage (after fees) */
|
|
214
|
-
minNetApy?: number;
|
|
215
|
-
/** Maximum Net APY percentage (after fees) */
|
|
216
|
-
maxNetApy?: number;
|
|
217
|
-
/** Minimum total assets in vault (in token units) */
|
|
218
|
-
minTotalAssets?: number;
|
|
219
|
-
/** Maximum total assets in vault (in token units) */
|
|
220
|
-
maxTotalAssets?: number;
|
|
221
|
-
/** Minimum Total Value Locked in USD */
|
|
222
|
-
minTvl?: number;
|
|
223
|
-
/** Maximum Total Value Locked in USD */
|
|
224
|
-
maxTvl?: number;
|
|
225
|
-
/** Only include whitelisted vaults */
|
|
226
|
-
whitelistedOnly?: boolean;
|
|
227
|
-
/** Exclude low-activity vaults (< $100 TVL) */
|
|
228
|
-
excludeIdle?: boolean;
|
|
229
|
-
/** Field to sort results by */
|
|
230
|
-
sortBy?: VaultSortBy;
|
|
231
|
-
/** Sort order: ascending or descending */
|
|
232
|
-
sortOrder?: SortOrder;
|
|
233
|
-
/** Maximum number of results to return */
|
|
234
|
-
limit?: number;
|
|
235
112
|
}
|
|
236
113
|
/**
|
|
237
|
-
*
|
|
238
|
-
*/
|
|
239
|
-
export interface VaultSearchOptions {
|
|
240
|
-
query?: string;
|
|
241
|
-
chains?: Array<string | number>;
|
|
242
|
-
limit?: number;
|
|
243
|
-
offset?: number;
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Morpho GraphQL API Client
|
|
247
|
-
*/
|
|
248
|
-
export declare class MorphoVaultClient {
|
|
249
|
-
private readonly apiUrl;
|
|
250
|
-
/**
|
|
251
|
-
* Fetch vault data from Morpho GraphQL API
|
|
252
|
-
*/
|
|
253
|
-
private fetchVaultData;
|
|
254
|
-
/**
|
|
255
|
-
* Get all vaults with comprehensive information
|
|
256
|
-
* Now uses proper server-side filtering via GraphQL VaultFilters
|
|
257
|
-
*/
|
|
258
|
-
getAllVaults(options?: VaultFilterOptions): Promise<MorphoVaultInfo[]>;
|
|
259
|
-
/**
|
|
260
|
-
* Unified function to get vaults with flexible filtering
|
|
261
|
-
* Supports filtering by asset, chain, and all other options
|
|
262
|
-
*/
|
|
263
|
-
getVaults(options?: VaultFilterOptions): Promise<MorphoVaultInfo[]>;
|
|
264
|
-
/**
|
|
265
|
-
* Get top vaults by APY
|
|
266
|
-
*/
|
|
267
|
-
getTopVaultsByNetApy(limit?: number, minTvl?: number): Promise<MorphoVaultInfo[]>;
|
|
268
|
-
/**
|
|
269
|
-
* Get top vaults by TVL
|
|
270
|
-
*/
|
|
271
|
-
getTopVaultsByTvl(limit?: number): Promise<MorphoVaultInfo[]>;
|
|
272
|
-
/**
|
|
273
|
-
* Search vaults by name, symbol, or asset
|
|
274
|
-
*/
|
|
275
|
-
searchVaults(searchOptions: VaultSearchOptions): Promise<MorphoVaultInfo[]>;
|
|
276
|
-
/**
|
|
277
|
-
* Get vault details by address
|
|
278
|
-
*/
|
|
279
|
-
getVaultByAddress(address: string, chainId: number): Promise<MorphoVaultInfo | null>;
|
|
280
|
-
/**
|
|
281
|
-
* Get best vaults for a specific asset
|
|
282
|
-
*/
|
|
283
|
-
getBestVaultsForAsset(assetSymbol: string, limit?: number): Promise<MorphoVaultInfo[]>;
|
|
284
|
-
/**
|
|
285
|
-
* Map vault data from GraphQL response
|
|
286
|
-
*/
|
|
287
|
-
private mapVaultData;
|
|
288
|
-
/**
|
|
289
|
-
* Build GraphQL VaultFilters from filter options
|
|
290
|
-
* Uses proper server-side filtering for better performance
|
|
291
|
-
*/
|
|
292
|
-
private buildVaultFilters;
|
|
293
|
-
/**
|
|
294
|
-
* Apply remaining client-side filters not supported by GraphQL
|
|
295
|
-
* Only handles computed properties like isIdle
|
|
296
|
-
*/
|
|
297
|
-
private applyRemainingClientFilters;
|
|
298
|
-
/**
|
|
299
|
-
* Map sortBy option to GraphQL enum
|
|
300
|
-
*/
|
|
301
|
-
private mapSortBy;
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Create a singleton instance of MorphoVaultClient
|
|
305
|
-
*/
|
|
306
|
-
export declare const morphoVaultClient: MorphoVaultClient;
|
|
307
|
-
/**
|
|
308
|
-
* Helper function to get best vaults for a specific asset
|
|
309
|
-
*/
|
|
310
|
-
export declare function getBestVaultsForAsset(assetSymbol: string, limit?: number): Promise<MorphoVaultInfo[]>;
|
|
311
|
-
/**
|
|
312
|
-
* Helper function to get top vaults by APY
|
|
114
|
+
* Get Morpho vault details using their graphql api
|
|
313
115
|
*/
|
|
314
|
-
export declare function
|
|
315
|
-
/**
|
|
316
|
-
* Helper function to get top vaults by TVL
|
|
317
|
-
*/
|
|
318
|
-
export declare function getTopVaultsByTvl(limit?: number): Promise<MorphoVaultInfo[]>;
|
|
319
|
-
/**
|
|
320
|
-
* Helper function to search vaults
|
|
321
|
-
*/
|
|
322
|
-
export declare function searchVaults(query: string, limit?: number): Promise<MorphoVaultInfo[]>;
|
|
323
|
-
/**
|
|
324
|
-
* 🚀 **Quick Vault Search with Presets**
|
|
325
|
-
*
|
|
326
|
-
* Get vaults using pre-configured filter presets for common use cases.
|
|
327
|
-
*
|
|
328
|
-
* @param preset - Pre-configured filter preset
|
|
329
|
-
* @param overrides - Additional options to override preset defaults
|
|
330
|
-
* @returns Promise resolving to array of vault information
|
|
331
|
-
*
|
|
332
|
-
* @example
|
|
333
|
-
* ```typescript
|
|
334
|
-
* // Find high-yield vaults
|
|
335
|
-
* const highYieldVaults = await getVaultsByPreset("highYield");
|
|
336
|
-
*
|
|
337
|
-
* // Find high-yield USDC vaults specifically
|
|
338
|
-
* const usdcHighYield = await getVaultsByPreset("highYield", {
|
|
339
|
-
* assetSymbol: "USDC"
|
|
340
|
-
* });
|
|
341
|
-
*
|
|
342
|
-
* // Find stable vaults on Base chain
|
|
343
|
-
* const stableBaseVaults = await getVaultsByPreset("stable", {
|
|
344
|
-
* chainId: 8453
|
|
345
|
-
* });
|
|
346
|
-
* ```
|
|
347
|
-
*/
|
|
348
|
-
export declare function getVaultsByPreset(preset: keyof VaultFilterPresets, overrides?: Partial<VaultFilterOptions>): Promise<MorphoVaultInfo[]>;
|
|
349
|
-
/**
|
|
350
|
-
* 🔍 **Primary Vault Discovery Function**
|
|
351
|
-
*
|
|
352
|
-
* Get Morpho vaults with comprehensive filtering and sorting options.
|
|
353
|
-
* Uses server-side GraphQL queries for optimal performance.
|
|
354
|
-
*
|
|
355
|
-
* @param options - Vault filtering and sorting options
|
|
356
|
-
* @returns Promise resolving to array of vault information
|
|
357
|
-
*
|
|
358
|
-
* @example
|
|
359
|
-
* ```typescript
|
|
360
|
-
* // Find best USDC vaults across all chains
|
|
361
|
-
* const topVaults = await getVaults({
|
|
362
|
-
* assetSymbol: "USDC",
|
|
363
|
-
* minNetApy: 0.05,
|
|
364
|
-
* minTvl: 1000000,
|
|
365
|
-
* sortBy: "netApy",
|
|
366
|
-
* sortOrder: "desc",
|
|
367
|
-
* limit: 5
|
|
368
|
-
* });
|
|
369
|
-
*
|
|
370
|
-
* // Filter by specific chain
|
|
371
|
-
* const baseVaults = await getVaults({
|
|
372
|
-
* chainId: 8453, // Base
|
|
373
|
-
* excludeIdle: true,
|
|
374
|
-
* sortBy: "totalAssetsUsd"
|
|
375
|
-
* });
|
|
376
|
-
*
|
|
377
|
-
* // Search with multiple criteria
|
|
378
|
-
* const premiumVaults = await getVaults({
|
|
379
|
-
* minNetApy: 10.0,
|
|
380
|
-
* minTvl: 5000000,
|
|
381
|
-
* whitelistedOnly: true,
|
|
382
|
-
* sortBy: "netApy",
|
|
383
|
-
* limit: 3
|
|
384
|
-
* });
|
|
385
|
-
* ```
|
|
386
|
-
*/
|
|
387
|
-
export declare function getVaults(options?: VaultFilterOptions): Promise<MorphoVaultInfo[]>;
|
|
388
|
-
/**
|
|
389
|
-
* Get supported chains with active vaults
|
|
390
|
-
*/
|
|
391
|
-
export declare function getSupportedChainsWithVaults(): Promise<{
|
|
392
|
-
chainId: number;
|
|
393
|
-
name: string;
|
|
394
|
-
vaultCount: number;
|
|
395
|
-
}[]>;
|
|
396
|
-
/**
|
|
397
|
-
* Get vault discovery summary for a chain
|
|
398
|
-
*/
|
|
399
|
-
export declare function getVaultDiscoverySummary(chainId: number): Promise<{
|
|
400
|
-
chainId: number;
|
|
401
|
-
chainName: string;
|
|
402
|
-
totalVaults: number;
|
|
403
|
-
totalTvl: number;
|
|
404
|
-
topVaultsByTvl: MorphoVaultInfo[];
|
|
405
|
-
topVaultsByNetApy: MorphoVaultInfo[];
|
|
406
|
-
assetBreakdown: {
|
|
407
|
-
count: number;
|
|
408
|
-
totalTvl: number;
|
|
409
|
-
maxNetApy: number;
|
|
410
|
-
symbol: string;
|
|
411
|
-
}[];
|
|
412
|
-
}>;
|
|
413
|
-
export declare function normalizeLitSig(parsed: {
|
|
414
|
-
r: string;
|
|
415
|
-
s: string;
|
|
416
|
-
v: number;
|
|
417
|
-
}): {
|
|
418
|
-
r: string;
|
|
419
|
-
s: string;
|
|
420
|
-
v: number;
|
|
421
|
-
};
|
|
422
|
-
export declare function buildDepositTxData({ bundlerStepsLimit, skipRevertOnPermit, amount, pkpAddress, pkpPublicKey, provider, tokenAddress, vaultAddress, }: {
|
|
423
|
-
bundlerStepsLimit: number;
|
|
424
|
-
skipRevertOnPermit: boolean;
|
|
425
|
-
amount: string;
|
|
426
|
-
pkpAddress: string;
|
|
427
|
-
pkpPublicKey: string;
|
|
428
|
-
provider: ethers.providers.Provider;
|
|
429
|
-
tokenAddress: string;
|
|
430
|
-
vaultAddress: string;
|
|
431
|
-
}): Promise<{
|
|
432
|
-
abi: any;
|
|
433
|
-
args: any[];
|
|
434
|
-
functionName: string;
|
|
435
|
-
data: string;
|
|
436
|
-
to: string;
|
|
437
|
-
value: string;
|
|
438
|
-
}>;
|
|
439
|
-
export declare function buildRedeemTxData({ bundlerStepsLimit, amount, pkpAddress, provider, vaultAddress, }: {
|
|
440
|
-
bundlerStepsLimit: number;
|
|
441
|
-
amount: string;
|
|
442
|
-
pkpAddress: string;
|
|
443
|
-
provider: ethers.providers.Provider;
|
|
444
|
-
vaultAddress: string;
|
|
445
|
-
}): Promise<{
|
|
446
|
-
abi: any;
|
|
447
|
-
args: any[];
|
|
448
|
-
functionName: string;
|
|
449
|
-
data: string;
|
|
450
|
-
to: string;
|
|
451
|
-
value: string;
|
|
452
|
-
}>;
|
|
116
|
+
export declare function getMorphoVaultByAddress(address: string, chainId: number): Promise<MorphoVaultInfo | null>;
|
|
453
117
|
/**
|
|
454
118
|
* Generic function to execute any Morpho operation, with optional gas sponsorship
|
|
455
119
|
*/
|
|
456
|
-
export declare function
|
|
457
|
-
abi: any;
|
|
120
|
+
export declare function executeMorphoOperation({ abi, args, alchemyGasSponsor, alchemyGasSponsorApiKey, alchemyGasSponsorPolicyId, contractAddress, chainId, functionName, provider, pkpInfo, }: {
|
|
121
|
+
abi: any[];
|
|
458
122
|
alchemyGasSponsor?: boolean;
|
|
459
123
|
alchemyGasSponsorApiKey?: string;
|
|
460
124
|
alchemyGasSponsorPolicyId?: string;
|
|
461
|
-
args:
|
|
125
|
+
args: unknown[];
|
|
462
126
|
chainId: number;
|
|
463
127
|
contractAddress: string;
|
|
464
|
-
provider?: any;
|
|
465
|
-
pkpEthAddress: string;
|
|
466
|
-
pkpPublicKey: string;
|
|
467
128
|
functionName: string;
|
|
129
|
+
pkpInfo: PKPInfo;
|
|
130
|
+
provider?: ethers.providers.JsonRpcProvider;
|
|
468
131
|
}): Promise<string>;
|
|
469
132
|
export {};
|
|
470
133
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/helpers/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/lib/helpers/index.ts"],"names":[],"mappings":"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"}
|