Publisher API Reference

This document provides a concise API reference for the Publisher class within the Hedera DID SDK for JavaScript. This class is responsible for submitting transactions to the Hedera network.

Class Diagram

The class diagram below illustrates the core methods of the Publisher interface for interacting with the Hedera network.

publisher class diagram

Constructor

constructor

constructor(client: Client)

Initializes a new Publisher instance.

Parameters
  • client: A Hedera Client instance configured to interact with the Hedera network.

Methods

publish

publish(transaction: Transaction): Promise<TransactionReceipt>

Submits the given transaction to the Hedera network.

Parameters
  • transaction: The transaction to be submitted.

Returns

A promise that resolves to the TransactionReceipt of the submitted transaction.

network

network(): string

Returns the name of the Hedera network the Publisher is configured to use (e.g., "mainnet", "testnet").

Returns

The name of the Hedera network.

publicKey

publicKey(): PublicKey

Returns the public key of the operator account associated with the Hedera Client.

Returns

The public key of the operator account.

Errors

Exception code Description

invalidArgument

Hashgraph SDK Client is required to create a Publisher.

invalidArgument

Hashgraph SDK Client must be configured with a network.

invalidArgument

Hashgraph SDK Client must be configured with an operator account.

internalError

Unknown network, ledger ID: #.

Class Implementation

The Hashgraph DID SDK provides the Publisher class within its publisher-internal package. For further details, refer to the @hashgraph-did-sdk-js/publisher-internal package documentation.