@riocrypto/common-server 1.0.1033 → 1.0.1035
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.
|
@@ -11,7 +11,7 @@ declare class FireblocksClient {
|
|
|
11
11
|
getExchangeFiatBalance(): Promise<number>;
|
|
12
12
|
getTransactions(vaultId: string, crypto: Crypto, nextPage?: string): Promise<any>;
|
|
13
13
|
getDepositAddress(vaultId: string, crypto: Crypto): Promise<string>;
|
|
14
|
-
createVault(userId: string): Promise<string>;
|
|
14
|
+
createVault(userId: string, name: string): Promise<string>;
|
|
15
15
|
createWallet(vaultId: string, crypto: Crypto): Promise<string>;
|
|
16
16
|
}
|
|
17
17
|
export declare const buildFireblocksClient: () => Promise<FireblocksClient>;
|
|
@@ -126,9 +126,9 @@ class FireblocksClient {
|
|
|
126
126
|
return addresses[0].address;
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
createVault(userId) {
|
|
129
|
+
createVault(userId, name) {
|
|
130
130
|
return __awaiter(this, void 0, void 0, function* () {
|
|
131
|
-
const vault = yield this.fireblocks.createVaultAccount(
|
|
131
|
+
const vault = yield this.fireblocks.createVaultAccount(`${name}`);
|
|
132
132
|
return vault.id;
|
|
133
133
|
});
|
|
134
134
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { User } from "@riocrypto/common";
|
|
2
|
+
declare class STPClient {
|
|
3
|
+
private apiKey;
|
|
4
|
+
private env;
|
|
5
|
+
private baseUrl;
|
|
6
|
+
constructor(apiKey: string, env: "production" | "sandbox");
|
|
7
|
+
createCryptoListIndividualUser(user: User): Promise<{
|
|
8
|
+
id: number;
|
|
9
|
+
descripcion: string;
|
|
10
|
+
}>;
|
|
11
|
+
createCryptoListBusinessUser(user: User): Promise<{
|
|
12
|
+
id: number;
|
|
13
|
+
descripcion: string;
|
|
14
|
+
}>;
|
|
15
|
+
getCyptoListUsers(user: User): Promise<{
|
|
16
|
+
id: number;
|
|
17
|
+
descripcion: string;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export declare const buildSTPClient: () => Promise<STPClient>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.buildSTPClient = void 0;
|
|
16
|
+
const secret_manager_client_1 = require("./secret-manager-client");
|
|
17
|
+
const axios_1 = __importDefault(require("axios"));
|
|
18
|
+
const common_1 = require("@riocrypto/common");
|
|
19
|
+
class STPClient {
|
|
20
|
+
constructor(apiKey, env) {
|
|
21
|
+
this.apiKey = apiKey;
|
|
22
|
+
this.env = env;
|
|
23
|
+
this.baseUrl =
|
|
24
|
+
env === "production"
|
|
25
|
+
? "https://stpmex.com:7024"
|
|
26
|
+
: "https://demo.stpmex.com:7024";
|
|
27
|
+
}
|
|
28
|
+
createCryptoListIndividualUser(user) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const { data } = yield axios_1.default.put(`${this.baseUrl}/speiws/rest/cuentaModule/fisicaCrypto`, {
|
|
31
|
+
nombre: user.firstName.toLocaleUpperCase(),
|
|
32
|
+
apellidoPaterno: user.lastName.toLocaleUpperCase(),
|
|
33
|
+
apellidoMaterno: user.lastName.toLocaleUpperCase(),
|
|
34
|
+
cuenta: "",
|
|
35
|
+
empresa: "Rampa Blockchain SAPI",
|
|
36
|
+
}, {
|
|
37
|
+
headers: {
|
|
38
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
if (data.id !== 0) {
|
|
42
|
+
throw new Error(data.descripcion);
|
|
43
|
+
}
|
|
44
|
+
return data;
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
createCryptoListBusinessUser(user) {
|
|
48
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
const { data } = yield axios_1.default.put(`${this.baseUrl}/speiws/rest/cuentaModule/moralCrypto`, {
|
|
50
|
+
nombre: user.companyName.toLocaleUpperCase(),
|
|
51
|
+
cuenta: "",
|
|
52
|
+
empresa: "Rampa Blockchain SAPI",
|
|
53
|
+
fechaConstitucion: "2020-01-01",
|
|
54
|
+
}, {
|
|
55
|
+
headers: {
|
|
56
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
if (data.id !== 0) {
|
|
60
|
+
throw new Error(data.descripcion);
|
|
61
|
+
}
|
|
62
|
+
return data;
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
getCyptoListUsers(user) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
const { data } = yield axios_1.default.put(`${this.baseUrl}/speiws/rest/cuentaModule/moralCrypto`, {
|
|
68
|
+
nombre: user.companyName.toLocaleUpperCase(),
|
|
69
|
+
cuenta: "",
|
|
70
|
+
empresa: "Rampa Blockchain SAPI",
|
|
71
|
+
fechaConstitucion: "2020-01-01",
|
|
72
|
+
}, {
|
|
73
|
+
headers: {
|
|
74
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
if (data.id !== 0) {
|
|
78
|
+
throw new Error(data.descripcion);
|
|
79
|
+
}
|
|
80
|
+
return data;
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const buildSTPClient = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
85
|
+
// Retrieve secrets asynchronously
|
|
86
|
+
const STP_API_KEY = yield secret_manager_client_1.secretManagerClient.getSecretValue("STP_API_KEY");
|
|
87
|
+
if (!STP_API_KEY) {
|
|
88
|
+
throw new common_1.SecretManagerError();
|
|
89
|
+
}
|
|
90
|
+
const env = process.env.RIO_ENV === common_1.RioEnv.Production ||
|
|
91
|
+
process.env.RIO_ENV === common_1.RioEnv.Staging ||
|
|
92
|
+
process.env.RIO_ENV === common_1.RioEnv.Development
|
|
93
|
+
? "production"
|
|
94
|
+
: "sandbox";
|
|
95
|
+
return new STPClient(STP_API_KEY, env);
|
|
96
|
+
});
|
|
97
|
+
exports.buildSTPClient = buildSTPClient;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1035",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
25
25
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
26
26
|
"@google-cloud/storage": "^6.9.5",
|
|
27
|
-
"@riocrypto/common": "^1.0.
|
|
27
|
+
"@riocrypto/common": "^1.0.891",
|
|
28
28
|
"@types/express": "^4.17.13",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"ccxt": "^3.0.30",
|