Event listener plugin related issue


in my main.js file I am using the following code (nothing special about it) to set the contract Address which is checksum compliant (see web3.utils.toChecksumAddress)

const Item = Moralis.Object.extend("Item");
const item = new Item();
item.set('nftContractAddress', contractAddress);

The event listener plugin - that creates “ItemsForSale” table - however does not produce a checksum compliant Address. Instead the address is all in lower case and numbers. Therefore the Moralis.Cloud.beforeSave does not find a matching result when doing the “query.first()” after

Moralis.Cloud.beforeSave("ItemsForSaleUpdated", async (request) => {
  const query = new Moralis.Query("Item");
  query.equalTo('nftContractAddress', request.object.get('tokenAddress')); 
  const resultObject = await query.first();

So the tokenAddress (from the table produced by the plugin) is NOT checksum compliant while the nftContractAddress from item.set is.
Is there a way to convert the all lower-case address from the Moralis event listener into a checksum compliant Address? Or do you have a suggestion as a workaround for me?

All addresses in Moralis are lowercase.
See this in docs: https://docs.moralis.io/moralis-server/real-time-transactions#address-casing

awesome! Sorry, I hadn’t seen this piece of the documentation. this works for me.

1 Like

Amazing! Closing topic
Good luck!