UNPKG

@coinbase/cdp-sdk

Version:

SDK for interacting with the Coinbase Developer Platform Wallet API

87 lines (80 loc) 4.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.submitDepositTravelRule = exports.executeFundTransfer = exports.getTransferById = exports.listTransfers = exports.createTransfer = void 0; const cdpApiClient_js_1 = require("../../cdpApiClient.js"); /** * Create a new transfer to move funds from a source to a target. All transfers first transition to `quoted`. If `execute: false`, the transfer stays quoted until you call `/v2/transfers/{transferId}/execute`. If `execute: true`, quoted status emits momentarily before the transfer moves to `processing`, where execution proceeds. Subscribe to the transfers webhook to follow progress in real time instead of polling. * @summary Create transfer */ const createTransfer = (transferRequest, options) => { return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/transfers`, method: "POST", headers: { "Content-Type": "application/json" }, data: transferRequest, }, options); }; exports.createTransfer = createTransfer; /** * List transfers for your organization. Use this to view and monitor your transfer activity. **Status Filtering**: Filter by specific status to efficiently manage transfers: * `?status=processing` - Monitor active transfers. * `?status=quoted` - Find transfers awaiting execution. * `?status=failed` - Review failed transfers for troubleshooting. * `?status=completed` - Find completed transfers. **Account Filtering**: Filter by account ID to find transfers involving a specific account: * `?accountId=<ID>` - All transfers where the account is either source or target (OR semantics). * `?sourceAccountId=<ID>` - Only transfers where the account is the source (outbound). * `?targetAccountId=<ID>` - Only transfers where the account is the target (inbound). Providing `accountId` together with `sourceAccountId` or `targetAccountId` is a validation error and returns HTTP 400. **Date Range Filtering**: Filter by creation or last-updated time for reconciliation: * `?createdAfter=2026-01-01T00:00:00Z&createdBefore=2026-01-31T23:59:59Z` - Transfers created within a date range. * `?updatedAfter=2026-01-01T00:00:00Z` - Transfers updated since a given time. Useful for incremental sync. **Asset Filtering**: Filter by source or target asset symbol: * `?sourceAsset=usd` - Transfers funded from a USD account. * `?targetAsset=usdc` - Transfers delivering USDC to the target. **Other Filters**: * `?sourceAddress=0x...` - Transfers from a specific on-chain source address. * `?targetAddress=0x...` - Transfers to a specific on-chain destination address. * `?targetEmail=user@example.com` - Transfers to a specific email recipient. * `?transferId=transfer_...` - Look up a single transfer by ID; bypasses pagination. * @summary List transfers */ const listTransfers = (params, options) => { return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/transfers`, method: "GET", params }, options); }; exports.listTransfers = listTransfers; /** * Get a transfer by its ID. * @summary Get transfer */ const getTransferById = (transferId, options) => { return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/transfers/${transferId}`, method: "GET" }, options); }; exports.getTransferById = getTransferById; /** * Executes a transfer which was created using the Create a transfer endpoint. * @summary Execute transfer */ const executeFundTransfer = (transferId, options) => { return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/transfers/${transferId}/execute`, method: "POST" }, options); }; exports.executeFundTransfer = executeFundTransfer; /** * Submit travel rule information for a deposit transfer held pending compliance review. Required fields vary by jurisdiction and may include originator name, address, date of birth, personal ID, and VASP information. If the submitted information satisfies all jurisdictional requirements, `status` will be `completed` and the transfer will proceed. Otherwise, `status` will be `incomplete` and `missingFields` will indicate which fields still need to be provided. * @summary Submit deposit travel rule information */ const submitDepositTravelRule = (transferId, depositTravelRuleRequest, options) => { return (0, cdpApiClient_js_1.cdpApiClient)({ url: `/v2/transfers/${transferId}/travel-rule`, method: "POST", headers: { "Content-Type": "application/json" }, data: depositTravelRuleRequest, }, options); }; exports.submitDepositTravelRule = submitDepositTravelRule; //# sourceMappingURL=transfers.js.map