Cross Chain Dex

How do I know what Blockchain I am on e.g. ETH, BSC, MATIC for making cross chain DEX on 1Inch.

Is there a call that will give me the answer to current blockchain?

you can get current blockchain from web3 or from Moralis with Moralis.getChainId()

Thanks. I am trying to display the chain, Address(shortened) and balance on top right corner of the page once the user is logged into metamask.

MOralis.getChainId() returned β€œPromise” but not the chain.

you may have to use await before Moralis.getChainId()

Yes I got that. thanks

is there a way to get balance from current user wallet?

thanks a lot for quick replies. Helps a lot to learn Moralis

1 Like