@compass-labs/api-sdk 0.0.28 → 0.0.30
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/FUNCTIONS.md +4 -3
- package/README.md +23 -13
- package/bin/mcp-server.js +1048 -570
- package/bin/mcp-server.js.map +19 -11
- package/dist/commonjs/funcs/aaveV3AvgRate.d.ts +18 -0
- package/dist/commonjs/funcs/aaveV3AvgRate.d.ts.map +1 -0
- package/dist/commonjs/funcs/aaveV3AvgRate.js +122 -0
- package/dist/commonjs/funcs/aaveV3AvgRate.js.map +1 -0
- package/dist/commonjs/funcs/aaveV3StdRate.d.ts +18 -0
- package/dist/commonjs/funcs/aaveV3StdRate.d.ts.map +1 -0
- package/dist/commonjs/funcs/aaveV3StdRate.js +122 -0
- package/dist/commonjs/funcs/aaveV3StdRate.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/mcp-server/mcp-server.js +1 -1
- package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/server.js +5 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/aaveV3AvgRate.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/aaveV3AvgRate.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/aaveV3AvgRate.js +64 -0
- package/dist/commonjs/mcp-server/tools/aaveV3AvgRate.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/aaveV3StdRate.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/aaveV3StdRate.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/aaveV3StdRate.js +64 -0
- package/dist/commonjs/mcp-server/tools/aaveV3StdRate.js.map +1 -0
- package/dist/commonjs/models/components/aaveavgrateresponse.d.ts +57 -0
- package/dist/commonjs/models/components/aaveavgrateresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/aaveavgrateresponse.js +98 -0
- package/dist/commonjs/models/components/aaveavgrateresponse.js.map +1 -0
- package/dist/commonjs/models/components/aavestdrateresponse.d.ts +57 -0
- package/dist/commonjs/models/components/aavestdrateresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/aavestdrateresponse.js +98 -0
- package/dist/commonjs/models/components/aavestdrateresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +2 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +2 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/aaveavgrate.d.ts +244 -0
- package/dist/commonjs/models/operations/aaveavgrate.d.ts.map +1 -0
- package/dist/commonjs/models/operations/aaveavgrate.js +165 -0
- package/dist/commonjs/models/operations/aaveavgrate.js.map +1 -0
- package/dist/commonjs/models/operations/aavestdrate.d.ts +244 -0
- package/dist/commonjs/models/operations/aavestdrate.d.ts.map +1 -0
- package/dist/commonjs/models/operations/aavestdrate.js +165 -0
- package/dist/commonjs/models/operations/aavestdrate.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +2 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +2 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/sdk/aavev3.d.ts +14 -0
- package/dist/commonjs/sdk/aavev3.d.ts.map +1 -1
- package/dist/commonjs/sdk/aavev3.js +20 -0
- package/dist/commonjs/sdk/aavev3.js.map +1 -1
- package/dist/esm/funcs/aaveV3AvgRate.d.ts +18 -0
- package/dist/esm/funcs/aaveV3AvgRate.d.ts.map +1 -0
- package/dist/esm/funcs/aaveV3AvgRate.js +86 -0
- package/dist/esm/funcs/aaveV3AvgRate.js.map +1 -0
- package/dist/esm/funcs/aaveV3StdRate.d.ts +18 -0
- package/dist/esm/funcs/aaveV3StdRate.d.ts.map +1 -0
- package/dist/esm/funcs/aaveV3StdRate.js +86 -0
- package/dist/esm/funcs/aaveV3StdRate.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/mcp-server/mcp-server.js +1 -1
- package/dist/esm/mcp-server/server.d.ts.map +1 -1
- package/dist/esm/mcp-server/server.js +5 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/aaveV3AvgRate.d.ts +8 -0
- package/dist/esm/mcp-server/tools/aaveV3AvgRate.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/aaveV3AvgRate.js +28 -0
- package/dist/esm/mcp-server/tools/aaveV3AvgRate.js.map +1 -0
- package/dist/esm/mcp-server/tools/aaveV3StdRate.d.ts +8 -0
- package/dist/esm/mcp-server/tools/aaveV3StdRate.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/aaveV3StdRate.js +28 -0
- package/dist/esm/mcp-server/tools/aaveV3StdRate.js.map +1 -0
- package/dist/esm/models/components/aaveavgrateresponse.d.ts +57 -0
- package/dist/esm/models/components/aaveavgrateresponse.d.ts.map +1 -0
- package/dist/esm/models/components/aaveavgrateresponse.js +60 -0
- package/dist/esm/models/components/aaveavgrateresponse.js.map +1 -0
- package/dist/esm/models/components/aavestdrateresponse.d.ts +57 -0
- package/dist/esm/models/components/aavestdrateresponse.d.ts.map +1 -0
- package/dist/esm/models/components/aavestdrateresponse.js +60 -0
- package/dist/esm/models/components/aavestdrateresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +2 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +2 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/aaveavgrate.d.ts +244 -0
- package/dist/esm/models/operations/aaveavgrate.d.ts.map +1 -0
- package/dist/esm/models/operations/aaveavgrate.js +127 -0
- package/dist/esm/models/operations/aaveavgrate.js.map +1 -0
- package/dist/esm/models/operations/aavestdrate.d.ts +244 -0
- package/dist/esm/models/operations/aavestdrate.d.ts.map +1 -0
- package/dist/esm/models/operations/aavestdrate.js +127 -0
- package/dist/esm/models/operations/aavestdrate.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +2 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +2 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/sdk/aavev3.d.ts +14 -0
- package/dist/esm/sdk/aavev3.d.ts.map +1 -1
- package/dist/esm/sdk/aavev3.js +20 -0
- package/dist/esm/sdk/aavev3.js.map +1 -1
- package/docs/sdks/aavev3/README.md +164 -0
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/aaveV3AvgRate.ts +170 -0
- package/src/funcs/aaveV3StdRate.ts +170 -0
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +5 -1
- package/src/mcp-server/tools/aaveV3AvgRate.ts +37 -0
- package/src/mcp-server/tools/aaveV3StdRate.ts +37 -0
- package/src/models/components/aaveavgrateresponse.ts +123 -0
- package/src/models/components/aavestdrateresponse.ts +123 -0
- package/src/models/components/index.ts +2 -0
- package/src/models/operations/aaveavgrate.ts +203 -0
- package/src/models/operations/aavestdrate.ts +203 -0
- package/src/models/operations/index.ts +2 -0
- package/src/sdk/aavev3.ts +36 -0
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
### Available Operations
|
|
7
7
|
|
|
8
|
+
* [stdRate](#stdrate) - Standard deviation of interest rates
|
|
9
|
+
* [avgRate](#avgrate) - Average interest rates
|
|
8
10
|
* [reserveOverview](#reserveoverview) - Reserve overview
|
|
9
11
|
* [rate](#rate) - Interest rates
|
|
10
12
|
* [tokenPrice](#tokenprice) - Token prices
|
|
@@ -17,6 +19,168 @@
|
|
|
17
19
|
* [repay](#repay) - Repay loans
|
|
18
20
|
* [withdraw](#withdraw) - Unstake
|
|
19
21
|
|
|
22
|
+
## stdRate
|
|
23
|
+
|
|
24
|
+
Returns the standard deviation of Interest Rates for Aave Reserves over time:
|
|
25
|
+
|
|
26
|
+
### Example Usage
|
|
27
|
+
|
|
28
|
+
```typescript
|
|
29
|
+
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
30
|
+
|
|
31
|
+
const compassApiSDK = new CompassApiSDK({
|
|
32
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
async function run() {
|
|
36
|
+
const result = await compassApiSDK.aaveV3.stdRate({
|
|
37
|
+
chain: "ethereum:mainnet",
|
|
38
|
+
token: "USDC",
|
|
39
|
+
days: 7,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// Handle the result
|
|
43
|
+
console.log(result);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
run();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Standalone function
|
|
50
|
+
|
|
51
|
+
The standalone function version of this method:
|
|
52
|
+
|
|
53
|
+
```typescript
|
|
54
|
+
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
55
|
+
import { aaveV3StdRate } from "@compass-labs/api-sdk/funcs/aaveV3StdRate.js";
|
|
56
|
+
|
|
57
|
+
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
58
|
+
// You can create one instance of it to use across an application.
|
|
59
|
+
const compassApiSDK = new CompassApiSDKCore({
|
|
60
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
async function run() {
|
|
64
|
+
const res = await aaveV3StdRate(compassApiSDK, {
|
|
65
|
+
chain: "ethereum:mainnet",
|
|
66
|
+
token: "USDC",
|
|
67
|
+
days: 7,
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
if (!res.ok) {
|
|
71
|
+
throw res.error;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const { value: result } = res;
|
|
75
|
+
|
|
76
|
+
// Handle the result
|
|
77
|
+
console.log(result);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
run();
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Parameters
|
|
84
|
+
|
|
85
|
+
| Parameter | Type | Required | Description |
|
|
86
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
87
|
+
| `request` | [operations.AaveStdRateRequest](../../models/operations/aavestdraterequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
88
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
89
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
90
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
91
|
+
|
|
92
|
+
### Response
|
|
93
|
+
|
|
94
|
+
**Promise\<[components.AaveSTDRateResponse](../../models/components/aavestdrateresponse.md)\>**
|
|
95
|
+
|
|
96
|
+
### Errors
|
|
97
|
+
|
|
98
|
+
| Error Type | Status Code | Content Type |
|
|
99
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
100
|
+
| errors.HTTPValidationError | 422 | application/json |
|
|
101
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
102
|
+
|
|
103
|
+
## avgRate
|
|
104
|
+
|
|
105
|
+
Returns time averaged Interest Rates for Aave Reserves:
|
|
106
|
+
|
|
107
|
+
### Example Usage
|
|
108
|
+
|
|
109
|
+
```typescript
|
|
110
|
+
import { CompassApiSDK } from "@compass-labs/api-sdk";
|
|
111
|
+
|
|
112
|
+
const compassApiSDK = new CompassApiSDK({
|
|
113
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
async function run() {
|
|
117
|
+
const result = await compassApiSDK.aaveV3.avgRate({
|
|
118
|
+
chain: "ethereum:mainnet",
|
|
119
|
+
token: "USDC",
|
|
120
|
+
days: 7,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
// Handle the result
|
|
124
|
+
console.log(result);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
run();
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### Standalone function
|
|
131
|
+
|
|
132
|
+
The standalone function version of this method:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
|
|
136
|
+
import { aaveV3AvgRate } from "@compass-labs/api-sdk/funcs/aaveV3AvgRate.js";
|
|
137
|
+
|
|
138
|
+
// Use `CompassApiSDKCore` for best tree-shaking performance.
|
|
139
|
+
// You can create one instance of it to use across an application.
|
|
140
|
+
const compassApiSDK = new CompassApiSDKCore({
|
|
141
|
+
apiKeyAuth: "<YOUR_API_KEY_HERE>",
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
async function run() {
|
|
145
|
+
const res = await aaveV3AvgRate(compassApiSDK, {
|
|
146
|
+
chain: "ethereum:mainnet",
|
|
147
|
+
token: "USDC",
|
|
148
|
+
days: 7,
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
if (!res.ok) {
|
|
152
|
+
throw res.error;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
const { value: result } = res;
|
|
156
|
+
|
|
157
|
+
// Handle the result
|
|
158
|
+
console.log(result);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
run();
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Parameters
|
|
165
|
+
|
|
166
|
+
| Parameter | Type | Required | Description |
|
|
167
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
168
|
+
| `request` | [operations.AaveAvgRateRequest](../../models/operations/aaveavgraterequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
|
169
|
+
| `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
|
|
170
|
+
| `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
|
|
171
|
+
| `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
|
|
172
|
+
|
|
173
|
+
### Response
|
|
174
|
+
|
|
175
|
+
**Promise\<[components.AaveAvgRateResponse](../../models/components/aaveavgrateresponse.md)\>**
|
|
176
|
+
|
|
177
|
+
### Errors
|
|
178
|
+
|
|
179
|
+
| Error Type | Status Code | Content Type |
|
|
180
|
+
| -------------------------- | -------------------------- | -------------------------- |
|
|
181
|
+
| errors.HTTPValidationError | 422 | application/json |
|
|
182
|
+
| errors.APIError | 4XX, 5XX | \*/\* |
|
|
183
|
+
|
|
20
184
|
## reserveOverview
|
|
21
185
|
|
|
22
186
|
Returns key metrics for Aave Reserves:
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { APIError } from "../models/errors/apierror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Average interest rates
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Returns time averaged Interest Rates for Aave Reserves:
|
|
33
|
+
*/
|
|
34
|
+
export function aaveV3AvgRate(
|
|
35
|
+
client: CompassApiSDKCore,
|
|
36
|
+
request: operations.AaveAvgRateRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
components.AaveAvgRateResponse,
|
|
41
|
+
| errors.HTTPValidationError
|
|
42
|
+
| APIError
|
|
43
|
+
| SDKValidationError
|
|
44
|
+
| UnexpectedClientError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
>
|
|
50
|
+
> {
|
|
51
|
+
return new APIPromise($do(
|
|
52
|
+
client,
|
|
53
|
+
request,
|
|
54
|
+
options,
|
|
55
|
+
));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function $do(
|
|
59
|
+
client: CompassApiSDKCore,
|
|
60
|
+
request: operations.AaveAvgRateRequest,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<
|
|
63
|
+
[
|
|
64
|
+
Result<
|
|
65
|
+
components.AaveAvgRateResponse,
|
|
66
|
+
| errors.HTTPValidationError
|
|
67
|
+
| APIError
|
|
68
|
+
| SDKValidationError
|
|
69
|
+
| UnexpectedClientError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
>,
|
|
75
|
+
APICall,
|
|
76
|
+
]
|
|
77
|
+
> {
|
|
78
|
+
const parsed = safeParse(
|
|
79
|
+
request,
|
|
80
|
+
(value) => operations.AaveAvgRateRequest$outboundSchema.parse(value),
|
|
81
|
+
"Input validation failed",
|
|
82
|
+
);
|
|
83
|
+
if (!parsed.ok) {
|
|
84
|
+
return [parsed, { status: "invalid" }];
|
|
85
|
+
}
|
|
86
|
+
const payload = parsed.value;
|
|
87
|
+
const body = null;
|
|
88
|
+
|
|
89
|
+
const path = pathToFunc("/v0/aave/avg_rate/get")();
|
|
90
|
+
|
|
91
|
+
const query = encodeFormQuery({
|
|
92
|
+
"chain": payload.chain,
|
|
93
|
+
"days": payload.days,
|
|
94
|
+
"token": payload.token,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const headers = new Headers(compactMap({
|
|
98
|
+
Accept: "application/json",
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
102
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
103
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
104
|
+
|
|
105
|
+
const context = {
|
|
106
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
107
|
+
operationID: "aave_avg_rate",
|
|
108
|
+
oAuth2Scopes: [],
|
|
109
|
+
|
|
110
|
+
resolvedSecurity: requestSecurity,
|
|
111
|
+
|
|
112
|
+
securitySource: client._options.apiKeyAuth,
|
|
113
|
+
retryConfig: options?.retries
|
|
114
|
+
|| client._options.retryConfig
|
|
115
|
+
|| { strategy: "none" },
|
|
116
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const requestRes = client._createRequest(context, {
|
|
120
|
+
security: requestSecurity,
|
|
121
|
+
method: "GET",
|
|
122
|
+
baseURL: options?.serverURL,
|
|
123
|
+
path: path,
|
|
124
|
+
headers: headers,
|
|
125
|
+
query: query,
|
|
126
|
+
body: body,
|
|
127
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
128
|
+
}, options);
|
|
129
|
+
if (!requestRes.ok) {
|
|
130
|
+
return [requestRes, { status: "invalid" }];
|
|
131
|
+
}
|
|
132
|
+
const req = requestRes.value;
|
|
133
|
+
|
|
134
|
+
const doResult = await client._do(req, {
|
|
135
|
+
context,
|
|
136
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
137
|
+
retryConfig: context.retryConfig,
|
|
138
|
+
retryCodes: context.retryCodes,
|
|
139
|
+
});
|
|
140
|
+
if (!doResult.ok) {
|
|
141
|
+
return [doResult, { status: "request-error", request: req }];
|
|
142
|
+
}
|
|
143
|
+
const response = doResult.value;
|
|
144
|
+
|
|
145
|
+
const responseFields = {
|
|
146
|
+
HttpMeta: { Response: response, Request: req },
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const [result] = await M.match<
|
|
150
|
+
components.AaveAvgRateResponse,
|
|
151
|
+
| errors.HTTPValidationError
|
|
152
|
+
| APIError
|
|
153
|
+
| SDKValidationError
|
|
154
|
+
| UnexpectedClientError
|
|
155
|
+
| InvalidRequestError
|
|
156
|
+
| RequestAbortedError
|
|
157
|
+
| RequestTimeoutError
|
|
158
|
+
| ConnectionError
|
|
159
|
+
>(
|
|
160
|
+
M.json(200, components.AaveAvgRateResponse$inboundSchema),
|
|
161
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
162
|
+
M.fail("4XX"),
|
|
163
|
+
M.fail("5XX"),
|
|
164
|
+
)(response, { extraFields: responseFields });
|
|
165
|
+
if (!result.ok) {
|
|
166
|
+
return [result, { status: "complete", request: req, response }];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return [result, { status: "complete", request: req, response }];
|
|
170
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { CompassApiSDKCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { APIError } from "../models/errors/apierror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
24
|
+
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
26
|
+
import { Result } from "../types/fp.js";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Standard deviation of interest rates
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Returns the standard deviation of Interest Rates for Aave Reserves over time:
|
|
33
|
+
*/
|
|
34
|
+
export function aaveV3StdRate(
|
|
35
|
+
client: CompassApiSDKCore,
|
|
36
|
+
request: operations.AaveStdRateRequest,
|
|
37
|
+
options?: RequestOptions,
|
|
38
|
+
): APIPromise<
|
|
39
|
+
Result<
|
|
40
|
+
components.AaveSTDRateResponse,
|
|
41
|
+
| errors.HTTPValidationError
|
|
42
|
+
| APIError
|
|
43
|
+
| SDKValidationError
|
|
44
|
+
| UnexpectedClientError
|
|
45
|
+
| InvalidRequestError
|
|
46
|
+
| RequestAbortedError
|
|
47
|
+
| RequestTimeoutError
|
|
48
|
+
| ConnectionError
|
|
49
|
+
>
|
|
50
|
+
> {
|
|
51
|
+
return new APIPromise($do(
|
|
52
|
+
client,
|
|
53
|
+
request,
|
|
54
|
+
options,
|
|
55
|
+
));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function $do(
|
|
59
|
+
client: CompassApiSDKCore,
|
|
60
|
+
request: operations.AaveStdRateRequest,
|
|
61
|
+
options?: RequestOptions,
|
|
62
|
+
): Promise<
|
|
63
|
+
[
|
|
64
|
+
Result<
|
|
65
|
+
components.AaveSTDRateResponse,
|
|
66
|
+
| errors.HTTPValidationError
|
|
67
|
+
| APIError
|
|
68
|
+
| SDKValidationError
|
|
69
|
+
| UnexpectedClientError
|
|
70
|
+
| InvalidRequestError
|
|
71
|
+
| RequestAbortedError
|
|
72
|
+
| RequestTimeoutError
|
|
73
|
+
| ConnectionError
|
|
74
|
+
>,
|
|
75
|
+
APICall,
|
|
76
|
+
]
|
|
77
|
+
> {
|
|
78
|
+
const parsed = safeParse(
|
|
79
|
+
request,
|
|
80
|
+
(value) => operations.AaveStdRateRequest$outboundSchema.parse(value),
|
|
81
|
+
"Input validation failed",
|
|
82
|
+
);
|
|
83
|
+
if (!parsed.ok) {
|
|
84
|
+
return [parsed, { status: "invalid" }];
|
|
85
|
+
}
|
|
86
|
+
const payload = parsed.value;
|
|
87
|
+
const body = null;
|
|
88
|
+
|
|
89
|
+
const path = pathToFunc("/v0/aave/std_rate/get")();
|
|
90
|
+
|
|
91
|
+
const query = encodeFormQuery({
|
|
92
|
+
"chain": payload.chain,
|
|
93
|
+
"days": payload.days,
|
|
94
|
+
"token": payload.token,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const headers = new Headers(compactMap({
|
|
98
|
+
Accept: "application/json",
|
|
99
|
+
}));
|
|
100
|
+
|
|
101
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
102
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
103
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
104
|
+
|
|
105
|
+
const context = {
|
|
106
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
107
|
+
operationID: "aave_std_rate",
|
|
108
|
+
oAuth2Scopes: [],
|
|
109
|
+
|
|
110
|
+
resolvedSecurity: requestSecurity,
|
|
111
|
+
|
|
112
|
+
securitySource: client._options.apiKeyAuth,
|
|
113
|
+
retryConfig: options?.retries
|
|
114
|
+
|| client._options.retryConfig
|
|
115
|
+
|| { strategy: "none" },
|
|
116
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const requestRes = client._createRequest(context, {
|
|
120
|
+
security: requestSecurity,
|
|
121
|
+
method: "GET",
|
|
122
|
+
baseURL: options?.serverURL,
|
|
123
|
+
path: path,
|
|
124
|
+
headers: headers,
|
|
125
|
+
query: query,
|
|
126
|
+
body: body,
|
|
127
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
128
|
+
}, options);
|
|
129
|
+
if (!requestRes.ok) {
|
|
130
|
+
return [requestRes, { status: "invalid" }];
|
|
131
|
+
}
|
|
132
|
+
const req = requestRes.value;
|
|
133
|
+
|
|
134
|
+
const doResult = await client._do(req, {
|
|
135
|
+
context,
|
|
136
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
137
|
+
retryConfig: context.retryConfig,
|
|
138
|
+
retryCodes: context.retryCodes,
|
|
139
|
+
});
|
|
140
|
+
if (!doResult.ok) {
|
|
141
|
+
return [doResult, { status: "request-error", request: req }];
|
|
142
|
+
}
|
|
143
|
+
const response = doResult.value;
|
|
144
|
+
|
|
145
|
+
const responseFields = {
|
|
146
|
+
HttpMeta: { Response: response, Request: req },
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
const [result] = await M.match<
|
|
150
|
+
components.AaveSTDRateResponse,
|
|
151
|
+
| errors.HTTPValidationError
|
|
152
|
+
| APIError
|
|
153
|
+
| SDKValidationError
|
|
154
|
+
| UnexpectedClientError
|
|
155
|
+
| InvalidRequestError
|
|
156
|
+
| RequestAbortedError
|
|
157
|
+
| RequestTimeoutError
|
|
158
|
+
| ConnectionError
|
|
159
|
+
>(
|
|
160
|
+
M.json(200, components.AaveSTDRateResponse$inboundSchema),
|
|
161
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
162
|
+
M.fail("4XX"),
|
|
163
|
+
M.fail("5XX"),
|
|
164
|
+
)(response, { extraFields: responseFields });
|
|
165
|
+
if (!result.ok) {
|
|
166
|
+
return [result, { status: "complete", request: req, response }];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return [result, { status: "complete", request: req, response }];
|
|
170
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -57,8 +57,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
57
57
|
export const SDK_METADATA = {
|
|
58
58
|
language: "typescript",
|
|
59
59
|
openapiDocVersion: "0.0.1",
|
|
60
|
-
sdkVersion: "0.0.
|
|
60
|
+
sdkVersion: "0.0.30",
|
|
61
61
|
genVersion: "2.604.2",
|
|
62
62
|
userAgent:
|
|
63
|
-
"speakeasy-sdk/typescript 0.0.
|
|
63
|
+
"speakeasy-sdk/typescript 0.0.30 2.604.2 0.0.1 @compass-labs/api-sdk",
|
|
64
64
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -13,12 +13,14 @@ import {
|
|
|
13
13
|
} from "./resources.js";
|
|
14
14
|
import { MCPScope } from "./scopes.js";
|
|
15
15
|
import { createRegisterTool } from "./tools.js";
|
|
16
|
+
import { tool$aaveV3AvgRate } from "./tools/aaveV3AvgRate.js";
|
|
16
17
|
import { tool$aaveV3Borrow } from "./tools/aaveV3Borrow.js";
|
|
17
18
|
import { tool$aaveV3HistoricalTransactions } from "./tools/aaveV3HistoricalTransactions.js";
|
|
18
19
|
import { tool$aaveV3LiquidityChange } from "./tools/aaveV3LiquidityChange.js";
|
|
19
20
|
import { tool$aaveV3Rate } from "./tools/aaveV3Rate.js";
|
|
20
21
|
import { tool$aaveV3Repay } from "./tools/aaveV3Repay.js";
|
|
21
22
|
import { tool$aaveV3ReserveOverview } from "./tools/aaveV3ReserveOverview.js";
|
|
23
|
+
import { tool$aaveV3StdRate } from "./tools/aaveV3StdRate.js";
|
|
22
24
|
import { tool$aaveV3Supply } from "./tools/aaveV3Supply.js";
|
|
23
25
|
import { tool$aaveV3TokenPrice } from "./tools/aaveV3TokenPrice.js";
|
|
24
26
|
import { tool$aaveV3UserPositionPerToken } from "./tools/aaveV3UserPositionPerToken.js";
|
|
@@ -83,7 +85,7 @@ export function createMCPServer(deps: {
|
|
|
83
85
|
}) {
|
|
84
86
|
const server = new McpServer({
|
|
85
87
|
name: "CompassApiSDK",
|
|
86
|
-
version: "0.0.
|
|
88
|
+
version: "0.0.30",
|
|
87
89
|
});
|
|
88
90
|
|
|
89
91
|
const client = new CompassApiSDKCore({
|
|
@@ -113,6 +115,8 @@ export function createMCPServer(deps: {
|
|
|
113
115
|
const register = { tool, resource, resourceTemplate, prompt };
|
|
114
116
|
void register; // suppress unused warnings
|
|
115
117
|
|
|
118
|
+
tool(tool$aaveV3StdRate);
|
|
119
|
+
tool(tool$aaveV3AvgRate);
|
|
116
120
|
tool(tool$aaveV3ReserveOverview);
|
|
117
121
|
tool(tool$aaveV3Rate);
|
|
118
122
|
tool(tool$aaveV3TokenPrice);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { aaveV3AvgRate } from "../../funcs/aaveV3AvgRate.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.AaveAvgRateRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$aaveV3AvgRate: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "aave-v3-avg-rate",
|
|
15
|
+
description: `Average interest rates
|
|
16
|
+
|
|
17
|
+
Returns time averaged Interest Rates for Aave Reserves:`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await aaveV3AvgRate(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { aaveV3StdRate } from "../../funcs/aaveV3StdRate.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.AaveStdRateRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$aaveV3StdRate: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "aave-v3-std-rate",
|
|
15
|
+
description: `Standard deviation of interest rates
|
|
16
|
+
|
|
17
|
+
Returns the standard deviation of Interest Rates for Aave Reserves over time:`,
|
|
18
|
+
args,
|
|
19
|
+
tool: async (client, args, ctx) => {
|
|
20
|
+
const [result, apiCall] = await aaveV3StdRate(
|
|
21
|
+
client,
|
|
22
|
+
args.request,
|
|
23
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
24
|
+
).$inspect();
|
|
25
|
+
|
|
26
|
+
if (!result.ok) {
|
|
27
|
+
return {
|
|
28
|
+
content: [{ type: "text", text: result.error.message }],
|
|
29
|
+
isError: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const value = result.value;
|
|
34
|
+
|
|
35
|
+
return formatResult(value, apiCall);
|
|
36
|
+
},
|
|
37
|
+
};
|