diff --git a/packages/burner-wallet-connector/src/BurnerWalletConnector.ts b/packages/burner-wallet-connector/src/BurnerWalletConnector.ts index 5595d6b6..90838f1f 100644 --- a/packages/burner-wallet-connector/src/BurnerWalletConnector.ts +++ b/packages/burner-wallet-connector/src/BurnerWalletConnector.ts @@ -59,7 +59,7 @@ export class BurnerWalletConnector extends FuelConnector { } private configProvider(config: BurnerWalletConfig = {}) { - const network = getProviderUrl(config.chainId ?? CHAIN_IDS.fuel.mainnet); + const network = getProviderUrl(config.chainId ?? CHAIN_IDS.fuel.testnet); this.config = Object.assign(config, { fuelProvider: config.fuelProvider || Provider.create(network), }); diff --git a/packages/burner-wallet-connector/src/tests/burnerWalletConnector.test.ts b/packages/burner-wallet-connector/src/tests/burnerWalletConnector.test.ts index 580d2272..3d40540a 100644 --- a/packages/burner-wallet-connector/src/tests/burnerWalletConnector.test.ts +++ b/packages/burner-wallet-connector/src/tests/burnerWalletConnector.test.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import { MAINNET_NETWORK } from '@fuel-connectors/common'; +import { TESTNET_NETWORK } from '@fuel-connectors/common'; import { type Asset, type Network, Provider, Wallet } from 'fuels'; import { launchTestNode } from 'fuels/test-utils'; import { @@ -17,8 +17,6 @@ import { BURNER_WALLET_PRIVATE_KEY } from '../constants'; import type { BurnerWalletConfig } from '../types'; import { createMockedStorage } from './mockedStorage'; -const TESTNET_URL = 'https://testnet.fuel.network/v1/graphql'; - const mockConfirm = vi.fn(); window.confirm = mockConfirm; @@ -74,7 +72,7 @@ describe('Burner Wallet Connector', () => { expect(connector.connected).to.be.false; expect(connector.installed).to.be.true; expect(await connector.currentNetwork()).to.be.deep.equal( - MAINNET_NETWORK, + TESTNET_NETWORK, ); }); @@ -149,7 +147,7 @@ describe('Burner Wallet Connector', () => { }); test('Creates a new BurnerWalletConnector instance with non default Provider url', async () => { - const nonDefaultProvider = await Provider.create(TESTNET_URL); + const nonDefaultProvider = await Provider.create(TESTNET_NETWORK.url); const config: BurnerWalletConfig = { fuelProvider: nonDefaultProvider, @@ -157,14 +155,13 @@ describe('Burner Wallet Connector', () => { const connector = await getBurnerWallet(config); expect(connector).to.be.an.instanceOf(BurnerWalletConnector); - expect(await connector.currentNetwork()).to.be.deep.equal({ - chainId: 0, - url: TESTNET_URL, - }); + expect(await connector.currentNetwork()).to.be.deep.equal( + TESTNET_NETWORK, + ); }); test('Creates a new BurnerWalletConnector instance with non default Promise Provider url', async () => { - const nonDefaultProvider = Provider.create(TESTNET_URL); + const nonDefaultProvider = Provider.create(TESTNET_NETWORK.url); const config: BurnerWalletConfig = { fuelProvider: nonDefaultProvider, @@ -172,10 +169,9 @@ describe('Burner Wallet Connector', () => { const connector = await getBurnerWallet(config); expect(connector).to.be.an.instanceOf(BurnerWalletConnector); - expect(await connector.currentNetwork()).to.be.deep.equal({ - chainId: 0, - url: TESTNET_URL, - }); + expect(await connector.currentNetwork()).to.be.deep.equal( + TESTNET_NETWORK, + ); }); }); diff --git a/packages/common/src/networks.ts b/packages/common/src/networks.ts index 6568abf9..6c139d93 100644 --- a/packages/common/src/networks.ts +++ b/packages/common/src/networks.ts @@ -1,15 +1,17 @@ import { CHAIN_IDS, type Network } from 'fuels'; +export const TESTNET_NETWORK: Network = { + chainId: CHAIN_IDS.fuel.testnet, + url: 'https://testnet.fuel.network/v1/graphql', +}; + export const MAINNET_NETWORK: Network = { chainId: CHAIN_IDS.fuel.mainnet, url: 'https://mainnet.fuel.network/v1/graphql', }; export const DEFAULT_NETWORKS: Network[] = [ - { - chainId: CHAIN_IDS.fuel.testnet, - url: 'https://testnet.fuel.network/v1/graphql', - }, + TESTNET_NETWORK, { chainId: CHAIN_IDS.fuel.devnet, url: 'https://devnet.fuel.network/v1/graphql',