Skip to content

Commit e987553

Browse files
authored
Merge pull request #8338 from BitGo/CAAS-1013-fix-go-account-example-doc
chore: fix go account examples doc
2 parents ed4835c + 5965220 commit e987553

1 file changed

Lines changed: 64 additions & 64 deletions

File tree

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Creating Go Accounts without BitGo Express
1+
# Go Account Workflows
22

3-
This guide demonstrates how to create Go Accounts (trading wallets) using only the BitGo SDK, without requiring BitGo Express.
3+
This guide covers the full Go Account (trading wallet) lifecycle using the BitGo SDK directly, without requiring BitGo Express.
44

55
## Overview
66

@@ -12,6 +12,68 @@ This guide demonstrates how to create Go Accounts (trading wallets) using only t
1212

1313
## Available Scripts
1414

15+
### 1. SDK Approach (Recommended)
16+
**File:** `examples/ts/go-account/create-go-account.ts`
17+
18+
Uses the high-level `generateWallet()` method which handles keychain creation, encryption, and wallet setup automatically.
19+
20+
**Best for:**
21+
- Most production use cases
22+
- Quick integration
23+
- Users who don't need manual key management
24+
25+
**Example:**
26+
```typescript
27+
const bitgo = new BitGoAPI({
28+
accessToken: process.env.TESTNET_ACCESS_TOKEN,
29+
env: 'test',
30+
});
31+
32+
const coin = 'ofc';
33+
bitgo.register(coin, coins.Ofc.createInstance);
34+
35+
const response = await bitgo.coin(coin).wallets().generateWallet({
36+
label: 'My Go Account',
37+
passphrase: 'wallet_passphrase',
38+
passcodeEncryptionCode: 'encryption_code',
39+
enterprise: 'your_enterprise_id',
40+
type: 'trading', // Required for Go Accounts
41+
});
42+
43+
const { wallet, userKeychain, encryptedWalletPassphrase } = response;
44+
```
45+
46+
### 2. Advanced SDK Approach
47+
**File:** `examples/ts/go-account/create-go-account-advanced.ts`
48+
49+
Provides manual control over keychain creation and wallet setup using SDK methods.
50+
51+
**Best for:**
52+
- Advanced users needing custom key management
53+
- Integration with custom key storage systems
54+
- Understanding the internals of Go Account creation
55+
- Testing and debugging
56+
57+
### 3. Creating Addresses for Existing Wallets
58+
**File:** `examples/ts/go-account/create-go-account-address.ts`
59+
60+
Demonstrates how to create additional addresses for an existing Go Account wallet.
61+
62+
**Best for:**
63+
- Adding new addresses to existing wallets
64+
- Creating addresses for different tokens
65+
- Managing multiple receiving addresses
66+
67+
**Example:**
68+
```typescript
69+
const wallet = await bitgo.coin('ofc').wallets().get({ id: walletId });
70+
71+
const address = await wallet.createAddress({
72+
label: 'My New Address',
73+
onToken: 'ofctsol:usdc' // Required for OFC wallets
74+
});
75+
```
76+
1577
### 4. Go Account Withdrawal — complete flow
1678
**File:** `examples/ts/go-account/go-account-withdrawal.ts`
1779

@@ -78,68 +140,6 @@ const signature = await tradingAccount.signPayload({
78140

79141
---
80142

81-
### 1. SDK Approach (Recommended)
82-
**File:** `examples/ts/go-account/create-go-account.ts`
83-
84-
Uses the high-level `generateWallet()` method which handles keychain creation, encryption, and wallet setup automatically.
85-
86-
**Best for:**
87-
- Most production use cases
88-
- Quick integration
89-
- Users who don't need manual key management
90-
91-
**Example:**
92-
```typescript
93-
const bitgo = new BitGoAPI({
94-
accessToken: process.env.TESTNET_ACCESS_TOKEN,
95-
env: 'test',
96-
});
97-
98-
const coin = 'ofc';
99-
bitgo.register(coin, coins.Ofc.createInstance);
100-
101-
const response = await bitgo.coin(coin).wallets().generateWallet({
102-
label: 'My Go Account',
103-
passphrase: 'wallet_passphrase',
104-
passcodeEncryptionCode: 'encryption_code',
105-
enterprise: 'your_enterprise_id',
106-
type: 'trading', // Required for Go Accounts
107-
});
108-
109-
const { wallet, userKeychain, encryptedWalletPassphrase } = response;
110-
```
111-
112-
### 2. Advanced SDK Approach
113-
**File:** `examples/ts/go-account/create-go-account-advanced.ts`
114-
115-
Provides manual control over keychain creation and wallet setup using SDK methods.
116-
117-
**Best for:**
118-
- Advanced users needing custom key management
119-
- Integration with custom key storage systems
120-
- Understanding the internals of Go Account creation
121-
- Testing and debugging
122-
123-
### 3. Creating Addresses for Existing Wallets
124-
**File:** `examples/ts/go-account/create-go-account-address.ts`
125-
126-
Demonstrates how to create additional addresses for an existing Go Account wallet.
127-
128-
**Best for:**
129-
- Adding new addresses to existing wallets
130-
- Creating addresses for different tokens
131-
- Managing multiple receiving addresses
132-
133-
**Example:**
134-
```typescript
135-
const wallet = await bitgo.coin('ofc').wallets().get({ id: walletId });
136-
137-
const address = await wallet.createAddress({
138-
label: 'My New Address',
139-
onToken: 'ofctsol:usdc' // Required for OFC wallets
140-
});
141-
```
142-
143143
## Detailed Examples
144144

145145
### SDK Approach Example

0 commit comments

Comments
 (0)