Skip to content

Commit

Permalink
chore: revert burner wallet to keep using testnet
Browse files Browse the repository at this point in the history
  • Loading branch information
helciofranco committed Jan 6, 2025
1 parent 4660bb7 commit 0669161
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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),
});
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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;

Expand Down Expand Up @@ -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,
);
});

Expand Down Expand Up @@ -149,33 +147,31 @@ 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,
};
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,
};

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,
);
});
});

Expand Down
10 changes: 6 additions & 4 deletions packages/common/src/networks.ts
Original file line number Diff line number Diff line change
@@ -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',
Expand Down

0 comments on commit 0669161

Please sign in to comment.