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 #176

Draft
wants to merge 5 commits 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
2 changes: 2 additions & 0 deletions examples/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"@fuels/react": "0.20.0",
"@radix-ui/react-toast": "1.1.5",
"@tanstack/react-query": "5.35.1",
"@usecapsule/react-sdk": "3.17.0",
"@usecapsule/wagmi-v2-integration": "2.18.0",
"@wagmi/connectors": "5.0.26",
"@wagmi/core": "2.12.2",
"clsx": "2.1.1",
Expand Down
15 changes: 15 additions & 0 deletions examples/react-app/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import ReactDOM from 'react-dom/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';

import Capsule, { Environment } from '@usecapsule/react-sdk';
import { capsuleConnector } from '@usecapsule/wagmi-v2-integration';

import { coinbaseWallet, walletConnect } from '@wagmi/connectors';
import { http, createConfig, injected } from '@wagmi/core';
import { mainnet, sepolia } from '@wagmi/core/chains';
Expand All @@ -19,6 +22,12 @@ import './index.css';

const queryClient = new QueryClient();

const capsule = new Capsule(
Environment.BETA,
'9e1ce73625425f6bd64fc79ab7ea7028',
{},
);

// ============================================================
// WalletConnect Connector configurations
// https://docs.walletconnect.com/web3modal/javascript/about
Expand Down Expand Up @@ -49,6 +58,12 @@ const wagmiConfig = createConfig({
darkMode: true,
reloadOnDisconnect: true,
}),
capsuleConnector({
chains: [mainnet, sepolia],
appName: METADATA.name,
capsule,
options: {},
}),
],
});

Expand Down
15 changes: 14 additions & 1 deletion examples/react-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
import react from '@vitejs/plugin-react';
import tailwindcss from 'tailwindcss';
import { defineConfig } from 'vite';
import { nodePolyfills } from 'vite-plugin-node-polyfills';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [
react(),
nodePolyfills({
exclude: ['fs', 'stream'],
globals: {
process: true,
},
protocolImports: false,
}),
],
css: {
postcss: {
plugins: [tailwindcss()],
},
},
// define: {
// 'process.env': {},
// },
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"lint-staged": "15.2.2",
"tsx": "^4.16.2",
"turbo": "1.13.3",
"vitest": "1.6.0"
"vitest": "1.6.0",
"vite-plugin-node-polyfills": "0.22.0"
},
"engines": {
"node": ">=18",
Expand Down
Loading
Loading