Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove verbose log #1323

Merged
merged 5 commits into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/green-dogs-leap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@fuel-ts/providers": patch
---

remove console warn
10 changes: 1 addition & 9 deletions packages/providers/src/provider.ts
Original file line number Diff line number Diff line change
@@ -356,7 +356,7 @@ export default class Provider {
}

private static ensureClientVersionIsSupported(nodeInfo: NodeInfo) {
const { isMajorSupported, isMinorSupported, isPatchSupported, supportedVersion } =
const { isMajorSupported, isMinorSupported, supportedVersion } =
checkFuelCoreVersionCompatibility(nodeInfo.nodeVersion);

if (!isMajorSupported || !isMinorSupported) {
@@ -365,14 +365,6 @@ export default class Provider {
`Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
);
}

if (!isPatchSupported) {
// eslint-disable-next-line no-console
console.warn(
FuelError.CODES.UNSUPPORTED_FUEL_CLIENT_VERSION,
`The patch versions of the client and sdk differ. Fuel client version: ${nodeInfo.nodeVersion}, Supported version: ${supportedVersion}`
);
}
}

/**
25 changes: 0 additions & 25 deletions packages/providers/test/provider.test.ts
Original file line number Diff line number Diff line change
@@ -866,29 +866,4 @@ describe('Provider', () => {
message: `Fuel client version: ${FUEL_CORE}, Supported version: ${mock.supportedVersion}`,
});
});

it('warns on difference between patch client version and supported patch version', async () => {
const { FUEL_CORE } = versions;
const [major, minor, patch] = FUEL_CORE.split('.');

const patchMismatch = patch === '0' ? 1 : parseInt(patch, 10) - 1;
const mock = {
isMajorSupported: true,
isMinorSupported: true,
isPatchSupported: false,
supportedVersion: `${major}.${minor}.${patchMismatch}`,
};
if (mock.supportedVersion === FUEL_CORE) throw new Error();

const spy = jest.spyOn(fuelTsVersionsMod, 'checkFuelCoreVersionCompatibility');
spy.mockImplementation(() => mock);

const warnSpy = jest.spyOn(global.console, 'warn').mockImplementation(() => {});
await Provider.create(FUEL_NETWORK_URL);

expect(warnSpy).toHaveBeenCalledWith(
ErrorCode.UNSUPPORTED_FUEL_CLIENT_VERSION,
`The patch versions of the client and sdk differ. Fuel client version: ${FUEL_CORE}, Supported version: ${mock.supportedVersion}`
);
});
});