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

feat: set default chain to mainnet #450

Merged
merged 12 commits into from
Jan 6, 2025
11 changes: 11 additions & 0 deletions .changeset/brave-ads-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@fuel-connectors/burner-wallet-connector": minor
"@fuel-connectors/walletconnect-connector": minor
"@fuel-connectors/solana-connector": minor
"@fuel-connectors/evm-connector": minor
"@fuels/connectors": minor
"@fuel-connectors/common": minor
"@fuels/react": minor
---

Set mainnet as default chain if no chain ID is specified.
1 change: 1 addition & 0 deletions .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:

- name: Build & Deploy Solana Predicates
run: pnpm fuels build && pnpm fuels deploy
if: false # @TODO: Phantom CRX is currently broken, so we're skipping this step for now
working-directory: packages/solana-connector

- name: Install Playwright Browsers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import { fundWallet } from '../setup';
import phantomExtended from './phantom/phantom';
import { test } from './setup';

test.describe('SolanaConnector', () => {
// @TODO: Phantom CRX is currently broken, so we're skipping this step for now
test.skip('SolanaConnector', () => {
test.slow();

const connect: ConnectFunction = async (page: Page) => {
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/runner/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
defineConfig,
devices,
} from '@playwright/test';
// import { synpressFixtures } from '@synthetixio/synpress';

import dotenv from 'dotenv';
dotenv.config();
Expand Down
9 changes: 5 additions & 4 deletions examples/react-app/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import { http, createConfig, injected } from '@wagmi/core';
import { mainnet, sepolia } from '@wagmi/core/chains';

import { defaultConnectors } from '@fuels/connectors';
import { FuelProvider } from '@fuels/react';
import { FuelProvider, type NetworkConfig } from '@fuels/react';

import * as Toast from '@radix-ui/react-toast';

import App from './App.tsx';
import ScreenSizeIndicator from './components/screensize-indicator.tsx';
import './index.css';
import { CHAIN_IDS, Provider, bn } from 'fuels';
import { CHAIN_IDS, type FuelConfig, Provider, bn } from 'fuels';
import { ConfigProvider } from './context/ConfigContext.tsx';

const queryClient = new QueryClient();
Expand Down Expand Up @@ -69,14 +69,14 @@ if (!PROVIDER_URL) {
throw new Error('VITE_FUEL_PROVIDER_URL is not set');
}

const NETWORKS = [
const NETWORKS: NetworkConfig[] = [
{
chainId: CHAIN_ID,
url: PROVIDER_URL,
},
];

const FUEL_CONFIG = {
const FUEL_CONFIG: FuelConfig = {
connectors: defaultConnectors({
devMode: true,
wcProjectId: WC_PROJECT_ID,
Expand All @@ -85,6 +85,7 @@ const FUEL_CONFIG = {
fuelProvider: Provider.create(PROVIDER_URL),
}),
};

function getContractId() {
switch (CHAIN_ID_NAME) {
case 'mainnet':
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"secp256k1@=5.0.0": ">=5.0.1",
"elliptic@<6.6.0": ">=6.6.0",
"next@>=10.0.0 <14.2.7": ">=14.2.7",
"cross-spawn@>=7.0.0 <7.0.5": ">=7.0.5"
"cross-spawn@>=7.0.0 <7.0.5": ">=7.0.5",
"nanoid@<3.3.8": "3.3.8"
}
},
"packageManager": "[email protected]"
Expand Down
1 change: 0 additions & 1 deletion packages/burner-wallet-connector/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export const BURNER_WALLET_ICON =
'data:image/svg+xml;utf8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0Ny41IDQ3LjUiPjxkZWZzPjxjbGlwUGF0aCBpZD0iYSI+PHBhdGggZD0iTTAgMzhoMzhWMEgwdjM4WiIvPjwvY2xp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jI4LTQuNDE3IDMuMDQxLTIuOTYyIDguMzMzQTE2LjkzNiAxNi45MzYgMCAwIDEgMiAxOEMyIDguNjExIDkuNjExIDEgMTkgMXMxNyA3LjYxMSAxNyAxNyIvPjwvZz48ZyBjbGlwLXBhdGg9InVybCgjYikiIHRyYW5zZm9ybT0ibWF0cml4KDEuMjUgMCAwIC0xLjI1IDAgNDcuNSkiPjxwYXRoIGZpbGw9IiNmZmNjNGQiIGQ9Ik0zMSA3YzAgMi4xODctLjU4NCA0LjIzNi0xLjYwNSA2LjAwMS4xNDctMy4wODQtMi41NjItNC4yOTMtNC4wMi0zLjcwOS0yLjEwNS44NDMtMS41NDEgMi4yOTEtMi4wODMgNS4yOTEtLjU0MiAzLTIuNjI1IDUuMDg0LTUuNzA5IDYgMi4yNS02LjMzMy0xLjI0Ny04LjY2Ny0zLjA4LTkuMDg0LTEuODcyLS40MjYtMy43NTMuMDAxLTMuOTY4IDQuMDA3QTExLjk2NyAxMS45NjcgMCAwIDEgNyA3QzcgLjM3MyAxMi4zNzMtNSAxOS01UzMxIC4zNzMgMzEgNyIvPjwvZz48L3N2Zz4=';
export const TESTNET_URL = 'https://testnet.fuel.network/v1/graphql';
export const HAS_WINDOW = typeof window !== 'undefined';
export const BURNER_WALLET_PRIVATE_KEY = 'burner-wallet-private-key';
export const BURNER_WALLET_STATUS = 'burner-wallet-status';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from 'node:path';
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 @@ -12,7 +13,7 @@ import {
vi,
} from 'vitest';
import { BurnerWalletConnector } from '../BurnerWalletConnector';
import { BURNER_WALLET_PRIVATE_KEY, TESTNET_URL } from '../constants';
import { BURNER_WALLET_PRIVATE_KEY } from '../constants';
import type { BurnerWalletConfig } from '../types';
import { createMockedStorage } from './mockedStorage';

Expand Down Expand Up @@ -65,17 +66,14 @@ describe('Burner Wallet Connector', () => {

describe('constructor()', () => {
test('Creates a new BurnerWalletConnector instance using default config', async () => {
const connector = await getBurnerWallet({
fuelProvider,
});
const connector = await getBurnerWallet();
expect(connector).to.be.an.instanceOf(BurnerWalletConnector);
expect(connector.name).to.be.equal('Burner Wallet');
expect(connector.connected).to.be.false;
expect(connector.installed).to.be.true;
expect(await connector.currentNetwork()).to.be.deep.equal({
chainId: 0,
url: fuelProvider.url,
});
expect(await connector.currentNetwork()).to.be.deep.equal(
TESTNET_NETWORK,
);
});

test('Creates a new BurnerWalletConnector instance with custom storage', async () => {
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
23 changes: 14 additions & 9 deletions packages/common/src/networks.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
import { CHAIN_IDS, type Network } from 'fuels';

export const DEFAULT_NETWORKS: Array<Partial<Network>> = [
{
chainId: CHAIN_IDS.fuel.testnet,
url: 'https://testnet.fuel.network/v1/graphql',
},
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[] = [
TESTNET_NETWORK,
{
chainId: CHAIN_IDS.fuel.devnet,
url: 'https://devnet.fuel.network/v1/graphql',
},
{
chainId: CHAIN_IDS.fuel.mainnet,
url: 'https://mainnet.fuel.network/v1/graphql',
},
MAINNET_NETWORK,
];

export const getProviderUrl = (chainId: number): string => {
const network = DEFAULT_NETWORKS.find(
(network) => network.chainId === chainId,
);

if (!network || !network.url) {
throw new Error(`Network with chainId ${chainId} not found`);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/connectors/src/defaultConnectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import { FuelWalletConnector } from '@fuel-connectors/fuel-wallet';
import { FueletWalletConnector } from '@fuel-connectors/fuelet-wallet';
import { SolanaConnector } from '@fuel-connectors/solana-connector';
import { WalletConnectConnector } from '@fuel-connectors/walletconnect-connector';
import { type Config, connect } from '@wagmi/core';
import type { Config } from '@wagmi/core';
import type { ProviderType } from '@web3modal/solana/dist/types/src/utils/scaffold';
import type { FuelConfig, FuelConnector } from 'fuels';
import type { FuelConnector } from 'fuels';
import type { Provider as FuelProvider } from 'fuels';

type DefaultConnectors = {
Expand Down
2 changes: 1 addition & 1 deletion packages/evm-connector/src/EvmWalletConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class EVMWalletConnector extends PredicateConnector {
protected requireConnection(): MaybeAsync<void> {}

protected async configProviders(config: EVMWalletConnectorConfig = {}) {
const network = getProviderUrl(config.chainId ?? CHAIN_IDS.fuel.testnet);
const network = getProviderUrl(config.chainId ?? CHAIN_IDS.fuel.mainnet);
this.config = Object.assign(config, {
fuelProvider: config.fuelProvider || Provider.create(network),
ethProvider: config.ethProvider || WINDOW?.ethereum,
Expand Down
18 changes: 12 additions & 6 deletions packages/react/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@ import { CHAIN_IDS } from 'fuels';
import type { NetworkConfig } from './types';

export const CONNECTOR_KEY = 'fuel-current-connector';

export const NATIVE_CONNECTORS = [
'Bako Safe',
'Burner Wallet',
'Fuel Wallet',
'Fuel Wallet Development',
'Fuelet Wallet',
];
export const DEFAULT_NETWORKS: Array<NetworkConfig> = [

export const DEFAULT_NETWORK: NetworkConfig = {
chainId: CHAIN_IDS.fuel.mainnet,
url: 'https://mainnet.fuel.network/v1/graphql',
bridgeURL: 'https://app.fuel.network/bridge?from=eth&to=fuel&auto_close=true',
};

export const BASE_NETWORK_CONFIGS: NetworkConfig[] = [
{
chainId: CHAIN_IDS.fuel.testnet,
url: 'https://testnet.fuel.network/v1/graphql',
bridgeURL:
'https://app-testnet.fuel.network/bridge?from=eth&to=fuel&auto_close=true',
},
{
chainId: CHAIN_IDS.fuel.devnet,
url: 'https://devnet.fuel.network/v1/graphql',
bridgeURL:
'https://app-devnet.fuel.network/bridge?from=eth&to=fuel&auto_close=true',
},
{
chainId: CHAIN_IDS.fuel.mainnet,
bridgeURL:
'https://app.fuel.network/bridge?from=eth&to=fuel&auto_close=true',
},
DEFAULT_NETWORK,
];
4 changes: 3 additions & 1 deletion packages/react/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export type Connector = {
installed: boolean;
};

export type NetworkConfig = Partial<Network & { bridgeURL?: string }>;
export interface NetworkConfig extends Partial<Network> {
bridgeURL?: string;
}

export type UIConfig = {
suggestBridge?: boolean;
Expand Down
12 changes: 8 additions & 4 deletions packages/react/src/ui/Connect/hooks/useNetworkConfigs.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
import { useMemo } from 'react';
import { DEFAULT_NETWORKS } from '../../../config';
import { BASE_NETWORK_CONFIGS, DEFAULT_NETWORK } from '../../../config';
import type { NetworkConfig } from '../../../types';

export function useNetworkConfigs(networks?: Array<NetworkConfig>) {
// Merge network configurations
const _networks = useMemo(() => {
if (!networks) return DEFAULT_NETWORKS;
const _networks = useMemo<NetworkConfig[]>(() => {
if (!networks) {
return [DEFAULT_NETWORK];
}

return networks.map((network) => {
if (!network.chainId) return network;
const defaultConfig = DEFAULT_NETWORKS.find(
const defaultConfig = BASE_NETWORK_CONFIGS.find(
(n) => n.chainId === network.chainId,
);
return { ...defaultConfig, ...network };
});
}, [networks]);

return {
networks: _networks ?? [],
};
Expand Down
4 changes: 2 additions & 2 deletions packages/solana-connector/src/SolanaConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export class SolanaConnector extends PredicateConnector {
}

private providerFactory(config?: SolanaConfig) {
const network = getProviderUrl(config?.chainId ?? CHAIN_IDS.fuel.testnet);
const network = getProviderUrl(config?.chainId ?? CHAIN_IDS.fuel.mainnet);
return config?.fuelProvider || FuelProvider.create(network);
}

Expand Down Expand Up @@ -153,7 +153,7 @@ export class SolanaConnector extends PredicateConnector {
}

protected async configProviders(config: SolanaConfig = {}) {
const network = getProviderUrl(config.chainId ?? CHAIN_IDS.fuel.testnet);
const network = getProviderUrl(config.chainId ?? CHAIN_IDS.fuel.mainnet);
this.config = Object.assign(config, {
fuelProvider: config.fuelProvider || FuelProvider.create(network),
});
Expand Down
1 change: 0 additions & 1 deletion packages/solana-connector/src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export const SOLANA_ICON =
'data:image/svg+xml;utf8;base64,PHN2ZyB3aWR0aD0iMTAxIiBoZWlnaHQ9Ijg4IiB2aWV3Qm94PSIwIDAgMTAxIDg4IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMTAwLjQ4IDY5LjM4MTdMODMuODA2OC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E5RkI5QiIvPgo8L2xpbmVhckdyYWRpZW50Pgo8L2RlZnM+Cjwvc3ZnPgo=';
export const TESTNET_URL = 'https://testnet.fuel.network/v1/graphql';

export const solana = {
chainId: '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
Expand Down
19 changes: 8 additions & 11 deletions packages/solana-connector/src/test/solanaConnector.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from 'node:path';
import { PredicateFactory } from '@fuel-connectors/common';
import { type Asset, type Network, Provider } from 'fuels';
import { MAINNET_NETWORK, PredicateFactory } from '@fuel-connectors/common';
import { type Asset, Provider } from 'fuels';
import { launchTestNode } from 'fuels/test-utils';
import {
afterAll,
Expand All @@ -11,7 +11,6 @@ import {
test,
} from 'vitest';
import { SolanaConnector } from '../SolanaConnector';
import { TESTNET_URL } from '../constants';
import { PREDICATE_VERSIONS } from './mockedPredicate';

describe('Solana Connector', () => {
Expand Down Expand Up @@ -63,10 +62,9 @@ describe('Solana Connector', () => {
expect(solanaConnector.name).to.equal('Solana Wallets');
expect(solanaConnector.connected).to.be.false;
expect(solanaConnector.installed).to.be.false;
expect(await solanaConnector.currentNetwork()).to.be.deep.equal({
chainId: 0,
url: TESTNET_URL,
});
expect(await solanaConnector.currentNetwork()).to.be.deep.equal(
MAINNET_NETWORK,
);
});

test('can construct a SolanaConnector with a non default Provider', async () => {
Expand Down Expand Up @@ -203,10 +201,9 @@ describe('Solana Connector', () => {

describe('selectNetwork()', () => {
test('throws error', async () => {
const network: Network = { url: '', chainId: 0 };
await expect(() => connector.selectNetwork(network)).rejects.toThrowError(
'Method not implemented.',
);
await expect(() =>
connector.selectNetwork(MAINNET_NETWORK),
).rejects.toThrowError('Method not implemented.');
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export class WalletConnectConnector extends PredicateConnector {
}

protected async configProviders(config: WalletConnectConfig = {}) {
const network = getProviderUrl(config?.chainId ?? CHAIN_IDS.fuel.testnet);
const network = getProviderUrl(config?.chainId ?? CHAIN_IDS.fuel.mainnet);
this.config = Object.assign(config, {
fuelProvider: config.fuelProvider || FuelProvider.create(network),
});
Expand Down
Loading
Loading