qr code issue #3336
qr code issue
#3336
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
my only problem is when i connect with qr code i get the error
script.js:203 s: Returned error: The requested account and/or method has not been authorized by the user
other then that no issue with my dapp if iuse it with browser extension no issue mobile wallet browser no issue too so plz this my 10 time asking what's the fix ````import {
EthereumClient,
w3mConnectors,
w3mProvider,
WagmiCore,
WagmiCoreChains,
WagmiCoreConnectors,
} from "https://unpkg.com/@web3modal/[email protected]";
import { Web3Modal } from "https://unpkg.com/@web3modal/[email protected]";
// 0. Import wagmi dependencies
const { bscTestnet, bsc } = WagmiCoreChains;
const { configureChains, createConfig } = WagmiCore;
// 1. Define chains
const chains = [bscTestnet, bsc];
const projectId = "#";
// 2. Configure wagmi client
const { publicClient } = configureChains(chains, [w3mProvider({ projectId })]);
const wagmiConfig = createConfig({
autoConnect: true,
connectors: [
...w3mConnectors({ chains, version: 2, projectId }),
new WagmiCoreConnectors.CoinbaseWalletConnector({
chains,
options: {
appName: "#",
},
}),
],
publicClient,
});
// 3. Create ethereum and modal clients
const ethereumClient = new EthereumClient(wagmiConfig, chains);
export const web3Modal = new Web3Modal(
{
projectId,
themeVariables: {
"--w3m-accent-color":
"background: linear-gradient(157.81deg, #DEF9FA -43.27%, #BEF3F5 -21.24%, #9DEDF0 12.19%, #7DE7EB 29.82%, #5CE1E6 51.94%, #33BBCF 90.29%);",
},
walletImages: {
safe:
"#",
},
},
ethereumClient
);
const getAccountAndHandle = async () => {
try {
account = await ethereumClient.getAccount();
console.log(account);
} catch (err) {
console.error(err);
}
};
ethereumClient.watchAccount(async (accounts) => {
console.log("Accounts:", accounts);
await getAccountAndHandle();
});
getAccountAndHandle();`
Beta Was this translation helpful? Give feedback.
All reactions