From 0599ce89e06a07c4b5940a24643210e7fb5297b0 Mon Sep 17 00:00:00 2001 From: JJ-Cro Date: Mon, 28 Apr 2025 12:39:10 +0200 Subject: [PATCH] chore(): updated examples --- examples/rest-private-futures.ts | 5 +++++ examples/rest-private-spot.ts | 4 ++++ examples/rest-trade-futures.ts | 5 +++++ examples/rest-trade-spot.ts | 5 +++++ examples/ws-private.ts | 5 +++++ 5 files changed, 24 insertions(+) diff --git a/examples/rest-private-futures.ts b/examples/rest-private-futures.ts index 6874f44..ccdc842 100644 --- a/examples/rest-private-futures.ts +++ b/examples/rest-private-futures.ts @@ -8,6 +8,11 @@ const API_KEY = process.env.API_KEY_COM; const API_SECRET = process.env.API_SECRET_COM; const API_PASS = process.env.API_PASS_COM; +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM=‘lkm12n3-2ba3-1mxf-fn13-lkm12n3a’ API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-private-futures.ts + +// note the single quotes, preventing special characters such as $ from being incorrectly passed + const client = new RestClientV2({ apiKey: API_KEY, apiSecret: API_SECRET, diff --git a/examples/rest-private-spot.ts b/examples/rest-private-spot.ts index 28c8310..0a4562a 100644 --- a/examples/rest-private-spot.ts +++ b/examples/rest-private-spot.ts @@ -7,6 +7,10 @@ import { RestClientV2 } from '../src/index'; const API_KEY = process.env.API_KEY_COM; const API_SECRET = process.env.API_SECRET_COM; const API_PASS = process.env.API_PASS_COM; +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM=‘lkm12n3-2ba3-1mxf-fn13-lkm12n3a’ API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-private-spot.ts + +// note the single quotes, preventing special characters such as $ from being incorrectly passed const client = new RestClientV2({ apiKey: API_KEY, diff --git a/examples/rest-trade-futures.ts b/examples/rest-trade-futures.ts index 1f2eb5d..f9c3ca3 100644 --- a/examples/rest-trade-futures.ts +++ b/examples/rest-trade-futures.ts @@ -12,6 +12,11 @@ const API_KEY = process.env.API_KEY_COM; const API_SECRET = process.env.API_SECRET_COM; const API_PASS = process.env.API_PASS_COM; +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM=‘lkm12n3-2ba3-1mxf-fn13-lkm12n3a’ API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-trade-futures.ts + +// note the single quotes, preventing special characters such as $ from being incorrectly passed + const client = new RestClientV2({ apiKey: API_KEY, apiSecret: API_SECRET, diff --git a/examples/rest-trade-spot.ts b/examples/rest-trade-spot.ts index 25f5eee..e3b2cbe 100644 --- a/examples/rest-trade-spot.ts +++ b/examples/rest-trade-spot.ts @@ -11,6 +11,11 @@ const API_KEY = process.env.API_KEY_COM; const API_SECRET = process.env.API_SECRET_COM; const API_PASS = process.env.API_PASS_COM; +// If running from CLI in unix, you can pass env vars as such: +// API_KEY_COM=‘lkm12n3-2ba3-1mxf-fn13-lkm12n3a’ API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/rest-trade-spot.ts + +// note the single quotes, preventing special characters such as $ from being incorrectly passed + const client = new RestClientV2({ apiKey: API_KEY, apiSecret: API_SECRET, diff --git a/examples/ws-private.ts b/examples/ws-private.ts index c623275..fc05fc9 100644 --- a/examples/ws-private.ts +++ b/examples/ws-private.ts @@ -13,6 +13,11 @@ import { DefaultLogger, WebsocketClientV2 } from '../src'; const API_SECRET = process.env.API_SECRET_COM; const API_PASS = process.env.API_PASS_COM; + // If running from CLI in unix, you can pass env vars as such: + // API_KEY_COM=‘lkm12n3-2ba3-1mxf-fn13-lkm12n3a’ API_SECRET_COM='035B2B9637E1BDFFEE2646BFBDDB8CE4' API_PASSPHRASE_COM='ComplexPa$$!23$5^' ts-node examples/ws-private.ts + + // note the single quotes, preventing special characters such as $ from being incorrectly passed + const wsClient = new WebsocketClientV2( { apiKey: API_KEY,