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

chore!: deprecate FUEL_NETWORK_URL and LOCAL_NETWORK_URL #2915

Merged
merged 77 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
e51a6d3
refactor: integrated launchTestNode in remaining files
maschad Jul 19, 2024
5b075d8
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Jul 19, 2024
9976ff5
docs: update changeset
maschad Jul 21, 2024
67e359d
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Jul 25, 2024
095ad96
test: integrated launchTestNode into all tests excluding doc-snippets
maschad Jul 25, 2024
9a43d4e
wip
maschad Jul 26, 2024
12e1fe3
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Jul 26, 2024
093d259
test: refactored many tests in docs-snippets
maschad Jul 27, 2024
b9e4c7a
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Jul 29, 2024
7009b8f
test: skipping currently failing test suites for ci tests
maschad Jul 29, 2024
29a9ab0
docs: add changeset
maschad Jul 29, 2024
597857e
deps: update dependencies
maschad Jul 29, 2024
f7b1dbf
deps: remove cyclical dependency
maschad Jul 29, 2024
25f9cf6
deps: updated dependencies to use setupTestWallet for now
maschad Jul 29, 2024
7cfaa6c
fix: add error handling for in memory store historical view issues
maschad Jul 29, 2024
303d0db
fix: resolve conflicts
maschad Jul 29, 2024
2cd21ff
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Jul 30, 2024
3be4052
test: enable browser for demo-fuels index test
maschad Jul 30, 2024
2591024
docs: added comments about typegen contract call mismatches
maschad Jul 30, 2024
989cf2a
revert error supression on provider
maschad Jul 30, 2024
4429937
test: increasing block production time
maschad Jul 30, 2024
ea331ad
test: browser test adjusments
maschad Jul 30, 2024
9378913
test: browser test adjustments
maschad Jul 30, 2024
4abbb87
test: update provider test case for snippets
maschad Aug 6, 2024
9d33d33
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 6, 2024
1a486f2
chore: refactor to use new typegen types
maschad Aug 6, 2024
6a948d8
linting
maschad Aug 6, 2024
781aa6c
chore: resolve issue with account tests
maschad Aug 6, 2024
fcdb5ca
chore: undo create-fuels.js change
maschad Aug 6, 2024
5760f90
chore: update poa-interval-period
maschad Aug 6, 2024
6c5a42e
chore: update querying chain docs tests
maschad Aug 6, 2024
c4f08f4
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 8, 2024
c69aacf
test: update FUEL_CORE compatability tests
maschad Aug 8, 2024
3ba2d9e
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 8, 2024
441e56f
linting fixes
maschad Aug 8, 2024
7170dfc
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
Torres-ssf Aug 8, 2024
3306155
docs: use custom port for launchTestNode
maschad Aug 8, 2024
9b806da
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 8, 2024
1a5378e
docs: update docs with PR feedback
maschad Aug 8, 2024
72bdc09
chore: remove unused testing utilities
maschad Aug 8, 2024
66cc914
chore: more PR feedback refactors
maschad Aug 8, 2024
a9c8ec6
ci: update CI workflow test scripts
maschad Aug 8, 2024
3eaccd9
ci: update workflow steps
maschad Aug 8, 2024
2d07030
test: update tests to spin up temp nodes in setup
maschad Aug 9, 2024
9f41a25
linting
maschad Aug 9, 2024
16f39d1
docs: update changesets
maschad Aug 9, 2024
9f1398a
chore: update variable assignment
maschad Aug 9, 2024
9b8ec2f
docs: update imports
maschad Aug 9, 2024
fd799b4
chore: pr feedback changes
maschad Aug 9, 2024
54a9b0b
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 9, 2024
c471267
docs: re-introduce testing wallets docs (#2635)
maschad Aug 10, 2024
283c96e
chore: update changesets + feedback
maschad Aug 10, 2024
cc3d4fd
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 10, 2024
75ebda3
ci: remove unnecessary clean step
maschad Aug 12, 2024
7a95dc7
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 12, 2024
957b951
chore: deprecated urls
petertonysmith94 Aug 12, 2024
afc46cc
chore: changeset
petertonysmith94 Aug 12, 2024
5d73ea4
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Aug 12, 2024
02912ec
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 12, 2024
b3c10cc
docs: update contributing docs
maschad Aug 12, 2024
1bb4b70
chore: update test asset IDs
maschad Aug 12, 2024
4c36fa7
Merge branch 'mc/chore/integrate-launch-test-node-in-remaining-packag…
petertonysmith94 Aug 12, 2024
c576dca
Update network url
petertonysmith94 Aug 13, 2024
f818d81
chore: refactor account tests to use helper
maschad Aug 13, 2024
8c12add
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 13, 2024
0f8f2cc
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 14, 2024
8939ed9
chore: pr feedback
maschad Aug 14, 2024
f569034
Merge branch 'master' into mc/chore/integrate-launch-test-node-in-rem…
maschad Aug 14, 2024
17f9ad5
docs: update changesets
maschad Aug 14, 2024
86461db
docs: update changeset to breaking
maschad Aug 14, 2024
63e2c2e
docs: remove unnecessary updates from changeset
maschad Aug 14, 2024
2c5678a
chore: removed `FUEL_NETWORK_URL` env
petertonysmith94 Aug 15, 2024
48ce0dc
chore: updated pvt key envs
petertonysmith94 Aug 15, 2024
a9f1133
Merge branch 'mc/chore/integrate-launch-test-node-in-remaining-packag…
petertonysmith94 Aug 15, 2024
2f71f1d
Merge branch 'master' of https://github.com/FuelLabs/fuels-ts into ps…
petertonysmith94 Aug 15, 2024
211df94
chore: changeset
petertonysmith94 Aug 15, 2024
804dd12
Merge branch 'master' into ps/chore/deprecate-fuel-network-url-and-local
arboleya Aug 15, 2024
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
6 changes: 6 additions & 0 deletions .changeset/nervous-shirts-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@fuel-ts/account": minor
"fuels": patch
---

chore!: deprecate `FUEL_NETWORK_URL` and `LOCAL_NETWORK_URL`
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FUEL_NETWORK_URL=
TEST_WALLET_PVT_KEY=
DEVNET_WALLET_PVT_KEY=
TESTNET_WALLET_PVT_KEY=
PUBLISHED_NPM_TAG=
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ cp .env.example .env.test
And changing the below variables:

```sh
FUEL_NETWORK_URL=https://testnet.fuel.network/v1/graphql
TEST_WALLET_PVT_KEY=0x...
DEVNET_WALLET_PVT_KEY=0x...
TESTNET_WALLET_PVT_KEY=0x...
```

<!-- TODO: add/fix block explorer URL after testnet support- Checking Wallet Balance: https://fuellabs.github.io/block-explorer-v2/beta-5/?#/address/fuel1x33ajpj0jy5p2wcqqu45e32r75zrwfeh6hwqfv5un670rv4p0mns58enjg -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import { launchTestNode } from 'fuels/test-utils';
*/
describe('Getting started', () => {
it('can connect to a local network', async () => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
using launched = await launchTestNode({
nodeOptions: { port: '4000' },
});
using launched = await launchTestNode();

const mockedProvider = await Provider.create(launched.provider.url);
vi.spyOn(Provider, 'create').mockResolvedValueOnce(mockedProvider);

// #region connecting-to-the-local-node
// #import { Provider, Wallet };

Expand All @@ -30,6 +31,11 @@ describe('Getting started', () => {
});

it('can connect to testnet', async () => {
using launched = await launchTestNode();

const mockedProvider = await Provider.create(launched.provider.url);
vi.spyOn(Provider, 'create').mockResolvedValueOnce(mockedProvider);

// #region connecting-to-the-testnet
// #import { Provider, Wallet, TESTNET_NETWORK_URL };

Expand Down
27 changes: 12 additions & 15 deletions apps/docs-snippets/src/guide/provider/provider.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* eslint-disable @typescript-eslint/no-unused-vars */

import {
Provider,
ScriptTransactionRequest,
sleep,
WalletUnlocked,
Address,
FUEL_NETWORK_URL,
} from 'fuels';
import { Provider, ScriptTransactionRequest, sleep, WalletUnlocked, Address } from 'fuels';
import { launchTestNode } from 'fuels/test-utils';

async function fetchSomeExternalCredentials() {
Expand All @@ -27,10 +17,13 @@ describe('Provider', () => {
it('base examples', async () => {
using launched = await launchTestNode();

const FUEL_NETWORK_URL = launched.provider.url;
const mockedProvider = await Provider.create(launched.provider.url);
vi.spyOn(Provider, 'create').mockResolvedValueOnce(mockedProvider);

// #region provider-definition
// #import { Provider, FUEL_NETWORK_URL, WalletUnlocked };
// #import { Provider, WalletUnlocked };

const FUEL_NETWORK_URL = 'http://127.0.0.1:4000/v1/graphql';

// Create the provider
const provider = await Provider.create(FUEL_NETWORK_URL);
Expand All @@ -57,6 +50,7 @@ describe('Provider', () => {
using launched = await launchTestNode();

const FUEL_NETWORK_URL = launched.provider.url;

// #region options-requestMiddleware
// synchronous request middleware
await Provider.create(FUEL_NETWORK_URL, {
Expand Down Expand Up @@ -147,10 +141,13 @@ describe('Provider', () => {
const recipientAddress = Address.fromRandom();
using launched = await launchTestNode();

const FUEL_NETWORK_URL = launched.provider.url;
const mockedProvider = await Provider.create(launched.provider.url);
vi.spyOn(Provider, 'create').mockResolvedValueOnce(mockedProvider);

// #region provider-getBaseAssetId
// #import { Provider, FUEL_NETWORK_URL, ScriptTransactionRequest };
// #import { Provider, ScriptTransactionRequest };

const FUEL_NETWORK_URL = 'http://127.0.0.1:4000/v1/graphql';

// Fetch the base asset ID using the provider
const provider = await Provider.create(FUEL_NETWORK_URL);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-shadow */
import type {
TransactionResultMessageOutReceipt,
CoinQuantityLike,
ExcludeResourcesOption,
} from 'fuels';
import { ScriptTransactionRequest, FUEL_NETWORK_URL, Provider } from 'fuels';
import { ScriptTransactionRequest, Provider } from 'fuels';
import { TestAssetId, TestMessage, launchTestNode } from 'fuels/test-utils';

/**
Expand All @@ -28,7 +27,7 @@ describe('querying the chain', () => {
const FUEL_NETWORK_URL = testProvider.url;

// #region get-coins-1
// #import { Provider, FUEL_NETWORK_URL };
// #import { Provider };
maschad marked this conversation as resolved.
Show resolved Hide resolved

const provider = await Provider.create(FUEL_NETWORK_URL);

Expand Down Expand Up @@ -74,7 +73,7 @@ describe('querying the chain', () => {
const FUEL_NETWORK_URL = testProvider.url;

// #region get-spendable-resources-1
// #import { Provider, FUEL_NETWORK_URL, ScriptTransactionRequest, CoinQuantityLike, ExcludeResourcesOption };
// #import { Provider, ScriptTransactionRequest, CoinQuantityLike, ExcludeResourcesOption };

const provider = await Provider.create(FUEL_NETWORK_URL);
const assetIdA = '0x0101010101010101010101010101010101010101010101010101010101010101';
Expand Down Expand Up @@ -125,7 +124,7 @@ describe('querying the chain', () => {
const FUEL_NETWORK_URL = testProvider.url;

// #region get-balances-1
// #import { Provider, FUEL_NETWORK_URL };
// #import { Provider };

const provider = await Provider.create(FUEL_NETWORK_URL);

Expand All @@ -149,7 +148,7 @@ describe('querying the chain', () => {
const FUEL_NETWORK_URL = launched.provider.url;

// #region Provider-get-blocks
// #import { Provider, FUEL_NETWORK_URL };
// #import { Provider };

const provider = await Provider.create(FUEL_NETWORK_URL);

Expand All @@ -172,7 +171,7 @@ describe('querying the chain', () => {
const FUEL_NETWORK_URL = testProvider.url;

// #region get-message-by-nonce-1
// #import { Provider, FUEL_NETWORK_URL };
// #import { Provider };

const provider = await Provider.create(FUEL_NETWORK_URL);

Expand Down
2 changes: 0 additions & 2 deletions internal/check-imports/src/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
Predicate,
Provider,
} from '@fuel-ts/account';
import { FUEL_NETWORK_URL } from '@fuel-ts/account/configs';
import { Address } from '@fuel-ts/address';
import { ContractFactory } from '@fuel-ts/contract';
import { encrypt, decrypt } from '@fuel-ts/crypto';
Expand Down Expand Up @@ -167,7 +166,6 @@ log(WalletManager);
* wallet
*/
log(Wallet);
log(FUEL_NETWORK_URL);

/**
* wordlists
Expand Down
57 changes: 1 addition & 56 deletions packages/account/src/configs.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
/**
* @group node
* @group browser
*/
describe('Configs', () => {
it('exports FUEL_NETWORK_URL', async () => {
const configs = await import('./configs');
expect(configs.FUEL_NETWORK_URL).toBe('http://127.0.0.1:4000/v1/graphql');
});

it('exports LOCAL_NETWORK_URL', async () => {
const configs = await import('./configs');
expect(configs.LOCAL_NETWORK_URL).toBe('http://127.0.0.1:4000/v1/graphql');
});

it('exports DEVNET_NETWORK_URL', async () => {
const configs = await import('./configs');
expect(configs.DEVNET_NETWORK_URL).toBe('https://devnet.fuel.network/v1/graphql');
Expand All @@ -22,49 +13,3 @@ describe('Configs', () => {
expect(configs.TESTNET_NETWORK_URL).toBe('https://testnet.fuel.network/v1/graphql');
});
});

describe('Configs - undefined process', () => {
const originalProcess = process;

beforeEach(() => {
vi.resetModules();

// @ts-expect-error - test to assert undefined process
// eslint-disable-next-line no-global-assign
process = undefined;
});

afterEach(() => {
// eslint-disable-next-line no-global-assign
process = originalProcess;
});

it('exports FUEL_NETWORK_URL with undefined process', async () => {
expect(typeof process).toBe('undefined');
expect(process).toBeUndefined();

const configs = await import('./configs');

expect(configs.FUEL_NETWORK_URL).toBe('http://127.0.0.1:4000/v1/graphql');
});
});

describe('Configs - overridden env', () => {
const originalEnv = process.env;

beforeEach(() => {
vi.resetModules();

process.env = { ...originalEnv, FUEL_NETWORK_URL: 'some-other-network-url' };
});

afterEach(() => {
process.env = originalEnv;
});

it('exports FUEL_NETWORK_URL with overridden env', async () => {
const configs = await import('./configs');

expect(configs.FUEL_NETWORK_URL).toBe('some-other-network-url');
});
});
6 changes: 0 additions & 6 deletions packages/account/src/configs.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
export const LOCAL_NETWORK_URL = 'http://127.0.0.1:4000/v1/graphql';
export const DEVNET_NETWORK_URL = 'https://devnet.fuel.network/v1/graphql';
export const TESTNET_NETWORK_URL = 'https://testnet.fuel.network/v1/graphql';
// TODO: replace placeholder with mainnet network url
// export const NETWORK_URL = '';

export const FUEL_NETWORK_URL: string =
typeof process !== 'undefined'
? process?.env?.FUEL_NETWORK_URL || LOCAL_NETWORK_URL
: LOCAL_NETWORK_URL;
3 changes: 1 addition & 2 deletions packages/account/test/fixtures/mocked-connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import type {
ConnectorMetadata,
Network,
} from '../../src';
import { FUEL_NETWORK_URL } from '../../src/configs';
import { FuelConnector } from '../../src/connectors/fuel-connector';
import { FuelConnectorEventTypes } from '../../src/connectors/types';
import type { Asset } from '../../src/providers/assets/types';
Expand Down Expand Up @@ -51,7 +50,7 @@ export class MockConnector extends FuelConnector {
this._networks = options.networks ?? [
{
chainId: 0,
url: FUEL_NETWORK_URL,
url: 'http://127.0.0.1/v1/graphql',
},
];
// Time should be under 1 second
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('autoStartFuelCore', () => {
port: '4000',
url: 'http://127.0.0.1:4000/v1/graphql',
snapshotDir: '/some/path',
pid: 1234,
})
);
return { launchNode };
Expand Down
3 changes: 1 addition & 2 deletions packages/fuels/src/cli/config/loadConfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FUEL_NETWORK_URL } from '@fuel-ts/account/configs';
import { FuelError } from '@fuel-ts/errors';
import { defaultConsensusKey } from '@fuel-ts/utils';
import { bundleRequire } from 'bundle-require';
Expand Down Expand Up @@ -64,7 +63,7 @@ export async function loadConfig(cwd: string): Promise<FuelsConfig> {
deployConfig: {},
autoStartFuelCore: true,
fuelCorePort: 4000,
providerUrl: FUEL_NETWORK_URL,
providerUrl: process.env.FUEL_NETWORK_URL ?? 'http://127.0.0.1:4000/v1/graphql',
privateKey: defaultConsensusKey,
...userConfig,
basePath: cwd,
Expand Down
3 changes: 1 addition & 2 deletions packages/fuels/test/fixtures/fuels.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FUEL_NETWORK_URL } from '@fuel-ts/account/configs';
import { join } from 'path';

import type { FuelsConfig } from '../../src';
Expand All @@ -21,7 +20,7 @@ export const fuelsConfig: FuelsConfig = {
deployConfig: {},
autoStartFuelCore: true,
fuelCorePort: 4000,
providerUrl: FUEL_NETWORK_URL,
providerUrl: 'http://127.0.0.1:4000/v1/graphql',
configPath: __filename,
forcBuildFlags: [],
buildMode: 'debug',
Expand Down
3 changes: 1 addition & 2 deletions packages/fuels/test/utils/mockAutoStartFuelCore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { FUEL_NETWORK_URL } from '@fuel-ts/account/configs';
import type { SpyInstance } from 'vitest';

import * as autoStartFuelCoreMod from '../../src/cli/commands/dev/autoStartFuelCore';
Expand All @@ -14,7 +13,7 @@ export const mockStartFuelCore = (): {
bindIp: '0.0.0.0',
accessIp: '127.0.0.1',
port: 4000,
providerUrl: FUEL_NETWORK_URL,
providerUrl: 'http://127.0.0.1:4000/v1/graphql',
killChildProcess,
snapshotDir: '/some/path',
};
Expand Down
Loading