@compass-labs/api-sdk 2.2.69 → 2.2.70-rc.1

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,70 @@
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
+
8
+ /**
9
+ * Create a fiat on-ramp payment delivering USDC on Ethereum.
10
+ *
11
+ * @remarks
12
+ *
13
+ * Carries the same fields as the quote (a quote is implicit — we do not
14
+ * persist a quote handle). ``quote_id`` is optional and only echoed upstream
15
+ * if Halliday's ``/payments/confirm`` requires a previously-issued quote
16
+ * handle; omit it to confirm against a fresh quote.
17
+ */
18
+ export type OnrampCreateRequest = {
19
+ /**
20
+ * Amount of fiat to spend, as a decimal string (e.g. `100`).
21
+ */
22
+ fiatAmount: string;
23
+ /**
24
+ * ISO-4217 fiat currency code. Defaults to `USD`.
25
+ */
26
+ fiatCurrency?: string | undefined;
27
+ /**
28
+ * The wallet that will receive the USDC on Ethereum. Funds are delivered here directly — Compass never holds them.
29
+ */
30
+ destinationAddress: string;
31
+ /**
32
+ * Optional Halliday quote handle to confirm against. Omit to confirm against a fresh quote derived from the amount and currency.
33
+ */
34
+ quoteId?: string | null | undefined;
35
+ };
36
+
37
+ /** @internal */
38
+ export type OnrampCreateRequest$Outbound = {
39
+ fiat_amount: string;
40
+ fiat_currency?: string | undefined;
41
+ destination_address: string;
42
+ quote_id?: string | null | undefined;
43
+ };
44
+
45
+ /** @internal */
46
+ export const OnrampCreateRequest$outboundSchema: z.ZodType<
47
+ OnrampCreateRequest$Outbound,
48
+ z.ZodTypeDef,
49
+ OnrampCreateRequest
50
+ > = z.object({
51
+ fiatAmount: z.string(),
52
+ fiatCurrency: z.string().optional(),
53
+ destinationAddress: z.string(),
54
+ quoteId: z.nullable(z.string()).optional(),
55
+ }).transform((v) => {
56
+ return remap$(v, {
57
+ fiatAmount: "fiat_amount",
58
+ fiatCurrency: "fiat_currency",
59
+ destinationAddress: "destination_address",
60
+ quoteId: "quote_id",
61
+ });
62
+ });
63
+
64
+ export function onrampCreateRequestToJSON(
65
+ onrampCreateRequest: OnrampCreateRequest,
66
+ ): string {
67
+ return JSON.stringify(
68
+ OnrampCreateRequest$outboundSchema.parse(onrampCreateRequest),
69
+ );
70
+ }
@@ -0,0 +1,59 @@
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
+
11
+ /**
12
+ * Fee breakdown for an on-ramp quote.
13
+ *
14
+ * @remarks
15
+ *
16
+ * ``business_fees`` is a fixed ``"0"`` for now — monetization is a single
17
+ * future lever and is intentionally not charged.
18
+ */
19
+ export type OnrampFees = {
20
+ /**
21
+ * Fee charged by the on-ramp provider, in fiat.
22
+ */
23
+ providerFee: string;
24
+ /**
25
+ * Estimated network/gas fee, in fiat.
26
+ */
27
+ networkFee: string;
28
+ /**
29
+ * Compass business fee, in fiat. Always `0` for now.
30
+ */
31
+ businessFees?: string | undefined;
32
+ };
33
+
34
+ /** @internal */
35
+ export const OnrampFees$inboundSchema: z.ZodType<
36
+ OnrampFees,
37
+ z.ZodTypeDef,
38
+ unknown
39
+ > = z.object({
40
+ provider_fee: z.string(),
41
+ network_fee: z.string(),
42
+ business_fees: z.string().optional(),
43
+ }).transform((v) => {
44
+ return remap$(v, {
45
+ "provider_fee": "providerFee",
46
+ "network_fee": "networkFee",
47
+ "business_fees": "businessFees",
48
+ });
49
+ });
50
+
51
+ export function onrampFeesFromJSON(
52
+ jsonString: string,
53
+ ): SafeParseResult<OnrampFees, SDKValidationError> {
54
+ return safeParse(
55
+ jsonString,
56
+ (x) => OnrampFees$inboundSchema.parse(JSON.parse(x)),
57
+ `Failed to parse 'OnrampFees' from JSON`,
58
+ );
59
+ }
@@ -0,0 +1,101 @@
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 { OnrampFees, OnrampFees$inboundSchema } from "./onrampfees.js";
11
+
12
+ /**
13
+ * An indicative fiat -> USDC-on-Ethereum quote.
14
+ */
15
+ export type OnrampQuote = {
16
+ /**
17
+ * Fiat amount to spend.
18
+ */
19
+ fiatAmount: string;
20
+ /**
21
+ * ISO-4217 fiat currency code.
22
+ */
23
+ fiatCurrency: string;
24
+ /**
25
+ * Estimated USDC delivered, human-readable (6-decimal token).
26
+ */
27
+ outputAmount: string;
28
+ /**
29
+ * Delivered asset. Always USDC for this on-ramp.
30
+ */
31
+ outputAsset?: "USDC" | undefined;
32
+ /**
33
+ * Delivery chain. Always Ethereum for this on-ramp.
34
+ */
35
+ outputChain?: "ethereum" | undefined;
36
+ /**
37
+ * USDC received per unit of fiat.
38
+ */
39
+ exchangeRate: string;
40
+ /**
41
+ * Fee breakdown for an on-ramp quote.
42
+ *
43
+ * @remarks
44
+ *
45
+ * ``business_fees`` is a fixed ``"0"`` for now — monetization is a single
46
+ * future lever and is intentionally not charged.
47
+ */
48
+ fees: OnrampFees;
49
+ /**
50
+ * Minimum fiat amount accepted, if advertised by the provider.
51
+ */
52
+ minAmount?: string | null | undefined;
53
+ /**
54
+ * Maximum fiat amount accepted, if advertised by the provider.
55
+ */
56
+ maxAmount?: string | null | undefined;
57
+ /**
58
+ * ISO-8601 timestamp after which this quote is stale, if any.
59
+ */
60
+ expiresAt?: string | null | undefined;
61
+ };
62
+
63
+ /** @internal */
64
+ export const OnrampQuote$inboundSchema: z.ZodType<
65
+ OnrampQuote,
66
+ z.ZodTypeDef,
67
+ unknown
68
+ > = z.object({
69
+ fiat_amount: z.string(),
70
+ fiat_currency: z.string(),
71
+ output_amount: z.string(),
72
+ output_asset: z.literal("USDC").optional(),
73
+ output_chain: z.literal("ethereum").optional(),
74
+ exchange_rate: z.string(),
75
+ fees: OnrampFees$inboundSchema,
76
+ min_amount: z.nullable(z.string()).optional(),
77
+ max_amount: z.nullable(z.string()).optional(),
78
+ expires_at: z.nullable(z.string()).optional(),
79
+ }).transform((v) => {
80
+ return remap$(v, {
81
+ "fiat_amount": "fiatAmount",
82
+ "fiat_currency": "fiatCurrency",
83
+ "output_amount": "outputAmount",
84
+ "output_asset": "outputAsset",
85
+ "output_chain": "outputChain",
86
+ "exchange_rate": "exchangeRate",
87
+ "min_amount": "minAmount",
88
+ "max_amount": "maxAmount",
89
+ "expires_at": "expiresAt",
90
+ });
91
+ });
92
+
93
+ export function onrampQuoteFromJSON(
94
+ jsonString: string,
95
+ ): SafeParseResult<OnrampQuote, SDKValidationError> {
96
+ return safeParse(
97
+ jsonString,
98
+ (x) => OnrampQuote$inboundSchema.parse(JSON.parse(x)),
99
+ `Failed to parse 'OnrampQuote' from JSON`,
100
+ );
101
+ }
@@ -0,0 +1,62 @@
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
+
8
+ /**
9
+ * An indicative fiat -> USDC-on-Ethereum quote request.
10
+ *
11
+ * @remarks
12
+ *
13
+ * The output asset and chain are fixed to USDC on Ethereum and are not
14
+ * user-supplied — this product group delivers only USDC to the user's own
15
+ * wallet (non-custodial).
16
+ */
17
+ export type OnrampQuoteRequest = {
18
+ /**
19
+ * Amount of fiat to spend, as a decimal string (e.g. `100`).
20
+ */
21
+ fiatAmount: string;
22
+ /**
23
+ * ISO-4217 fiat currency code. Defaults to `USD`.
24
+ */
25
+ fiatCurrency?: string | undefined;
26
+ /**
27
+ * The wallet that will receive the USDC on Ethereum. Funds are delivered here directly — Compass never holds them.
28
+ */
29
+ destinationAddress: string;
30
+ };
31
+
32
+ /** @internal */
33
+ export type OnrampQuoteRequest$Outbound = {
34
+ fiat_amount: string;
35
+ fiat_currency?: string | undefined;
36
+ destination_address: string;
37
+ };
38
+
39
+ /** @internal */
40
+ export const OnrampQuoteRequest$outboundSchema: z.ZodType<
41
+ OnrampQuoteRequest$Outbound,
42
+ z.ZodTypeDef,
43
+ OnrampQuoteRequest
44
+ > = z.object({
45
+ fiatAmount: z.string(),
46
+ fiatCurrency: z.string().optional(),
47
+ destinationAddress: z.string(),
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ fiatAmount: "fiat_amount",
51
+ fiatCurrency: "fiat_currency",
52
+ destinationAddress: "destination_address",
53
+ });
54
+ });
55
+
56
+ export function onrampQuoteRequestToJSON(
57
+ onrampQuoteRequest: OnrampQuoteRequest,
58
+ ): string {
59
+ return JSON.stringify(
60
+ OnrampQuoteRequest$outboundSchema.parse(onrampQuoteRequest),
61
+ );
62
+ }
@@ -0,0 +1,96 @@
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
+
12
+ /**
13
+ * Lifecycle state: `pending` (awaiting card payment), `processing` (payment received, bridging/swapping to USDC), `delivered` (USDC received in the destination wallet), or `failed`.
14
+ */
15
+ export const OnrampStatusStatus = {
16
+ Pending: "pending",
17
+ Processing: "processing",
18
+ Delivered: "delivered",
19
+ Failed: "failed",
20
+ } as const;
21
+ /**
22
+ * Lifecycle state: `pending` (awaiting card payment), `processing` (payment received, bridging/swapping to USDC), `delivered` (USDC received in the destination wallet), or `failed`.
23
+ */
24
+ export type OnrampStatusStatus = ClosedEnum<typeof OnrampStatusStatus>;
25
+
26
+ /**
27
+ * Current state of a fiat on-ramp payment.
28
+ *
29
+ * @remarks
30
+ *
31
+ * Re-read on demand from Halliday (the system of record) — Compass holds no
32
+ * state of its own.
33
+ */
34
+ export type OnrampStatus = {
35
+ /**
36
+ * Halliday's payment id, echoed straight through.
37
+ */
38
+ paymentId: string;
39
+ /**
40
+ * Lifecycle state: `pending` (awaiting card payment), `processing` (payment received, bridging/swapping to USDC), `delivered` (USDC received in the destination wallet), or `failed`.
41
+ */
42
+ status: OnrampStatusStatus;
43
+ /**
44
+ * USDC delivered so far, human-readable. Set once delivered.
45
+ */
46
+ outputAmountDelivered?: string | null | undefined;
47
+ /**
48
+ * Ethereum tx hash of the USDC delivery, once available.
49
+ */
50
+ deliveryTxHash?: string | null | undefined;
51
+ /**
52
+ * The wallet the USDC is delivered to.
53
+ */
54
+ destinationAddress?: string | null | undefined;
55
+ /**
56
+ * ISO-8601 timestamp of the last status change, if provided.
57
+ */
58
+ updatedAt?: string | null | undefined;
59
+ };
60
+
61
+ /** @internal */
62
+ export const OnrampStatusStatus$inboundSchema: z.ZodNativeEnum<
63
+ typeof OnrampStatusStatus
64
+ > = z.nativeEnum(OnrampStatusStatus);
65
+
66
+ /** @internal */
67
+ export const OnrampStatus$inboundSchema: z.ZodType<
68
+ OnrampStatus,
69
+ z.ZodTypeDef,
70
+ unknown
71
+ > = z.object({
72
+ payment_id: z.string(),
73
+ status: OnrampStatusStatus$inboundSchema,
74
+ output_amount_delivered: z.nullable(z.string()).optional(),
75
+ delivery_tx_hash: z.nullable(z.string()).optional(),
76
+ destination_address: z.nullable(z.string()).optional(),
77
+ updated_at: z.nullable(z.string()).optional(),
78
+ }).transform((v) => {
79
+ return remap$(v, {
80
+ "payment_id": "paymentId",
81
+ "output_amount_delivered": "outputAmountDelivered",
82
+ "delivery_tx_hash": "deliveryTxHash",
83
+ "destination_address": "destinationAddress",
84
+ "updated_at": "updatedAt",
85
+ });
86
+ });
87
+
88
+ export function onrampStatusFromJSON(
89
+ jsonString: string,
90
+ ): SafeParseResult<OnrampStatus, SDKValidationError> {
91
+ return safeParse(
92
+ jsonString,
93
+ (x) => OnrampStatus$inboundSchema.parse(JSON.parse(x)),
94
+ `Failed to parse 'OnrampStatus' from JSON`,
95
+ );
96
+ }
@@ -12,7 +12,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
12
  /**
13
13
  * Order lifecycle state. One of `pending`, `filled`, `expired`, or `cancelled`. Upstream protocol states beyond these four (e.g. `partially-filled`, `refunded`) are mapped onto this set.
14
14
  */
15
- export const Status = {
15
+ export const OrderStatusStatus = {
16
16
  Pending: "pending",
17
17
  Filled: "filled",
18
18
  Expired: "expired",
@@ -21,7 +21,7 @@ export const Status = {
21
21
  /**
22
22
  * Order lifecycle state. One of `pending`, `filled`, `expired`, or `cancelled`. Upstream protocol states beyond these four (e.g. `partially-filled`, `refunded`) are mapped onto this set.
23
23
  */
24
- export type Status = ClosedEnum<typeof Status>;
24
+ export type OrderStatusStatus = ClosedEnum<typeof OrderStatusStatus>;
25
25
 
26
26
  /**
27
27
  * Returned from `GET /order/{hash}` — current state of a relayed order.
@@ -34,7 +34,7 @@ export type OrderStatus = {
34
34
  /**
35
35
  * Order lifecycle state. One of `pending`, `filled`, `expired`, or `cancelled`. Upstream protocol states beyond these four (e.g. `partially-filled`, `refunded`) are mapped onto this set.
36
36
  */
37
- status: Status;
37
+ status: OrderStatusStatus;
38
38
  /**
39
39
  * Transaction hash of the most recent fill. Populated for fully filled orders and for partial fills while `status` is still `pending`.
40
40
  */
@@ -58,8 +58,9 @@ export type OrderStatus = {
58
58
  };
59
59
 
60
60
  /** @internal */
61
- export const Status$inboundSchema: z.ZodNativeEnum<typeof Status> = z
62
- .nativeEnum(Status);
61
+ export const OrderStatusStatus$inboundSchema: z.ZodNativeEnum<
62
+ typeof OrderStatusStatus
63
+ > = z.nativeEnum(OrderStatusStatus);
63
64
 
64
65
  /** @internal */
65
66
  export const OrderStatus$inboundSchema: z.ZodType<
@@ -68,7 +69,7 @@ export const OrderStatus$inboundSchema: z.ZodType<
68
69
  unknown
69
70
  > = z.object({
70
71
  order_hash: z.string(),
71
- status: Status$inboundSchema,
72
+ status: OrderStatusStatus$inboundSchema,
72
73
  fill_tx_hash: z.nullable(z.string()).optional(),
73
74
  fill_price_usd: z.nullable(z.string()).optional(),
74
75
  filled_amount: z.nullable(z.string()).optional(),
@@ -7,6 +7,7 @@ export * from "./compassapisdkerror.js";
7
7
  export * from "./httpclienterrors.js";
8
8
  export * from "./httpvalidationerror.js";
9
9
  export * from "./mintpreparenotfoundresponseerror.js";
10
+ export * from "./onramperrorresponse.js";
10
11
  export * from "./responsevalidationerror.js";
11
12
  export * from "./sdkvalidationerror.js";
12
13
  export * from "./tokenizedassetserrorresponse.js";
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { CompassAPISDKError } from "./compassapisdkerror.js";
7
+
8
+ /**
9
+ * Standard error envelope returned by every non-2xx on-ramp response.
10
+ *
11
+ * @remarks
12
+ *
13
+ * Surfaced in OpenAPI ``responses`` declarations so SDK consumers can decode
14
+ * failures uniformly without inspecting per-status-code shapes.
15
+ */
16
+ export type OnrampErrorResponseData = {
17
+ /**
18
+ * Short human-readable error label (e.g. `Payment not found.`, `On-ramp provider unavailable`, `Identity verification required`).
19
+ */
20
+ error: string;
21
+ /**
22
+ * Human-readable explanation.
23
+ */
24
+ message: string;
25
+ };
26
+
27
+ /**
28
+ * Standard error envelope returned by every non-2xx on-ramp response.
29
+ *
30
+ * @remarks
31
+ *
32
+ * Surfaced in OpenAPI ``responses`` declarations so SDK consumers can decode
33
+ * failures uniformly without inspecting per-status-code shapes.
34
+ */
35
+ export class OnrampErrorResponse extends CompassAPISDKError {
36
+ /**
37
+ * Short human-readable error label (e.g. `Payment not found.`, `On-ramp provider unavailable`, `Identity verification required`).
38
+ */
39
+ error: string;
40
+
41
+ /** The original data that was passed to this error instance. */
42
+ data$: OnrampErrorResponseData;
43
+
44
+ constructor(
45
+ err: OnrampErrorResponseData,
46
+ httpMeta: { response: Response; request: Request; body: string },
47
+ ) {
48
+ const message = err.message || `API error occurred: ${JSON.stringify(err)}`;
49
+ super(message, httpMeta);
50
+ this.data$ = err;
51
+ this.error = err.error;
52
+
53
+ this.name = "OnrampErrorResponse";
54
+ }
55
+ }
56
+
57
+ /** @internal */
58
+ export const OnrampErrorResponse$inboundSchema: z.ZodType<
59
+ OnrampErrorResponse,
60
+ z.ZodTypeDef,
61
+ unknown
62
+ > = z.object({
63
+ error: z.string(),
64
+ message: z.string(),
65
+ request$: z.instanceof(Request),
66
+ response$: z.instanceof(Response),
67
+ body$: z.string(),
68
+ })
69
+ .transform((v) => {
70
+ return new OnrampErrorResponse(v, {
71
+ request: v.request$,
72
+ response: v.response$,
73
+ body: v.body$,
74
+ });
75
+ });
@@ -54,6 +54,7 @@ export * from "./v2globalmarketsperpsactivity.js";
54
54
  export * from "./v2globalmarketsperpscandles.js";
55
55
  export * from "./v2globalmarketsperpsopportunities.js";
56
56
  export * from "./v2globalmarketsperpspositions.js";
57
+ export * from "./v2onrampstatus.js";
57
58
  export * from "./v2tokenizedassetsbalances.js";
58
59
  export * from "./v2tokenizedassetsmarkets.js";
59
60
  export * from "./v2tokenizedassetsmarketssymbol.js";
@@ -0,0 +1,39 @@
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
+
8
+ export type V2OnrampStatusRequest = {
9
+ /**
10
+ * The `payment_id` returned by `POST /v2/onramp/create`.
11
+ */
12
+ paymentId: string;
13
+ };
14
+
15
+ /** @internal */
16
+ export type V2OnrampStatusRequest$Outbound = {
17
+ payment_id: string;
18
+ };
19
+
20
+ /** @internal */
21
+ export const V2OnrampStatusRequest$outboundSchema: z.ZodType<
22
+ V2OnrampStatusRequest$Outbound,
23
+ z.ZodTypeDef,
24
+ V2OnrampStatusRequest
25
+ > = z.object({
26
+ paymentId: z.string(),
27
+ }).transform((v) => {
28
+ return remap$(v, {
29
+ paymentId: "payment_id",
30
+ });
31
+ });
32
+
33
+ export function v2OnrampStatusRequestToJSON(
34
+ v2OnrampStatusRequest: V2OnrampStatusRequest,
35
+ ): string {
36
+ return JSON.stringify(
37
+ V2OnrampStatusRequest$outboundSchema.parse(v2OnrampStatusRequest),
38
+ );
39
+ }
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { onrampOnrampCreate } from "../funcs/onrampOnrampCreate.js";
6
+ import { onrampOnrampQuote } from "../funcs/onrampOnrampQuote.js";
7
+ import { onrampOnrampStatus } from "../funcs/onrampOnrampStatus.js";
8
+ import { ClientSDK, RequestOptions } from "../lib/sdks.js";
9
+ import * as components from "../models/components/index.js";
10
+ import * as operations from "../models/operations/index.js";
11
+ import { unwrapAsync } from "../types/fp.js";
12
+
13
+ export class Onramp extends ClientSDK {
14
+ /**
15
+ * Get a fiat on-ramp quote (card -> USDC on Ethereum)
16
+ *
17
+ * @remarks
18
+ * Get an indicative quote for buying USDC on Ethereum with a card.
19
+ *
20
+ * Returns the estimated USDC the user will receive for a given fiat amount,
21
+ * the exchange rate, fee breakdown (`business_fees` is `0`), and the provider
22
+ * min/max limits. The output is always **USDC on Ethereum** delivered to the
23
+ * `destination_address` — this is a non-custodial on-ramp, so Compass never
24
+ * holds the funds.
25
+ *
26
+ * This quote is indicative and may expire (`expires_at`). To actually start a
27
+ * payment, call `POST /v2/onramp/create`.
28
+ */
29
+ async onrampQuote(
30
+ request: components.OnrampQuoteRequest,
31
+ options?: RequestOptions,
32
+ ): Promise<components.OnrampQuote> {
33
+ return unwrapAsync(onrampOnrampQuote(
34
+ this,
35
+ request,
36
+ options,
37
+ ));
38
+ }
39
+
40
+ /**
41
+ * Create a fiat on-ramp payment + get the checkout link
42
+ *
43
+ * @remarks
44
+ * Create a fiat on-ramp payment and return the browser-checkout handoff.
45
+ *
46
+ * A fiat card + identity-verification flow can only render in a browser, so
47
+ * this endpoint returns a **`checkout_url`** (a Compass-hosted page) together
48
+ * with `payment_id`, the one-time-wallet `deposit_address`, an initial
49
+ * `status`, and a `user_instructions` string.
50
+ *
51
+ * **How to drive this (CLI / MCP agent / UI):**
52
+ *
53
+ * 1. **Present `checkout_url` to the user and open it in a browser.** It
54
+ * renders the card payment + identity verification and delivers USDC on
55
+ * Ethereum to the destination wallet. (An MCP agent cannot open a browser
56
+ * itself — show the link and ask the user to open it.)
57
+ * 2. **Poll `GET /v2/onramp/status?payment_id=...`** until `status` becomes
58
+ * `delivered` (or `failed`). `pending` = awaiting payment, `processing` =
59
+ * payment received and bridging/swapping to USDC.
60
+ * 3. Once `delivered`, the USDC is in the user's own wallet — continue with
61
+ * the tokenized buy.
62
+ *
63
+ * Funds are never held by Compass: the `deposit_address` is a one-time wallet
64
+ * owned solely by the user's wallet.
65
+ */
66
+ async onrampCreate(
67
+ request: components.OnrampCreateRequest,
68
+ options?: RequestOptions,
69
+ ): Promise<components.OnrampCreate> {
70
+ return unwrapAsync(onrampOnrampCreate(
71
+ this,
72
+ request,
73
+ options,
74
+ ));
75
+ }
76
+
77
+ /**
78
+ * Get the status of a fiat on-ramp payment
79
+ *
80
+ * @remarks
81
+ * Get the current status of a fiat on-ramp payment.
82
+ *
83
+ * Poll this after `create` until `status` is `delivered`. The `status` field
84
+ * is one of:
85
+ *
86
+ * - `pending` — awaiting the card payment in the hosted checkout.
87
+ * - `processing` — payment received; bridging/swapping the proceeds to USDC.
88
+ * - `delivered` — USDC has been delivered to the destination wallet
89
+ * (`delivery_tx_hash` and `output_amount_delivered` are populated).
90
+ * - `failed` — the payment failed, expired, or was refunded.
91
+ *
92
+ * State is re-read live from the on-ramp provider on every call — Compass
93
+ * stores nothing of its own.
94
+ */
95
+ async onrampStatus(
96
+ request: operations.V2OnrampStatusRequest,
97
+ options?: RequestOptions,
98
+ ): Promise<components.OnrampStatus> {
99
+ return unwrapAsync(onrampOnrampStatus(
100
+ this,
101
+ request,
102
+ options,
103
+ ));
104
+ }
105
+ }
package/src/sdk/sdk.ts CHANGED
@@ -13,6 +13,7 @@ import { Ethena } from "./ethena.js";
13
13
  import { GasSponsorship } from "./gassponsorship.js";
14
14
  import { GlobalMarketsPerps } from "./globalmarketsperps.js";
15
15
  import { Morpho } from "./morpho.js";
16
+ import { Onramp } from "./onramp.js";
16
17
  import { Pendle } from "./pendle.js";
17
18
  import { Sky } from "./sky.js";
18
19
  import { SmartAccount } from "./smartaccount.js";
@@ -126,4 +127,9 @@ export class CompassApiSDK extends ClientSDK {
126
127
  get tokenizedAssets(): TokenizedAssets {
127
128
  return (this._tokenizedAssets ??= new TokenizedAssets(this._options));
128
129
  }
130
+
131
+ private _onramp?: Onramp;
132
+ get onramp(): Onramp {
133
+ return (this._onramp ??= new Onramp(this._options));
134
+ }
129
135
  }