@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
97 lines (93 loc) • 3.22 kB
text/typescript
/**
* Generated by orval v7.6.0 🍺
* Do not edit manually.
* Coinbase Developer Platform APIs
* The Coinbase Developer Platform APIs - leading the world's transition onchain.
* OpenAPI spec version: 2.0.0
*/
import type {
CreatePaymentTransferQuote201,
CreatePaymentTransferQuoteBody,
CryptoRail,
GetCryptoRailsParams,
PaymentMethod,
Transfer,
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
import { cdpApiClient } from "../../cdpApiClient.js";
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* Gets the fiat payment methods that can be used to send funds or receive funds. This is the list of payment methods configured for your account.
* @summary Get the fiat payment methods
*/
export const getPaymentMethods = (options?: SecondParameter<typeof cdpApiClient>) => {
return cdpApiClient<PaymentMethod[]>(
{ url: `/v2/payments/rails/payment-methods`, method: "GET" },
options,
);
};
/**
* Gets the crypto rails that can be used to send funds or receive funds.
* @summary Get the crypto rails
*/
export const getCryptoRails = (
params?: GetCryptoRailsParams,
options?: SecondParameter<typeof cdpApiClient>,
) => {
return cdpApiClient<CryptoRail[]>(
{ url: `/v2/payments/rails/crypto`, method: "GET", params },
options,
);
};
/**
* Creates a new transfer quote, which can then be executed using the Execute a transfer quote endpoint. If you want to automatically execute the transfer without needing to confirm, specify execute as true.
* @summary Create a transfer quote
*/
export const createPaymentTransferQuote = (
createPaymentTransferQuoteBody: CreatePaymentTransferQuoteBody,
options?: SecondParameter<typeof cdpApiClient>,
) => {
return cdpApiClient<CreatePaymentTransferQuote201>(
{
url: `/v2/payments/transfers`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createPaymentTransferQuoteBody,
},
options,
);
};
/**
* Executes a transfer quote which was created using the Create a transfer quote endpoint.
* @summary Execute a transfer quote
*/
export const executePaymentTransferQuote = (
transferId: string,
options?: SecondParameter<typeof cdpApiClient>,
) => {
return cdpApiClient<Transfer>(
{ url: `/v2/payments/transfers/${transferId}/execute`, method: "POST" },
options,
);
};
/**
* Gets a transfer by ID.
* @summary Get a transfer by ID
*/
export const getPaymentTransfer = (
transferId: string,
options?: SecondParameter<typeof cdpApiClient>,
) => {
return cdpApiClient<Transfer>(
{ url: `/v2/payments/transfers/${transferId}`, method: "GET" },
options,
);
};
export type GetPaymentMethodsResult = NonNullable<Awaited<ReturnType<typeof getPaymentMethods>>>;
export type GetCryptoRailsResult = NonNullable<Awaited<ReturnType<typeof getCryptoRails>>>;
export type CreatePaymentTransferQuoteResult = NonNullable<
Awaited<ReturnType<typeof createPaymentTransferQuote>>
>;
export type ExecutePaymentTransferQuoteResult = NonNullable<
Awaited<ReturnType<typeof executePaymentTransferQuote>>
>;
export type GetPaymentTransferResult = NonNullable<Awaited<ReturnType<typeof getPaymentTransfer>>>;