ar.io SDKANT Contracts
Versions
getModuleId()
Gets the module ID of the current ANT process by querying its spawn transaction tags. Results are cached after the first successful fetch.
const moduleId = await ant.getModuleId();
console.log(`ANT was spawned with module: ${moduleId}`);
// With custom GraphQL URL and retries
const moduleId = await ant.getModuleId({
graphqlUrl: "https://turbo-gateway.com/graphql",
retries: 5,
});Output:
"FKtQtOOtlcWCW2pXrwWFiCSlnuewMZOHCzhulVkyqBE"getVersion()
Gets the version string of the current ANT by matching its module ID with versions from the ANT registry.
const version = await ant.getVersion();
console.log(`ANT is running version: ${version}`);
// With custom ANT registry
const version = await ant.getVersion({
antRegistryId: "custom-ant-registry-id",
});Output:
"23"isLatestVersion()
Checks if the current ANT version is the latest according to the ANT registry.
const isLatest = await ant.isLatestVersion();
if (!isLatest) {
console.log("ANT can be upgraded to the latest version");
}Output:
trueHow is this guide?