Coinbase TypeScript SDK example: transferMoney.ts
Coinbase Coinbase App Private transfer money example for the Siebly Coinbase SDK, with TypeScript source for exchange REST API and WebSocket integration, setup, and production SDK docs.
What This Example Covers
- Coinbase exchange API example in TypeScript.
- Uses the Siebly Coinbase SDK package
coinbase-apiinstead of hand-written HTTP request plumbing. - Source path:
Coinbase/CoinbaseApp/Private/transferMoney.ts. - Example category: Coinbase App Private.
- Imports SDK symbols including
CBAppClient. - Calls SDK methods such as
transferMoney().
How To Use This Example
- Start here for the specific request or stream pattern, then check the matching SDK guide for install, credentials, and operational notes.
- For private or order-management examples, keep credentials in environment variables or a secret manager. Use read-only keys where possible, and check the execution mode reference before any exchange write path can run.
- Open the repository source when you need the latest committed version: GitHub source file.
Example Path
Coinbase/CoinbaseApp/Private/transferMoney.ts
Source Link
Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Coinbase/CoinbaseApp/Private/transferMoney.ts
Related SDK Docs
Example Source
import { CBAppClient } from 'coinbase-api';
// initialise the client
/**
*
* You can add both ED25519 and ECDSA keys, client will recognize both types of keys
*
* ECDSA:
*
* {
* apiKey: 'organizations/your_org_id/apiKeys/your_api_key_id',
* apiSecret:
* '-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIPT/TTZPxw0kDGvpuCENJp9A4/2INAt9/QKKfyidTWM8oAoGCCqGSM49\nAwEHoUQDQgAEd+cnxrKl536ly5eYBi+8dvXt1MJXYRo+/v38h9HrFKVGBRndU9DY\npV357xIfqeJEzb/MBuk3EW8cG9RTrYBwjg==\n-----END EC PRIVATE KEY-----\n',
* }
*
* ED25519:
* {
* apiKey: 'your-api-key-id',
* apiSecret: 'yourExampleApiSecretEd25519Version==',
* }
*
*
*/
const client = new CBAppClient({
apiKey: process.env.API_KEY_NAME || 'insert_api_key_here',
apiSecret: process.env.API_PRIVATE_KEY || 'insert_api_secret_here',
});
async function transferMoney() {
try {
// Transfer money between your own accounts
const transferMoneyResult = await client.transferMoney({
account_id: 'your_source_account_id',
type: 'transfer',
to: 'your_destination_account_id',
amount: '0.01',
currency: 'BTC',
});
console.log('Transfer Money Result: ', transferMoneyResult);
} catch (e) {
console.error('Transfer money error: ', e);
}
}
transferMoney();