Skip to main content

How to get coin metadata by creator addresses

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 transactions​

In order to get coin metadata by creator addresses, Moralis provides you a getCoinsByCreators endpoint to do so.

Here you'll need two parameters: limit and creatorAddresses.

Once you have obtained both the limit and creatorAddresses, 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 creatorAddresses =
"0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa";

const response = await Moralis.AptosApi.coins.getCoinsByCreators({
limit,
creatorAddresses,
});

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": [
{
"coin_type": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDD",
"coin_type_hash": "01c715215141a93bd423637fda0ca77f619a60f2038db6205df3dab00cf4955f",
"name": "Decentralized USD",
"creator_address": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa",
"decimals": 6,
"supply_aggregator_table_handle": null,
"supply_aggregator_table_key": null,
"symbol": "USDD",
"transaction_created_timestamp": "2022-10-27T17:21:45.000Z",
"transaction_version_created": "15017856"
},
{
"coin_type": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDT",
"coin_type_hash": "175cc6491b0d75a131a36391318cde4c4b1312de70675c7e46cc54dacfe7ae29",
"name": "Tether USD",
"creator_address": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa",
"decimals": 6,
"supply_aggregator_table_handle": null,
"supply_aggregator_table_key": null,
"symbol": "USDT",
"transaction_created_timestamp": "2022-10-19T02:43:38.000Z",
"transaction_version_created": "2413215"
},
{
"coin_type": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::USDC",
"coin_type_hash": "6bcbe340e5091769502fb9a6c83157e66850ed1e151ccfcd5577ea952e5035e9",
"name": "USD Coin",
"creator_address": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa",
"decimals": 6,
"supply_aggregator_table_handle": null,
"supply_aggregator_table_key": null,
"symbol": "USDC",
"transaction_created_timestamp": "2022-10-19T02:44:02.000Z",
"transaction_version_created": "2413754"
},
{
"coin_type": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa::asset::WETH",
"coin_type_hash": "980da8a2350c887ac01c05f390204e13b52be3ca86e7781783fd2b874445827e",
"name": "Wrapped Ether",
"creator_address": "0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa",
"decimals": 6,
"supply_aggregator_table_handle": null,
"supply_aggregator_table_key": null,
"symbol": "WETH",
"transaction_created_timestamp": "2022-10-19T02:43:21.000Z",
"transaction_version_created": "2412846"
}
]
}

Congratulations 🥳 You just got coin metadata by creator addresses with just a few lines of code using the Moralis Coin 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.