HCS‑5 API Reference
Sources
Import PathsDirect link to Import Paths
- TypeScript
- Go
import {
HCS5Client,
HCS5BrowserClient,
type HCS5ClientConfig,
type HCS5MintOptions,
type HCS5CreateHashinalOptions,
type HCS5MintResponse,
buildHcs1Hrl,
} from '@hashgraphonline/standards-sdk';
import (
"github.com/hashgraph-online/standards-sdk-go/pkg/hcs5"
"github.com/hashgraph-online/standards-sdk-go/pkg/inscriber"
)
TypesDirect link to Types
- TypeScript
- Go
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;
}
type ClientConfig struct {
OperatorAccountID string
OperatorPrivateKey string
Network string
InscriberAuthURL string
InscriberAPIURL string
}
type MintOptions struct {
TokenID string
MetadataTopicID string
SupplyKey string
Memo string
}
type CreateHashinalOptions struct {
TokenID string
Request inscriber.StartInscriptionRequest
WaitForCompletion bool
SupplyKey string
Memo string
InscriberNetwork inscriber.Network
InscriberAuthURL string
InscriberAPIURL string
}
type MintResponse struct {
Success bool
SerialNumber int64
TransactionID string
Metadata string
Error string
}
Server Client (HCS5Client)Direct link to Server Client (HCS5Client)
- TypeScript
- Go
constructor(config: HCS5ClientConfig)
mint(options: HCS5MintOptions): Promise<HCS5MintResponse>
createHashinal(options: HCS5CreateHashinalOptions): Promise<HCS5MintResponse>
func NewClient(config ClientConfig) (*Client, error)
func (c *Client) Mint(ctx context.Context, options MintOptions) (MintResponse, error)
func (c *Client) CreateHashinal(ctx context.Context, options CreateHashinalOptions) (MintResponse, error)
Notes
createHashinalinscribes content first (waits for confirmation) and reuses the resulting topic as metadata for minting.- If a raw
supplyKeyis 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
- TypeScript
- Go
function buildHcs1Hrl(topicId: string): string; // e.g., hcs://1/<topicId>
func BuildHCS1HRL(topicID string) string // e.g., hcs://1/<topicId>
Builders (tx.ts)Direct link to Builders (tx.ts)
- TypeScript
- Go
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;
func BuildMintTx(tokenID string, metadata string, transactionMemo string) (*hedera.TokenMintTransaction, error)
func BuildMintWithHRLTx(tokenID string, metadataTopicID string, transactionMemo string) (*hedera.TokenMintTransaction, error)
Throws / ErrorsDirect link to Throws / Errors
Failed to mint HCS-5 Hashinal: …Failed to inscribe and mint HCS-5 Hashinal: …
ExampleDirect link to Example
- TypeScript
- Go
const c = new HCS5Client({ network: 'testnet', operatorId, operatorKey });
const hr = await c.createHashinal({ tokenId, inscriptionInput: { type: 'url', url: 'https://…' } });
client, _ := hcs5.NewClient(hcs5.ClientConfig{
Network: "testnet",
OperatorAccountID: os.Getenv("HEDERA_ACCOUNT_ID"),
OperatorPrivateKey: os.Getenv("HEDERA_PRIVATE_KEY"),
})
hr, _ := client.CreateHashinal(context.Background(), hcs5.CreateHashinalOptions{
TokenID: tokenId,
Request: inscriber.StartInscriptionRequest{
Content: "https://...",
},
})