Skip to main content

HCS‑5 API Reference

Sources

Import PathsDirect link to Import Paths​

import {
HCS5Client,
HCS5BrowserClient,
type HCS5ClientConfig,
type HCS5MintOptions,
type HCS5CreateHashinalOptions,
type HCS5MintResponse,
buildHcs1Hrl,
} from '@hashgraphonline/standards-sdk';

TypesDirect link to Types​

interface HCS5ClientConfig {
network: 'mainnet' | 'testnet';
operatorId: string; // Server only
operatorKey: string | import('@hashgraph/sdk').PrivateKey; // Server only
logLevel?: 'debug' | 'info' | 'warn' | 'error';
silent?: boolean;
mirrorNodeUrl?: string;
logger?: any;
}

interface HCS5MintOptions {
tokenId: string;
metadataTopicId: string; // HCS‑1/12 content topic
supplyKey?: string | import('@hashgraph/sdk').PrivateKey;
memo?: string;
}

interface HCS5CreateHashinalOptions {
tokenId: string;
inscriptionInput: import('../inscribe/inscriber').InscriptionInput; // file/buffer/url/topic
inscriptionOptions?: import('../inscribe/inscriber').InscriptionOptions;
supplyKey?: string | import('@hashgraph/sdk').PrivateKey;
memo?: string;
}

interface HCS5MintResponse {
success: boolean;
serialNumber?: number;
transactionId?: string;
metadata?: string; // HRL used as NFT metadata
error?: string;
}

Server Client (HCS5Client)Direct link to Server Client (HCS5Client)​

constructor(config: HCS5ClientConfig)

mint(options: HCS5MintOptions): Promise<HCS5MintResponse>

createHashinal(options: HCS5CreateHashinalOptions): Promise<HCS5MintResponse>

Notes

  • createHashinal inscribes content first (waits for confirmation) and reuses the resulting topic as metadata for minting.
  • If a raw supplyKey is a string, it may be resolved via Mirror Node to the correct curve using NodeOperatorResolver.

Browser Client (HCS5BrowserClient)Direct link to Browser Client (HCS5BrowserClient)​

Mirrors server flows but uses wallet signing for inscription and mint. Returns similar responses.

HelperDirect link to Helper​

function buildHcs1Hrl(topicId: string): string; // e.g., hcs://1/<topicId>

Builders (tx.ts)Direct link to Builders (tx.ts)​

function buildHcs5MintTx(params: { tokenId: string; metadata: string; transactionMemo?: string }): import('@hashgraph/sdk').TokenMintTransaction;

function buildHcs5MintWithHrlTx(params: { tokenId: string; metadataTopicId: string; transactionMemo?: string }): import('@hashgraph/sdk').TokenMintTransaction;

Throws / ErrorsDirect link to Throws / Errors​

  • Failed to mint HCS-5 Hashinal: …
  • Failed to inscribe and mint HCS-5 Hashinal: …

ExampleDirect link to Example​

const c = new HCS5Client({ network: 'testnet', operatorId, operatorKey });
const hr = await c.createHashinal({ tokenId, inscriptionInput: { type: 'url', url: 'https://…' } });