Skip to main content
AssetRegistry is the SDK class for reading and writing metadata on an already-deployed Ankara Chain token. Pass it the adapter you used to configure TokenFactory, the token’s contract address, and the asset template string — it then exposes a fully typed method surface for every operation supported by that template.
AssetRegistry wraps an existing token; it does not deploy new ones. Use TokenFactory to deploy first, then construct an AssetRegistry with the returned tokenAddress.

Import


Constructor

IAdapter
required
The EVMAdapter or StellarAdapter instance. Obtain it from tokenFactory.adapter or construct one directly.
string
required
The deployed token contract address (EVM hex address or Stellar contract ID).
AssetTemplate | NFTAssetTemplate
required
The asset template the token was deployed with. Must match the on-chain contract — the registry uses this to route calls to the correct ABI methods.Fungible templates: "farmland" | "commodity" | "real-estate" | "invoice" | "carbon-credit" | "mining-rights"NFT templates: "farmland-nft" | "real-estate-nft" | "mining-rights-nft" | "commodity-vault-nft"

Generic Read Methods

These methods work on all fungible templates.

getName

Returns the token name set at deployment time.

getSymbol

Returns the ticker symbol.

getTotalSupply

Returns the total token supply in wei.

getBalanceOf

Returns the token balance of a given wallet address in wei.
string
required
The wallet or contract address to query.

getStatus

Returns the current lifecycle status of the token.
enum
DRAFT (0) · ACTIVE (1) · SUSPENDED (2) · REDEEMED (3) · EXPIRED (4)

getCountryCode

Returns the ISO 3166-1 alpha-2 country code stored on-chain at deployment.

getIdentityVerifier

Returns the address of the configured identity verifier contract. Returns the zero address if no KYC gating is active.

getVersion

Returns the on-chain metadata version number. This increments each time an admin update is recorded, providing a simple audit trail.

getMetadata

Returns the full template-specific metadata struct. The return type is the union of all metadata interfaces — narrow it using the template you passed to the constructor.

getValuationUSD

Returns the most recent USD valuation stored in the metadata, in wei (1e18 = $1).

Generic Write Methods

These methods work on all fungible templates and require the appropriate on-chain role (typically DEFAULT_ADMIN_ROLE or MANAGER_ROLE).

setStatus

Updates the asset lifecycle status. Returns the transaction hash.
AssetStatus
required
The target status. Import AssetStatus from @ankarachain/sdk.

setIdentityVerifier

Sets or replaces the KYC identity verifier. Pass the zero address ("0x0000000000000000000000000000000000000000") to remove KYC gating.
string
required
Address of the verifier contract, or the zero address to disable verification.

mint

Mints new tokens to the specified address. Requires MINTER_ROLE.
string
required
Recipient wallet address.
bigint
required
Amount in wei.

pause

Pauses all token transfers. Requires admin role.

unpause

Resumes token transfers after a pause.

Farmland & Real Estate Methods

updateValuation

Updates the USD valuation stored in the token’s metadata. Available on farmland and real-estate templates only.
bigint
required
New valuation in wei (e.g. 150_000n * 10n ** 18n for $150,000).

Real Estate Methods

updateOccupancyStatus

Updates the occupancy status. Only available on the real-estate template.
string
required
One of "Vacant", "Owner-occupied", or "Tenanted".

declareRentalDistribution

Records a rental income distribution event on-chain for audit purposes. Only available on the real-estate template.
bigint
required
Total distribution amount in USD wei.

Commodity Methods

isExpired

Returns true if the commodity’s expiryDate has passed. Only available on the commodity template.

markExpired

Marks the commodity token as expired on-chain, transitioning its status accordingly. Only available on the commodity template.

Invoice Methods

getInvoiceStatus

Returns the invoice’s payment lifecycle status. Only available on the invoice template.
enum
PENDING (0) · FUNDED (1) · REPAID (2) · DEFAULTED (3)

isOverdue

Returns true if the invoice is past its due date and still in PENDING or FUNDED status.

markFunded

Transitions the invoice from PENDING to FUNDED. Call this once the investor has funded the invoice.

markRepaid

Transitions the invoice to REPAID. Call this once the debtor has settled the invoice.

markDefaulted

Marks the invoice as DEFAULTED and records a human-readable reason on-chain.
string
required
Free-text reason for default, e.g. "Debtor insolvent — court reference NG/2024/0042".

Carbon Credit Methods

retire

Burns carbon credits and records an immutable retirement event on-chain. Only available on the carbon-credit template.
bigint
required
Amount of credits to retire, in wei (1e18 = 1 tCO₂e).
string
required
Entity on whose behalf the offset is being made (can be a name string stored as calldata, or an address).
string
required
Reason or project reference, e.g. "Flight offset — Abuja–Lagos Q1 2025".

getTotalRetired

Returns the cumulative amount of credits retired in wei.

getTotalRetirements

Returns the total number of retirement events recorded.

getRetirement

Returns a specific retirement event by its zero-based index.
string
Wallet address that called retire().
bigint
Credits retired in that event, in wei.
bigint
Unix timestamp of the retirement.
string
The beneficiary string passed to retire().
string
The note string passed to retire().

Mining Rights Methods

isLicenseExpired

Returns true if the mining licence has passed its licenseExpiry timestamp.

renewLicense

Extends the licence expiry date on-chain.
bigint
required
New Unix timestamp for licence expiry.

markLicenseExpired

Manually records the licence as expired on-chain.

declareRoyalty

Records a royalty declaration event based on extraction value. The royalty amount is calculated on-chain from the token’s royaltyRateBps setting.
bigint
required
Total extraction value in USD wei for the period being declared.

NFT Methods

The following methods are only available when the AssetRegistry is constructed with an NFT template ("farmland-nft", "real-estate-nft", "mining-rights-nft", "commodity-vault-nft").

getTokenMetadata

Returns the metadata stored for a specific NFT token ID.

getTokenVersion

Returns the metadata version for a specific token ID.

ownerOf

Returns the current owner of the given token ID.

linkToERC20

Links the NFT collection to a corresponding ERC-20 fungible token, enabling NFT ↔ fungible interoperability.
string
required
Address of the ERC-20 token to link.

Properties


Type Reference

Template-specific methods (updateValuation, retire, etc.) throw a descriptive Error at runtime if called on a registry constructed with a different template. This is a developer-safety guard — the TypeScript types do not currently enforce the constraint at compile time, because the registry uses a single union template type.