Skip to content

Commit 25b0f53

Browse files
author
Kevin Daniel
committed
refactor(blockapis): replace bluebird with native promises
Ticket: DX-1126 TICKET: DX-1126
1 parent e09da7c commit 25b0f53

File tree

3 files changed

+39
-34
lines changed

3 files changed

+39
-34
lines changed

modules/blockapis/package.json

Lines changed: 0 additions & 1 deletion
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

Lines changed: 7 additions & 3 deletions
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) {
@@ -28,8 +27,13 @@ export interface HttpClient {
2827
get<T>(path: string): Promise<Response<T>>;
2928
}
3029

31-
export function mapSeries<T, U>(arr: T[], f: (v: T, i: number) => Promise<U>): Promise<U[]> {
32-
return Bluebird.mapSeries(arr, f);
30+
export async function mapSeries<T, U>(arr: T[], f: (v: T, i: number) => Promise<U>): Promise<U[]> {
31+
const results: U[] = [];
32+
33+
for (const [index, value] of arr.entries()) {
34+
results.push(await f(value, index));
35+
}
36+
return results;
3337
}
3438

3539
export class BaseHttpClient implements HttpClient {

yarn.lock

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -893,9 +893,9 @@
893893
integrity sha512-00RbByQG85lSzrkDjCblzrUc2n1LJAPPrEMHS4oMg+QckE0kzjd26JytT6yx6tNU2+aOXfK7O4kGW/sKVL67cw==
894894

895895
"@bufbuild/protobuf@^2.2.0":
896-
version "2.2.3"
897-
resolved "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.2.3.tgz#9cd136f6b687e63e9b517b3a54211ece942897ee"
898-
integrity sha512-tFQoXHJdkEOSwj5tRIZSPNUuXK3RaR7T1nUrPgbYX1pUbvqqaaZAsfo+NXBPsz5rZMSKVFrgK1WL8Q/MSLvprg==
896+
version "2.2.4"
897+
resolved "https://registry.npmjs.org/@bufbuild/protobuf/-/protobuf-2.2.4.tgz#4f43b3e775ce0bf7a9a84b547f017105db3c184d"
898+
integrity sha512-P9xQgtMh71TA7tHTnbDe68zcI+TPnkyyfBIhGaUr4iUEIXN7yI01DyjmmdEwXTk5OlISBJYkoxCVj2dwmHqIkA==
899899

900900
"@cbor-extract/[email protected]":
901901
version "2.2.0"
@@ -6603,16 +6603,17 @@ array-uniq@^1.0.1:
66036603
integrity sha512-MNha4BWQ6JbwhFhj03YK552f7cb3AzoE8SzeljgChvL1dl3IcvggXVz1DilzySZkCja+CXuZbdW7yATchWn8/Q==
66046604

66056605
array.prototype.findlastindex@^1.2.5:
6606-
version "1.2.5"
6607-
resolved "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz#8c35a755c72908719453f87145ca011e39334d0d"
6608-
integrity sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==
6606+
version "1.2.6"
6607+
resolved "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.6.tgz#cfa1065c81dcb64e34557c9b81d012f6a421c564"
6608+
integrity sha512-F/TKATkzseUExPlfvmwQKGITM3DGTK+vkAsCZoDc5daVygbJBnjEUCbgkAvVFsgfXfX4YIqZ/27G3k3tdXrTxQ==
66096609
dependencies:
6610-
call-bind "^1.0.7"
6610+
call-bind "^1.0.8"
6611+
call-bound "^1.0.4"
66116612
define-properties "^1.2.1"
6612-
es-abstract "^1.23.2"
6613+
es-abstract "^1.23.9"
66136614
es-errors "^1.3.0"
6614-
es-object-atoms "^1.0.0"
6615-
es-shim-unscopables "^1.0.2"
6615+
es-object-atoms "^1.1.1"
6616+
es-shim-unscopables "^1.1.0"
66166617

66176618
array.prototype.flat@^1.3.2:
66186619
version "1.3.3"
@@ -6635,17 +6636,18 @@ array.prototype.flatmap@^1.3.2:
66356636
es-shim-unscopables "^1.0.2"
66366637

66376638
array.prototype.reduce@^1.0.6:
6638-
version "1.0.7"
6639-
resolved "https://registry.npmjs.org/array.prototype.reduce/-/array.prototype.reduce-1.0.7.tgz#6aadc2f995af29cb887eb866d981dc85ab6f7dc7"
6640-
integrity sha512-mzmiUCVwtiD4lgxYP8g7IYy8El8p2CSMePvIbTS7gchKir/L1fgJrk0yDKmAX6mnRQFKNADYIk8nNlTris5H1Q==
6639+
version "1.0.8"
6640+
resolved "https://registry.npmjs.org/array.prototype.reduce/-/array.prototype.reduce-1.0.8.tgz#42f97f5078daedca687d4463fd3c05cbfd83da57"
6641+
integrity sha512-DwuEqgXFBwbmZSRqt3BpQigWNUoqw9Ml2dTWdF3B2zQlQX4OeUE0zyuzX0fX0IbTvjdkZbcBTU3idgpO78qkTw==
66416642
dependencies:
6642-
call-bind "^1.0.7"
6643+
call-bind "^1.0.8"
6644+
call-bound "^1.0.4"
66436645
define-properties "^1.2.1"
6644-
es-abstract "^1.23.2"
6646+
es-abstract "^1.23.9"
66456647
es-array-method-boxes-properly "^1.0.0"
66466648
es-errors "^1.3.0"
6647-
es-object-atoms "^1.0.0"
6648-
is-string "^1.0.7"
6649+
es-object-atoms "^1.1.1"
6650+
is-string "^1.1.1"
66496651

66506652
arraybuffer.prototype.slice@^1.0.4:
66516653
version "1.0.4"
@@ -7857,9 +7859,9 @@ camelize@^1.0.0:
78577859
integrity sha512-dU+Tx2fsypxTgtLoE36npi3UqcjSSMNYfkqgmoEhtZrraP5VWq0K7FkWVTYa8eMPtnU/G2txVsfdCJTn9uzpuQ==
78587860

78597861
caniuse-lite@^1.0.30001688, caniuse-lite@^1.0.30001702:
7860-
version "1.0.30001704"
7861-
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001704.tgz#6644fe909d924ac3a7125e8a0ab6af95b1f32990"
7862-
integrity sha512-+L2IgBbV6gXB4ETf0keSvLr7JUrRVbIaB/lrQ1+z8mRcQiisG5k+lG6O4n6Y5q6f5EuNfaYXKgymucphlEXQew==
7862+
version "1.0.30001706"
7863+
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001706.tgz#902c3f896f4b2968031c3a546ab2ef8b465a2c8f"
7864+
integrity sha512-3ZczoTApMAZwPKYWmwVbQMFpXBDds3/0VciVoUwPUbldlYyVLmRVuRs/PcUZtHpbLRpzzDvrvnFuREsGt6lUug==
78637865

78647866
[email protected], canvg@^3.0.6:
78657867
version "4.0.3"
@@ -9775,9 +9777,9 @@ ejs@^3.1.7, ejs@^3.1.8:
97759777
jake "^10.8.5"
97769778

97779779
electron-to-chromium@^1.5.73:
9778-
version "1.5.118"
9779-
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.118.tgz#064bda9bfea1611074288adb1fdd1f787a131e21"
9780-
integrity sha512-yNDUus0iultYyVoEFLnQeei7LOQkL8wg8GQpkPCRrOlJXlcCwa6eGKZkxQ9ciHsqZyYbj8Jd94X1CTPzGm+uIA==
9780+
version "1.5.120"
9781+
resolved "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.120.tgz#ccfdd28e9795fb8c2221cefa2c9a071501c86247"
9782+
integrity sha512-oTUp3gfX1gZI+xfD2djr2rzQdHCwHzPQrrK0CD7WpTdF0nPdQ/INcRVjWgLdCT4a9W3jFObR9DAfsuyFQnI8CQ==
97819783

97829784
[email protected], [email protected], elliptic@^6.4.0, elliptic@^6.4.1, elliptic@^6.5.2, elliptic@^6.5.3, elliptic@^6.5.4, elliptic@^6.5.5, elliptic@^6.5.7, elliptic@^6.6.1:
97839785
version "6.6.1"
@@ -10069,7 +10071,7 @@ es-set-tostringtag@^2.1.0:
1006910071
has-tostringtag "^1.0.2"
1007010072
hasown "^2.0.2"
1007110073

10072-
es-shim-unscopables@^1.0.2:
10074+
es-shim-unscopables@^1.0.2, es-shim-unscopables@^1.1.0:
1007310075
version "1.1.0"
1007410076
resolved "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.1.0.tgz#438df35520dac5d105f3943d927549ea3b00f4b5"
1007510077
integrity sha512-d9T8ucsEhh8Bi1woXCf+TIKDIROLG5WCkxg8geBCbvk22kzwC5G2OnXVMO6FUsvQlgUUXQ2itephWDLqDzbeCw==
@@ -14915,9 +14917,9 @@ [email protected]:
1491514917
integrity sha512-n6Vs/3KGyxPQd6uO0eH4Bv0ojGSUvuLlIHtC3Y0kEO23YRge8H9x1GCzLn28YX0H66pMkxuaeESFq4tKISKwdw==
1491614918

1491714919
nanoid@^3.3.8:
14918-
version "3.3.9"
14919-
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.9.tgz#e0097d8e026b3343ff053e9ccd407360a03f503a"
14920-
integrity sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==
14920+
version "3.3.10"
14921+
resolved "https://registry.npmjs.org/nanoid/-/nanoid-3.3.10.tgz#7bc882237698ef787d5cbba109e3b0168ba6e7b1"
14922+
integrity sha512-vSJJTG+t/dIKAUhUDw/dLdZ9s//5OxcHqLaDWWrW4Cdq7o6tdLIczUkMXt2MBNmk6sJRZBZRXVixs7URY1CmIg==
1492114923

1492214924
natural-compare@^1.4.0:
1492314925
version "1.4.0"
@@ -17813,9 +17815,9 @@ sass-loader@^11.0.1:
1781317815
neo-async "^2.6.2"
1781417816

1781517817
sass@^1.32.12:
17816-
version "1.85.1"
17817-
resolved "https://registry.npmjs.org/sass/-/sass-1.85.1.tgz#18ab0bb48110ae99163778f06445b406148ca0d5"
17818-
integrity sha512-Uk8WpxM5v+0cMR0XjX9KfRIacmSG86RH4DCCZjLU2rFh5tyutt9siAXJ7G+YfxQ99Q6wrRMbMlVl6KqUms71ag==
17818+
version "1.86.0"
17819+
resolved "https://registry.npmjs.org/sass/-/sass-1.86.0.tgz#f49464fb6237a903a93f4e8760ef6e37a5030114"
17820+
integrity sha512-zV8vGUld/+mP4KbMLJMX7TyGCuUp7hnkOScgCMsWuHtns8CWBoz+vmEhoGMXsaJrbUP8gj+F1dLvVe79sK8UdA==
1781917821
dependencies:
1782017822
chokidar "^4.0.0"
1782117823
immutable "^5.0.2"

0 commit comments

Comments
 (0)