@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
@@ -5,18 +5,18 @@
5
5
 
6
6
  ### Available Operations
7
7
 
8
- * [authorization](#authorization) - Get EIP-7702 Authorization
9
- * [execute](#execute) - Execute Tx Batching
10
- * [aaveLoop](#aaveloop) - Execute Aave Loop Strategy
8
+ * [authorization](#authorization) - Enable transaction bundling.
9
+ * [execute](#execute) - Construct Bundled Transaction
10
+ * [aaveLoop](#aaveloop) - AAVE leverage long/short
11
11
 
12
12
  ## authorization
13
13
 
14
- Get authorization data for EIP-7702 batching operations.
14
+ Get authorization for bundling transactions.
15
15
 
16
- This authorization is required to prevent replay attacks and ensure transaction
17
- ordering when batching multiple actions into a single transaction. The authorization
18
- includes a nonce and chain ID to guarantee transaction uniqueness and proper network
19
- targeting.
16
+ Currently this is required for every transaction bundle to prevent replay attacks
17
+ and ensure transaction ordering when batching multiple actions into a single
18
+ transaction. The authorization includes a nonce and chain ID to guarantee
19
+ transaction uniqueness and proper network targeting.
20
20
 
21
21
  ### Example Usage
22
22
 
@@ -33,7 +33,6 @@ async function run() {
33
33
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
34
34
  });
35
35
 
36
- // Handle the result
37
36
  console.log(result);
38
37
  }
39
38
 
@@ -59,15 +58,12 @@ async function run() {
59
58
  chain: "ethereum:mainnet",
60
59
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
61
60
  });
62
-
63
- if (!res.ok) {
64
- throw res.error;
61
+ if (res.ok) {
62
+ const { value: result } = res;
63
+ console.log(result);
64
+ } else {
65
+ console.log("transactionBatchingAuthorization failed:", res.error);
65
66
  }
66
-
67
- const { value: result } = res;
68
-
69
- // Handle the result
70
- console.log(result);
71
67
  }
72
68
 
73
69
  run();
@@ -95,7 +91,8 @@ run();
95
91
 
96
92
  ## execute
97
93
 
98
- Execute a batch of transactions in a single multicall using EIP-7702.
94
+ Bundle arbitrary transactions together into a single multicall transaction using
95
+ EIP-7702.
99
96
 
100
97
  This endpoint allows bundling multiple contract calls into a single atomic
101
98
  transaction, reducing gas costs and ensuring all operations succeed or fail
@@ -134,7 +131,6 @@ async function run() {
134
131
  ],
135
132
  });
136
133
 
137
- // Handle the result
138
134
  console.log(result);
139
135
  }
140
136
 
@@ -177,15 +173,12 @@ async function run() {
177
173
  },
178
174
  ],
179
175
  });
180
-
181
- if (!res.ok) {
182
- throw res.error;
176
+ if (res.ok) {
177
+ const { value: result } = res;
178
+ console.log(result);
179
+ } else {
180
+ console.log("transactionBatchingExecute failed:", res.error);
183
181
  }
184
-
185
- const { value: result } = res;
186
-
187
- // Handle the result
188
- console.log(result);
189
182
  }
190
183
 
191
184
  run();
@@ -254,7 +247,6 @@ async function run() {
254
247
  loanToValue: 20.5,
255
248
  });
256
249
 
257
- // Handle the result
258
250
  console.log(result);
259
251
  }
260
252
 
@@ -294,15 +286,12 @@ async function run() {
294
286
  maxSlippagePercent: 2.5,
295
287
  loanToValue: 20.5,
296
288
  });
297
-
298
- if (!res.ok) {
299
- throw res.error;
289
+ if (res.ok) {
290
+ const { value: result } = res;
291
+ console.log(result);
292
+ } else {
293
+ console.log("transactionBatchingAaveLoop failed:", res.error);
300
294
  }
301
-
302
- const { value: result } = res;
303
-
304
- // Handle the result
305
- console.log(result);
306
295
  }
307
296
 
308
297
  run();
@@ -35,14 +35,9 @@ const compassApiSDK = new CompassApiSDK({
35
35
 
36
36
  async function run() {
37
37
  const result = await compassApiSDK.uniswapV3.quoteBuyExactly({
38
- chain: "arbitrum:mainnet",
39
- tokenIn: "USDC",
40
- tokenOut: "USDT",
41
- fee: "0.01",
42
38
  amountOut: "<value>",
43
39
  });
44
40
 
45
- // Handle the result
46
41
  console.log(result);
47
42
  }
48
43
 
@@ -65,21 +60,14 @@ const compassApiSDK = new CompassApiSDKCore({
65
60
 
66
61
  async function run() {
67
62
  const res = await uniswapV3QuoteBuyExactly(compassApiSDK, {
68
- chain: "arbitrum:mainnet",
69
- tokenIn: "USDC",
70
- tokenOut: "USDT",
71
- fee: "0.01",
72
63
  amountOut: "<value>",
73
64
  });
74
-
75
- if (!res.ok) {
76
- throw res.error;
65
+ if (res.ok) {
66
+ const { value: result } = res;
67
+ console.log(result);
68
+ } else {
69
+ console.log("uniswapV3QuoteBuyExactly failed:", res.error);
77
70
  }
78
-
79
- const { value: result } = res;
80
-
81
- // Handle the result
82
- console.log(result);
83
71
  }
84
72
 
85
73
  run();
@@ -124,14 +112,9 @@ const compassApiSDK = new CompassApiSDK({
124
112
 
125
113
  async function run() {
126
114
  const result = await compassApiSDK.uniswapV3.quoteSellExactly({
127
- chain: "arbitrum:mainnet",
128
- tokenIn: "USDC",
129
- tokenOut: "USDT",
130
- fee: "0.01",
131
115
  amountIn: "<value>",
132
116
  });
133
117
 
134
- // Handle the result
135
118
  console.log(result);
136
119
  }
137
120
 
@@ -154,21 +137,14 @@ const compassApiSDK = new CompassApiSDKCore({
154
137
 
155
138
  async function run() {
156
139
  const res = await uniswapV3QuoteSellExactly(compassApiSDK, {
157
- chain: "arbitrum:mainnet",
158
- tokenIn: "USDC",
159
- tokenOut: "USDT",
160
- fee: "0.01",
161
140
  amountIn: "<value>",
162
141
  });
163
-
164
- if (!res.ok) {
165
- throw res.error;
142
+ if (res.ok) {
143
+ const { value: result } = res;
144
+ console.log(result);
145
+ } else {
146
+ console.log("uniswapV3QuoteSellExactly failed:", res.error);
166
147
  }
167
-
168
- const { value: result } = res;
169
-
170
- // Handle the result
171
- console.log(result);
172
148
  }
173
149
 
174
150
  run();
@@ -210,14 +186,8 @@ const compassApiSDK = new CompassApiSDK({
210
186
  });
211
187
 
212
188
  async function run() {
213
- const result = await compassApiSDK.uniswapV3.poolPrice({
214
- chain: "arbitrum:mainnet",
215
- tokenIn: "USDC",
216
- tokenOut: "USDT",
217
- fee: "0.01",
218
- });
189
+ const result = await compassApiSDK.uniswapV3.poolPrice({});
219
190
 
220
- // Handle the result
221
191
  console.log(result);
222
192
  }
223
193
 
@@ -239,21 +209,13 @@ const compassApiSDK = new CompassApiSDKCore({
239
209
  });
240
210
 
241
211
  async function run() {
242
- const res = await uniswapV3PoolPrice(compassApiSDK, {
243
- chain: "arbitrum:mainnet",
244
- tokenIn: "USDC",
245
- tokenOut: "USDT",
246
- fee: "0.01",
247
- });
248
-
249
- if (!res.ok) {
250
- throw res.error;
212
+ const res = await uniswapV3PoolPrice(compassApiSDK, {});
213
+ if (res.ok) {
214
+ const { value: result } = res;
215
+ console.log(result);
216
+ } else {
217
+ console.log("uniswapV3PoolPrice failed:", res.error);
251
218
  }
252
-
253
- const { value: result } = res;
254
-
255
- // Handle the result
256
- console.log(result);
257
219
  }
258
220
 
259
221
  run();
@@ -300,12 +262,8 @@ const compassApiSDK = new CompassApiSDK({
300
262
  });
301
263
 
302
264
  async function run() {
303
- const result = await compassApiSDK.uniswapV3.liquidityProvisionInRange({
304
- chain: "arbitrum:mainnet",
305
- tokenId: 4318185,
306
- });
265
+ const result = await compassApiSDK.uniswapV3.liquidityProvisionInRange({});
307
266
 
308
- // Handle the result
309
267
  console.log(result);
310
268
  }
311
269
 
@@ -327,19 +285,13 @@ const compassApiSDK = new CompassApiSDKCore({
327
285
  });
328
286
 
329
287
  async function run() {
330
- const res = await uniswapV3LiquidityProvisionInRange(compassApiSDK, {
331
- chain: "arbitrum:mainnet",
332
- tokenId: 4318185,
333
- });
334
-
335
- if (!res.ok) {
336
- throw res.error;
288
+ const res = await uniswapV3LiquidityProvisionInRange(compassApiSDK, {});
289
+ if (res.ok) {
290
+ const { value: result } = res;
291
+ console.log(result);
292
+ } else {
293
+ console.log("uniswapV3LiquidityProvisionInRange failed:", res.error);
337
294
  }
338
-
339
- const { value: result } = res;
340
-
341
- // Handle the result
342
- console.log(result);
343
295
  }
344
296
 
345
297
  run();
@@ -385,11 +337,8 @@ const compassApiSDK = new CompassApiSDK({
385
337
  });
386
338
 
387
339
  async function run() {
388
- const result = await compassApiSDK.uniswapV3.liquidityProvisionPositions({
389
- chain: "arbitrum:mainnet",
390
- });
340
+ const result = await compassApiSDK.uniswapV3.liquidityProvisionPositions({});
391
341
 
392
- // Handle the result
393
342
  console.log(result);
394
343
  }
395
344
 
@@ -411,18 +360,13 @@ const compassApiSDK = new CompassApiSDKCore({
411
360
  });
412
361
 
413
362
  async function run() {
414
- const res = await uniswapV3LiquidityProvisionPositions(compassApiSDK, {
415
- chain: "arbitrum:mainnet",
416
- });
417
-
418
- if (!res.ok) {
419
- throw res.error;
363
+ const res = await uniswapV3LiquidityProvisionPositions(compassApiSDK, {});
364
+ if (res.ok) {
365
+ const { value: result } = res;
366
+ console.log(result);
367
+ } else {
368
+ console.log("uniswapV3LiquidityProvisionPositions failed:", res.error);
420
369
  }
421
-
422
- const { value: result } = res;
423
-
424
- // Handle the result
425
- console.log(result);
426
370
  }
427
371
 
428
372
  run();
@@ -474,11 +418,11 @@ async function run() {
474
418
  fee: "0.01",
475
419
  amount: 1.5,
476
420
  maxSlippagePercent: 0.5,
421
+ wrapEth: true,
477
422
  chain: "ethereum:mainnet",
478
423
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
479
424
  });
480
425
 
481
- // Handle the result
482
426
  console.log(result);
483
427
  }
484
428
 
@@ -506,18 +450,16 @@ async function run() {
506
450
  fee: "0.01",
507
451
  amount: 1.5,
508
452
  maxSlippagePercent: 0.5,
453
+ wrapEth: true,
509
454
  chain: "ethereum:mainnet",
510
455
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
511
456
  });
512
-
513
- if (!res.ok) {
514
- throw res.error;
457
+ if (res.ok) {
458
+ const { value: result } = res;
459
+ console.log(result);
460
+ } else {
461
+ console.log("uniswapV3SwapBuyExactly failed:", res.error);
515
462
  }
516
-
517
- const { value: result } = res;
518
-
519
- // Handle the result
520
- console.log(result);
521
463
  }
522
464
 
523
465
  run();
@@ -569,11 +511,11 @@ async function run() {
569
511
  fee: "0.05",
570
512
  amount: 1.5,
571
513
  maxSlippagePercent: 0.5,
514
+ wrapEth: true,
572
515
  chain: "arbitrum:mainnet",
573
516
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
574
517
  });
575
518
 
576
- // Handle the result
577
519
  console.log(result);
578
520
  }
579
521
 
@@ -601,18 +543,16 @@ async function run() {
601
543
  fee: "0.05",
602
544
  amount: 1.5,
603
545
  maxSlippagePercent: 0.5,
546
+ wrapEth: true,
604
547
  chain: "arbitrum:mainnet",
605
548
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
606
549
  });
607
-
608
- if (!res.ok) {
609
- throw res.error;
550
+ if (res.ok) {
551
+ const { value: result } = res;
552
+ console.log(result);
553
+ } else {
554
+ console.log("uniswapV3SwapSellExactly failed:", res.error);
610
555
  }
611
-
612
- const { value: result } = res;
613
-
614
- // Handle the result
615
- console.log(result);
616
556
  }
617
557
 
618
558
  run();
@@ -670,7 +610,6 @@ async function run() {
670
610
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
671
611
  });
672
612
 
673
- // Handle the result
674
613
  console.log(result);
675
614
  }
676
615
 
@@ -701,15 +640,12 @@ async function run() {
701
640
  chain: "ethereum:mainnet",
702
641
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
703
642
  });
704
-
705
- if (!res.ok) {
706
- throw res.error;
643
+ if (res.ok) {
644
+ const { value: result } = res;
645
+ console.log(result);
646
+ } else {
647
+ console.log("uniswapV3LiquidityProvisionIncrease failed:", res.error);
707
648
  }
708
-
709
- const { value: result } = res;
710
-
711
- // Handle the result
712
- console.log(result);
713
649
  }
714
650
 
715
651
  run();
@@ -772,7 +708,6 @@ async function run() {
772
708
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
773
709
  });
774
710
 
775
- // Handle the result
776
711
  console.log(result);
777
712
  }
778
713
 
@@ -808,15 +743,12 @@ async function run() {
808
743
  chain: "arbitrum:mainnet",
809
744
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
810
745
  });
811
-
812
- if (!res.ok) {
813
- throw res.error;
746
+ if (res.ok) {
747
+ const { value: result } = res;
748
+ console.log(result);
749
+ } else {
750
+ console.log("uniswapV3LiquidityProvisionMint failed:", res.error);
814
751
  }
815
-
816
- const { value: result } = res;
817
-
818
- // Handle the result
819
- console.log(result);
820
752
  }
821
753
 
822
754
  run();
@@ -872,7 +804,6 @@ async function run() {
872
804
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
873
805
  });
874
806
 
875
- // Handle the result
876
807
  console.log(result);
877
808
  }
878
809
 
@@ -900,15 +831,12 @@ async function run() {
900
831
  chain: "arbitrum:mainnet",
901
832
  sender: "0x29F20a192328eF1aD35e1564aBFf4Be9C5ce5f7B",
902
833
  });
903
-
904
- if (!res.ok) {
905
- throw res.error;
834
+ if (res.ok) {
835
+ const { value: result } = res;
836
+ console.log(result);
837
+ } else {
838
+ console.log("uniswapV3LiquidityProvisionWithdraw failed:", res.error);
906
839
  }
907
-
908
- const { value: result } = res;
909
-
910
- // Handle the result
911
- console.log(result);
912
840
  }
913
841
 
914
842
  run();