Skip to content

Commit c9a306d

Browse files
authored
feat: add solana to defaultConnectors (#159)
1 parent 23afa71 commit c9a306d

File tree

5 files changed

+25
-23
lines changed

5 files changed

+25
-23
lines changed

.changeset/famous-items-shop.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@fuels/connectors": patch
3+
---
4+
5+
Accept `ethWagmiConfig` for eth wallet wagmi configs

.changeset/hungry-students-cheer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@fuel-connectors/solana-connector": patch
3+
---
4+
5+
Include more solana wallets

examples/react-app/src/main.tsx

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,7 @@ import { coinbaseWallet, walletConnect } from '@wagmi/connectors';
88
import { http, createConfig, injected } from '@wagmi/core';
99
import { mainnet, sepolia } from '@wagmi/core/chains';
1010

11-
import {
12-
BakoSafeConnector,
13-
BurnerWalletConnector,
14-
FuelWalletConnector,
15-
FuelWalletDevelopmentConnector,
16-
FueletWalletConnector,
17-
SolanaConnector,
18-
WalletConnectConnector,
19-
} from '@fuels/connectors';
11+
import { defaultConnectors } from '@fuels/connectors';
2012
import { FuelProvider } from '@fuels/react';
2113

2214
import * as Toast from '@radix-ui/react-toast';
@@ -66,20 +58,11 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
6658
<FuelProvider
6759
theme="dark"
6860
fuelConfig={{
69-
connectors: [
70-
new FuelWalletConnector(),
71-
new BakoSafeConnector(),
72-
new FueletWalletConnector(),
73-
new WalletConnectConnector({
74-
wagmiConfig,
75-
projectId: WC_PROJECT_ID,
76-
}),
77-
new FuelWalletDevelopmentConnector(),
78-
new BurnerWalletConnector(),
79-
new SolanaConnector({
80-
projectId: WC_PROJECT_ID,
81-
}),
82-
],
61+
connectors: defaultConnectors({
62+
devMode: true,
63+
wcProjectId: WC_PROJECT_ID,
64+
ethWagmiConfig: wagmiConfig,
65+
}),
8366
}}
8467
>
8568
<Toast.Provider>

packages/connectors/src/defaultConnectors.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { BurnerWalletConnector } from '@fuel-connectors/burner-wallet-connector'
33
import { FuelWalletDevelopmentConnector } from '@fuel-connectors/fuel-development-wallet';
44
import { FuelWalletConnector } from '@fuel-connectors/fuel-wallet';
55
import { FueletWalletConnector } from '@fuel-connectors/fuelet-wallet';
6+
import { SolanaConnector } from '@fuel-connectors/solana-connector';
67
import { WalletConnectConnector } from '@fuel-connectors/walletconnect-connector';
8+
import type { Config } from '@wagmi/core';
79
import type { FuelConnector } from 'fuels';
810
import type { BurnerWalletConfig } from '../../burner-wallet-connector/src/types';
911

@@ -13,19 +15,25 @@ type DefaultConnectors = {
1315
devMode?: boolean;
1416
wcProjectId?: string;
1517
burnerWalletConfig?: BurnerWalletConfig;
18+
ethWagmiConfig?: Config;
1619
};
1720

1821
export function defaultConnectors({
1922
devMode,
2023
wcProjectId = DEFAULT_WC_PROJECT_ID,
2124
burnerWalletConfig,
25+
ethWagmiConfig,
2226
}: DefaultConnectors = {}): Array<FuelConnector> {
2327
const connectors = [
2428
new FuelWalletConnector(),
2529
new BakoSafeConnector(),
2630
new FueletWalletConnector(),
2731
new WalletConnectConnector({
2832
projectId: wcProjectId,
33+
wagmiConfig: ethWagmiConfig,
34+
}),
35+
new SolanaConnector({
36+
projectId: wcProjectId,
2937
}),
3038
new BurnerWalletConnector(burnerWalletConfig),
3139
];

packages/solana-connector/src/utils/solanaProvider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export function createSolanaProvider(config: SolanaConfig): ModalConfig {
2222
const solanaConfig =
2323
config.solanaConfig ??
2424
defaultSolanaConfig({
25+
enableInjected: true,
2526
chains,
2627
projectId: config.projectId ?? DEFAULT_PROJECT_ID,
2728
metadata: {

0 commit comments

Comments
 (0)