HCS‑7 API Reference
Import MapDirect link to Import Map
- TypeScript
- Go
import {
HCS7Client,
HCS7BrowserClient,
HCS7ConfigType,
type HCS7RegisterConfigOptions,
type HCS7RegisterMetadataOptions,
type HCS7CreateRegistryOptions,
type HCS7RegistryTopic,
} from '@hashgraphonline/standards-sdk';
import {
EVMBridge,
MapCache,
type EVMConfig,
} from '@hashgraphonline/standards-sdk';
import {
WasmBridge,
type WASMConfig,
} from '@hashgraphonline/standards-sdk';
import {
RedisCache,
type RedisConfig,
} from '@hashgraphonline/standards-sdk';
import {
buildHcs7CreateRegistryTx,
buildHcs7SubmitMessageTx,
buildHcs7EvmMessageTx,
buildHcs7WasmMessageTx,
} from '@hashgraphonline/standards-sdk';
NewClient(config ClientConfig) (*Client, error)
Client.CreateRegistry(ctx, CreateRegistryOptions) (CreateRegistryResult, error)
Client.RegisterConfig(ctx, RegisterConfigOptions) (RegistryOperationResult, error)
Client.RegisterMetadata(ctx, RegisterMetadataOptions) (RegistryOperationResult, error)
Client.GetRegistry(ctx, topicID string, QueryRegistryOptions) (RegistryTopic, error)
BuildCreateRegistryTx(CreateRegistryTxParams) *hedera.TopicCreateTransaction
BuildSubmitMessageTx(topicID string, Message, transactionMemo string) (*hedera.TopicMessageSubmitTransaction, error)
Types: AbiIO, AbiDefinition, EvmConfigPayload, WasmConfigPayload, Message, ClientConfig
RegisterConfigOptions, RegisterMetadataOptions
HCS7ClientDirect link to hcs7client
- TypeScript
- Go
class HCS7Client {
constructor(config: {
network: 'testnet' | 'mainnet';
operatorId: string | AccountId;
operatorKey: string | PrivateKey;
keyType?: 'ed25519' | 'ecdsa';
mirrorNodeUrl?: string;
logger?: Logger;
});
createRegistry(options?: HCS7CreateRegistryOptions): Promise<HCS7TopicRegistrationResponse>;
registerConfig(options: HCS7RegisterConfigOptions): Promise<HCS7RegistryOperationResponse>;
registerMetadata(options: HCS7RegisterMetadataOptions): Promise<HCS7RegistryOperationResponse>;
getRegistry(topicId: string, opts?: HCS7QueryRegistryOptions): Promise<HCS7RegistryTopic>;
close(): void;
}
// See standards-sdk-go for full Go API types and methods
- Automatically builds the
hcs-7:indexed:{ttl}memo. - Validates all payloads with zod before submitting.
- Uses the Hedera SDK under the hood.
TypesDirect link to Types
- TypeScript
- Go
interface HCS7CreateRegistryOptions {
ttl?: number; // default 86_400
submitKey?: boolean | string | PrivateKey;
adminKey?: boolean | string | PrivateKey;
}
interface HCS7RegisterConfigOptions {
registryTopicId: string;
memo?: string;
transactionMemo?: string;
submitKey?: string | PrivateKey;
config: HCS7RegisterConfigInput;
}
type HCS7RegisterConfigInput =
| {
type: HCS7ConfigType.EVM;
contractAddress: string;
abi: HCS7AbiDefinition;
}
| {
type: HCS7ConfigType.WASM;
wasmTopicId: string;
inputType: { stateData: Record<string, HCS7StateValueType> };
outputType: { type: 'string'; format: 'topic-id' };
};
interface HCS7RegisterMetadataOptions {
registryTopicId: string;
metadataTopicId: string;
memo?: string;
weight: number;
tags: string[];
data?: Record<string, unknown>;
transactionMemo?: string;
submitKey?: string | PrivateKey;
}
// See standards-sdk-go for full Go API types and methods
HCS7BrowserClientDirect link to hcs7browserclient
Same API surface as HCS7Client, but constructor accepts { network, hwc } where hwc is an instance of HashinalsWalletConnectSDK. Transactions are routed through WalletConnect’s submitMessageToTopic / createTopic helpers.
EVMBridgeDirect link to evmbridge
- TypeScript
- Go
class EVMBridge {
constructor(
network?: string,
mirrorNodeUrl?: string,
cache?: EVMCache,
);
executeCommands(configs: EVMConfig[], initialState?: Record<string, any>): Promise<{
results: Record<string, any>;
stateData: Record<string, any>;
}>;
executeCommand(config: EVMConfig, stateData?: Record<string, any>): Promise<{
result: any;
stateData: Record<string, any>;
}>;
clearCache(): Promise<void>;
}
interface EVMConfig {
c: {
contractAddress: string;
abi: {
name: string;
inputs?: HCS7AbiIO[];
outputs?: HCS7AbiIO[];
stateMutability: 'view' | 'pure';
type?: 'function';
};
};
}
interface EVMCache {
get(key: string): Promise<string | undefined> | string | undefined;
set(key: string, value: string): Promise<void> | void;
delete(key: string): Promise<void> | void;
clear(): Promise<void> | void;
}
class MapCache implements EVMCache { /* in-memory */ }
class RedisCache implements EVMCache { constructor(config?: RedisConfig); }
// See standards-sdk-go for full Go API types and methods
WasmBridgeDirect link to wasmbridge
- TypeScript
- Go
class WasmBridge {
initWasm(wasmBytes: BufferSource): Promise<WasmExports>;
executeWasm(stateData: Record<string, any>, messages: BaseMessage[]): string;
createStateData(wasmConfig: WASMConfig, state?: Record<string, any>): Record<string, any>;
createWasmFunction(fn: (...args: any[]) => any): (...args: string[]) => string;
getParams(): string;
}
interface WASMConfig {
c: {
wasmTopicId: string;
inputType: { stateData: Record<string, HCS7StateValueType> };
outputType: { type: 'string'; format: 'topic-id' };
};
}
// See standards-sdk-go for full Go API types and methods
BuildersDirect link to Builders
buildHcs7CreateRegistryTxbuildHcs7SubmitMessageTxbuildHcs7EvmMessageTxbuildHcs7WasmMessageTx
See the Transactions guide for usage details.
Demo UtilitiesDirect link to Demo Utilities
The package also ships an end-to-end CLI at demo/hcs-7/create-hcs-7-topic.ts and a Rust/WASM toolkit in hcs-7-toolkit to help you stand up registries quickly.