@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
104 lines (100 loc) • 4.3 kB
text/typescript
// This file was auto-generated by Fern from our API Definition.
import type * as CoinbaseApi from "../../../../index.js";
/**
* @example
* ```ts
* {
* idempotencyKey: "8e03978e-40d5-43e8-bc93-6894a57f9324",
* source: {
* accountId: "account_af2937b0-9846-4fe7-bfe9-ccc22d935114",
* asset: "usd"
* },
* target: {
* address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
* network: "base",
* asset: "usdc"
* },
* amount: "100.00",
* asset: "usd",
* validateOnly: false,
* execute: false,
* metadata: {
* "invoiceId": "12345",
* "reference": "Payment for invoice #12345"
* },
* travelRule: {
* isSelf: false,
* isIntermediary: true,
* originator: {
* financialInstitution: "PayPal, Inc.",
* name: "John Doe",
* address: {
* line1: "123 Main St",
* line2: "Unit 201",
* city: "San Francisco",
* state: "California",
* postCode: "94105",
* countryCode: "US"
* },
* personalId: "123-45-6789",
* dateOfBirth: {
* day: "15",
* month: "08",
* year: "1990"
* }
* },
* beneficiary: {
* name: "Jane Smith",
* address: {
* line1: "456 Oak Ave",
* city: "Paris",
* postCode: "75001",
* countryCode: "FR"
* },
* walletType: "custodial"
* }
* }
* }
* ```
*/
export interface TransferRequest {
/**
* An optional string request header for making requests safely retryable.
* When included, duplicate requests with the same key will return identical responses.
* Refer to our [Idempotency docs](https://docs.cdp.coinbase.com/api-reference/v2/idempotency) for more information on using idempotency keys.
*/
idempotencyKey?: string;
source: CoinbaseApi.CreateTransferSource;
target: CoinbaseApi.TransferTarget;
/** The amount of the transfer, as a decimal string in standard unit denomination of the asset specified by `asset` (e.g., "100.00" for 100 USD, "0.05" for 0.05 ETH). */
amount: string;
/** The symbol of the asset for the amount. This must be one of the assets of the source or target. */
asset: CoinbaseApi.Asset;
/**
* Specifies whether the given amount is to be received by the target or taken from the source.
*
* - `target`: The transfer `target` receives the exact value specified in `amount`. Fees are added to the amount taken from the transfer `source`.
* - `source`: The transfer `target` receives the value specified in `amount`, minus any fees.
*/
amountType?: TransferRequest.AmountType;
/** If true, validates the transfer without initiating it. If the request is valid, a 2xx will be returned. If the request is invalid, a 4xx error will be returned. The response will include an errorType, for e.g. invalid_target if the specified target cannot receive funds. */
validateOnly?: boolean;
/** Whether to immediately execute the transfer. If false, the transfer will be created in quoted status and must be executed manually via the /execute endpoint. */
execute: boolean;
metadata?: CoinbaseApi.Metadata;
/** Travel Rule compliance information for this transfer. Required for transfers to external wallets above regulatory thresholds. Fields required differ by region and Coinbase contracting entity. */
travelRule?: CoinbaseApi.TravelRule;
}
export namespace TransferRequest {
/**
* Specifies whether the given amount is to be received by the target or taken from the source.
*
* - `target`: The transfer `target` receives the exact value specified in `amount`. Fees are added to the amount taken from the transfer `source`.
* - `source`: The transfer `target` receives the value specified in `amount`, minus any fees.
*/
export const AmountType = {
Target: "target",
Source: "source",
} as const;
export type AmountType = (typeof AmountType)[keyof typeof AmountType];
}