coinbase-api 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +46 -30
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -127,13 +127,17 @@ const client = new CBAdvancedTradeClient({
127
127
  apiSecret: advancedTradeCdpAPIKey.privateKey,
128
128
  });
129
129
 
130
- // Example usage of the CBAdvancedTradeClient
131
- try {
132
- const accounts = await client.getAccounts();
133
- console.log('Get accounts result: ', accounts);
134
- } catch (e) {
135
- console.error('Exception: ', JSON.stringify(e));
130
+ async function doAPICall() {
131
+ // Example usage of the CBAdvancedTradeClient
132
+ try {
133
+ const accounts = await client.getAccounts();
134
+ console.log('Get accounts result: ', accounts);
135
+ } catch (e) {
136
+ console.error('Exception: ', JSON.stringify(e));
137
+ }
136
138
  }
139
+
140
+ doAPICall();
137
141
  ```
138
142
 
139
143
  #### CBAppClient
@@ -162,19 +166,23 @@ const client = new CBAppClient({
162
166
  apiSecret: CBAppKeys.privateKey,
163
167
  });
164
168
 
165
- try {
166
- // Transfer money between your own accounts
167
- const transferMoneyResult = await client.transferMoney({
168
- account_id: 'your_source_account_id',
169
- type: 'transfer',
170
- to: 'your_destination_account_id',
171
- amount: '0.01',
172
- currency: 'BTC',
173
- });
174
- console.log('Transfer Money Result: ', transferMoneyResult);
175
- } catch (e) {
176
- console.error('Error: ', e);
169
+ async function doAPICall() {
170
+ try {
171
+ // Transfer money between your own accounts
172
+ const transferMoneyResult = await client.transferMoney({
173
+ account_id: 'your_source_account_id',
174
+ type: 'transfer',
175
+ to: 'your_destination_account_id',
176
+ amount: '0.01',
177
+ currency: 'BTC',
178
+ });
179
+ console.log('Transfer Money Result: ', transferMoneyResult);
180
+ } catch (e) {
181
+ console.error('Error: ', e);
182
+ }
177
183
  }
184
+
185
+ doAPICall();
178
186
  ```
179
187
 
180
188
  #### CBInternationalClient
@@ -195,13 +203,17 @@ const client = new CBInternationalClient({
195
203
  // useSandbox: true,
196
204
  });
197
205
 
198
- try {
199
- // Get asset details
200
- const assetDetails = await client.getAssetDetails({ asset: 'BTC' });
201
- console.log('Asset Details: ', assetDetails);
202
- } catch (e) {
203
- console.error('Exception: ', JSON.stringify(e, null, 2));
206
+ async function doAPICall() {
207
+ try {
208
+ // Get asset details
209
+ const assetDetails = await client.getAssetDetails({ asset: 'BTC' });
210
+ console.log('Asset Details: ', assetDetails);
211
+ } catch (e) {
212
+ console.error('Exception: ', JSON.stringify(e, null, 2));
213
+ }
204
214
  }
215
+
216
+ doAPICall();
205
217
  ```
206
218
 
207
219
  #### CBExchangeClient
@@ -222,13 +234,17 @@ const client = new CBExchangeClient({
222
234
  // useSandbox: true,
223
235
  });
224
236
 
225
- try {
226
- // Get a single currency by id
227
- const currency = await client.getCurrency('BTC');
228
- console.log('Currency: ', currency);
229
- } catch (e) {
230
- console.error('Exception: ', JSON.stringify(e, null, 2));
237
+ async function doAPICall() {
238
+ try {
239
+ // Get a single currency by id
240
+ const currency = await client.getCurrency('BTC');
241
+ console.log('Currency: ', currency);
242
+ } catch (e) {
243
+ console.error('Exception: ', JSON.stringify(e, null, 2));
244
+ }
231
245
  }
246
+
247
+ doAPICall();
232
248
  ```
233
249
 
234
250
  See all clients [here](./src/) for more information on all the functions or the [examples](./examples/) for lots of usage examples. You can also check the endpoint function list [here](./docs/endpointFunctionList.md) to find all available functions!
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coinbase-api",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Node.js SDK for Coinbase's REST APIs and WebSockets, with TypeScript & strong end to end tests.",
5
5
  "scripts": {
6
6
  "clean": "rm -rf dist",