Frontend
Last updated
/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
config.resolve.fallback = { fs: false };
return config;
},
};
module.exports = nextConfig;"use client"; // this is a client component 👈🏽
import styles from "./page.module.css";
import { create, SdkConfig } from "@connext/sdk";
import { useEffect } from "react";
const inter = Inter({ subsets: ["latin"] });
const sdkConfig: SdkConfig = {
signerAddress: "0x2b8aA42fFb2c9c7B9f0B1e1b935F7D8331b6dC7c",
// Use `mainnet` when you're ready...
network: "testnet",
// Add more chains here! Use mainnet domains if `network: mainnet`.
// This information can be found at https://docs.connext.network/resources/supported-chains
chains: {
1735353714: { // Goerli domain ID
providers: ["https://rpc.ankr.com/eth_goerli"],
},
1735356532: { // Optimism-Goerli domain ID
providers: ["https://goerli.optimism.io"],
},
},
};
export default function Home() {
useEffect(() => {
const run = async () => {
const { sdkBase } = await create(sdkConfig);
console.log('sdkBase: ', sdkBase);
}
run();
})
return (
<main className={styles.main}>
<div className={styles.description}>
<p>
Get started by editing
<code className={styles.code}>src/app/page.tsx</code>
</p>
</div>
</main>
)npx create-react-app my-app
# or
yarn create react-app my-app --template typescriptnpm install @connext/sdkyarn add -D @craco/craco zlib-browserify const webpack from 'webpack';
module.exports = {
webpack: {
configure: webpackConfig => {
webpackConfig['resolve'] = {
fallback: {
fs: false,
path: false,
os: false,
zlib: require.resolve("zlib-browserify"),
},
}
return webpackConfig;
},
plugins: [
// Work around for Buffer is undefined:
// https://github.com/webpack/changelog-v5/issues/10
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
],
},
};"scripts": {
- "start": "react-scripts start",
- "build": "react-scripts build",
- "test": "react-scripts test"
+ "start": "craco start",
+ "build": "craco build",
+ "test": "craco test"
}