-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #292 from LinkdropHQ/dev_wallet-connect_update
Dev wallet connect update
- Loading branch information
Showing
24 changed files
with
7,218 additions
and
8,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
src/components/application/connectors/coinbase-connector.tsx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
102 changes: 65 additions & 37 deletions
102
src/components/application/connectors/wallet-connect.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,75 @@ | ||
import { createWeb3Modal } from '@web3modal/wagmi/react' | ||
import { defaultWagmiConfig } from '@web3modal/wagmi/react/config' | ||
import { WagmiProvider } from 'wagmi' | ||
import { | ||
EthereumClient | ||
} from "@web3modal/ethereum" | ||
import { configureChains, createConfig } from "wagmi" | ||
import { mainnet, polygon, goerli, polygonMumbai, base, baseGoerli } from "wagmi/chains" | ||
import { WalletConnectConnector } from 'wagmi/connectors/walletConnect' | ||
import { InjectedConnector } from 'wagmi/connectors/injected' | ||
import { infuraProvider } from 'wagmi/providers/infura' | ||
import { publicProvider } from 'wagmi/providers/public' | ||
import { coinbaseConnector } from './coinbase-connector' | ||
|
||
const { REACT_APP_WC_PROJECT_ID, REACT_APP_INFURA_ID } = process.env | ||
const chains = [mainnet, polygon, goerli, polygonMumbai, base, baseGoerli] | ||
|
||
// Wagmi client | ||
const { publicClient, webSocketPublicClient } = configureChains( | ||
[ | ||
mainnet, polygon, goerli, polygonMumbai, base, baseGoerli | ||
], | ||
[ | ||
infuraProvider({ apiKey: REACT_APP_INFURA_ID as string }), | ||
publicProvider() | ||
], | ||
) | ||
mainnet, | ||
polygon, | ||
sepolia, | ||
base, | ||
baseGoerli, | ||
polygonMumbai | ||
} from 'wagmi/chains' | ||
import { http } from 'wagmi' | ||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query' | ||
// import { metamaskConfig } from './metamask-connect' | ||
// import { coinbaseConfig } from './coinbase-connector' | ||
|
||
import { injected, walletConnect } from 'wagmi/connectors' | ||
|
||
const { REACT_APP_WC_PROJECT_ID } = process.env | ||
|
||
// 0. Setup queryClient | ||
const queryClient = new QueryClient() | ||
|
||
// 1. Get projectId at https://cloud.walletconnect.com | ||
const projectId = REACT_APP_WC_PROJECT_ID as string | ||
|
||
const wagmiConfig = createConfig({ | ||
autoConnect: true, | ||
// 2. Create wagmiConfig | ||
const metadata = { | ||
name: 'Linkdrop Claim App', | ||
description: 'Linkdrop Claim App', | ||
url: 'https://linkdrop.io', // origin must match your domain & subdomain | ||
icons: ['https://avatars.githubusercontent.com/u/37784886'] | ||
} | ||
|
||
const chains = [ | ||
mainnet, | ||
polygon, | ||
sepolia, | ||
base, | ||
baseGoerli, | ||
polygonMumbai | ||
] as const | ||
|
||
const config = defaultWagmiConfig({ | ||
chains, | ||
projectId, | ||
metadata, | ||
connectors: [ | ||
new WalletConnectConnector({ | ||
chains, options: { | ||
projectId: REACT_APP_WC_PROJECT_ID as string | ||
} | ||
}), | ||
new InjectedConnector({ | ||
chains | ||
walletConnect({ | ||
projectId | ||
}), | ||
coinbaseConnector | ||
injected() | ||
], | ||
publicClient | ||
transports: { | ||
[mainnet.id]: http(), | ||
[sepolia.id]: http(), | ||
[polygon.id]: http(), | ||
[base.id]: http(), | ||
[baseGoerli.id]: http(), | ||
[polygonMumbai.id]: http(), | ||
}, | ||
}) | ||
|
||
// 3. Create modal | ||
createWeb3Modal({ | ||
wagmiConfig: config, | ||
projectId, | ||
enableAnalytics: true, // Optional - defaults to your Cloud configuration | ||
}) | ||
|
||
const ethereumClient = new EthereumClient(wagmiConfig, chains) | ||
|
||
export { | ||
wagmiConfig, | ||
ethereumClient | ||
config, | ||
queryClient | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
type TProps = { | ||
href: string | ||
target?: string | ||
children?: React.ReactNode | ||
} | ||
|
||
export default TProps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
type TProps = { | ||
className?: string, | ||
onClick?: () => void | ||
children?: React.ReactNode | ||
} | ||
|
||
export default TProps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
type TProps = { | ||
className?: string | ||
children?: React.ReactNode | ||
} | ||
|
||
export default TProps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.