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.2

How to get coin transfers by wallet(s)

Step 1: Setup Moralis​

Read the article Setting Up Moralis: Getting Started and make sure to finish all the steps. Only after that you can go ahead to complete this guide.

Step 2: Get Coin Transfers By Wallet(s)​

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

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

Once you have obtained the limit, ownerAddresses 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 ownerAddresses = [
"0x274c398a921b8e2ba345feac3039e1c8b196a7eb1395cdd3584af3a85eb9ec50",
];

const network = "mainnet";

const response = Moralis.AptosApi.coins.getCoinTransfersByOwnerAddresses({
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": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ2IjoiMjAyMy0wMy0yMVQyMTo1NTo0MS4wMDBaIiwibyI6MiwiaWF0IjoxNjgyMDY3NTc2fQ.505lbLYPA4Vg4aUNbZIqv9CsgbcyaHeSgcySFwgOqpM",
"hasNextPage": true,
"result": [
{
"activity_type": "0x1::coin::WithdrawEvent",
"amount": "18620000",
"block_height": "42022697",
"coin_type": "0x1::aptos_coin::AptosCoin",
"event_account_address": "0x274c398a921b8e2ba345feac3039e1c8b196a7eb1395cdd3584af3a85eb9ec50",
"event_creation_number": "3",
"event_sequence_number": "11",
"is_gas_fee": false,
"entry_function_id_str": "0x1::aptos_account::transfer",
"is_transaction_success": true,
"owner_address": "0x274c398a921b8e2ba345feac3039e1c8b196a7eb1395cdd3584af3a85eb9ec50",
"transaction_timestamp": "2023-03-26T21:48:28.000Z",
"transaction_version": "108478684"
}
]
}

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.