TokenFactory class is the single entry point for deploying tokenized real-world assets on either an EVM chain or Stellar. You provide a config object — network, signer, and factory contract address — and call one of the template-specific deploy methods. The factory handles encoding your asset metadata and broadcasting the deployment transaction, returning a DeployResult with the new token address as soon as the transaction is confirmed.
Prerequisites
Install the SDK and ethers if you haven’t already:Deploy a fungible RWA token
- EVM
- Stellar
Construct a
TokenFactory with an EVMAnkaraChainConfig. Your signer must be an ethers.js Signer that has enough native gas on the target chain.Farmland token (full example)
Other EVM template snippets
Each template follows the same pattern — swap the method name and provide the corresponding metadata shape.DeployResult shape
EverydeployFarmland, deployCommodity, deployRealEstate, deployInvoice, deployCarbonCredit, and deployMiningRights call resolves to a DeployResult:
NFT tokens
Use the NFT deploy methods when you need a non-fungible title deed rather than fractional shares. Each returns anNFTDeployResult with nftAddress instead of tokenAddress.
Multi-token contracts
Use multi-token contracts when a single on-chain deployment needs to track many commodity batches (ERC-1155 warehouse receipts) or pool together multiple assets (a fund-style PoolVault).MultiTokenDeployResult:
Reading asset metadata after deploy
After a token is deployed, useAssetRegistry to read and write its on-chain metadata. Construct it with the adapter from your TokenFactory instance and the address from DeployResult:
AssetRegistry also exposes write methods (updateValuation, setStatus, mint, pause, and template-specific actions like retire for carbon credits). See the SDK reference for the full API.
CLI quick-start
If you prefer an interactive terminal flow, the Ankara Chain CLI wraps all of the above in a guided prompt. Install it once and run:ankara.config.json.