Convert hex address to clusters name
Last updated
// This will return { clusterName: "clusters", walletName: "main" }
const { clusterName, walletName } = await clusters.getName('0x5755d1dcea21caa687339c305d143e6e78f96adf');import { getImageUrl, getProfileUrl } from "@clustersxyz/sdk";
// https://cdn.clusters.xyz/profile/clusters
const profileImage = getImageUrl(clusterName);
// https://clusters.xyz/clusters
const profileUrl = getProfileUrl(clusterName);const cluster = await clusters.getClusterByName('clusters');
/*
{
"id": "0xa8d12b92b91fe0db3651ff2d45c1f47b1bb343054e9cd1e556c73f2330269224",
"createdBy": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
"createdAt": "2024-02-14 21:39:05+00",
"wallets": [
{
"address": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
"name": "main",
"isVerified": true,
"isPrivate": false,
"isBackedUp": false,
"updatedAt": "2024-02-09 15:21:22+00",
"updatedBy": "0x5cff9c1362a71247da33887be2a44ac36a8724bb",
"createdAt": "2024-02-09 15:21:22+00"
}
],
"isTestnet": false
}
*/import { Clusters } from "@clustersxyz/sdk";
const clusters = new Clusters();
const clusterName = await clusters.getNames([
'0x5755d1dcea21caa687339c305d143e6e78f96adf',
'0xccdead94e8cf17de32044d9701c4f5668ad0bef9'
]);
/*
[
{
"address": "0x5755d1dcea21caa687339c305d143e6e78f96adf",
"name": "clusters/main"
},
{
"address": "0xccdead94e8cf17de32044d9701c4f5668ad0bef9",
"name": "layerzero/main"
}
]
*/