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

chore: include useCapsule #438

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/app-commons/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export const ALCHEMY_ID = process.env.NEXT_PUBLIC_ALCHEMY_ID;
export const INFURA_ID = process.env.NEXT_PUBLIC_INFURA_ID;
export const WALLETCONNECT_ID = process.env.NEXT_PUBLIC_WALLETCONNECT_ID;
export const USE_CAPSULE_KEY = process.env.NEXT_PUBLIC_USE_CAPSULE_KEY;
export const ETH_CHAIN_NAME = process.env.NEXT_PUBLIC_ETH_CHAIN_NAME;
export const FUEL_CHAIN_NAME = process.env.NEXT_PUBLIC_FUEL_CHAIN_NAME;
export const FUEL_VERSION = process.env.NEXT_PUBLIC_FUEL_VERSION;
Expand Down
2 changes: 2 additions & 0 deletions packages/app-portal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"@fuels/react": "0.23.0",
"@fuels/react-xstore": "0.23.0",
"@hookform/resolvers": "^3.1.1",
"@usecapsule/react-sdk": "3.17.0",
"@usecapsule/wagmi-v2-integration": "2.18.0",
"@xstate/react": "^3.2.1",
"connectkit": "1.7.2",
"dexie": "^3.2.4",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-portal/src/systems/Chains/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const TRANSPORTS = {

export const DEFAULT_WAGMI_CONFIG = createConfig({
chains: CHAINS_TO_CONNECT,
connectors: generateETHConnectors(APP.name),
connectors: generateETHConnectors(APP.name, CHAINS_TO_CONNECT),
transports: TRANSPORTS,
storage: createStorage({
storage: cookieStorage,
Expand Down
14 changes: 13 additions & 1 deletion packages/app-portal/src/systems/Core/utils/connectors.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import { WALLETCONNECT_ID } from 'app-commons';
import Capsule, { Environment } from '@usecapsule/react-sdk';
import { capsuleConnector } from '@usecapsule/wagmi-v2-integration';
import { USE_CAPSULE_KEY, WALLETCONNECT_ID } from 'app-commons';
import { Chain } from 'viem';
import { type CreateConnectorFn } from 'wagmi';
import { coinbaseWallet, injected, walletConnect } from 'wagmi/connectors';

const capsule = new Capsule(Environment.BETA, USE_CAPSULE_KEY, {});

export function generateETHConnectors(
appName: string,
chains: Chain[],
): Array<CreateConnectorFn> {
const connectors: Array<CreateConnectorFn> = [
injected({
Expand All @@ -16,6 +22,12 @@ export function generateETHConnectors(
}),
}),
coinbaseWallet({ appName, headlessMode: true }),
capsuleConnector({
chains,
appName: appName,
capsule,
options: {},
}),
];

if (WALLETCONNECT_ID) {
Expand Down
Loading
Loading