@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
@@ -31,11 +31,8 @@ const compassApiSDK = new CompassApiSDK({
31
31
  });
32
32
 
33
33
  async function run() {
34
- const result = await compassApiSDK.universal.portfolio({
35
- chain: "arbitrum:mainnet",
36
- });
34
+ const result = await compassApiSDK.universal.portfolio({});
37
35
 
38
- // Handle the result
39
36
  console.log(result);
40
37
  }
41
38
 
@@ -57,18 +54,13 @@ const compassApiSDK = new CompassApiSDKCore({
57
54
  });
58
55
 
59
56
  async function run() {
60
- const res = await universalPortfolio(compassApiSDK, {
61
- chain: "arbitrum:mainnet",
62
- });
63
-
64
- if (!res.ok) {
65
- throw res.error;
57
+ const res = await universalPortfolio(compassApiSDK, {});
58
+ if (res.ok) {
59
+ const { value: result } = res;
60
+ console.log(result);
61
+ } else {
62
+ console.log("universalPortfolio failed:", res.error);
66
63
  }
67
-
68
- const { value: result } = res;
69
-
70
- // Handle the result
71
- console.log(result);
72
64
  }
73
65
 
74
66
  run();
@@ -112,11 +104,8 @@ const compassApiSDK = new CompassApiSDK({
112
104
  });
113
105
 
114
106
  async function run() {
115
- const result = await compassApiSDK.universal.visualizePortfolio({
116
- chain: "arbitrum:mainnet",
117
- });
107
+ const result = await compassApiSDK.universal.visualizePortfolio({});
118
108
 
119
- // Handle the result
120
109
  console.log(result);
121
110
  }
122
111
 
@@ -138,18 +127,13 @@ const compassApiSDK = new CompassApiSDKCore({
138
127
  });
139
128
 
140
129
  async function run() {
141
- const res = await universalVisualizePortfolio(compassApiSDK, {
142
- chain: "arbitrum:mainnet",
143
- });
144
-
145
- if (!res.ok) {
146
- throw res.error;
130
+ const res = await universalVisualizePortfolio(compassApiSDK, {});
131
+ if (res.ok) {
132
+ const { value: result } = res;
133
+ console.log(result);
134
+ } else {
135
+ console.log("universalVisualizePortfolio failed:", res.error);
147
136
  }
148
-
149
- const { value: result } = res;
150
-
151
- // Handle the result
152
- console.log(result);
153
137
  }
154
138
 
155
139
  run();
@@ -189,11 +173,8 @@ const compassApiSDK = new CompassApiSDK({
189
173
  });
190
174
 
191
175
  async function run() {
192
- const result = await compassApiSDK.universal.supportedTokens({
193
- chain: "arbitrum:mainnet",
194
- });
176
+ const result = await compassApiSDK.universal.supportedTokens({});
195
177
 
196
- // Handle the result
197
178
  console.log(result);
198
179
  }
199
180
 
@@ -215,18 +196,13 @@ const compassApiSDK = new CompassApiSDKCore({
215
196
  });
216
197
 
217
198
  async function run() {
218
- const res = await universalSupportedTokens(compassApiSDK, {
219
- chain: "arbitrum:mainnet",
220
- });
221
-
222
- if (!res.ok) {
223
- throw res.error;
199
+ const res = await universalSupportedTokens(compassApiSDK, {});
200
+ if (res.ok) {
201
+ const { value: result } = res;
202
+ console.log(result);
203
+ } else {
204
+ console.log("universalSupportedTokens failed:", res.error);
224
205
  }
225
-
226
- const { value: result } = res;
227
-
228
- // Handle the result
229
- console.log(result);
230
206
  }
231
207
 
232
208
  run();
@@ -272,13 +248,8 @@ const compassApiSDK = new CompassApiSDK({
272
248
  });
273
249
 
274
250
  async function run() {
275
- const result = await compassApiSDK.universal.allowance({
276
- chain: "arbitrum:mainnet",
277
- token: "USDC",
278
- contractName: "AaveV3Pool",
279
- });
251
+ const result = await compassApiSDK.universal.allowance({});
280
252
 
281
- // Handle the result
282
253
  console.log(result);
283
254
  }
284
255
 
@@ -300,20 +271,13 @@ const compassApiSDK = new CompassApiSDKCore({
300
271
  });
301
272
 
302
273
  async function run() {
303
- const res = await universalAllowance(compassApiSDK, {
304
- chain: "arbitrum:mainnet",
305
- token: "USDC",
306
- contractName: "AaveV3Pool",
307
- });
308
-
309
- if (!res.ok) {
310
- throw res.error;
274
+ const res = await universalAllowance(compassApiSDK, {});
275
+ if (res.ok) {
276
+ const { value: result } = res;
277
+ console.log(result);
278
+ } else {
279
+ console.log("universalAllowance failed:", res.error);
311
280
  }
312
-
313
- const { value: result } = res;
314
-
315
- // Handle the result
316
- console.log(result);
317
281
  }
318
282
 
319
283
  run();
@@ -356,11 +320,8 @@ const compassApiSDK = new CompassApiSDK({
356
320
  });
357
321
 
358
322
  async function run() {
359
- const result = await compassApiSDK.universal.ens({
360
- chain: "ethereum:mainnet",
361
- });
323
+ const result = await compassApiSDK.universal.ens({});
362
324
 
363
- // Handle the result
364
325
  console.log(result);
365
326
  }
366
327
 
@@ -382,18 +343,13 @@ const compassApiSDK = new CompassApiSDKCore({
382
343
  });
383
344
 
384
345
  async function run() {
385
- const res = await universalEns(compassApiSDK, {
386
- chain: "ethereum:mainnet",
387
- });
388
-
389
- if (!res.ok) {
390
- throw res.error;
346
+ const res = await universalEns(compassApiSDK, {});
347
+ if (res.ok) {
348
+ const { value: result } = res;
349
+ console.log(result);
350
+ } else {
351
+ console.log("universalEns failed:", res.error);
391
352
  }
392
-
393
- const { value: result } = res;
394
-
395
- // Handle the result
396
- console.log(result);
397
353
  }
398
354
 
399
355
  run();
@@ -440,7 +396,6 @@ async function run() {
440
396
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
441
397
  });
442
398
 
443
- // Handle the result
444
399
  console.log(result);
445
400
  }
446
401
 
@@ -467,15 +422,12 @@ async function run() {
467
422
  chain: "arbitrum:mainnet",
468
423
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
469
424
  });
470
-
471
- if (!res.ok) {
472
- throw res.error;
425
+ if (res.ok) {
426
+ const { value: result } = res;
427
+ console.log(result);
428
+ } else {
429
+ console.log("universalWrapEth failed:", res.error);
473
430
  }
474
-
475
- const { value: result } = res;
476
-
477
- // Handle the result
478
- console.log(result);
479
431
  }
480
432
 
481
433
  run();
@@ -522,7 +474,6 @@ async function run() {
522
474
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
523
475
  });
524
476
 
525
- // Handle the result
526
477
  console.log(result);
527
478
  }
528
479
 
@@ -549,15 +500,12 @@ async function run() {
549
500
  chain: "arbitrum:mainnet",
550
501
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
551
502
  });
552
-
553
- if (!res.ok) {
554
- throw res.error;
503
+ if (res.ok) {
504
+ const { value: result } = res;
505
+ console.log(result);
506
+ } else {
507
+ console.log("universalUnwrapWeth failed:", res.error);
555
508
  }
556
-
557
- const { value: result } = res;
558
-
559
- // Handle the result
560
- console.log(result);
561
509
  }
562
510
 
563
511
  run();
@@ -611,7 +559,6 @@ async function run() {
611
559
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
612
560
  });
613
561
 
614
- // Handle the result
615
562
  console.log(result);
616
563
  }
617
564
 
@@ -640,15 +587,12 @@ async function run() {
640
587
  chain: "base:mainnet",
641
588
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
642
589
  });
643
-
644
- if (!res.ok) {
645
- throw res.error;
590
+ if (res.ok) {
591
+ const { value: result } = res;
592
+ console.log(result);
593
+ } else {
594
+ console.log("universalAllowanceSet failed:", res.error);
646
595
  }
647
-
648
- const { value: result } = res;
649
-
650
- // Handle the result
651
- console.log(result);
652
596
  }
653
597
 
654
598
  run();
package/jsr.json CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  {
4
4
  "name": "@compass-labs/api-sdk",
5
- "version": "0.5.6",
5
+ "version": "0.5.8",
6
6
  "exports": {
7
7
  ".": "./src/index.ts",
8
8
  "./models/errors": "./src/models/errors/index.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compass-labs/api-sdk",
3
- "version": "0.5.6",
3
+ "version": "0.5.8",
4
4
  "author": "royalnine",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,7 @@ import { APICall, APIPromise } from "../types/async.js";
25
25
  import { Result } from "../types/fp.js";
26
26
 
27
27
  /**
28
- * Execute Aave Loop Strategy
28
+ * AAVE leverage long/short
29
29
  *
30
30
  * @remarks
31
31
  * Execute an Aave looping strategy that involves repeated supply and borrow
@@ -25,15 +25,15 @@ import { APICall, APIPromise } from "../types/async.js";
25
25
  import { Result } from "../types/fp.js";
26
26
 
27
27
  /**
28
- * Get EIP-7702 Authorization
28
+ * Enable transaction bundling.
29
29
  *
30
30
  * @remarks
31
- * Get authorization data for EIP-7702 batching operations.
31
+ * Get authorization for bundling transactions.
32
32
  *
33
- * This authorization is required to prevent replay attacks and ensure transaction
34
- * ordering when batching multiple actions into a single transaction. The authorization
35
- * includes a nonce and chain ID to guarantee transaction uniqueness and proper network
36
- * targeting.
33
+ * Currently this is required for every transaction bundle to prevent replay attacks
34
+ * and ensure transaction ordering when batching multiple actions into a single
35
+ * transaction. The authorization includes a nonce and chain ID to guarantee
36
+ * transaction uniqueness and proper network targeting.
37
37
  */
38
38
  export function transactionBatchingAuthorization(
39
39
  client: CompassApiSDKCore,
@@ -25,10 +25,11 @@ import { APICall, APIPromise } from "../types/async.js";
25
25
  import { Result } from "../types/fp.js";
26
26
 
27
27
  /**
28
- * Execute Tx Batching
28
+ * Construct Bundled Transaction
29
29
  *
30
30
  * @remarks
31
- * Execute a batch of transactions in a single multicall using EIP-7702.
31
+ * Bundle arbitrary transactions together into a single multicall transaction using
32
+ * EIP-7702.
32
33
  *
33
34
  * This endpoint allows bundling multiple contract calls into a single atomic
34
35
  * transaction, reducing gas costs and ensuring all operations succeed or fail
package/src/lib/config.ts CHANGED
@@ -61,8 +61,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
61
61
  export const SDK_METADATA = {
62
62
  language: "typescript",
63
63
  openapiDocVersion: "0.0.1",
64
- sdkVersion: "0.5.6",
65
- genVersion: "2.618.0",
64
+ sdkVersion: "0.5.8",
65
+ genVersion: "2.620.2",
66
66
  userAgent:
67
- "speakeasy-sdk/typescript 0.5.6 2.618.0 0.0.1 @compass-labs/api-sdk",
67
+ "speakeasy-sdk/typescript 0.5.8 2.620.2 0.0.1 @compass-labs/api-sdk",
68
68
  } as const;
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "0.5.6",
22
+ currentVersion: "0.5.8",
23
23
  },
24
24
  });
25
25
 
@@ -98,7 +98,7 @@ export function createMCPServer(deps: {
98
98
  }) {
99
99
  const server = new McpServer({
100
100
  name: "CompassApiSDK",
101
- version: "0.5.6",
101
+ version: "0.5.8",
102
102
  });
103
103
 
104
104
  const client = new CompassApiSDKCore({
@@ -12,7 +12,7 @@ const args = {
12
12
 
13
13
  export const tool$transactionBatchingAaveLoop: ToolDefinition<typeof args> = {
14
14
  name: "transaction-batching-aave-loop",
15
- description: `Execute Aave Loop Strategy
15
+ description: `AAVE leverage long/short
16
16
 
17
17
  Execute an Aave looping strategy that involves repeated supply and borrow
18
18
  operations.
@@ -14,14 +14,14 @@ export const tool$transactionBatchingAuthorization: ToolDefinition<
14
14
  typeof args
15
15
  > = {
16
16
  name: "transaction-batching-authorization",
17
- description: `Get EIP-7702 Authorization
17
+ description: `Enable transaction bundling.
18
18
 
19
- Get authorization data for EIP-7702 batching operations.
19
+ Get authorization for bundling transactions.
20
20
 
21
- This authorization is required to prevent replay attacks and ensure transaction
22
- ordering when batching multiple actions into a single transaction. The authorization
23
- includes a nonce and chain ID to guarantee transaction uniqueness and proper network
24
- targeting.`,
21
+ Currently this is required for every transaction bundle to prevent replay attacks
22
+ and ensure transaction ordering when batching multiple actions into a single
23
+ transaction. The authorization includes a nonce and chain ID to guarantee
24
+ transaction uniqueness and proper network targeting.`,
25
25
  args,
26
26
  tool: async (client, args, ctx) => {
27
27
  const [result, apiCall] = await transactionBatchingAuthorization(
@@ -12,9 +12,10 @@ const args = {
12
12
 
13
13
  export const tool$transactionBatchingExecute: ToolDefinition<typeof args> = {
14
14
  name: "transaction-batching-execute",
15
- description: `Execute Tx Batching
15
+ description: `Construct Bundled Transaction
16
16
 
17
- Execute a batch of transactions in a single multicall using EIP-7702.
17
+ Bundle arbitrary transactions together into a single multicall transaction using
18
+ EIP-7702.
18
19
 
19
20
  This endpoint allows bundling multiple contract calls into a single atomic
20
21
  transaction, reducing gas costs and ensuring all operations succeed or fail
@@ -3,22 +3,37 @@
3
3
  */
4
4
 
5
5
  export class APIError extends Error {
6
+ /**
7
+ * HTTP status code
8
+ */
6
9
  public readonly statusCode: number;
10
+ /**
11
+ * HTTP content type
12
+ */
7
13
  public readonly contentType: string;
14
+ /**
15
+ * HTTP body
16
+ */
17
+ public readonly body: string;
18
+ /**
19
+ * Raw response
20
+ */
21
+ public readonly rawResponse: Response;
8
22
 
9
23
  constructor(
10
24
  message: string,
11
- public readonly rawResponse: Response,
12
- public readonly body: string = "",
25
+ rawResponse: Response,
26
+ body: string = "",
13
27
  ) {
14
28
  const statusCode = rawResponse.status;
15
29
  const contentType = rawResponse.headers.get("content-type") || "";
16
30
  const bodyString = body.length > 0 ? `\n${body}` : "";
17
-
18
31
  super(
19
32
  `${message}: Status ${statusCode} Content-Type ${contentType} Body ${bodyString}`,
20
33
  );
21
34
 
35
+ this.body = body;
36
+ this.rawResponse = rawResponse;
22
37
  this.statusCode = statusCode;
23
38
  this.contentType = contentType;
24
39
 
@@ -11,15 +11,15 @@ import { unwrapAsync } from "../types/fp.js";
11
11
 
12
12
  export class TransactionBatching extends ClientSDK {
13
13
  /**
14
- * Get EIP-7702 Authorization
14
+ * Enable transaction bundling.
15
15
  *
16
16
  * @remarks
17
- * Get authorization data for EIP-7702 batching operations.
17
+ * Get authorization for bundling transactions.
18
18
  *
19
- * This authorization is required to prevent replay attacks and ensure transaction
20
- * ordering when batching multiple actions into a single transaction. The authorization
21
- * includes a nonce and chain ID to guarantee transaction uniqueness and proper network
22
- * targeting.
19
+ * Currently this is required for every transaction bundle to prevent replay attacks
20
+ * and ensure transaction ordering when batching multiple actions into a single
21
+ * transaction. The authorization includes a nonce and chain ID to guarantee
22
+ * transaction uniqueness and proper network targeting.
23
23
  */
24
24
  async authorization(
25
25
  request: components.MulticallAuthorizationRequest,
@@ -33,10 +33,11 @@ export class TransactionBatching extends ClientSDK {
33
33
  }
34
34
 
35
35
  /**
36
- * Execute Tx Batching
36
+ * Construct Bundled Transaction
37
37
  *
38
38
  * @remarks
39
- * Execute a batch of transactions in a single multicall using EIP-7702.
39
+ * Bundle arbitrary transactions together into a single multicall transaction using
40
+ * EIP-7702.
40
41
  *
41
42
  * This endpoint allows bundling multiple contract calls into a single atomic
42
43
  * transaction, reducing gas costs and ensuring all operations succeed or fail
@@ -55,7 +56,7 @@ export class TransactionBatching extends ClientSDK {
55
56
  }
56
57
 
57
58
  /**
58
- * Execute Aave Loop Strategy
59
+ * AAVE leverage long/short
59
60
  *
60
61
  * @remarks
61
62
  * Execute an Aave looping strategy that involves repeated supply and borrow