Hi there,
I want to add user eth address into server whenever they click connect wallet using auth method. Is there any documentation to read? Thank you
cheers,
edd
Hi there,
I want to add user eth address into server whenever they click connect wallet using auth method. Is there any documentation to read? Thank you
cheers,
edd
Hi Malik,
Thank you. I am going thru the doc, but havent finished it yet.
The connect wallet went flawlessly in Chrome, but got problem during connecting wallet in Firefox.
Any insight? Thank you!
Do you get any other errors in Firefox? From that print screen it looks like an error in the local JavaScript file.
No, mate. All error I have is on screenshot.
On what JavaScript line is that error generated? Can you share your code?
hi @cryptokid hereâs the code. Error in Firefox comes from multiple lines as shown in screenshot above
//Mainnet
Moralis.initialize(""); // Application id from moralis.io
Moralis.serverURL = ââ; //Server url from moralis.ioconst chainutama = âbsc testnetâ
//dApp frontend logic
async function login(){Moralis.Web3.authenticate({signingMessage:âhello there!â}).then(function (user) {
user.save();
getBalances();
})
}async function getBalances(){
const web3 = await Moralis.Web3.enable();
const chainIdDec = await web3.eth.getChainId();if (chainIdDec == 97 ) {
chain = âBSC Testnetâ;
chain2 = âbsc testnetâ;
} else if (chainIdDec == 56 ) {
chain = âBSC Mainnetâ;
chain2 = âbscâ;
} else if (chainIdDec == 1 ) {
chain = âETH Mainnetâ;
chain2 = âethâ;
} else if (chainIdDec == 3 ) {
chain = âRopsten Testnetâ;
chain2 = âropstenâ;
} else if (chainIdDec == 4 ) {
chain = âRinkeby Testnetâ;
chain2 = ârinkebyâ;
} else if (chainIdDec == 5 ) {
chain = âGoerli Testnetâ;
chain2 = âgoerliâ;
} else if (chainIdDec == 42 ) {
chain = âKovan Testnetâ;
chain2 = âkovanâ;
}
console.log(chain);
document.querySelector("#network").textContent = chain;const tier = await Moralis.Web3.getAllERC20( { chain: chainutama }).then(getTier);
const balances = await Moralis.Web3.getAllERC20( { chain: chain2 }).then(allBalance);}
function getTier(data){
const tokadd = â0xae13d989dac2f0debff460ac112a837c89baa7cdâ;
for (var i = 0; i < data.length; i++){if (data[i].tokenAddress == tokadd) { tokbal = data[i].balance/10**18; }
}
if (tokbal >= 0 && tokbal <= 1) {
result = âTier 0â;
} else if (tokbal > 1 && tokbal <= 3) {
result = âTier 1â;
} else if (tokbal > 3 && tokbal <= 5) {
result = âTier 2â;
} else {
result = âTier 3â;
}console.log(result);
document.querySelector("#tier").textContent = result;if (result != âTier 0â) {
document.getElementById(âbtSubmitâ).disabled = true;
}
else {
document.getElementById(âbtSubmitâ).disabled = false;
}
}function allBalance(data){
var simbol = [];
var saldo = [];
displaydata = [];for (var i = 0; i < data.length; i++){
simbol.push(data[i].symbol); desimal = data[i].decimals; saldo.push(data[i].balance/10**desimal);
}
console.log(saldo,simbol);
obj = {};
for (var i = 0; i < data.length; i++) {
obj[saldo[i]] = simbol[i];
}
console.log(obj);
}
It looks like this function didnât execute, in order to set that tokbal
variable.
Or it did execute but it didnât have data.