Skip to main content

HCS‑15 API Reference

Sources

Import Paths

import {
HCS15Client,
HCS15BrowserClient,
type SDKHCS15ClientConfig,
type BrowserHCS15ClientConfig,
buildHcs15BaseAccountCreateTx,
buildHcs15PetalAccountCreateTx,
} from '@hashgraphonline/standards-sdk/hcs-15';

Node Client (HCS15Client)

constructor(config: SDKHCS15ClientConfig)
getKeyType(): 'ed25519' | 'ecdsa'
close(): Promise<void>

createBaseAccount(options?: { initialBalance?: number; maxAutomaticTokenAssociations?: number; accountMemo?: string }): Promise<{
accountId: string; privateKey: import('@hashgraph/sdk').PrivateKey; privateKeyHex: string; publicKey: import('@hashgraph/sdk').PublicKey; evmAddress: string; receipt: import('@hashgraph/sdk').TransactionReceipt;
}>

createPetalAccount(params: { basePrivateKey: string | import('@hashgraph/sdk').PrivateKey; initialBalance?: number; maxAutomaticTokenAssociations?: number; accountMemo?: string }): Promise<{ accountId: string; receipt: import('@hashgraph/sdk').TransactionReceipt }>

Browser Client (HCS15BrowserClient)

Wallet‑signed counterparts for creating base and petal accounts. Returns similar shapes; accountId may be provided by wallet flows.

Base Client

verifyPetalAccount(petalAccountId: string, baseAccountId: string): Promise<boolean> // compares mirror‑node key material

Builders

function buildHcs15BaseAccountCreateTx(params: { publicKey: import('@hashgraph/sdk').PublicKey; initialBalance?: import('@hashgraph/sdk').Hbar|number; maxAutomaticTokenAssociations?: number; accountMemo?: string }): import('@hashgraph/sdk').AccountCreateTransaction;

function buildHcs15PetalAccountCreateTx(params: { publicKey: import('@hashgraph/sdk').PublicKey; initialBalance?: import('@hashgraph/sdk').Hbar|number; maxAutomaticTokenAssociations?: number; accountMemo?: string }): import('@hashgraph/sdk').AccountCreateTransaction;

Errors

  • HCS-15 BASE_ACCOUNT_CREATE_FAILED
  • HCS-15 PETAL_ACCOUNT_CREATE_FAILED

Example

const c = new HCS15Client({ network: 'testnet', operatorId, operatorKey });
const base = await c.createBaseAccount({ initialBalance: 10 });
await c.createPetalAccount({ basePrivateKey: base.privateKey });