@compass-labs/api-sdk 0.5.13 → 0.5.14

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 (165) hide show
  1. package/README.md +9 -0
  2. package/bin/mcp-server.js +751 -264
  3. package/bin/mcp-server.js.map +20 -10
  4. package/dist/commonjs/funcs/transactionBatchingAaveLoop.d.ts +28 -0
  5. package/dist/commonjs/funcs/transactionBatchingAaveLoop.d.ts.map +1 -0
  6. package/dist/commonjs/funcs/transactionBatchingAaveLoop.js +128 -0
  7. package/dist/commonjs/funcs/transactionBatchingAaveLoop.js.map +1 -0
  8. package/dist/commonjs/funcs/transactionBatchingAuthorization.d.ts +23 -0
  9. package/dist/commonjs/funcs/transactionBatchingAuthorization.d.ts.map +1 -0
  10. package/dist/commonjs/funcs/transactionBatchingAuthorization.js +123 -0
  11. package/dist/commonjs/funcs/transactionBatchingAuthorization.js.map +1 -0
  12. package/dist/commonjs/funcs/transactionBatchingExecute.d.ts +24 -0
  13. package/dist/commonjs/funcs/transactionBatchingExecute.d.ts.map +1 -0
  14. package/dist/commonjs/funcs/transactionBatchingExecute.js +124 -0
  15. package/dist/commonjs/funcs/transactionBatchingExecute.js.map +1 -0
  16. package/dist/commonjs/lib/config.d.ts +3 -3
  17. package/dist/commonjs/lib/config.js +3 -3
  18. package/dist/commonjs/lib/files.d.ts +5 -0
  19. package/dist/commonjs/lib/files.d.ts.map +1 -1
  20. package/dist/commonjs/lib/files.js +41 -0
  21. package/dist/commonjs/lib/files.js.map +1 -1
  22. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  23. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  24. package/dist/commonjs/mcp-server/server.js +7 -1
  25. package/dist/commonjs/mcp-server/server.js.map +1 -1
  26. package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.d.ts +8 -0
  27. package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.d.ts.map +1 -0
  28. package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.js +74 -0
  29. package/dist/commonjs/mcp-server/tools/transactionBatchingAaveLoop.js.map +1 -0
  30. package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.d.ts +8 -0
  31. package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.d.ts.map +1 -0
  32. package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js +69 -0
  33. package/dist/commonjs/mcp-server/tools/transactionBatchingAuthorization.js.map +1 -0
  34. package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.d.ts +8 -0
  35. package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.d.ts.map +1 -0
  36. package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js +70 -0
  37. package/dist/commonjs/mcp-server/tools/transactionBatchingExecute.js.map +1 -0
  38. package/dist/commonjs/models/components/aavelooprequest.d.ts +181 -0
  39. package/dist/commonjs/models/components/aavelooprequest.d.ts.map +1 -0
  40. package/dist/commonjs/models/components/aavelooprequest.js +199 -0
  41. package/dist/commonjs/models/components/aavelooprequest.js.map +1 -0
  42. package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts +8 -8
  43. package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts.map +1 -1
  44. package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js +8 -8
  45. package/dist/commonjs/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js.map +1 -1
  46. package/dist/commonjs/models/components/index.d.ts +4 -0
  47. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  48. package/dist/commonjs/models/components/index.js +4 -0
  49. package/dist/commonjs/models/components/index.js.map +1 -1
  50. package/dist/commonjs/models/components/metadata.d.ts +0 -4
  51. package/dist/commonjs/models/components/metadata.d.ts.map +1 -1
  52. package/dist/commonjs/models/components/metadata.js +0 -4
  53. package/dist/commonjs/models/components/metadata.js.map +1 -1
  54. package/dist/commonjs/models/components/multicallauthorizationrequest.d.ts +49 -0
  55. package/dist/commonjs/models/components/multicallauthorizationrequest.d.ts.map +1 -0
  56. package/dist/commonjs/models/components/multicallauthorizationrequest.js +72 -0
  57. package/dist/commonjs/models/components/multicallauthorizationrequest.js.map +1 -0
  58. package/dist/commonjs/models/components/multicallauthorizationresponse.d.ts +45 -0
  59. package/dist/commonjs/models/components/multicallauthorizationresponse.d.ts.map +1 -0
  60. package/dist/commonjs/models/components/multicallauthorizationresponse.js +73 -0
  61. package/dist/commonjs/models/components/multicallauthorizationresponse.js.map +1 -0
  62. package/dist/commonjs/models/components/multicallexecuterequest.d.ts +50 -0
  63. package/dist/commonjs/models/components/multicallexecuterequest.d.ts.map +1 -0
  64. package/dist/commonjs/models/components/multicallexecuterequest.js +87 -0
  65. package/dist/commonjs/models/components/multicallexecuterequest.js.map +1 -0
  66. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  67. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  68. package/dist/commonjs/sdk/sdk.js +4 -0
  69. package/dist/commonjs/sdk/sdk.js.map +1 -1
  70. package/dist/commonjs/sdk/transactionbatching.d.ts +47 -0
  71. package/dist/commonjs/sdk/transactionbatching.d.ts.map +1 -0
  72. package/dist/commonjs/sdk/transactionbatching.js +63 -0
  73. package/dist/commonjs/sdk/transactionbatching.js.map +1 -0
  74. package/dist/esm/funcs/transactionBatchingAaveLoop.d.ts +28 -0
  75. package/dist/esm/funcs/transactionBatchingAaveLoop.d.ts.map +1 -0
  76. package/dist/esm/funcs/transactionBatchingAaveLoop.js +92 -0
  77. package/dist/esm/funcs/transactionBatchingAaveLoop.js.map +1 -0
  78. package/dist/esm/funcs/transactionBatchingAuthorization.d.ts +23 -0
  79. package/dist/esm/funcs/transactionBatchingAuthorization.d.ts.map +1 -0
  80. package/dist/esm/funcs/transactionBatchingAuthorization.js +87 -0
  81. package/dist/esm/funcs/transactionBatchingAuthorization.js.map +1 -0
  82. package/dist/esm/funcs/transactionBatchingExecute.d.ts +24 -0
  83. package/dist/esm/funcs/transactionBatchingExecute.d.ts.map +1 -0
  84. package/dist/esm/funcs/transactionBatchingExecute.js +88 -0
  85. package/dist/esm/funcs/transactionBatchingExecute.js.map +1 -0
  86. package/dist/esm/lib/config.d.ts +3 -3
  87. package/dist/esm/lib/config.js +3 -3
  88. package/dist/esm/lib/files.d.ts +5 -0
  89. package/dist/esm/lib/files.d.ts.map +1 -1
  90. package/dist/esm/lib/files.js +40 -0
  91. package/dist/esm/lib/files.js.map +1 -1
  92. package/dist/esm/mcp-server/mcp-server.js +1 -1
  93. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  94. package/dist/esm/mcp-server/server.js +7 -1
  95. package/dist/esm/mcp-server/server.js.map +1 -1
  96. package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.d.ts +8 -0
  97. package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.d.ts.map +1 -0
  98. package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.js +38 -0
  99. package/dist/esm/mcp-server/tools/transactionBatchingAaveLoop.js.map +1 -0
  100. package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.d.ts +8 -0
  101. package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.d.ts.map +1 -0
  102. package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js +33 -0
  103. package/dist/esm/mcp-server/tools/transactionBatchingAuthorization.js.map +1 -0
  104. package/dist/esm/mcp-server/tools/transactionBatchingExecute.d.ts +8 -0
  105. package/dist/esm/mcp-server/tools/transactionBatchingExecute.d.ts.map +1 -0
  106. package/dist/esm/mcp-server/tools/transactionBatchingExecute.js +34 -0
  107. package/dist/esm/mcp-server/tools/transactionBatchingExecute.js.map +1 -0
  108. package/dist/esm/models/components/aavelooprequest.d.ts +181 -0
  109. package/dist/esm/models/components/aavelooprequest.d.ts.map +1 -0
  110. package/dist/esm/models/components/aavelooprequest.js +153 -0
  111. package/dist/esm/models/components/aavelooprequest.js.map +1 -0
  112. package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts +8 -8
  113. package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.d.ts.map +1 -1
  114. package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js +8 -8
  115. package/dist/esm/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.js.map +1 -1
  116. package/dist/esm/models/components/index.d.ts +4 -0
  117. package/dist/esm/models/components/index.d.ts.map +1 -1
  118. package/dist/esm/models/components/index.js +4 -0
  119. package/dist/esm/models/components/index.js.map +1 -1
  120. package/dist/esm/models/components/metadata.d.ts +0 -4
  121. package/dist/esm/models/components/metadata.d.ts.map +1 -1
  122. package/dist/esm/models/components/metadata.js +0 -4
  123. package/dist/esm/models/components/metadata.js.map +1 -1
  124. package/dist/esm/models/components/multicallauthorizationrequest.d.ts +49 -0
  125. package/dist/esm/models/components/multicallauthorizationrequest.d.ts.map +1 -0
  126. package/dist/esm/models/components/multicallauthorizationrequest.js +34 -0
  127. package/dist/esm/models/components/multicallauthorizationrequest.js.map +1 -0
  128. package/dist/esm/models/components/multicallauthorizationresponse.d.ts +45 -0
  129. package/dist/esm/models/components/multicallauthorizationresponse.d.ts.map +1 -0
  130. package/dist/esm/models/components/multicallauthorizationresponse.js +35 -0
  131. package/dist/esm/models/components/multicallauthorizationresponse.js.map +1 -0
  132. package/dist/esm/models/components/multicallexecuterequest.d.ts +50 -0
  133. package/dist/esm/models/components/multicallexecuterequest.d.ts.map +1 -0
  134. package/dist/esm/models/components/multicallexecuterequest.js +49 -0
  135. package/dist/esm/models/components/multicallexecuterequest.js.map +1 -0
  136. package/dist/esm/sdk/sdk.d.ts +3 -0
  137. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  138. package/dist/esm/sdk/sdk.js +4 -0
  139. package/dist/esm/sdk/sdk.js.map +1 -1
  140. package/dist/esm/sdk/transactionbatching.d.ts +47 -0
  141. package/dist/esm/sdk/transactionbatching.d.ts.map +1 -0
  142. package/dist/esm/sdk/transactionbatching.js +59 -0
  143. package/dist/esm/sdk/transactionbatching.js.map +1 -0
  144. package/docs/sdks/transactionbatching/README.md +318 -0
  145. package/jsr.json +1 -1
  146. package/package.json +1 -1
  147. package/src/funcs/transactionBatchingAaveLoop.ts +179 -0
  148. package/src/funcs/transactionBatchingAuthorization.ts +175 -0
  149. package/src/funcs/transactionBatchingExecute.ts +175 -0
  150. package/src/lib/config.ts +3 -3
  151. package/src/lib/files.ts +42 -0
  152. package/src/mcp-server/mcp-server.ts +1 -1
  153. package/src/mcp-server/server.ts +7 -1
  154. package/src/mcp-server/tools/transactionBatchingAaveLoop.ts +47 -0
  155. package/src/mcp-server/tools/transactionBatchingAuthorization.ts +44 -0
  156. package/src/mcp-server/tools/transactionBatchingExecute.ts +43 -0
  157. package/src/models/components/aavelooprequest.ts +368 -0
  158. package/src/models/components/compassapibackendmodelsmorphoreadresponsegetmarketmarketstate.ts +16 -16
  159. package/src/models/components/index.ts +4 -0
  160. package/src/models/components/metadata.ts +0 -8
  161. package/src/models/components/multicallauthorizationrequest.ts +90 -0
  162. package/src/models/components/multicallauthorizationresponse.ts +88 -0
  163. package/src/models/components/multicallexecuterequest.ts +112 -0
  164. package/src/sdk/sdk.ts +8 -0
  165. package/src/sdk/transactionbatching.ts +84 -0
@@ -0,0 +1,112 @@
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
+ import { Chain, Chain$inboundSchema, Chain$outboundSchema } from "./chain.js";
11
+ import {
12
+ SignedAuthorization,
13
+ SignedAuthorization$inboundSchema,
14
+ SignedAuthorization$Outbound,
15
+ SignedAuthorization$outboundSchema,
16
+ } from "./signedauthorization.js";
17
+ import {
18
+ UserOperation,
19
+ UserOperation$inboundSchema,
20
+ UserOperation$Outbound,
21
+ UserOperation$outboundSchema,
22
+ } from "./useroperation.js";
23
+
24
+ /**
25
+ * Request model for executing a multicall.
26
+ */
27
+ export type MulticallExecuteRequest = {
28
+ /**
29
+ * The chain to use.
30
+ */
31
+ chain: Chain;
32
+ /**
33
+ * The address of the transaction sender.
34
+ */
35
+ sender: string;
36
+ signedAuthorization: SignedAuthorization;
37
+ /**
38
+ * List of possible actions for multicall
39
+ */
40
+ actions: Array<UserOperation>;
41
+ };
42
+
43
+ /** @internal */
44
+ export const MulticallExecuteRequest$inboundSchema: z.ZodType<
45
+ MulticallExecuteRequest,
46
+ z.ZodTypeDef,
47
+ unknown
48
+ > = z.object({
49
+ chain: Chain$inboundSchema,
50
+ sender: z.string(),
51
+ signed_authorization: SignedAuthorization$inboundSchema,
52
+ actions: z.array(UserOperation$inboundSchema),
53
+ }).transform((v) => {
54
+ return remap$(v, {
55
+ "signed_authorization": "signedAuthorization",
56
+ });
57
+ });
58
+
59
+ /** @internal */
60
+ export type MulticallExecuteRequest$Outbound = {
61
+ chain: string;
62
+ sender: string;
63
+ signed_authorization: SignedAuthorization$Outbound;
64
+ actions: Array<UserOperation$Outbound>;
65
+ };
66
+
67
+ /** @internal */
68
+ export const MulticallExecuteRequest$outboundSchema: z.ZodType<
69
+ MulticallExecuteRequest$Outbound,
70
+ z.ZodTypeDef,
71
+ MulticallExecuteRequest
72
+ > = z.object({
73
+ chain: Chain$outboundSchema,
74
+ sender: z.string(),
75
+ signedAuthorization: SignedAuthorization$outboundSchema,
76
+ actions: z.array(UserOperation$outboundSchema),
77
+ }).transform((v) => {
78
+ return remap$(v, {
79
+ signedAuthorization: "signed_authorization",
80
+ });
81
+ });
82
+
83
+ /**
84
+ * @internal
85
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
86
+ */
87
+ export namespace MulticallExecuteRequest$ {
88
+ /** @deprecated use `MulticallExecuteRequest$inboundSchema` instead. */
89
+ export const inboundSchema = MulticallExecuteRequest$inboundSchema;
90
+ /** @deprecated use `MulticallExecuteRequest$outboundSchema` instead. */
91
+ export const outboundSchema = MulticallExecuteRequest$outboundSchema;
92
+ /** @deprecated use `MulticallExecuteRequest$Outbound` instead. */
93
+ export type Outbound = MulticallExecuteRequest$Outbound;
94
+ }
95
+
96
+ export function multicallExecuteRequestToJSON(
97
+ multicallExecuteRequest: MulticallExecuteRequest,
98
+ ): string {
99
+ return JSON.stringify(
100
+ MulticallExecuteRequest$outboundSchema.parse(multicallExecuteRequest),
101
+ );
102
+ }
103
+
104
+ export function multicallExecuteRequestFromJSON(
105
+ jsonString: string,
106
+ ): SafeParseResult<MulticallExecuteRequest, SDKValidationError> {
107
+ return safeParse(
108
+ jsonString,
109
+ (x) => MulticallExecuteRequest$inboundSchema.parse(JSON.parse(x)),
110
+ `Failed to parse 'MulticallExecuteRequest' from JSON`,
111
+ );
112
+ }
package/src/sdk/sdk.ts CHANGED
@@ -10,6 +10,7 @@ import { Pendle } from "./pendle.js";
10
10
  import { Sky } from "./sky.js";
11
11
  import { SmartAccount } from "./smartaccount.js";
12
12
  import { Token } from "./token.js";
13
+ import { TransactionBatching } from "./transactionbatching.js";
13
14
  import { UniswapV3 } from "./uniswapv3.js";
14
15
  import { Universal } from "./universal.js";
15
16
 
@@ -56,6 +57,13 @@ export class CompassApiSDK extends ClientSDK {
56
57
  return (this._pendle ??= new Pendle(this._options));
57
58
  }
58
59
 
60
+ private _transactionBatching?: TransactionBatching;
61
+ get transactionBatching(): TransactionBatching {
62
+ return (this._transactionBatching ??= new TransactionBatching(
63
+ this._options,
64
+ ));
65
+ }
66
+
59
67
  private _smartAccount?: SmartAccount;
60
68
  get smartAccount(): SmartAccount {
61
69
  return (this._smartAccount ??= new SmartAccount(this._options));
@@ -0,0 +1,84 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { transactionBatchingAaveLoop } from "../funcs/transactionBatchingAaveLoop.js";
6
+ import { transactionBatchingAuthorization } from "../funcs/transactionBatchingAuthorization.js";
7
+ import { transactionBatchingExecute } from "../funcs/transactionBatchingExecute.js";
8
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
9
+ import * as components from "../models/components/index.js";
10
+ import { unwrapAsync } from "../types/fp.js";
11
+
12
+ export class TransactionBatching extends ClientSDK {
13
+ /**
14
+ * Enable transaction bundling.
15
+ *
16
+ * @remarks
17
+ * Get authorization for bundling transactions.
18
+ *
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
+ */
24
+ async authorization(
25
+ request: components.MulticallAuthorizationRequest,
26
+ options?: RequestOptions,
27
+ ): Promise<components.MulticallAuthorizationResponse> {
28
+ return unwrapAsync(transactionBatchingAuthorization(
29
+ this,
30
+ request,
31
+ options,
32
+ ));
33
+ }
34
+
35
+ /**
36
+ * Construct Bundled Transaction
37
+ *
38
+ * @remarks
39
+ * Bundle arbitrary transactions together into a single multicall transaction using
40
+ * EIP-7702.
41
+ *
42
+ * This endpoint allows bundling multiple contract calls into a single atomic
43
+ * transaction, reducing gas costs and ensuring all operations succeed or fail
44
+ * together. The transaction must be authorized using the /authorization endpoint to
45
+ * prevent replay attacks.
46
+ */
47
+ async execute(
48
+ request: components.MulticallExecuteRequest,
49
+ options?: RequestOptions,
50
+ ): Promise<components.UnsignedMulticallTransaction> {
51
+ return unwrapAsync(transactionBatchingExecute(
52
+ this,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ /**
59
+ * AAVE leverage long/short
60
+ *
61
+ * @remarks
62
+ * Execute an Aave looping strategy that involves repeated supply and borrow
63
+ * operations.
64
+ *
65
+ * This endpoint creates a multicall transaction that performs a series of operations:
66
+ * 1. Approves and supplies initial token
67
+ * 2. For each loop:
68
+ * - Borrows another token
69
+ * - Swaps borrowed token back to supply token
70
+ * - Supplies the swapped tokens
71
+ *
72
+ * The transaction must be authorized using the /authorization endpoint to prevent replay attacks.
73
+ */
74
+ async aaveLoop(
75
+ request: components.AaveLoopRequest,
76
+ options?: RequestOptions,
77
+ ): Promise<components.UnsignedMulticallTransaction> {
78
+ return unwrapAsync(transactionBatchingAaveLoop(
79
+ this,
80
+ request,
81
+ options,
82
+ ));
83
+ }
84
+ }