@compass-labs/api-sdk 2.2.70-rc.0 → 2.2.70

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 (175) hide show
  1. package/README.md +13 -3
  2. package/codeSamples_typescript.yaml +18 -0
  3. package/dist/commonjs/funcs/onrampOnrampCreate.d.ts +38 -0
  4. package/dist/commonjs/funcs/onrampOnrampCreate.d.ts.map +1 -0
  5. package/dist/commonjs/funcs/onrampOnrampCreate.js +139 -0
  6. package/dist/commonjs/funcs/onrampOnrampCreate.js.map +1 -0
  7. package/dist/commonjs/funcs/onrampOnrampQuote.d.ts +27 -0
  8. package/dist/commonjs/funcs/onrampOnrampQuote.d.ts.map +1 -0
  9. package/dist/commonjs/funcs/onrampOnrampQuote.js +128 -0
  10. package/dist/commonjs/funcs/onrampOnrampQuote.js.map +1 -0
  11. package/dist/commonjs/funcs/onrampOnrampStatus.d.ts +31 -0
  12. package/dist/commonjs/funcs/onrampOnrampStatus.d.ts.map +1 -0
  13. package/dist/commonjs/funcs/onrampOnrampStatus.js +135 -0
  14. package/dist/commonjs/funcs/onrampOnrampStatus.js.map +1 -0
  15. package/dist/commonjs/lib/config.d.ts +2 -2
  16. package/dist/commonjs/lib/config.js +2 -2
  17. package/dist/commonjs/models/components/index.d.ts +6 -0
  18. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  19. package/dist/commonjs/models/components/index.js +6 -0
  20. package/dist/commonjs/models/components/index.js.map +1 -1
  21. package/dist/commonjs/models/components/onrampcreate.d.ts +59 -0
  22. package/dist/commonjs/models/components/onrampcreate.d.ts.map +1 -0
  23. package/dist/commonjs/models/components/onrampcreate.js +75 -0
  24. package/dist/commonjs/models/components/onrampcreate.js.map +1 -0
  25. package/dist/commonjs/models/components/onrampcreaterequest.d.ts +40 -0
  26. package/dist/commonjs/models/components/onrampcreaterequest.d.ts.map +1 -0
  27. package/dist/commonjs/models/components/onrampcreaterequest.js +60 -0
  28. package/dist/commonjs/models/components/onrampcreaterequest.js.map +1 -0
  29. package/dist/commonjs/models/components/onrampfees.d.ts +29 -0
  30. package/dist/commonjs/models/components/onrampfees.d.ts.map +1 -0
  31. package/dist/commonjs/models/components/onrampfees.js +59 -0
  32. package/dist/commonjs/models/components/onrampfees.js.map +1 -0
  33. package/dist/commonjs/models/components/onrampquote.d.ts +58 -0
  34. package/dist/commonjs/models/components/onrampquote.d.ts.map +1 -0
  35. package/dist/commonjs/models/components/onrampquote.js +73 -0
  36. package/dist/commonjs/models/components/onrampquote.js.map +1 -0
  37. package/dist/commonjs/models/components/onrampquoterequest.d.ts +34 -0
  38. package/dist/commonjs/models/components/onrampquoterequest.d.ts.map +1 -0
  39. package/dist/commonjs/models/components/onrampquoterequest.js +58 -0
  40. package/dist/commonjs/models/components/onrampquoterequest.js.map +1 -0
  41. package/dist/commonjs/models/components/onrampstatus.d.ts +57 -0
  42. package/dist/commonjs/models/components/onrampstatus.d.ts.map +1 -0
  43. package/dist/commonjs/models/components/onrampstatus.js +75 -0
  44. package/dist/commonjs/models/components/onrampstatus.js.map +1 -0
  45. package/dist/commonjs/models/components/orderstatus.d.ts +4 -4
  46. package/dist/commonjs/models/components/orderstatus.d.ts.map +1 -1
  47. package/dist/commonjs/models/components/orderstatus.js +4 -5
  48. package/dist/commonjs/models/components/orderstatus.js.map +1 -1
  49. package/dist/commonjs/models/errors/index.d.ts +1 -0
  50. package/dist/commonjs/models/errors/index.d.ts.map +1 -1
  51. package/dist/commonjs/models/errors/index.js +1 -0
  52. package/dist/commonjs/models/errors/index.js.map +1 -1
  53. package/dist/commonjs/models/errors/onramperrorresponse.d.ts +44 -0
  54. package/dist/commonjs/models/errors/onramperrorresponse.d.ts.map +1 -0
  55. package/dist/commonjs/models/errors/onramperrorresponse.js +75 -0
  56. package/dist/commonjs/models/errors/onramperrorresponse.js.map +1 -0
  57. package/dist/commonjs/models/operations/index.d.ts +1 -0
  58. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  59. package/dist/commonjs/models/operations/index.js +1 -0
  60. package/dist/commonjs/models/operations/index.js.map +1 -1
  61. package/dist/commonjs/models/operations/v2onrampstatus.d.ts +15 -0
  62. package/dist/commonjs/models/operations/v2onrampstatus.d.ts.map +1 -0
  63. package/dist/commonjs/models/operations/v2onrampstatus.js +54 -0
  64. package/dist/commonjs/models/operations/v2onrampstatus.js.map +1 -0
  65. package/dist/commonjs/sdk/onramp.d.ts +68 -0
  66. package/dist/commonjs/sdk/onramp.d.ts.map +1 -0
  67. package/dist/commonjs/sdk/onramp.js +83 -0
  68. package/dist/commonjs/sdk/onramp.js.map +1 -0
  69. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  70. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  71. package/dist/commonjs/sdk/sdk.js +4 -0
  72. package/dist/commonjs/sdk/sdk.js.map +1 -1
  73. package/dist/esm/funcs/onrampOnrampCreate.d.ts +38 -0
  74. package/dist/esm/funcs/onrampOnrampCreate.d.ts.map +1 -0
  75. package/dist/esm/funcs/onrampOnrampCreate.js +103 -0
  76. package/dist/esm/funcs/onrampOnrampCreate.js.map +1 -0
  77. package/dist/esm/funcs/onrampOnrampQuote.d.ts +27 -0
  78. package/dist/esm/funcs/onrampOnrampQuote.d.ts.map +1 -0
  79. package/dist/esm/funcs/onrampOnrampQuote.js +92 -0
  80. package/dist/esm/funcs/onrampOnrampQuote.js.map +1 -0
  81. package/dist/esm/funcs/onrampOnrampStatus.d.ts +31 -0
  82. package/dist/esm/funcs/onrampOnrampStatus.d.ts.map +1 -0
  83. package/dist/esm/funcs/onrampOnrampStatus.js +99 -0
  84. package/dist/esm/funcs/onrampOnrampStatus.js.map +1 -0
  85. package/dist/esm/lib/config.d.ts +2 -2
  86. package/dist/esm/lib/config.js +2 -2
  87. package/dist/esm/models/components/index.d.ts +6 -0
  88. package/dist/esm/models/components/index.d.ts.map +1 -1
  89. package/dist/esm/models/components/index.js +6 -0
  90. package/dist/esm/models/components/index.js.map +1 -1
  91. package/dist/esm/models/components/onrampcreate.d.ts +59 -0
  92. package/dist/esm/models/components/onrampcreate.d.ts.map +1 -0
  93. package/dist/esm/models/components/onrampcreate.js +38 -0
  94. package/dist/esm/models/components/onrampcreate.js.map +1 -0
  95. package/dist/esm/models/components/onrampcreaterequest.d.ts +40 -0
  96. package/dist/esm/models/components/onrampcreaterequest.d.ts.map +1 -0
  97. package/dist/esm/models/components/onrampcreaterequest.js +23 -0
  98. package/dist/esm/models/components/onrampcreaterequest.js.map +1 -0
  99. package/dist/esm/models/components/onrampfees.d.ts +29 -0
  100. package/dist/esm/models/components/onrampfees.d.ts.map +1 -0
  101. package/dist/esm/models/components/onrampfees.js +22 -0
  102. package/dist/esm/models/components/onrampfees.js.map +1 -0
  103. package/dist/esm/models/components/onrampquote.d.ts +58 -0
  104. package/dist/esm/models/components/onrampquote.d.ts.map +1 -0
  105. package/dist/esm/models/components/onrampquote.js +36 -0
  106. package/dist/esm/models/components/onrampquote.js.map +1 -0
  107. package/dist/esm/models/components/onrampquoterequest.d.ts +34 -0
  108. package/dist/esm/models/components/onrampquoterequest.d.ts.map +1 -0
  109. package/dist/esm/models/components/onrampquoterequest.js +21 -0
  110. package/dist/esm/models/components/onrampquoterequest.js.map +1 -0
  111. package/dist/esm/models/components/onrampstatus.d.ts +57 -0
  112. package/dist/esm/models/components/onrampstatus.d.ts.map +1 -0
  113. package/dist/esm/models/components/onrampstatus.js +38 -0
  114. package/dist/esm/models/components/onrampstatus.js.map +1 -0
  115. package/dist/esm/models/components/orderstatus.d.ts +4 -4
  116. package/dist/esm/models/components/orderstatus.d.ts.map +1 -1
  117. package/dist/esm/models/components/orderstatus.js +3 -4
  118. package/dist/esm/models/components/orderstatus.js.map +1 -1
  119. package/dist/esm/models/errors/index.d.ts +1 -0
  120. package/dist/esm/models/errors/index.d.ts.map +1 -1
  121. package/dist/esm/models/errors/index.js +1 -0
  122. package/dist/esm/models/errors/index.js.map +1 -1
  123. package/dist/esm/models/errors/onramperrorresponse.d.ts +44 -0
  124. package/dist/esm/models/errors/onramperrorresponse.d.ts.map +1 -0
  125. package/dist/esm/models/errors/onramperrorresponse.js +38 -0
  126. package/dist/esm/models/errors/onramperrorresponse.js.map +1 -0
  127. package/dist/esm/models/operations/index.d.ts +1 -0
  128. package/dist/esm/models/operations/index.d.ts.map +1 -1
  129. package/dist/esm/models/operations/index.js +1 -0
  130. package/dist/esm/models/operations/index.js.map +1 -1
  131. package/dist/esm/models/operations/v2onrampstatus.d.ts +15 -0
  132. package/dist/esm/models/operations/v2onrampstatus.d.ts.map +1 -0
  133. package/dist/esm/models/operations/v2onrampstatus.js +17 -0
  134. package/dist/esm/models/operations/v2onrampstatus.js.map +1 -0
  135. package/dist/esm/sdk/onramp.d.ts +68 -0
  136. package/dist/esm/sdk/onramp.d.ts.map +1 -0
  137. package/dist/esm/sdk/onramp.js +79 -0
  138. package/dist/esm/sdk/onramp.js.map +1 -0
  139. package/dist/esm/sdk/sdk.d.ts +3 -0
  140. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  141. package/dist/esm/sdk/sdk.js +4 -0
  142. package/dist/esm/sdk/sdk.js.map +1 -1
  143. package/docs/models/components/onrampcreate.md +43 -0
  144. package/docs/models/components/onrampcreaterequest.md +29 -0
  145. package/docs/models/components/onrampcreatestatus.md +17 -0
  146. package/docs/models/components/onrampfees.md +26 -0
  147. package/docs/models/components/onrampquote.md +36 -0
  148. package/docs/models/components/onrampquoterequest.md +27 -0
  149. package/docs/models/components/onrampstatus.md +28 -0
  150. package/docs/models/components/onrampstatusstatus.md +17 -0
  151. package/docs/models/components/orderstatus.md +1 -1
  152. package/docs/models/components/{status.md → orderstatusstatus.md} +3 -3
  153. package/docs/models/errors/onramperrorresponse.md +21 -0
  154. package/docs/models/operations/v2onrampstatusrequest.md +17 -0
  155. package/docs/sdks/onramp/README.md +283 -0
  156. package/openapi_prepped_for_speakeasy.json +539 -0
  157. package/package.json +1 -1
  158. package/src/funcs/onrampOnrampCreate.ts +192 -0
  159. package/src/funcs/onrampOnrampQuote.ts +181 -0
  160. package/src/funcs/onrampOnrampStatus.ts +189 -0
  161. package/src/lib/config.ts +2 -2
  162. package/src/models/components/index.ts +6 -0
  163. package/src/models/components/onrampcreate.ts +97 -0
  164. package/src/models/components/onrampcreaterequest.ts +70 -0
  165. package/src/models/components/onrampfees.ts +59 -0
  166. package/src/models/components/onrampquote.ts +101 -0
  167. package/src/models/components/onrampquoterequest.ts +62 -0
  168. package/src/models/components/onrampstatus.ts +96 -0
  169. package/src/models/components/orderstatus.ts +7 -6
  170. package/src/models/errors/index.ts +1 -0
  171. package/src/models/errors/onramperrorresponse.ts +75 -0
  172. package/src/models/operations/index.ts +1 -0
  173. package/src/models/operations/v2onrampstatus.ts +39 -0
  174. package/src/sdk/onramp.ts +105 -0
  175. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,192 @@
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 { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Create a fiat on-ramp payment + get the checkout link
31
+ *
32
+ * @remarks
33
+ * Create a fiat on-ramp payment and return the browser-checkout handoff.
34
+ *
35
+ * A fiat card + identity-verification flow can only render in a browser, so
36
+ * this endpoint returns a **`checkout_url`** (a Compass-hosted page) together
37
+ * with `payment_id`, the one-time-wallet `deposit_address`, an initial
38
+ * `status`, and a `user_instructions` string.
39
+ *
40
+ * **How to drive this (CLI / MCP agent / UI):**
41
+ *
42
+ * 1. **Present `checkout_url` to the user and open it in a browser.** It
43
+ * renders the card payment + identity verification and delivers USDC on
44
+ * Ethereum to the destination wallet. (An MCP agent cannot open a browser
45
+ * itself — show the link and ask the user to open it.)
46
+ * 2. **Poll `GET /v2/onramp/status?payment_id=...`** until `status` becomes
47
+ * `delivered` (or `failed`). `pending` = awaiting payment, `processing` =
48
+ * payment received and bridging/swapping to USDC.
49
+ * 3. Once `delivered`, the USDC is in the user's own wallet — continue with
50
+ * the tokenized buy.
51
+ *
52
+ * Funds are never held by Compass: the `deposit_address` is a one-time wallet
53
+ * owned solely by the user's wallet.
54
+ */
55
+ export function onrampOnrampCreate(
56
+ client: CompassApiSDKCore,
57
+ request: components.OnrampCreateRequest,
58
+ options?: RequestOptions,
59
+ ): APIPromise<
60
+ Result<
61
+ components.OnrampCreate,
62
+ | errors.OnrampErrorResponse
63
+ | CompassAPISDKError
64
+ | ResponseValidationError
65
+ | ConnectionError
66
+ | RequestAbortedError
67
+ | RequestTimeoutError
68
+ | InvalidRequestError
69
+ | UnexpectedClientError
70
+ | SDKValidationError
71
+ >
72
+ > {
73
+ return new APIPromise($do(
74
+ client,
75
+ request,
76
+ options,
77
+ ));
78
+ }
79
+
80
+ async function $do(
81
+ client: CompassApiSDKCore,
82
+ request: components.OnrampCreateRequest,
83
+ options?: RequestOptions,
84
+ ): Promise<
85
+ [
86
+ Result<
87
+ components.OnrampCreate,
88
+ | errors.OnrampErrorResponse
89
+ | CompassAPISDKError
90
+ | ResponseValidationError
91
+ | ConnectionError
92
+ | RequestAbortedError
93
+ | RequestTimeoutError
94
+ | InvalidRequestError
95
+ | UnexpectedClientError
96
+ | SDKValidationError
97
+ >,
98
+ APICall,
99
+ ]
100
+ > {
101
+ const parsed = safeParse(
102
+ request,
103
+ (value) => components.OnrampCreateRequest$outboundSchema.parse(value),
104
+ "Input validation failed",
105
+ );
106
+ if (!parsed.ok) {
107
+ return [parsed, { status: "invalid" }];
108
+ }
109
+ const payload = parsed.value;
110
+ const body = encodeJSON("body", payload, { explode: true });
111
+
112
+ const path = pathToFunc("/v2/onramp/create")();
113
+
114
+ const headers = new Headers(compactMap({
115
+ "Content-Type": "application/json",
116
+ Accept: "application/json",
117
+ }));
118
+
119
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
120
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
121
+ const requestSecurity = resolveGlobalSecurity(securityInput);
122
+
123
+ const context = {
124
+ options: client._options,
125
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
126
+ operationID: "v2_onramp_create",
127
+ oAuth2Scopes: null,
128
+
129
+ resolvedSecurity: requestSecurity,
130
+
131
+ securitySource: client._options.apiKeyAuth,
132
+ retryConfig: options?.retries
133
+ || client._options.retryConfig
134
+ || { strategy: "none" },
135
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
136
+ };
137
+
138
+ const requestRes = client._createRequest(context, {
139
+ security: requestSecurity,
140
+ method: "POST",
141
+ baseURL: options?.serverURL,
142
+ path: path,
143
+ headers: headers,
144
+ body: body,
145
+ userAgent: client._options.userAgent,
146
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
147
+ }, options);
148
+ if (!requestRes.ok) {
149
+ return [requestRes, { status: "invalid" }];
150
+ }
151
+ const req = requestRes.value;
152
+
153
+ const doResult = await client._do(req, {
154
+ context,
155
+ isErrorStatusCode: (statusCode: number) =>
156
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
157
+ retryConfig: context.retryConfig,
158
+ retryCodes: context.retryCodes,
159
+ });
160
+ if (!doResult.ok) {
161
+ return [doResult, { status: "request-error", request: req }];
162
+ }
163
+ const response = doResult.value;
164
+
165
+ const responseFields = {
166
+ HttpMeta: { Response: response, Request: req },
167
+ };
168
+
169
+ const [result] = await M.match<
170
+ components.OnrampCreate,
171
+ | errors.OnrampErrorResponse
172
+ | CompassAPISDKError
173
+ | ResponseValidationError
174
+ | ConnectionError
175
+ | RequestAbortedError
176
+ | RequestTimeoutError
177
+ | InvalidRequestError
178
+ | UnexpectedClientError
179
+ | SDKValidationError
180
+ >(
181
+ M.json(200, components.OnrampCreate$inboundSchema),
182
+ M.jsonErr([400, 402, 410, 422], errors.OnrampErrorResponse$inboundSchema),
183
+ M.jsonErr(502, errors.OnrampErrorResponse$inboundSchema),
184
+ M.fail("4XX"),
185
+ M.fail("5XX"),
186
+ )(response, req, { extraFields: responseFields });
187
+ if (!result.ok) {
188
+ return [result, { status: "complete", request: req, response }];
189
+ }
190
+
191
+ return [result, { status: "complete", request: req, response }];
192
+ }
@@ -0,0 +1,181 @@
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 { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+
29
+ /**
30
+ * Get a fiat on-ramp quote (card -> USDC on Ethereum)
31
+ *
32
+ * @remarks
33
+ * Get an indicative quote for buying USDC on Ethereum with a card.
34
+ *
35
+ * Returns the estimated USDC the user will receive for a given fiat amount,
36
+ * the exchange rate, fee breakdown (`business_fees` is `0`), and the provider
37
+ * min/max limits. The output is always **USDC on Ethereum** delivered to the
38
+ * `destination_address` — this is a non-custodial on-ramp, so Compass never
39
+ * holds the funds.
40
+ *
41
+ * This quote is indicative and may expire (`expires_at`). To actually start a
42
+ * payment, call `POST /v2/onramp/create`.
43
+ */
44
+ export function onrampOnrampQuote(
45
+ client: CompassApiSDKCore,
46
+ request: components.OnrampQuoteRequest,
47
+ options?: RequestOptions,
48
+ ): APIPromise<
49
+ Result<
50
+ components.OnrampQuote,
51
+ | errors.OnrampErrorResponse
52
+ | CompassAPISDKError
53
+ | ResponseValidationError
54
+ | ConnectionError
55
+ | RequestAbortedError
56
+ | RequestTimeoutError
57
+ | InvalidRequestError
58
+ | UnexpectedClientError
59
+ | SDKValidationError
60
+ >
61
+ > {
62
+ return new APIPromise($do(
63
+ client,
64
+ request,
65
+ options,
66
+ ));
67
+ }
68
+
69
+ async function $do(
70
+ client: CompassApiSDKCore,
71
+ request: components.OnrampQuoteRequest,
72
+ options?: RequestOptions,
73
+ ): Promise<
74
+ [
75
+ Result<
76
+ components.OnrampQuote,
77
+ | errors.OnrampErrorResponse
78
+ | CompassAPISDKError
79
+ | ResponseValidationError
80
+ | ConnectionError
81
+ | RequestAbortedError
82
+ | RequestTimeoutError
83
+ | InvalidRequestError
84
+ | UnexpectedClientError
85
+ | SDKValidationError
86
+ >,
87
+ APICall,
88
+ ]
89
+ > {
90
+ const parsed = safeParse(
91
+ request,
92
+ (value) => components.OnrampQuoteRequest$outboundSchema.parse(value),
93
+ "Input validation failed",
94
+ );
95
+ if (!parsed.ok) {
96
+ return [parsed, { status: "invalid" }];
97
+ }
98
+ const payload = parsed.value;
99
+ const body = encodeJSON("body", payload, { explode: true });
100
+
101
+ const path = pathToFunc("/v2/onramp/quote")();
102
+
103
+ const headers = new Headers(compactMap({
104
+ "Content-Type": "application/json",
105
+ Accept: "application/json",
106
+ }));
107
+
108
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
109
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
110
+ const requestSecurity = resolveGlobalSecurity(securityInput);
111
+
112
+ const context = {
113
+ options: client._options,
114
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
115
+ operationID: "v2_onramp_quote",
116
+ oAuth2Scopes: null,
117
+
118
+ resolvedSecurity: requestSecurity,
119
+
120
+ securitySource: client._options.apiKeyAuth,
121
+ retryConfig: options?.retries
122
+ || client._options.retryConfig
123
+ || { strategy: "none" },
124
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
125
+ };
126
+
127
+ const requestRes = client._createRequest(context, {
128
+ security: requestSecurity,
129
+ method: "POST",
130
+ baseURL: options?.serverURL,
131
+ path: path,
132
+ headers: headers,
133
+ body: body,
134
+ userAgent: client._options.userAgent,
135
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return [requestRes, { status: "invalid" }];
139
+ }
140
+ const req = requestRes.value;
141
+
142
+ const doResult = await client._do(req, {
143
+ context,
144
+ isErrorStatusCode: (statusCode: number) =>
145
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
146
+ retryConfig: context.retryConfig,
147
+ retryCodes: context.retryCodes,
148
+ });
149
+ if (!doResult.ok) {
150
+ return [doResult, { status: "request-error", request: req }];
151
+ }
152
+ const response = doResult.value;
153
+
154
+ const responseFields = {
155
+ HttpMeta: { Response: response, Request: req },
156
+ };
157
+
158
+ const [result] = await M.match<
159
+ components.OnrampQuote,
160
+ | errors.OnrampErrorResponse
161
+ | CompassAPISDKError
162
+ | ResponseValidationError
163
+ | ConnectionError
164
+ | RequestAbortedError
165
+ | RequestTimeoutError
166
+ | InvalidRequestError
167
+ | UnexpectedClientError
168
+ | SDKValidationError
169
+ >(
170
+ M.json(200, components.OnrampQuote$inboundSchema),
171
+ M.jsonErr([400, 422], errors.OnrampErrorResponse$inboundSchema),
172
+ M.jsonErr(502, errors.OnrampErrorResponse$inboundSchema),
173
+ M.fail("4XX"),
174
+ M.fail("5XX"),
175
+ )(response, req, { extraFields: responseFields });
176
+ if (!result.ok) {
177
+ return [result, { status: "complete", request: req, response }];
178
+ }
179
+
180
+ return [result, { status: "complete", request: req, response }];
181
+ }
@@ -0,0 +1,189 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { CompassApiSDKCore } from "../core.js";
6
+ import { encodeFormQuery } from "../lib/encodings.js";
7
+ import { matchStatusCode } from "../lib/http.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import * as components from "../models/components/index.js";
15
+ import { CompassAPISDKError } from "../models/errors/compassapisdkerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Get the status of a fiat on-ramp payment
32
+ *
33
+ * @remarks
34
+ * Get the current status of a fiat on-ramp payment.
35
+ *
36
+ * Poll this after `create` until `status` is `delivered`. The `status` field
37
+ * is one of:
38
+ *
39
+ * - `pending` — awaiting the card payment in the hosted checkout.
40
+ * - `processing` — payment received; bridging/swapping the proceeds to USDC.
41
+ * - `delivered` — USDC has been delivered to the destination wallet
42
+ * (`delivery_tx_hash` and `output_amount_delivered` are populated).
43
+ * - `failed` — the payment failed, expired, or was refunded.
44
+ *
45
+ * State is re-read live from the on-ramp provider on every call — Compass
46
+ * stores nothing of its own.
47
+ */
48
+ export function onrampOnrampStatus(
49
+ client: CompassApiSDKCore,
50
+ request: operations.V2OnrampStatusRequest,
51
+ options?: RequestOptions,
52
+ ): APIPromise<
53
+ Result<
54
+ components.OnrampStatus,
55
+ | errors.OnrampErrorResponse
56
+ | CompassAPISDKError
57
+ | ResponseValidationError
58
+ | ConnectionError
59
+ | RequestAbortedError
60
+ | RequestTimeoutError
61
+ | InvalidRequestError
62
+ | UnexpectedClientError
63
+ | SDKValidationError
64
+ >
65
+ > {
66
+ return new APIPromise($do(
67
+ client,
68
+ request,
69
+ options,
70
+ ));
71
+ }
72
+
73
+ async function $do(
74
+ client: CompassApiSDKCore,
75
+ request: operations.V2OnrampStatusRequest,
76
+ options?: RequestOptions,
77
+ ): Promise<
78
+ [
79
+ Result<
80
+ components.OnrampStatus,
81
+ | errors.OnrampErrorResponse
82
+ | CompassAPISDKError
83
+ | ResponseValidationError
84
+ | ConnectionError
85
+ | RequestAbortedError
86
+ | RequestTimeoutError
87
+ | InvalidRequestError
88
+ | UnexpectedClientError
89
+ | SDKValidationError
90
+ >,
91
+ APICall,
92
+ ]
93
+ > {
94
+ const parsed = safeParse(
95
+ request,
96
+ (value) => operations.V2OnrampStatusRequest$outboundSchema.parse(value),
97
+ "Input validation failed",
98
+ );
99
+ if (!parsed.ok) {
100
+ return [parsed, { status: "invalid" }];
101
+ }
102
+ const payload = parsed.value;
103
+ const body = null;
104
+
105
+ const path = pathToFunc("/v2/onramp/status")();
106
+
107
+ const query = encodeFormQuery({
108
+ "payment_id": payload.payment_id,
109
+ });
110
+
111
+ const headers = new Headers(compactMap({
112
+ Accept: "application/json",
113
+ }));
114
+
115
+ const secConfig = await extractSecurity(client._options.apiKeyAuth);
116
+ const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
117
+ const requestSecurity = resolveGlobalSecurity(securityInput);
118
+
119
+ const context = {
120
+ options: client._options,
121
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
122
+ operationID: "v2_onramp_status",
123
+ oAuth2Scopes: null,
124
+
125
+ resolvedSecurity: requestSecurity,
126
+
127
+ securitySource: client._options.apiKeyAuth,
128
+ retryConfig: options?.retries
129
+ || client._options.retryConfig
130
+ || { strategy: "none" },
131
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
132
+ };
133
+
134
+ const requestRes = client._createRequest(context, {
135
+ security: requestSecurity,
136
+ method: "GET",
137
+ baseURL: options?.serverURL,
138
+ path: path,
139
+ headers: headers,
140
+ query: query,
141
+ body: body,
142
+ userAgent: client._options.userAgent,
143
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
144
+ }, options);
145
+ if (!requestRes.ok) {
146
+ return [requestRes, { status: "invalid" }];
147
+ }
148
+ const req = requestRes.value;
149
+
150
+ const doResult = await client._do(req, {
151
+ context,
152
+ isErrorStatusCode: (statusCode: number) =>
153
+ matchStatusCode({ status: statusCode } as Response, ["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.OnrampStatus,
168
+ | errors.OnrampErrorResponse
169
+ | CompassAPISDKError
170
+ | ResponseValidationError
171
+ | ConnectionError
172
+ | RequestAbortedError
173
+ | RequestTimeoutError
174
+ | InvalidRequestError
175
+ | UnexpectedClientError
176
+ | SDKValidationError
177
+ >(
178
+ M.json(200, components.OnrampStatus$inboundSchema),
179
+ M.jsonErr([404, 422], errors.OnrampErrorResponse$inboundSchema),
180
+ M.jsonErr(502, errors.OnrampErrorResponse$inboundSchema),
181
+ M.fail("4XX"),
182
+ M.fail("5XX"),
183
+ )(response, req, { extraFields: responseFields });
184
+ if (!result.ok) {
185
+ return [result, { status: "complete", request: req, response }];
186
+ }
187
+
188
+ return [result, { status: "complete", request: req, response }];
189
+ }
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.911.3",
65
+ genVersion: "2.912.1",
66
66
  userAgent:
67
- "speakeasy-sdk/typescript 2.0.0 2.911.3 0.0.1 @compass-labs/api-sdk",
67
+ "speakeasy-sdk/typescript 2.0.0 2.912.1 0.0.1 @compass-labs/api-sdk",
68
68
  } as const;
@@ -216,6 +216,12 @@ export * from "./odosswaprequest.js";
216
216
  export * from "./odostransactionresponse.js";
217
217
  export * from "./ohlccandle.js";
218
218
  export * from "./oneinchswapparams.js";
219
+ export * from "./onrampcreate.js";
220
+ export * from "./onrampcreaterequest.js";
221
+ export * from "./onrampfees.js";
222
+ export * from "./onrampquote.js";
223
+ export * from "./onrampquoterequest.js";
224
+ export * from "./onrampstatus.js";
219
225
  export * from "./openposition.js";
220
226
  export * from "./operationtype.js";
221
227
  export * from "./orderstatus.js";
@@ -0,0 +1,97 @@
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 { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import { OnrampQuote, OnrampQuote$inboundSchema } from "./onrampquote.js";
12
+
13
+ /**
14
+ * Initial lifecycle state (typically `pending`).
15
+ */
16
+ export const OnrampCreateStatus = {
17
+ Pending: "pending",
18
+ Processing: "processing",
19
+ Delivered: "delivered",
20
+ Failed: "failed",
21
+ } as const;
22
+ /**
23
+ * Initial lifecycle state (typically `pending`).
24
+ */
25
+ export type OnrampCreateStatus = ClosedEnum<typeof OnrampCreateStatus>;
26
+
27
+ /**
28
+ * A created on-ramp payment, with the browser-handoff affordances.
29
+ *
30
+ * @remarks
31
+ *
32
+ * The caller (CLI / MCP agent / UI) presents ``checkout_url`` to the user to
33
+ * pay by card and complete identity verification, then polls
34
+ * ``GET /v2/onramp/status`` until ``status`` is ``delivered``.
35
+ */
36
+ export type OnrampCreate = {
37
+ /**
38
+ * Halliday's payment id. Use it to poll status.
39
+ */
40
+ paymentId: string;
41
+ /**
42
+ * The one-time-wallet (OTW) deposit address for this payment, owned solely by the user's wallet (non-custodial).
43
+ */
44
+ depositAddress: string;
45
+ /**
46
+ * Compass-hosted checkout page to open in a browser. It renders the card + identity-verification flow and delivers USDC to the destination wallet.
47
+ */
48
+ checkoutUrl: string;
49
+ /**
50
+ * Short, agent-actionable guidance: open the checkout link, pay, then poll status until delivered.
51
+ */
52
+ userInstructions: string;
53
+ /**
54
+ * Initial lifecycle state (typically `pending`).
55
+ */
56
+ status: OnrampCreateStatus;
57
+ /**
58
+ * An indicative fiat -> USDC-on-Ethereum quote.
59
+ */
60
+ quote: OnrampQuote;
61
+ };
62
+
63
+ /** @internal */
64
+ export const OnrampCreateStatus$inboundSchema: z.ZodNativeEnum<
65
+ typeof OnrampCreateStatus
66
+ > = z.nativeEnum(OnrampCreateStatus);
67
+
68
+ /** @internal */
69
+ export const OnrampCreate$inboundSchema: z.ZodType<
70
+ OnrampCreate,
71
+ z.ZodTypeDef,
72
+ unknown
73
+ > = z.object({
74
+ payment_id: z.string(),
75
+ deposit_address: z.string(),
76
+ checkout_url: z.string(),
77
+ user_instructions: z.string(),
78
+ status: OnrampCreateStatus$inboundSchema,
79
+ quote: OnrampQuote$inboundSchema,
80
+ }).transform((v) => {
81
+ return remap$(v, {
82
+ "payment_id": "paymentId",
83
+ "deposit_address": "depositAddress",
84
+ "checkout_url": "checkoutUrl",
85
+ "user_instructions": "userInstructions",
86
+ });
87
+ });
88
+
89
+ export function onrampCreateFromJSON(
90
+ jsonString: string,
91
+ ): SafeParseResult<OnrampCreate, SDKValidationError> {
92
+ return safeParse(
93
+ jsonString,
94
+ (x) => OnrampCreate$inboundSchema.parse(JSON.parse(x)),
95
+ `Failed to parse 'OnrampCreate' from JSON`,
96
+ );
97
+ }