In my project, I encountered a situation where I needed to fetch the ERC1155 tokens that a specific smart contract owns ( Assuming that I have already transferred a bunch of ERC155 tokens to it from another smart contract )

Alchemy has already provided valuable solutions ( Alchemy SDK ) for fetching all NFTs of an address ( EOA ) or fetching a whole NFT collection. Still, my need is different now as my target owner is not an EOA but a smart contract itself.

Is there a solution to this? Or I should query the whole contract's events?

1 Answer 1


If you are using Moralis, they have a getWalletNFTs API that can do just that.

Even though the input describes it as a wallet address, the fact is that it doesn't make difference whether you use an EOA or smart contract address. As long as it is a valid address then it should work just fine.

You can simply just npm install moralis @moralisweb3/common-evm-utils and add the following code with address and chain params ready.

const Moralis = require('moralis');
const { EvmChain } = require('@moralisweb3/common-evm-utils');

try {
    const address = '0x1234567890123456789012345678901234567890';

    const chain = EvmChain.ETHEREUM;

    await Moralis.start({
        apiKey: 'YOUR_API_KEY',
        // ...and any other configuration

    const response = await Moralis.EvmApi.nft.getWalletNFTs({

} catch (e) {

Hope this helps!

  • Thanks, Yoseph. Your answer would be the most complete one if we add a conditional statement (!Moralis.Core.isStarted) for executing "await Moralis.start()". If not applied, Moralis gives us an error for every time the component gets rendered, telling us "Moralis.start()" should be executed only one time Feb 14, 2023 at 12:57
  • Glad to help! Ahhh yes that will be needed for best practice to avoid initializing the SDK multiple times, but yeah if it is already initialized and you call Moralis.start again then it will throw an error Feb 15, 2023 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.