Skip to content

Commit 61f09bf

Browse files
committed
feat: refactor main.tsx to improve readability and add Capsule connector integration
1 parent d5f0f95 commit 61f09bf

File tree

1 file changed

+32
-14
lines changed

1 file changed

+32
-14
lines changed

examples/react-app/src/main.tsx

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ import { mainnet, sepolia } from '@wagmi/core/chains';
1414
import { defaultConnectors } from '@fuels/connectors';
1515
import { FuelProvider } from '@fuels/react';
1616

17+
import Capsule, { Environment } from '@usecapsule/react-sdk';
18+
import { capsuleConnector } from '@usecapsule/wagmi-v2-integration';
19+
import type { Chain } from 'wagmi/chains';
20+
1721
import * as Toast from '@radix-ui/react-toast';
1822

1923
import App from './App.tsx';
@@ -36,27 +40,41 @@ const METADATA = {
3640
url: location.href,
3741
icons: ['https://connectors.fuel.network/logo_white.png'],
3842
};
43+
44+
const connectors = [
45+
injected({ shimDisconnect: false }),
46+
walletConnect({
47+
projectId: WC_PROJECT_ID,
48+
metadata: METADATA,
49+
showQrModal: false,
50+
}),
51+
coinbaseWallet({
52+
appName: METADATA.name,
53+
appLogoUrl: METADATA.icons[0],
54+
darkMode: true,
55+
reloadOnDisconnect: true,
56+
}),
57+
capsuleConnector({
58+
capsule: new Capsule(
59+
Environment.BETA,
60+
'9e1ce73625425f6bd64fc79ab7ea7028',
61+
{},
62+
),
63+
chains: [mainnet, sepolia],
64+
appName: 'Fuel BETA',
65+
options: {},
66+
nameOverride: 'Fuel BETA',
67+
}),
68+
];
69+
3970
const wagmiConfig = createConfig({
4071
chains: [mainnet, sepolia],
4172
transports: {
4273
[mainnet.id]: http(),
4374
[sepolia.id]: http(),
4475
},
4576
syncConnectedChain: true,
46-
connectors: [
47-
injected({ shimDisconnect: false }),
48-
walletConnect({
49-
projectId: WC_PROJECT_ID,
50-
metadata: METADATA,
51-
showQrModal: false,
52-
}),
53-
coinbaseWallet({
54-
appName: METADATA.name,
55-
appLogoUrl: METADATA.icons[0],
56-
darkMode: true,
57-
reloadOnDisconnect: true,
58-
}),
59-
],
77+
connectors,
6078
});
6179

6280
const CHAIN_ID_NAME = import.meta.env

0 commit comments

Comments
 (0)