-
Notifications
You must be signed in to change notification settings - Fork 4
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 #965 from etherisc/hotfix/remove-ledger-connect-vi…
…a-wagmi-walletconnect remove walletconnect (#964)
- Loading branch information
Showing
11 changed files
with
7,396 additions
and
13,243 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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,34 +1,36 @@ | ||
import { EthereumClient, w3mConnectors } from "@web3modal/ethereum"; | ||
import { configureChains, createConfig } from "wagmi"; | ||
import { mainnet, polygonMumbai } from 'wagmi/chains'; | ||
import { publicProvider } from 'wagmi/providers/public'; | ||
// import { EthereumClient, w3mConnectors } from "@web3modal/ethereum"; | ||
// import { configureChains, createConfig } from "wagmi"; | ||
// import { mainnet, polygonMumbai } from 'wagmi/chains'; | ||
// import { publicProvider } from 'wagmi/providers/public'; | ||
|
||
export const CHAIN_ID = process.env.NEXT_PUBLIC_CHAIN_ID; | ||
console.log("wallet connect config", "chainid", CHAIN_ID); | ||
|
||
export const WALLET_CONNECT_PROJECT_ID = process.env.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID || ""; | ||
|
||
// configure walletconnect v2 | ||
let chainsList; | ||
// let chainsList = []; | ||
if (CHAIN_ID === "80001") { | ||
// console.log("wallet connect config", "chainid", chainId, "polygonMumbai"); | ||
chainsList = [polygonMumbai]; | ||
// chainsList = [polygonMumbai]; | ||
} else if (CHAIN_ID === "1") { | ||
// console.log("wallet connect config", "chainid", chainId, "mainnet"); | ||
chainsList = [mainnet]; | ||
// chainsList = [mainnet]; | ||
} else { | ||
// console.log("wallet connect config", "chainid", chainId, "mainnet"); | ||
chainsList = [mainnet]; | ||
// chainsList = [mainnet]; | ||
} | ||
|
||
// console.log("wallet connect config", "chainsList", chainsList); | ||
// @ts-ignore testnet not set on mainnet chain - ignore complaint | ||
const { chains, publicClient } = configureChains(chainsList, [publicProvider()]); | ||
// console.log("wallet connect config", "chains", chains, "publicClient", publicClient); | ||
export const wagmiConfig = createConfig({ | ||
autoConnect: true, | ||
connectors: w3mConnectors({ projectId: WALLET_CONNECT_PROJECT_ID, chains }), | ||
publicClient | ||
}); | ||
// console.log("wallet connect config", "wagmiConfig", wagmiConfig); | ||
export const ethereumClient = new EthereumClient(wagmiConfig, chains); | ||
// const { chains, publicClient } = configureChains(chainsList, [publicProvider()]); | ||
// // console.log("wallet connect config", "chains", chains, "publicClient", publicClient); | ||
// export const wagmiConfig = createConfig({ | ||
// autoConnect: true, | ||
// connectors: w3mConnectors({ projectId: WALLET_CONNECT_PROJECT_ID, chains }), | ||
// publicClient | ||
// }); | ||
// // console.log("wallet connect config", "wagmiConfig", wagmiConfig); | ||
// export const ethereumClient = new EthereumClient(wagmiConfig, chains); | ||
export const wagmiConfig = undefined; | ||
export const ethereumClient = undefined; |
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,21 +1,22 @@ | ||
import { type WalletClient, getWalletClient } from '@wagmi/core'; | ||
// import { type WalletClient, getWalletClient } from '@wagmi/core'; | ||
import { providers } from 'ethers'; | ||
|
||
export function walletClientToSigner(walletClient: WalletClient) { | ||
const { account, chain, transport } = walletClient | ||
const network = { | ||
chainId: chain.id, | ||
name: chain.name, | ||
ensAddress: chain.contracts?.ensRegistry?.address, | ||
} | ||
const provider = new providers.Web3Provider(transport, network) | ||
const signer = provider.getSigner(account.address) | ||
return signer | ||
export function walletClientToSigner(walletClient: unknown) { | ||
// const { account, chain, transport } = walletClient | ||
// const network = { | ||
// chainId: chain.id, | ||
// name: chain.name, | ||
// ensAddress: chain.contracts?.ensRegistry?.address, | ||
// } | ||
// const provider = new providers.Web3Provider(transport, network) | ||
// const signer = provider.getSigner(account.address) | ||
return undefined; | ||
} | ||
|
||
/** Action to convert a viem Wallet Client to an ethers.js Signer. */ | ||
export async function getEthersSigner({ chainId }: { chainId?: number } = {}) { | ||
const walletClient = await getWalletClient({ chainId }) | ||
if (!walletClient) return undefined | ||
return walletClientToSigner(walletClient) | ||
// const walletClient = await getWalletClient({ chainId }) | ||
// if (!walletClient) return undefined | ||
// return walletClientToSigner(walletClient) | ||
return undefined; | ||
} |
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 +1 @@ | ||
{ "name": "depeg-ui", "version": "dev", "date": "202T-0D-A1" } | ||
{"name": "depeg-interface", "version": "1.2.5", "date": "2023-12-14" } |