-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(bridge-ui-v2): upgrade walletconnect from v2 to v3 (#14999)
- Loading branch information
1 parent
f71c7b7
commit 8efd5cb
Showing
9 changed files
with
3,508 additions
and
3,810 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,51 @@ | ||
import { EthereumClient } from '@web3modal/ethereum'; | ||
import { Web3Modal } from '@web3modal/html'; | ||
import { createWeb3Modal } from '@web3modal/wagmi'; | ||
|
||
import { PUBLIC_WALLETCONNECT_PROJECT_ID } from '$env/static/public'; | ||
import { chains, getChainImages } from '$libs/chain'; | ||
import { wagmiConfig } from '$libs/wagmi'; | ||
|
||
const projectId = PUBLIC_WALLETCONNECT_PROJECT_ID; | ||
|
||
const ethereumClient = new EthereumClient(wagmiConfig, chains); | ||
|
||
const chainImages = getChainImages(); | ||
|
||
export const web3modal = new Web3Modal( | ||
{ | ||
projectId, | ||
chainImages, | ||
// TODO: can we bring these vars into Tailwind theme? | ||
themeVariables: { | ||
'--w3m-font-family': '"Public Sans", sans-serif', | ||
'--w3m-font-feature-settings': 'normal', | ||
'--w3m-button-border-radius': '9999px', | ||
|
||
// Body small regular | ||
'--w3m-text-small-regular-size': '14px', | ||
'--w3m-text-small-regular-weight': '400', | ||
'--w3m-text-small-regular-line-height': '20px', | ||
|
||
// Body regular | ||
'--w3m-text-medium-regular-size': '16px', | ||
'--w3m-text-medium-regular-weight': '400', | ||
'--w3m-text-medium-regular-line-height': '24px', | ||
'--w3m-text-medium-regular-letter-spacing': 'normal', | ||
|
||
// Title body bold | ||
'--w3m-text-big-bold-size': '18px', | ||
'--w3m-text-big-bold-weight': '700', | ||
'--w3m-text-big-bold-line-height': '24px', | ||
|
||
'--w3m-background-color': 'var(--primary-brand)', | ||
'--w3m-overlay-background-color': 'var(--overlay-background)', | ||
'--w3m-background-border-radius': '20px', | ||
'--w3m-container-border-radius': '0', | ||
|
||
// Unofficial variables | ||
// @ts-ignore | ||
'--w3m-color-fg-1': 'var(--primary-content)', | ||
'--w3m-color-bg-1': 'var(--primary-background)', | ||
'--w3m-color-bg-2': 'var(--neutral-background)', | ||
'--w3m-color-overlay': 'none', | ||
'--w3m-accent-color': 'var(--neutral-background)', | ||
'--w3m-accent-fill-color': 'var(--dark-background)', | ||
}, | ||
themeMode: (localStorage.getItem('theme') as 'dark' | 'light') ?? 'dark', | ||
export const web3modal = createWeb3Modal({ | ||
wagmiConfig, | ||
projectId, | ||
chains, | ||
chainImages, | ||
themeVariables: { | ||
'--w3m-font-family': '"Public Sans", sans-serif', | ||
'--w3m-accent': 'var(--primary-brand)', | ||
|
||
// Body small regular | ||
// @ts-ignore | ||
'--w3m-text-small-regular-line-height': '20px', | ||
|
||
// Body regular | ||
// @ts-ignore | ||
'--w3m-text-medium-regular-size': '16px', | ||
'--w3m-text-medium-regular-weight': '400', | ||
'--w3m-text-medium-regular-line-height': '24px', | ||
'--w3m-text-medium-regular-letter-spacing': 'normal', | ||
|
||
// Title body bold | ||
// @ts-ignore | ||
'--w3m-text-big-bold-size': '18px', | ||
'--w3m-text-big-bold-weight': '700', | ||
'--w3m-text-big-bold-line-height': '24px', | ||
|
||
// @ts-ignore | ||
'--w3m-background-color': 'var(--primary-brand)', | ||
'--w3m-overlay-background-color': 'var(--overlay-background)', | ||
'--w3m-background-border-radius': '20px', | ||
'--w3m-container-border-radius': '0', | ||
|
||
// Unofficial variables | ||
// @ts-ignore | ||
'--w3m-color-fg-1': 'var(--primary-content)', | ||
'--w3m-color-bg-1': 'var(--primary-background)', | ||
'--w3m-color-bg-2': 'var(--neutral-background)', | ||
'--w3m-color-overlay': 'none', | ||
'--w3m-accent-fill-color': 'var(--dark-background)', | ||
}, | ||
ethereumClient, | ||
); | ||
themeMode: (localStorage.getItem('theme') as 'dark' | 'light') ?? 'dark', | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,12 @@ | ||
import { configureChains, createConfig } from '@wagmi/core'; | ||
import { w3mConnectors, w3mProvider } from '@web3modal/ethereum'; | ||
import { configureChains } from '@wagmi/core'; | ||
import { publicProvider } from '@wagmi/core/providers/public'; | ||
import { defaultWagmiConfig, walletConnectProvider } from '@web3modal/wagmi'; | ||
|
||
import { PUBLIC_WALLETCONNECT_PROJECT_ID } from '$env/static/public'; | ||
import { chains } from '$libs/chain'; | ||
|
||
const projectId = PUBLIC_WALLETCONNECT_PROJECT_ID; | ||
|
||
export const { publicClient } = configureChains(chains, [w3mProvider({ projectId })]); | ||
export const { publicClient } = configureChains(chains, [walletConnectProvider({ projectId }), publicProvider()]); | ||
|
||
export const wagmiConfig = createConfig({ | ||
autoConnect: true, | ||
connectors: w3mConnectors({ projectId, chains }), | ||
publicClient, | ||
}); | ||
export const wagmiConfig = defaultWagmiConfig({ chains, projectId }); |
Oops, something went wrong.