Closed 0xchaosbi closed 4 months ago
i have faced the same issue it is because moralis sometimes returns null in to_address so its not user's issue:
Lets understand why? If there's an transaction where an address created a smart contract then you'll get null in to_address (and moralis sdk expects an address) and if you carefully observe in "node_modules\@moralisweb3\common-evm-utils\lib\cjs\index.cjs" you'll see that address is being parsed and checked for its validity and if its null then error is being thrown "throw new commonCore.CoreError({ code: commonCore.CoreErrorCode.INVALID_ARGUMENT, message: "Invalid address provided: ".concat(address$1),"
So whats quick fix? you can fix this issue for your code by going in "node_modules\@moralisweb3\common-evm-utils\lib\cjs\index.cjs" and replace the EvmAddress constructor with the following code in line 194 "function EvmAddress(address) { if(address===null){ this._value = address; } else{ this._value = EvmAddress.parse(address); } }"
this will solve the issue for now.
We fixed the toAddress
field, now it's optional. Could you check the 2.26.2
version?
It seems to be fixed now, thanks so much @b4rtaz 🙏 🎉
New Bug Report
Checklist
Issue Description
When using
getWalletHistory
on mainnet, I am encountering the following error:MoralisError [Moralis SDK Core Error]: [C0005] Invalid address provided: null
However, the address being passed is a correctly checksummed address copied directly from Etherscan.
I did some poking around and what actually seems to be happening is an error regarding the
limit
query param passed into the API call.If there is no limit set and there are more than 20 results, or the limit is 20 or above, I get the error saying an incorrect address is being passed.
However, if no limit is set and the number of results returned is below 20, or the limit is set to below 20, then the API call completes as expected.
Steps + code to reproduce
First make a call with the SDK using the following parameters:
This call should return results as expected, because the wallet has fewer than 20 transactions.
Next we will see the bug in action using a different wallet.
Make the following call:
There is no
limit
set and the account has hundreds of transactions. We get a nonsensical error that the address is incorrectly formatted, but it isn't.Make one more call:
If we use the exact same wallet address but set the limit to 10, we get results returned as expected.
Actual Outcome
See above
Expected Outcome
I would not expect that a problem with the
limit
query param manifests as an error related to the address input, which is clearly correct in all of the calls above. If there is an actual error relating to thelimit
or something else, I would like to see that properly displayed so I can troubleshoot it correctly.Environment
Server
Client
Logs