@riocrypto/common-server 1.0.1088 → 1.0.1090
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.
|
@@ -8,6 +8,7 @@ declare class BitsoClient {
|
|
|
8
8
|
constructor(apiKey: string, apiSecret: string, env: "production" | "sandbox");
|
|
9
9
|
createClabe(): Promise<string>;
|
|
10
10
|
createReceivingAccount(user: User, bankAccount: BankAccount, bitsoBankAccountCode: string): Promise<string>;
|
|
11
|
+
createWithdraw(bitsoReceivingAccountId: string, amount: number, concept: string, rfc?: string): Promise<string>;
|
|
11
12
|
signRequest(requestConfig: AxiosRequestConfig): AxiosRequestConfig;
|
|
12
13
|
}
|
|
13
14
|
export declare const buildBistoClient: () => Promise<BitsoClient>;
|
|
@@ -17,6 +17,7 @@ const secret_manager_client_1 = require("./secret-manager-client");
|
|
|
17
17
|
const axios_1 = __importDefault(require("axios"));
|
|
18
18
|
const common_1 = require("@riocrypto/common");
|
|
19
19
|
const crypto_js_1 = __importDefault(require("crypto-js"));
|
|
20
|
+
const uuid_1 = require("uuid");
|
|
20
21
|
class BitsoClient {
|
|
21
22
|
constructor(apiKey, apiSecret, env) {
|
|
22
23
|
this.apiKey = apiKey;
|
|
@@ -75,6 +76,32 @@ class BitsoClient {
|
|
|
75
76
|
return data.payload;
|
|
76
77
|
});
|
|
77
78
|
}
|
|
79
|
+
createWithdraw(bitsoReceivingAccountId, amount, concept, rfc) {
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const requestConfig = {
|
|
82
|
+
method: "POST",
|
|
83
|
+
url: `${this.baseUrl}/api/v3/withdrawals`,
|
|
84
|
+
headers: {
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
},
|
|
87
|
+
data: {
|
|
88
|
+
amount: amount.toFixed(2),
|
|
89
|
+
max_fee: "0.00000000",
|
|
90
|
+
contact_id: bitsoReceivingAccountId,
|
|
91
|
+
numeric_ref: "",
|
|
92
|
+
notes_ref: concept,
|
|
93
|
+
rfc: rfc || "XAXX010101000",
|
|
94
|
+
origin_id: (0, uuid_1.v4)(),
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
const signedRequestConfig = this.signRequest(requestConfig);
|
|
98
|
+
const { data } = yield (0, axios_1.default)(signedRequestConfig);
|
|
99
|
+
if (!data.success) {
|
|
100
|
+
throw new Error("Error creating Bitso withdraw");
|
|
101
|
+
}
|
|
102
|
+
return data.payload;
|
|
103
|
+
});
|
|
104
|
+
}
|
|
78
105
|
signRequest(requestConfig) {
|
|
79
106
|
var _a;
|
|
80
107
|
const url = new URL(requestConfig.url || "");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riocrypto/common-server",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1090",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./build/index.js",
|
|
6
6
|
"types": "./build/index.d.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@aws-sdk/client-s3": "^3.297.0",
|
|
26
26
|
"@everapi/currencyapi-js": "^1.0.6",
|
|
27
27
|
"@google-cloud/storage": "^6.9.5",
|
|
28
|
-
"@riocrypto/common": "^1.0.
|
|
28
|
+
"@riocrypto/common": "^1.0.929",
|
|
29
29
|
"@types/express": "^4.17.13",
|
|
30
30
|
"axios": "^0.27.2",
|
|
31
31
|
"ccxt": "^3.0.30",
|