From 4c4ff3c8f1ee7232e46859701521e9f11b33f899 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 17:46:01 +0100 Subject: [PATCH 01/29] chore: bumped versions --- internal/fuel-core/VERSION | 2 +- packages/account/src/providers/provider.test.ts | 2 +- packages/versions/src/lib/getBuiltinVersions.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/fuel-core/VERSION b/internal/fuel-core/VERSION index 1b58cc10180..697f087f376 100644 --- a/internal/fuel-core/VERSION +++ b/internal/fuel-core/VERSION @@ -1 +1 @@ -0.27.0 +0.28.0 diff --git a/packages/account/src/providers/provider.test.ts b/packages/account/src/providers/provider.test.ts index 5eeaefc189d..0bc2e4d30d2 100644 --- a/packages/account/src/providers/provider.test.ts +++ b/packages/account/src/providers/provider.test.ts @@ -63,7 +63,7 @@ describe('Provider', () => { const version = await provider.getVersion(); - expect(version).toEqual('0.27.0'); + expect(version).toEqual('0.28.0'); }); it('can call()', async () => { diff --git a/packages/versions/src/lib/getBuiltinVersions.ts b/packages/versions/src/lib/getBuiltinVersions.ts index 1898f43648e..a43a95c9610 100644 --- a/packages/versions/src/lib/getBuiltinVersions.ts +++ b/packages/versions/src/lib/getBuiltinVersions.ts @@ -1,7 +1,7 @@ export function getBuiltinVersions() { return { FORC: '0.60.0', - FUEL_CORE: '0.27.0', + FUEL_CORE: '0.28.0', FUELS: '0.89.2', }; } From f502e9b5f24848889920610248f51dd391299069 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 17:54:16 +0100 Subject: [PATCH 02/29] chore: added devnet URL --- packages/account/src/configs.test.ts | 5 +++++ packages/account/src/configs.ts | 1 + 2 files changed, 6 insertions(+) diff --git a/packages/account/src/configs.test.ts b/packages/account/src/configs.test.ts index 9ca7c3dfe54..1c29c74e6f2 100644 --- a/packages/account/src/configs.test.ts +++ b/packages/account/src/configs.test.ts @@ -7,6 +7,11 @@ describe('Configs', () => { expect(configs.FUEL_NETWORK_URL).toBe('http://127.0.0.1:4000/v1/graphql'); }); + it('exports FUEL_DEVNET_NETWORK_URL', async () => { + const configs = await import('./configs'); + expect(configs.FUEL_TESTNET_NETWORK_URL).toBe('https://devnet.fuel.network/v1/graphql'); + }); + it('exports FUEL_TESTNET_NETWORK_URL', async () => { const configs = await import('./configs'); expect(configs.FUEL_TESTNET_NETWORK_URL).toBe('https://testnet.fuel.network/v1/graphql'); diff --git a/packages/account/src/configs.ts b/packages/account/src/configs.ts index bcf896e8bec..6e4e390863e 100644 --- a/packages/account/src/configs.ts +++ b/packages/account/src/configs.ts @@ -3,4 +3,5 @@ export const FUEL_NETWORK_URL: string = ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql' : 'http://127.0.0.1:4000/v1/graphql'; +export const FUEL_DEVNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql'; export const FUEL_TESTNET_NETWORK_URL: string = 'https://testnet.fuel.network/v1/graphql'; From c318f3edb1f7918e7db5ad7a179a7b36e3c1b94f Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 18:28:35 +0100 Subject: [PATCH 03/29] ci: removed redundant env --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ec41efa2e59..0c6763f8d82 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,7 +79,6 @@ jobs: - name: Run Isolated Tests run: pnpm test:e2e env: - FUEL_NETWORK_URL: https://testnet.fuel.network/v1/graphql FUEL_TESTNET_NETWORK_URL: https://testnet.fuel.network/v1/graphql TEST_WALLET_PVT_KEY: ${{ secrets.TEST_WALLET_PVT_KEY }} TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }} From b5a107b43363db7b2c26736bf81324e80e401614 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 18:31:33 +0100 Subject: [PATCH 04/29] chore: removed redundant `FUEL_TESTNET_NETWORK_URL` e2e env --- .github/workflows/test.yaml | 1 - packages/fuel-gauge/src/e2e-script.test.ts | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0c6763f8d82..2fd89fb8a81 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,7 +79,6 @@ jobs: - name: Run Isolated Tests run: pnpm test:e2e env: - FUEL_TESTNET_NETWORK_URL: https://testnet.fuel.network/v1/graphql TEST_WALLET_PVT_KEY: ${{ secrets.TEST_WALLET_PVT_KEY }} TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }} PUBLISHED_NPM_VERSION: ${{ steps.release.outputs.published_version }} diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index d2b72988427..04c5e273078 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import { Provider, TransactionType, WalletUnlocked } from 'fuels'; +import { FUEL_TESTNET_NETWORK_URL, Provider, TransactionType, WalletUnlocked } from 'fuels'; import { getScript } from './utils'; @@ -17,13 +17,13 @@ describe('Live Script Test', () => { let shouldSkip: boolean; beforeAll(async () => { - if (!process.env.TEST_WALLET_PVT_KEY || !process.env.FUEL_TESTNET_NETWORK_URL) { + if (!process.env.TEST_WALLET_PVT_KEY) { console.log('Skipping live Fuel Node test'); shouldSkip = true; return; } - provider = await Provider.create(process.env.FUEL_TESTNET_NETWORK_URL); + provider = await Provider.create(FUEL_TESTNET_NETWORK_URL); wallet = new WalletUnlocked(process.env.TEST_WALLET_PVT_KEY, provider); }); From 431f51f6c6090897f29ca86eed2ed966dbb029a7 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 18:46:13 +0100 Subject: [PATCH 05/29] chore: removed redundant `TEST_WALLET_ADDRESS` --- .github/workflows/test.yaml | 1 - CONTRIBUTING.md | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2fd89fb8a81..9f6b32a3d9c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -80,7 +80,6 @@ jobs: run: pnpm test:e2e env: TEST_WALLET_PVT_KEY: ${{ secrets.TEST_WALLET_PVT_KEY }} - TEST_WALLET_ADDRESS: ${{ secrets.TEST_WALLET_ADDRESS }} PUBLISHED_NPM_VERSION: ${{ steps.release.outputs.published_version }} create-fuels-template-integration: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b76ebdbf0fb..55a5cc2c3ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -155,7 +155,6 @@ And changing the below variables: ```sh FUEL_NETWORK_URL=https://testnet.fuel.network/v1/graphql TEST_WALLET_PVT_KEY=0x... -TEST_WALLET_ADDRESS=fuel... ``` From 3ebef101397e90e22a6b61a7f51d394bdaea501c Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 19:01:13 +0100 Subject: [PATCH 06/29] chore: allowed for two networks in the e2e's --- packages/fuel-gauge/src/e2e-script.test.ts | 31 +++++++++++++++++----- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 04c5e273078..6755700a955 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -1,8 +1,25 @@ /* eslint-disable no-console */ -import { FUEL_TESTNET_NETWORK_URL, Provider, TransactionType, WalletUnlocked } from 'fuels'; +import { + FUEL_DEVNET_NETWORK_URL, + FUEL_TESTNET_NETWORK_URL, + Provider, + TransactionType, + WalletUnlocked, +} from 'fuels'; import { getScript } from './utils'; +const networks = { + devnet: { + networkUrl: FUEL_DEVNET_NETWORK_URL, + privateKey: process.env.DEVNET_WALLET_PVT_KEY, + }, + testnet: { + networkUrl: FUEL_TESTNET_NETWORK_URL, + privateKey: process.env.TESTNET_WALLET_PVT_KEY, + }, +} as const; + /** * @group node * @group e2e @@ -12,19 +29,22 @@ describe('Live Script Test', () => { const UPGRADE_TX_ID = '0xe2c03044fe708e9b112027881baf9f892e6b64a630a629998922c1cab918c094'; const UPLOAD_TX_ID = '0x94bc2a189b8211796c8fe5b9c6b67624fe97d2007e104bf1b30739944f43bd73'; + const selectedNetwork: keyof typeof networks = 'testnet'; let provider: Provider; let wallet: WalletUnlocked; let shouldSkip: boolean; beforeAll(async () => { - if (!process.env.TEST_WALLET_PVT_KEY) { + const network = networks[selectedNetwork]; + + if (!network.privateKey) { console.log('Skipping live Fuel Node test'); shouldSkip = true; return; } - provider = await Provider.create(FUEL_TESTNET_NETWORK_URL); - wallet = new WalletUnlocked(process.env.TEST_WALLET_PVT_KEY, provider); + provider = await Provider.create(network.networkUrl); + wallet = new WalletUnlocked(network.privateKey, provider); }); it('can use script against live Fuel Node', async () => { @@ -47,8 +67,7 @@ describe('Live Script Test', () => { console.error((e as Error).message); console.warn(` not enough coins to fit the target? - - add assets: https://faucet-testnet.fuel.network/ - - check balance: https://app.fuel.network/account/${address}/assets/ + - add assets: https://faucet-${selectedNetwork}.fuel.network/ - bech32 address: ${address} `); } From 8b52548c997ac428025e3bcf5b1feff0a0fcbc53 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 20:35:29 +0100 Subject: [PATCH 07/29] chore: updates operations --- .../account/src/providers/operations.graphql | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/packages/account/src/providers/operations.graphql b/packages/account/src/providers/operations.graphql index 6fbc1aebf99..5398436ac5b 100644 --- a/packages/account/src/providers/operations.graphql +++ b/packages/account/src/providers/operations.graphql @@ -212,6 +212,7 @@ fragment messageProofFragment on MessageProof { proofIndex } messageBlockHeader { + version id daHeight consensusParametersVersion @@ -227,6 +228,7 @@ fragment messageProofFragment on MessageProof { applicationHash } commitBlockHeader { + version id daHeight consensusParametersVersion @@ -393,6 +395,9 @@ fragment GasCostsFragment on GasCosts { wqmm xor xori + alocDependentCost { + ...DependentCostFragment + } call { ...DependentCostFragment } @@ -772,8 +777,16 @@ query getRelayedTransactionStatus( } } -mutation dryRun($encodedTransactions: [HexString!]!, $utxoValidation: Boolean) { - dryRun(txs: $encodedTransactions, utxoValidation: $utxoValidation) { +mutation dryRun( + $encodedTransactions: [HexString!]! + $utxoValidation: Boolean + $gasPrice: U64 +) { + dryRun( + txs: $encodedTransactions + utxoValidation: $utxoValidation + gasPrice: $gasPrice + ) { ...dryRunTransactionExecutionStatusFragment } } From 412884c755066330c9c83b4bdd179ac5ad27fe85 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 20:36:10 +0100 Subject: [PATCH 08/29] chore: added alocDependentCost --- .fuel-core/configs/chainConfig.json | 6 ++++++ packages/account/src/providers/fuel-core-schema.graphql | 1 + packages/account/test/fixtures/chain.ts | 5 +++++ .../fuels/test/fixtures/project/.fuels/chainConfig.json | 6 ++++++ packages/utils/src/utils/defaultSnapshots/chainConfig.json | 6 ++++++ 5 files changed, 24 insertions(+) diff --git a/.fuel-core/configs/chainConfig.json b/.fuel-core/configs/chainConfig.json index ff86d200f67..6e8d20bb07a 100644 --- a/.fuel-core/configs/chainConfig.json +++ b/.fuel-core/configs/chainConfig.json @@ -129,6 +129,12 @@ "wqmm": 10, "xor": 2, "xori": 2, + "alloc": { + "LightOperation": { + "base": "2", + "unitsPerGas": "214" + } + }, "call": { "LightOperation": { "base": 18190, diff --git a/packages/account/src/providers/fuel-core-schema.graphql b/packages/account/src/providers/fuel-core-schema.graphql index fa6bf8518ec..a8709c10071 100644 --- a/packages/account/src/providers/fuel-core-schema.graphql +++ b/packages/account/src/providers/fuel-core-schema.graphql @@ -436,6 +436,7 @@ type GasCosts { wqmm: U64! xor: U64! xori: U64! + alocDependentCost: DependentCost! call: DependentCost! ccp: DependentCost! croo: DependentCost! diff --git a/packages/account/test/fixtures/chain.ts b/packages/account/test/fixtures/chain.ts index 9eee0d862b0..75772573ca2 100644 --- a/packages/account/test/fixtures/chain.ts +++ b/packages/account/test/fixtures/chain.ts @@ -139,6 +139,11 @@ export const MOCK_CHAIN: GqlChainInfoFragment = { wqmm: '3', xor: '1', xori: '1', + alocDependentCost: { + type: 'LightOperation', + base: '2', + unitsPerGas: '214', + }, call: { type: 'LightOperation', base: '144', diff --git a/packages/fuels/test/fixtures/project/.fuels/chainConfig.json b/packages/fuels/test/fixtures/project/.fuels/chainConfig.json index 81083c09456..c01adf7e995 100644 --- a/packages/fuels/test/fixtures/project/.fuels/chainConfig.json +++ b/packages/fuels/test/fixtures/project/.fuels/chainConfig.json @@ -129,6 +129,12 @@ "wqmm": 11, "xor": 2, "xori": 2, + "alloc": { + "LightOperation": { + "base": "2", + "unitsPerGas": "214" + } + }, "call": { "LightOperation": { "base": 21687, diff --git a/packages/utils/src/utils/defaultSnapshots/chainConfig.json b/packages/utils/src/utils/defaultSnapshots/chainConfig.json index ff86d200f67..6e8d20bb07a 100644 --- a/packages/utils/src/utils/defaultSnapshots/chainConfig.json +++ b/packages/utils/src/utils/defaultSnapshots/chainConfig.json @@ -129,6 +129,12 @@ "wqmm": 10, "xor": 2, "xori": 2, + "alloc": { + "LightOperation": { + "base": "2", + "unitsPerGas": "214" + } + }, "call": { "LightOperation": { "base": 18190, From 2661c3f21283c7a1fc8b3f26fd203a13f6ccdf09 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 20:37:30 +0100 Subject: [PATCH 09/29] chore: added version to Header --- packages/account/src/providers/fuel-core-schema.graphql | 9 +++++++++ packages/account/test/fixtures/messageProof.ts | 7 ++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/account/src/providers/fuel-core-schema.graphql b/packages/account/src/providers/fuel-core-schema.graphql index a8709c10071..c86dc4626b6 100644 --- a/packages/account/src/providers/fuel-core-schema.graphql +++ b/packages/account/src/providers/fuel-core-schema.graphql @@ -494,6 +494,11 @@ type Genesis { } type Header { + """ + Version of the header + """ + version: HeaderVersion! + """ Hash of the header """ @@ -560,6 +565,10 @@ type Header { applicationHash: Bytes32! } +enum HeaderVersion { + V1 +} + type HeavyOperation { base: U64! gasPerUnit: U64! diff --git a/packages/account/test/fixtures/messageProof.ts b/packages/account/test/fixtures/messageProof.ts index 0088b65ef3e..4d08d5ca574 100644 --- a/packages/account/test/fixtures/messageProof.ts +++ b/packages/account/test/fixtures/messageProof.ts @@ -1,7 +1,10 @@ import { Address } from '@fuel-ts/address'; import { bn } from '@fuel-ts/math'; -import type { GqlGetMessageProofQuery } from '../../src/providers/__generated__/operations'; +import { + GqlHeaderVersion, + type GqlGetMessageProofQuery, +} from '../../src/providers/__generated__/operations'; import type { MessageProof } from '../../src/providers/message'; export const MESSAGE_PROOF_RAW_RESPONSE: GqlGetMessageProofQuery['messageProof'] = { @@ -20,6 +23,7 @@ export const MESSAGE_PROOF_RAW_RESPONSE: GqlGetMessageProofQuery['messageProof'] proofIndex: '432', }, messageBlockHeader: { + version: GqlHeaderVersion.V1, id: '0x864b55089878bf7009d2ff64cbeeeeb75fcd73768785dcb75d54180e7fbaab7b', daHeight: '0', transactionsCount: '2', @@ -35,6 +39,7 @@ export const MESSAGE_PROOF_RAW_RESPONSE: GqlGetMessageProofQuery['messageProof'] messageOutboxRoot: '0x8817eb3173bc39ae465def50f978153fd84ea4badbe3a4e26486ba7f1bcd0579', }, commitBlockHeader: { + version: GqlHeaderVersion.V1, id: '0xe4dfe8fc1b5de2c669efbcc5e4c0a61db175d1b2f03e3cd46ed4396e76695c5b', daHeight: '0', transactionsCount: '2', From 4f00297f4f53e65d11c8face94511c379194952e Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 20:43:21 +0100 Subject: [PATCH 10/29] chore: fix incorrect test network --- packages/account/src/configs.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account/src/configs.test.ts b/packages/account/src/configs.test.ts index 1c29c74e6f2..9e3e234e833 100644 --- a/packages/account/src/configs.test.ts +++ b/packages/account/src/configs.test.ts @@ -9,7 +9,7 @@ describe('Configs', () => { it('exports FUEL_DEVNET_NETWORK_URL', async () => { const configs = await import('./configs'); - expect(configs.FUEL_TESTNET_NETWORK_URL).toBe('https://devnet.fuel.network/v1/graphql'); + expect(configs.FUEL_DEVNET_NETWORK_URL).toBe('https://devnet.fuel.network/v1/graphql'); }); it('exports FUEL_TESTNET_NETWORK_URL', async () => { From ab300f99768bcf0628ec5343faa17f261bb40871 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 20:51:41 +0100 Subject: [PATCH 11/29] chore: ensure we don't connect to the live network --- .../src/guide/introduction/getting-started.test.ts | 5 +++-- .../src/guide/wallets/instantiating-wallets.test.ts | 10 ++++++++-- packages/fuel-gauge/src/doc-examples.test.ts | 6 ++++++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/apps/docs-snippets/src/guide/introduction/getting-started.test.ts b/apps/docs-snippets/src/guide/introduction/getting-started.test.ts index eb6173d0eef..2fb1620a84a 100644 --- a/apps/docs-snippets/src/guide/introduction/getting-started.test.ts +++ b/apps/docs-snippets/src/guide/introduction/getting-started.test.ts @@ -11,9 +11,10 @@ import { * @group browser */ describe('Getting started', () => { - beforeAll(() => { + beforeAll(async () => { // Avoids using the actual network. - vi.spyOn(Provider, 'create').mockImplementationOnce(() => Provider.create(FUEL_NETWORK_URL)); + const mockProvider = await Provider.create(FUEL_NETWORK_URL); + vi.spyOn(Provider, 'create').mockResolvedValue(mockProvider); }); it('can connect to a local network', async () => { diff --git a/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts b/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts index 7dcbad01650..c3ec1f0727c 100644 --- a/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts +++ b/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts @@ -1,10 +1,16 @@ import type { WalletLocked, WalletUnlocked } from 'fuels'; -import { FUEL_NETWORK_URL, HDWallet, Provider, Wallet } from 'fuels'; +import { FUEL_NETWORK_URL, FUEL_TESTNET_NETWORK_URL, HDWallet, Provider, Wallet } from 'fuels'; /** * @group node */ describe(__filename, () => { + beforeAll(async () => { + // Avoids using the actual network. + const mockProvider = await Provider.create(FUEL_NETWORK_URL); + vi.spyOn(Provider, 'create').mockResolvedValue(mockProvider); + }); + it('should generate a new wallet just fine', () => { // #region instantiating-wallets-1 const unlockedWallet: WalletUnlocked = Wallet.generate(); @@ -100,7 +106,7 @@ describe(__filename, () => { const myWallet = Wallet.fromAddress(address); // #region instantiating-wallets-9 - const provider = await Provider.create('https://testnet.fuel.network/v1/graphql'); + const provider = await Provider.create(FUEL_TESTNET_NETWORK_URL); myWallet.connect(provider); // #endregion instantiating-wallets-9 diff --git a/packages/fuel-gauge/src/doc-examples.test.ts b/packages/fuel-gauge/src/doc-examples.test.ts index 83492903096..85c6156d6e3 100644 --- a/packages/fuel-gauge/src/doc-examples.test.ts +++ b/packages/fuel-gauge/src/doc-examples.test.ts @@ -60,6 +60,12 @@ const ADDRESS_BYTES = new Uint8Array([ describe('Doc Examples', () => { let baseAssetId: string; + beforeAll(async () => { + // Avoids using the actual network. + const mockProvider = await Provider.create(FUEL_NETWORK_URL); + vi.spyOn(Provider, 'create').mockResolvedValue(mockProvider); + }); + beforeAll(async () => { const provider = await Provider.create(FUEL_NETWORK_URL); baseAssetId = provider.getBaseAssetId(); From 077b69f3efbbe9569857eb7b12effbc838447c92 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 21:03:06 +0100 Subject: [PATCH 12/29] chore: added Block.version --- packages/account/src/providers/fuel-core-schema.graphql | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/account/src/providers/fuel-core-schema.graphql b/packages/account/src/providers/fuel-core-schema.graphql index c86dc4626b6..4e944f40255 100644 --- a/packages/account/src/providers/fuel-core-schema.graphql +++ b/packages/account/src/providers/fuel-core-schema.graphql @@ -48,6 +48,7 @@ input BalanceFilterInput { } type Block { + version: BlockVersion! id: BlockId! height: U32! header: Header! @@ -89,6 +90,10 @@ type BlockEdge { scalar BlockId +enum BlockVersion { + V1 +} + """ Breakpoint, defined as a tuple of contract ID and relative PC offset inside it """ From c234d194f84c9cd8bae595e9a890441c63e648f9 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 21:04:00 +0100 Subject: [PATCH 13/29] chore: added `gasPrice` to the dryRun --- packages/account/src/providers/fuel-core-schema.graphql | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/account/src/providers/fuel-core-schema.graphql b/packages/account/src/providers/fuel-core-schema.graphql index 4e944f40255..5cd6a3e2e4c 100644 --- a/packages/account/src/providers/fuel-core-schema.graphql +++ b/packages/account/src/providers/fuel-core-schema.graphql @@ -754,6 +754,7 @@ type Mutation { dryRun( txs: [HexString!]! utxoValidation: Boolean + gasPrice: U64 ): [DryRunTransactionExecutionStatus!]! """ From f967b68881b4074f3d362a78b0711cd6e6723398 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 21:06:04 +0100 Subject: [PATCH 14/29] chore: point e2e test to devnet --- packages/fuel-gauge/src/e2e-script.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 6755700a955..08278b37b6d 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -29,7 +29,7 @@ describe('Live Script Test', () => { const UPGRADE_TX_ID = '0xe2c03044fe708e9b112027881baf9f892e6b64a630a629998922c1cab918c094'; const UPLOAD_TX_ID = '0x94bc2a189b8211796c8fe5b9c6b67624fe97d2007e104bf1b30739944f43bd73'; - const selectedNetwork: keyof typeof networks = 'testnet'; + const selectedNetwork: keyof typeof networks = 'devnet'; let provider: Provider; let wallet: WalletUnlocked; let shouldSkip: boolean; From f10a67d5f4125066721fe476faffabde21904d26 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 21:11:55 +0100 Subject: [PATCH 15/29] chore: changeset --- .changeset/breezy-hounds-crash.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/breezy-hounds-crash.md diff --git a/.changeset/breezy-hounds-crash.md b/.changeset/breezy-hounds-crash.md new file mode 100644 index 00000000000..937aa552b13 --- /dev/null +++ b/.changeset/breezy-hounds-crash.md @@ -0,0 +1,7 @@ +--- +"@fuel-ts/versions": patch +"@fuel-ts/account": patch +"fuels": patch +--- + +chore: upgrade fuel core to `0.28.0` From 89667c895825a4d3ee9c98f928d8b517dcfc66c1 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Mon, 10 Jun 2024 22:13:07 +0100 Subject: [PATCH 16/29] ci: added missing envs --- .github/workflows/test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9f6b32a3d9c..0cbb68d787c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,7 +79,8 @@ jobs: - name: Run Isolated Tests run: pnpm test:e2e env: - TEST_WALLET_PVT_KEY: ${{ secrets.TEST_WALLET_PVT_KEY }} + TESTNET_WALLET_PVT_KEY: ${{ secrets.TESTNET_WALLET_PVT_KEY }} + DEVNET_WALLET_PVT_KEY: ${{ secrets.DEVNET_WALLET_PVT_KEY }} PUBLISHED_NPM_VERSION: ${{ steps.release.outputs.published_version }} create-fuels-template-integration: From 1861e13fa45f3635c3256e9e333fc8a272a0f91f Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 07:40:34 +0100 Subject: [PATCH 17/29] chore: removed `FUEL_` prefix from network urls --- .changeset/breezy-hounds-crash.md | 6 +++--- .../src/guide/introduction/getting-started.test.ts | 12 +++--------- .../src/guide/wallets/instantiating-wallets.test.ts | 4 ++-- packages/account/src/configs.test.ts | 8 ++++---- packages/account/src/configs.ts | 4 ++-- packages/fuel-gauge/src/doc-examples.test.ts | 4 ++-- packages/fuel-gauge/src/e2e-script.test.ts | 8 ++++---- 7 files changed, 20 insertions(+), 26 deletions(-) diff --git a/.changeset/breezy-hounds-crash.md b/.changeset/breezy-hounds-crash.md index 937aa552b13..d9ccdf41de5 100644 --- a/.changeset/breezy-hounds-crash.md +++ b/.changeset/breezy-hounds-crash.md @@ -1,7 +1,7 @@ --- "@fuel-ts/versions": patch -"@fuel-ts/account": patch -"fuels": patch +"@fuel-ts/account": minor +"fuels": minor --- -chore: upgrade fuel core to `0.28.0` +chore!: upgrade fuel core to `0.28.0` diff --git a/apps/docs-snippets/src/guide/introduction/getting-started.test.ts b/apps/docs-snippets/src/guide/introduction/getting-started.test.ts index 2fb1620a84a..533b2be3f49 100644 --- a/apps/docs-snippets/src/guide/introduction/getting-started.test.ts +++ b/apps/docs-snippets/src/guide/introduction/getting-started.test.ts @@ -1,10 +1,4 @@ -import { - FUEL_NETWORK_URL, - FUEL_TESTNET_NETWORK_URL, - Provider, - Wallet, - WalletUnlocked, -} from 'fuels'; +import { FUEL_NETWORK_URL, TESTNET_NETWORK_URL, Provider, Wallet, WalletUnlocked } from 'fuels'; /** * @group node @@ -38,10 +32,10 @@ describe('Getting started', () => { it('can connect to testnet', async () => { // #region connecting-to-the-testnet - // #import { Provider, Wallet, FUEL_TESTNET_NETWORK_URL }; + // #import { Provider, Wallet, TESTNET_NETWORK_URL }; // Create a provider, with the Latest Testnet URL. - const provider = await Provider.create(FUEL_TESTNET_NETWORK_URL); + const provider = await Provider.create(TESTNET_NETWORK_URL); // Create our wallet (with a private key). const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568'; diff --git a/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts b/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts index c3ec1f0727c..6c73f4df129 100644 --- a/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts +++ b/apps/docs-snippets/src/guide/wallets/instantiating-wallets.test.ts @@ -1,5 +1,5 @@ import type { WalletLocked, WalletUnlocked } from 'fuels'; -import { FUEL_NETWORK_URL, FUEL_TESTNET_NETWORK_URL, HDWallet, Provider, Wallet } from 'fuels'; +import { FUEL_NETWORK_URL, TESTNET_NETWORK_URL, HDWallet, Provider, Wallet } from 'fuels'; /** * @group node @@ -106,7 +106,7 @@ describe(__filename, () => { const myWallet = Wallet.fromAddress(address); // #region instantiating-wallets-9 - const provider = await Provider.create(FUEL_TESTNET_NETWORK_URL); + const provider = await Provider.create(TESTNET_NETWORK_URL); myWallet.connect(provider); // #endregion instantiating-wallets-9 diff --git a/packages/account/src/configs.test.ts b/packages/account/src/configs.test.ts index 9e3e234e833..5f2acc94807 100644 --- a/packages/account/src/configs.test.ts +++ b/packages/account/src/configs.test.ts @@ -7,14 +7,14 @@ describe('Configs', () => { expect(configs.FUEL_NETWORK_URL).toBe('http://127.0.0.1:4000/v1/graphql'); }); - it('exports FUEL_DEVNET_NETWORK_URL', async () => { + it('exports DEVNET_NETWORK_URL', async () => { const configs = await import('./configs'); - expect(configs.FUEL_DEVNET_NETWORK_URL).toBe('https://devnet.fuel.network/v1/graphql'); + expect(configs.DEVNET_NETWORK_URL).toBe('https://devnet.fuel.network/v1/graphql'); }); - it('exports FUEL_TESTNET_NETWORK_URL', async () => { + it('exports TESTNET_NETWORK_URL', async () => { const configs = await import('./configs'); - expect(configs.FUEL_TESTNET_NETWORK_URL).toBe('https://testnet.fuel.network/v1/graphql'); + expect(configs.TESTNET_NETWORK_URL).toBe('https://testnet.fuel.network/v1/graphql'); }); }); diff --git a/packages/account/src/configs.ts b/packages/account/src/configs.ts index 6e4e390863e..f4b7dfc4b4e 100644 --- a/packages/account/src/configs.ts +++ b/packages/account/src/configs.ts @@ -3,5 +3,5 @@ export const FUEL_NETWORK_URL: string = ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql' : 'http://127.0.0.1:4000/v1/graphql'; -export const FUEL_DEVNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql'; -export const FUEL_TESTNET_NETWORK_URL: string = 'https://testnet.fuel.network/v1/graphql'; +export const DEVNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql'; +export const TESTNET_NETWORK_URL: string = 'https://testnet.fuel.network/v1/graphql'; diff --git a/packages/fuel-gauge/src/doc-examples.test.ts b/packages/fuel-gauge/src/doc-examples.test.ts index 85c6156d6e3..daf96673de8 100644 --- a/packages/fuel-gauge/src/doc-examples.test.ts +++ b/packages/fuel-gauge/src/doc-examples.test.ts @@ -24,7 +24,7 @@ import { Signer, ZeroBytes32, FUEL_NETWORK_URL, - FUEL_TESTNET_NETWORK_URL, + TESTNET_NETWORK_URL, } from 'fuels'; import { FuelGaugeProjectsEnum, getFuelGaugeForcProject } from '../test/fixtures'; @@ -245,7 +245,7 @@ describe('Doc Examples', () => { }); it('can connect to testnet', async () => { - const provider = await Provider.create(FUEL_TESTNET_NETWORK_URL); + const provider = await Provider.create(TESTNET_NETWORK_URL); const PRIVATE_KEY = 'a1447cd75accc6b71a976fd3401a1f6ce318d27ba660b0315ee6ac347bf39568'; const wallet = Wallet.fromPrivateKey(PRIVATE_KEY, provider); diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 08278b37b6d..c1f608bcf3a 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -1,7 +1,7 @@ /* eslint-disable no-console */ import { - FUEL_DEVNET_NETWORK_URL, - FUEL_TESTNET_NETWORK_URL, + DEVNET_NETWORK_URL, + TESTNET_NETWORK_URL, Provider, TransactionType, WalletUnlocked, @@ -11,11 +11,11 @@ import { getScript } from './utils'; const networks = { devnet: { - networkUrl: FUEL_DEVNET_NETWORK_URL, + networkUrl: DEVNET_NETWORK_URL, privateKey: process.env.DEVNET_WALLET_PVT_KEY, }, testnet: { - networkUrl: FUEL_TESTNET_NETWORK_URL, + networkUrl: TESTNET_NETWORK_URL, privateKey: process.env.TESTNET_WALLET_PVT_KEY, }, } as const; From 2a77256d2563f1b30b669668c4aee81540bda81c Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 07:41:38 +0100 Subject: [PATCH 18/29] chore: removed type from network urls --- packages/account/src/configs.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/account/src/configs.ts b/packages/account/src/configs.ts index f4b7dfc4b4e..75236c7f461 100644 --- a/packages/account/src/configs.ts +++ b/packages/account/src/configs.ts @@ -3,5 +3,5 @@ export const FUEL_NETWORK_URL: string = ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql' : 'http://127.0.0.1:4000/v1/graphql'; -export const DEVNET_NETWORK_URL: string = 'https://devnet.fuel.network/v1/graphql'; -export const TESTNET_NETWORK_URL: string = 'https://testnet.fuel.network/v1/graphql'; +export const DEVNET_NETWORK_URL = 'https://devnet.fuel.network/v1/graphql'; +export const TESTNET_NETWORK_URL = 'https://testnet.fuel.network/v1/graphql'; From d9cd0e9ddb7727283b50575b974e8706bfcae7bd Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 08:03:55 +0100 Subject: [PATCH 19/29] chore: added ability to run e2e against multiple networks --- .github/workflows/test.yaml | 1 + packages/fuel-gauge/src/e2e-script.test.ts | 37 +++++++++++++++------- 2 files changed, 27 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 0cbb68d787c..9cc4cb81c4e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,6 +79,7 @@ jobs: - name: Run Isolated Tests run: pnpm test:e2e env: + SHOULD_SKIP_E2E: false TESTNET_WALLET_PVT_KEY: ${{ secrets.TESTNET_WALLET_PVT_KEY }} DEVNET_WALLET_PVT_KEY: ${{ secrets.DEVNET_WALLET_PVT_KEY }} PUBLISHED_NPM_VERSION: ${{ steps.release.outputs.published_version }} diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index c1f608bcf3a..8e693f69e67 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -5,46 +5,61 @@ import { Provider, TransactionType, WalletUnlocked, + FuelError, } from 'fuels'; import { getScript } from './utils'; -const networks = { - devnet: { +enum Networks { + DEVNET = 'devnet', + TESTNET = 'testnet', +} + +const configuredNetworks = { + [Networks.DEVNET]: { networkUrl: DEVNET_NETWORK_URL, privateKey: process.env.DEVNET_WALLET_PVT_KEY, + faucetUrl: `https://faucet-devnet.fuel.network/`, }, - testnet: { + [Networks.TESTNET]: { networkUrl: TESTNET_NETWORK_URL, privateKey: process.env.TESTNET_WALLET_PVT_KEY, + faucetUrl: `https://faucet-testnet.fuel.network/`, }, } as const; +const selectedNetworks: Networks[] = [Networks.DEVNET]; + /** * @group node * @group e2e */ -describe('Live Script Test', () => { +describe.each(selectedNetworks)('Live Script Test', (selectedNetwork) => { const MINT_TX_ID = '0x03299946676ddc0044a52a675dd201d3173886c998a7301262141334b6d5a29e'; const UPGRADE_TX_ID = '0xe2c03044fe708e9b112027881baf9f892e6b64a630a629998922c1cab918c094'; const UPLOAD_TX_ID = '0x94bc2a189b8211796c8fe5b9c6b67624fe97d2007e104bf1b30739944f43bd73'; - const selectedNetwork: keyof typeof networks = 'devnet'; let provider: Provider; let wallet: WalletUnlocked; let shouldSkip: boolean; beforeAll(async () => { - const network = networks[selectedNetwork]; - - if (!network.privateKey) { + if (process.env.SHOULD_SKIP_E2E === 'true') { console.log('Skipping live Fuel Node test'); shouldSkip = true; return; } - provider = await Provider.create(network.networkUrl); - wallet = new WalletUnlocked(network.privateKey, provider); + const { networkUrl, privateKey } = configuredNetworks[selectedNetwork]; + if (!privateKey) { + throw new FuelError( + FuelError.CODES.MISSING_REQUIRED_PARAMETER, + `Missing private key for network: '${selectedNetwork}'` + ); + } + + provider = await Provider.create(networkUrl); + wallet = new WalletUnlocked(privateKey, provider); }); it('can use script against live Fuel Node', async () => { @@ -67,7 +82,7 @@ describe('Live Script Test', () => { console.error((e as Error).message); console.warn(` not enough coins to fit the target? - - add assets: https://faucet-${selectedNetwork}.fuel.network/ + - add assets: ${configuredNetworks[selectedNetwork].faucetUrl} - bech32 address: ${address} `); } From 33f2f0a9e062799ab253c35f791723f3cc830f37 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 08:31:14 +0100 Subject: [PATCH 20/29] chore: revert back to skipping when private key missing --- packages/fuel-gauge/src/e2e-script.test.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 8e693f69e67..f7c5801aaf5 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -44,20 +44,13 @@ describe.each(selectedNetworks)('Live Script Test', (selectedNetwork) => { let shouldSkip: boolean; beforeAll(async () => { - if (process.env.SHOULD_SKIP_E2E === 'true') { + const { networkUrl, privateKey } = configuredNetworks[selectedNetwork]; + if (!privateKey) { console.log('Skipping live Fuel Node test'); shouldSkip = true; return; } - const { networkUrl, privateKey } = configuredNetworks[selectedNetwork]; - if (!privateKey) { - throw new FuelError( - FuelError.CODES.MISSING_REQUIRED_PARAMETER, - `Missing private key for network: '${selectedNetwork}'` - ); - } - provider = await Provider.create(networkUrl); wallet = new WalletUnlocked(privateKey, provider); }); From ad84110c6eb69163c75c2f0f34490279e3fe95a3 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 08:55:43 +0100 Subject: [PATCH 21/29] chore: linting --- packages/fuel-gauge/src/e2e-script.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index f7c5801aaf5..06beb40fd8d 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -5,7 +5,6 @@ import { Provider, TransactionType, WalletUnlocked, - FuelError, } from 'fuels'; import { getScript } from './utils'; From d917bf98bff0ba345ca58c80cb90c43ace8c4150 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 11:32:45 +0100 Subject: [PATCH 22/29] chore: reconfigured the e2e transaction tests --- packages/fuel-gauge/src/e2e-script.test.ts | 48 ++++++++++++++++------ 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 06beb40fd8d..07c4c85fb9b 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -14,18 +14,37 @@ enum Networks { TESTNET = 'testnet', } +type ConfiguredNetwork = { + networkUrl: string; + privateKey?: string; + faucetUrl: string; + transactions?: { + [TransactionType.Mint]: string; + [TransactionType.Upgrade]: string; + [TransactionType.Upload]: string; + }; +}; + const configuredNetworks = { [Networks.DEVNET]: { networkUrl: DEVNET_NETWORK_URL, privateKey: process.env.DEVNET_WALLET_PVT_KEY, faucetUrl: `https://faucet-devnet.fuel.network/`, - }, + transactions: { + [TransactionType.Mint]: '0x03299946676ddc0044a52a675dd201d3173886c998a7301262141334b6d5a29e', + [TransactionType.Upgrade]: + '0xe2c03044fe708e9b112027881baf9f892e6b64a630a629998922c1cab918c094', + [TransactionType.Upload]: + '0x94bc2a189b8211796c8fe5b9c6b67624fe97d2007e104bf1b30739944f43bd73', + }, + } as ConfiguredNetwork, [Networks.TESTNET]: { networkUrl: TESTNET_NETWORK_URL, privateKey: process.env.TESTNET_WALLET_PVT_KEY, faucetUrl: `https://faucet-testnet.fuel.network/`, - }, -} as const; + transactions: undefined, + } as ConfiguredNetwork, +}; const selectedNetworks: Networks[] = [Networks.DEVNET]; @@ -34,10 +53,6 @@ const selectedNetworks: Networks[] = [Networks.DEVNET]; * @group e2e */ describe.each(selectedNetworks)('Live Script Test', (selectedNetwork) => { - const MINT_TX_ID = '0x03299946676ddc0044a52a675dd201d3173886c998a7301262141334b6d5a29e'; - const UPGRADE_TX_ID = '0xe2c03044fe708e9b112027881baf9f892e6b64a630a629998922c1cab918c094'; - const UPLOAD_TX_ID = '0x94bc2a189b8211796c8fe5b9c6b67624fe97d2007e104bf1b30739944f43bd73'; - let provider: Provider; let wallet: WalletUnlocked; let shouldSkip: boolean; @@ -82,16 +97,23 @@ describe.each(selectedNetworks)('Live Script Test', (selectedNetwork) => { expect(output).toBe(true); }); - it.skip.each([ - ['Mint', MINT_TX_ID, TransactionType.Mint], - ['Upgrade', UPGRADE_TX_ID, TransactionType.Upgrade], - ['Upload', UPLOAD_TX_ID, TransactionType.Upload], - ])('can query and decode a %s transaction', async (_, txId, type) => { + it.each([ + ['Mint', TransactionType.Mint], + ['Upgrade', TransactionType.Upgrade], + ['Upload', TransactionType.Upload], + ])('can query and decode a %s transaction', async (_, type) => { if (shouldSkip) { return; } - const transaction = await provider.getTransaction(txId); + const { transactions } = configuredNetworks[selectedNetwork]; + if (undefined === transactions) { + console.log(`Skipping ${type} transaction test for ${selectedNetwork} network`); + return; + } + + const txId = transactions[type as keyof ConfiguredNetwork['transactions']]; + const transaction = await provider.getTransaction(txId); expect(transaction?.type).toBe(type); }); }); From 162df8d3dc0c836cd788687a81fc8a76dcb4a9b9 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 18:06:17 +0100 Subject: [PATCH 23/29] chore: address el nits --- packages/fuel-gauge/src/e2e-script.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 07c4c85fb9b..502a44e2a0c 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -18,7 +18,7 @@ type ConfiguredNetwork = { networkUrl: string; privateKey?: string; faucetUrl: string; - transactions?: { + txIds?: { [TransactionType.Mint]: string; [TransactionType.Upgrade]: string; [TransactionType.Upload]: string; @@ -30,7 +30,7 @@ const configuredNetworks = { networkUrl: DEVNET_NETWORK_URL, privateKey: process.env.DEVNET_WALLET_PVT_KEY, faucetUrl: `https://faucet-devnet.fuel.network/`, - transactions: { + txIds: { [TransactionType.Mint]: '0x03299946676ddc0044a52a675dd201d3173886c998a7301262141334b6d5a29e', [TransactionType.Upgrade]: '0xe2c03044fe708e9b112027881baf9f892e6b64a630a629998922c1cab918c094', @@ -42,7 +42,7 @@ const configuredNetworks = { networkUrl: TESTNET_NETWORK_URL, privateKey: process.env.TESTNET_WALLET_PVT_KEY, faucetUrl: `https://faucet-testnet.fuel.network/`, - transactions: undefined, + txIds: undefined, } as ConfiguredNetwork, }; @@ -106,13 +106,13 @@ describe.each(selectedNetworks)('Live Script Test', (selectedNetwork) => { return; } - const { transactions } = configuredNetworks[selectedNetwork]; - if (undefined === transactions) { + const { txIds } = configuredNetworks[selectedNetwork]; + if (undefined === txIds) { console.log(`Skipping ${type} transaction test for ${selectedNetwork} network`); return; } - const txId = transactions[type as keyof ConfiguredNetwork['transactions']]; + const txId = txIds[type as keyof ConfiguredNetwork['txIds']]; const transaction = await provider.getTransaction(txId); expect(transaction?.type).toBe(type); }); From 576a96c8567426a4caeb2719bac38c40afebe77d Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 18:08:38 +0100 Subject: [PATCH 24/29] chore: added `txIds` for `testnet` --- packages/fuel-gauge/src/e2e-script.test.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 502a44e2a0c..ce9f7bb27b8 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -42,7 +42,13 @@ const configuredNetworks = { networkUrl: TESTNET_NETWORK_URL, privateKey: process.env.TESTNET_WALLET_PVT_KEY, faucetUrl: `https://faucet-testnet.fuel.network/`, - txIds: undefined, + txIds: { + [TransactionType.Mint]: '0x4a7b49a5dcc4b4ff65f13429ba09c0dbfb2ca21f2f16ebe4b495bc73c2979f3b', + [TransactionType.Upgrade]: + '0xd64e3f7589bc1c6dcf1e419f4a3a8fc21d3694abf98f151000f34682d1cacdce', + [TransactionType.Upload]: + '0x996eec87a702ac978663fe67dbde7ab94d31f32b1860fbfc527d4b5447b3446c', + }, } as ConfiguredNetwork, }; From c116b5214e1abec9906864a5eab839484b2790d2 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Tue, 11 Jun 2024 19:15:58 +0100 Subject: [PATCH 25/29] chore: combine e2e assets and script --- packages/fuel-gauge/src/e2e-assets.test.ts | 60 ---------------------- packages/fuel-gauge/src/e2e-script.test.ts | 29 +++++++++++ 2 files changed, 29 insertions(+), 60 deletions(-) delete mode 100644 packages/fuel-gauge/src/e2e-assets.test.ts diff --git a/packages/fuel-gauge/src/e2e-assets.test.ts b/packages/fuel-gauge/src/e2e-assets.test.ts deleted file mode 100644 index ee425430bc7..00000000000 --- a/packages/fuel-gauge/src/e2e-assets.test.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* eslint-disable no-console */ -import { - Provider, - DEVNET_NETWORK_URL, - TESTNET_NETWORK_URL, - assets, - CHAIN_IDS, - rawAssets, -} from 'fuels'; - -type FuelChainId = keyof typeof CHAIN_IDS.fuel; - -/** - * @group e2e - */ -describe('e2e-assets', () => { - let shouldSkip: boolean = false; - let networks: [string, Provider][] = []; - - beforeAll(async () => { - if (!process.env.CI) { - console.log('Skipping live assets compatibility test'); - shouldSkip = true; - return; - } - - networks = [ - ['devnet', await Provider.create(DEVNET_NETWORK_URL)], - ['testnet', await Provider.create(TESTNET_NETWORK_URL)], - ]; - }); - - it(`should have correct assets`, () => { - if (shouldSkip) { - return; - } - - for (const [chainKey, provider] of networks) { - const expected = [ - { - name: 'Ethereum', - symbol: 'ETH', - icon: expect.stringContaining('eth.svg'), - networks: expect.arrayContaining([ - { - type: 'fuel', - decimals: 9, - chainId: provider.getChainId(), - assetId: provider.getBaseAssetId(), - }, - ]), - }, - ]; - - expect(CHAIN_IDS.fuel[chainKey as FuelChainId]).toEqual(provider.getChainId()); - expect(rawAssets).toEqual(expected); - expect(assets).toEqual(expected); - } - }); -}); diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index ce9f7bb27b8..ec3c039e06b 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -5,6 +5,9 @@ import { Provider, TransactionType, WalletUnlocked, + CHAIN_IDS, + rawAssets, + assets, } from 'fuels'; import { getScript } from './utils'; @@ -122,4 +125,30 @@ describe.each(selectedNetworks)('Live Script Test', (selectedNetwork) => { const transaction = await provider.getTransaction(txId); expect(transaction?.type).toBe(type); }); + + it(`should have correct assets`, () => { + if (shouldSkip) { + return; + } + + const expected = [ + { + name: 'Ethereum', + symbol: 'ETH', + icon: expect.stringContaining('eth.svg'), + networks: expect.arrayContaining([ + { + type: 'fuel', + decimals: 9, + chainId: provider.getChainId(), + assetId: provider.getBaseAssetId(), + }, + ]), + }, + ]; + + expect(CHAIN_IDS.fuel[selectedNetwork]).toEqual(provider.getChainId()); + expect(rawAssets).toEqual(expected); + expect(assets).toEqual(expected); + }); }); From 5c42df78f82eb066fc7146b9722658530fca8de7 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Wed, 12 Jun 2024 07:58:20 +0100 Subject: [PATCH 26/29] chore: added all network URLS --- packages/account/src/configs.test.ts | 5 +++++ packages/account/src/configs.ts | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/account/src/configs.test.ts b/packages/account/src/configs.test.ts index 5f2acc94807..96a0a598347 100644 --- a/packages/account/src/configs.test.ts +++ b/packages/account/src/configs.test.ts @@ -7,6 +7,11 @@ describe('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'); diff --git a/packages/account/src/configs.ts b/packages/account/src/configs.ts index 75236c7f461..9d150651fff 100644 --- a/packages/account/src/configs.ts +++ b/packages/account/src/configs.ts @@ -1,7 +1,10 @@ -export const FUEL_NETWORK_URL: string = - typeof process !== 'undefined' - ? process?.env?.FUEL_NETWORK_URL || 'http://127.0.0.1:4000/v1/graphql' - : 'http://127.0.0.1:4000/v1/graphql'; - +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; From a0e0e41aad77d02501476605b81d9b9e20664c8a Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Wed, 12 Jun 2024 10:11:31 +0100 Subject: [PATCH 27/29] chore: removed redundant env Co-authored-by: Daniel Bate --- .github/workflows/test.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9cc4cb81c4e..0cbb68d787c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -79,7 +79,6 @@ jobs: - name: Run Isolated Tests run: pnpm test:e2e env: - SHOULD_SKIP_E2E: false TESTNET_WALLET_PVT_KEY: ${{ secrets.TESTNET_WALLET_PVT_KEY }} DEVNET_WALLET_PVT_KEY: ${{ secrets.DEVNET_WALLET_PVT_KEY }} PUBLISHED_NPM_VERSION: ${{ steps.release.outputs.published_version }} From 6fe0d24b6272ce2e492136085ffc6fa92258dfda Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Wed, 12 Jun 2024 12:18:09 +0100 Subject: [PATCH 28/29] chore: fixed chain config --- .fuel-core/configs/chainConfig.json | 2 +- packages/fuels/test/fixtures/project/.fuels/chainConfig.json | 2 +- packages/utils/src/utils/defaultSnapshots/chainConfig.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.fuel-core/configs/chainConfig.json b/.fuel-core/configs/chainConfig.json index 6e8d20bb07a..cf7b258e219 100644 --- a/.fuel-core/configs/chainConfig.json +++ b/.fuel-core/configs/chainConfig.json @@ -129,7 +129,7 @@ "wqmm": 10, "xor": 2, "xori": 2, - "alloc": { + "alocDependentCost": { "LightOperation": { "base": "2", "unitsPerGas": "214" diff --git a/packages/fuels/test/fixtures/project/.fuels/chainConfig.json b/packages/fuels/test/fixtures/project/.fuels/chainConfig.json index c01adf7e995..422b73de6fc 100644 --- a/packages/fuels/test/fixtures/project/.fuels/chainConfig.json +++ b/packages/fuels/test/fixtures/project/.fuels/chainConfig.json @@ -129,7 +129,7 @@ "wqmm": 11, "xor": 2, "xori": 2, - "alloc": { + "alocDependentCost": { "LightOperation": { "base": "2", "unitsPerGas": "214" diff --git a/packages/utils/src/utils/defaultSnapshots/chainConfig.json b/packages/utils/src/utils/defaultSnapshots/chainConfig.json index 6e8d20bb07a..cf7b258e219 100644 --- a/packages/utils/src/utils/defaultSnapshots/chainConfig.json +++ b/packages/utils/src/utils/defaultSnapshots/chainConfig.json @@ -129,7 +129,7 @@ "wqmm": 10, "xor": 2, "xori": 2, - "alloc": { + "alocDependentCost": { "LightOperation": { "base": "2", "unitsPerGas": "214" From 80d0ed740d4765ff37a4ea63b39476f1bf9236f7 Mon Sep 17 00:00:00 2001 From: Peter Smith Date: Thu, 13 Jun 2024 21:08:26 +0100 Subject: [PATCH 29/29] chore: added missing testnet test case Co-authored-by: Anderson Arboleya --- packages/fuel-gauge/src/e2e-script.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fuel-gauge/src/e2e-script.test.ts b/packages/fuel-gauge/src/e2e-script.test.ts index 80b196d6ff9..6813435d06b 100644 --- a/packages/fuel-gauge/src/e2e-script.test.ts +++ b/packages/fuel-gauge/src/e2e-script.test.ts @@ -53,7 +53,7 @@ const configuredNetworks = { } as ConfiguredNetwork, }; -const selectedNetworks: Networks[] = [Networks.DEVNET]; +const selectedNetworks: Networks[] = [Networks.DEVNET, Networks.TESTNET]; /** * @group node