Initialized, run Web3Api.initialize first

what version of Moralis SDK you have? you can get the version with Moralis.CoreManager.get("VERSION")
There were some changes in latest version.

thank you. my version is ‘js0.0.80’

Hey @nani

Please use new init syntax:
https://docs.moralis.io/moralis-server/getting-started/quick-start#initialize-moralis

It will automatically init Web3API

1 Like

thank you @Yomoo. I am currently using the below for the connection to moralis sever:
Moralis.initialize(“LtCAPag9Kl1f9oOtxJ5jr7xV9KbuBJbSklemDqvK”);
Moralis.serverURL = “https://a1zxiyoi7jle.moralishost.com:2053/server”;

do I need to change this?

Yes, you have to use:

Moralis.start({ serverUrl: “https://a1zxiyoi7jle.moralishost.com:2053/server”, appId: “LtCAPag9Kl1f9oOtxJ5jr7xV9KbuBJbSklemDqvK” });

3 Likes

perfect, thank you team. it worked.

the below function does not work. i am receiving below error:

Uncaught (in promise) {code: 141, error: ‘Error: required param address not provided’}
https://a1zxiyoi7jle.moralishost.com:2053/server/functions/getNativeBalance

does this relate to the above problem/change?

function:
getBalances = async() =>{
console.log(‘Get Balances click’);
const rinkebyBalance = await Moralis.Web3API.account.getNativeBalance({ chain: “rinkeby” });

1 Like

yes, it is also related to that change, we will make a fix soon for this

3 Likes

When will this issue be resolved?

1 Like

I would expected to be fixed today, I’ll reply here when is fixed

1 Like

Thanks buddy, really appreciate your help

@Tommy @nani, you can check now

2 Likes

Back and better the 3 depreciated warnings are now gone!

Thank you Moralis team!

thank you @cryptokid but for some reason i am still receiving the below erros if i call the function. not sure if it is me or something else.

Failed to load resource: the server responded with a status of 400 ()

Uncaught (in promise)

  1. Object

  2. code: 141

  3. error: “Error: required param address not provided”

  4. [[Prototype]]: Object

i did a debug, i think the below is still now working:

const ethBalance = await Moralis.Web3API.account.getNativeBalance()

what you see if you run this in browser console: Moralis.CoreManager.get("VERSION")?
you should see: 'js0.0.87'

i get the below version:
‘js0.0.87’

it looks like you also have to use something like window.web3 = await Moralis.enable();

1 Like

yes, now it works. thank you

1 Like

Hello, me too since today it does not work.
I changed this in my 2 .js files

I also checked my version in the console and I have ‘js0.0.87’

But I have his mistakes:

Access to XMLHttpRequest at 'https://xsmb9wqekxnl.moralishost.com:2053/server%20/functions/getTokenPrice' from origin 'http://localhost' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
moralis.js:27851 POST https://xsmb9wqekxnl.moralishost.com:2053/server%20/functions/getTokenPrice net::ERR_FAILED
dispatchXhrRequest @ moralis.js:27851
xhrAdapter @ moralis.js:27687
dispatchRequest @ moralis.js:28245
Promise.then (async)
request @ moralis.js:28061
Axios.<computed> @ moralis.js:28087
wrap @ moralis.js:28567
(anonymous) @ moralis.js:6347
tryCatch @ moralis.js:26918
invoke @ moralis.js:27148
(anonymous) @ moralis.js:26973
asyncGeneratorStep @ moralis.js:26427
_next @ moralis.js:26449
(anonymous) @ moralis.js:26456
Wrapper @ moralis.js:31028
(anonymous) @ moralis.js:26445
(anonymous) @ moralis.js:6381
(anonymous) @ moralis.js:6770
tryCatch @ moralis.js:26918
invoke @ moralis.js:27148
(anonymous) @ moralis.js:26973
asyncGeneratorStep @ moralis.js:26427
_next @ moralis.js:26449
(anonymous) @ moralis.js:26456
Wrapper @ moralis.js:31028
(anonymous) @ moralis.js:26445
(anonymous) @ moralis.js:6781
getPrice @ main.js:3
(anonymous) @ VM130:1
moralis.js:28189 Uncaught (in promise) Error: Network Error
    at createError (moralis.js:28189)
    at XMLHttpRequest.handleError (moralis.js:27758)
createError @ moralis.js:28189
handleError @ moralis.js:27758
async function (async)
getPrice @ main.js:3
(anonymous) @ VM130:1
moralis.js:27851 XHR failed loading: POST "https://xsmb9wqekxnl.moralishost.com:2053/server%20/functions/getTokenPrice".