@coinbase/agentkit 0.0.0-nightly-20251210210514 → 0.0.0-nightly-20251212210437
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 +30 -10
- package/dist/action-providers/vaultsfyi/constants.d.ts +8 -12
- package/dist/action-providers/vaultsfyi/constants.js +47 -13
- package/dist/action-providers/vaultsfyi/schemas.d.ts +120 -65
- package/dist/action-providers/vaultsfyi/schemas.js +72 -38
- package/dist/action-providers/vaultsfyi/sdk.d.ts +8 -0
- package/dist/action-providers/vaultsfyi/sdk.js +15 -0
- package/dist/action-providers/vaultsfyi/utils.d.ts +151 -55
- package/dist/action-providers/vaultsfyi/utils.js +29 -75
- package/dist/action-providers/vaultsfyi/vaultsfyiActionProvider.d.ts +55 -16
- package/dist/action-providers/vaultsfyi/vaultsfyiActionProvider.js +413 -217
- package/dist/action-providers/vaultsfyi/vaultsfyiActionProvider.test.js +509 -316
- package/package.json +4 -3
- package/dist/action-providers/vaultsfyi/api/actions.d.ts +0 -41
- package/dist/action-providers/vaultsfyi/api/actions.js +0 -28
- package/dist/action-providers/vaultsfyi/api/historicalData.d.ts +0 -31
- package/dist/action-providers/vaultsfyi/api/historicalData.js +0 -44
- package/dist/action-providers/vaultsfyi/api/types.d.ts +0 -34
- package/dist/action-providers/vaultsfyi/api/types.js +0 -2
- package/dist/action-providers/vaultsfyi/api/vaults.d.ts +0 -66
- package/dist/action-providers/vaultsfyi/api/vaults.js +0 -57
package/README.md
CHANGED
|
@@ -575,25 +575,45 @@ const agent = createReactAgent({
|
|
|
575
575
|
<td width="768">Gets historical APY and TVL data for a specific vault over time.</td>
|
|
576
576
|
</tr>
|
|
577
577
|
<tr>
|
|
578
|
-
<td width="200"><code>
|
|
579
|
-
<td width="768">
|
|
578
|
+
<td width="200"><code>transaction_context</code></td>
|
|
579
|
+
<td width="768">Gets the available balances and operations for a given vault.</td>
|
|
580
580
|
</tr>
|
|
581
581
|
<tr>
|
|
582
|
-
<td width="200"><code>
|
|
583
|
-
<td width="768">
|
|
584
|
-
</tr>
|
|
585
|
-
<tr>
|
|
586
|
-
<td width="200"><code>claim</code></td>
|
|
587
|
-
<td width="768">Claims rewards from a vault without withdrawing the principal deposit.</td>
|
|
582
|
+
<td width="200"><code>execute_step</code></td>
|
|
583
|
+
<td width="768">Executes an operation on a given vault.</td>
|
|
588
584
|
</tr>
|
|
589
585
|
<tr>
|
|
590
|
-
<td width="200"><code>
|
|
591
|
-
<td width="768">
|
|
586
|
+
<td width="200"><code>user_idle_assets</code></td>
|
|
587
|
+
<td width="768">Gets the user's idle assets.</td>
|
|
592
588
|
</tr>
|
|
593
589
|
<tr>
|
|
594
590
|
<td width="200"><code>positions</code></td>
|
|
595
591
|
<td width="768">Gets user's current positions in vaults including balances and unclaimed rewards.</td>
|
|
596
592
|
</tr>
|
|
593
|
+
<tr>
|
|
594
|
+
<td width="200"><code>rewards_context</code></td>
|
|
595
|
+
<td width="768">Gets the available rewards for a given user.</td>
|
|
596
|
+
</tr>
|
|
597
|
+
<tr>
|
|
598
|
+
<td width="200"><code>claim_rewards</code></td>
|
|
599
|
+
<td width="768">Claims requested rewards for a given user.</td>
|
|
600
|
+
</tr>
|
|
601
|
+
<tr>
|
|
602
|
+
<td width="200"><code>benchmark_apy</code></td>
|
|
603
|
+
<td width="768">Gets the benchmark APY.</td>
|
|
604
|
+
</tr>
|
|
605
|
+
<tr>
|
|
606
|
+
<td width="200"><code>historical_benchmark_apy</code></td>
|
|
607
|
+
<td width="768">Gets the historical benchmark APY.</td>
|
|
608
|
+
</tr>
|
|
609
|
+
<tr>
|
|
610
|
+
<td width="200"><code>total_vault_returns</code></td>
|
|
611
|
+
<td width="768">Gets the total returns for a given vault.</td>
|
|
612
|
+
</tr>
|
|
613
|
+
<tr>
|
|
614
|
+
<td width="200"><code>user_events</code></td>
|
|
615
|
+
<td width="768">Gets the user's events for a given vault.</td>
|
|
616
|
+
</tr>
|
|
597
617
|
</table>
|
|
598
618
|
</details>
|
|
599
619
|
<details>
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly 130: "unichain";
|
|
10
|
-
readonly 1923: "swellchain";
|
|
11
|
-
readonly 42220: "celo";
|
|
12
|
-
};
|
|
1
|
+
export declare const SUPPORTED_CHAIN_IDS: string[];
|
|
2
|
+
/**
|
|
3
|
+
* Get the network name from a chain id
|
|
4
|
+
*
|
|
5
|
+
* @param chainId - The chain id
|
|
6
|
+
* @returns The network name
|
|
7
|
+
*/
|
|
8
|
+
export declare function getNetworkNameFromChainId(chainId: string): string | undefined;
|
|
@@ -1,15 +1,49 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
36
|
+
exports.SUPPORTED_CHAIN_IDS = void 0;
|
|
37
|
+
exports.getNetworkNameFromChainId = getNetworkNameFromChainId;
|
|
38
|
+
const sdk_1 = require("@vaultsfyi/sdk");
|
|
39
|
+
const viemChains = __importStar(require("viem/chains"));
|
|
40
|
+
exports.SUPPORTED_CHAIN_IDS = sdk_1.SUPPORTED_NETWORKS.map(network => viemChains[network]?.id.toString()).filter(id => id !== undefined);
|
|
41
|
+
/**
|
|
42
|
+
* Get the network name from a chain id
|
|
43
|
+
*
|
|
44
|
+
* @param chainId - The chain id
|
|
45
|
+
* @returns The network name
|
|
46
|
+
*/
|
|
47
|
+
function getNetworkNameFromChainId(chainId) {
|
|
48
|
+
return sdk_1.SUPPORTED_NETWORKS.find(network => viemChains[network]?.id.toString() === chainId);
|
|
49
|
+
}
|
|
@@ -3,46 +3,43 @@ import { z } from "zod";
|
|
|
3
3
|
* Vaults list action schema.
|
|
4
4
|
*/
|
|
5
5
|
export declare const VaultsActionSchema: z.ZodObject<{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
allowedAssets: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
allowedProtocols: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
8
|
+
allowedNetworks: z.ZodOptional<z.ZodArray<z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>, "many">>;
|
|
9
9
|
minTvl: z.ZodOptional<z.ZodNumber>;
|
|
10
10
|
sort: z.ZodOptional<z.ZodObject<{
|
|
11
|
-
field: z.ZodOptional<z.ZodEnum<["tvl", "
|
|
11
|
+
field: z.ZodOptional<z.ZodEnum<["tvl", "apy1day", "apy7day", "apy30day"]>>;
|
|
12
12
|
direction: z.ZodOptional<z.ZodEnum<["asc", "desc"]>>;
|
|
13
13
|
}, "strip", z.ZodTypeAny, {
|
|
14
|
-
field?: "
|
|
14
|
+
field?: "tvl" | "apy1day" | "apy7day" | "apy30day" | undefined;
|
|
15
15
|
direction?: "asc" | "desc" | undefined;
|
|
16
16
|
}, {
|
|
17
|
-
field?: "
|
|
17
|
+
field?: "tvl" | "apy1day" | "apy7day" | "apy30day" | undefined;
|
|
18
18
|
direction?: "asc" | "desc" | undefined;
|
|
19
19
|
}>>;
|
|
20
|
-
|
|
21
|
-
take: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
perPage: z.ZodOptional<z.ZodNumber>;
|
|
22
21
|
page: z.ZodOptional<z.ZodNumber>;
|
|
23
22
|
}, "strip", z.ZodTypeAny, {
|
|
24
23
|
sort?: {
|
|
25
|
-
field?: "
|
|
24
|
+
field?: "tvl" | "apy1day" | "apy7day" | "apy30day" | undefined;
|
|
26
25
|
direction?: "asc" | "desc" | undefined;
|
|
27
26
|
} | undefined;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
allowedAssets?: string[] | undefined;
|
|
28
|
+
allowedProtocols?: string[] | undefined;
|
|
29
|
+
allowedNetworks?: ("arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid")[] | undefined;
|
|
31
30
|
minTvl?: number | undefined;
|
|
32
|
-
|
|
33
|
-
take?: number | undefined;
|
|
31
|
+
perPage?: number | undefined;
|
|
34
32
|
page?: number | undefined;
|
|
35
33
|
}, {
|
|
36
34
|
sort?: {
|
|
37
|
-
field?: "
|
|
35
|
+
field?: "tvl" | "apy1day" | "apy7day" | "apy30day" | undefined;
|
|
38
36
|
direction?: "asc" | "desc" | undefined;
|
|
39
37
|
} | undefined;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
allowedAssets?: string[] | undefined;
|
|
39
|
+
allowedProtocols?: string[] | undefined;
|
|
40
|
+
allowedNetworks?: ("arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid")[] | undefined;
|
|
43
41
|
minTvl?: number | undefined;
|
|
44
|
-
|
|
45
|
-
take?: number | undefined;
|
|
42
|
+
perPage?: number | undefined;
|
|
46
43
|
page?: number | undefined;
|
|
47
44
|
}>;
|
|
48
45
|
/**
|
|
@@ -50,80 +47,138 @@ export declare const VaultsActionSchema: z.ZodObject<{
|
|
|
50
47
|
*/
|
|
51
48
|
export declare const VaultDetailsActionSchema: z.ZodObject<{
|
|
52
49
|
vaultAddress: z.ZodString;
|
|
53
|
-
network: z.ZodEnum<[
|
|
54
|
-
apyRange: z.ZodOptional<z.ZodEnum<["1day", "7day", "30day"]>>;
|
|
50
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
55
51
|
}, "strip", z.ZodTypeAny, {
|
|
56
|
-
network:
|
|
52
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
57
53
|
vaultAddress: string;
|
|
58
|
-
apyRange?: "1day" | "7day" | "30day" | undefined;
|
|
59
54
|
}, {
|
|
60
|
-
network:
|
|
55
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
61
56
|
vaultAddress: string;
|
|
62
|
-
apyRange?: "1day" | "7day" | "30day" | undefined;
|
|
63
57
|
}>;
|
|
64
58
|
export declare const VaultHistoricalDataActionSchema: z.ZodObject<{
|
|
65
59
|
vaultAddress: z.ZodString;
|
|
66
|
-
network: z.ZodEnum<[
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
61
|
+
fromDate: z.ZodString;
|
|
62
|
+
toDate: z.ZodString;
|
|
63
|
+
granularity: z.ZodEnum<["1hour", "1day", "1week"]>;
|
|
64
|
+
apyInterval: z.ZodEnum<["1day", "7day", "30day"]>;
|
|
65
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
perPage: z.ZodOptional<z.ZodNumber>;
|
|
69
67
|
}, "strip", z.ZodTypeAny, {
|
|
70
|
-
network:
|
|
71
|
-
date: string;
|
|
68
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
72
69
|
vaultAddress: string;
|
|
73
|
-
|
|
70
|
+
granularity: "1hour" | "1day" | "1week";
|
|
71
|
+
fromDate: string;
|
|
72
|
+
toDate: string;
|
|
73
|
+
apyInterval: "1day" | "7day" | "30day";
|
|
74
|
+
perPage?: number | undefined;
|
|
75
|
+
page?: number | undefined;
|
|
74
76
|
}, {
|
|
75
|
-
network:
|
|
76
|
-
date: string;
|
|
77
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
77
78
|
vaultAddress: string;
|
|
78
|
-
|
|
79
|
+
granularity: "1hour" | "1day" | "1week";
|
|
80
|
+
fromDate: string;
|
|
81
|
+
toDate: string;
|
|
82
|
+
apyInterval: "1day" | "7day" | "30day";
|
|
83
|
+
perPage?: number | undefined;
|
|
84
|
+
page?: number | undefined;
|
|
79
85
|
}>;
|
|
80
|
-
|
|
86
|
+
/**
|
|
87
|
+
* Base transaction params schema.
|
|
88
|
+
*/
|
|
89
|
+
export declare const transactionContextActionSchema: z.ZodObject<{
|
|
81
90
|
vaultAddress: z.ZodString;
|
|
82
|
-
|
|
83
|
-
network: z.ZodEnum<[string, ...string[]]>;
|
|
84
|
-
amount: z.ZodNumber;
|
|
91
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
85
92
|
}, "strip", z.ZodTypeAny, {
|
|
86
|
-
|
|
87
|
-
network: string;
|
|
93
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
88
94
|
vaultAddress: string;
|
|
89
|
-
assetAddress: string;
|
|
90
95
|
}, {
|
|
91
|
-
|
|
92
|
-
network: string;
|
|
96
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
93
97
|
vaultAddress: string;
|
|
94
|
-
assetAddress: string;
|
|
95
98
|
}>;
|
|
96
|
-
export declare const
|
|
99
|
+
export declare const executeStepActionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
97
100
|
vaultAddress: z.ZodString;
|
|
98
|
-
|
|
99
|
-
network: z.ZodEnum<[string, ...string[]]>;
|
|
100
|
-
amount: z.ZodNumber;
|
|
101
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
101
102
|
}, {
|
|
102
|
-
|
|
103
|
+
action: z.ZodEnum<["deposit", "redeem", "request-redeem", "request-deposit", "claim-redeem", "claim-deposit", "claim-rewards", "start-redeem-cooldown"]>;
|
|
104
|
+
assetAddress: z.ZodString;
|
|
105
|
+
amount: z.ZodOptional<z.ZodUnion<[z.ZodBigInt, z.ZodLiteral<"all">]>>;
|
|
103
106
|
}>, "strip", z.ZodTypeAny, {
|
|
104
|
-
|
|
105
|
-
network:
|
|
107
|
+
action: "deposit" | "redeem" | "request-redeem" | "request-deposit" | "claim-redeem" | "claim-deposit" | "claim-rewards" | "start-redeem-cooldown";
|
|
108
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
106
109
|
vaultAddress: string;
|
|
107
110
|
assetAddress: string;
|
|
108
|
-
|
|
111
|
+
amount?: bigint | "all" | undefined;
|
|
109
112
|
}, {
|
|
110
|
-
|
|
111
|
-
network:
|
|
113
|
+
action: "deposit" | "redeem" | "request-redeem" | "request-deposit" | "claim-redeem" | "claim-deposit" | "claim-rewards" | "start-redeem-cooldown";
|
|
114
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
112
115
|
vaultAddress: string;
|
|
113
116
|
assetAddress: string;
|
|
114
|
-
|
|
117
|
+
amount?: bigint | "all" | undefined;
|
|
118
|
+
}>;
|
|
119
|
+
export declare const claimRewardsActionSchema: z.ZodObject<{
|
|
120
|
+
claimIds: z.ZodArray<z.ZodString, "many">;
|
|
121
|
+
}, "strip", z.ZodTypeAny, {
|
|
122
|
+
claimIds: string[];
|
|
123
|
+
}, {
|
|
124
|
+
claimIds: string[];
|
|
115
125
|
}>;
|
|
116
|
-
export declare const
|
|
126
|
+
export declare const benchmarkActionSchema: z.ZodObject<{
|
|
127
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
128
|
+
benchmarkCode: z.ZodEnum<["eth", "usd"]>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
131
|
+
benchmarkCode: "eth" | "usd";
|
|
132
|
+
}, {
|
|
133
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
134
|
+
benchmarkCode: "eth" | "usd";
|
|
135
|
+
}>;
|
|
136
|
+
export declare const historicalBenchmarkActionSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
137
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
138
|
+
benchmarkCode: z.ZodEnum<["eth", "usd"]>;
|
|
139
|
+
}, {
|
|
140
|
+
fromDate: z.ZodString;
|
|
141
|
+
toDate: z.ZodString;
|
|
142
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
143
|
+
perPage: z.ZodOptional<z.ZodNumber>;
|
|
144
|
+
}>, "strip", z.ZodTypeAny, {
|
|
145
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
146
|
+
fromDate: string;
|
|
147
|
+
toDate: string;
|
|
148
|
+
benchmarkCode: "eth" | "usd";
|
|
149
|
+
perPage?: number | undefined;
|
|
150
|
+
page?: number | undefined;
|
|
151
|
+
}, {
|
|
152
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
153
|
+
fromDate: string;
|
|
154
|
+
toDate: string;
|
|
155
|
+
benchmarkCode: "eth" | "usd";
|
|
156
|
+
perPage?: number | undefined;
|
|
157
|
+
page?: number | undefined;
|
|
158
|
+
}>;
|
|
159
|
+
export declare const totalVaultReturnsActionSchema: z.ZodObject<{
|
|
117
160
|
vaultAddress: z.ZodString;
|
|
118
|
-
|
|
119
|
-
network: z.ZodEnum<[
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
network: string;
|
|
161
|
+
userAddress: z.ZodOptional<z.ZodString>;
|
|
162
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
123
165
|
vaultAddress: string;
|
|
124
|
-
|
|
166
|
+
userAddress?: string | undefined;
|
|
125
167
|
}, {
|
|
126
|
-
network:
|
|
168
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
127
169
|
vaultAddress: string;
|
|
128
|
-
|
|
170
|
+
userAddress?: string | undefined;
|
|
171
|
+
}>;
|
|
172
|
+
export declare const userEventsActionSchema: z.ZodObject<{
|
|
173
|
+
vaultAddress: z.ZodString;
|
|
174
|
+
userAddress: z.ZodOptional<z.ZodString>;
|
|
175
|
+
network: z.ZodEnum<["mainnet", "optimism", "arbitrum", "polygon", "gnosis", "base", "unichain", "swellchain", "celo", "worldchain", "berachain", "ink", "bsc", "hyperliquid", "plasma", "avalanche"]>;
|
|
176
|
+
}, "strip", z.ZodTypeAny, {
|
|
177
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
178
|
+
vaultAddress: string;
|
|
179
|
+
userAddress?: string | undefined;
|
|
180
|
+
}, {
|
|
181
|
+
network: "arbitrum" | "avalanche" | "base" | "berachain" | "bsc" | "celo" | "gnosis" | "ink" | "mainnet" | "optimism" | "plasma" | "polygon" | "swellchain" | "unichain" | "worldchain" | "hyperliquid";
|
|
182
|
+
vaultAddress: string;
|
|
183
|
+
userAddress?: string | undefined;
|
|
129
184
|
}>;
|
|
@@ -1,47 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.userEventsActionSchema = exports.totalVaultReturnsActionSchema = exports.historicalBenchmarkActionSchema = exports.benchmarkActionSchema = exports.claimRewardsActionSchema = exports.executeStepActionSchema = exports.transactionContextActionSchema = exports.VaultHistoricalDataActionSchema = exports.VaultDetailsActionSchema = exports.VaultsActionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
-
const
|
|
5
|
+
const sdk_1 = require("@vaultsfyi/sdk");
|
|
6
6
|
/**
|
|
7
7
|
* Action schemas for the vaultsfyi action provider.
|
|
8
8
|
*
|
|
9
9
|
* This file contains the Zod schemas that define the shape and validation
|
|
10
10
|
* rules for action parameters in the vaultsfyi action provider.
|
|
11
11
|
*/
|
|
12
|
-
const NetworkSchema = zod_1.z.enum(
|
|
12
|
+
const NetworkSchema = zod_1.z.enum(sdk_1.SUPPORTED_NETWORKS);
|
|
13
13
|
/**
|
|
14
14
|
* Vaults list action schema.
|
|
15
15
|
*/
|
|
16
16
|
exports.VaultsActionSchema = zod_1.z.object({
|
|
17
|
-
|
|
18
|
-
.string()
|
|
19
|
-
.transform(val => (val === "" ? undefined : val))
|
|
17
|
+
allowedAssets: zod_1.z
|
|
18
|
+
.array(zod_1.z.string())
|
|
20
19
|
.optional()
|
|
21
|
-
.describe("Optional:
|
|
22
|
-
|
|
23
|
-
.string()
|
|
24
|
-
.transform(val => (val === "" ? undefined : val))
|
|
20
|
+
.describe("Optional: Symbols of the assets to filter vaults by"),
|
|
21
|
+
allowedProtocols: zod_1.z
|
|
22
|
+
.array(zod_1.z.string())
|
|
25
23
|
.optional()
|
|
26
|
-
.describe("Optional:
|
|
27
|
-
|
|
24
|
+
.describe("Optional: Protocols to filter vaults by. Leave undefined to include all protocols."),
|
|
25
|
+
allowedNetworks: zod_1.z
|
|
26
|
+
.array(NetworkSchema)
|
|
28
27
|
.optional()
|
|
29
|
-
.
|
|
30
|
-
|
|
31
|
-
minTvl: zod_1.z.number().optional().describe("Optional: Minimum TVL to filter vaults by"),
|
|
28
|
+
.describe("Optional: Networks to filter vaults by. Leave undefined to include all networks."),
|
|
29
|
+
minTvl: zod_1.z.coerce.number().optional().describe("Optional: Minimum TVL to filter vaults by"),
|
|
32
30
|
sort: zod_1.z
|
|
33
31
|
.object({
|
|
34
|
-
field: zod_1.z.enum(["tvl", "
|
|
32
|
+
field: zod_1.z.enum(["tvl", "apy1day", "apy7day", "apy30day"]).optional().describe("Sort field"),
|
|
35
33
|
direction: zod_1.z.enum(["asc", "desc"]).optional().describe("Sort direction"),
|
|
36
34
|
})
|
|
37
35
|
.optional()
|
|
38
36
|
.describe("Sort options"),
|
|
39
|
-
|
|
40
|
-
.
|
|
37
|
+
perPage: zod_1.z.coerce
|
|
38
|
+
.number()
|
|
41
39
|
.optional()
|
|
42
|
-
.describe("Optional:
|
|
43
|
-
|
|
44
|
-
page: zod_1.z.number().optional().describe("Optional: Page number"),
|
|
40
|
+
.describe("Optional: Number of results per page (default: 5)"),
|
|
41
|
+
page: zod_1.z.coerce.number().optional().describe("Optional: Page number starting from 0 (default: 0)"),
|
|
45
42
|
});
|
|
46
43
|
/**
|
|
47
44
|
* Vault details action schema.
|
|
@@ -49,33 +46,70 @@ exports.VaultsActionSchema = zod_1.z.object({
|
|
|
49
46
|
exports.VaultDetailsActionSchema = zod_1.z.object({
|
|
50
47
|
vaultAddress: zod_1.z.string().describe("The address of the vault to fetch details for"),
|
|
51
48
|
network: NetworkSchema.describe("The network of the vault"),
|
|
52
|
-
apyRange: zod_1.z
|
|
53
|
-
.enum(["1day", "7day", "30day"])
|
|
54
|
-
.optional()
|
|
55
|
-
.describe("Optional: APY moving average range (default: 7day)"),
|
|
56
49
|
});
|
|
57
50
|
exports.VaultHistoricalDataActionSchema = zod_1.z.object({
|
|
58
51
|
vaultAddress: zod_1.z.string().describe("The address of the vault to fetch historical data for"),
|
|
59
52
|
network: NetworkSchema.describe("The network of the vault"),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
fromDate: zod_1.z.string().datetime().describe("The date to fetch historical data from"),
|
|
54
|
+
toDate: zod_1.z.string().datetime().describe("The date to fetch historical data to"),
|
|
55
|
+
granularity: zod_1.z.enum(["1hour", "1day", "1week"]).describe("The granularity of the data"),
|
|
56
|
+
apyInterval: zod_1.z.enum(["1day", "7day", "30day"]).describe("The interval of the apy data"),
|
|
57
|
+
page: zod_1.z.coerce.number().optional().describe("The page number to fetch"),
|
|
58
|
+
perPage: zod_1.z.coerce.number().optional().describe("The number of results per page"),
|
|
65
59
|
});
|
|
66
60
|
/**
|
|
67
61
|
* Base transaction params schema.
|
|
68
62
|
*/
|
|
69
|
-
|
|
63
|
+
exports.transactionContextActionSchema = zod_1.z.object({
|
|
70
64
|
vaultAddress: zod_1.z.string().describe("The address of the vault to interact with"),
|
|
71
|
-
assetAddress: zod_1.z.string().describe("The address of the vault's underlying token"),
|
|
72
65
|
network: NetworkSchema.describe("The network of the vault"),
|
|
73
|
-
amount: zod_1.z.number().describe("The amount of assets to use"),
|
|
74
66
|
});
|
|
75
|
-
exports.
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
exports.executeStepActionSchema = exports.transactionContextActionSchema.extend({
|
|
68
|
+
action: zod_1.z
|
|
69
|
+
.enum([
|
|
70
|
+
"deposit",
|
|
71
|
+
"redeem",
|
|
72
|
+
"request-redeem",
|
|
73
|
+
"request-deposit",
|
|
74
|
+
"claim-redeem",
|
|
75
|
+
"claim-deposit",
|
|
76
|
+
"claim-rewards",
|
|
77
|
+
"start-redeem-cooldown",
|
|
78
|
+
])
|
|
79
|
+
.describe("The action to execute"),
|
|
80
|
+
assetAddress: zod_1.z.string().describe("The address of the vault's underlying token"),
|
|
81
|
+
amount: zod_1.z.coerce
|
|
82
|
+
.bigint()
|
|
83
|
+
.or(zod_1.z.literal("all"))
|
|
84
|
+
.optional()
|
|
85
|
+
.describe("The amount of assets to use as a number with decimals"),
|
|
86
|
+
});
|
|
87
|
+
exports.claimRewardsActionSchema = zod_1.z.object({
|
|
88
|
+
claimIds: zod_1.z.array(zod_1.z.string()).describe("The ids of the rewards to claim"),
|
|
89
|
+
});
|
|
90
|
+
exports.benchmarkActionSchema = zod_1.z.object({
|
|
91
|
+
network: NetworkSchema.describe("The network to retrieve benchmark data for"),
|
|
92
|
+
benchmarkCode: zod_1.z.enum(["eth", "usd"]).describe("The benchmark code to retrieve data for"),
|
|
78
93
|
});
|
|
79
|
-
exports.
|
|
80
|
-
|
|
94
|
+
exports.historicalBenchmarkActionSchema = exports.benchmarkActionSchema.extend({
|
|
95
|
+
fromDate: zod_1.z.string().datetime().describe("The date to fetch historical data from"),
|
|
96
|
+
toDate: zod_1.z.string().datetime().describe("The date to fetch historical data to"),
|
|
97
|
+
page: zod_1.z.coerce.number().optional().describe("The page number to fetch"),
|
|
98
|
+
perPage: zod_1.z.coerce.number().optional().describe("The number of results per page"),
|
|
99
|
+
});
|
|
100
|
+
exports.totalVaultReturnsActionSchema = zod_1.z.object({
|
|
101
|
+
vaultAddress: zod_1.z.string().describe("The address of the vault to fetch total returns for"),
|
|
102
|
+
userAddress: zod_1.z
|
|
103
|
+
.string()
|
|
104
|
+
.optional()
|
|
105
|
+
.describe("The address of the user to fetch total returns for. (default: user's address)"),
|
|
106
|
+
network: NetworkSchema.describe("The network of the vault"),
|
|
107
|
+
});
|
|
108
|
+
exports.userEventsActionSchema = zod_1.z.object({
|
|
109
|
+
vaultAddress: zod_1.z.string().describe("The address of the vault to fetch user events for"),
|
|
110
|
+
userAddress: zod_1.z
|
|
111
|
+
.string()
|
|
112
|
+
.optional()
|
|
113
|
+
.describe("The address of the user to fetch user events for. (default: user's address)"),
|
|
114
|
+
network: NetworkSchema.describe("The network of the vault"),
|
|
81
115
|
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getVaultsSdk = getVaultsSdk;
|
|
4
|
+
const sdk_1 = require("@vaultsfyi/sdk");
|
|
5
|
+
/**
|
|
6
|
+
* Get the vaults.fyi SDK
|
|
7
|
+
*
|
|
8
|
+
* @param apiKey - The API key for the vaults.fyi API
|
|
9
|
+
* @returns The vaults.fyi SDK client
|
|
10
|
+
*/
|
|
11
|
+
function getVaultsSdk(apiKey) {
|
|
12
|
+
return new sdk_1.VaultsSdk({
|
|
13
|
+
apiKey,
|
|
14
|
+
});
|
|
15
|
+
}
|