@compass-labs/api-sdk 0.5.6 → 0.5.8

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.
Files changed (79) hide show
  1. package/FUNCTIONS.md +6 -26
  2. package/README.md +47 -78
  3. package/bin/mcp-server.js +19 -18
  4. package/bin/mcp-server.js.map +12 -12
  5. package/dist/commonjs/funcs/transactionBatchingAaveLoop.d.ts +1 -1
  6. package/dist/commonjs/funcs/transactionBatchingAaveLoop.js +1 -1
  7. package/dist/commonjs/funcs/transactionBatchingAuthorization.d.ts +6 -6
  8. package/dist/commonjs/funcs/transactionBatchingAuthorization.js +6 -6
  9. package/dist/commonjs/funcs/transactionBatchingExecute.d.ts +3 -2
  10. package/dist/commonjs/funcs/transactionBatchingExecute.d.ts.map +1 -1
  11. package/dist/commonjs/funcs/transactionBatchingExecute.js +3 -2
  12. package/dist/commonjs/funcs/transactionBatchingExecute.js.map +1 -1
  13. package/dist/commonjs/lib/config.d.ts +3 -3
  14. package/dist/commonjs/lib/config.js +3 -3
  15. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  16. package/dist/commonjs/mcp-server/server.js +1 -1
  17. package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.js +1 -1
  18. package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js +6 -6
  19. package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js.map +1 -1
  20. package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.d.ts.map +1 -1
  21. package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js +3 -2
  22. package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js.map +1 -1
  23. package/dist/commonjs/models/errors/apierror.d.ts +14 -2
  24. package/dist/commonjs/models/errors/apierror.d.ts.map +1 -1
  25. package/dist/commonjs/models/errors/apierror.js +1 -1
  26. package/dist/commonjs/models/errors/apierror.js.map +1 -1
  27. package/dist/commonjs/sdk/transactionbatching.d.ts +10 -9
  28. package/dist/commonjs/sdk/transactionbatching.d.ts.map +1 -1
  29. package/dist/commonjs/sdk/transactionbatching.js +10 -9
  30. package/dist/commonjs/sdk/transactionbatching.js.map +1 -1
  31. package/dist/esm/funcs/transactionBatchingAaveLoop.d.ts +1 -1
  32. package/dist/esm/funcs/transactionBatchingAaveLoop.js +1 -1
  33. package/dist/esm/funcs/transactionBatchingAuthorization.d.ts +6 -6
  34. package/dist/esm/funcs/transactionBatchingAuthorization.js +6 -6
  35. package/dist/esm/funcs/transactionBatchingExecute.d.ts +3 -2
  36. package/dist/esm/funcs/transactionBatchingExecute.d.ts.map +1 -1
  37. package/dist/esm/funcs/transactionBatchingExecute.js +3 -2
  38. package/dist/esm/funcs/transactionBatchingExecute.js.map +1 -1
  39. package/dist/esm/lib/config.d.ts +3 -3
  40. package/dist/esm/lib/config.js +3 -3
  41. package/dist/esm/mcp-server/mcp-server.js +1 -1
  42. package/dist/esm/mcp-server/server.js +1 -1
  43. package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.js +1 -1
  44. package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js +6 -6
  45. package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js.map +1 -1
  46. package/dist/esm/mcp-server/tools/transactionBatchingExecute.d.ts.map +1 -1
  47. package/dist/esm/mcp-server/tools/transactionBatchingExecute.js +3 -2
  48. package/dist/esm/mcp-server/tools/transactionBatchingExecute.js.map +1 -1
  49. package/dist/esm/models/errors/apierror.d.ts +14 -2
  50. package/dist/esm/models/errors/apierror.d.ts.map +1 -1
  51. package/dist/esm/models/errors/apierror.js +1 -1
  52. package/dist/esm/models/errors/apierror.js.map +1 -1
  53. package/dist/esm/sdk/transactionbatching.d.ts +10 -9
  54. package/dist/esm/sdk/transactionbatching.d.ts.map +1 -1
  55. package/dist/esm/sdk/transactionbatching.js +10 -9
  56. package/dist/esm/sdk/transactionbatching.js.map +1 -1
  57. package/docs/sdks/aavev3/README.md +83 -199
  58. package/docs/sdks/aerodromeslipstream/README.md +39 -79
  59. package/docs/sdks/morpho/README.md +84 -182
  60. package/docs/sdks/pendle/README.md +53 -113
  61. package/docs/sdks/sky/README.md +27 -51
  62. package/docs/sdks/smartaccount/README.md +5 -9
  63. package/docs/sdks/token/README.md +24 -56
  64. package/docs/sdks/transactionbatching/README.md +25 -36
  65. package/docs/sdks/uniswapv3/README.md +60 -132
  66. package/docs/sdks/universal/README.md +50 -106
  67. package/jsr.json +1 -1
  68. package/package.json +1 -1
  69. package/src/funcs/transactionBatchingAaveLoop.ts +1 -1
  70. package/src/funcs/transactionBatchingAuthorization.ts +6 -6
  71. package/src/funcs/transactionBatchingExecute.ts +3 -2
  72. package/src/lib/config.ts +3 -3
  73. package/src/mcp-server/mcp-server.ts +1 -1
  74. package/src/mcp-server/server.ts +1 -1
  75. package/src/mcp-server/tools/transactionBatchingAaveLoop.ts +1 -1
  76. package/src/mcp-server/tools/transactionBatchingAuthorization.ts +6 -6
  77. package/src/mcp-server/tools/transactionBatchingExecute.ts +3 -2
  78. package/src/models/errors/apierror.ts +18 -3
  79. package/src/sdk/transactionbatching.ts +10 -9
package/FUNCTIONS.md CHANGED
@@ -21,7 +21,6 @@ specific category of applications.
21
21
  ```typescript
22
22
  import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
23
23
  import { aaveV3Rate } from "@compass-labs/api-sdk/funcs/aaveV3Rate.js";
24
- import { SDKValidationError } from "@compass-labs/api-sdk/models/errors/sdkvalidationerror.js";
25
24
 
26
25
  // Use `CompassApiSDKCore` for best tree-shaking performance.
27
26
  // You can create one instance of it to use across an application.
@@ -30,32 +29,13 @@ const compassApiSDK = new CompassApiSDKCore({
30
29
  });
31
30
 
32
31
  async function run() {
33
- const res = await aaveV3Rate(compassApiSDK, {
34
- chain: "arbitrum:mainnet",
35
- token: "USDC",
36
- });
37
-
38
- switch (true) {
39
- case res.ok:
40
- // The success case will be handled outside of the switch block
41
- break;
42
- case res.error instanceof SDKValidationError:
43
- // Pretty-print validation errors.
44
- return console.log(res.error.pretty());
45
- case res.error instanceof Error:
46
- return console.log(res.error);
47
- default:
48
- // TypeScript's type checking will fail on the following line if the above
49
- // cases were not exhaustive.
50
- res.error satisfies never;
51
- throw new Error("Assertion failed: expected error checks to be exhaustive: " + res.error);
32
+ const res = await aaveV3Rate(compassApiSDK, {});
33
+ if (res.ok) {
34
+ const { value: result } = res;
35
+ console.log(result);
36
+ } else {
37
+ console.log("aaveV3Rate failed:", res.error);
52
38
  }
53
-
54
-
55
- const { value: result } = res;
56
-
57
- // Handle the result
58
- console.log(result);
59
39
  }
60
40
 
61
41
  run();
package/README.md CHANGED
@@ -168,12 +168,8 @@ const compassApiSDK = new CompassApiSDK({
168
168
  });
169
169
 
170
170
  async function run() {
171
- const result = await compassApiSDK.aaveV3.rate({
172
- chain: "arbitrum:mainnet",
173
- token: "USDC",
174
- });
171
+ const result = await compassApiSDK.aaveV3.rate({});
175
172
 
176
- // Handle the result
177
173
  console.log(result);
178
174
  }
179
175
 
@@ -202,12 +198,8 @@ const compassApiSDK = new CompassApiSDK({
202
198
  });
203
199
 
204
200
  async function run() {
205
- const result = await compassApiSDK.aaveV3.rate({
206
- chain: "arbitrum:mainnet",
207
- token: "USDC",
208
- });
201
+ const result = await compassApiSDK.aaveV3.rate({});
209
202
 
210
- // Handle the result
211
203
  console.log(result);
212
204
  }
213
205
 
@@ -299,9 +291,9 @@ run();
299
291
 
300
292
  ### [transactionBatching](docs/sdks/transactionbatching/README.md)
301
293
 
302
- * [authorization](docs/sdks/transactionbatching/README.md#authorization) - Get EIP-7702 Authorization
303
- * [execute](docs/sdks/transactionbatching/README.md#execute) - Execute Tx Batching
304
- * [aaveLoop](docs/sdks/transactionbatching/README.md#aaveloop) - Execute Aave Loop Strategy
294
+ * [authorization](docs/sdks/transactionbatching/README.md#authorization) - Enable transaction bundling.
295
+ * [execute](docs/sdks/transactionbatching/README.md#execute) - Construct Bundled Transaction
296
+ * [aaveLoop](docs/sdks/transactionbatching/README.md#aaveloop) - AAVE leverage long/short
305
297
 
306
298
  ### [uniswapV3](docs/sdks/uniswapv3/README.md)
307
299
 
@@ -398,9 +390,9 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
398
390
  - [`tokenBalance`](docs/sdks/token/README.md#balance) - Token Balance
399
391
  - [`tokenPrice`](docs/sdks/token/README.md#price) - Token Price
400
392
  - [`tokenTransfer`](docs/sdks/token/README.md#transfer) - Transfer ETH or ERC20 Tokens.
401
- - [`transactionBatchingAaveLoop`](docs/sdks/transactionbatching/README.md#aaveloop) - Execute Aave Loop Strategy
402
- - [`transactionBatchingAuthorization`](docs/sdks/transactionbatching/README.md#authorization) - Get EIP-7702 Authorization
403
- - [`transactionBatchingExecute`](docs/sdks/transactionbatching/README.md#execute) - Execute Tx Batching
393
+ - [`transactionBatchingAaveLoop`](docs/sdks/transactionbatching/README.md#aaveloop) - AAVE leverage long/short
394
+ - [`transactionBatchingAuthorization`](docs/sdks/transactionbatching/README.md#authorization) - Enable transaction bundling.
395
+ - [`transactionBatchingExecute`](docs/sdks/transactionbatching/README.md#execute) - Construct Bundled Transaction
404
396
  - [`uniswapV3LiquidityProvisionIncrease`](docs/sdks/uniswapv3/README.md#liquidityprovisionincrease) - Increase an LP position
405
397
  - [`uniswapV3LiquidityProvisionInRange`](docs/sdks/uniswapv3/README.md#liquidityprovisioninrange) - Check if LP is active.
406
398
  - [`uniswapV3LiquidityProvisionMint`](docs/sdks/uniswapv3/README.md#liquidityprovisionmint) - Open a new LP position
@@ -437,10 +429,7 @@ const compassApiSDK = new CompassApiSDK({
437
429
  });
438
430
 
439
431
  async function run() {
440
- const result = await compassApiSDK.aaveV3.rate({
441
- chain: "arbitrum:mainnet",
442
- token: "USDC",
443
- }, {
432
+ const result = await compassApiSDK.aaveV3.rate({}, {
444
433
  retries: {
445
434
  strategy: "backoff",
446
435
  backoff: {
@@ -453,7 +442,6 @@ async function run() {
453
442
  },
454
443
  });
455
444
 
456
- // Handle the result
457
445
  console.log(result);
458
446
  }
459
447
 
@@ -480,12 +468,8 @@ const compassApiSDK = new CompassApiSDK({
480
468
  });
481
469
 
482
470
  async function run() {
483
- const result = await compassApiSDK.aaveV3.rate({
484
- chain: "arbitrum:mainnet",
485
- token: "USDC",
486
- });
471
+ const result = await compassApiSDK.aaveV3.rate({});
487
472
 
488
- // Handle the result
489
473
  console.log(result);
490
474
  }
491
475
 
@@ -497,55 +481,45 @@ run();
497
481
  <!-- Start Error Handling [errors] -->
498
482
  ## Error Handling
499
483
 
500
- Some methods specify known errors which can be thrown. All the known errors are enumerated in the `models/errors/errors.ts` module. The known errors for a method are documented under the *Errors* tables in SDK docs. For example, the `rate` method may throw the following errors:
484
+ This table shows properties which are common on error classes. For full details see [error classes](#error-classes).
501
485
 
502
- | Error Type | Status Code | Content Type |
503
- | -------------------------- | ----------- | ---------------- |
504
- | errors.HTTPValidationError | 422 | application/json |
505
- | errors.APIError | 4XX, 5XX | \*/\* |
506
-
507
- If the method throws an error and it is not captured by the known errors, it will default to throwing a `APIError`.
486
+ | Property | Type | Description |
487
+ | ------------------- | ---------- | --------------------------------------------------------------------------------------- |
488
+ | `error.name` | `string` | Error class name eg `APIError` |
489
+ | `error.message` | `string` | Error message |
490
+ | `error.statusCode` | `number` | HTTP status code eg `404` |
491
+ | `error.contentType` | `string` | HTTP content type eg `application/json` |
492
+ | `error.body` | `string` | HTTP body. Can be empty string if no body is returned. |
493
+ | `error.rawResponse` | `Response` | Raw HTTP response. Access to headers and more. |
494
+ | `error.data$` | | Optional. Some errors may contain structured data. [See Error Classes](#error-classes). |
508
495
 
496
+ ### Example
509
497
  ```typescript
510
498
  import { CompassApiSDK } from "@compass-labs/api-sdk";
511
- import {
512
- HTTPValidationError,
513
- SDKValidationError,
514
- } from "@compass-labs/api-sdk/models/errors";
499
+ import * as errors from "@compass-labs/api-sdk/models/errors";
515
500
 
516
501
  const compassApiSDK = new CompassApiSDK({
517
502
  apiKeyAuth: "<YOUR_API_KEY_HERE>",
518
503
  });
519
504
 
520
505
  async function run() {
521
- let result;
522
506
  try {
523
- result = await compassApiSDK.aaveV3.rate({
524
- chain: "arbitrum:mainnet",
525
- token: "USDC",
526
- });
507
+ const result = await compassApiSDK.aaveV3.rate({});
527
508
 
528
- // Handle the result
529
509
  console.log(result);
530
- } catch (err) {
531
- switch (true) {
532
- // The server response does not match the expected SDK schema
533
- case (err instanceof SDKValidationError): {
534
- // Pretty-print will provide a human-readable multi-line error message
535
- console.error(err.pretty());
536
- // Raw value may also be inspected
537
- console.error(err.rawValue);
538
- return;
539
- }
540
- case (err instanceof HTTPValidationError): {
541
- // Handle err.data$: HTTPValidationErrorData
542
- console.error(err);
543
- return;
544
- }
545
- default: {
546
- // Other errors such as network errors, see HTTPClientErrors for more details
547
- throw err;
548
- }
510
+ } catch (error) {
511
+ // Depending on the method different errors may be thrown
512
+ if (error instanceof errors.HTTPValidationError) {
513
+ console.log(error.message);
514
+ console.log(error.data$.detail); // ValidationError[]
515
+ }
516
+
517
+ // Fallback error class, if no other more specific error class is matched
518
+ if (error instanceof errors.APIError) {
519
+ console.log(error.message);
520
+ console.log(error.statusCode);
521
+ console.log(error.body);
522
+ console.log(error.rawResponse.headers);
549
523
  }
550
524
  }
551
525
  }
@@ -554,17 +528,16 @@ run();
554
528
 
555
529
  ```
556
530
 
557
- Validation errors can also occur when either method arguments or data returned from the server do not match the expected format. The `SDKValidationError` that is thrown as a result will capture the raw value that failed validation in an attribute called `rawValue`. Additionally, a `pretty()` method is available on this error that can be used to log a nicely formatted multi-line string since validation errors can list many issues and the plain error string may be difficult read when debugging.
558
-
559
- In some rare cases, the SDK can fail to get a response from the server or even make the request due to unexpected circumstances such as network conditions. These types of errors are captured in the `models/errors/httpclienterrors.ts` module:
560
-
561
- | HTTP Client Error | Description |
562
- | ---------------------------------------------------- | ---------------------------------------------------- |
563
- | RequestAbortedError | HTTP request was aborted by the client |
564
- | RequestTimeoutError | HTTP request timed out due to an AbortSignal signal |
565
- | ConnectionError | HTTP client was unable to make a request to a server |
566
- | InvalidRequestError | Any input used to create a request is invalid |
567
- | UnexpectedClientError | Unrecognised or unexpected error |
531
+ ### Error Classes
532
+ * [`HTTPValidationError`](docs/models/errors/httpvalidationerror.md): Validation Error. Status code `422`.
533
+ * `APIError`: The fallback error class, if no other more specific error class is matched.
534
+ * `SDKValidationError`: Type mismatch between the data returned from the server and the structure expected by the SDK. This can also be thrown for invalid method arguments. See `error.rawValue` for the raw value and `error.pretty()` for a nicely formatted multi-line string.
535
+ * Network errors:
536
+ * `ConnectionError`: HTTP client was unable to make a request to a server.
537
+ * `RequestTimeoutError`: HTTP request timed out due to an AbortSignal signal.
538
+ * `RequestAbortedError`: HTTP request was aborted by the client.
539
+ * `InvalidRequestError`: Any input used to create a request is invalid.
540
+ * `UnexpectedClientError`: Unrecognised or unexpected error.
568
541
  <!-- End Error Handling [errors] -->
569
542
 
570
543
  <!-- Start Server Selection [server] -->
@@ -582,12 +555,8 @@ const compassApiSDK = new CompassApiSDK({
582
555
  });
583
556
 
584
557
  async function run() {
585
- const result = await compassApiSDK.aaveV3.rate({
586
- chain: "arbitrum:mainnet",
587
- token: "USDC",
588
- });
558
+ const result = await compassApiSDK.aaveV3.rate({});
589
559
 
590
- // Handle the result
591
560
  console.log(result);
592
561
  }
593
562
 
package/bin/mcp-server.js CHANGED
@@ -34205,9 +34205,9 @@ var init_config = __esm(() => {
34205
34205
  SDK_METADATA = {
34206
34206
  language: "typescript",
34207
34207
  openapiDocVersion: "0.0.1",
34208
- sdkVersion: "0.5.6",
34209
- genVersion: "2.618.0",
34210
- userAgent: "speakeasy-sdk/typescript 0.5.6 2.618.0 0.0.1 @compass-labs/api-sdk"
34208
+ sdkVersion: "0.5.8",
34209
+ genVersion: "2.620.2",
34210
+ userAgent: "speakeasy-sdk/typescript 0.5.8 2.620.2 0.0.1 @compass-labs/api-sdk"
34211
34211
  };
34212
34212
  });
34213
34213
 
@@ -35130,18 +35130,18 @@ var init_tools = __esm(() => {
35130
35130
  var APIError;
35131
35131
  var init_apierror = __esm(() => {
35132
35132
  APIError = class APIError extends Error {
35133
- rawResponse;
35134
- body;
35135
35133
  statusCode;
35136
35134
  contentType;
35135
+ body;
35136
+ rawResponse;
35137
35137
  constructor(message, rawResponse, body = "") {
35138
35138
  const statusCode = rawResponse.status;
35139
35139
  const contentType2 = rawResponse.headers.get("content-type") || "";
35140
35140
  const bodyString = body.length > 0 ? `
35141
35141
  ${body}` : "";
35142
35142
  super(`${message}: Status ${statusCode} Content-Type ${contentType2} Body ${bodyString}`);
35143
- this.rawResponse = rawResponse;
35144
35143
  this.body = body;
35144
+ this.rawResponse = rawResponse;
35145
35145
  this.statusCode = statusCode;
35146
35146
  this.contentType = contentType2;
35147
35147
  this.name = "APIError";
@@ -50788,7 +50788,7 @@ var init_transactionBatchingAaveLoop2 = __esm(() => {
50788
50788
  };
50789
50789
  tool$transactionBatchingAaveLoop = {
50790
50790
  name: "transaction-batching-aave-loop",
50791
- description: `Execute Aave Loop Strategy
50791
+ description: `AAVE leverage long/short
50792
50792
 
50793
50793
  Execute an Aave looping strategy that involves repeated supply and borrow
50794
50794
  operations.
@@ -50901,14 +50901,14 @@ var init_transactionBatchingAuthorization2 = __esm(() => {
50901
50901
  };
50902
50902
  tool$transactionBatchingAuthorization = {
50903
50903
  name: "transaction-batching-authorization",
50904
- description: `Get EIP-7702 Authorization
50904
+ description: `Enable transaction bundling.
50905
50905
 
50906
- Get authorization data for EIP-7702 batching operations.
50906
+ Get authorization for bundling transactions.
50907
50907
 
50908
- This authorization is required to prevent replay attacks and ensure transaction
50909
- ordering when batching multiple actions into a single transaction. The authorization
50910
- includes a nonce and chain ID to guarantee transaction uniqueness and proper network
50911
- targeting.`,
50908
+ Currently this is required for every transaction bundle to prevent replay attacks
50909
+ and ensure transaction ordering when batching multiple actions into a single
50910
+ transaction. The authorization includes a nonce and chain ID to guarantee
50911
+ transaction uniqueness and proper network targeting.`,
50912
50912
  args: args55,
50913
50913
  tool: async (client, args56, ctx) => {
50914
50914
  const [result, apiCall] = await transactionBatchingAuthorization(client, args56.request, { fetchOptions: { signal: ctx.signal } }).$inspect();
@@ -51009,9 +51009,10 @@ var init_transactionBatchingExecute2 = __esm(() => {
51009
51009
  };
51010
51010
  tool$transactionBatchingExecute = {
51011
51011
  name: "transaction-batching-execute",
51012
- description: `Execute Tx Batching
51012
+ description: `Construct Bundled Transaction
51013
51013
 
51014
- Execute a batch of transactions in a single multicall using EIP-7702.
51014
+ Bundle arbitrary transactions together into a single multicall transaction using
51015
+ EIP-7702.
51015
51016
 
51016
51017
  This endpoint allows bundling multiple contract calls into a single atomic
51017
51018
  transaction, reducing gas costs and ensuring all operations succeed or fail
@@ -53043,7 +53044,7 @@ it to be traded on DeFi protocols.`,
53043
53044
  function createMCPServer(deps) {
53044
53045
  const server = new McpServer({
53045
53046
  name: "CompassApiSDK",
53046
- version: "0.5.6"
53047
+ version: "0.5.8"
53047
53048
  });
53048
53049
  const client = new CompassApiSDKCore({
53049
53050
  apiKeyAuth: deps.apiKeyAuth,
@@ -54402,7 +54403,7 @@ var routes = an({
54402
54403
  var app = He(routes, {
54403
54404
  name: "mcp",
54404
54405
  versionInfo: {
54405
- currentVersion: "0.5.6"
54406
+ currentVersion: "0.5.8"
54406
54407
  }
54407
54408
  });
54408
54409
  zt(app, process3.argv.slice(2), buildContext(process3));
@@ -54410,5 +54411,5 @@ export {
54410
54411
  app
54411
54412
  };
54412
54413
 
54413
- //# debugId=75BDCA259F34292264756E2164756E21
54414
+ //# debugId=D98B0B01A5F7083564756E2164756E21
54414
54415
  //# sourceMappingURL=mcp-server.js.map