Hello! I am following the moralis dex video. My code is very minimal, however my server’s CPU is at 100%. I have installed and removed the 1inch plugin a few times, is that the culprit? Here is my server URL: https://iqvaw6azff7h.usemoralis.com:2053/server How can I fix this? Here is the JS file code, thank you:
const serverUrl = "https:XYZ";
const appId = "ABC";
Moralis.start({ serverUrl, appId });
async function init(){
await Moralis.initPlugins();
await Moralis.enable();
await listAvailableTokens();
}
async function listAvailableTokens(){
const result = await Moralis.Plugins.oneInch.getSupportedTokens({
chain: 'bsc,
});
const tokens = result.tokens;
let parent = document.getElementById("token_list");
for( const address in tokens){
let token = tokens[address];
let div = document.createElement("div");
div.className = "token_row";
let html = `
<img class="token_list_img" src="${token.logoURI}">
<span class="token_list_text">${token.symbol}</span>
`
div.innerHTML = html;
parent.appendChild(div);
}
}
async function login() {
let user = Moralis.User.current();
if (!user) {
try {
user = await Moralis.authenticate({ signingMessage: "Hello World!" })
console.log(user)
console.log(user.get('ethAddress'))
} catch(error) {
console.log(error)
}
}
}
function openModal(){
document.getElementById("token_modal").style.display = "block";
}
function closeModal(){
document.getElementById("token_modal").style.display = "none";
}
document.getElementById("modal_close").onclick = closeModal;
document.getElementById("from_token_select").onclick = openModal;
document.getElementById("login_button").onclick = login;
/*async function logOut() {
await Moralis.User.logOut();
console.log("logged out");
}*/
init();