Is it possible to add BSC TestNet to TrustWallet for testing?
I need to test several things with Trust Wallet integration in addition to metamask.
Is it possible to add BSC TestNet to TrustWallet for testing?
I need to test several things with Trust Wallet integration in addition to metamask.
I didnāt see a way to add BSC testnet to TrustWallet.
It seems that there is no way.
Iām on mainnet anyway.
My problem is when using web3 = await Moralis.enableWeb3({provider, chainId}); //wallet connect
Which is the connection to Wallet Conect - using Trust Wallet.
The function āClaimā is executed on the contract and the tokens transferred correctly. However, there is an error in the responseā¦ It does not return āclaimOKā and the code snippet of if(claimOK) {ā¦} does not execute as it should.
Any idea what happens?
async function claimAirDrop() {
$("#modal2").modal({backdrop: 'static', keyboard: false});
user = Moralis.User.current();
const claim = {
contractAddress: smartContractAddr,
functionName: "claimAirDrop",
abi: smartContractABI,
msgValue: "30000000000000", //30000000000000 400000000000000
params: {
id: getRefZ()
},
};
if(user) {
let claimOk = false;
try {
const providerZ = localStorage.getItem("providerZ");
console.log(providerZ);
if (providerZ == 'wc') {
web3 = await Moralis.enableWeb3({provider, chainId}); //wallet conect
}
else {
web3 = await Moralis.enableWeb3(); // metamask
}
if(web3) {
claimOk = await Moralis.executeFunction(claim);
}
} catch (error) {
$("#modal2").modal('hide');
showModal("Error", "error: " + error.code + ". " + error.message)
logout();
}
//console.log(claimOK);
if (claimOk) {
$("#modal2").modal('hide');
clearForm();
user.set("airdropv1", true);
user.save();
console.log("aqui!" + user.attributes.ethAddress);
showModal("Success", "Congratulations, your transaction was successful. If you have any questions, please contact [email protected]." );
renderApp();
}
else {
$("#modal2").modal('hide');
showModal("Error", "Unexpected error. Reconnect your wallet and try again." )
logout();
}
}
else {
$("#modal2").modal('hide');
showModal('Error', 'connect your wallet first.');
choiceWallet();
}
}
I think that youāll have to wait until Moralis.executeFunction works with events
I come from PHP and I still havenāt adapted much with the super asynchronous powers of JS lol.
Could you give some code example?
you have an example here:
and it looks like now it should work with latest Moralis SDK