@compass-labs/api-sdk 0.0.20 → 0.0.22
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 +2 -2
- package/README.md +9 -7
- package/bin/mcp-server.js +668 -892
- package/bin/mcp-server.js.map +18 -21
- package/dist/commonjs/funcs/aaveV3Rate.d.ts +31 -0
- package/dist/commonjs/funcs/aaveV3Rate.d.ts.map +1 -0
- package/dist/commonjs/funcs/aaveV3Rate.js +134 -0
- package/dist/commonjs/funcs/aaveV3Rate.js.map +1 -0
- package/dist/commonjs/funcs/skyBuy.d.ts +6 -2
- package/dist/commonjs/funcs/skyBuy.d.ts.map +1 -1
- package/dist/commonjs/funcs/skyBuy.js +6 -2
- package/dist/commonjs/funcs/skyBuy.js.map +1 -1
- package/dist/commonjs/funcs/skySell.d.ts +6 -2
- package/dist/commonjs/funcs/skySell.d.ts.map +1 -1
- package/dist/commonjs/funcs/skySell.js +6 -2
- package/dist/commonjs/funcs/skySell.js.map +1 -1
- 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 +3 -1
- package/dist/commonjs/mcp-server/server.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/aaveV3Rate.d.ts +8 -0
- package/dist/commonjs/mcp-server/tools/aaveV3Rate.d.ts.map +1 -0
- package/dist/commonjs/mcp-server/tools/aaveV3Rate.js +77 -0
- package/dist/commonjs/mcp-server/tools/aaveV3Rate.js.map +1 -0
- package/dist/commonjs/mcp-server/tools/skyBuy.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/skyBuy.js +6 -2
- package/dist/commonjs/mcp-server/tools/skyBuy.js.map +1 -1
- package/dist/commonjs/mcp-server/tools/skySell.d.ts.map +1 -1
- package/dist/commonjs/mcp-server/tools/skySell.js +6 -2
- package/dist/commonjs/mcp-server/tools/skySell.js.map +1 -1
- package/dist/commonjs/models/components/aaverateresponse.d.ts +57 -0
- package/dist/commonjs/models/components/aaverateresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/aaverateresponse.js +98 -0
- package/dist/commonjs/models/components/aaverateresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +1 -7
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -7
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/components/multicallaction.d.ts +4 -11
- package/dist/commonjs/models/components/multicallaction.d.ts.map +1 -1
- package/dist/commonjs/models/components/multicallaction.js +0 -35
- package/dist/commonjs/models/components/multicallaction.js.map +1 -1
- package/dist/commonjs/models/components/multicallactiontype.d.ts +0 -21
- package/dist/commonjs/models/components/multicallactiontype.d.ts.map +1 -1
- package/dist/commonjs/models/components/multicallactiontype.js +0 -7
- package/dist/commonjs/models/components/multicallactiontype.js.map +1 -1
- package/dist/commonjs/models/operations/aaverate.d.ts +244 -0
- package/dist/commonjs/models/operations/aaverate.d.ts.map +1 -0
- package/dist/commonjs/models/operations/aaverate.js +163 -0
- package/dist/commonjs/models/operations/aaverate.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +1 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +1 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/sdk/aavev3.d.ts +20 -0
- package/dist/commonjs/sdk/aavev3.d.ts.map +1 -1
- package/dist/commonjs/sdk/aavev3.js +23 -0
- package/dist/commonjs/sdk/aavev3.js.map +1 -1
- package/dist/commonjs/sdk/sky.d.ts +12 -4
- package/dist/commonjs/sdk/sky.d.ts.map +1 -1
- package/dist/commonjs/sdk/sky.js +12 -4
- package/dist/commonjs/sdk/sky.js.map +1 -1
- package/dist/esm/funcs/aaveV3Rate.d.ts +31 -0
- package/dist/esm/funcs/aaveV3Rate.d.ts.map +1 -0
- package/dist/esm/funcs/aaveV3Rate.js +98 -0
- package/dist/esm/funcs/aaveV3Rate.js.map +1 -0
- package/dist/esm/funcs/skyBuy.d.ts +6 -2
- package/dist/esm/funcs/skyBuy.d.ts.map +1 -1
- package/dist/esm/funcs/skyBuy.js +6 -2
- package/dist/esm/funcs/skyBuy.js.map +1 -1
- package/dist/esm/funcs/skySell.d.ts +6 -2
- package/dist/esm/funcs/skySell.d.ts.map +1 -1
- package/dist/esm/funcs/skySell.js +6 -2
- package/dist/esm/funcs/skySell.js.map +1 -1
- 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 +3 -1
- package/dist/esm/mcp-server/server.js.map +1 -1
- package/dist/esm/mcp-server/tools/aaveV3Rate.d.ts +8 -0
- package/dist/esm/mcp-server/tools/aaveV3Rate.d.ts.map +1 -0
- package/dist/esm/mcp-server/tools/aaveV3Rate.js +41 -0
- package/dist/esm/mcp-server/tools/aaveV3Rate.js.map +1 -0
- package/dist/esm/mcp-server/tools/skyBuy.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/skyBuy.js +6 -2
- package/dist/esm/mcp-server/tools/skyBuy.js.map +1 -1
- package/dist/esm/mcp-server/tools/skySell.d.ts.map +1 -1
- package/dist/esm/mcp-server/tools/skySell.js +6 -2
- package/dist/esm/mcp-server/tools/skySell.js.map +1 -1
- package/dist/esm/models/components/aaverateresponse.d.ts +57 -0
- package/dist/esm/models/components/aaverateresponse.d.ts.map +1 -0
- package/dist/esm/models/components/aaverateresponse.js +60 -0
- package/dist/esm/models/components/aaverateresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +1 -7
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -7
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/components/multicallaction.d.ts +4 -11
- package/dist/esm/models/components/multicallaction.d.ts.map +1 -1
- package/dist/esm/models/components/multicallaction.js +0 -35
- package/dist/esm/models/components/multicallaction.js.map +1 -1
- package/dist/esm/models/components/multicallactiontype.d.ts +0 -21
- package/dist/esm/models/components/multicallactiontype.d.ts.map +1 -1
- package/dist/esm/models/components/multicallactiontype.js +0 -7
- package/dist/esm/models/components/multicallactiontype.js.map +1 -1
- package/dist/esm/models/operations/aaverate.d.ts +244 -0
- package/dist/esm/models/operations/aaverate.d.ts.map +1 -0
- package/dist/esm/models/operations/aaverate.js +125 -0
- package/dist/esm/models/operations/aaverate.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +1 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +1 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/sdk/aavev3.d.ts +20 -0
- package/dist/esm/sdk/aavev3.d.ts.map +1 -1
- package/dist/esm/sdk/aavev3.js +23 -0
- package/dist/esm/sdk/aavev3.js.map +1 -1
- package/dist/esm/sdk/sky.d.ts +12 -4
- package/dist/esm/sdk/sky.d.ts.map +1 -1
- package/dist/esm/sdk/sky.js +12 -4
- package/dist/esm/sdk/sky.js.map +1 -1
- package/docs/sdks/aavev3/README.md +93 -0
- package/docs/sdks/sky/README.md +12 -4
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/funcs/aaveV3Rate.ts +182 -0
- package/src/funcs/skyBuy.ts +6 -2
- package/src/funcs/skySell.ts +6 -2
- package/src/lib/config.ts +2 -2
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +3 -1
- package/src/mcp-server/tools/aaveV3Rate.ts +50 -0
- package/src/mcp-server/tools/skyBuy.ts +6 -2
- package/src/mcp-server/tools/skySell.ts +6 -2
- package/src/models/components/aaverateresponse.ts +123 -0
- package/src/models/components/index.ts +1 -7
- package/src/models/components/multicallaction.ts +0 -98
- package/src/models/components/multicallactiontype.ts +0 -7
- package/src/models/operations/aaverate.ts +199 -0
- package/src/models/operations/index.ts +1 -0
- package/src/sdk/aavev3.ts +31 -0
- package/src/sdk/sky.ts +12 -4
- package/dist/commonjs/models/components/aerodromeaddliquidityethparams.d.ts +0 -177
- package/dist/commonjs/models/components/aerodromeaddliquidityethparams.d.ts.map +0 -1
- package/dist/commonjs/models/components/aerodromeaddliquidityethparams.js +0 -191
- package/dist/commonjs/models/components/aerodromeaddliquidityethparams.js.map +0 -1
- package/dist/commonjs/models/components/aerodromeaddliquidityparams.d.ts +0 -186
- package/dist/commonjs/models/components/aerodromeaddliquidityparams.d.ts.map +0 -1
- package/dist/commonjs/models/components/aerodromeaddliquidityparams.js +0 -197
- package/dist/commonjs/models/components/aerodromeaddliquidityparams.js.map +0 -1
- package/dist/commonjs/models/components/aerodromeremoveliquidityethrequest.d.ts +0 -151
- package/dist/commonjs/models/components/aerodromeremoveliquidityethrequest.d.ts.map +0 -1
- package/dist/commonjs/models/components/aerodromeremoveliquidityethrequest.js +0 -167
- package/dist/commonjs/models/components/aerodromeremoveliquidityethrequest.js.map +0 -1
- package/dist/commonjs/models/components/aerodromeremoveliquidityrequest.d.ts +0 -161
- package/dist/commonjs/models/components/aerodromeremoveliquidityrequest.d.ts.map +0 -1
- package/dist/commonjs/models/components/aerodromeremoveliquidityrequest.js +0 -173
- package/dist/commonjs/models/components/aerodromeremoveliquidityrequest.js.map +0 -1
- package/dist/commonjs/models/components/aerodromeswapethfortokenparams.d.ts +0 -109
- package/dist/commonjs/models/components/aerodromeswapethfortokenparams.d.ts.map +0 -1
- package/dist/commonjs/models/components/aerodromeswapethfortokenparams.js +0 -137
- package/dist/commonjs/models/components/aerodromeswapethfortokenparams.js.map +0 -1
- package/dist/commonjs/models/components/aerodromeswaptokenforethparams.d.ts +0 -109
- package/dist/commonjs/models/components/aerodromeswaptokenforethparams.d.ts.map +0 -1
- package/dist/commonjs/models/components/aerodromeswaptokenforethparams.js +0 -137
- package/dist/commonjs/models/components/aerodromeswaptokenforethparams.js.map +0 -1
- package/dist/commonjs/models/components/aerodromeswaptokensparams.d.ts +0 -128
- package/dist/commonjs/models/components/aerodromeswaptokensparams.d.ts.map +0 -1
- package/dist/commonjs/models/components/aerodromeswaptokensparams.js +0 -141
- package/dist/commonjs/models/components/aerodromeswaptokensparams.js.map +0 -1
- package/dist/esm/models/components/aerodromeaddliquidityethparams.d.ts +0 -177
- package/dist/esm/models/components/aerodromeaddliquidityethparams.d.ts.map +0 -1
- package/dist/esm/models/components/aerodromeaddliquidityethparams.js +0 -145
- package/dist/esm/models/components/aerodromeaddliquidityethparams.js.map +0 -1
- package/dist/esm/models/components/aerodromeaddliquidityparams.d.ts +0 -186
- package/dist/esm/models/components/aerodromeaddliquidityparams.d.ts.map +0 -1
- package/dist/esm/models/components/aerodromeaddliquidityparams.js +0 -151
- package/dist/esm/models/components/aerodromeaddliquidityparams.js.map +0 -1
- package/dist/esm/models/components/aerodromeremoveliquidityethrequest.d.ts +0 -151
- package/dist/esm/models/components/aerodromeremoveliquidityethrequest.d.ts.map +0 -1
- package/dist/esm/models/components/aerodromeremoveliquidityethrequest.js +0 -123
- package/dist/esm/models/components/aerodromeremoveliquidityethrequest.js.map +0 -1
- package/dist/esm/models/components/aerodromeremoveliquidityrequest.d.ts +0 -161
- package/dist/esm/models/components/aerodromeremoveliquidityrequest.d.ts.map +0 -1
- package/dist/esm/models/components/aerodromeremoveliquidityrequest.js +0 -129
- package/dist/esm/models/components/aerodromeremoveliquidityrequest.js.map +0 -1
- package/dist/esm/models/components/aerodromeswapethfortokenparams.d.ts +0 -109
- package/dist/esm/models/components/aerodromeswapethfortokenparams.d.ts.map +0 -1
- package/dist/esm/models/components/aerodromeswapethfortokenparams.js +0 -95
- package/dist/esm/models/components/aerodromeswapethfortokenparams.js.map +0 -1
- package/dist/esm/models/components/aerodromeswaptokenforethparams.d.ts +0 -109
- package/dist/esm/models/components/aerodromeswaptokenforethparams.d.ts.map +0 -1
- package/dist/esm/models/components/aerodromeswaptokenforethparams.js +0 -95
- package/dist/esm/models/components/aerodromeswaptokenforethparams.js.map +0 -1
- package/dist/esm/models/components/aerodromeswaptokensparams.d.ts +0 -128
- package/dist/esm/models/components/aerodromeswaptokensparams.d.ts.map +0 -1
- package/dist/esm/models/components/aerodromeswaptokensparams.js +0 -99
- package/dist/esm/models/components/aerodromeswaptokensparams.js.map +0 -1
- package/src/models/components/aerodromeaddliquidityethparams.ts +0 -392
- package/src/models/components/aerodromeaddliquidityparams.ts +0 -382
- package/src/models/components/aerodromeremoveliquidityethrequest.ts +0 -357
- package/src/models/components/aerodromeremoveliquidityrequest.ts +0 -363
- package/src/models/components/aerodromeswapethfortokenparams.ts +0 -249
- package/src/models/components/aerodromeswaptokenforethparams.ts +0 -249
- package/src/models/components/aerodromeswaptokensparams.ts +0 -260
|
@@ -0,0 +1,182 @@
|
|
|
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
|
+
* Interest rates
|
|
30
|
+
*
|
|
31
|
+
* @remarks
|
|
32
|
+
* Returns the latest APY and APR rates for a specified token on Aave, for both
|
|
33
|
+
* deposits and loans.
|
|
34
|
+
*
|
|
35
|
+
* **Annual percentage yield (APY)** is the yearly return/cost after continuous
|
|
36
|
+
* compounding of the per-second rate stored on-chain. This value is the same value as
|
|
37
|
+
* seen the on [app.aave.com](
|
|
38
|
+
* https://app.aave.com/)
|
|
39
|
+
* but more up-to-date as it is taken directly from the
|
|
40
|
+
* blockchain every time this endpoint is called.
|
|
41
|
+
*
|
|
42
|
+
* **Annual percentage rate (APR)** is the yearly simple interest rate (no
|
|
43
|
+
* compounding).
|
|
44
|
+
*
|
|
45
|
+
* For APY/APR on loans Aave offers both stable and fixed rates on certain tokens.
|
|
46
|
+
*/
|
|
47
|
+
export function aaveV3Rate(
|
|
48
|
+
client: CompassApiSDKCore,
|
|
49
|
+
request: operations.AaveRateRequest,
|
|
50
|
+
options?: RequestOptions,
|
|
51
|
+
): APIPromise<
|
|
52
|
+
Result<
|
|
53
|
+
components.AaveRateResponse,
|
|
54
|
+
| errors.HTTPValidationError
|
|
55
|
+
| APIError
|
|
56
|
+
| SDKValidationError
|
|
57
|
+
| UnexpectedClientError
|
|
58
|
+
| InvalidRequestError
|
|
59
|
+
| RequestAbortedError
|
|
60
|
+
| RequestTimeoutError
|
|
61
|
+
| ConnectionError
|
|
62
|
+
>
|
|
63
|
+
> {
|
|
64
|
+
return new APIPromise($do(
|
|
65
|
+
client,
|
|
66
|
+
request,
|
|
67
|
+
options,
|
|
68
|
+
));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function $do(
|
|
72
|
+
client: CompassApiSDKCore,
|
|
73
|
+
request: operations.AaveRateRequest,
|
|
74
|
+
options?: RequestOptions,
|
|
75
|
+
): Promise<
|
|
76
|
+
[
|
|
77
|
+
Result<
|
|
78
|
+
components.AaveRateResponse,
|
|
79
|
+
| errors.HTTPValidationError
|
|
80
|
+
| APIError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
| UnexpectedClientError
|
|
83
|
+
| InvalidRequestError
|
|
84
|
+
| RequestAbortedError
|
|
85
|
+
| RequestTimeoutError
|
|
86
|
+
| ConnectionError
|
|
87
|
+
>,
|
|
88
|
+
APICall,
|
|
89
|
+
]
|
|
90
|
+
> {
|
|
91
|
+
const parsed = safeParse(
|
|
92
|
+
request,
|
|
93
|
+
(value) => operations.AaveRateRequest$outboundSchema.parse(value),
|
|
94
|
+
"Input validation failed",
|
|
95
|
+
);
|
|
96
|
+
if (!parsed.ok) {
|
|
97
|
+
return [parsed, { status: "invalid" }];
|
|
98
|
+
}
|
|
99
|
+
const payload = parsed.value;
|
|
100
|
+
const body = null;
|
|
101
|
+
|
|
102
|
+
const path = pathToFunc("/v0/aave/rate/get")();
|
|
103
|
+
|
|
104
|
+
const query = encodeFormQuery({
|
|
105
|
+
"chain": payload.chain,
|
|
106
|
+
"token": payload.token,
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
const headers = new Headers(compactMap({
|
|
110
|
+
Accept: "application/json",
|
|
111
|
+
}));
|
|
112
|
+
|
|
113
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
114
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
115
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
116
|
+
|
|
117
|
+
const context = {
|
|
118
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
119
|
+
operationID: "aave_rate",
|
|
120
|
+
oAuth2Scopes: [],
|
|
121
|
+
|
|
122
|
+
resolvedSecurity: requestSecurity,
|
|
123
|
+
|
|
124
|
+
securitySource: client._options.apiKeyAuth,
|
|
125
|
+
retryConfig: options?.retries
|
|
126
|
+
|| client._options.retryConfig
|
|
127
|
+
|| { strategy: "none" },
|
|
128
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const requestRes = client._createRequest(context, {
|
|
132
|
+
security: requestSecurity,
|
|
133
|
+
method: "GET",
|
|
134
|
+
baseURL: options?.serverURL,
|
|
135
|
+
path: path,
|
|
136
|
+
headers: headers,
|
|
137
|
+
query: query,
|
|
138
|
+
body: body,
|
|
139
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
140
|
+
}, options);
|
|
141
|
+
if (!requestRes.ok) {
|
|
142
|
+
return [requestRes, { status: "invalid" }];
|
|
143
|
+
}
|
|
144
|
+
const req = requestRes.value;
|
|
145
|
+
|
|
146
|
+
const doResult = await client._do(req, {
|
|
147
|
+
context,
|
|
148
|
+
errorCodes: ["422", "4XX", "5XX"],
|
|
149
|
+
retryConfig: context.retryConfig,
|
|
150
|
+
retryCodes: context.retryCodes,
|
|
151
|
+
});
|
|
152
|
+
if (!doResult.ok) {
|
|
153
|
+
return [doResult, { status: "request-error", request: req }];
|
|
154
|
+
}
|
|
155
|
+
const response = doResult.value;
|
|
156
|
+
|
|
157
|
+
const responseFields = {
|
|
158
|
+
HttpMeta: { Response: response, Request: req },
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const [result] = await M.match<
|
|
162
|
+
components.AaveRateResponse,
|
|
163
|
+
| errors.HTTPValidationError
|
|
164
|
+
| APIError
|
|
165
|
+
| SDKValidationError
|
|
166
|
+
| UnexpectedClientError
|
|
167
|
+
| InvalidRequestError
|
|
168
|
+
| RequestAbortedError
|
|
169
|
+
| RequestTimeoutError
|
|
170
|
+
| ConnectionError
|
|
171
|
+
>(
|
|
172
|
+
M.json(200, components.AaveRateResponse$inboundSchema),
|
|
173
|
+
M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
|
|
174
|
+
M.fail("4XX"),
|
|
175
|
+
M.fail("5XX"),
|
|
176
|
+
)(response, { extraFields: responseFields });
|
|
177
|
+
if (!result.ok) {
|
|
178
|
+
return [result, { status: "complete", request: req, response }];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
package/src/funcs/skyBuy.ts
CHANGED
|
@@ -28,9 +28,13 @@ import { Result } from "../types/fp.js";
|
|
|
28
28
|
* Buy USDS
|
|
29
29
|
*
|
|
30
30
|
* @remarks
|
|
31
|
-
* Buy USDS with DAI or USDC on a 1:1 basis.
|
|
31
|
+
* Buy USDS with DAI or USDC on a 1:1 basis. There are no fees.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
33
|
+
* If buying with DAI, user will need to set an allowance on the DAI contract for the
|
|
34
|
+
* 'SkyDaiUsdsConverter' contract beforehand.
|
|
35
|
+
*
|
|
36
|
+
* If buying with USDC, user will need to set an allowance on the USDC contract for the
|
|
37
|
+
* 'SkyDaiUsdsConverter' contract beforehand.
|
|
34
38
|
*/
|
|
35
39
|
export function skyBuy(
|
|
36
40
|
client: CompassApiSDKCore,
|
package/src/funcs/skySell.ts
CHANGED
|
@@ -28,9 +28,13 @@ import { Result } from "../types/fp.js";
|
|
|
28
28
|
* Sell USDS
|
|
29
29
|
*
|
|
30
30
|
* @remarks
|
|
31
|
-
* Sell USDS for DAI or USDC on a 1:1 basis.
|
|
31
|
+
* Sell USDS for DAI or USDC on a 1:1 basis. There are no fees.
|
|
32
32
|
*
|
|
33
|
-
*
|
|
33
|
+
* If swapping to DAI, user will need to set an allowance on the USDS contract for the
|
|
34
|
+
* 'SkyDaiUsdsConverter' contract beforehand.
|
|
35
|
+
*
|
|
36
|
+
* If swapping to USDC, user will need to set an allowance on the USDS contract for the
|
|
37
|
+
* 'SkyUsdcUsdsConverter' contract beforehand.
|
|
34
38
|
*/
|
|
35
39
|
export function skySell(
|
|
36
40
|
client: CompassApiSDKCore,
|
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.22",
|
|
61
61
|
genVersion: "2.598.22",
|
|
62
62
|
userAgent:
|
|
63
|
-
"speakeasy-sdk/typescript 0.0.
|
|
63
|
+
"speakeasy-sdk/typescript 0.0.22 2.598.22 0.0.1 @compass-labs/api-sdk",
|
|
64
64
|
} as const;
|
package/src/mcp-server/server.ts
CHANGED
|
@@ -16,6 +16,7 @@ import { createRegisterTool } from "./tools.js";
|
|
|
16
16
|
import { tool$aaveV3Borrow } from "./tools/aaveV3Borrow.js";
|
|
17
17
|
import { tool$aaveV3HistoricalTransactions } from "./tools/aaveV3HistoricalTransactions.js";
|
|
18
18
|
import { tool$aaveV3LiquidityChange } from "./tools/aaveV3LiquidityChange.js";
|
|
19
|
+
import { tool$aaveV3Rate } from "./tools/aaveV3Rate.js";
|
|
19
20
|
import { tool$aaveV3Repay } from "./tools/aaveV3Repay.js";
|
|
20
21
|
import { tool$aaveV3Supply } from "./tools/aaveV3Supply.js";
|
|
21
22
|
import { tool$aaveV3TokenPrice } from "./tools/aaveV3TokenPrice.js";
|
|
@@ -80,7 +81,7 @@ export function createMCPServer(deps: {
|
|
|
80
81
|
}) {
|
|
81
82
|
const server = new McpServer({
|
|
82
83
|
name: "CompassApiSDK",
|
|
83
|
-
version: "0.0.
|
|
84
|
+
version: "0.0.22",
|
|
84
85
|
});
|
|
85
86
|
|
|
86
87
|
const client = new CompassApiSDKCore({
|
|
@@ -110,6 +111,7 @@ export function createMCPServer(deps: {
|
|
|
110
111
|
const register = { tool, resource, resourceTemplate, prompt };
|
|
111
112
|
void register; // suppress unused warnings
|
|
112
113
|
|
|
114
|
+
tool(tool$aaveV3Rate);
|
|
113
115
|
tool(tool$aaveV3TokenPrice);
|
|
114
116
|
tool(tool$aaveV3LiquidityChange);
|
|
115
117
|
tool(tool$aaveV3UserPositionSummary);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { aaveV3Rate } from "../../funcs/aaveV3Rate.js";
|
|
6
|
+
import * as operations from "../../models/operations/index.js";
|
|
7
|
+
import { formatResult, ToolDefinition } from "../tools.js";
|
|
8
|
+
|
|
9
|
+
const args = {
|
|
10
|
+
request: operations.AaveRateRequest$inboundSchema,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const tool$aaveV3Rate: ToolDefinition<typeof args> = {
|
|
14
|
+
name: "aave-v3-rate",
|
|
15
|
+
description: `Interest rates
|
|
16
|
+
|
|
17
|
+
Returns the latest APY and APR rates for a specified token on Aave, for both
|
|
18
|
+
deposits and loans.
|
|
19
|
+
|
|
20
|
+
**Annual percentage yield (APY)** is the yearly return/cost after continuous
|
|
21
|
+
compounding of the per-second rate stored on-chain. This value is the same value as
|
|
22
|
+
seen the on [app.aave.com](
|
|
23
|
+
https://app.aave.com/)
|
|
24
|
+
but more up-to-date as it is taken directly from the
|
|
25
|
+
blockchain every time this endpoint is called.
|
|
26
|
+
|
|
27
|
+
**Annual percentage rate (APR)** is the yearly simple interest rate (no
|
|
28
|
+
compounding).
|
|
29
|
+
|
|
30
|
+
For APY/APR on loans Aave offers both stable and fixed rates on certain tokens.`,
|
|
31
|
+
args,
|
|
32
|
+
tool: async (client, args, ctx) => {
|
|
33
|
+
const [result, apiCall] = await aaveV3Rate(
|
|
34
|
+
client,
|
|
35
|
+
args.request,
|
|
36
|
+
{ fetchOptions: { signal: ctx.signal } },
|
|
37
|
+
).$inspect();
|
|
38
|
+
|
|
39
|
+
if (!result.ok) {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: "text", text: result.error.message }],
|
|
42
|
+
isError: true,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const value = result.value;
|
|
47
|
+
|
|
48
|
+
return formatResult(value, apiCall);
|
|
49
|
+
},
|
|
50
|
+
};
|
|
@@ -14,9 +14,13 @@ export const tool$skyBuy: ToolDefinition<typeof args> = {
|
|
|
14
14
|
name: "sky-buy",
|
|
15
15
|
description: `Buy USDS
|
|
16
16
|
|
|
17
|
-
Buy USDS with DAI or USDC on a 1:1 basis.
|
|
17
|
+
Buy USDS with DAI or USDC on a 1:1 basis. There are no fees.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
If buying with DAI, user will need to set an allowance on the DAI contract for the
|
|
20
|
+
'SkyDaiUsdsConverter' contract beforehand.
|
|
21
|
+
|
|
22
|
+
If buying with USDC, user will need to set an allowance on the USDC contract for the
|
|
23
|
+
'SkyDaiUsdsConverter' contract beforehand.`,
|
|
20
24
|
args,
|
|
21
25
|
tool: async (client, args, ctx) => {
|
|
22
26
|
const [result, apiCall] = await skyBuy(
|
|
@@ -14,9 +14,13 @@ export const tool$skySell: ToolDefinition<typeof args> = {
|
|
|
14
14
|
name: "sky-sell",
|
|
15
15
|
description: `Sell USDS
|
|
16
16
|
|
|
17
|
-
Sell USDS for DAI or USDC on a 1:1 basis.
|
|
17
|
+
Sell USDS for DAI or USDC on a 1:1 basis. There are no fees.
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
If swapping to DAI, user will need to set an allowance on the USDS contract for the
|
|
20
|
+
'SkyDaiUsdsConverter' contract beforehand.
|
|
21
|
+
|
|
22
|
+
If swapping to USDC, user will need to set an allowance on the USDS contract for the
|
|
23
|
+
'SkyUsdcUsdsConverter' contract beforehand.`,
|
|
20
24
|
args,
|
|
21
25
|
tool: async (client, args, ctx) => {
|
|
22
26
|
const [result, apiCall] = await skySell(
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export type AaveRateResponse = {
|
|
12
|
+
/**
|
|
13
|
+
* Variable rate APY for deposits.
|
|
14
|
+
*/
|
|
15
|
+
supplyApyVariableRate: string;
|
|
16
|
+
/**
|
|
17
|
+
* Variable rate APR for deposits.
|
|
18
|
+
*/
|
|
19
|
+
supplyAprVariableRate: string;
|
|
20
|
+
/**
|
|
21
|
+
* Variable rate APY for loans.
|
|
22
|
+
*/
|
|
23
|
+
borrowApyVariableRate: string;
|
|
24
|
+
/**
|
|
25
|
+
* Variable rate APR for loans.
|
|
26
|
+
*/
|
|
27
|
+
borrowAprVariableRate: string;
|
|
28
|
+
/**
|
|
29
|
+
* Fixed rate APY for loans.
|
|
30
|
+
*/
|
|
31
|
+
borrowApyFixedRate: string;
|
|
32
|
+
/**
|
|
33
|
+
* Fixed rate APR for loans.
|
|
34
|
+
*/
|
|
35
|
+
borrowAprFixedRate: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/** @internal */
|
|
39
|
+
export const AaveRateResponse$inboundSchema: z.ZodType<
|
|
40
|
+
AaveRateResponse,
|
|
41
|
+
z.ZodTypeDef,
|
|
42
|
+
unknown
|
|
43
|
+
> = z.object({
|
|
44
|
+
supply_apy_variable_rate: z.string(),
|
|
45
|
+
supply_apr_variable_rate: z.string(),
|
|
46
|
+
borrow_apy_variable_rate: z.string(),
|
|
47
|
+
borrow_apr_variable_rate: z.string(),
|
|
48
|
+
borrow_apy_fixed_rate: z.string(),
|
|
49
|
+
borrow_apr_fixed_rate: z.string(),
|
|
50
|
+
}).transform((v) => {
|
|
51
|
+
return remap$(v, {
|
|
52
|
+
"supply_apy_variable_rate": "supplyApyVariableRate",
|
|
53
|
+
"supply_apr_variable_rate": "supplyAprVariableRate",
|
|
54
|
+
"borrow_apy_variable_rate": "borrowApyVariableRate",
|
|
55
|
+
"borrow_apr_variable_rate": "borrowAprVariableRate",
|
|
56
|
+
"borrow_apy_fixed_rate": "borrowApyFixedRate",
|
|
57
|
+
"borrow_apr_fixed_rate": "borrowAprFixedRate",
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
/** @internal */
|
|
62
|
+
export type AaveRateResponse$Outbound = {
|
|
63
|
+
supply_apy_variable_rate: string;
|
|
64
|
+
supply_apr_variable_rate: string;
|
|
65
|
+
borrow_apy_variable_rate: string;
|
|
66
|
+
borrow_apr_variable_rate: string;
|
|
67
|
+
borrow_apy_fixed_rate: string;
|
|
68
|
+
borrow_apr_fixed_rate: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const AaveRateResponse$outboundSchema: z.ZodType<
|
|
73
|
+
AaveRateResponse$Outbound,
|
|
74
|
+
z.ZodTypeDef,
|
|
75
|
+
AaveRateResponse
|
|
76
|
+
> = z.object({
|
|
77
|
+
supplyApyVariableRate: z.string(),
|
|
78
|
+
supplyAprVariableRate: z.string(),
|
|
79
|
+
borrowApyVariableRate: z.string(),
|
|
80
|
+
borrowAprVariableRate: z.string(),
|
|
81
|
+
borrowApyFixedRate: z.string(),
|
|
82
|
+
borrowAprFixedRate: z.string(),
|
|
83
|
+
}).transform((v) => {
|
|
84
|
+
return remap$(v, {
|
|
85
|
+
supplyApyVariableRate: "supply_apy_variable_rate",
|
|
86
|
+
supplyAprVariableRate: "supply_apr_variable_rate",
|
|
87
|
+
borrowApyVariableRate: "borrow_apy_variable_rate",
|
|
88
|
+
borrowAprVariableRate: "borrow_apr_variable_rate",
|
|
89
|
+
borrowApyFixedRate: "borrow_apy_fixed_rate",
|
|
90
|
+
borrowAprFixedRate: "borrow_apr_fixed_rate",
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @internal
|
|
96
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
97
|
+
*/
|
|
98
|
+
export namespace AaveRateResponse$ {
|
|
99
|
+
/** @deprecated use `AaveRateResponse$inboundSchema` instead. */
|
|
100
|
+
export const inboundSchema = AaveRateResponse$inboundSchema;
|
|
101
|
+
/** @deprecated use `AaveRateResponse$outboundSchema` instead. */
|
|
102
|
+
export const outboundSchema = AaveRateResponse$outboundSchema;
|
|
103
|
+
/** @deprecated use `AaveRateResponse$Outbound` instead. */
|
|
104
|
+
export type Outbound = AaveRateResponse$Outbound;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function aaveRateResponseToJSON(
|
|
108
|
+
aaveRateResponse: AaveRateResponse,
|
|
109
|
+
): string {
|
|
110
|
+
return JSON.stringify(
|
|
111
|
+
AaveRateResponse$outboundSchema.parse(aaveRateResponse),
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function aaveRateResponseFromJSON(
|
|
116
|
+
jsonString: string,
|
|
117
|
+
): SafeParseResult<AaveRateResponse, SDKValidationError> {
|
|
118
|
+
return safeParse(
|
|
119
|
+
jsonString,
|
|
120
|
+
(x) => AaveRateResponse$inboundSchema.parse(JSON.parse(x)),
|
|
121
|
+
`Failed to parse 'AaveRateResponse' from JSON`,
|
|
122
|
+
);
|
|
123
|
+
}
|
|
@@ -7,6 +7,7 @@ export * from "./aaveborrowrequest.js";
|
|
|
7
7
|
export * from "./aavehistoricaltransactionbase.js";
|
|
8
8
|
export * from "./aavehistoricaltransactionsresponse.js";
|
|
9
9
|
export * from "./aaveliquiditychangeresponse.js";
|
|
10
|
+
export * from "./aaverateresponse.js";
|
|
10
11
|
export * from "./aaverepayparams.js";
|
|
11
12
|
export * from "./aaverepayrequest.js";
|
|
12
13
|
export * from "./aavesupplyparams.js";
|
|
@@ -17,12 +18,8 @@ export * from "./aaveuserpositionsummaryresponse.js";
|
|
|
17
18
|
export * from "./aavewithdrawparams.js";
|
|
18
19
|
export * from "./aavewithdrawrequest.js";
|
|
19
20
|
export * from "./action.js";
|
|
20
|
-
export * from "./aerodromeaddliquidityethparams.js";
|
|
21
|
-
export * from "./aerodromeaddliquidityparams.js";
|
|
22
21
|
export * from "./aerodromelppositionsresponse.js";
|
|
23
22
|
export * from "./aerodromeposition.js";
|
|
24
|
-
export * from "./aerodromeremoveliquidityethrequest.js";
|
|
25
|
-
export * from "./aerodromeremoveliquidityrequest.js";
|
|
26
23
|
export * from "./aerodromeslipstreambuyexactlyparams.js";
|
|
27
24
|
export * from "./aerodromeslipstreambuyexactlyrequest.js";
|
|
28
25
|
export * from "./aerodromeslipstreamincreaseliquidityprovisionparams.js";
|
|
@@ -34,9 +31,6 @@ export * from "./aerodromeslipstreamsellexactlyparams.js";
|
|
|
34
31
|
export * from "./aerodromeslipstreamsellexactlyrequest.js";
|
|
35
32
|
export * from "./aerodromeslipstreamwithdrawliquidityprovisionparams.js";
|
|
36
33
|
export * from "./aerodromeslipstreamwithdrawliquidityprovisionrequest.js";
|
|
37
|
-
export * from "./aerodromeswapethfortokenparams.js";
|
|
38
|
-
export * from "./aerodromeswaptokenforethparams.js";
|
|
39
|
-
export * from "./aerodromeswaptokensparams.js";
|
|
40
34
|
export * from "./allowanceinforesponse.js";
|
|
41
35
|
export * from "./borrow.js";
|
|
42
36
|
export * from "./chain.js";
|