@riocrypto/common-server 1.0.1088 → 1.0.1089

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>;
@@ -75,6 +75,32 @@ class BitsoClient {
75
75
  return data.payload;
76
76
  });
77
77
  }
78
+ createWithdraw(bitsoReceivingAccountId, amount, concept, rfc) {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const requestConfig = {
81
+ method: "POST",
82
+ url: `${this.baseUrl}/api/v3/withdrawals`,
83
+ headers: {
84
+ "Content-Type": "application/json",
85
+ },
86
+ data: {
87
+ amount: amount.toFixed(2),
88
+ max_fee: "0.00000000",
89
+ contact_id: bitsoReceivingAccountId,
90
+ numeric_ref: "",
91
+ notes_ref: concept,
92
+ rfc: rfc || "XAXX010101000",
93
+ origin_id: "bitso_7d37598b9605",
94
+ },
95
+ };
96
+ const signedRequestConfig = this.signRequest(requestConfig);
97
+ const { data } = yield (0, axios_1.default)(signedRequestConfig);
98
+ if (!data.success) {
99
+ throw new Error("Error creating Bitso withdraw");
100
+ }
101
+ return data.payload;
102
+ });
103
+ }
78
104
  signRequest(requestConfig) {
79
105
  var _a;
80
106
  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.1088",
3
+ "version": "1.0.1089",
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.926",
28
+ "@riocrypto/common": "^1.0.927",
29
29
  "@types/express": "^4.17.13",
30
30
  "axios": "^0.27.2",
31
31
  "ccxt": "^3.0.30",