diff --git a/sdk.json b/sdk.json index ddb82a9..f26f321 100644 --- a/sdk.json +++ b/sdk.json @@ -8,7 +8,7 @@ "info": { "version": "2.14.0", "title": "All Circle APIs", - "description": "Circle's General, Core Functionality, Payments, Payouts, Accounts, and Crypto Payments APIs bundled into one OpenAPI Specification." + "description": "Circle's General, Core Functionality, Payments, Payouts, Accounts, Crypto Payments, and Exchange APIs bundled into one OpenAPI Specification." }, "tags": [ { @@ -114,6 +114,10 @@ { "name": "Checkout Sessions", "description": "Create, get, extend a checkout session." + }, + { + "name": "Exchange", + "description": "Exchange between two currencies." } ], "paths": { @@ -6998,6 +7002,46 @@ } } } + }, + "/v1/exchange/cps/quotes": { + "post": { + "security": [ + { + "bearerAuth": [] + } + ], + "summary": "Create CPS Quote", + "description": "Create a quote for exchanging between two stablecoins.", + "operationId": "createCpsQuote", + "tags": ["Exchange"], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateCpsQuoteRequest" + } + } + } + }, + "responses": { + "200": { + "description": "Successfully created CPS quote.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateCpsQuoteResponse" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/NotAuthorized" + } + } + } } }, "components": { @@ -7018,6 +7062,77 @@ } } }, + "CreateCpsQuoteRequest": { + "type": "object", + "required": ["from", "to"], + "properties": { + "from": { + "$ref": "#/components/schemas/CpsOptionalAmountMoney" + }, + "to": { + "$ref": "#/components/schemas/CpsOptionalAmountMoney" + } + } + }, + "CpsOptionalAmountMoney": { + "type": "object", + "required": ["currency"], + "properties": { + "amount": { + "type": "number", + "nullable": true, + "description": "Source amount (optional)", + "example": 100.0 + }, + "currency": { + "$ref": "#/components/schemas/CpsToken" + } + } + }, + "CpsToken": { + "type": "string", + "description": "Supported stablecoin tokens for CPS", + "enum": ["USDC", "EURC"], + "example": "USDC" + }, + "CreateCpsQuoteResponse": { + "type": "object", + "properties": { + "data": { + "$ref": "#/components/schemas/CpsQuote" + } + } + }, + "CpsQuote": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique identifier for the CPS quote", + "example": "825a494f-83a7-4e1f-bb6c-e01f0766f420" + }, + "rate": { + "type": "string", + "description": "Exchange rate", + "example": "0.9132" + }, + "from": { + "$ref": "#/components/schemas/CpsOptionalAmountMoney" + }, + "to": { + "$ref": "#/components/schemas/CpsOptionalAmountMoney" + }, + "fee": { + "$ref": "#/components/schemas/CpsOptionalAmountMoney" + }, + "expiry": { + "type": "string", + "format": "date-time", + "description": "Quote expiration time in ISO-8601 format", + "example": "2025-09-10T17:48:12.237Z" + } + } + }, "MerchantWalletId": { "type": "string", "description": "Unique system generated identifier for the wallet of the merchant.", diff --git a/src/generated/.openapi-generator/FILES b/src/generated/.openapi-generator/FILES index d22ef94..109c6ec 100644 --- a/src/generated/.openapi-generator/FILES +++ b/src/generated/.openapi-generator/FILES @@ -12,6 +12,7 @@ apis/crypto-payment-intents-api.ts apis/cubixapi.ts apis/deposits-api.ts apis/encryption-api.ts +apis/exchange-api.ts apis/health-api.ts apis/management-api.ts apis/payment-tokens-api.ts @@ -82,6 +83,9 @@ models/checkout-session.ts models/conflict.ts models/continuous-payment-intent-creation-request.ts models/continuous-payment-intent.ts +models/cps-optional-amount-money.ts +models/cps-quote.ts +models/cps-token.ts models/create-address-book-recipient-response.ts models/create-business-cbit-account-response.ts models/create-business-cubix-account-response.ts @@ -93,6 +97,8 @@ models/create-business-transfer-response.ts models/create-business-wire-account-response.ts models/create-card-response.ts models/create-checkout-session-response.ts +models/create-cps-quote-request.ts +models/create-cps-quote-response.ts models/create-crypto-payment-response.ts models/create-crypto-payment-response1.ts models/create-crypto-refund-response.ts diff --git a/src/generated/api.ts b/src/generated/api.ts index bad9695..c0abd55 100644 --- a/src/generated/api.ts +++ b/src/generated/api.ts @@ -19,6 +19,7 @@ export * from "./apis/crypto-exchange-rates-api"; export * from "./apis/crypto-payment-intents-api"; export * from "./apis/deposits-api"; export * from "./apis/encryption-api"; +export * from "./apis/exchange-api"; export * from "./apis/health-api"; export * from "./apis/management-api"; export * from "./apis/pixapi"; diff --git a/src/generated/apis/exchange-api.ts b/src/generated/apis/exchange-api.ts new file mode 100644 index 0000000..c04ce28 --- /dev/null +++ b/src/generated/apis/exchange-api.ts @@ -0,0 +1,194 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import globalAxios, { + AxiosPromise, + AxiosInstance, + AxiosRequestConfig +} from "axios"; +import { Configuration } from "../configuration"; +// Some imports not used depending on template conditions +// @ts-ignore +import { + DUMMY_BASE_URL, + assertParamExists, + setBearerAuthToObject, + setSearchParams, + serializeDataIfNeeded, + toPathString, + createRequestFunction +} from "../common"; +// @ts-ignore +import { + BASE_PATH, + COLLECTION_FORMATS, + RequestArgs, + BaseAPI, + RequiredError +} from "../base"; +// @ts-ignore +import { BadRequest } from "../models"; +// @ts-ignore +import { CreateCpsQuoteRequest } from "../models"; +// @ts-ignore +import { CreateCpsQuoteResponse } from "../models"; +// @ts-ignore +import { NotAuthorized } from "../models"; +/** + * ExchangeApi - axios parameter creator + * @export + */ +export const ExchangeApiAxiosParamCreator = function ( + configuration?: Configuration +) { + return { + /** + * Create a quote for exchanging between two stablecoins. + * @summary Create CPS Quote + * @param {CreateCpsQuoteRequest} [createCpsQuoteRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createCpsQuote: async ( + createCpsQuoteRequest?: CreateCpsQuoteRequest, + options: AxiosRequestConfig = {} + ): Promise => { + const localVarPath = `/v1/exchange/cps/quotes`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { + method: "POST", + ...baseOptions, + ...options + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication bearerAuth required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration); + + localVarHeaderParameter["Content-Type"] = "application/json"; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers + }; + localVarRequestOptions.data = serializeDataIfNeeded( + createCpsQuoteRequest, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions + }; + } + }; +}; + +/** + * ExchangeApi - functional programming interface + * @export + */ +export const ExchangeApiFp = function (configuration?: Configuration) { + const localVarAxiosParamCreator = ExchangeApiAxiosParamCreator(configuration); + return { + /** + * Create a quote for exchanging between two stablecoins. + * @summary Create CPS Quote + * @param {CreateCpsQuoteRequest} [createCpsQuoteRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createCpsQuote( + createCpsQuoteRequest?: CreateCpsQuoteRequest, + options?: AxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.createCpsQuote( + createCpsQuoteRequest, + options + ); + return createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + ); + } + }; +}; + +/** + * ExchangeApi - factory interface + * @export + */ +export const ExchangeApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance +) { + const localVarFp = ExchangeApiFp(configuration); + return { + /** + * Create a quote for exchanging between two stablecoins. + * @summary Create CPS Quote + * @param {CreateCpsQuoteRequest} [createCpsQuoteRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createCpsQuote( + createCpsQuoteRequest?: CreateCpsQuoteRequest, + options?: any + ): AxiosPromise { + return localVarFp + .createCpsQuote(createCpsQuoteRequest, options) + .then((request) => request(axios, basePath)); + } + }; +}; + +/** + * ExchangeApi - object-oriented interface + * @export + * @class ExchangeApi + * @extends {BaseAPI} + */ +export class ExchangeApi extends BaseAPI { + /** + * Create a quote for exchanging between two stablecoins. + * @summary Create CPS Quote + * @param {CreateCpsQuoteRequest} [createCpsQuoteRequest] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ExchangeApi + */ + public createCpsQuote( + createCpsQuoteRequest?: CreateCpsQuoteRequest, + options?: AxiosRequestConfig + ) { + return ExchangeApiFp(this.configuration) + .createCpsQuote(createCpsQuoteRequest, options) + .then((request) => request(this.axios, this.basePath)); + } +} diff --git a/src/generated/index.ts b/src/generated/index.ts index b2a936e..413e34e 100644 --- a/src/generated/index.ts +++ b/src/generated/index.ts @@ -20,6 +20,7 @@ import { CryptoPaymentIntentsApi, DepositsApi, EncryptionApi, + ExchangeApi, HealthApi, ManagementApi, PIXApi, @@ -51,6 +52,7 @@ export class Circle { public cryptoPaymentIntents: CryptoPaymentIntentsApi; public deposits: DepositsApi; public encryption: EncryptionApi; + public exchange: ExchangeApi; public health: HealthApi; public management: ManagementApi; public pix: PIXApi; @@ -79,6 +81,7 @@ export class Circle { this.cryptoPaymentIntents = new CryptoPaymentIntentsApi(configuration); this.deposits = new DepositsApi(configuration); this.encryption = new EncryptionApi(configuration); + this.exchange = new ExchangeApi(configuration); this.health = new HealthApi(configuration); this.management = new ManagementApi(configuration); this.pix = new PIXApi(configuration); diff --git a/src/generated/models/cps-optional-amount-money.ts b/src/generated/models/cps-optional-amount-money.ts new file mode 100644 index 0000000..7e6301b --- /dev/null +++ b/src/generated/models/cps-optional-amount-money.ts @@ -0,0 +1,31 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { CpsToken } from "./cps-token"; + +/** + * + * @export + * @interface CpsOptionalAmountMoney + */ +export interface CpsOptionalAmountMoney { + /** + * Source amount (optional) + * @type {number} + * @memberof CpsOptionalAmountMoney + */ + amount?: number | null; + /** + * + * @type {CpsToken} + * @memberof CpsOptionalAmountMoney + */ + currency: CpsToken; +} diff --git a/src/generated/models/cps-quote.ts b/src/generated/models/cps-quote.ts new file mode 100644 index 0000000..599827c --- /dev/null +++ b/src/generated/models/cps-quote.ts @@ -0,0 +1,55 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { CpsOptionalAmountMoney } from "./cps-optional-amount-money"; + +/** + * + * @export + * @interface CpsQuote + */ +export interface CpsQuote { + /** + * Unique identifier for the CPS quote + * @type {string} + * @memberof CpsQuote + */ + id?: string; + /** + * Exchange rate + * @type {string} + * @memberof CpsQuote + */ + rate?: string; + /** + * + * @type {CpsOptionalAmountMoney} + * @memberof CpsQuote + */ + from?: CpsOptionalAmountMoney; + /** + * + * @type {CpsOptionalAmountMoney} + * @memberof CpsQuote + */ + to?: CpsOptionalAmountMoney; + /** + * + * @type {CpsOptionalAmountMoney} + * @memberof CpsQuote + */ + fee?: CpsOptionalAmountMoney; + /** + * Quote expiration time in ISO-8601 format + * @type {string} + * @memberof CpsQuote + */ + expiry?: string; +} diff --git a/src/generated/models/cps-token.ts b/src/generated/models/cps-token.ts new file mode 100644 index 0000000..e9f1502 --- /dev/null +++ b/src/generated/models/cps-token.ts @@ -0,0 +1,20 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/** + * Supported stablecoin tokens + * @export + * @enum {string} + */ + +export const CpsToken = { + Usdc: "USDC", + Eurc: "EURC" +} as const; + +export type CpsToken = typeof CpsToken[keyof typeof CpsToken]; diff --git a/src/generated/models/create-cps-quote-request.ts b/src/generated/models/create-cps-quote-request.ts new file mode 100644 index 0000000..b6b519b --- /dev/null +++ b/src/generated/models/create-cps-quote-request.ts @@ -0,0 +1,31 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { CpsOptionalAmountMoney } from "./cps-optional-amount-money"; + +/** + * + * @export + * @interface CreateCpsQuoteRequest + */ +export interface CreateCpsQuoteRequest { + /** + * + * @type {CpsOptionalAmountMoney} + * @memberof CreateCpsQuoteRequest + */ + from: CpsOptionalAmountMoney; + /** + * + * @type {CpsOptionalAmountMoney} + * @memberof CreateCpsQuoteRequest + */ + to: CpsOptionalAmountMoney; +} diff --git a/src/generated/models/create-cps-quote-response.ts b/src/generated/models/create-cps-quote-response.ts new file mode 100644 index 0000000..a6b4cbd --- /dev/null +++ b/src/generated/models/create-cps-quote-response.ts @@ -0,0 +1,25 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +// May contain unused imports in some cases +// @ts-ignore +import { CpsQuote } from "./cps-quote"; + +/** + * + * @export + * @interface CreateCpsQuoteResponse + */ +export interface CreateCpsQuoteResponse { + /** + * + * @type {CpsQuote} + * @memberof CreateCpsQuoteResponse + */ + data?: CpsQuote; +} diff --git a/src/generated/models/index.ts b/src/generated/models/index.ts index a07ec45..c35dc15 100644 --- a/src/generated/models/index.ts +++ b/src/generated/models/index.ts @@ -52,6 +52,9 @@ export * from "./checkout-session-status"; export * from "./conflict"; export * from "./continuous-payment-intent"; export * from "./continuous-payment-intent-creation-request"; +export * from "./cps-optional-amount-money"; +export * from "./cps-quote"; +export * from "./cps-token"; export * from "./create-address-book-recipient-response"; export * from "./create-business-cbit-account-response"; export * from "./create-business-cubix-account-response"; @@ -63,6 +66,8 @@ export * from "./create-business-transfer-response"; export * from "./create-business-wire-account-response"; export * from "./create-card-response"; export * from "./create-checkout-session-response"; +export * from "./create-cps-quote-request"; +export * from "./create-cps-quote-response"; export * from "./create-crypto-payment-response"; export * from "./create-crypto-payment-response1"; export * from "./create-crypto-refund-response";