wallet connect mobile issue #3303
Replies: 2 comments 4 replies
-
also i get connection request declined when i try to scan the qr from trust wallet |
Beta Was this translation helpful? Give feedback.
3 replies
-
Closing as duplicate of https://github.com/orgs/WalletConnect/discussions/3305 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
when i connect my dapp to metamask on phone it connect but i can't use my dapp like the pc like i can't send or write anyfunction it just connect and trust wallet when i try to connect it i get an unknown error occurred here's my full wallet connect code
import { usdt_abi, contract_abi } from "./abi.js";
const params = new Proxy(new URLSearchParams(location.search), {
get: (searchParams, prop) => searchParams.get(prop),
});
const customRPCs = {
97: {
rpcs: ["https://rpc.ankr.com/bsc_testnet_chapel"],
},
56: {
rpcs: ["https://bscrpc.com"],
},
};
let web3;
let chainId = 97; // testnet
// Removed window.ethereum
const provider = new Web3.providers.HttpProvider(customRPCs[chainId].rpcs[0]);
web3 = new Web3(provider);
let contractAddress = "#";
let c = new web3.eth.Contract(contract_abi, contractAddress);
let usdt_contractAddress = "#";
let usdt_c = new web3.eth.Contract(usdt_abi, usdt_contractAddress);
web3.eth.setProvider(Web3.givenProvider);
let account = "";
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:
"https://pbs.twimg.com/profile_images/1566773491764023297/IvmCdGnM_400x400.jpg",
},
},
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