Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6164d7f

Browse files
committedMar 14, 2025··
refactor(blockapis): replace bluebird with native promises
Ticket: DX-1126 TICKET: DX-1126
1 parent d6a052f commit 6164d7f

File tree

3 files changed

+646
-618
lines changed

3 files changed

+646
-618
lines changed
 

‎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": {

‎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+
for (const [index, value] of arr.entries()) {
34+
results.push(await f(value, index));
35+
}
36+
return results;
37+
})();
3338
}
3439

3540
export class BaseHttpClient implements HttpClient {

‎yarn.lock

+639-615
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.