@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
73 lines (69 loc) • 2.53 kB
text/typescript
/**
* Generated by orval v7.21.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 {
CreateDepositDestinationRequest,
DepositDestination,
DepositDestinationId,
ListDepositDestinations200,
ListDepositDestinationsParams,
} from "../coinbaseDeveloperPlatformAPIs.schemas.js";
import { cdpApiClient } from "../../cdpApiClient.js";
type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];
/**
* List deposit destinations. You can optionally filter the results by type, account ID, network, or cryptocurrency address. Results are sorted by creation date in descending order (newest first).
* @summary List deposit destinations
*/
export const listDepositDestinations = (
params?: ListDepositDestinationsParams,
options?: SecondParameter<typeof cdpApiClient<ListDepositDestinations200>>,
) => {
return cdpApiClient<ListDepositDestinations200>(
{ url: `/v2/deposit-destinations`, method: "GET", params },
options,
);
};
/**
* Create a new deposit destination for an account. A deposit destination is a cryptocurrency address that can be used to receive funds. The address will be generated for the specified network.
* @summary Create deposit destination
*/
export const createDepositDestination = (
createDepositDestinationRequest: CreateDepositDestinationRequest,
options?: SecondParameter<typeof cdpApiClient<DepositDestination>>,
) => {
return cdpApiClient<DepositDestination>(
{
url: `/v2/deposit-destinations`,
method: "POST",
headers: { "Content-Type": "application/json" },
data: createDepositDestinationRequest,
},
options,
);
};
/**
* Get a specific deposit destination by its ID.
* @summary Get deposit destination
*/
export const getDepositDestinationById = (
depositDestinationId: DepositDestinationId,
options?: SecondParameter<typeof cdpApiClient<DepositDestination>>,
) => {
return cdpApiClient<DepositDestination>(
{ url: `/v2/deposit-destinations/${depositDestinationId}`, method: "GET" },
options,
);
};
export type ListDepositDestinationsResult = NonNullable<
Awaited<ReturnType<typeof listDepositDestinations>>
>;
export type CreateDepositDestinationResult = NonNullable<
Awaited<ReturnType<typeof createDepositDestination>>
>;
export type GetDepositDestinationByIdResult = NonNullable<
Awaited<ReturnType<typeof getDepositDestinationById>>
>;