@compass-labs/api-sdk 2.1.9 → 2.1.10-rc.2

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 (134) hide show
  1. package/README.md +7 -0
  2. package/dist/commonjs/funcs/cctpCCTPBurn.d.ts +37 -0
  3. package/dist/commonjs/funcs/cctpCCTPBurn.d.ts.map +1 -0
  4. package/dist/commonjs/funcs/cctpCCTPBurn.js +137 -0
  5. package/dist/commonjs/funcs/cctpCCTPBurn.js.map +1 -0
  6. package/dist/commonjs/funcs/cctpCCTPMint.d.ts +52 -0
  7. package/dist/commonjs/funcs/cctpCCTPMint.d.ts.map +1 -0
  8. package/dist/commonjs/funcs/cctpCCTPMint.js +152 -0
  9. package/dist/commonjs/funcs/cctpCCTPMint.js.map +1 -0
  10. package/dist/commonjs/lib/config.d.ts +2 -2
  11. package/dist/commonjs/lib/config.js +2 -2
  12. package/dist/commonjs/lib/encodings.d.ts +1 -0
  13. package/dist/commonjs/lib/encodings.d.ts.map +1 -1
  14. package/dist/commonjs/lib/encodings.js +9 -0
  15. package/dist/commonjs/lib/encodings.js.map +1 -1
  16. package/dist/commonjs/models/components/depositforburnrequest.d.ts +96 -0
  17. package/dist/commonjs/models/components/depositforburnrequest.d.ts.map +1 -0
  18. package/dist/commonjs/models/components/depositforburnrequest.js +87 -0
  19. package/dist/commonjs/models/components/depositforburnrequest.js.map +1 -0
  20. package/dist/commonjs/models/components/depositforburnresponse.d.ts +37 -0
  21. package/dist/commonjs/models/components/depositforburnresponse.d.ts.map +1 -0
  22. package/dist/commonjs/models/components/depositforburnresponse.js +60 -0
  23. package/dist/commonjs/models/components/depositforburnresponse.js.map +1 -0
  24. package/dist/commonjs/models/components/index.d.ts +5 -0
  25. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/index.js +5 -0
  27. package/dist/commonjs/models/components/index.js.map +1 -1
  28. package/dist/commonjs/models/components/mintpreparependingresponse.d.ts +43 -0
  29. package/dist/commonjs/models/components/mintpreparependingresponse.d.ts.map +1 -0
  30. package/dist/commonjs/models/components/mintpreparependingresponse.js +64 -0
  31. package/dist/commonjs/models/components/mintpreparependingresponse.js.map +1 -0
  32. package/dist/commonjs/models/components/mintpreparereadyresponse.d.ts +41 -0
  33. package/dist/commonjs/models/components/mintpreparereadyresponse.d.ts.map +1 -0
  34. package/dist/commonjs/models/components/mintpreparereadyresponse.js +64 -0
  35. package/dist/commonjs/models/components/mintpreparereadyresponse.js.map +1 -0
  36. package/dist/commonjs/models/components/mintpreparerequest.d.ts +39 -0
  37. package/dist/commonjs/models/components/mintpreparerequest.d.ts.map +1 -0
  38. package/dist/commonjs/models/components/mintpreparerequest.js +57 -0
  39. package/dist/commonjs/models/components/mintpreparerequest.js.map +1 -0
  40. package/dist/commonjs/models/operations/index.d.ts +1 -0
  41. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  42. package/dist/commonjs/models/operations/index.js +1 -0
  43. package/dist/commonjs/models/operations/index.js.map +1 -1
  44. package/dist/commonjs/models/operations/v2cctpmint.d.ts +9 -0
  45. package/dist/commonjs/models/operations/v2cctpmint.d.ts.map +1 -0
  46. package/dist/commonjs/models/operations/v2cctpmint.js +52 -0
  47. package/dist/commonjs/models/operations/v2cctpmint.js.map +1 -0
  48. package/dist/commonjs/sdk/cctp.d.ts +72 -0
  49. package/dist/commonjs/sdk/cctp.d.ts.map +1 -0
  50. package/dist/commonjs/sdk/cctp.js +84 -0
  51. package/dist/commonjs/sdk/cctp.js.map +1 -0
  52. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  53. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  54. package/dist/commonjs/sdk/sdk.js +4 -0
  55. package/dist/commonjs/sdk/sdk.js.map +1 -1
  56. package/dist/commonjs/types/unrecognized.d.ts +7 -1
  57. package/dist/commonjs/types/unrecognized.d.ts.map +1 -1
  58. package/dist/commonjs/types/unrecognized.js +9 -1
  59. package/dist/commonjs/types/unrecognized.js.map +1 -1
  60. package/dist/esm/funcs/cctpCCTPBurn.d.ts +37 -0
  61. package/dist/esm/funcs/cctpCCTPBurn.d.ts.map +1 -0
  62. package/dist/esm/funcs/cctpCCTPBurn.js +101 -0
  63. package/dist/esm/funcs/cctpCCTPBurn.js.map +1 -0
  64. package/dist/esm/funcs/cctpCCTPMint.d.ts +52 -0
  65. package/dist/esm/funcs/cctpCCTPMint.d.ts.map +1 -0
  66. package/dist/esm/funcs/cctpCCTPMint.js +116 -0
  67. package/dist/esm/funcs/cctpCCTPMint.js.map +1 -0
  68. package/dist/esm/lib/config.d.ts +2 -2
  69. package/dist/esm/lib/config.js +2 -2
  70. package/dist/esm/lib/encodings.d.ts +1 -0
  71. package/dist/esm/lib/encodings.d.ts.map +1 -1
  72. package/dist/esm/lib/encodings.js +9 -0
  73. package/dist/esm/lib/encodings.js.map +1 -1
  74. package/dist/esm/models/components/depositforburnrequest.d.ts +96 -0
  75. package/dist/esm/models/components/depositforburnrequest.d.ts.map +1 -0
  76. package/dist/esm/models/components/depositforburnrequest.js +49 -0
  77. package/dist/esm/models/components/depositforburnrequest.js.map +1 -0
  78. package/dist/esm/models/components/depositforburnresponse.d.ts +37 -0
  79. package/dist/esm/models/components/depositforburnresponse.d.ts.map +1 -0
  80. package/dist/esm/models/components/depositforburnresponse.js +23 -0
  81. package/dist/esm/models/components/depositforburnresponse.js.map +1 -0
  82. package/dist/esm/models/components/index.d.ts +5 -0
  83. package/dist/esm/models/components/index.d.ts.map +1 -1
  84. package/dist/esm/models/components/index.js +5 -0
  85. package/dist/esm/models/components/index.js.map +1 -1
  86. package/dist/esm/models/components/mintpreparependingresponse.d.ts +43 -0
  87. package/dist/esm/models/components/mintpreparependingresponse.d.ts.map +1 -0
  88. package/dist/esm/models/components/mintpreparependingresponse.js +27 -0
  89. package/dist/esm/models/components/mintpreparependingresponse.js.map +1 -0
  90. package/dist/esm/models/components/mintpreparereadyresponse.d.ts +41 -0
  91. package/dist/esm/models/components/mintpreparereadyresponse.d.ts.map +1 -0
  92. package/dist/esm/models/components/mintpreparereadyresponse.js +27 -0
  93. package/dist/esm/models/components/mintpreparereadyresponse.js.map +1 -0
  94. package/dist/esm/models/components/mintpreparerequest.d.ts +39 -0
  95. package/dist/esm/models/components/mintpreparerequest.d.ts.map +1 -0
  96. package/dist/esm/models/components/mintpreparerequest.js +20 -0
  97. package/dist/esm/models/components/mintpreparerequest.js.map +1 -0
  98. package/dist/esm/models/operations/index.d.ts +1 -0
  99. package/dist/esm/models/operations/index.d.ts.map +1 -1
  100. package/dist/esm/models/operations/index.js +1 -0
  101. package/dist/esm/models/operations/index.js.map +1 -1
  102. package/dist/esm/models/operations/v2cctpmint.d.ts +9 -0
  103. package/dist/esm/models/operations/v2cctpmint.d.ts.map +1 -0
  104. package/dist/esm/models/operations/v2cctpmint.js +15 -0
  105. package/dist/esm/models/operations/v2cctpmint.js.map +1 -0
  106. package/dist/esm/sdk/cctp.d.ts +72 -0
  107. package/dist/esm/sdk/cctp.d.ts.map +1 -0
  108. package/dist/esm/sdk/cctp.js +80 -0
  109. package/dist/esm/sdk/cctp.js.map +1 -0
  110. package/dist/esm/sdk/sdk.d.ts +3 -0
  111. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  112. package/dist/esm/sdk/sdk.js +4 -0
  113. package/dist/esm/sdk/sdk.js.map +1 -1
  114. package/dist/esm/types/unrecognized.d.ts +7 -1
  115. package/dist/esm/types/unrecognized.d.ts.map +1 -1
  116. package/dist/esm/types/unrecognized.js +9 -1
  117. package/dist/esm/types/unrecognized.js.map +1 -1
  118. package/package.json +1 -1
  119. package/src/funcs/cctpCCTPBurn.ts +188 -0
  120. package/src/funcs/cctpCCTPMint.ts +204 -0
  121. package/src/lib/config.ts +2 -2
  122. package/src/lib/encodings.ts +13 -0
  123. package/src/models/components/depositforburnrequest.ts +153 -0
  124. package/src/models/components/depositforburnresponse.ts +72 -0
  125. package/src/models/components/index.ts +5 -0
  126. package/src/models/components/mintpreparependingresponse.ts +78 -0
  127. package/src/models/components/mintpreparereadyresponse.ts +80 -0
  128. package/src/models/components/mintpreparerequest.ts +66 -0
  129. package/src/models/operations/index.ts +1 -0
  130. package/src/models/operations/v2cctpmint.ts +33 -0
  131. package/src/sdk/cctp.ts +98 -0
  132. package/src/sdk/sdk.ts +6 -0
  133. package/src/types/unrecognized.ts +9 -1
  134. package/tsconfig.json +0 -1
@@ -0,0 +1,188 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CompassApiSDKCore } from "../core.js";
6
+ import { encodeJSON } 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 { CompassAPISDKError } from "../models/errors/compassapisdkerror.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 { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Build depositForBurn transaction for Earn Account
30
+ *
31
+ * @remarks
32
+ * Build a transaction to burn USDC from an Earn Account (Safe) on the source chain
33
+ * and initiate a cross-chain transfer via Circle's CCTP (Cross-Chain Transfer Protocol).
34
+ *
35
+ * **Flow:**
36
+ * 1. Call this endpoint with `gas_sponsorship=false` to get an unsigned transaction,
37
+ * or `gas_sponsorship=true` to get EIP-712 typed data for gas-sponsored execution
38
+ * 2. Owner signs the transaction or typed data
39
+ * 3. Broadcast the transaction on the source chain (or submit to `/gas_sponsorship/prepare`)
40
+ * 4. Wait for Circle's attestation service to attest the burn
41
+ * 5. Call the mint endpoint (when available) to receive USDC on the destination chain
42
+ *
43
+ * **Supported chains:**
44
+ * - Ethereum (domain 0)
45
+ * - Arbitrum (domain 3)
46
+ * - Base (domain 6)
47
+ *
48
+ * **Note:** The USDC must already be deposited in the Earn Account. If approval is needed
49
+ * for the TokenMessenger contract, it will be included in the transaction automatically.
50
+ *
51
+ * **Gas estimate:** ~200,000 gas units (includes Safe execTransaction overhead)
52
+ */
53
+ export function cctpCCTPBurn(
54
+ client: CompassApiSDKCore,
55
+ request: components.DepositForBurnRequest,
56
+ options?: RequestOptions,
57
+ ): APIPromise<
58
+ Result<
59
+ components.DepositForBurnResponse,
60
+ | errors.HTTPValidationError
61
+ | CompassAPISDKError
62
+ | ResponseValidationError
63
+ | ConnectionError
64
+ | RequestAbortedError
65
+ | RequestTimeoutError
66
+ | InvalidRequestError
67
+ | UnexpectedClientError
68
+ | SDKValidationError
69
+ >
70
+ > {
71
+ return new APIPromise($do(
72
+ client,
73
+ request,
74
+ options,
75
+ ));
76
+ }
77
+
78
+ async function $do(
79
+ client: CompassApiSDKCore,
80
+ request: components.DepositForBurnRequest,
81
+ options?: RequestOptions,
82
+ ): Promise<
83
+ [
84
+ Result<
85
+ components.DepositForBurnResponse,
86
+ | errors.HTTPValidationError
87
+ | CompassAPISDKError
88
+ | ResponseValidationError
89
+ | ConnectionError
90
+ | RequestAbortedError
91
+ | RequestTimeoutError
92
+ | InvalidRequestError
93
+ | UnexpectedClientError
94
+ | SDKValidationError
95
+ >,
96
+ APICall,
97
+ ]
98
+ > {
99
+ const parsed = safeParse(
100
+ request,
101
+ (value) => components.DepositForBurnRequest$outboundSchema.parse(value),
102
+ "Input validation failed",
103
+ );
104
+ if (!parsed.ok) {
105
+ return [parsed, { status: "invalid" }];
106
+ }
107
+ const payload = parsed.value;
108
+ const body = encodeJSON("body", payload, { explode: true });
109
+
110
+ const path = pathToFunc("/v2/cctp/burn")();
111
+
112
+ const headers = new Headers(compactMap({
113
+ "Content-Type": "application/json",
114
+ Accept: "application/json",
115
+ }));
116
+
117
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
118
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
119
+ const requestSecurity = resolveGlobalSecurity(securityInput);
120
+
121
+ const context = {
122
+ options: client._options,
123
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
124
+ operationID: "v2_cctp_burn",
125
+ oAuth2Scopes: null,
126
+
127
+ resolvedSecurity: requestSecurity,
128
+
129
+ securitySource: client._options.apiKeyAuth,
130
+ retryConfig: options?.retries
131
+ || client._options.retryConfig
132
+ || { strategy: "none" },
133
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
134
+ };
135
+
136
+ const requestRes = client._createRequest(context, {
137
+ security: requestSecurity,
138
+ method: "POST",
139
+ baseURL: options?.serverURL,
140
+ path: path,
141
+ headers: headers,
142
+ body: body,
143
+ userAgent: client._options.userAgent,
144
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
145
+ }, options);
146
+ if (!requestRes.ok) {
147
+ return [requestRes, { status: "invalid" }];
148
+ }
149
+ const req = requestRes.value;
150
+
151
+ const doResult = await client._do(req, {
152
+ context,
153
+ errorCodes: ["422", "4XX", "5XX"],
154
+ retryConfig: context.retryConfig,
155
+ retryCodes: context.retryCodes,
156
+ });
157
+ if (!doResult.ok) {
158
+ return [doResult, { status: "request-error", request: req }];
159
+ }
160
+ const response = doResult.value;
161
+
162
+ const responseFields = {
163
+ HttpMeta: { Response: response, Request: req },
164
+ };
165
+
166
+ const [result] = await M.match<
167
+ components.DepositForBurnResponse,
168
+ | errors.HTTPValidationError
169
+ | CompassAPISDKError
170
+ | ResponseValidationError
171
+ | ConnectionError
172
+ | RequestAbortedError
173
+ | RequestTimeoutError
174
+ | InvalidRequestError
175
+ | UnexpectedClientError
176
+ | SDKValidationError
177
+ >(
178
+ M.json(200, components.DepositForBurnResponse$inboundSchema),
179
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
180
+ M.fail("4XX"),
181
+ M.fail("5XX"),
182
+ )(response, req, { extraFields: responseFields });
183
+ if (!result.ok) {
184
+ return [result, { status: "complete", request: req, response }];
185
+ }
186
+
187
+ return [result, { status: "complete", request: req, response }];
188
+ }
@@ -0,0 +1,204 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CompassApiSDKCore } from "../core.js";
6
+ import { encodeJSON } 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 { CompassAPISDKError } from "../models/errors/compassapisdkerror.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 { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Prepare mint transaction for Earn Account on destination chain
31
+ *
32
+ * @remarks
33
+ * Prepare a receiveMessage transaction to mint USDC to an Earn Account (Safe) on the
34
+ * destination chain.
35
+ *
36
+ * **How it works:**
37
+ *
38
+ * This endpoint uses the `bridge_id` from `/burn` to:
39
+ * 1. Look up the bridge session (no burn tx hash needed!)
40
+ * 2. Find the DepositForBurn event on the source chain using stored nonce
41
+ * 3. Extract the CCTP message and compute its hash
42
+ * 4. Check if Circle's attestation is ready
43
+ * 5. Return the mint transaction wrapped in Safe execTransaction
44
+ *
45
+ * **Request parameters:**
46
+ *
47
+ * - `bridge_id`: The bridge ID returned from `/burn`
48
+ * - `owner`: The wallet address that owns the Earn Account (Safe) on the destination chain
49
+ * - `gas_sponsorship`: If true, returns EIP-712 typed data for gas-sponsored execution
50
+ *
51
+ * **Response codes:**
52
+ *
53
+ * - **200 OK**: Attestation is ready, mint transaction is included
54
+ * - **202 Accepted**: Attestation is pending, SSE URL for real-time updates is included
55
+ * - **400 Bad Request**: Bridge not found, or burn event not found yet
56
+ *
57
+ * **After receiving 202:**
58
+ *
59
+ * Either:
60
+ * - Connect to the SSE stream at `sse_url` and wait for `attestation_ready` event
61
+ * - Poll this endpoint periodically until you get 200
62
+ *
63
+ * **After receiving 200:**
64
+ *
65
+ * Sign and broadcast the returned transaction on the destination chain to mint USDC
66
+ * to your Earn Account.
67
+ */
68
+ export function cctpCCTPMint(
69
+ client: CompassApiSDKCore,
70
+ request: components.MintPrepareRequest,
71
+ options?: RequestOptions,
72
+ ): APIPromise<
73
+ Result<
74
+ operations.V2CctpMintResponse,
75
+ | errors.HTTPValidationError
76
+ | CompassAPISDKError
77
+ | ResponseValidationError
78
+ | ConnectionError
79
+ | RequestAbortedError
80
+ | RequestTimeoutError
81
+ | InvalidRequestError
82
+ | UnexpectedClientError
83
+ | SDKValidationError
84
+ >
85
+ > {
86
+ return new APIPromise($do(
87
+ client,
88
+ request,
89
+ options,
90
+ ));
91
+ }
92
+
93
+ async function $do(
94
+ client: CompassApiSDKCore,
95
+ request: components.MintPrepareRequest,
96
+ options?: RequestOptions,
97
+ ): Promise<
98
+ [
99
+ Result<
100
+ operations.V2CctpMintResponse,
101
+ | errors.HTTPValidationError
102
+ | CompassAPISDKError
103
+ | ResponseValidationError
104
+ | ConnectionError
105
+ | RequestAbortedError
106
+ | RequestTimeoutError
107
+ | InvalidRequestError
108
+ | UnexpectedClientError
109
+ | SDKValidationError
110
+ >,
111
+ APICall,
112
+ ]
113
+ > {
114
+ const parsed = safeParse(
115
+ request,
116
+ (value) => components.MintPrepareRequest$outboundSchema.parse(value),
117
+ "Input validation failed",
118
+ );
119
+ if (!parsed.ok) {
120
+ return [parsed, { status: "invalid" }];
121
+ }
122
+ const payload = parsed.value;
123
+ const body = encodeJSON("body", payload, { explode: true });
124
+
125
+ const path = pathToFunc("/v2/cctp/mint")();
126
+
127
+ const headers = new Headers(compactMap({
128
+ "Content-Type": "application/json",
129
+ Accept: "application/json",
130
+ }));
131
+
132
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
133
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
134
+ const requestSecurity = resolveGlobalSecurity(securityInput);
135
+
136
+ const context = {
137
+ options: client._options,
138
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
139
+ operationID: "v2_cctp_mint",
140
+ oAuth2Scopes: null,
141
+
142
+ resolvedSecurity: requestSecurity,
143
+
144
+ securitySource: client._options.apiKeyAuth,
145
+ retryConfig: options?.retries
146
+ || client._options.retryConfig
147
+ || { strategy: "none" },
148
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
149
+ };
150
+
151
+ const requestRes = client._createRequest(context, {
152
+ security: requestSecurity,
153
+ method: "POST",
154
+ baseURL: options?.serverURL,
155
+ path: path,
156
+ headers: headers,
157
+ body: body,
158
+ userAgent: client._options.userAgent,
159
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
160
+ }, options);
161
+ if (!requestRes.ok) {
162
+ return [requestRes, { status: "invalid" }];
163
+ }
164
+ const req = requestRes.value;
165
+
166
+ const doResult = await client._do(req, {
167
+ context,
168
+ errorCodes: ["422", "4XX", "5XX"],
169
+ retryConfig: context.retryConfig,
170
+ retryCodes: context.retryCodes,
171
+ });
172
+ if (!doResult.ok) {
173
+ return [doResult, { status: "request-error", request: req }];
174
+ }
175
+ const response = doResult.value;
176
+
177
+ const responseFields = {
178
+ HttpMeta: { Response: response, Request: req },
179
+ };
180
+
181
+ const [result] = await M.match<
182
+ operations.V2CctpMintResponse,
183
+ | errors.HTTPValidationError
184
+ | CompassAPISDKError
185
+ | ResponseValidationError
186
+ | ConnectionError
187
+ | RequestAbortedError
188
+ | RequestTimeoutError
189
+ | InvalidRequestError
190
+ | UnexpectedClientError
191
+ | SDKValidationError
192
+ >(
193
+ M.json(200, operations.V2CctpMintResponse$inboundSchema),
194
+ M.json(202, operations.V2CctpMintResponse$inboundSchema),
195
+ M.jsonErr(422, errors.HTTPValidationError$inboundSchema),
196
+ M.fail("4XX"),
197
+ M.fail("5XX"),
198
+ )(response, req, { extraFields: responseFields });
199
+ if (!result.ok) {
200
+ return [result, { status: "complete", request: req, response }];
201
+ }
202
+
203
+ return [result, { status: "complete", request: req, response }];
204
+ }
package/src/lib/config.ts CHANGED
@@ -62,7 +62,7 @@ export const SDK_METADATA = {
62
62
  language: "typescript",
63
63
  openapiDocVersion: "0.0.1",
64
64
  sdkVersion: "2.0.0",
65
- genVersion: "2.763.3",
65
+ genVersion: "2.767.2",
66
66
  userAgent:
67
- "speakeasy-sdk/typescript 2.0.0 2.763.3 0.0.1 @compass-labs/api-sdk",
67
+ "speakeasy-sdk/typescript 2.0.0 2.767.2 0.0.1 @compass-labs/api-sdk",
68
68
  } as const;
@@ -427,6 +427,7 @@ export function queryJoin(...args: (string | undefined)[]): string {
427
427
  type QueryEncoderOptions = {
428
428
  explode?: boolean;
429
429
  charEncoding?: "percent" | "none";
430
+ allowEmptyValue?: string[];
430
431
  };
431
432
 
432
433
  type QueryEncoder = (
@@ -451,7 +452,19 @@ export function queryEncoder(f: QueryEncoder): BulkQueryEncoder {
451
452
  charEncoding: options?.charEncoding ?? "percent",
452
453
  };
453
454
 
455
+ const allowEmptySet = new Set(options?.allowEmptyValue ?? []);
456
+
454
457
  const encoded = Object.entries(values).map(([key, value]) => {
458
+ if (allowEmptySet.has(key)) {
459
+ if (
460
+ value === undefined
461
+ || value === null
462
+ || value === ""
463
+ || (Array.isArray(value) && value.length === 0)
464
+ ) {
465
+ return `${encodeURIComponent(key)}=`;
466
+ }
467
+ }
455
468
  return f(key, value, opts);
456
469
  });
457
470
  return queryJoin(...encoded);
@@ -0,0 +1,153 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+
9
+ /**
10
+ * The source chain where USDC will be burned.
11
+ */
12
+ export const DepositForBurnRequestChain = {
13
+ Ethereum: "ethereum",
14
+ Arbitrum: "arbitrum",
15
+ Base: "base",
16
+ } as const;
17
+ /**
18
+ * The source chain where USDC will be burned.
19
+ */
20
+ export type DepositForBurnRequestChain = ClosedEnum<
21
+ typeof DepositForBurnRequestChain
22
+ >;
23
+
24
+ /**
25
+ * The amount of USDC to bridge (in token units, e.g., 100.5 for 100.5 USDC).
26
+ */
27
+ export type DepositForBurnRequestAmount = number | string;
28
+
29
+ /**
30
+ * The destination chain where USDC will be minted.
31
+ */
32
+ export const DestinationChain = {
33
+ Ethereum: "ethereum",
34
+ Arbitrum: "arbitrum",
35
+ Base: "base",
36
+ } as const;
37
+ /**
38
+ * The destination chain where USDC will be minted.
39
+ */
40
+ export type DestinationChain = ClosedEnum<typeof DestinationChain>;
41
+
42
+ /**
43
+ * Request model for CCTP depositForBurn transaction from a smart account.
44
+ *
45
+ * @remarks
46
+ *
47
+ * Burns USDC from an Earn Account (Safe) to initiate a cross-chain transfer
48
+ * via Circle's CCTP. The transaction is executed through the Safe contract,
49
+ * supporting both direct owner execution and gas-sponsored transactions.
50
+ *
51
+ * Flow:
52
+ * 1. Owner calls this endpoint to get either:
53
+ * - An unsigned transaction (gas_sponsorship=False)
54
+ * - EIP-712 typed data for signing (gas_sponsorship=True)
55
+ * 2. Owner signs the transaction/typed data
56
+ * 3. Transaction is broadcast on source chain
57
+ * 4. Wait for Circle's attestation service
58
+ * 5. Call receiveMessage on destination chain to mint USDC
59
+ */
60
+ export type DepositForBurnRequest = {
61
+ /**
62
+ * The primary wallet address that owns and controls the Earn Account (Safe).
63
+ */
64
+ owner: string;
65
+ /**
66
+ * The source chain where USDC will be burned.
67
+ */
68
+ chain: DepositForBurnRequestChain;
69
+ /**
70
+ * The amount of USDC to bridge (in token units, e.g., 100.5 for 100.5 USDC).
71
+ */
72
+ amount: number | string;
73
+ /**
74
+ * The destination chain where USDC will be minted.
75
+ */
76
+ destinationChain: DestinationChain;
77
+ /**
78
+ * The recipient address on the destination chain.
79
+ */
80
+ destinationAddress: string;
81
+ /**
82
+ * Optionally request gas sponsorship. If set to `true`, EIP-712 typed data will be returned that must be signed by the `owner` and submitted to the 'Prepare gas-sponsored transaction' endpoint (`/gas_sponsorship/prepare`).
83
+ */
84
+ gasSponsorship?: boolean | undefined;
85
+ };
86
+
87
+ /** @internal */
88
+ export const DepositForBurnRequestChain$outboundSchema: z.ZodNativeEnum<
89
+ typeof DepositForBurnRequestChain
90
+ > = z.nativeEnum(DepositForBurnRequestChain);
91
+
92
+ /** @internal */
93
+ export type DepositForBurnRequestAmount$Outbound = number | string;
94
+
95
+ /** @internal */
96
+ export const DepositForBurnRequestAmount$outboundSchema: z.ZodType<
97
+ DepositForBurnRequestAmount$Outbound,
98
+ z.ZodTypeDef,
99
+ DepositForBurnRequestAmount
100
+ > = z.union([z.number(), z.string()]);
101
+
102
+ export function depositForBurnRequestAmountToJSON(
103
+ depositForBurnRequestAmount: DepositForBurnRequestAmount,
104
+ ): string {
105
+ return JSON.stringify(
106
+ DepositForBurnRequestAmount$outboundSchema.parse(
107
+ depositForBurnRequestAmount,
108
+ ),
109
+ );
110
+ }
111
+
112
+ /** @internal */
113
+ export const DestinationChain$outboundSchema: z.ZodNativeEnum<
114
+ typeof DestinationChain
115
+ > = z.nativeEnum(DestinationChain);
116
+
117
+ /** @internal */
118
+ export type DepositForBurnRequest$Outbound = {
119
+ owner: string;
120
+ chain: string;
121
+ amount: number | string;
122
+ destination_chain: string;
123
+ destination_address: string;
124
+ gas_sponsorship?: boolean | undefined;
125
+ };
126
+
127
+ /** @internal */
128
+ export const DepositForBurnRequest$outboundSchema: z.ZodType<
129
+ DepositForBurnRequest$Outbound,
130
+ z.ZodTypeDef,
131
+ DepositForBurnRequest
132
+ > = z.object({
133
+ owner: z.string(),
134
+ chain: DepositForBurnRequestChain$outboundSchema,
135
+ amount: z.union([z.number(), z.string()]),
136
+ destinationChain: DestinationChain$outboundSchema,
137
+ destinationAddress: z.string(),
138
+ gasSponsorship: z.boolean().optional(),
139
+ }).transform((v) => {
140
+ return remap$(v, {
141
+ destinationChain: "destination_chain",
142
+ destinationAddress: "destination_address",
143
+ gasSponsorship: "gas_sponsorship",
144
+ });
145
+ });
146
+
147
+ export function depositForBurnRequestToJSON(
148
+ depositForBurnRequest: DepositForBurnRequest,
149
+ ): string {
150
+ return JSON.stringify(
151
+ DepositForBurnRequest$outboundSchema.parse(depositForBurnRequest),
152
+ );
153
+ }
@@ -0,0 +1,72 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
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 {
11
+ BatchedSafeOperationsResponseOutput,
12
+ BatchedSafeOperationsResponseOutput$inboundSchema,
13
+ } from "./batchedsafeoperationsresponseoutput.js";
14
+ import {
15
+ UnsignedTransaction,
16
+ UnsignedTransaction$inboundSchema,
17
+ } from "./unsignedtransaction.js";
18
+
19
+ /**
20
+ * Response model for CCTP depositForBurn transaction from a smart account.
21
+ *
22
+ * @remarks
23
+ *
24
+ * Contains either an unsigned transaction for direct submission or EIP-712 typed
25
+ * data for gas-sponsored transactions. Also includes a bridge_id for tracking
26
+ * the cross-chain transfer.
27
+ *
28
+ * Attributes:
29
+ * bridge_id: Unique identifier for this bridge operation. Use this ID when
30
+ * calling /mint/prepare to complete the cross-chain transfer. The API
31
+ * tracks the bridge state and will automatically poll for Circle's
32
+ * attestation.
33
+ * transaction: Unsigned transaction for the owner to sign and submit directly.
34
+ * Present when gas_sponsorship=False.
35
+ * eip_712: EIP-712 typed data for off-chain signing. The owner signs this
36
+ * data and submits it to /gas_sponsorship/prepare for a relayer to execute.
37
+ * Present when gas_sponsorship=True.
38
+ */
39
+ export type DepositForBurnResponse = {
40
+ /**
41
+ * Unique bridge identifier for tracking this cross-chain transfer. Use this ID when calling /mint/prepare to complete the transfer. Only present when Redis is configured on the server.
42
+ */
43
+ bridgeId?: string | null | undefined;
44
+ transaction: UnsignedTransaction | null;
45
+ eip712: BatchedSafeOperationsResponseOutput | null;
46
+ };
47
+
48
+ /** @internal */
49
+ export const DepositForBurnResponse$inboundSchema: z.ZodType<
50
+ DepositForBurnResponse,
51
+ z.ZodTypeDef,
52
+ unknown
53
+ > = z.object({
54
+ bridge_id: z.nullable(z.string()).optional(),
55
+ transaction: z.nullable(UnsignedTransaction$inboundSchema),
56
+ eip_712: z.nullable(BatchedSafeOperationsResponseOutput$inboundSchema),
57
+ }).transform((v) => {
58
+ return remap$(v, {
59
+ "bridge_id": "bridgeId",
60
+ "eip_712": "eip712",
61
+ });
62
+ });
63
+
64
+ export function depositForBurnResponseFromJSON(
65
+ jsonString: string,
66
+ ): SafeParseResult<DepositForBurnResponse, SDKValidationError> {
67
+ return safeParse(
68
+ jsonString,
69
+ (x) => DepositForBurnResponse$inboundSchema.parse(JSON.parse(x)),
70
+ `Failed to parse 'DepositForBurnResponse' from JSON`,
71
+ );
72
+ }
@@ -78,6 +78,8 @@ export * from "./compassapibackendv2modelssafetransactresponsebatchedsafeoperati
78
78
  export * from "./cooldownposition.js";
79
79
  export * from "./createaccountrequest.js";
80
80
  export * from "./createaccountresponse.js";
81
+ export * from "./depositforburnrequest.js";
82
+ export * from "./depositforburnresponse.js";
81
83
  export * from "./details.js";
82
84
  export * from "./earnmanagerequest.js";
83
85
  export * from "./earnmanageresponse.js";
@@ -108,6 +110,9 @@ export * from "./market.js";
108
110
  export * from "./marketposition.js";
109
111
  export * from "./markettokens.js";
110
112
  export * from "./maxsupplyapydata.js";
113
+ export * from "./mintpreparependingresponse.js";
114
+ export * from "./mintpreparereadyresponse.js";
115
+ export * from "./mintpreparerequest.js";
111
116
  export * from "./morphoborrowparams.js";
112
117
  export * from "./morphoborrowrequest.js";
113
118
  export * from "./morphocheckmarketpositionresponse.js";