From cef381b6b31e2444e36872661e9e059300055c15 Mon Sep 17 00:00:00 2001 From: dynst <148708712+dynst@users.noreply.github.com> Date: Sun, 4 May 2025 00:00:00 +0000 Subject: [PATCH 1/3] replace axios with cross-fetch --- .pnp.cjs | 173 +++++++++--------- ...ynckit-npm-0.4.0-c718858525-d73e2ddf20.zip | 3 - .../axios-npm-1.6.2-2334cb6eee-9b77e030e8.zip | 3 - ...stream-npm-1.0.8-dc14d4a63a-0dbb829577.zip | 3 - ...-fetch-npm-4.1.0-6116134545-628b134ea2.zip | 3 + ...stream-npm-1.0.0-c5a4c4cc02-d758899da0.zip | 3 - ...m-data-npm-4.0.0-916facec2d-cb6f3ac491.zip | 3 - ...-fetch-npm-2.7.0-587d57004e-b55786b602.zip | 3 + ...om-env-npm-1.1.0-c13d07f26b-fe7dd8b1bd.zip | 3 - .../tr46-npm-0.0.3-de53018915-047cb209a6.zip | 3 + ...rsions-npm-3.0.1-60310f6a2b-5612d5f3e5.zip | 3 + ...wg-url-npm-5.0.0-374fb45e60-1588bed84d.zip | 3 + packages/cli/package.json | 2 +- packages/cli/src/cli.ts | 10 +- packages/faucet-client/package.json | 2 +- packages/faucet-client/src/faucetclient.ts | 4 +- packages/tendermint-rpc/package.json | 2 +- .../tendermint-rpc/src/rpcclients/http.ts | 29 +-- yarn.lock | 109 ++++++----- 19 files changed, 165 insertions(+), 199 deletions(-) delete mode 100644 .yarn/cache/asynckit-npm-0.4.0-c718858525-d73e2ddf20.zip delete mode 100644 .yarn/cache/axios-npm-1.6.2-2334cb6eee-9b77e030e8.zip delete mode 100644 .yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-0dbb829577.zip create mode 100644 .yarn/cache/cross-fetch-npm-4.1.0-6116134545-628b134ea2.zip delete mode 100644 .yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-d758899da0.zip delete mode 100644 .yarn/cache/form-data-npm-4.0.0-916facec2d-cb6f3ac491.zip create mode 100644 .yarn/cache/node-fetch-npm-2.7.0-587d57004e-b55786b602.zip delete mode 100644 .yarn/cache/proxy-from-env-npm-1.1.0-c13d07f26b-fe7dd8b1bd.zip create mode 100644 .yarn/cache/tr46-npm-0.0.3-de53018915-047cb209a6.zip create mode 100644 .yarn/cache/webidl-conversions-npm-3.0.1-60310f6a2b-5612d5f3e5.zip create mode 100644 .yarn/cache/whatwg-url-npm-5.0.0-374fb45e60-1588bed84d.zip diff --git a/.pnp.cjs b/.pnp.cjs index 9c0f8076..16fbcf8b 100644 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -833,14 +833,6 @@ const RAW_RUNTIME_STATE = "astral-regex",\ "npm:2.0.0"\ ],\ - [\ - "asynckit",\ - "npm:0.4.0"\ - ],\ - [\ - "axios",\ - "npm:1.6.2"\ - ],\ [\ "babylon",\ "npm:6.18.0"\ @@ -997,10 +989,6 @@ const RAW_RUNTIME_STATE = "colors",\ "npm:1.4.0"\ ],\ - [\ - "combined-stream",\ - "npm:1.0.8"\ - ],\ [\ "commander",\ "npm:2.20.3"\ @@ -1061,6 +1049,10 @@ const RAW_RUNTIME_STATE = "cosmjs-types",\ "npm:0.9.0"\ ],\ + [\ + "cross-fetch",\ + "npm:4.1.0"\ + ],\ [\ "cross-spawn",\ "npm:7.0.3"\ @@ -1105,10 +1097,6 @@ const RAW_RUNTIME_STATE = "define-properties",\ "npm:1.1.3"\ ],\ - [\ - "delayed-stream",\ - "npm:1.0.0"\ - ],\ [\ "delegates",\ "npm:1.0.0"\ @@ -1401,10 +1389,6 @@ const RAW_RUNTIME_STATE = "foreground-child",\ "npm:2.0.0"\ ],\ - [\ - "form-data",\ - "npm:4.0.0"\ - ],\ [\ "fresh",\ "npm:0.5.2"\ @@ -2073,6 +2057,10 @@ const RAW_RUNTIME_STATE = "node-addon-api",\ "npm:3.2.0"\ ],\ + [\ + "node-fetch",\ + "virtual:611613454578e2dd4bcee686f4d881fe5e138f6c540465d10e9f5a4dd350869bcb413fdfda81b5fcedf3990538dcbd302e372e25db17ec42816b0ce234944e88#npm:2.7.0"\ + ],\ [\ "node-gyp",\ "npm:9.4.0"\ @@ -2285,10 +2273,6 @@ const RAW_RUNTIME_STATE = "protobufjs",\ "npm:7.4.0"\ ],\ - [\ - "proxy-from-env",\ - "npm:1.1.0"\ - ],\ [\ "pump",\ "npm:3.0.0"\ @@ -2671,6 +2655,10 @@ const RAW_RUNTIME_STATE = "toidentifier",\ "npm:1.0.0"\ ],\ + [\ + "tr46",\ + "npm:0.0.3"\ + ],\ [\ "ts-node",\ "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.10.2"\ @@ -2799,6 +2787,10 @@ const RAW_RUNTIME_STATE = "watchpack",\ "npm:2.4.0"\ ],\ + [\ + "webidl-conversions",\ + "npm:3.0.1"\ + ],\ [\ "webpack",\ "virtual:14e834828d065c83a62d939f78f867dca06a99ef32e4048b15b8f9e3433169eca01f5c29b8d8692cae8f8109cda402ac498149ee584b3d3b9e10e5ef4428aaa9#npm:5.76.1"\ @@ -2815,6 +2807,10 @@ const RAW_RUNTIME_STATE = "webpack-sources",\ "npm:3.2.3"\ ],\ + [\ + "whatwg-url",\ + "npm:5.0.0"\ + ],\ [\ "which",\ "npm:2.0.2"\ @@ -3296,10 +3292,10 @@ const RAW_RUNTIME_STATE = ["@types/yargs", "npm:15.0.13"],\ ["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ - ["axios", "npm:1.6.2"],\ ["babylon", "npm:6.18.0"],\ ["chalk", "npm:4.1.2"],\ ["cosmjs-types", "npm:0.9.0"],\ + ["cross-fetch", "npm:4.1.0"],\ ["diff", "npm:4.0.2"],\ ["eslint", "npm:7.26.0"],\ ["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],\ @@ -3532,7 +3528,7 @@ const RAW_RUNTIME_STATE = ["@types/node", "npm:22.10.6"],\ ["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ - ["axios", "npm:1.6.2"],\ + ["cross-fetch", "npm:4.1.0"],\ ["eslint", "npm:7.26.0"],\ ["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],\ ["eslint-import-resolver-node", "npm:0.3.4"],\ @@ -3909,7 +3905,7 @@ const RAW_RUNTIME_STATE = ["@types/node", "npm:22.10.6"],\ ["@typescript-eslint/eslint-plugin", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ ["@typescript-eslint/parser", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:5.54.0"],\ - ["axios", "npm:1.6.2"],\ + ["cross-fetch", "npm:4.1.0"],\ ["eslint", "npm:7.26.0"],\ ["eslint-config-prettier", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.3.0"],\ ["eslint-import-resolver-node", "npm:0.3.4"],\ @@ -6473,27 +6469,6 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["asynckit", [\ - ["npm:0.4.0", {\ - "packageLocation": "./.yarn/cache/asynckit-npm-0.4.0-c718858525-d73e2ddf20.zip/node_modules/asynckit/",\ - "packageDependencies": [\ - ["asynckit", "npm:0.4.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ - ["axios", [\ - ["npm:1.6.2", {\ - "packageLocation": "./.yarn/cache/axios-npm-1.6.2-2334cb6eee-9b77e030e8.zip/node_modules/axios/",\ - "packageDependencies": [\ - ["axios", "npm:1.6.2"],\ - ["follow-redirects", "virtual:a313c479c5c7e54d9ec8fbeeea69ff640f56b8989ea2dff42351a3fa5c4061fb80a52d8ede0f0826a181a216820c2d2c3f15da881e7fdf31cef1c446e42f0c45#npm:1.15.3"],\ - ["form-data", "npm:4.0.0"],\ - ["proxy-from-env", "npm:1.1.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["babylon", [\ ["npm:6.18.0", {\ "packageLocation": "./.yarn/cache/babylon-npm-6.18.0-2c6a1b9c30-9b1bf946e1.zip/node_modules/babylon/",\ @@ -7003,16 +6978,6 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["combined-stream", [\ - ["npm:1.0.8", {\ - "packageLocation": "./.yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-0dbb829577.zip/node_modules/combined-stream/",\ - "packageDependencies": [\ - ["combined-stream", "npm:1.0.8"],\ - ["delayed-stream", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["commander", [\ ["npm:2.20.3", {\ "packageLocation": "./.yarn/cache/commander-npm-2.20.3-d8dcbaa39b-74c781a524.zip/node_modules/commander/",\ @@ -7192,6 +7157,16 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["cross-fetch", [\ + ["npm:4.1.0", {\ + "packageLocation": "./.yarn/cache/cross-fetch-npm-4.1.0-6116134545-628b134ea2.zip/node_modules/cross-fetch/",\ + "packageDependencies": [\ + ["cross-fetch", "npm:4.1.0"],\ + ["node-fetch", "virtual:611613454578e2dd4bcee686f4d881fe5e138f6c540465d10e9f5a4dd350869bcb413fdfda81b5fcedf3990538dcbd302e372e25db17ec42816b0ce234944e88#npm:2.7.0"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["cross-spawn", [\ ["npm:7.0.3", {\ "packageLocation": "./.yarn/cache/cross-spawn-npm-7.0.3-e4ff3e65b3-5738c31238.zip/node_modules/cross-spawn/",\ @@ -7374,15 +7349,6 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["delayed-stream", [\ - ["npm:1.0.0", {\ - "packageLocation": "./.yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-d758899da0.zip/node_modules/delayed-stream/",\ - "packageDependencies": [\ - ["delayed-stream", "npm:1.0.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["delegates", [\ ["npm:1.0.0", {\ "packageLocation": "./.yarn/cache/delegates-npm-1.0.0-9b1942d75f-ba05874b91.zip/node_modules/delegates/",\ @@ -8384,18 +8350,6 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["form-data", [\ - ["npm:4.0.0", {\ - "packageLocation": "./.yarn/cache/form-data-npm-4.0.0-916facec2d-cb6f3ac491.zip/node_modules/form-data/",\ - "packageDependencies": [\ - ["form-data", "npm:4.0.0"],\ - ["asynckit", "npm:0.4.0"],\ - ["combined-stream", "npm:1.0.8"],\ - ["mime-types", "npm:2.1.35"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["fresh", [\ ["npm:0.5.2", {\ "packageLocation": "./.yarn/cache/fresh-npm-0.5.2-ad2bb4c0a2-c6d27f3ed8.zip/node_modules/fresh/",\ @@ -10390,6 +10344,29 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["node-fetch", [\ + ["npm:2.7.0", {\ + "packageLocation": "./.yarn/cache/node-fetch-npm-2.7.0-587d57004e-b55786b602.zip/node_modules/node-fetch/",\ + "packageDependencies": [\ + ["node-fetch", "npm:2.7.0"]\ + ],\ + "linkType": "SOFT"\ + }],\ + ["virtual:611613454578e2dd4bcee686f4d881fe5e138f6c540465d10e9f5a4dd350869bcb413fdfda81b5fcedf3990538dcbd302e372e25db17ec42816b0ce234944e88#npm:2.7.0", {\ + "packageLocation": "./.yarn/__virtual__/node-fetch-virtual-8efb717437/0/cache/node-fetch-npm-2.7.0-587d57004e-b55786b602.zip/node_modules/node-fetch/",\ + "packageDependencies": [\ + ["node-fetch", "virtual:611613454578e2dd4bcee686f4d881fe5e138f6c540465d10e9f5a4dd350869bcb413fdfda81b5fcedf3990538dcbd302e372e25db17ec42816b0ce234944e88#npm:2.7.0"],\ + ["@types/encoding", null],\ + ["encoding", null],\ + ["whatwg-url", "npm:5.0.0"]\ + ],\ + "packagePeers": [\ + "@types/encoding",\ + "encoding"\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["node-gyp", [\ ["npm:9.4.0", {\ "packageLocation": "./.yarn/unplugged/node-gyp-npm-9.4.0-ebf5f5573e/node_modules/node-gyp/",\ @@ -11070,15 +11047,6 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["proxy-from-env", [\ - ["npm:1.1.0", {\ - "packageLocation": "./.yarn/cache/proxy-from-env-npm-1.1.0-c13d07f26b-fe7dd8b1bd.zip/node_modules/proxy-from-env/",\ - "packageDependencies": [\ - ["proxy-from-env", "npm:1.1.0"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["pump", [\ ["npm:3.0.0", {\ "packageLocation": "./.yarn/cache/pump-npm-3.0.0-0080bf6a7a-bbdeda4f74.zip/node_modules/pump/",\ @@ -12691,6 +12659,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["tr46", [\ + ["npm:0.0.3", {\ + "packageLocation": "./.yarn/cache/tr46-npm-0.0.3-de53018915-047cb209a6.zip/node_modules/tr46/",\ + "packageDependencies": [\ + ["tr46", "npm:0.0.3"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["ts-node", [\ ["npm:8.10.2", {\ "packageLocation": "./.yarn/cache/ts-node-npm-8.10.2-b4fe5a56b0-628343f62f.zip/node_modules/ts-node/",\ @@ -13094,6 +13071,15 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["webidl-conversions", [\ + ["npm:3.0.1", {\ + "packageLocation": "./.yarn/cache/webidl-conversions-npm-3.0.1-60310f6a2b-5612d5f3e5.zip/node_modules/webidl-conversions/",\ + "packageDependencies": [\ + ["webidl-conversions", "npm:3.0.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["webpack", [\ ["npm:5.76.1", {\ "packageLocation": "./.yarn/cache/webpack-npm-5.76.1-9aeb64c072-9cfc3f5a42.zip/node_modules/webpack/",\ @@ -14317,6 +14303,17 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ + ["whatwg-url", [\ + ["npm:5.0.0", {\ + "packageLocation": "./.yarn/cache/whatwg-url-npm-5.0.0-374fb45e60-1588bed84d.zip/node_modules/whatwg-url/",\ + "packageDependencies": [\ + ["whatwg-url", "npm:5.0.0"],\ + ["tr46", "npm:0.0.3"],\ + ["webidl-conversions", "npm:3.0.1"]\ + ],\ + "linkType": "HARD"\ + }]\ + ]],\ ["which", [\ ["npm:1.3.1", {\ "packageLocation": "./.yarn/cache/which-npm-1.3.1-f0ebb8bdd8-e945a8b6bb.zip/node_modules/which/",\ diff --git a/.yarn/cache/asynckit-npm-0.4.0-c718858525-d73e2ddf20.zip b/.yarn/cache/asynckit-npm-0.4.0-c718858525-d73e2ddf20.zip deleted file mode 100644 index e278fcfd..00000000 --- a/.yarn/cache/asynckit-npm-0.4.0-c718858525-d73e2ddf20.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:dfff24c24e7345bb4d59b01bc5e452e9e33d94d8e26f0e7794cca7239003e405 -size 30702 diff --git a/.yarn/cache/axios-npm-1.6.2-2334cb6eee-9b77e030e8.zip b/.yarn/cache/axios-npm-1.6.2-2334cb6eee-9b77e030e8.zip deleted file mode 100644 index 5d3d5b11..00000000 --- a/.yarn/cache/axios-npm-1.6.2-2334cb6eee-9b77e030e8.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2b8c7423c8c5c1a2570e6cc63cbf5e1c38a34cbb87b1b148b6da9351536f28e7 -size 1813514 diff --git a/.yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-0dbb829577.zip b/.yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-0dbb829577.zip deleted file mode 100644 index 4be49d02..00000000 --- a/.yarn/cache/combined-stream-npm-1.0.8-dc14d4a63a-0dbb829577.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:489bfcfb5b5a4d0f1354240e44a16cdb2350a244aff699086588e00d7761324f -size 12702 diff --git a/.yarn/cache/cross-fetch-npm-4.1.0-6116134545-628b134ea2.zip b/.yarn/cache/cross-fetch-npm-4.1.0-6116134545-628b134ea2.zip new file mode 100644 index 00000000..14c73d10 --- /dev/null +++ b/.yarn/cache/cross-fetch-npm-4.1.0-6116134545-628b134ea2.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:469cc96e814ff88818cc327e7105c098e0b1df63fef6552e90af4be0b7bb933d +size 95918 diff --git a/.yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-d758899da0.zip b/.yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-d758899da0.zip deleted file mode 100644 index 3fc340f1..00000000 --- a/.yarn/cache/delayed-stream-npm-1.0.0-c5a4c4cc02-d758899da0.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1f9a94817294d8f386482773c50e5de4122a06fcb3b93299b3cc11266661f8a4 -size 9343 diff --git a/.yarn/cache/form-data-npm-4.0.0-916facec2d-cb6f3ac491.zip b/.yarn/cache/form-data-npm-4.0.0-916facec2d-cb6f3ac491.zip deleted file mode 100644 index 36716a80..00000000 --- a/.yarn/cache/form-data-npm-4.0.0-916facec2d-cb6f3ac491.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a02a8df5cd38d042e3e0b31485f734269434715358117d0f98da57a7a69c5de1 -size 44925 diff --git a/.yarn/cache/node-fetch-npm-2.7.0-587d57004e-b55786b602.zip b/.yarn/cache/node-fetch-npm-2.7.0-587d57004e-b55786b602.zip new file mode 100644 index 00000000..82f162b4 --- /dev/null +++ b/.yarn/cache/node-fetch-npm-2.7.0-587d57004e-b55786b602.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c0554a250e1195fbe7021976f0089664795d06a0a58199204a51e95761eac09a +size 163663 diff --git a/.yarn/cache/proxy-from-env-npm-1.1.0-c13d07f26b-fe7dd8b1bd.zip b/.yarn/cache/proxy-from-env-npm-1.1.0-c13d07f26b-fe7dd8b1bd.zip deleted file mode 100644 index 77647329..00000000 --- a/.yarn/cache/proxy-from-env-npm-1.1.0-c13d07f26b-fe7dd8b1bd.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a505bcbc7b90e9b8059461867067df2ac5c8037d22104384a0346f301b14803d -size 30758 diff --git a/.yarn/cache/tr46-npm-0.0.3-de53018915-047cb209a6.zip b/.yarn/cache/tr46-npm-0.0.3-de53018915-047cb209a6.zip new file mode 100644 index 00000000..6e242710 --- /dev/null +++ b/.yarn/cache/tr46-npm-0.0.3-de53018915-047cb209a6.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c1efa434478f59460d8d07a3a9f143b4b9e7a67a50d7e982f03c3d23c0943d4d +size 269430 diff --git a/.yarn/cache/webidl-conversions-npm-3.0.1-60310f6a2b-5612d5f3e5.zip b/.yarn/cache/webidl-conversions-npm-3.0.1-60310f6a2b-5612d5f3e5.zip new file mode 100644 index 00000000..19d757c8 --- /dev/null +++ b/.yarn/cache/webidl-conversions-npm-3.0.1-60310f6a2b-5612d5f3e5.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2275456231d0a5adf2cfe93046914c9b520612c01ceaead3cfc3a82c1b2580ae +size 13428 diff --git a/.yarn/cache/whatwg-url-npm-5.0.0-374fb45e60-1588bed84d.zip b/.yarn/cache/whatwg-url-npm-5.0.0-374fb45e60-1588bed84d.zip new file mode 100644 index 00000000..bf9070c8 --- /dev/null +++ b/.yarn/cache/whatwg-url-npm-5.0.0-374fb45e60-1588bed84d.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:955bc83677d05459d708ef80685378882cc17fbcb098d1890532a08941b572ca +size 51478 diff --git a/packages/cli/package.json b/packages/cli/package.json index beba6f88..76a47f2a 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -51,10 +51,10 @@ "@cosmjs/stargate": "workspace:^", "@cosmjs/tendermint-rpc": "workspace:^", "@cosmjs/utils": "workspace:^", - "axios": "^1.6.0", "babylon": "^6.18.0", "chalk": "^4", "cosmjs-types": "^0.9.0", + "cross-fetch": "^4.1.0", "diff": "^4", "recast": "^0.20", "ts-node": "^8", diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index 0dcd9e5a..3bafa576 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -1,5 +1,5 @@ -import axios from "axios"; import chalk from "chalk"; +import fetch from "cross-fetch"; import * as fs from "fs"; import { join } from "path"; import yargs from "yargs"; @@ -50,7 +50,7 @@ export async function main(originalArgs: readonly string[]): Promise { console.info(chalk.green("Initializing session for you. Have fun!")); const visiblePackages = (await installedPackages()).filter( - (name) => name.startsWith("@cosmjs/") || name === "axios", + (name) => name.startsWith("@cosmjs/") || name === "cross-fetch", ); console.info(chalk.yellow("The following packages have been installed and can be imported:")); console.info(chalk.yellow(visiblePackages.join(", "))); @@ -59,7 +59,7 @@ export async function main(originalArgs: readonly string[]): Promise { if (args.selftest) { // execute some trival stuff and exit init += ` - import axios from "axios"; + import fetch from "cross-fetch"; import * as fs from "fs"; import { @@ -135,8 +135,8 @@ export async function main(originalArgs: readonly string[]): Promise { for (const source of args.init.map((arg) => arg.toString())) { if (args.debug) console.info(`Adding code from: '${source}' ...`); if (source.startsWith("https://")) { - const response = await axios.get(source); - init += response.data + "\n"; + const response = await fetch(source).then((r) => r.json()); + init += response + "\n"; } else { init += fs.readFileSync(source, "utf8") + "\n"; } diff --git a/packages/faucet-client/package.json b/packages/faucet-client/package.json index 0658e2f9..edf09c32 100644 --- a/packages/faucet-client/package.json +++ b/packages/faucet-client/package.json @@ -40,7 +40,7 @@ "pack-web": "yarn build-or-skip && webpack --mode development --config webpack.web.config.js" }, "dependencies": { - "axios": "^1.6.0" + "cross-fetch": "^4.1.0" }, "devDependencies": { "@istanbuljs/nyc-config-typescript": "^1.0.1", diff --git a/packages/faucet-client/src/faucetclient.ts b/packages/faucet-client/src/faucetclient.ts index 5fc2209b..9d3de0f9 100644 --- a/packages/faucet-client/src/faucetclient.ts +++ b/packages/faucet-client/src/faucetclient.ts @@ -1,4 +1,4 @@ -import axios from "axios"; +import fetch from "cross-fetch"; export class FaucetClient { private readonly baseUrl: string; @@ -20,7 +20,7 @@ export class FaucetClient { }; try { - await axios.post(this.baseUrl + "/credit", body); + await fetch(this.baseUrl + "/credit", { method: "POST", body: JSON.stringify(body) }); } catch (error: any) { if (error.response) { // append response body to error message diff --git a/packages/tendermint-rpc/package.json b/packages/tendermint-rpc/package.json index c727a779..5341ff5c 100644 --- a/packages/tendermint-rpc/package.json +++ b/packages/tendermint-rpc/package.json @@ -49,7 +49,7 @@ "@cosmjs/socket": "workspace:^", "@cosmjs/stream": "workspace:^", "@cosmjs/utils": "workspace:^", - "axios": "^1.6.0", + "cross-fetch": "^4.1.0", "readonly-date": "^1.0.0", "xstream": "^11.14.0" }, diff --git a/packages/tendermint-rpc/src/rpcclients/http.ts b/packages/tendermint-rpc/src/rpcclients/http.ts index 1d389504..f5a65c81 100644 --- a/packages/tendermint-rpc/src/rpcclients/http.ts +++ b/packages/tendermint-rpc/src/rpcclients/http.ts @@ -1,8 +1,4 @@ -import axios from "axios"; - -// Global symbols in some environments -// https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/fetch -declare const fetch: any | undefined; +import fetch from "cross-fetch"; function filterBadStatus(res: any): any { if (res.status >= 400) { @@ -11,23 +7,6 @@ function filterBadStatus(res: any): any { return res; } -/** - * Node.js 18 comes with exprimental fetch support (https://nodejs.org/de/blog/announcements/v18-release-announce/). - * This is nice, but the implementation does not yet work wekk for us. We - * can just stick with axios on those systems for now. - */ -// eslint-disable-next-line @typescript-eslint/ban-types -function isExperimental(nodeJsFunc: Function): boolean { - // This works because we get this info in node 18: - // - // > fetch.toString() - // 'async function fetch(input, init = undefined) {\n' + - // " emitExperimentalWarning('The Fetch API');\n" + - // ' return lazyUndici().fetch(input, init);\n' + - // ' }' - return nodeJsFunc.toString().includes("emitExperimentalWarning"); -} - /** * Helper to work around missing CORS support in Tendermint (https://github.com/tendermint/tendermint/pull/2800) * @@ -40,7 +19,7 @@ export async function http( headers: Record | undefined, request?: any, ): Promise { - if (typeof fetch === "function" && !isExperimental(fetch)) { + if (typeof fetch === "function") { const settings = { method: method, body: request ? JSON.stringify(request) : undefined, @@ -54,8 +33,6 @@ export async function http( .then(filterBadStatus) .then((res: any) => res.json()); } else { - return axios - .request({ url: url, method: method, data: request, headers: headers }) - .then((res) => res.data); + console.error("no fetch?"); } } diff --git a/yarn.lock b/yarn.lock index 11a5fc9e..fd782d8c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -345,10 +345,10 @@ __metadata: "@types/yargs": "npm:^15.0.4" "@typescript-eslint/eslint-plugin": "npm:^5.54.0" "@typescript-eslint/parser": "npm:^5.54.0" - axios: "npm:^1.6.0" babylon: "npm:^6.18.0" chalk: "npm:^4" cosmjs-types: "npm:^0.9.0" + cross-fetch: "npm:^4.1.0" diff: "npm:^4" eslint: "npm:^7.5" eslint-config-prettier: "npm:^8.3.0" @@ -532,7 +532,7 @@ __metadata: "@types/node": "npm:*" "@typescript-eslint/eslint-plugin": "npm:^5.54.0" "@typescript-eslint/parser": "npm:^5.54.0" - axios: "npm:^1.6.0" + cross-fetch: "npm:^4.1.0" eslint: "npm:^7.5" eslint-config-prettier: "npm:^8.3.0" eslint-import-resolver-node: "npm:^0.3.4" @@ -936,7 +936,7 @@ __metadata: "@types/node": "npm:*" "@typescript-eslint/eslint-plugin": "npm:^5.54.0" "@typescript-eslint/parser": "npm:^5.54.0" - axios: "npm:^1.6.0" + cross-fetch: "npm:^4.1.0" eslint: "npm:^7.5" eslint-config-prettier: "npm:^8.3.0" eslint-import-resolver-node: "npm:^0.3.4" @@ -2453,24 +2453,6 @@ __metadata: languageName: node linkType: hard -"asynckit@npm:^0.4.0": - version: 0.4.0 - resolution: "asynckit@npm:0.4.0" - checksum: 10c0/d73e2ddf20c4eb9337e1b3df1a0f6159481050a5de457c55b14ea2e5cb6d90bb69e004c9af54737a5ee0917fcf2c9e25de67777bbe58261847846066ba75bc9d - languageName: node - linkType: hard - -"axios@npm:^1.6.0": - version: 1.6.2 - resolution: "axios@npm:1.6.2" - dependencies: - follow-redirects: "npm:^1.15.0" - form-data: "npm:^4.0.0" - proxy-from-env: "npm:^1.1.0" - checksum: 10c0/9b77e030e85e4f9cbcba7bb52fbff67d6ce906c92d213e0bd932346a50140faf83733bf786f55bd58301bd92f9973885c7b87d6348023e10f7eaf286d0791a1d - languageName: node - linkType: hard - "babylon@npm:^6.18.0": version: 6.18.0 resolution: "babylon@npm:6.18.0" @@ -2936,15 +2918,6 @@ __metadata: languageName: node linkType: hard -"combined-stream@npm:^1.0.8": - version: 1.0.8 - resolution: "combined-stream@npm:1.0.8" - dependencies: - delayed-stream: "npm:~1.0.0" - checksum: 10c0/0dbb829577e1b1e839fa82b40c07ffaf7de8a09b935cadd355a73652ae70a88b4320db322f6634a4ad93424292fa80973ac6480986247f1734a1137debf271d5 - languageName: node - linkType: hard - "commander@npm:^2.20.0": version: 2.20.3 resolution: "commander@npm:2.20.3" @@ -3098,6 +3071,15 @@ __metadata: languageName: node linkType: hard +"cross-fetch@npm:^4.1.0": + version: 4.1.0 + resolution: "cross-fetch@npm:4.1.0" + dependencies: + node-fetch: "npm:^2.7.0" + checksum: 10c0/628b134ea27cfcada67025afe6ef1419813fffc5d63d175553efa75a2334522d450300a0f3f0719029700da80e96327930709d5551cf6deb39bb62f1d536642e + languageName: node + linkType: hard + "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -3220,13 +3202,6 @@ __metadata: languageName: node linkType: hard -"delayed-stream@npm:~1.0.0": - version: 1.0.0 - resolution: "delayed-stream@npm:1.0.0" - checksum: 10c0/d758899da03392e6712f042bec80aa293bbe9e9ff1b2634baae6a360113e708b91326594c8a486d475c69d6259afb7efacdc3537bfcda1c6c648e390ce601b19 - languageName: node - linkType: hard - "delegates@npm:^1.0.0": version: 1.0.0 resolution: "delegates@npm:1.0.0" @@ -4001,7 +3976,7 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.0.0, follow-redirects@npm:^1.15.0": +"follow-redirects@npm:^1.0.0": version: 1.15.3 resolution: "follow-redirects@npm:1.15.3" peerDependenciesMeta: @@ -4031,17 +4006,6 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^4.0.0": - version: 4.0.0 - resolution: "form-data@npm:4.0.0" - dependencies: - asynckit: "npm:^0.4.0" - combined-stream: "npm:^1.0.8" - mime-types: "npm:^2.1.12" - checksum: 10c0/cb6f3ac49180be03ff07ba3ff125f9eba2ff0b277fb33c7fc47569fc5e616882c5b1c69b9904c4c4187e97dd0419dd03b134174756f296dec62041e6527e2c6e - languageName: node - linkType: hard - "fresh@npm:~0.5.2": version: 0.5.2 resolution: "fresh@npm:0.5.2" @@ -5516,7 +5480,7 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^2.1.12, mime-types@npm:^2.1.18, mime-types@npm:^2.1.27, mime-types@npm:~2.1.24": +"mime-types@npm:^2.1.18, mime-types@npm:^2.1.27, mime-types@npm:~2.1.24": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: @@ -5797,6 +5761,20 @@ __metadata: languageName: node linkType: hard +"node-fetch@npm:^2.7.0": + version: 2.7.0 + resolution: "node-fetch@npm:2.7.0" + dependencies: + whatwg-url: "npm:^5.0.0" + peerDependencies: + encoding: ^0.1.0 + peerDependenciesMeta: + encoding: + optional: true + checksum: 10c0/b55786b6028208e6fbe594ccccc213cab67a72899c9234eb59dba51062a299ea853210fcf526998eaa2867b0963ad72338824450905679ff0fa304b8c5093ae8 + languageName: node + linkType: hard + "node-gyp-build@npm:^4.3.0": version: 4.5.0 resolution: "node-gyp-build@npm:4.5.0" @@ -6424,13 +6402,6 @@ __metadata: languageName: node linkType: hard -"proxy-from-env@npm:^1.1.0": - version: 1.1.0 - resolution: "proxy-from-env@npm:1.1.0" - checksum: 10c0/fe7dd8b1bdbbbea18d1459107729c3e4a2243ca870d26d34c2c1bcd3e4425b7bcc5112362df2d93cc7fb9746f6142b5e272fd1cc5c86ddf8580175186f6ad42b - languageName: node - linkType: hard - "pump@npm:^3.0.0": version: 3.0.0 resolution: "pump@npm:3.0.0" @@ -7513,6 +7484,13 @@ __metadata: languageName: node linkType: hard +"tr46@npm:~0.0.3": + version: 0.0.3 + resolution: "tr46@npm:0.0.3" + checksum: 10c0/047cb209a6b60c742f05c9d3ace8fa510bff609995c129a37ace03476a9b12db4dbf975e74600830ef0796e18882b2381fb5fb1f6b4f96b832c374de3ab91a11 + languageName: node + linkType: hard + "ts-node@npm:^8": version: 8.10.2 resolution: "ts-node@npm:8.10.2" @@ -7834,6 +7812,13 @@ __metadata: languageName: node linkType: hard +"webidl-conversions@npm:^3.0.0": + version: 3.0.1 + resolution: "webidl-conversions@npm:3.0.1" + checksum: 10c0/5612d5f3e54760a797052eb4927f0ddc01383550f542ccd33d5238cfd65aeed392a45ad38364970d0a0f4fea32e1f4d231b3d8dac4a3bdd385e5cf802ae097db + languageName: node + linkType: hard + "webpack-cli@npm:^4.6.0": version: 4.7.0 resolution: "webpack-cli@npm:4.7.0" @@ -7922,6 +7907,16 @@ __metadata: languageName: node linkType: hard +"whatwg-url@npm:^5.0.0": + version: 5.0.0 + resolution: "whatwg-url@npm:5.0.0" + dependencies: + tr46: "npm:~0.0.3" + webidl-conversions: "npm:^3.0.0" + checksum: 10c0/1588bed84d10b72d5eec1d0faa0722ba1962f1821e7539c535558fb5398d223b0c50d8acab950b8c488b4ba69043fd833cc2697056b167d8ad46fac3995a55d5 + languageName: node + linkType: hard + "which-boxed-primitive@npm:^1.0.2": version: 1.0.2 resolution: "which-boxed-primitive@npm:1.0.2" From bda91316bec613dfbebaf545a964595e59bbf964 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 11 Jun 2025 15:14:08 +0200 Subject: [PATCH 2/3] Remove fetch check as cross-fetch should ensure we have it --- .../tendermint-rpc/src/rpcclients/http.ts | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/packages/tendermint-rpc/src/rpcclients/http.ts b/packages/tendermint-rpc/src/rpcclients/http.ts index f5a65c81..98f137c3 100644 --- a/packages/tendermint-rpc/src/rpcclients/http.ts +++ b/packages/tendermint-rpc/src/rpcclients/http.ts @@ -19,20 +19,16 @@ export async function http( headers: Record | undefined, request?: any, ): Promise { - if (typeof fetch === "function") { - const settings = { - method: method, - body: request ? JSON.stringify(request) : undefined, - headers: { - // eslint-disable-next-line @typescript-eslint/naming-convention - "Content-Type": "application/json", - ...headers, - }, - }; - return fetch(url, settings) - .then(filterBadStatus) - .then((res: any) => res.json()); - } else { - console.error("no fetch?"); - } + const settings = { + method: method, + body: request ? JSON.stringify(request) : undefined, + headers: { + // eslint-disable-next-line @typescript-eslint/naming-convention + "Content-Type": "application/json", + ...headers, + }, + }; + return fetch(url, settings) + .then(filterBadStatus) + .then((res: any) => res.json()); } From e51ddf5fea2e842d1cc31673dc91189f262c3045 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 11 Jun 2025 15:15:45 +0200 Subject: [PATCH 3/3] Add CHANGELOG entry --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 70a59170..7034af3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to ## [Unreleased] +- Replaxe axios with cross-fetch ([#1645]) + +[#1645]: https://github.com/cosmos/cosmjs/pull/1645 + ## [0.33.1] - 2025-03-12 ### Fixed