UNPKG

@hashgraphonline/hedera-agent-kit

Version:

Build LLM-powered applications that interact with the Hedera Network. Create conversational agents that can understand user requests in natural language and execute Hedera transactions, or build backend systems that leverage AI for on-chain operations.

52 lines (50 loc) 2.52 kB
import { AccountId, Transaction, TransactionReceipt, PrivateKey } from '@hashgraph/sdk'; import { AbstractSigner } from './abstract-signer'; import { HederaNetworkType } from '../types'; import { HashinalsWalletConnectSDK } from '@hashgraphonline/hashinal-wc'; /** * A signer implementation for browser environments that uses HashConnect for signing. * It delegates signing operations to an instance of HashinalsWalletConnectSDK. */ export declare class BrowserSigner extends AbstractSigner { private networkInternal; private accountIdInternal; private hwcSdk; /** * Constructs a BrowserSigner instance. * @param {HashinalsWalletConnectSDK} hwcSdk - An initialized HashinalsWalletConnectSDK instance. * @param {HederaNetworkType} network - The Hedera network ('mainnet' or 'testnet'). * @param {string | AccountId} accountId - The Hedera account ID this signer will represent (must be paired with hwcSdk). */ constructor(hwcSdk: HashinalsWalletConnectSDK, network: HederaNetworkType, accountId: string | AccountId); /** * Retrieves the Hedera account ID associated with this signer. * @returns {AccountId} The Hedera AccountId object. */ getAccountId(): AccountId; /** * Signs and executes a Hedera transaction using the HashinalsWalletConnectSDK, * returning the transaction receipt. Transaction freezing is handled by HashinalsWalletConnectSDK. * @param {Transaction} transaction - The transaction to sign and execute. * @returns {Promise<TransactionReceipt>} A promise that resolves to the transaction receipt. * @throws {Error} If the transaction fails or is rejected. */ signAndExecuteTransaction(transaction: Transaction): Promise<TransactionReceipt>; /** * Retrieves the Hedera network type this signer is configured for. * @returns {HederaNetworkType} The configured Hedera network type ('mainnet' or 'testnet'). */ getNetwork(): HederaNetworkType; /** * Retrieves the operator's private key. * For BrowserSigner, this is not available as signing is delegated to the user's wallet via WalletConnect. * @returns {string | PrivateKey} Throws an error as private key is not accessible. * @throws {Error} Always, as BrowserSigner does not hold private keys. */ getOperatorPrivateKey(): string | PrivateKey; /** * Retrieves the Hedera client instance. * @returns {Client} The Hedera client instance. */ getClient(): any; }