How to get coin metadata by creator addresses
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 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:
- index.js (JavaScript)
- index.ts (TypeScript)
- index.py (Python)
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();
import Moralis from "moralis";
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();
from moralis import aptos_api
api_key = "YOUR_API_KEY"
params = {
"network": "mainnet",
"limit": 10,
"creator_addresses": ["0xf22bede237a07e121b56d91a491eb7bcdfd1f5907926a9e58338f964a01b17fa"]
}
result = aptos_api.coins.get_coins_by_creators(
api_key=api_key,
params=params,
)
print(result)
Step 3: Run the scriptβ
To run the script, enter the following command:
- Shell (JavaScript)
- Shell (TypeScript)
- Shell (Python)
node index.js
ts-node index.ts
python index.py
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.