Skip to main content
Version: 2.0

How to get NFT transfers by wallet(s)

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

Step 2: Get NFT Transfers By Wallet(s)

In order to get NFT transfers by wallet(s), Moralis provides you a getWalletsNFTTransfers endpoint to do so.

Here you'll need three parameters: limit, walletAddresses and network.

Once you have obtained the limit, walletAddresses and network, you can copy the following code:

const Moralis = require("moralis").default;

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

const limit = 10;

const walletAddresses = ["0x274c398a921b8e2ba345feac3039e1c8b196a7eb1395cdd3584af3a85eb9ec50"];

const network = "mainnet";

const response = Moralis.AptosApi.wallets.getWalletsNFTTransfers({
limit,
walletAddresses,
network
});

console.log(response.result);
};

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:

{
"cursor": null,
"hasNextPage": false,
"result": [
{
"collection_data_id_hash": "92c681b47797568f7513421a7cc1d47d349a71af66cd91794844543ff5430c67",
"collection_name": "Aptos Wizards",
"creator_address": "0x6d4336aeac8441314cacdd42ea7aae57b3fad71ea26a00186a23eb8f1fa19ffb",
"event_account_address": "0x274c398a921b8e2ba345feac3039e1c8b196a7eb1395cdd3584af3a85eb9ec50",
"event_creation_number": "27",
"event_sequence_number": "0",
"name": "Aptos Wizards #4221",
"property_version": "0",
"token_amount": "1",
"token_data_id_hash": "1eb27f897040b5ae8cf236591354658a2044703bf46307687f916651ca317bda",
"transaction_timestamp": "2023-03-26T21:48:41.000Z",
"transfer_type": "0x3::token_transfers::TokenClaimEvent",
"transaction_version": "108478769",
"coin_amount": null,
"coin_type": null,
"from_address": "0x274c398a921b8e2ba345feac3039e1c8b196a7eb1395cdd3584af3a85eb9ec50",
"to_address": "0xfd55b452c755d56c12860a760f61eb9d8edd46677b8fa59eee905989049620a9"
}
]
}

Congratulations 🥳 You just got the NFT transfers by wallet(s) with just a few lines of code using the Moralis Wallet API!

Youtube Video

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.