Hello,
I created a node.js application where I am trying to fetch contractMetaData using the endpoint Moralis.Web3API.token.getTokenMetadata(contractAddress)
I am using the Moralis.Web3API for the first time so I must have done something wrong with setting it up.
I have created a server at admin.moralis.io/servers. I assume I need this to connect the node.js client to.
This is the complete code:
const Moralis = require('moralis/node')
Moralis.initialize({Server Application ID})
Moralis.serverURL = {Server Url}
const tokenInfo = await Moralis.Web3API.token.getTokenMetadata("xyz")
I did not connect a wallet or anything because I don’t need that. I just want to ‘query’ the blockchain.
I get the following error:
/path/to/project/node_modules/moralis/lib/node/RESTController.js:420
error = new _ParseError.default(errorJSON.code, errorJSON.error);
^
ParseError: [object Object]
at handleError (/path/to/project/node_modules/moralis/lib/node/RESTController.js:420:17)
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async main (/path/to/project/index.js:24:21) {
code: 141
}
I did a little digging and found that the [object Object]
is actually a string
that is taken from the error response in RESTController.js:
const errorJSON = JSON.parse(response.responseText);
error = new _ParseError.default(errorJSON.code, errorJSON.error);
So there seems to be an issue with the json serialisation of the error response from the server. It is therefor difficult for me to see what is actually going wrong. I did not find any information about the meaning of code: 141 either.
This seems to happen with all API calls that I try. Does anybody have an idea what I am doing wrong? What am I missing?
Thanks for the help!