Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions examples/ts/go-account/create-go-account-address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
* IMPORTANT: For Go Account (OFC) wallets, the onToken parameter is always required
* when creating addresses.
*
* Required environment variables (in examples/.env):
* TESTNET_ACCESS_TOKEN - your BitGo access token
* OFC_WALLET_ID - your Go Account wallet ID
*
* Copyright 2025, BitGo, Inc. All Rights Reserved.
*/

Expand All @@ -27,8 +31,8 @@ const bitgo = new BitGoAPI({
const coin = 'ofc';
bitgo.register(coin, coins.Ofc.createInstance);

// Configuration - Update these values
const walletId = 'your_wallet_id'; // The ID of your existing Go Account wallet
// Configuration - Update these values or set them as environment variables
const walletId = process.env.OFC_WALLET_ID || 'your_wallet_id'; // The ID of your existing Go Account wallet
const addressLabel = 'My New Address 2'; // Label for the new address

// Token to create address for (required for OFC wallets)
Expand Down
8 changes: 4 additions & 4 deletions examples/ts/go-account/go-account-get-balance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const bitgo = new BitGoAPI({
// ---------------------------------------------------------------------------

/** Your Go Account wallet ID */
const accountId = process.env.OFC_WALLET_ID || 'your_wallet_id';
const walletId = process.env.OFC_WALLET_ID || 'your_wallet_id';

/**
* When true, unsettled trading balance is included in the available balance
Expand Down Expand Up @@ -67,10 +67,10 @@ async function main() {
console.log(`Include unsettled in available: ${includeUnsettledInAvailable}\n`);

const url = (bitgo as any).microservicesUrl(
`/api/prime/trading/v1/accounts/${accountId}/balances`
`/api/prime/trading/v1/accounts/${walletId}/balances`
);

console.log(`Fetching balances for account ${accountId}...`);
console.log(`Fetching balances for account ${walletId}...`);
const response: GetBalancesResponse = await (bitgo as any)
.get(url)
.query({ includeUnsettledInAvailable })
Expand Down Expand Up @@ -103,7 +103,7 @@ async function main() {
console.log('\n' + '='.repeat(60));
console.log('SUMMARY');
console.log('='.repeat(60));
console.log(` Account ID : ${accountId}`);
console.log(` Account ID : ${walletId}`);
console.log(` Currencies held : ${balances.length}`);
console.log(` Include unsettled : ${includeUnsettledInAvailable}`);
for (const b of balances) {
Expand Down
4 changes: 2 additions & 2 deletions examples/ts/go-account/go-account-get-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const bitgo = new BitGoAPI({
// ---------------------------------------------------------------------------

/** Your Go Account wallet ID */
const accountId = process.env.OFC_WALLET_ID || 'your_wallet_id';
const walletId = process.env.OFC_WALLET_ID || 'your_wallet_id';

/** The order ID returned when the order was placed */
const orderId = process.env.TRADE_ORDER_ID || 'your_order_id';
Expand Down Expand Up @@ -58,7 +58,7 @@ async function main() {
console.log('=== Go Account — Get Trade Order ===\n');

const url = (bitgo as any).microservicesUrl(
`/api/prime/trading/v1/accounts/${accountId}/orders/${orderId}`
`/api/prime/trading/v1/accounts/${walletId}/orders/${orderId}`
);

console.log(`Fetching order ${orderId}...`);
Expand Down
8 changes: 4 additions & 4 deletions examples/ts/go-account/go-account-list-orders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const bitgo = new BitGoAPI({
// ---------------------------------------------------------------------------

/** Your Go Account wallet ID */
const accountId = process.env.OFC_WALLET_ID || 'your_wallet_id';
const walletId = process.env.OFC_WALLET_ID || 'your_wallet_id';

/** Optional: filter orders by status */
const statusFilter = process.env.TRADE_ORDER_STATUS;
Expand Down Expand Up @@ -65,7 +65,7 @@ async function main() {
console.log('=== Go Account — List Trade Orders ===\n');

const url = (bitgo as any).microservicesUrl(
`/api/prime/trading/v1/accounts/${accountId}/orders`
`/api/prime/trading/v1/accounts/${walletId}/orders`
);

// Build query params
Expand All @@ -77,7 +77,7 @@ async function main() {
query['product'] = productFilter;
}

console.log(`Fetching orders for account ${accountId}...`);
console.log(`Fetching orders for account ${walletId}...`);
if (statusFilter) console.log(` Status filter : ${statusFilter}`);
if (productFilter) console.log(` Product filter : ${productFilter}`);
console.log('');
Expand Down Expand Up @@ -112,7 +112,7 @@ async function main() {
console.log('\n' + '='.repeat(60));
console.log('SUMMARY');
console.log('='.repeat(60));
console.log(` Account ID : ${accountId}`);
console.log(` Account ID : ${walletId}`);
console.log(` Total orders : ${orders.length}`);

// Group by status
Expand Down
8 changes: 4 additions & 4 deletions examples/ts/go-account/go-account-list-products.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const bitgo = new BitGoAPI({
* Your Go Account wallet ID.
* Find this in the BitGo portal or from the wallet object in your API responses.
*/
const accountId = process.env.OFC_WALLET_ID || 'your_wallet_id';
const walletId = process.env.OFC_WALLET_ID || 'your_wallet_id';

// ---------------------------------------------------------------------------

Expand All @@ -53,10 +53,10 @@ async function main() {
console.log('=== Go Account — List Trading Products ===\n');

const url = (bitgo as any).microservicesUrl(
`/api/prime/trading/v1/accounts/${accountId}/products`
`/api/prime/trading/v1/accounts/${walletId}/products`
);

console.log(`Fetching trading products for account ${accountId}...`);
console.log(`Fetching trading products for account ${walletId}...`);
const response: ListProductsResponse = await (bitgo as any).get(url).result();

const products: Product[] = response.data ?? [];
Expand Down Expand Up @@ -99,7 +99,7 @@ async function main() {
console.log('\n' + '='.repeat(60));
console.log('SUMMARY');
console.log('='.repeat(60));
console.log(` Account ID : ${accountId}`);
console.log(` Account ID : ${walletId}`);
console.log(` Total products : ${products.length}`);
console.log(` Available to trade: ${availableProducts.length}`);
console.log(` Disabled : ${disabledProducts.length}`);
Expand Down
6 changes: 3 additions & 3 deletions examples/ts/go-account/go-account-place-order.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const bitgo = new BitGoAPI({
* Your Go Account wallet ID.
* Find this in the BitGo portal or from the wallet object in your API responses.
*/
const accountId = process.env.OFC_WALLET_ID || 'your_wallet_id';
const walletId = process.env.OFC_WALLET_ID || 'your_wallet_id';

/**
* Unique identifier for this order. Must be unique per account.
Expand Down Expand Up @@ -163,7 +163,7 @@ async function main() {

// Log what we are about to send
console.log('Order details:');
console.log(` Account ID : ${accountId}`);
console.log(` Account ID : ${walletId}`);
console.log(` Client Order ID : ${clientOrderId}`);
console.log(` Type : ${orderType}`);
console.log(` Product : ${product}`);
Expand All @@ -184,7 +184,7 @@ async function main() {
console.log('');

const url = (bitgo as any).microservicesUrl(
`/api/prime/trading/v1/accounts/${accountId}/orders`
`/api/prime/trading/v1/accounts/${walletId}/orders`
);

console.log('Placing trade order...');
Expand Down