@compass-labs/api-sdk 2.2.104 → 2.2.105-rc.0

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 (159) hide show
  1. package/README.md +3 -13
  2. package/codeSamples_typescript.yaml +0 -18
  3. package/dist/commonjs/models/components/index.d.ts +0 -6
  4. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  5. package/dist/commonjs/models/components/index.js +0 -6
  6. package/dist/commonjs/models/components/index.js.map +1 -1
  7. package/dist/commonjs/models/errors/index.d.ts +0 -1
  8. package/dist/commonjs/models/errors/index.d.ts.map +1 -1
  9. package/dist/commonjs/models/errors/index.js +0 -1
  10. package/dist/commonjs/models/errors/index.js.map +1 -1
  11. package/dist/commonjs/models/operations/index.d.ts +0 -1
  12. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  13. package/dist/commonjs/models/operations/index.js +0 -1
  14. package/dist/commonjs/models/operations/index.js.map +1 -1
  15. package/dist/commonjs/sdk/sdk.d.ts +0 -3
  16. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  17. package/dist/commonjs/sdk/sdk.js +0 -4
  18. package/dist/commonjs/sdk/sdk.js.map +1 -1
  19. package/dist/esm/models/components/index.d.ts +0 -6
  20. package/dist/esm/models/components/index.d.ts.map +1 -1
  21. package/dist/esm/models/components/index.js +0 -6
  22. package/dist/esm/models/components/index.js.map +1 -1
  23. package/dist/esm/models/errors/index.d.ts +0 -1
  24. package/dist/esm/models/errors/index.d.ts.map +1 -1
  25. package/dist/esm/models/errors/index.js +0 -1
  26. package/dist/esm/models/errors/index.js.map +1 -1
  27. package/dist/esm/models/operations/index.d.ts +0 -1
  28. package/dist/esm/models/operations/index.d.ts.map +1 -1
  29. package/dist/esm/models/operations/index.js +0 -1
  30. package/dist/esm/models/operations/index.js.map +1 -1
  31. package/dist/esm/sdk/sdk.d.ts +0 -3
  32. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  33. package/dist/esm/sdk/sdk.js +0 -4
  34. package/dist/esm/sdk/sdk.js.map +1 -1
  35. package/openapi_prepped_for_speakeasy.json +0 -539
  36. package/package.json +1 -1
  37. package/src/models/components/index.ts +0 -6
  38. package/src/models/errors/index.ts +0 -1
  39. package/src/models/operations/index.ts +0 -1
  40. package/src/sdk/sdk.ts +0 -6
  41. package/dist/commonjs/funcs/onrampOnrampCreate.d.ts +0 -38
  42. package/dist/commonjs/funcs/onrampOnrampCreate.d.ts.map +0 -1
  43. package/dist/commonjs/funcs/onrampOnrampCreate.js +0 -139
  44. package/dist/commonjs/funcs/onrampOnrampCreate.js.map +0 -1
  45. package/dist/commonjs/funcs/onrampOnrampQuote.d.ts +0 -27
  46. package/dist/commonjs/funcs/onrampOnrampQuote.d.ts.map +0 -1
  47. package/dist/commonjs/funcs/onrampOnrampQuote.js +0 -128
  48. package/dist/commonjs/funcs/onrampOnrampQuote.js.map +0 -1
  49. package/dist/commonjs/funcs/onrampOnrampStatus.d.ts +0 -31
  50. package/dist/commonjs/funcs/onrampOnrampStatus.d.ts.map +0 -1
  51. package/dist/commonjs/funcs/onrampOnrampStatus.js +0 -135
  52. package/dist/commonjs/funcs/onrampOnrampStatus.js.map +0 -1
  53. package/dist/commonjs/models/components/onrampcreate.d.ts +0 -59
  54. package/dist/commonjs/models/components/onrampcreate.d.ts.map +0 -1
  55. package/dist/commonjs/models/components/onrampcreate.js +0 -75
  56. package/dist/commonjs/models/components/onrampcreate.js.map +0 -1
  57. package/dist/commonjs/models/components/onrampcreaterequest.d.ts +0 -40
  58. package/dist/commonjs/models/components/onrampcreaterequest.d.ts.map +0 -1
  59. package/dist/commonjs/models/components/onrampcreaterequest.js +0 -60
  60. package/dist/commonjs/models/components/onrampcreaterequest.js.map +0 -1
  61. package/dist/commonjs/models/components/onrampfees.d.ts +0 -29
  62. package/dist/commonjs/models/components/onrampfees.d.ts.map +0 -1
  63. package/dist/commonjs/models/components/onrampfees.js +0 -59
  64. package/dist/commonjs/models/components/onrampfees.js.map +0 -1
  65. package/dist/commonjs/models/components/onrampquote.d.ts +0 -58
  66. package/dist/commonjs/models/components/onrampquote.d.ts.map +0 -1
  67. package/dist/commonjs/models/components/onrampquote.js +0 -73
  68. package/dist/commonjs/models/components/onrampquote.js.map +0 -1
  69. package/dist/commonjs/models/components/onrampquoterequest.d.ts +0 -34
  70. package/dist/commonjs/models/components/onrampquoterequest.d.ts.map +0 -1
  71. package/dist/commonjs/models/components/onrampquoterequest.js +0 -58
  72. package/dist/commonjs/models/components/onrampquoterequest.js.map +0 -1
  73. package/dist/commonjs/models/components/onrampstatus.d.ts +0 -57
  74. package/dist/commonjs/models/components/onrampstatus.d.ts.map +0 -1
  75. package/dist/commonjs/models/components/onrampstatus.js +0 -75
  76. package/dist/commonjs/models/components/onrampstatus.js.map +0 -1
  77. package/dist/commonjs/models/errors/onramperrorresponse.d.ts +0 -44
  78. package/dist/commonjs/models/errors/onramperrorresponse.d.ts.map +0 -1
  79. package/dist/commonjs/models/errors/onramperrorresponse.js +0 -75
  80. package/dist/commonjs/models/errors/onramperrorresponse.js.map +0 -1
  81. package/dist/commonjs/models/operations/v2onrampstatus.d.ts +0 -15
  82. package/dist/commonjs/models/operations/v2onrampstatus.d.ts.map +0 -1
  83. package/dist/commonjs/models/operations/v2onrampstatus.js +0 -54
  84. package/dist/commonjs/models/operations/v2onrampstatus.js.map +0 -1
  85. package/dist/commonjs/sdk/onramp.d.ts +0 -68
  86. package/dist/commonjs/sdk/onramp.d.ts.map +0 -1
  87. package/dist/commonjs/sdk/onramp.js +0 -83
  88. package/dist/commonjs/sdk/onramp.js.map +0 -1
  89. package/dist/esm/funcs/onrampOnrampCreate.d.ts +0 -38
  90. package/dist/esm/funcs/onrampOnrampCreate.d.ts.map +0 -1
  91. package/dist/esm/funcs/onrampOnrampCreate.js +0 -103
  92. package/dist/esm/funcs/onrampOnrampCreate.js.map +0 -1
  93. package/dist/esm/funcs/onrampOnrampQuote.d.ts +0 -27
  94. package/dist/esm/funcs/onrampOnrampQuote.d.ts.map +0 -1
  95. package/dist/esm/funcs/onrampOnrampQuote.js +0 -92
  96. package/dist/esm/funcs/onrampOnrampQuote.js.map +0 -1
  97. package/dist/esm/funcs/onrampOnrampStatus.d.ts +0 -31
  98. package/dist/esm/funcs/onrampOnrampStatus.d.ts.map +0 -1
  99. package/dist/esm/funcs/onrampOnrampStatus.js +0 -99
  100. package/dist/esm/funcs/onrampOnrampStatus.js.map +0 -1
  101. package/dist/esm/models/components/onrampcreate.d.ts +0 -59
  102. package/dist/esm/models/components/onrampcreate.d.ts.map +0 -1
  103. package/dist/esm/models/components/onrampcreate.js +0 -38
  104. package/dist/esm/models/components/onrampcreate.js.map +0 -1
  105. package/dist/esm/models/components/onrampcreaterequest.d.ts +0 -40
  106. package/dist/esm/models/components/onrampcreaterequest.d.ts.map +0 -1
  107. package/dist/esm/models/components/onrampcreaterequest.js +0 -23
  108. package/dist/esm/models/components/onrampcreaterequest.js.map +0 -1
  109. package/dist/esm/models/components/onrampfees.d.ts +0 -29
  110. package/dist/esm/models/components/onrampfees.d.ts.map +0 -1
  111. package/dist/esm/models/components/onrampfees.js +0 -22
  112. package/dist/esm/models/components/onrampfees.js.map +0 -1
  113. package/dist/esm/models/components/onrampquote.d.ts +0 -58
  114. package/dist/esm/models/components/onrampquote.d.ts.map +0 -1
  115. package/dist/esm/models/components/onrampquote.js +0 -36
  116. package/dist/esm/models/components/onrampquote.js.map +0 -1
  117. package/dist/esm/models/components/onrampquoterequest.d.ts +0 -34
  118. package/dist/esm/models/components/onrampquoterequest.d.ts.map +0 -1
  119. package/dist/esm/models/components/onrampquoterequest.js +0 -21
  120. package/dist/esm/models/components/onrampquoterequest.js.map +0 -1
  121. package/dist/esm/models/components/onrampstatus.d.ts +0 -57
  122. package/dist/esm/models/components/onrampstatus.d.ts.map +0 -1
  123. package/dist/esm/models/components/onrampstatus.js +0 -38
  124. package/dist/esm/models/components/onrampstatus.js.map +0 -1
  125. package/dist/esm/models/errors/onramperrorresponse.d.ts +0 -44
  126. package/dist/esm/models/errors/onramperrorresponse.d.ts.map +0 -1
  127. package/dist/esm/models/errors/onramperrorresponse.js +0 -38
  128. package/dist/esm/models/errors/onramperrorresponse.js.map +0 -1
  129. package/dist/esm/models/operations/v2onrampstatus.d.ts +0 -15
  130. package/dist/esm/models/operations/v2onrampstatus.d.ts.map +0 -1
  131. package/dist/esm/models/operations/v2onrampstatus.js +0 -17
  132. package/dist/esm/models/operations/v2onrampstatus.js.map +0 -1
  133. package/dist/esm/sdk/onramp.d.ts +0 -68
  134. package/dist/esm/sdk/onramp.d.ts.map +0 -1
  135. package/dist/esm/sdk/onramp.js +0 -79
  136. package/dist/esm/sdk/onramp.js.map +0 -1
  137. package/docs/models/components/onrampcreate.md +0 -43
  138. package/docs/models/components/onrampcreaterequest.md +0 -29
  139. package/docs/models/components/onrampcreatestatus.md +0 -17
  140. package/docs/models/components/onrampfees.md +0 -26
  141. package/docs/models/components/onrampquote.md +0 -36
  142. package/docs/models/components/onrampquoterequest.md +0 -27
  143. package/docs/models/components/onrampstatus.md +0 -28
  144. package/docs/models/components/onrampstatusstatus.md +0 -17
  145. package/docs/models/errors/onramperrorresponse.md +0 -21
  146. package/docs/models/operations/v2onrampstatusrequest.md +0 -17
  147. package/docs/sdks/onramp/README.md +0 -283
  148. package/src/funcs/onrampOnrampCreate.ts +0 -192
  149. package/src/funcs/onrampOnrampQuote.ts +0 -181
  150. package/src/funcs/onrampOnrampStatus.ts +0 -189
  151. package/src/models/components/onrampcreate.ts +0 -97
  152. package/src/models/components/onrampcreaterequest.ts +0 -70
  153. package/src/models/components/onrampfees.ts +0 -59
  154. package/src/models/components/onrampquote.ts +0 -101
  155. package/src/models/components/onrampquoterequest.ts +0 -62
  156. package/src/models/components/onrampstatus.ts +0 -96
  157. package/src/models/errors/onramperrorresponse.ts +0 -75
  158. package/src/models/operations/v2onrampstatus.ts +0 -39
  159. package/src/sdk/onramp.ts +0 -105
@@ -1,283 +0,0 @@
1
- # Onramp
2
-
3
- ## Overview
4
-
5
- ### Available Operations
6
-
7
- * [onrampQuote](#onrampquote) - Get a fiat on-ramp quote (card -> USDC on Ethereum)
8
- * [onrampCreate](#onrampcreate) - Create a fiat on-ramp payment + get the checkout link
9
- * [onrampStatus](#onrampstatus) - Get the status of a fiat on-ramp payment
10
-
11
- ## onrampQuote
12
-
13
- Get an indicative quote for buying USDC on Ethereum with a card.
14
-
15
- Returns the estimated USDC the user will receive for a given fiat amount,
16
- the exchange rate, fee breakdown (`business_fees` is `0`), and the provider
17
- min/max limits. The output is always **USDC on Ethereum** delivered to the
18
- `destination_address` — this is a non-custodial on-ramp, so Compass never
19
- holds the funds.
20
-
21
- This quote is indicative and may expire (`expires_at`). To actually start a
22
- payment, call `POST /v2/onramp/create`.
23
-
24
- ### Example Usage
25
-
26
- <!-- UsageSnippet language="typescript" operationID="v2_onramp_quote" method="post" path="/v2/onramp/quote" -->
27
- ```typescript
28
- import { CompassApiSDK } from "@compass-labs/api-sdk";
29
-
30
- const compassApiSDK = new CompassApiSDK({
31
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
32
- });
33
-
34
- async function run() {
35
- const result = await compassApiSDK.onramp.onrampQuote({
36
- fiatAmount: "<value>",
37
- fiatCurrency: "USD",
38
- destinationAddress: "<value>",
39
- });
40
-
41
- console.log(result);
42
- }
43
-
44
- run();
45
- ```
46
-
47
- ### Standalone function
48
-
49
- The standalone function version of this method:
50
-
51
- ```typescript
52
- import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
53
- import { onrampOnrampQuote } from "@compass-labs/api-sdk/funcs/onrampOnrampQuote.js";
54
-
55
- // Use `CompassApiSDKCore` for best tree-shaking performance.
56
- // You can create one instance of it to use across an application.
57
- const compassApiSDK = new CompassApiSDKCore({
58
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
59
- });
60
-
61
- async function run() {
62
- const res = await onrampOnrampQuote(compassApiSDK, {
63
- fiatAmount: "<value>",
64
- fiatCurrency: "USD",
65
- destinationAddress: "<value>",
66
- });
67
- if (res.ok) {
68
- const { value: result } = res;
69
- console.log(result);
70
- } else {
71
- console.log("onrampOnrampQuote failed:", res.error);
72
- }
73
- }
74
-
75
- run();
76
- ```
77
-
78
- ### Parameters
79
-
80
- | Parameter | Type | Required | Description |
81
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
82
- | `request` | [components.OnrampQuoteRequest](../../models/components/onrampquoterequest.md) | :heavy_check_mark: | The request object to use for the request. |
83
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
84
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
85
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
86
-
87
- ### Response
88
-
89
- **Promise\<[components.OnrampQuote](../../models/components/onrampquote.md)\>**
90
-
91
- ### Errors
92
-
93
- | Error Type | Status Code | Content Type |
94
- | -------------------------- | -------------------------- | -------------------------- |
95
- | errors.OnrampErrorResponse | 400, 422 | application/json |
96
- | errors.OnrampErrorResponse | 502 | application/json |
97
- | errors.APIError | 4XX, 5XX | \*/\* |
98
-
99
- ## onrampCreate
100
-
101
- Create a fiat on-ramp payment and return the browser-checkout handoff.
102
-
103
- A fiat card + identity-verification flow can only render in a browser, so
104
- this endpoint returns a **`checkout_url`** (a Compass-hosted page) together
105
- with `payment_id`, the one-time-wallet `deposit_address`, an initial
106
- `status`, and a `user_instructions` string.
107
-
108
- **How to drive this (CLI / MCP agent / UI):**
109
-
110
- 1. **Present `checkout_url` to the user and open it in a browser.** It
111
- renders the card payment + identity verification and delivers USDC on
112
- Ethereum to the destination wallet. (An MCP agent cannot open a browser
113
- itself — show the link and ask the user to open it.)
114
- 2. **Poll `GET /v2/onramp/status?payment_id=...`** until `status` becomes
115
- `delivered` (or `failed`). `pending` = awaiting payment, `processing` =
116
- payment received and bridging/swapping to USDC.
117
- 3. Once `delivered`, the USDC is in the user's own wallet — continue with
118
- the tokenized buy.
119
-
120
- Funds are never held by Compass: the `deposit_address` is a one-time wallet
121
- owned solely by the user's wallet.
122
-
123
- ### Example Usage
124
-
125
- <!-- UsageSnippet language="typescript" operationID="v2_onramp_create" method="post" path="/v2/onramp/create" -->
126
- ```typescript
127
- import { CompassApiSDK } from "@compass-labs/api-sdk";
128
-
129
- const compassApiSDK = new CompassApiSDK({
130
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
131
- });
132
-
133
- async function run() {
134
- const result = await compassApiSDK.onramp.onrampCreate({
135
- fiatAmount: "<value>",
136
- fiatCurrency: "USD",
137
- destinationAddress: "<value>",
138
- });
139
-
140
- console.log(result);
141
- }
142
-
143
- run();
144
- ```
145
-
146
- ### Standalone function
147
-
148
- The standalone function version of this method:
149
-
150
- ```typescript
151
- import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
152
- import { onrampOnrampCreate } from "@compass-labs/api-sdk/funcs/onrampOnrampCreate.js";
153
-
154
- // Use `CompassApiSDKCore` for best tree-shaking performance.
155
- // You can create one instance of it to use across an application.
156
- const compassApiSDK = new CompassApiSDKCore({
157
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
158
- });
159
-
160
- async function run() {
161
- const res = await onrampOnrampCreate(compassApiSDK, {
162
- fiatAmount: "<value>",
163
- fiatCurrency: "USD",
164
- destinationAddress: "<value>",
165
- });
166
- if (res.ok) {
167
- const { value: result } = res;
168
- console.log(result);
169
- } else {
170
- console.log("onrampOnrampCreate failed:", res.error);
171
- }
172
- }
173
-
174
- run();
175
- ```
176
-
177
- ### Parameters
178
-
179
- | Parameter | Type | Required | Description |
180
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
181
- | `request` | [components.OnrampCreateRequest](../../models/components/onrampcreaterequest.md) | :heavy_check_mark: | The request object to use for the request. |
182
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
183
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
184
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
185
-
186
- ### Response
187
-
188
- **Promise\<[components.OnrampCreate](../../models/components/onrampcreate.md)\>**
189
-
190
- ### Errors
191
-
192
- | Error Type | Status Code | Content Type |
193
- | -------------------------- | -------------------------- | -------------------------- |
194
- | errors.OnrampErrorResponse | 400, 402, 410, 422 | application/json |
195
- | errors.OnrampErrorResponse | 502 | application/json |
196
- | errors.APIError | 4XX, 5XX | \*/\* |
197
-
198
- ## onrampStatus
199
-
200
- Get the current status of a fiat on-ramp payment.
201
-
202
- Poll this after `create` until `status` is `delivered`. The `status` field
203
- is one of:
204
-
205
- - `pending` — awaiting the card payment in the hosted checkout.
206
- - `processing` — payment received; bridging/swapping the proceeds to USDC.
207
- - `delivered` — USDC has been delivered to the destination wallet
208
- (`delivery_tx_hash` and `output_amount_delivered` are populated).
209
- - `failed` — the payment failed, expired, or was refunded.
210
-
211
- State is re-read live from the on-ramp provider on every call — Compass
212
- stores nothing of its own.
213
-
214
- ### Example Usage
215
-
216
- <!-- UsageSnippet language="typescript" operationID="v2_onramp_status" method="get" path="/v2/onramp/status" -->
217
- ```typescript
218
- import { CompassApiSDK } from "@compass-labs/api-sdk";
219
-
220
- const compassApiSDK = new CompassApiSDK({
221
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
222
- });
223
-
224
- async function run() {
225
- const result = await compassApiSDK.onramp.onrampStatus({
226
- paymentId: "<id>",
227
- });
228
-
229
- console.log(result);
230
- }
231
-
232
- run();
233
- ```
234
-
235
- ### Standalone function
236
-
237
- The standalone function version of this method:
238
-
239
- ```typescript
240
- import { CompassApiSDKCore } from "@compass-labs/api-sdk/core.js";
241
- import { onrampOnrampStatus } from "@compass-labs/api-sdk/funcs/onrampOnrampStatus.js";
242
-
243
- // Use `CompassApiSDKCore` for best tree-shaking performance.
244
- // You can create one instance of it to use across an application.
245
- const compassApiSDK = new CompassApiSDKCore({
246
- apiKeyAuth: "<YOUR_API_KEY_HERE>",
247
- });
248
-
249
- async function run() {
250
- const res = await onrampOnrampStatus(compassApiSDK, {
251
- paymentId: "<id>",
252
- });
253
- if (res.ok) {
254
- const { value: result } = res;
255
- console.log(result);
256
- } else {
257
- console.log("onrampOnrampStatus failed:", res.error);
258
- }
259
- }
260
-
261
- run();
262
- ```
263
-
264
- ### Parameters
265
-
266
- | Parameter | Type | Required | Description |
267
- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
268
- | `request` | [operations.V2OnrampStatusRequest](../../models/operations/v2onrampstatusrequest.md) | :heavy_check_mark: | The request object to use for the request. |
269
- | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
270
- | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
271
- | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
272
-
273
- ### Response
274
-
275
- **Promise\<[components.OnrampStatus](../../models/components/onrampstatus.md)\>**
276
-
277
- ### Errors
278
-
279
- | Error Type | Status Code | Content Type |
280
- | -------------------------- | -------------------------- | -------------------------- |
281
- | errors.OnrampErrorResponse | 404, 422 | application/json |
282
- | errors.OnrampErrorResponse | 502 | application/json |
283
- | errors.APIError | 4XX, 5XX | \*/\* |
@@ -1,192 +0,0 @@
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
- }
@@ -1,181 +0,0 @@
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
- }