Skip to content

Commit dfe52f3

Browse files
committed
refactor(blockapis): replace bluebird with native promises
Ticket: DX-1126 TICKET: DX-1126
1 parent 80ed436 commit dfe52f3

File tree

3 files changed

+606
-614
lines changed

3 files changed

+606
-614
lines changed

Diff for: modules/blockapis/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
"dependencies": {
2525
"@bitgo/utxo-lib": "^11.2.4",
2626
"@types/superagent": "4.1.16",
27-
"bluebird": "^3.7.2",
2827
"superagent": "^9.0.1"
2928
},
3029
"lint-staged": {

Diff for: modules/blockapis/src/BaseHttpClient.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as superagent from 'superagent';
2-
import * as Bluebird from 'bluebird';
32

43
export class ApiRequestError extends Error {
54
constructor(public url: string, public reason: Error | string) {
@@ -29,7 +28,13 @@ export interface HttpClient {
2928
}
3029

3130
export function mapSeries<T, U>(arr: T[], f: (v: T, i: number) => Promise<U>): Promise<U[]> {
32-
return Bluebird.mapSeries(arr, f);
31+
const results: U[] = [];
32+
return (async () => {
33+
arr.map(async (v, i) => {
34+
results.push(await f(v, i));
35+
});
36+
return results;
37+
})();
3338
}
3439

3540
export class BaseHttpClient implements HttpClient {

0 commit comments

Comments
 (0)