@riocrypto/common-server 1.0.1649 → 1.0.1650
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.
|
@@ -3,7 +3,7 @@ declare class CoinbaseClient {
|
|
|
3
3
|
private apiKey;
|
|
4
4
|
private baseUrl;
|
|
5
5
|
private productIdMappings;
|
|
6
|
-
constructor(apiKey: string);
|
|
6
|
+
constructor(apiKey: string, env?: "production" | "sandbox");
|
|
7
7
|
private getRequestHeaders;
|
|
8
8
|
createMarketOrder(crypto: Crypto, amount: number): Promise<any>;
|
|
9
9
|
}
|
|
@@ -18,13 +18,21 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
18
18
|
const common_1 = require("@riocrypto/common");
|
|
19
19
|
const crypto_1 = require("crypto");
|
|
20
20
|
class CoinbaseClient {
|
|
21
|
-
constructor(apiKey) {
|
|
21
|
+
constructor(apiKey, env) {
|
|
22
22
|
this.apiKey = apiKey;
|
|
23
|
-
if (
|
|
24
|
-
this.baseUrl =
|
|
23
|
+
if (env) {
|
|
24
|
+
this.baseUrl =
|
|
25
|
+
env === "production"
|
|
26
|
+
? "https://api.exchange.coinbase.com"
|
|
27
|
+
: "https://api-public.sandbox.exchange.coinbase.com";
|
|
25
28
|
}
|
|
26
29
|
else {
|
|
27
|
-
|
|
30
|
+
if ([common_1.RioEnv.Development, common_1.RioEnv.Production, common_1.RioEnv.Staging].includes(process.env.RIO_ENV)) {
|
|
31
|
+
this.baseUrl = "https://api.exchange.coinbase.com";
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
this.baseUrl = "https://api-public.sandbox.exchange.coinbase.com";
|
|
35
|
+
}
|
|
28
36
|
}
|
|
29
37
|
this.productIdMappings = {
|
|
30
38
|
[common_1.Crypto.USDTEthereum]: "USDT-USD",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1650",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@google-cloud/storage": "^6.9.5",
|
|
29
29
|
"@google-cloud/vision": "^4.0.2",
|
|
30
30
|
"@hyperdx/node-opentelemetry": "^0.4.2",
|
|
31
|
-
"@riocrypto/common": "^1.0.
|
|
31
|
+
"@riocrypto/common": "^1.0.1467",
|
|
32
32
|
"@types/express": "^4.17.13",
|
|
33
33
|
"axios": "^1.6.0",
|
|
34
34
|
"ccxt": "^3.0.30",
|