Skip to content

Commit

Permalink
chore: downgrade fetch-node
Browse files Browse the repository at this point in the history
  • Loading branch information
friedger committed Feb 14, 2024
1 parent 967e744 commit a4f665f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 47 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ export CUSTOM_STACKS_NODE="stacksbrice/stacks-node:devnet-2.4.0.0.0"
```

If this environment variable is not defined, `stacks-devnet-js` will default to an older version of the `stacks-node`.

## Logging
The devnet orchestrator outputs logging details to folder `/tmp/stacks-node-...`
4 changes: 3 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
module.exports = {
const config = {
preset: "ts-jest",
testEnvironment: "node",
testTimeout: 300_000,
maxWorkers: 1,
reporters: ["default", "jest-github-actions-reporter"],
testLocationInResults: true,
};

export default config;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"@stacks/transactions": "^6.11.3",
"@types/node": "^20.11.17",
"micro-btc-signer": "^0.4.2",
"node-fetch": "^3.3.2",
"node-fetch": "2.6.7",
"typescript": "^5.3.3"
},
"author": "",
Expand Down
1 change: 1 addition & 0 deletions settings/Devnet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ balance = 1_000_000_000_000_000
# btc_address: mjSrB3wS4xab3kYqFktwBzfTdPg367ZJ2d

[devnet]
use_nakamoto = true
disable_stacks_explorer = true
disable_stacks_api = true
enable_next_features = true
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
makeContractDeploy,
makeSTXTokenTransfer,
} from "@stacks/transactions";
import fetch from "node-fetch";
const fetch = require("node-fetch");

interface EpochTimeline {
epoch_2_0?: number;
Expand Down
13 changes: 9 additions & 4 deletions tests/integration/pox/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ import {
uintCV,
} from "@stacks/transactions";

import { expect } from "vitest";
import { Contracts } from "../constants";
import { BroadcastOptions } from "../helpers";
import fetch from "node-fetch";
const fetch = require("node-fetch");

export interface Account {
stxAddress: string;
Expand Down Expand Up @@ -81,10 +80,10 @@ export const getPoxInfo = async (
if (retryCountdown == 0) return Promise.reject();
try {
let response = await fetch(network.getPoxInfoUrl(), {});
let poxInfo = await response.json() as PoxInfo & {
let poxInfo = (await response.json()) as PoxInfo & {
total_liquid_supply_ustx: number;
pox_activation_threshold_ustx: number;
}
};
return poxInfo;
} catch (e) {
await delay();
Expand All @@ -101,6 +100,12 @@ export const getAccount = async (
if (retryCountdown == 0) return Promise.reject();
try {
let response = await fetch(network.getAccountApiUrl(address), {});
if (response.status === 404) {
return Promise.reject(
`account api url not found on ${network.getAccountApiUrl(address)}`,
);
}
expect(response.status).toBe(200);
let payload: any = await response.json();
return {
balance: BigInt(payload.balance),
Expand Down
2 changes: 1 addition & 1 deletion tests/testnet/next-cycle.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
broadcastDelegateStackExtend,
broadcastDelegateStackIncrease,
broadcastDelegateStackSTX,
broadcastRevokeDelegateStx
broadcastRevokeDelegateStx,
} from "../integration/pox/helpers-pooled-stacking";

describe("stack-increase", async () => {
Expand Down
39 changes: 0 additions & 39 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1901,11 +1901,6 @@ cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"

data-uri-to-buffer@^4.0.0:
version "4.0.1"
resolved "https://registry.yarnpkg.com/data-uri-to-buffer/-/data-uri-to-buffer-4.0.1.tgz#d8feb2b2881e6a4f58c2e08acfd0e2834e26222e"
integrity sha512-0R9ikRb668HB7QDxT1vkpuUBtqc53YyAwMwGeUFKRojY/NWKvdZ+9UYtRfGmhqNbRkTSVpMbmyhXipFFv2cb/A==

debug@4, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz"
Expand Down Expand Up @@ -2128,14 +2123,6 @@ fb-watchman@^2.0.0:
dependencies:
bser "2.1.1"

fetch-blob@^3.1.2, fetch-blob@^3.1.4:
version "3.2.0"
resolved "https://registry.yarnpkg.com/fetch-blob/-/fetch-blob-3.2.0.tgz#f09b8d4bbd45adc6f0c20b7e787e793e309dcce9"
integrity sha512-7yAQpD2UMJzLi1Dqv7qFYnPbaPx7ZfFK6PiIxQ4PfkGPyNyl2Ugx+a/umUonmKqjhM4DnfbMvdX6otXq83soQQ==
dependencies:
node-domexception "^1.0.0"
web-streams-polyfill "^3.0.3"

fflate@^0.8.1:
version "0.8.2"
resolved "https://registry.yarnpkg.com/fflate/-/fflate-0.8.2.tgz#fc8631f5347812ad6028bbe4a2308b2792aa1dea"
Expand Down Expand Up @@ -2175,13 +2162,6 @@ flatted@^3.2.9:
resolved "https://registry.yarnpkg.com/flatted/-/flatted-3.2.9.tgz#7eb4c67ca1ba34232ca9d2d93e9886e611ad7daf"
integrity sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==

formdata-polyfill@^4.0.10:
version "4.0.10"
resolved "https://registry.yarnpkg.com/formdata-polyfill/-/formdata-polyfill-4.0.10.tgz#24807c31c9d402e002ab3d8c720144ceb8848423"
integrity sha512-buewHzMvYL29jdeQTVILecSaZKnt/RJWjoZCF5OW60Z67/GmSLBkOFM7qh1PI3zFNtJbaZL5eQu1vLfazOwj4g==
dependencies:
fetch-blob "^3.1.2"

fs-minipass@^2.0.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-2.1.0.tgz#7f5036fdbf12c63c169190cbe4199c852271f9fb"
Expand Down Expand Up @@ -3158,11 +3138,6 @@ neon-cli@^0.9.1:
validate-npm-package-license "^3.0.4"
validate-npm-package-name "^3.0.0"

node-domexception@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-domexception/-/node-domexception-1.0.0.tgz#6888db46a1f71c0b76b3f7555016b63fe64766e5"
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==

node-fetch@2.6.7:
version "2.6.7"
resolved "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz"
Expand All @@ -3177,15 +3152,6 @@ node-fetch@^2.6.7:
dependencies:
whatwg-url "^5.0.0"

node-fetch@^3.3.2:
version "3.3.2"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-3.3.2.tgz#d1e889bacdf733b4ff3b2b243eb7a12866a0b78b"
integrity sha512-dRB78srN/l6gqWulah9SrxeYnxeddIG30+GOqK/9OlLVyLg3HPnr6SqOWTWOXKRwC2eGYCkZ59NNuSgvSrpgOA==
dependencies:
data-uri-to-buffer "^4.0.0"
fetch-blob "^3.1.4"
formdata-polyfill "^4.0.10"

node-int64@^0.4.0:
version "0.4.0"
resolved "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz"
Expand Down Expand Up @@ -4066,11 +4032,6 @@ walker@^1.0.8:
dependencies:
makeerror "1.0.12"

web-streams-polyfill@^3.0.3:
version "3.3.2"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz#32e26522e05128203a7de59519be3c648004343b"
integrity sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==

webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
Expand Down

0 comments on commit a4f665f

Please sign in to comment.