@riocrypto/common-server 1.0.1144 → 1.0.1146
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.
|
@@ -56,6 +56,7 @@ declare class BitsoClient {
|
|
|
56
56
|
updated_at: string;
|
|
57
57
|
sequence: string;
|
|
58
58
|
}>;
|
|
59
|
+
getMakerFee(crypto: Crypto): Promise<number>;
|
|
59
60
|
signRequest(requestConfig: AxiosRequestConfig): AxiosRequestConfig;
|
|
60
61
|
}
|
|
61
62
|
export declare const buildBistoClient: () => Promise<BitsoClient>;
|
|
@@ -196,6 +196,30 @@ class BitsoClient {
|
|
|
196
196
|
return data.payload;
|
|
197
197
|
});
|
|
198
198
|
}
|
|
199
|
+
getMakerFee(crypto) {
|
|
200
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
201
|
+
const requestConfig = {
|
|
202
|
+
method: "GET",
|
|
203
|
+
url: `${this.baseUrl}/api/v3/fees`,
|
|
204
|
+
headers: {
|
|
205
|
+
"Content-Type": "application/json",
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
const signedRequestConfig = this.signRequest(requestConfig);
|
|
209
|
+
const res = yield (0, axios_1.default)(signedRequestConfig);
|
|
210
|
+
console.log("res is", res);
|
|
211
|
+
const data = res.data;
|
|
212
|
+
if (!data.success) {
|
|
213
|
+
throw new Error("Error getting Bitso fees");
|
|
214
|
+
}
|
|
215
|
+
const fees = data.payload.fees;
|
|
216
|
+
const book = fees.find((obj) => obj.book === `${crypto.toLocaleLowerCase()}_mxn`);
|
|
217
|
+
if (!book) {
|
|
218
|
+
throw new Error("Unable to get fees");
|
|
219
|
+
}
|
|
220
|
+
return Number(book.maker_fee_decimal || 0);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
199
223
|
signRequest(requestConfig) {
|
|
200
224
|
var _a;
|
|
201
225
|
const url = new URL(requestConfig.url || "");
|