Skip to main content

Don't have an API key yet?

Sign-up to Moralis to get your free API key and start building today.

Get Your Free API Key
Version: 2.0

How to get all NFT transfers by wallet

Prerequisites​

Before getting started, make sure you have the following ready:

  • Node v.14+ or Python
  • NPM/Yarn or Pip

Step 1: Setup Moralis​

First register your Moralis account and get your Moralis API Key.

Once you have your Moralis API Key, install the Moralis SDK in your project.

npm install moralis @moralisweb3/common-evm-utils

Step 2: Get all NFT transfers by wallet​

In order to get all NFT transfers by wallet, Moralis provides you with an getWalletNFTTransfers endpoint.

Here you'll need two parameters: address and chain.

Once you have obtained the address and chain, you can copy the following code:

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

const runApp = async () => {
await Moralis.start({
apiKey: "YOUR_API_KEY",
// ...and any other configuration
});

const address = "0x26fcbd3afebbe28d0a8684f790c48368d21665b5";

const chain = EvmChain.ETHEREUM;

const response = await Moralis.EvmApi.nft.getWalletNFTTransfers({
address,
chain,
});

console.log(response.toJSON());
};

runApp();

Step 3: Run the script​

To run the script, enter the following command:

node index.js

In your terminal, you should see the following JSON response:

{
"total": null,
"page": 0,
"page_size": 100,
"cursor": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJvcmRlciI6IkRFU0MiLCJvZmZzZXQiOjAsImxpbWl0IjoxMDAsImRpc2FibGVfdG90YWwiOnRydWUsIndoZXJlIjp7fSwiZnJvbV9hZGRyZXNzIjoiMHhkOGRhNmJmMjY5NjRhZjlkN2VlZDllMDNlNTM0MTVkMzdhYTk2MDQ1IiwidG9fYWRkcmVzcyI6IjB4ZDhkYTZiZjI2OTY0YWY5ZDdlZWQ5ZTAzZTUzNDE1ZDM3YWE5NjA0NSIsInBhZ2UiOjEsImtleSI6IjE3NDMzNDI5LjUzLjEzMy4wIiwidG90YWwiOm51bGwsImlhdCI6MTY4OTc1ODUzNH0.MIBO5T05EbJruMe_ywWXEs99WJZ4jabI5IciWQugpYE",
"result": [
{
"block_number": "17715655",
"block_timestamp": "2023-07-17T21:27:59.000Z",
"block_hash": "0x58f8652ecb7025849a740fe0d6d270c61f9d0d59b41ab6460f4d9d6bb292b80d",
"transaction_hash": "0xf5e701f9f16f66ec8cdd3fa9f5c52b15410188392a0ffc128777bb89b2c73243",
"transaction_index": 80,
"log_index": 225,
"value": "0",
"contract_type": "ERC1155",
"transaction_type": "Single",
"token_address": "0xd4416b13d2b3a9abae7acd5d6c2bbdbe25686401",
"token_id": "32861001645432232115677216693187330961962340035243999304845689030250465478890",
"from_address": "0x26fcbd3afebbe28d0a8684f790c48368d21665b5",
"from_address_label": null,
"to_address": "0xea97bb00daa1880e0a575b38e723066a398595ea",
"to_address_label": null,
"amount": "1",
"verified": 1,
"operator": "0x11be6670e94c6862dcd92bd4c27753f4df50890d",
"possible_spam": false,
"verified_collection": true
},
// ....
]
}

Congratulations πŸ₯³ You just got all NFT transfers by wallet with just a few lines of code using the Moralis Wallet API!

API Reference​

If you want to know more details on the endpoint and optional parameters, check out:

Support​

If you face any trouble following the tutorial, feel free to reach out to our community engineers in our Discord or Forum to get 24/7 developer support.