UNPKG

@hashgraphonline/standards-sdk

Version:

The Hashgraph Online Standards SDK provides a complete implementation of the Hashgraph Consensus Standards (HCS), giving developers all the tools needed to build applications on Hedera.

128 lines 5.71 kB
import { PublicKey, TransactionReceipt, PrivateKey } from '@hashgraph/sdk'; import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc'; import { Logger, LogLevel } from '../utils/logger'; import { RetrievedInscriptionResult } from '@kiloscribe/inscription-sdk'; import { HCS10BaseClient } from './base-client'; import { AgentConfig, InscribePfpResponse, StoreHCS11ProfileResponse, AgentRegistrationResult, HandleConnectionRequestResponse, RegistrationProgressCallback, AgentCreationState, GetAccountAndSignerResponse } from './types'; import { InscribeProfileResponse } from '../hcs-11'; import { AgentBuilder } from '../hcs-11/agent-builder'; import { PersonBuilder } from '../hcs-11/person-builder'; /** * Configuration for HCS-10 browser client. * * @example * // Using default Hedera mirror nodes * const config = { * network: 'testnet', * hwc: walletConnectSDK * }; * * @example * // Using HGraph custom mirror node provider * const config = { * network: 'mainnet', * hwc: walletConnectSDK, * mirrorNode: { * customUrl: 'https://mainnet.hedera.api.hgraph.dev/v1/<API-KEY>', * apiKey: 'your-hgraph-api-key' * } * }; */ export type BrowserHCSClientConfig = { /** The Hedera network to connect to */ network: 'mainnet' | 'testnet'; /** Hashinals WalletConnect SDK instance */ hwc: HashinalsWalletConnectSDK; /** Log level for the client */ logLevel?: LogLevel; /** Whether to pretty print logs */ prettyPrint?: boolean; /** Guarded registry topic ID (deprecated) */ guardedRegistryTopicId?: string; /** Base URL for the guarded registry */ guardedRegistryBaseUrl?: string; /** Default fee amount for HIP-991 fee payments */ feeAmount?: number; /** Custom mirror node configuration */ mirrorNode?: import('../services').MirrorNodeConfig; /** Whether to run logger in silent mode */ silent?: boolean; }; export type BrowserAgentConfig = Omit<AgentConfig<BrowserHCSClient>, 'privateKey'> & { client: BrowserHCSClient; }; export type RegisteredAgent = { outboundTopicId: string; inboundTopicId: string; pfpTopicId: string; profileTopicId: string; error?: string; success: boolean; state: AgentCreationState; }; export declare class BrowserHCSClient extends HCS10BaseClient { private hwc; protected logger: Logger; private guardedRegistryBaseUrl; private hcs11Client; constructor(config: BrowserHCSClientConfig); sendMessage(connectionTopicId: string, data: string, memo?: string, submitKey?: PrivateKey, options?: { progressCallback?: RegistrationProgressCallback; waitMaxAttempts?: number; waitIntervalMs?: number; }): Promise<TransactionReceipt>; getPublicKey(accountId: string): Promise<PublicKey>; handleConnectionRequest(inboundTopicId: string, requestingAccountId: string, connectionId: number, connectionMemo?: string, ttl?: number): Promise<HandleConnectionRequestResponse>; confirmConnection(inboundTopicId: string, connectionTopicId: string, connectedAccountId: string, connectionId: number, operatorId: string, memo: string): Promise<number>; create(builder: AgentBuilder | PersonBuilder, options?: { progressCallback?: RegistrationProgressCallback; existingState?: AgentCreationState; ttl?: number; updateAccountMemo?: boolean; }): Promise<RegisteredAgent | InscribeProfileResponse>; private handleProfilePictureCreation; private createAndInscribeProfile; private initializeRegistrationState; private updateStateForCompletedRegistration; registerAgentWithGuardedRegistry(accountId: string, network?: string, options?: { progressCallback?: RegistrationProgressCallback; maxAttempts?: number; delayMs?: number; existingState?: AgentCreationState; }): Promise<AgentRegistrationResult>; createAndRegisterAgent(builder: AgentBuilder, options?: { progressCallback?: RegistrationProgressCallback; maxAttempts?: number; delayMs?: number; existingState?: AgentCreationState; baseUrl?: string; }): Promise<AgentRegistrationResult>; storeHCS11Profile(agentName: string, agentBio: string, inboundTopicId: string, outboundTopicId: string, capabilities?: number[], metadata?: Record<string, any>, pfpBuffer?: Buffer, pfpFileName?: string, existingPfpTopicId?: string, options?: { progressCallback?: RegistrationProgressCallback; }): Promise<StoreHCS11ProfileResponse>; createTopic(memo: string, adminKey?: boolean, submitKey?: boolean): Promise<{ success: boolean; topicId?: string; error?: string; }>; submitPayload(topicId: string, payload: object | string, submitKey?: PrivateKey, requiresFee?: boolean): Promise<TransactionReceipt>; inscribeFile(buffer: Buffer, fileName: string, options?: { progressCallback?: RegistrationProgressCallback; waitMaxAttempts?: number; waitIntervalMs?: number; }): Promise<RetrievedInscriptionResult>; getAccountAndSigner(): GetAccountAndSignerResponse; /** * Inscribes a profile picture (PFP) on HCS-11. * * @param buffer - The buffer containing the PFP image. * @param fileName - The name of the file containing the PFP image. * @param options - Optional configuration options. * @returns A promise that resolves to the topic ID of the inscribed PFP. */ inscribePfp(buffer: Buffer, fileName: string, options?: { progressCallback?: RegistrationProgressCallback; }): Promise<InscribePfpResponse>; private createCommunicationTopics; } //# sourceMappingURL=browser.d.ts.map