the repo on github but i am trying to make some change, as of now the dapp works only with metamask :
const metamaskIsInstalled = ethereum && ethereum.isMetaMask;
if (metamaskIsInstalled) {
Web3EthContract.setProvider(ethereum);
let web3 = new Web3(ethereum);
try {
const accounts = await ethereum.request({
method: "eth_requestAccounts",
});
const networkId = await ethereum.request({
method: "net_version",
});
if (networkId == CONFIG.NETWORK.ID) {
const SmartContractObj = new Web3EthContract(
abi,
CONFIG.CONTRACT_ADDRESS
);
dispatch(
connectSuccess({
account: accounts[0],
smartContract: SmartContractObj,
web3: web3,
})
);
// Add listeners start
ethereum.on("accountsChanged", (accounts) => {
dispatch(updateAccount(accounts[0]));
});
ethereum.on("chainChanged", () => {
window.location.reload();
});
// Add listeners end
} else {
dispatch(connectFailed(Change network to ${CONFIG.NETWORK.NAME}.));
}
} catch (err) {
dispatch(connectFailed("Something went wrong."));
}
} else {
dispatch(connectFailed("Install Metamask."));
}
};
};
how can integrate trust wallet in my dapp?
any suggestion with this?
I forget which repo had the code you are looking for for trustwallet but I think if you check Moralis react repo on github they have a section for connecting wallets and there they have a conditional statement for metamask and for trustwallet
i think wallet connect will help connecting trustwallet, i need to find code then, if yyou have by hand please share
Обсуждают сегодня