/** * @file Node health tracking for smart failover. * @license BSD-3-Clause-No-Military-License * * Tracks per-node, per-API health to enable intelligent failover decisions. * Nodes that fail for specific APIs are deprioritized for those APIs while * remaining available for others. Stale nodes (behind on head block) are * also deprioritized. */ /** * Tuning options for Pollen's RPC node health tracker. * * @remarks * These values shape how aggressively a client deprioritizes nodes after * failures, plugin-specific errors, stale head blocks, or HTTP 429 rate limits. * * @example * ```ts * const client = new Client(['https://api.hive.blog', 'https://api.openhive.network'], { * healthTrackerOptions: { * maxFailuresBeforeCooldown: 2, * staleBlockThreshold: 15 * } * }) * ``` */ export interface HealthTrackerOptions { /** * How long (ms) to deprioritize a node after consecutive failures. * Default: 30 seconds. */ nodeCooldownMs?: number; /** * How long (ms) to deprioritize a node for a specific API after failures. * Default: 60 seconds. */ apiCooldownMs?: number; /** * Number of consecutive failures before a node enters cooldown. * Default: 3. */ maxFailuresBeforeCooldown?: number; /** * Number of API-specific failures before deprioritizing for that API. * Default: 2. */ maxApiFailuresBeforeCooldown?: number; /** * How many blocks behind the best known head block a node can be * before being considered stale. Default: 30. */ staleBlockThreshold?: number; /** * How long (ms) head block data remains valid for staleness checks. * Default: 2 minutes. */ headBlockTtlMs?: number; /** * Default duration (ms) to skip a node after receiving a 429 response, * used when the server doesn't provide a Retry-After header. * Default: 10 seconds. */ defaultRateLimitMs?: number; } /** * Tracks per-node health for resilient Hive RPC failover. * * @remarks * `NodeHealthTracker` separates global node failures from API/plugin-specific * failures. A node missing `rc_api` can be deprioritized for RC calls while * remaining available for database reads. It also tracks rate-limit cooldowns * and stale head-block data so Pollen can prefer fresher nodes. * * @example * ```ts * const tracker = new NodeHealthTracker({ staleBlockThreshold: 20 }) * tracker.recordSuccess('https://api.hive.blog', 'condenser_api') * * const ordered = tracker.getOrderedNodes([ * 'https://api.hive.blog', * 'https://api.openhive.network' * ]) * ``` */ export declare class NodeHealthTracker { private health; private bestKnownHeadBlock; private bestKnownHeadBlockTime; private readonly nodeCooldownMs; private readonly apiCooldownMs; private readonly maxFailuresBeforeCooldown; private readonly maxApiFailuresBeforeCooldown; private readonly staleBlockThreshold; private readonly headBlockTtlMs; private readonly defaultRateLimitMs; /** * Creates a health tracker with optional cooldown and freshness tuning. * * @param options - Health tracker thresholds and cooldown durations. */ constructor(options?: HealthTrackerOptions); private getOrCreate; /** * Records a successful call to a node for a specific API. * * @param node - RPC endpoint URL. * @param api - API namespace that succeeded. * * @remarks * Success clears the global consecutive failure counter and any API-specific * failures for the namespace that just succeeded. * * @example * ```ts * tracker.recordSuccess('https://api.hive.blog', 'condenser_api') * ``` */ recordSuccess(node: string, api: string): void; /** * Records a network-level failure for a node and API. * * @param node - RPC endpoint URL. * @param api - API namespace that failed. * * @remarks * Network failures increment both the global consecutive failure count and the * API-specific failure count because they make the whole endpoint suspect. * * @example * ```ts * tracker.recordFailure('https://api.hive.blog', 'bridge') * ``` */ recordFailure(node: string, api: string): void; /** * Records that a node returned HTTP 429. * * @param node - RPC endpoint URL. * @param retryAfterSeconds - Optional `Retry-After` header value in seconds. * * @remarks * Rate-limited nodes are skipped until their cooldown expires. If the server * omits `Retry-After`, Pollen uses `defaultRateLimitMs`. * * @example * ```ts * tracker.recordRateLimit('https://api.hive.blog', 10) * ``` */ recordRateLimit(node: string, retryAfterSeconds?: number): void; /** * Checks whether a node is currently in a rate-limit cooldown. * * @param node - RPC endpoint URL. * @returns True when a prior 429 cooldown has not expired. * * @example * ```ts * if (!tracker.isRateLimited(node)) { * // node can be attempted * } * ``` */ isRateLimited(node: string): boolean; /** * Records an API/plugin-specific failure. * * @param node - RPC endpoint URL. * @param api - API namespace that failed. * * @remarks * This does not increment the global node failure counter. It is designed for * cases such as `method not found` where one plugin is disabled but other APIs * on the same node may still be healthy. * * @example * ```ts * tracker.recordApiFailure('https://api.hive.blog', 'transaction_status_api') * ``` */ recordApiFailure(node: string, api: string): void; private incrementApiFailure; /** * Updates the last observed head block number for a node. * * @param node - RPC endpoint URL. * @param headBlock - Head block number reported by the node. * * @remarks * The client calls this passively when * `get_dynamic_global_properties` responses are observed, allowing failover to * prefer nodes that are not lagging behind the best known head. * * @example * ```ts * tracker.updateHeadBlock('https://api.hive.blog', 90_000_000) * ``` */ updateHeadBlock(node: string, headBlock: number): void; /** * Checks whether a node should be preferred for a given API. * * @param node - RPC endpoint URL. * @param api - Optional API namespace for plugin-specific health. * @returns True when the node is not cooling down, rate-limited, or stale. * * @example * ```ts * const healthy = tracker.isNodeHealthy('https://api.hive.blog', 'bridge') * ``` */ isNodeHealthy(node: string, api?: string): boolean; /** * Orders endpoint URLs by current health for an API call. * * @param allNodes - Endpoints in caller-preferred order. * @param api - Optional API namespace for plugin-specific health. * @returns Healthy nodes first, preserving relative order, followed by * unhealthy nodes as fallback. * * @example * ```ts * const ordered = tracker.getOrderedNodes(nodes, 'condenser_api') * ``` */ getOrderedNodes(allNodes: string[], api?: string): string[]; /** * Clears all tracked health, rate-limit, and freshness data. * * @example * ```ts * tracker.reset() * ``` */ reset(): void; /** * Returns a diagnostic snapshot of tracked node health. * * @returns A map keyed by node URL with failure counts, head block, API * failure counts, and current health. * * @example * ```ts * for (const [node, health] of tracker.getHealthSnapshot()) { * console.log(node, health.healthy) * } * ``` */ getHealthSnapshot(): Map; healthy: boolean; }>; } /** * @file Hive asset type definitions and helpers. * @author Johan Nordberg * @license * Copyright (c) 2017 Johan Nordberg. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * 1. Redistribution of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * 2. Redistribution in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors * may be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * You acknowledge that this software is not designed, licensed or intended for use * in the design, construction, operation or maintenance of any military facility. */ export interface SMTAsset { /** * Integer amount in the token's smallest precision unit. */ amount: string | number; /** * Number of decimal places used by the token. */ precision: number; /** * Numeric asset identifier assigned by Hive's SMT protocol. */ nai: string; } /** * Asset symbol supported by Hive-compatible asset serialization. * * @example * ```ts * const symbol: AssetSymbol = 'HIVE' * ``` */ export type AssetSymbol = "HIVE" | "VESTS" | "HBD" | "TESTS" | "TBD" | "STEEM" | "SBD"; /** * Immutable representation of a Hive asset amount and symbol. * * @remarks * Hive serializes liquid assets at three decimal places and VESTS at six. * `Asset` keeps arithmetic symbol-aware so accidental HIVE/HBD/VESTS mixing is * caught before a transaction is signed. * * @example * ```ts * const balance = Asset.from('12.345 HIVE') * const payout = balance.add('1.000 HIVE') * * console.log(payout.toString()) * ``` */ export declare class Asset { readonly amount: number; readonly symbol: AssetSymbol; /** * Creates an asset from an amount and symbol. * * @param amount - Numeric amount in display units. * @param symbol - Hive asset symbol. */ constructor(amount: number, symbol: AssetSymbol); /** * Parses a Hive asset string. * * @param string - Asset string such as `42.000 HIVE`. * @param expectedSymbol - Optional symbol guard. * @returns A parsed {@link Asset}. * * @throws Error * Thrown when the string has an unsupported symbol, a non-numeric amount, or * a symbol that does not match `expectedSymbol`. * * @example * ```ts * const amount = Asset.fromString('42.000 HIVE', 'HIVE') * ``` */ static fromString(string: string, expectedSymbol?: AssetSymbol): Asset; /** * Normalizes an asset-like value into an {@link Asset}. * * @param value - Asset instance, asset string, or numeric amount. * @param symbol - Symbol to use for numeric values and to validate asset * strings or existing instances. * @returns A normalized asset. * * @throws Error * Thrown when the value cannot be parsed or fails the symbol guard. * * @example * ```ts * const fee = Asset.from(3, 'HIVE') * const balance = Asset.from('10.000 HBD', 'HBD') * ``` */ static from(value: string | Asset | number, symbol?: AssetSymbol): Asset; /** * Returns the smaller of two same-symbol assets. * * @param a - First asset. * @param b - Second asset. * @returns The asset with the lower amount. * * @throws AssertionError * Thrown when the two assets use different symbols. * * @example * ```ts * const capped = Asset.min(requested, available) * ``` */ static min(a: Asset, b: Asset): Asset; /** * Returns the larger of two same-symbol assets. * * @param a - First asset. * @param b - Second asset. * @returns The asset with the higher amount. * * @throws AssertionError * Thrown when the two assets use different symbols. * * @example * ```ts * const required = Asset.max(minimumFee, offeredFee) * ``` */ static max(a: Asset, b: Asset): Asset; /** * Resolves the display precision for this asset symbol. * * @returns `3` for liquid Hive-family assets and `6` for VESTS. * * @example * ```ts * Asset.from('1.000000 VESTS').getPrecision() * ``` */ getPrecision(): number; /** * Converts display Hive symbols to protocol serialization symbols. * * @returns An asset using `STEEM` for `HIVE` and `SBD` for `HBD`, or this * asset unchanged for symbols that already serialize directly. * * @remarks * Hive inherited protocol-level asset symbols from Steem. Pollen keeps public * APIs Hive-native while mapping to legacy wire symbols during serialization. * * @example * ```ts * const wireAsset = Asset.from('1.000 HIVE').steem_symbols() * console.log(wireAsset.toString()) // 1.000 STEEM * ``` */ steem_symbols(): Asset; /** * Renders the asset using Hive display precision. * * @returns Asset string such as `42.000 HIVE`. * * @example * ```ts * Asset.from(42, 'HIVE').toString() * ``` */ toString(): string; /** * Adds another amount with the same symbol. * * @param amount - Asset-like amount to add. * @returns A new asset containing the sum. * * @throws AssertionError * Thrown when `amount` uses a different symbol. * * @example * ```ts * const total = Asset.from('1.000 HIVE').add('2.500 HIVE') * ``` */ add(amount: Asset | string | number): Asset; /** * Subtracts another amount with the same symbol. * * @param amount - Asset-like amount to subtract. * @returns A new asset containing the difference. * * @throws AssertionError * Thrown when `amount` uses a different symbol. * * @example * ```ts * const remaining = Asset.from('5.000 HIVE').subtract('1.250 HIVE') * ``` */ subtract(amount: Asset | string | number): Asset; /** * Multiplies this asset amount by another same-symbol amount. * * @param factor - Asset-like factor. * @returns A new asset containing the product. * * @throws AssertionError * Thrown when `factor` uses a different symbol. * * @example * ```ts * const doubled = Asset.from('2.000 HIVE').multiply('2.000 HIVE') * ``` */ multiply(factor: Asset | string | number): Asset; /** * Divides this asset amount by another same-symbol amount. * * @param divisor - Asset-like divisor. * @returns A new asset containing the quotient. * * @throws AssertionError * Thrown when `divisor` uses a different symbol. * * @example * ```ts * const half = Asset.from('2.000 HIVE').divide('2.000 HIVE') * ``` */ divide(divisor: Asset | string | number): Asset; /** * For JSON serialization, same as toString(). */ toJSON(): string; } /** * Value accepted anywhere Pollen needs a Hive price ratio. * * @example * ```ts * const feed: PriceType = { * base: '1.000 HIVE', * quote: '0.300 HBD' * } * ``` */ export type PriceType = Price | { base: Asset | string; quote: Asset | string; }; /** * Price ratio between two different Hive assets. * * @remarks * `Price` behaves like a currency pair: `base` is expressed relative to * `quote`. Witness feeds commonly describe how much HBD one HIVE is worth. * * @example * ```ts * const price = Price.from({ * base: '1.000 HIVE', * quote: '0.300 HBD' * }) * * const hbd = price.convert(Asset.from('10.000 HIVE')) * ``` */ export declare class Price { readonly base: Asset; readonly quote: Asset; /** * Creates a price ratio from non-zero base and quote assets. * * @param base - Asset being priced. * @param quote - Relative asset used to express the price. * * @throws AssertionError * Thrown when either amount is zero or both assets use the same symbol. * * @example * ```ts * const price = new Price(Asset.from('1.000 HIVE'), Asset.from('0.300 HBD')) * ``` */ constructor(base: Asset, quote: Asset); /** * Normalizes a price-like value into a {@link Price}. * * @param value - Existing price or object containing base and quote assets. * @returns A normalized price. * * @example * ```ts * const price = Price.from({ base: '1.000 HIVE', quote: '0.300 HBD' }) * ``` */ static from(value: PriceType): Price; /** * Renders the price pair. * * @returns String in `base:quote` form. * * @example * ```ts * price.toString() * ``` */ toString(): string; /** * Converts an asset between the price pair's two symbols. * * @param asset - Asset using either the base or quote symbol. * @returns Converted asset using the opposite symbol. * * @throws Error * Thrown when `asset.symbol` is not part of this price pair. * * @example * ```ts * const hbd = price.convert(Asset.from('10.000 HIVE')) * ``` */ convert(asset: Asset): Asset; } /** * Unsigned Hive transaction ready for serialization and signing. * * @remarks * `ref_block_num` and `ref_block_prefix` provide TAPOS protection by anchoring * the transaction to a recent block. `expiration` bounds how long witnesses may * accept the transaction. * * @example * ```ts * const transaction: Transaction = { * ref_block_num, * ref_block_prefix, * expiration, * operations: [['vote', vote]], * extensions: [] * } * ``` */ export interface Transaction { /** * Lower 16 bits of the referenced head block number. */ ref_block_num: number; /** * Prefix extracted from the referenced block id. */ ref_block_prefix: number; /** * UTC expiration timestamp without a trailing timezone suffix. */ expiration: string; /** * Ordered operation list executed atomically by the chain. */ operations: Operation[]; /** * Transaction extension values. Hive currently expects this to be empty for * the operations supported by Pollen. */ extensions: unknown[]; } /** * Hive transaction plus compact ECDSA signatures. * * @remarks * Signatures are hex-encoded wire signatures produced from the chain-id-prefixed * transaction digest. * * @example * ```ts * const signed = client.broadcast.sign(transaction, activeKey) * console.log(signed.signatures) * ``` */ export interface SignedTransaction extends Transaction { /** * Hex-encoded recoverable signatures. */ signatures: string[]; } /** * Confirmation returned after broadcasting a transaction. * * @remarks * The local transaction id is added by Pollen after signing, while block and * transaction indexes are supplied by the RPC node when available. * * @example * ```ts * const confirmation = await client.broadcast.transfer(transfer, activeKey) * console.log(confirmation.id, confirmation.block_num) * ``` */ export interface TransactionConfirmation { /** * Transaction id. */ id: string; /** * Block number that accepted the transaction. */ block_num: number; /** * Transaction index within the accepting block. */ trx_num: number; /** * Whether the node considered the transaction expired. */ expired: boolean; } /** * Network marker byte used by Hive WIF private keys. */ export declare const NETWORK_ID: Uint8Array; declare function ripemd160(input: Uint8Array | string): Uint8Array; declare function sha256(input: Uint8Array | string): Uint8Array; declare function doubleSha256(input: Uint8Array | string): Uint8Array; declare function encodePublic(key: Uint8Array, prefix: string): string; declare function encodePrivate(key: Uint8Array): string; declare function decodePrivate(encodedKey: string): Uint8Array; declare function isCanonicalSignature(signature: Uint8Array): boolean; declare function isWif(privWif: string | Uint8Array): boolean; /** * Hive public key backed by the secp256k1 elliptic curve. */ export declare class PublicKey { readonly key: Uint8Array; readonly prefix: string; readonly uncompressed: Uint8Array; constructor(key: Uint8Array, prefix?: string); static fromBuffer(key: Uint8Array): PublicKey; /** * Creates a public key from its Hive string representation. */ static fromString(wif: string): PublicKey; /** * Normalizes a public-key input into a {@link PublicKey} instance. */ static from(value: string | PublicKey): PublicKey; /** * Verifies a compact ECDSA signature against a 32-byte digest. */ verify(message: Uint8Array, signature: Signature): boolean; /** * Renders the key as a Hive public-key string. */ toString(): string; /** * Return JSON representation of this key, same as toString(). */ toJSON(): string; /** * Used by `utils.inspect` and `console.log` in node.js. */ inspect(): string; } /** * Hive authority role used for password-derived account keys. */ export type KeyRole = "owner" | "active" | "posting" | "memo"; /** * Hive private key backed by the secp256k1 elliptic curve. */ export declare class PrivateKey { private key; constructor(key: Uint8Array); /** * Normalizes a WIF string or raw 32-byte secret into a private key. * * @remarks * Raw secrets are accepted as `Uint8Array` values so Pollen's key path stays * independent of Node `Buffer` while still working in browser builds. */ static from(value: string | Uint8Array): PrivateKey; /** * Parses a WIF-encoded Hive private key. */ static fromString(wif: string): PrivateKey; /** * Derives a private key by hashing an arbitrary seed string. */ static fromSeed(seed: string): PrivateKey; /** * Derives a Hive role key from an account name and master password. */ static fromLogin(username: string, password: string, role?: KeyRole): PrivateKey; /** * Signs a 32-byte digest with this private key. */ sign(message: Uint8Array): Signature; /** * Derives the compressed public key for this private key. */ createPublic(prefix?: string): PublicKey; /** * Renders the private key as a WIF string. */ toString(): string; /** * Used by `utils.inspect` and `console.log` in node.js. */ inspect(): string; /** * Derives the shared secret used by encrypted Hive memos. */ get_shared_secret(public_key: PublicKey): Uint8Array; } /** * Compact recoverable secp256k1 signature. */ export declare class Signature { data: Uint8Array; recovery: number; constructor(data: Uint8Array, recovery: number); static fromBuffer(buffer: Uint8Array): Signature; static fromString(string: string): Signature; /** * Recovers the public key that produced this signature. */ recover(message: Uint8Array, prefix?: string): PublicKey; toBuffer(): Uint8Array; toString(): string; } declare function transactionDigest(transaction: Transaction | SignedTransaction, chainId?: Uint8Array): Uint8Array; declare function signTransaction(transaction: Transaction, keys: PrivateKey | PrivateKey[], chainId?: Uint8Array): SignedTransaction; declare function generateTrxId(transaction: Transaction): string; /** * Low-level cryptographic utility namespace. */ export declare const cryptoUtils: { decodePrivate: typeof decodePrivate; doubleSha256: typeof doubleSha256; encodePrivate: typeof encodePrivate; encodePublic: typeof encodePublic; generateTrxId: typeof generateTrxId; isCanonicalSignature: typeof isCanonicalSignature; isWif: typeof isWif; ripemd160: typeof ripemd160; sha256: typeof sha256; signTransaction: typeof signTransaction; transactionDigest: typeof transactionDigest; }; /** * Raw Hive authority object. * * @remarks * Hive authorities combine weighted account references and public-key * references. A transaction is authorized when collected signatures and nested * authorities meet `weight_threshold`. * * @example * ```ts * const authority: AuthorityType = { * weight_threshold: 1, * account_auths: [], * key_auths: [[publicKey, 1]] * } * ``` */ export interface AuthorityType { weight_threshold: number; account_auths: [ string, number ][]; key_auths: [ string | PublicKey, number ][]; } /** * Convenience wrapper for Hive owner, active, and posting authorities. * * @remarks * `Authority` can be created from a single public key for simple one-signature * accounts or from a full weighted authority object for multisig setups. * * @example * ```ts * const posting = Authority.from(postingPublicKey) * ``` */ export declare class Authority implements AuthorityType { weight_threshold: number; account_auths: [ string, number ][]; key_auths: [ string | PublicKey, number ][]; /** * Creates an authority from explicit threshold and auth lists. * * @param authority - Raw authority fields from Hive. */ constructor({ weight_threshold, account_auths, key_auths }: AuthorityType); /** * Normalizes a public key or raw authority into an {@link Authority}. * * @param value - Public key string, {@link PublicKey}, existing authority, or * raw authority object. * @returns A normalized authority. * * @example * ```ts * const authority = Authority.from('STM8m5UgaFAAYQRuaNejYdS8FVLVp9Ss3K1qAVk5de6F8s3HnVbvA') * ``` */ static from(value: string | PublicKey | AuthorityType): Authority; } /** * Core Hive account object returned by condenser account lookups. * * @remarks * This shape includes authority keys, balances, savings balances, vesting * state, voting state, recovery metadata, and historical counters. Use * {@link ExtendedAccount} when condenser returns augmented social/history * fields. * * @example * ```ts * const [account] = await client.database.getAccounts(['srbde']) * console.log(account.balance, account.vesting_shares) * ``` */ export interface Account { id: number; name: string; owner: Authority; active: Authority; posting: Authority; memo_key: string; json_metadata: string; posting_json_metadata: string; proxy: string; last_owner_update: string; last_account_update: string; created: string; mined: boolean; owner_challenged: boolean; active_challenged: boolean; last_owner_proved: string; last_active_proved: string; recovery_account: string; reset_account: string; last_account_recovery: string; comment_count: number; lifetime_vote_count: number; post_count: number; can_vote: boolean; voting_power: number; last_vote_time: string; voting_manabar: { current_mana: string | number; last_update_time: number; }; balance: string | Asset; savings_balance: string | Asset; hbd_balance: string | Asset; hbd_seconds: string; hbd_seconds_last_update: string; hbd_last_interest_payment: string; savings_hbd_balance: string | Asset; savings_hbd_seconds: string; savings_hbd_seconds_last_update: string; savings_hbd_last_interest_payment: string; savings_withdraw_requests: number; reward_hbd_balance: string | Asset; reward_hive_balance: string | Asset; reward_vesting_balance: string | Asset; reward_vesting_hive: string | Asset; curation_rewards: number | string; posting_rewards: number | string; vesting_shares: string | Asset; delegated_vesting_shares: string | Asset; received_vesting_shares: string | Asset; vesting_withdraw_rate: string | Asset; next_vesting_withdrawal: string; withdrawn: number | string; to_withdraw: number | string; withdraw_routes: number; proxied_vsf_votes: number[]; witnesses_voted_for: number; average_bandwidth: number | string; lifetime_bandwidth: number | string; last_bandwidth_update: string; average_market_bandwidth: number | string; lifetime_market_bandwidth: number | string; last_market_bandwidth_update: string; last_post: string; last_root_post: string; } /** * Augmented account object returned by condenser `get_accounts`. * * @remarks * Extended accounts add reputation, converted vesting balance, witness votes, * and several legacy history collections used by social applications. * * @example * ```ts * const [account] = await client.database.getAccounts(['srbde']) * console.log(account.reputation, account.witness_votes) * ``` */ export interface ExtendedAccount extends Account { /** * Vesting shares converted to vesting HIVE for display. */ vesting_balance: string | Asset; reputation: string | number; /** * Transfer and vesting operation history. */ transfer_history: [ number, AppliedOperation ][]; /** * Limit order, cancel, and fill history. */ market_history: [ number, AppliedOperation ][]; post_history: [ number, AppliedOperation ][]; vote_history: [ number, AppliedOperation ][]; other_history: [ number, AppliedOperation ][]; witness_votes: string[]; tags_usage: string[]; guest_bloggers: string[]; open_orders?: unknown[]; comments?: string[]; blog?: string[]; feed?: string[]; recent_replies?: string[]; recommended?: string[]; } /** * Hive block header without the witness signature. * * @remarks * Block headers link blocks through `previous`, identify the producing witness, * and commit to the transaction list through the transaction Merkle root. * * @example * ```ts * const header = await client.database.getBlockHeader(90_000_000) * console.log(header.witness, header.timestamp) * ``` */ export interface BlockHeader { previous: string; timestamp: string; witness: string; transaction_merkle_root: string; extensions: unknown[]; } /** * Hive block header plus witness signature. * * @remarks * Witness signatures prove that the scheduled witness produced the block using * its active block-signing key. * * @example * ```ts * const block = await client.database.getBlock(90_000_000) * console.log(block.witness_signature) * ``` */ export interface SignedBlockHeader extends BlockHeader { witness_signature: string; } /** * Full Hive signed block including transactions. * * @remarks * This is the primary unit consumed by indexers. It carries the signed header, * transaction ids, and the deserialized transactions in block order. * * @example * ```ts * const block = await client.database.getBlock(90_000_000) * for (const transaction of block.transactions) { * console.log(transaction.operations.length) * } * ``` */ export interface SignedBlock extends SignedBlockHeader { block_id: string; signing_key: string; transaction_ids: string[]; transactions: Transaction[]; } /** * Core Hive comment object. * * @remarks * Hive uses the same object for top-level posts and replies. A top-level post * has an empty `parent_author`; replies point at a parent author and permlink. * Payout, vote, and beneficiary fields are included because condenser combines * social and reward state in this shape. * * @example * ```ts * const posts = await client.database.getDiscussions('trending', { * tag: 'hive-139531', * limit: 5 * }) * * console.log(posts[0].author, posts[0].permlink) * ``` */ interface Comment$1 { id: number; category: string; parent_author: string; parent_permlink: string; author: string; permlink: string; title: string; body: string; json_metadata: string; last_update: string; created: string; active: string; last_payout: string; depth: number; children: number; net_rshares: string; abs_rshares: string; vote_rshares: string; children_abs_rshares: string; cashout_time: string; max_cashout_time: string; total_vote_weight: number; reward_weight: number; total_payout_value: Asset | string; curator_payout_value: Asset | string; author_rewards: string; net_votes: number; root_comment: number; max_accepted_payout: string; percent_hbd: number; allow_replies: boolean; allow_votes: boolean; allow_curation_rewards: boolean; beneficiaries: BeneficiaryRoute[]; } export interface VoteState { voter: string; weight: number | string; rshares: number | string; percent: number; reputation: number | string; time: string; } /** * Hivemind/condenser discussion record for posts and enriched comments. * * @remarks * `Discussion` extends the base comment object with URL, root title, active * votes, reblog data, pending payout values, and reputation fields used by Hive * front ends. * * @example * ```ts * const [post] = await client.hivemind.getRankedPosts({ * sort: 'hot', * tag: 'hive-139531', * limit: 1 * }) * * console.log(post.url, post.pending_payout_value) * ``` */ export interface Discussion extends Comment$1 { url: string; root_title: string; pending_payout_value: Asset | string; total_pending_payout_value: Asset | string; active_votes: VoteState[]; replies: string[]; author_reputation: number; promoted: Asset | string; body_length: string; reblogged_by: string[]; first_reblogged_by?: string; first_reblogged_on?: string; } /** * Beneficiary payout route attached to comment options. * * @remarks * Weights are expressed in hundredths of a percent: `10000` means 100%. * * @example * ```ts * const beneficiary: BeneficiaryRoute = { * account: 'srbde', * weight: 500 * } * ``` */ export interface BeneficiaryRoute { account: string; weight: number; } /** * Large integer returned as a string to avoid JavaScript precision loss. * * @example * ```ts * const value: Bignum = props.max_virtual_bandwidth * ``` */ export type Bignum = string; /** * Byte wrapper that serializes to a hex-encoded string. * * @remarks * Hive APIs frequently represent binary values as hex strings. `HexBuffer` * now stores a native `Uint8Array`, keeping protocol bytes available for * serializers without reintroducing Node `Buffer` as a core byte container. * * @example * ```ts * const bytes = HexBuffer.from('deadbeef') * console.log(bytes.toJSON()) * ``` */ export declare class HexBuffer { buffer: Uint8Array; /** * Creates a hex-buffer wrapper around native bytes. * * @param buffer - Raw binary data as a `Uint8Array`. */ constructor(buffer: Uint8Array); /** * Normalizes hex, bytes, or an existing wrapper into a {@link HexBuffer}. * * @param value - `Uint8Array`, existing wrapper, byte array, or hex string. * @returns A hex-buffer wrapper. * * @example * ```ts * const buffer = HexBuffer.from([0xde, 0xad, 0xbe, 0xef]) * ``` */ static from(value: Uint8Array | HexBuffer | number[] | string): HexBuffer; toString(encoding?: string): string; toJSON(): string; } /** * Chain properties voted on by Hive witnesses. * * @remarks * Witnesses publish these values and the chain uses the median active-witness * values for account creation fee, block capacity, and HBD interest. * * @example * ```ts * const props = await client.database.getChainProperties() * console.log(props.account_creation_fee) * ``` */ export interface ChainProperties { /** * This fee, paid in HIVE, is converted into VESTING SHARES for the new account. Accounts * without vesting shares cannot earn usage rations and therefore are powerless. This minimum * fee requires all accounts to have some kind of commitment to the network that includes the * ability to vote and make transactions. * * @remarks * This has to be multiplied by STEEMIT ? `CREATE_ACCOUNT_WITH_HIVE_MODIFIER` * (defined as 30 on the main chain) to get the minimum fee needed to create an account. * */ account_creation_fee: string | Asset; /** * This witnesses vote for the maximum_block_size which is used by the network * to tune rate limiting and capacity. */ maximum_block_size: number; /** * The HBD interest percentage rate decided by witnesses, expressed 0 to 10000. */ hbd_interest_rate: number; } /** * Vesting-share delegation from one account to another. * * @remarks * Delegated VESTS remain owned by the delegator but transfer voting influence * and RC capacity to the delegatee until removed and cooled down. * * @example * ```ts * const delegations = await client.database.getVestingDelegations('srbde') * console.log(delegations[0]?.delegatee) * ``` */ export interface VestingDelegation { /** * Delegation id. */ id: number; /** * Account that is delegating vests to delegatee. */ delegator: string; /** * Account that is receiving vests from delegator. */ delegatee: string; /** * Amount of VESTS delegated. */ vesting_shares: Asset | string; /** * Earliest date delegation can be removed. */ min_delegation_time: string; } /** * Dynamic global chain state reported by a Hive RPC node. * * @remarks * These values drive transaction TAPOS fields, stream cursors, supply displays, * voting-power calculations, witness participation dashboards, and bandwidth * estimates. * * @example * ```ts * const props = await client.database.getDynamicGlobalProperties() * console.log(props.head_block_number, props.last_irreversible_block_num) * ``` */ export interface DynamicGlobalProperties { id: number; /** * Current block height. */ head_block_number: number; head_block_id: string; /** * UTC Server time, e.g. 2020-01-15T00:42:00 */ time: string; /** * Currently elected witness. */ current_witness: string; /** * The total POW accumulated, aka the sum of num_pow_witness at the time * new POW is added. */ total_pow: number; /** * The current count of how many pending POW witnesses there are, determines * the difficulty of doing pow. */ num_pow_witnesses: number; virtual_supply: Asset | string; current_supply: Asset | string; /** * Total asset held in confidential balances. */ confidential_supply: Asset | string; current_hbd_supply: Asset | string; /** * Total asset held in confidential balances. */ confidential_hbd_supply: Asset | string; total_vesting_fund_hive: Asset | string; total_vesting_shares: Asset | string; total_reward_fund_hive: Asset | string; /** * The running total of REWARD^2. */ total_reward_shares2: string; pending_rewarded_vesting_shares: Asset | string; pending_rewarded_vesting_hive: Asset | string; /** * This property defines the interest rate that HBD deposits receive. */ hbd_interest_rate: number; hbd_print_rate: number; /** * Average block size is updated every block to be: * * average_block_size = (99 * average_block_size + new_block_size) / 100 * * This property is used to update the current_reserve_ratio to maintain * approximately 50% or less utilization of network capacity. */ average_block_size: number; /** * Maximum block size is decided by the set of active witnesses which change every round. * Each witness posts what they think the maximum size should be as part of their witness * properties, the median size is chosen to be the maximum block size for the round. * * @remarks * The minimum value for maximum_block_size is defined by the protocol to prevent the * network from getting stuck by witnesses attempting to set this too low. */ maximum_block_size: number; /** * The current absolute slot number. Equal to the total * number of slots since genesis. Also equal to the total * number of missed slots plus head_block_number. */ current_aslot: number; /** * Used to compute witness participation. */ recent_slots_filled: Bignum; participation_count: number; last_irreversible_block_num: number; /** * The maximum bandwidth the blockchain can support is: * * max_bandwidth = maximum_block_size * BANDWIDTH_AVERAGE_WINDOW_SECONDS / BLOCK_INTERVAL * * The maximum virtual bandwidth is: * * max_bandwidth * current_reserve_ratio */ max_virtual_bandwidth: Bignum; /** * Any time average_block_size <= 50% maximum_block_size this value grows by 1 until it * reaches MAX_RESERVE_RATIO. Any time average_block_size is greater than * 50% it falls by 1%. Upward adjustments happen once per round, downward adjustments * happen every block. */ current_reserve_ratio: number; /** * The number of votes regenerated per day. Any user voting slower than this rate will be * "wasting" voting power through spillover; any user voting faster than this rate will have * their votes reduced. */ vote_power_reserve_rate: number; } /** * Calculates the HIVE/VESTS conversion price from global properties. * * @param props - Dynamic global properties containing total vesting fund and * total vesting shares. * @returns A price that converts between VESTS and HIVE. * * @remarks * Hive expresses influence in VESTS while users often reason about powered-up * HIVE. If either side of the vesting pool is zero, Pollen returns a neutral * 1:1 fallback price to keep downstream math defined. * * @example * ```ts * const props = await client.database.getDynamicGlobalProperties() * const vestingPrice = getVestingSharePrice(props) * ``` */ export declare function getVestingSharePrice(props: DynamicGlobalProperties): Price; /** * Calculates an account's effective vesting shares. * * @param account - Account containing vesting, delegation, and withdrawal * fields. * @param subtract_delegated - Whether outgoing delegations should reduce the * result. * @param add_received - Whether incoming delegations should increase the * result. * @returns Effective VESTS amount as a number. * * @remarks * The calculation subtracts pending power-down withdrawals, then optionally * adjusts for delegated and received vesting shares. RC and voting mana helpers * use this to derive maximum voting mana. * * @example * ```ts * const [account] = await client.database.getAccounts(['srbde']) * const effectiveVests = getVests(account) * ``` */ export declare function getVests(account: Account, subtract_delegated?: boolean, add_received?: boolean): number; /** * Name of a broadcastable Hive operation. * * @remarks * The comments beside each union member preserve the protocol operation id used * by the binary serializer. Pollen operation tuples use this string in position * `0` and the operation payload in position `1`. * * @example * ```ts * const name: OperationName = 'transfer' * ``` * * @see https://gitlab.syncad.com/hive/hive/-/blob/master/libraries/protocol/include/hive/protocol/operations.hpp */ export type OperationName = "vote" | "comment" | "transfer" | "transfer_to_vesting" | "withdraw_vesting" | "limit_order_create" | "limit_order_cancel" | "feed_publish" | "convert" | "account_create" | "account_update" | "witness_update" | "account_witness_vote" | "account_witness_proxy" | "custom" | "report_over_production" | "delete_comment" | "custom_json" | "comment_options" | "set_withdraw_vesting_route" | "limit_order_create2" | "claim_account" | "create_claimed_account" | "request_account_recovery" | "recover_account" | "change_recovery_account" | "escrow_transfer" | "escrow_dispute" | "escrow_release" | "escrow_approve" | "transfer_to_savings" | "transfer_from_savings" | "cancel_transfer_from_savings" | "custom_binary" | "decline_voting_rights" | "reset_account" | "set_reset_account" | "claim_reward_balance" | "delegate_vesting_shares" | "account_create_with_delegation" | "witness_set_properties" | "account_update2" | "create_proposal" | "update_proposal_votes" | "remove_proposal" | "update_proposal" | "collateralized_convert" | "recurrent_transfer"; /** * Name of a virtual operation emitted by chain processing. * * @remarks * Virtual operations cannot be broadcast directly. They appear in account and * block operation history when the chain materializes rewards, fills orders, * processes power-downs, or records system events. * * @example * ```ts * const virtualName: VirtualOperationName = 'author_reward' * ``` */ export type VirtualOperationName = "fill_convert_request" | "author_reward" | "curation_reward" | "comment_reward" | "liquidity_reward" | "interest" | "fill_vesting_withdraw" | "fill_order" | "shutdown_witness" | "fill_transfer_from_savings" | "hardfork" | "comment_payout_update" | "return_vesting_delegation" | "comment_benefactor_reward" | "producer_reward" | "clear_null_account_balance" | "proposal_pay" | "sps_fund" | "hardfork_hive" | "hardfork_hive_restore" | "delayed_voting" | "consolidate_treasury_balance" | "effective_comment_vote" | "ineffective_delete_comment" | "sps_convert" | "expired_account_notification" | "changed_recovery_account" | "transfer_to_vesting_completed" | "pow_reward" | "vesting_shares_split" | "account_created" | "fill_collateralized_convert_request" | "system_warning" | "fill_recurrent_transfer" | "failed_recurrent_transfer" | "limit_order_cancelled" | "producer_missed" | "proposal_fee" | "collateralized_convert_immediate_conversion" | "escrow_approved" | "escrow_rejected" | "proxy_cleared" | "declined_voting_rights"; /** * Generic Hive operation tuple. * * @remarks * Position `0` is the operation name; position `1` is the payload object. Use * the specific operation interfaces when constructing transactions so TypeScript * can validate the payload shape. * * @example * ```ts * const op: Operation = ['transfer', { * from: 'srbde', * to: 'alice', * amount: '1.000 HIVE', * memo: 'Pollen' * }] * ``` */ export interface OperationTuple { 0: OperationName | VirtualOperationName; 1: { [key: string]: any; }; } export type Operation = VoteOperation | CommentOperation | TransferOperation | TransferToVestingOperation | WithdrawVestingOperation | LimitOrderCreateOperation | LimitOrderCancelOperation | FeedPublishOperation | ConvertOperation | AccountCreateOperation | AccountUpdateOperation | WitnessUpdateOperation | AccountWitnessVoteOperation | AccountWitnessProxyOperation | CustomOperation | ReportOverProductionOperation | DeleteCommentOperation | CustomJsonOperation | CommentOptionsOperation | SetWithdrawVestingRouteOperation | LimitOrderCreate2Operation | ClaimAccountOperation | CreateClaimedAccountOperation | RequestAccountRecoveryOperation | RecoverAccountOperation | ChangeRecoveryAccountOperation | EscrowTransferOperation | EscrowDisputeOperation | EscrowReleaseOperation | EscrowApproveOperation | TransferToSavingsOperation | TransferFromSavingsOperation | CancelTransferFromSavingsOperation | CustomBinaryOperation | DeclineVotingRightsOperation | ResetAccountOperation | SetResetAccountOperation | ClaimRewardBalanceOperation | DelegateVestingSharesOperation | AccountCreateWithDelegationOperation | WitnessSetPropertiesOperation | AccountUpdate2Operation | CreateProposalOperation | UpdateProposalVotesOperation | RemoveProposalOperation | UpdateProposalOperation | CollateralizedConvertOperation | RecurrentTransferOperation | FillConvertRequestOperation | AuthorRewardOperation | CurationRewardOperation | CommentRewardOperation | LiquidityRewardOperation | InterestOperation | FillVestingWithdrawOperation | FillOrderOperation | ShutdownWitnessOperation | FillTransferFromSavingsOperation | HardforkOperation | CommentPayoutUpdateOperation | ReturnVestingDelegationOperation | CommentBenefactorRewardOperation | ProducerRewardOperation | ClearNullAccountBalanceOperation | ProposalPayOperation | SpsFundOperation | HardforkHiveOperation | HardforkHiveRestoreOperation | DelayedVotingOperation | ConsolidateTreasuryBalanceOperation | EffectiveCommentVoteOperation | IneffectiveDeleteCommentOperation | SpsConvertOperation | ExpiredAccountNotificationOperation | ChangedRecoveryAccountOperation | TransferToVestingCompletedOperation | PowRewardOperation | VestingSharesSplitOperation | AccountCreatedOperation | FillCollateralizedConvertRequestOperation | SystemWarningOperation | FillRecurrentTransferOperation | FailedRecurrentTransferOperation | LimitOrderCancelledOperation | ProducerMissedOperation | ProposalFeeOperation | CollateralizedConvertImmediateConversionOperation | EscrowApprovedOperation | EscrowRejectedOperation | ProxyClearedOperation | DeclinedVotingRightsOperation | [ string, Record ]; /** * Operation record annotated with block and transaction position. * * @remarks * `get_ops_in_block` and account-history calls return applied operations so * indexers can preserve exact chain order and distinguish virtual operations. * * @example * ```ts * const operations = await client.database.getOperations(90_000_000) * console.log(operations[0].block, operations[0].op[0]) * ``` */ export interface AppliedOperation { trx_id: string; block: number; trx_in_block: number; op_in_trx: number; virtual_op: number; timestamp: string; op: Operation; } /** * Legacy paid account creation operation. * * @remarks * This operation creates an account by paying `fee` directly. Modern Hive * account creation often uses claimed account tickets through * {@link ClaimAccountOperation} and {@link CreateClaimedAccountOperation}. * * @example * ```ts * const op: AccountCreateOperation = ['account_create', { * fee: '3.000 HIVE', * creator: 'srbde', * new_account_name: 'new-user', * owner, * active, * posting, * memo_key, * json_metadata: '{}' * }] * ``` */ export interface AccountCreateOperation extends OperationTuple { 0: "account_create"; 1: { fee: string | Asset; creator: string; new_account_name: string; owner: AuthorityType; active: AuthorityType; posting: AuthorityType; memo_key: string | PublicKey; json_metadata: string; }; } /** * Account creation operation that also delegates initial VESTS. * * @remarks * Delegation gives a new account immediate resource capacity without * transferring ownership of the underlying vesting shares. */ export interface AccountCreateWithDelegationOperation extends OperationTuple { 0: "account_create_with_delegation"; 1: { fee: string | Asset; delegation: string | Asset; creator: string; new_account_name: string; owner: AuthorityType; active: AuthorityType; posting: AuthorityType; memo_key: string | PublicKey; json_metadata: string; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Updates account authorities, memo key, or legacy JSON metadata. * * @remarks * Authority changes require the appropriate owner or active signatures. Use * {@link AccountUpdate2Operation} when posting JSON metadata is needed. * * @example * ```ts * const op: AccountUpdateOperation = ['account_update', { * account: 'srbde', * memo_key, * json_metadata: '{}' * }] * ``` */ export interface AccountUpdateOperation extends OperationTuple { 0: "account_update"; 1: { account: string; owner?: AuthorityType; active?: AuthorityType; posting?: AuthorityType; memo_key: string | PublicKey; json_metadata: string; }; } /** * Sets or clears the witness voting proxy for an account. * * @remarks * When a proxy is set, the account delegates witness-vote influence to another * account instead of voting witnesses directly. */ export interface AccountWitnessProxyOperation extends OperationTuple { 0: "account_witness_proxy"; 1: { account: string; proxy: string; }; } /** * Approves or removes a witness vote. * * @example * ```ts * const op: AccountWitnessVoteOperation = ['account_witness_vote', { * account: 'srbde', * witness: 'some-witness', * approve: true * }] * ``` */ export interface AccountWitnessVoteOperation extends OperationTuple { 0: "account_witness_vote"; 1: { account: string; witness: string; approve: boolean; }; } /** * Cancels a pending savings withdrawal request. */ export interface CancelTransferFromSavingsOperation extends OperationTuple { 0: "cancel_transfer_from_savings"; 1: { from: string; request_id: number; }; } /** * Each account lists another account as their recovery account. * The recovery account has the ability to create account_recovery_requests * for the account to recover. An account can change their recovery account * at any time with a 30 day delay. This delay is to prevent * an attacker from changing the recovery account to a malicious account * during an attack. These 30 days match the 30 days that an * owner authority is valid for recovery purposes. * * On account creation the recovery account is set either to the creator of * the account (The account that pays the creation fee and is a signer on the transaction) * or to the empty string if the account was mined. An account with no recovery * has the top voted witness as a recovery account, at the time the recover * request is created. Note: This does mean the effective recovery account * of an account with no listed recovery account can change at any time as * witness vote weights. The top voted witness is explicitly the most trusted * witness according to stake. */ export interface ChangeRecoveryAccountOperation extends OperationTuple { 0: "change_recovery_account"; 1: { /** * The account that would be recovered in case of compromise. */ account_to_recover: string; /** * The account that creates the recover request. */ new_recovery_account: string; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Claims pending author, curation, and vesting rewards. * * @remarks * Any reward field may be `0.000` in its respective asset. Hive requires the * operation to name all three reward buckets explicitly. */ export interface ClaimRewardBalanceOperation extends OperationTuple { 0: "claim_reward_balance"; 1: { account: string; reward_hive: string | Asset; reward_hbd: string | Asset; reward_vests: string | Asset; }; } /** * Claims a discounted account creation ticket. * * @remarks * Claimed tickets can later be consumed by * {@link CreateClaimedAccountOperation}. A zero fee is valid when the chain has * free account subsidies available. */ export interface ClaimAccountOperation extends OperationTuple { 0: "claim_account"; 1: { creator: string; fee: string | Asset; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Creates or updates a post or reply. * * @remarks * Empty `parent_author` creates a top-level post. Non-empty `parent_author` * creates a reply under the parent author/permlink pair. * * @example * ```ts * const op: CommentOperation = ['comment', { * parent_author: '', * parent_permlink: 'hive-139531', * author: 'srbde', * permlink: 'hello-pollen', * title: 'Hello Pollen', * body: 'Posted with Pollen.', * json_metadata: JSON.stringify({ tags: ['hive-139531'] }) * }] * ``` */ export interface CommentOperation extends OperationTuple { 0: "comment"; 1: { parent_author: string; parent_permlink: string; author: string; permlink: string; title: string; body: string; json_metadata: string; }; } /** * Sets payout, vote, curation, and beneficiary options for a comment. * * @remarks * This usually travels in the same transaction as {@link CommentOperation} so a * new post never exists with unintended payout settings. */ export interface CommentOptionsOperation extends OperationTuple { 0: "comment_options"; 1: { author: string; permlink: string; /** HBD value of the maximum payout this post will receive. */ max_accepted_payout: Asset | string; /** The percent of Hive Dollars to key, unkept amounts will be received as Hive Power. */ percent_hbd: number; /** Whether to allow post to receive votes. */ allow_votes: boolean; /** Whether to allow post to recieve curation rewards. */ allow_curation_rewards: boolean; extensions: [ 0, { beneficiaries: BeneficiaryRoute[]; } ][]; }; } /** * Converts HBD to HIVE through the standard conversion request flow. */ export interface ConvertOperation extends OperationTuple { 0: "convert"; 1: { owner: string; requestid: number; amount: Asset | string; }; } /** * Consumes a claimed account ticket to create a new account. */ export interface CreateClaimedAccountOperation extends OperationTuple { 0: "create_claimed_account"; 1: { creator: string; new_account_name: string; owner: AuthorityType; active: AuthorityType; posting: AuthorityType; memo_key: string | PublicKey; json_metadata: string; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * Legacy binary custom operation requiring active authority. */ export interface CustomOperation extends OperationTuple { 0: "custom"; 1: { required_auths: string[]; id: number; data: Uint8Array | HexBuffer | number[]; }; } /** * Binary custom operation supporting owner, active, posting, and authority auths. */ export interface CustomBinaryOperation extends OperationTuple { 0: "custom_binary"; 1: { required_owner_auths: string[]; required_active_auths: string[]; required_posting_auths: string[]; required_auths: AuthorityType[]; /** * ID string, must be less than 32 characters long. */ id: string; data: Uint8Array | HexBuffer | number[]; }; } /** * JSON custom operation used by Hive application protocols. * * @remarks * The `json` field must already be serialized. Posting authority is common for * social protocols; active authority is used for protocols with financial or * account-control implications. * * @example * ```ts * const op: CustomJsonOperation = ['custom_json', { * required_auths: [], * required_posting_auths: ['srbde'], * id: 'pollen.demo', * json: JSON.stringify({ ok: true }) * }] * ``` */ export interface CustomJsonOperation extends OperationTuple { 0: "custom_json"; 1: { required_auths: string[]; required_posting_auths: string[]; /** * ID string, must be less than 32 characters long. */ id: string; /** * JSON encoded string, must be valid JSON. */ json: string; }; } /** * Enables or disables an account's ability to vote. */ export interface DeclineVotingRightsOperation extends OperationTuple { 0: "decline_voting_rights"; 1: { account: string; decline: boolean; }; } /** * Delegates vesting shares from one account to another. * * @remarks * Set `vesting_shares` to `0.000000 VESTS` to remove an existing delegation. */ export interface DelegateVestingSharesOperation extends OperationTuple { 0: "delegate_vesting_shares"; 1: { /** * The account delegating vesting shares. */ delegator: string; /** * The account receiving vesting shares. */ delegatee: string; /** * The amount of vesting shares delegated. */ vesting_shares: string | Asset; }; } /** * Deletes a comment or post when chain rules allow it. */ export interface DeleteCommentOperation extends OperationTuple { 0: "delete_comment"; 1: { author: string; permlink: string; }; } /** * The agent and to accounts must approve an escrow transaction for it to be valid on * the blockchain. Once a part approves the escrow, the cannot revoke their approval. * Subsequent escrow approve operations, regardless of the approval, will be rejected. */ export interface EscrowApproveOperation extends OperationTuple { 0: "escrow_approve"; 1: { from: string; to: string; agent: string; /** * Either to or agent. */ who: string; escrow_id: number; approve: boolean; }; } /** * If either the sender or receiver of an escrow payment has an issue, they can * raise it for dispute. Once a payment is in dispute, the agent has authority over * who gets what. */ export interface EscrowDisputeOperation extends OperationTuple { 0: "escrow_dispute"; 1: { from: string; to: string; agent: string; who: string; escrow_id: number; }; } /** * This operation can be used by anyone associated with the escrow transfer to * release funds if they have permission. * * The permission scheme is as follows: * If there is no dispute and escrow has not expired, either party can release funds to the other. * If escrow expires and there is no dispute, either party can release funds to either party. * If there is a dispute regardless of expiration, the agent can release funds to either party * following whichever agreement was in place between the parties. */ export interface EscrowReleaseOperation extends OperationTuple { 0: "escrow_release"; 1: { from: string; /** * The original 'to'. */ to: string; agent: string; /** * The account that is attempting to release the funds, determines valid 'receiver'. */ who: string; /** * The account that should receive funds (might be from, might be to). */ receiver: string; escrow_id: number; /** * The amount of hbd to release. */ hbd_amount: Asset | string; /** * The amount of hive to release. */ hive_amount: Asset | string; }; } /** * The purpose of this operation is to enable someone to send money contingently to * another individual. The funds leave the *from* account and go into a temporary balance * where they are held until *from* releases it to *to* or *to* refunds it to *from*. * * In the event of a dispute the *agent* can divide the funds between the to/from account. * Disputes can be raised any time before or on the dispute deadline time, after the escrow * has been approved by all parties. * * This operation only creates a proposed escrow transfer. Both the *agent* and *to* must * agree to the terms of the arrangement by approving the escrow. * * The escrow agent is paid the fee on approval of all parties. It is up to the escrow agent * to determine the fee. * * Escrow transactions are uniquely identified by 'from' and 'escrow_id', the 'escrow_id' is defined * by the sender. */ export interface EscrowTransferOperation extends OperationTuple { 0: "escrow_transfer"; 1: { from: string; to: string; agent: string; escrow_id: number; hbd_amount: Asset | string; hive_amount: Asset | string; fee: Asset | string; ratification_deadline: string; escrow_expiration: string; json_meta: string; }; } /** * Publishes a witness price feed. * * @remarks * Witness feeds influence the median HIVE/HBD price used by conversions and * debt-ratio mechanics. */ export interface FeedPublishOperation extends OperationTuple { 0: "feed_publish"; 1: { publisher: string; exchange_rate: PriceType; }; } /** * Cancels an order and returns the balance to owner. */ export interface LimitOrderCancelOperation extends OperationTuple { 0: "limit_order_cancel"; 1: { owner: string; orderid: number; }; } /** * This operation creates a limit order and matches it against existing open orders. */ export interface LimitOrderCreateOperation extends OperationTuple { 0: "limit_order_create"; 1: { owner: string; orderid: number; amount_to_sell: Asset | string; min_to_receive: Asset | string; fill_or_kill: boolean; expiration: string; }; } /** * This operation is identical to limit_order_create except it serializes the price rather * than calculating it from other fields. */ export interface LimitOrderCreate2Operation extends OperationTuple { 0: "limit_order_create2"; 1: { owner: string; orderid: number; amount_to_sell: Asset | string; exchange_rate: PriceType; fill_or_kill: boolean; expiration: string; }; } /** * Recover an account to a new authority using a previous authority and verification * of the recovery account as proof of identity. This operation can only succeed * if there was a recovery request sent by the account's recover account. * * In order to recover the account, the account holder must provide proof * of past ownership and proof of identity to the recovery account. Being able * to satisfy an owner authority that was used in the past 30 days is sufficient * to prove past ownership. The get_owner_history function in the database API * returns past owner authorities that are valid for account recovery. * * Proving identity is an off chain contract between the account holder and * the recovery account. The recovery request contains a new authority which * must be satisfied by the account holder to regain control. The actual process * of verifying authority may become complicated, but that is an application * level concern, not a blockchain concern. * * This operation requires both the past and future owner authorities in the * operation because neither of them can be derived from the current chain state. * The operation must be signed by keys that satisfy both the new owner authority * and the recent owner authority. Failing either fails the operation entirely. * * If a recovery request was made inadvertantly, the account holder should * contact the recovery account to have the request deleted. * * The two setp combination of the account recovery request and recover is * safe because the recovery account never has access to secrets of the account * to recover. They simply act as an on chain endorsement of off chain identity. * In other systems, a fork would be required to enforce such off chain state. * Additionally, an account cannot be permanently recovered to the wrong account. * While any owner authority from the past 30 days can be used, including a compromised * authority, the account can be continually recovered until the recovery account * is confident a combination of uncompromised authorities were used to * recover the account. The actual process of verifying authority may become * complicated, but that is an application level concern, not the blockchain's * concern. */ export interface RecoverAccountOperation extends OperationTuple { 0: "recover_account"; 1: { /** * The account to be recovered. */ account_to_recover: string; /** * The new owner authority as specified in the request account recovery operation. */ new_owner_authority: AuthorityType; /** * A previous owner authority that the account holder will use to prove * past ownership of the account to be recovered. */ recent_owner_authority: AuthorityType; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * This operation is used to report a miner who signs two blocks * at the same time. To be valid, the violation must be reported within * MAX_WITNESSES blocks of the head block (1 round) and the * producer must be in the ACTIVE witness set. * * Users not in the ACTIVE witness set should not have to worry about their * key getting compromised and being used to produced multiple blocks so * the attacker can report it and steel their vesting hive. * * The result of the operation is to transfer the full VESTING HIVE balance * of the block producer to the reporter. */ export interface ReportOverProductionOperation extends OperationTuple { 0: "report_over_production"; 1: { reporter: string; first_block: SignedBlockHeader; second_block: SignedBlockHeader; }; } /** * All account recovery requests come from a listed recovery account. This * is secure based on the assumption that only a trusted account should be * a recovery account. It is the responsibility of the recovery account to * verify the identity of the account holder of the account to recover by * whichever means they have agreed upon. The blockchain assumes identity * has been verified when this operation is broadcast. * * This operation creates an account recovery request which the account to * recover has 24 hours to respond to before the request expires and is * invalidated. * * There can only be one active recovery request per account at any one time. * Pushing this operation for an account to recover when it already has * an active request will either update the request to a new new owner authority * and extend the request expiration to 24 hours from the current head block * time or it will delete the request. To cancel a request, simply set the * weight threshold of the new owner authority to 0, making it an open authority. * * Additionally, the new owner authority must be satisfiable. In other words, * the sum of the key weights must be greater than or equal to the weight * threshold. * * This operation only needs to be signed by the the recovery account. * The account to recover confirms its identity to the blockchain in * the recover account operation. */ export interface RequestAccountRecoveryOperation extends OperationTuple { 0: "request_account_recovery"; 1: { /** * The recovery account is listed as the recovery account on the account to recover. */ recovery_account: string; /** * The account to recover. This is likely due to a compromised owner authority. */ account_to_recover: string; /** * The new owner authority the account to recover wishes to have. This is secret * known by the account to recover and will be confirmed in a recover_account_operation. */ new_owner_authority: AuthorityType; /** * Extensions. Not currently used. */ extensions: any[]; }; } /** * This operation allows recovery_account to change account_to_reset's owner authority to * new_owner_authority after 60 days of inactivity. */ export interface ResetAccountOperation extends OperationTuple { 0: "reset_account"; 1: { reset_account: string; account_to_reset: string; new_owner_authority: AuthorityType; }; } /** * This operation allows 'account' owner to control which account has the power * to execute the 'reset_account_operation' after 60 days. */ export interface SetResetAccountOperation extends OperationTuple { 0: "set_reset_account"; 1: { account: string; current_reset_account: string; reset_account: string; }; } /** * Allows an account to setup a vesting withdraw but with the additional * request for the funds to be transferred directly to another account's * balance rather than the withdrawing account. In addition, those funds * can be immediately vested again, circumventing the conversion from * vests to hive and back, guaranteeing they maintain their value. */ export interface SetWithdrawVestingRouteOperation extends OperationTuple { 0: "set_withdraw_vesting_route"; 1: { from_account: string; to_account: string; percent: number; auto_vest: boolean; }; } /** * Transfers asset from one account to another. * * @remarks * Transfers require active authority from `from`. Use `Memo.encode` before * broadcasting when the memo should be encrypted for the recipient. * * @example * ```ts * const op: TransferOperation = ['transfer', { * from: 'srbde', * to: 'alice', * amount: '1.000 HIVE', * memo: 'Invoice 42' * }] * ``` */ export interface TransferOperation extends OperationTuple { 0: "transfer"; 1: { /** * Sending account name. */ from: string; /** * Receiving account name. */ to: string; /** * Amount of HIVE or HBD to send. */ amount: string | Asset; /** * Plain-text note attached to transaction. */ memo: string; }; } /** * Withdraws funds from savings to liquid balance after the savings delay. * * @remarks * The request can be cancelled with {@link CancelTransferFromSavingsOperation} * before it completes. */ export interface TransferFromSavingsOperation extends OperationTuple { 0: "transfer_from_savings"; 1: { from: string; request_id: number; to: string; amount: string | Asset; memo: string; }; } /** * Moves liquid HIVE or HBD into an account's savings balance. */ export interface TransferToSavingsOperation extends OperationTuple { 0: "transfer_to_savings"; 1: { amount: string | Asset; from: string; memo: string; request_id: number; to: string; }; } /** * This operation converts HIVE into VFS (Vesting Fund Shares) at * the current exchange rate. With this operation it is possible to * give another account vesting shares so that faucets can * pre-fund new accounts with vesting shares. * (A.k.a. Powering Up) */ export interface TransferToVestingOperation extends OperationTuple { 0: "transfer_to_vesting"; 1: { from: string; to: string; /** * Amount to power up, must be HIVE */ amount: string | Asset; }; } /** * Casts, updates, or removes a vote on a post or comment. * * @remarks * Weight is a signed integer where `10000` is a full upvote, `0` removes the * vote, and negative values are downvotes. * * @example * ```ts * const op: VoteOperation = ['vote', { * voter: 'srbde', * author: 'alice', * permlink: 'field-notes', * weight: 10_000 * }] * ``` */ export interface VoteOperation extends OperationTuple { 0: "vote"; 1: { voter: string; author: string; permlink: string; /** * Voting weight, 100% = 10000 (100_PERCENT). */ weight: number; }; } /** * At any given point in time an account can be withdrawing from their * vesting shares. A user may change the number of shares they wish to * cash out at any time between 0 and their total vesting stake. * * After applying this operation, vesting_shares will be withdrawn * at a rate of vesting_shares/104 per week for two years starting * one week after this operation is included in the blockchain. * * This operation is not valid if the user has no vesting shares. * (A.k.a. Powering Down) */ export interface WithdrawVestingOperation extends OperationTuple { 0: "withdraw_vesting"; 1: { account: string; /** * Amount to power down, must be VESTS. */ vesting_shares: string | Asset; }; } /** * Users who wish to become a witness must pay a fee acceptable to * the current witnesses to apply for the position and allow voting * to begin. * * If the owner isn't a witness they will become a witness. Witnesses * are charged a fee equal to 1 weeks worth of witness pay which in * turn is derived from the current share supply. The fee is * only applied if the owner is not already a witness. * * If the block_signing_key is null then the witness is removed from * contention. The network will pick the top 21 witnesses for * producing blocks. */ export interface WitnessUpdateOperation extends OperationTuple { 0: "witness_update"; 1: { owner: string; /** * URL for witness, usually a link to a post in the witness-category tag. */ url: string; block_signing_key: string | PublicKey | null; props: ChainProperties; /** * The fee paid to register a new witness, should be 10x current block production pay. */ fee: string | Asset; }; } export interface WitnessSetPropertiesOperation extends OperationTuple { 0: "witness_set_properties"; 1: { owner: string; props: [ string, string ][]; extensions: any[]; }; } /** * Modern account update operation with posting JSON metadata. * * @remarks * This operation extends the legacy account update shape by allowing separate * profile/application metadata in `posting_json_metadata`. */ export interface AccountUpdate2Operation extends OperationTuple { 0: "account_update2"; 1: { account: string; owner?: AuthorityType; active?: AuthorityType; posting?: AuthorityType; memo_key?: string | PublicKey; json_metadata: string; posting_json_metadata: string; extensions: any[]; }; } /** * Creates a Decentralized Hive Fund proposal. * * @remarks * Proposal payments are made to `receiver` between `start_date` and `end_date` * when the proposal receives sufficient stake-weighted approval. */ export interface CreateProposalOperation extends OperationTuple { 0: "create_proposal"; 1: { creator: string; receiver: string; start_date: string; end_date: string; daily_pay: Asset | string; subject: string; permlink: string; extensions: any[]; }; } /** * Approves or removes approvals for DHF proposal ids. */ export interface UpdateProposalVotesOperation extends OperationTuple { 0: "update_proposal_votes"; 1: { voter: string; proposal_ids: number[]; approve: boolean; extensions: any[]; }; } /** * Removes DHF proposals owned by an account. */ export interface RemoveProposalOperation extends OperationTuple { 0: "remove_proposal"; 1: { proposal_owner: string; proposal_ids: number[]; extensions: any[]; }; } /** * Updates mutable fields on an existing DHF proposal. */ export interface UpdateProposalOperation extends OperationTuple { 0: "update_proposal"; 1: { proposal_id: number; creator: string; daily_pay: Asset | string; subject: string; permlink: string; extensions: any[]; }; } /** * Converts HIVE to HBD through the collateralized conversion flow. */ export interface CollateralizedConvertOperation extends OperationTuple { 0: "collateralized_convert"; 1: { owner: string; requestid: number; amount: Asset | string; }; } /** * Schedules a recurring transfer. * * @remarks * `recurrence` is the interval in hours and `executions` is the number of * times the transfer should execute. * * @example * ```ts * const op: RecurrentTransferOperation = ['recurrent_transfer', { * from: 'srbde', * to: 'alice', * amount: '1.000 HIVE', * memo: 'monthly support', * recurrence: 720, * executions: 3, * extensions: [] * }] * ``` */ export interface RecurrentTransferOperation extends OperationTuple { 0: "recurrent_transfer"; 1: { from: string; to: string; amount: Asset | string; memo: string; recurrence: number; executions: number; extensions: any[]; }; } export interface FillConvertRequestOperation extends OperationTuple { 0: "fill_convert_request"; 1: { owner: string; requestid: number; amount_in: string | Asset; amount_out: string | Asset; }; } export interface AuthorRewardOperation extends OperationTuple { 0: "author_reward"; 1: { author: string; permlink: string; hbd_payout: string | Asset; hive_payout: string | Asset; vesting_payout: string | Asset; curators_vesting_payout: string | Asset; payout_must_be_claimed: boolean; }; } export interface CurationRewardOperation extends OperationTuple { 0: "curation_reward"; 1: { curator: string; reward: string | Asset; author: string; permlink: string; payout_must_be_claimed: boolean; }; } export interface CommentRewardOperation extends OperationTuple { 0: "comment_reward"; 1: { author: string; permlink: string; payout: string | Asset; author_rewards: number | string; total_payout_value: string | Asset; curator_payout_value: string | Asset; beneficiary_payout_value: string | Asset; }; } export interface LiquidityRewardOperation extends OperationTuple { 0: "liquidity_reward"; 1: { owner: string; payout: string | Asset; }; } export interface InterestOperation extends OperationTuple { 0: "interest"; 1: { owner: string; interest: string | Asset; is_saved_into_hbd_balance: boolean; }; } export interface FillVestingWithdrawOperation extends OperationTuple { 0: "fill_vesting_withdraw"; 1: { from_account: string; to_account: string; withdrawn: string | Asset; deposited: string | Asset; }; } export interface FillOrderOperation extends OperationTuple { 0: "fill_order"; 1: { current_owner: string; current_orderid: number; current_pays: string | Asset; open_owner: string; open_orderid: number; open_pays: string | Asset; }; } export interface ShutdownWitnessOperation extends OperationTuple { 0: "shutdown_witness"; 1: { owner: string; }; } export interface FillTransferFromSavingsOperation extends OperationTuple { 0: "fill_transfer_from_savings"; 1: { from: string; to: string; amount: string | Asset; request_id: number; memo: string; }; } export interface HardforkOperation extends OperationTuple { 0: "hardfork"; 1: { hardfork_id: number; }; } export interface CommentPayoutUpdateOperation extends OperationTuple { 0: "comment_payout_update"; 1: { author: string; permlink: string; }; } export interface ReturnVestingDelegationOperation extends OperationTuple { 0: "return_vesting_delegation"; 1: { account: string; vesting_shares: string | Asset; }; } export interface CommentBenefactorRewardOperation extends OperationTuple { 0: "comment_benefactor_reward"; 1: { benefactor: string; author: string; permlink: string; hbd_payout: string | Asset; hive_payout: string | Asset; vesting_payout: string | Asset; payout_must_be_claimed: boolean; }; } export interface ProducerRewardOperation extends OperationTuple { 0: "producer_reward"; 1: { producer: string; vesting_shares: string | Asset; }; } export interface ClearNullAccountBalanceOperation extends OperationTuple { 0: "clear_null_account_balance"; 1: { total_cleared: (string | Asset)[]; }; } export interface ProposalPayOperation extends OperationTuple { 0: "proposal_pay"; 1: { proposal_id: number; receiver: string; payer: string; payment: string | Asset; }; } export interface SpsFundOperation extends OperationTuple { 0: "sps_fund"; 1: { treasury: string; additional_funds: string | Asset; }; } export interface HardforkHiveOperation extends OperationTuple { 0: "hardfork_hive"; 1: { account: string; treasury: string; other_affected_accounts: string[]; hbd_transferred: string | Asset; hive_transferred: string | Asset; vests_converted: string | Asset; total_hive_from_vests: string | Asset; }; } export interface HardforkHiveRestoreOperation extends OperationTuple { 0: "hardfork_hive_restore"; 1: { account: string; treasury: string; hbd_transferred: string | Asset; hive_transferred: string | Asset; }; } export interface DelayedVotingOperation extends OperationTuple { 0: "delayed_voting"; 1: { voter: string; votes: number | string; }; } export interface ConsolidateTreasuryBalanceOperation extends OperationTuple { 0: "consolidate_treasury_balance"; 1: { total_cleared?: (string | Asset)[]; total_moved?: (string | Asset)[]; }; } export interface EffectiveCommentVoteOperation extends OperationTuple { 0: "effective_comment_vote"; 1: { voter: string; author: string; permlink: string; weight: number | string; rshares: number | string; total_vote_weight: number | string; pending_payout: string | Asset; }; } export interface IneffectiveDeleteCommentOperation extends OperationTuple { 0: "ineffective_delete_comment"; 1: { author: string; permlink: string; }; } export interface SpsConvertOperation extends OperationTuple { 0: "sps_convert"; 1: { treasury: string; hive_amount_in: string | Asset; hbd_amount_out: string | Asset; }; } export interface ExpiredAccountNotificationOperation extends OperationTuple { 0: "expired_account_notification"; 1: { account: string; }; } export interface ChangedRecoveryAccountOperation extends OperationTuple { 0: "changed_recovery_account"; 1: { account: string; old_recovery_account: string; new_recovery_account: string; }; } export interface TransferToVestingCompletedOperation extends OperationTuple { 0: "transfer_to_vesting_completed"; 1: { from_account: string; to_account: string; hive_vested: string | Asset; vesting_shares_received: string | Asset; }; } export interface PowRewardOperation extends OperationTuple { 0: "pow_reward"; 1: { worker: string; reward: string | Asset; }; } export interface VestingSharesSplitOperation extends OperationTuple { 0: "vesting_shares_split"; 1: { owner: string; vesting_shares_before_split: string | Asset; vesting_shares_after_split: string | Asset; }; } export interface AccountCreatedOperation extends OperationTuple { 0: "account_created"; 1: { new_account_name: string; creator: string; initial_vesting_shares: string | Asset; initial_delegation: string | Asset; }; } export interface FillCollateralizedConvertRequestOperation extends OperationTuple { 0: "fill_collateralized_convert_request"; 1: { owner: string; requestid: number; amount_in: string | Asset; amount_out: string | Asset; excess_collateral: string | Asset; }; } export interface SystemWarningOperation extends OperationTuple { 0: "system_warning"; 1: { message: string; }; } export interface FillRecurrentTransferOperation extends OperationTuple { 0: "fill_recurrent_transfer"; 1: { from: string; to: string; amount: string | Asset; memo: string; remaining_executions: number; extensions: any[]; }; } export interface FailedRecurrentTransferOperation extends OperationTuple { 0: "failed_recurrent_transfer"; 1: { from: string; to: string; amount: string | Asset; memo: string; consecutive_failures: number; remaining_executions: number; deleted: boolean; extensions: any[]; }; } export interface LimitOrderCancelledOperation extends OperationTuple { 0: "limit_order_cancelled"; 1: { seller: string; orderid: number; amount_back: string | Asset; }; } export interface ProducerMissedOperation extends OperationTuple { 0: "producer_missed"; 1: { producer: string; }; } export interface ProposalFeeOperation extends OperationTuple { 0: "proposal_fee"; 1: { creator: string; treasury: string; proposal_id: number; fee: string | Asset; }; } export interface CollateralizedConvertImmediateConversionOperation extends OperationTuple { 0: "collateralized_convert_immediate_conversion"; 1: { owner: string; requestid: number; hbd_out: string | Asset; }; } export interface EscrowApprovedOperation extends OperationTuple { 0: "escrow_approved"; 1: { from: string; to: string; agent: string; escrow_id: number; fee: string | Asset; }; } export interface EscrowRejectedOperation extends OperationTuple { 0: "escrow_rejected"; 1: { from: string; to: string; agent: string; escrow_id: number; hbd_amount: string | Asset; hive_amount: string | Asset; fee: string | Asset; }; } export interface ProxyClearedOperation extends OperationTuple { 0: "proxy_cleared"; 1: { account: string; proxy: string; }; } export interface DeclinedVotingRightsOperation extends OperationTuple { 0: "declined_voting_rights"; 1: { account: string; }; } /** * Context for smart retry and failover decisions. */ export interface RetryContext { healthTracker?: NodeHealthTracker; api?: string; isBroadcast?: boolean; consoleOnFailover?: boolean; } declare function assert$1(condition: any, message?: string): asserts condition; declare function toHex(data: Uint8Array): string; declare function fromHex(hex: string): Uint8Array; declare function concat(arrays: Uint8Array[]): Uint8Array; declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean; declare class BinaryWriter { private buffer; private cursor; constructor(size?: number); private ensureCapacity; writeInt8(value: number): void; writeUint8(value: number): void; writeInt16(value: number): void; writeUint16(value: number): void; writeInt32(value: number): void; writeUint32(value: number): void; writeInt64(value: number | string | bigint): void; writeUint64(value: number | string | bigint): void; writeVarint32(value: number): void; writeString(value: string): void; writeBytes(bytes: Uint8Array): void; getBuffer(): Uint8Array; } declare class BinaryReader { private buffer; private view; private cursor; constructor(buffer: Uint8Array); readInt8(): number; readUint8(): number; readInt16(): number; readUint16(): number; readInt32(): number; readUint32(): number; readInt64(): bigint; readUint64(): bigint; readVarint32(): number; readString(): string; readBytes(length: number): Uint8Array; skip(length: number): void; } declare function sleep(ms: number): Promise; declare function iteratorStream(iterator: AsyncIterableIterator): ReadableStream; declare function copy(object: T): T; declare function exponentialBackoffWithJitter(tries: number, baseDelay?: number, maxDelay?: number, jitter?: number): number; declare function retryingFetch(currentAddress: string, allAddresses: string | string[], opts: RequestInit & { agent?: unknown; timeout?: number; }, timeout: number, failoverThreshold: number, consoleOnFailover: boolean, backoff: (tries: number) => number, fetchTimeout?: (tries: number) => number, retryContext?: RetryContext): Promise<{ response: any; currentAddress: string; }>; export interface WitnessProps { account_creation_fee?: string | Asset; account_subsidy_budget?: number; account_subsidy_decay?: number; key: PublicKey | string; maximum_block_size?: number; new_signing_key?: PublicKey | string | null; hbd_exchange_rate?: PriceType; hbd_interest_rate?: number; url?: string; } declare const buildWitnessUpdateOp: (owner: string, props: WitnessProps) => WitnessSetPropertiesOperation; declare const operationOrders: { vote: number; comment: number; transfer: number; transfer_to_vesting: number; withdraw_vesting: number; limit_order_create: number; limit_order_cancel: number; feed_publish: number; convert: number; account_create: number; account_update: number; witness_update: number; account_witness_vote: number; account_witness_proxy: number; pow: number; custom: number; report_over_production: number; delete_comment: number; custom_json: number; comment_options: number; set_withdraw_vesting_route: number; limit_order_create2: number; claim_account: number; create_claimed_account: number; request_account_recovery: number; recover_account: number; change_recovery_account: number; escrow_transfer: number; escrow_dispute: number; escrow_release: number; pow2: number; escrow_approve: number; transfer_to_savings: number; transfer_from_savings: number; cancel_transfer_from_savings: number; custom_binary: number; decline_voting_rights: number; reset_account: number; set_reset_account: number; claim_reward_balance: number; delegate_vesting_shares: number; account_create_with_delegation: number; witness_set_properties: number; account_update2: number; create_proposal: number; update_proposal_votes: number; remove_proposal: number; update_proposal: number; collateralized_convert: number; recurrent_transfer: number; fill_convert_request: number; author_reward: number; curation_reward: number; comment_reward: number; liquidity_reward: number; interest: number; fill_vesting_withdraw: number; fill_order: number; shutdown_witness: number; fill_transfer_from_savings: number; hardfork: number; comment_payout_update: number; return_vesting_delegation: number; comment_benefactor_reward: number; producer_reward: number; clear_null_account_balance: number; proposal_pay: number; sps_fund: number; hardfork_hive: number; hardfork_hive_restore: number; delayed_voting: number; consolidate_treasury_balance: number; effective_comment_vote: number; ineffective_delete_comment: number; sps_convert: number; expired_account_notification: number; changed_recovery_account: number; transfer_to_vesting_completed: number; pow_reward: number; vesting_shares_split: number; account_created: number; fill_collateralized_convert_request: number; system_warning: number; fill_recurrent_transfer: number; failed_recurrent_transfer: number; }; declare function makeBitMaskFilter(allowedOperations: number[]): (string | null)[]; /** * Options used by {@link BroadcastAPI.createTestAccount}. * * @remarks * Tests can either provide a master password, letting Pollen derive role keys * with Hive's login convention, or provide explicit authorities for deterministic * account fixtures. * * @example * ```ts * const options: CreateAccountOptions = { * username: 'pollen-dev', * password: 'correct horse battery staple', * creator: 'initminer', * metadata: { app: 'pollen-tests' } * } * ``` */ export interface CreateAccountOptions { /** * Username for the new account. */ username: string; /** * Password for the new account, if set, all keys will be derived from this. */ password?: string; /** * Account authorities, used to manually set account keys. * Can not be used together with the password option. */ auths?: { owner: AuthorityType | string | PublicKey; active: AuthorityType | string | PublicKey; posting: AuthorityType | string | PublicKey; memoKey: PublicKey | string; }; /** * Creator account, fee will be deducted from this and the key to sign * the transaction must be the creators active key. */ creator: string; /** * Account creation fee. If omitted fee will be set to lowest possible. */ fee?: string | Asset | number; /** * Account delegation, amount of VESTS to delegate to the new account. * If omitted the delegation amount will be the lowest possible based * on the fee. Can be set to zero to disable delegation. */ delegation?: string | Asset | number; /** * Optional account meta-data. */ metadata?: { [key: string]: any; }; } /** * Helper for signing and broadcasting Hive operations. * * @remarks * `BroadcastAPI` turns typed operation payloads into signed Hive transactions, * derives TAPOS reference fields from the current head block, and submits the * signed transaction through the configured client. Signing uses Pollen's Noble * secp256k1-backed crypto layer through {@link cryptoUtils} for modern audited * primitives. * * @example * ```ts * import { Client, PrivateKey } from '@srbde/pollen' * * const client = new Client('https://api.hive.blog') * const key = PrivateKey.fromString(process.env.HIVE_ACTIVE_KEY!) * * const confirmation = await client.broadcast.transfer( * { * from: 'srbde', * to: 'alice', * amount: '0.001 HIVE', * memo: 'Pollen transfer' * }, * key * ) * * console.log(confirmation.id) * ``` * * @see {@link cryptoUtils.signTransaction} * @see {@link Client.call} */ export declare class BroadcastAPI { readonly client: Client; /** * How many milliseconds in the future to set the expiry time to when * broadcasting a transaction, defaults to 1 minute. */ expireTime: number; /** * Creates a broadcast helper bound to a client. * * @param client - Client used for chain-property reads and transaction * submission. */ constructor(client: Client); /** * Broadcasts a Hive `comment` operation. * * @param comment - Comment payload. Empty `parent_author` creates a top-level * post; a populated `parent_author` creates a reply. * @param key - Private posting key for `comment.author`. * @returns Transaction confirmation containing the generated transaction id. * * @throws RPCError * Thrown when the node rejects the transaction, the posting authority is * missing, or the comment payload violates chain rules. * * @example * ```ts * await client.broadcast.comment( * { * parent_author: '', * parent_permlink: 'hive-139531', * author: 'srbde', * permlink: 'hello-pollen', * title: 'Hello Pollen', * body: 'Published through the Pollen SDK.', * json_metadata: JSON.stringify({ tags: ['hive-139531'] }) * }, * postingKey * ) * ``` */ comment(comment: CommentOperation[1], key: PrivateKey): Promise; /** * Broadcasts a comment together with its payout and beneficiary options. * * @param comment - Comment or post payload. * @param options - Matching `comment_options` payload for the same author and * permlink. * @param key - Private posting key for the comment author. * @returns Transaction confirmation containing the generated transaction id. * * @remarks * Sending both operations in one transaction prevents a post from briefly * existing with default payout settings. * * @throws RPCError * Thrown when either operation fails chain validation. * * @example * ```ts * await client.broadcast.commentWithOptions(comment, { * author: comment.author, * permlink: comment.permlink, * max_accepted_payout: '1000000.000 HBD', * percent_hbd: 10000, * allow_votes: true, * allow_curation_rewards: true, * extensions: [] * }, postingKey) * ``` */ commentWithOptions(comment: CommentOperation[1], options: CommentOptionsOperation[1], key: PrivateKey): Promise; /** * Broadcasts a vote operation. * * @param vote - Vote payload including voter, author, permlink, and weight. * @param key - Private posting key for `vote.voter`. * @returns Transaction confirmation containing the generated transaction id. * * @throws RPCError * Thrown when the vote is outside chain limits or the posting authority is * invalid. * * @example * ```ts * await client.broadcast.vote( * { * voter: 'srbde', * author: 'alice', * permlink: 'field-notes', * weight: 10_000 * }, * postingKey * ) * ``` */ vote(vote: VoteOperation[1], key: PrivateKey): Promise; /** * Broadcasts a liquid HIVE or HBD transfer. * * @param data - Transfer payload with sender, recipient, amount, and memo. * @param key - Private active key for `data.from`. * @returns Transaction confirmation containing the generated transaction id. * * @throws RPCError * Thrown when the sender lacks funds, active authority is missing, or the node * rejects the transaction. * * @example * ```ts * await client.broadcast.transfer( * { * from: 'srbde', * to: 'alice', * amount: '1.000 HIVE', * memo: 'Invoice 42' * }, * activeKey * ) * ``` */ transfer(data: TransferOperation[1], key: PrivateKey): Promise; /** * Broadcasts a `custom_json` operation for application-level protocols. * * @param data - Custom JSON payload, including id, required authorities, and * serialized JSON string. * @param key - Private posting or active key matching the required authority * arrays. * @returns Transaction confirmation containing the generated transaction id. * * @throws RPCError * Thrown when authority requirements are not met or the payload is invalid. * * @example * ```ts * await client.broadcast.json( * { * required_auths: [], * required_posting_auths: ['srbde'], * id: 'pollen.demo', * json: JSON.stringify({ nectar: 'ready' }) * }, * postingKey * ) * ``` */ json(data: CustomJsonOperation[1], key: PrivateKey): Promise; /** * Creates and optionally delegates to a new account in test environments. * * @param options - New account name, authority source, creator, fee, optional * delegation, and metadata. * @param key - Private active key for `options.creator`. * @returns Transaction confirmation for the claim/create/delegate transaction. * * @remarks * This helper is intentionally guarded for test suites. It can derive owner, * active, posting, and memo keys from a password or accept explicit authority * objects when tests need deterministic key material. * * @throws AssertionError * Thrown when called outside a Mocha-style test environment. * @throws Error * Thrown when neither `password` nor `auths` is supplied, or when the provided * account-creation fee does not match chain properties. * @throws RPCError * Thrown when the chain rejects the account creation transaction. * * @example * ```ts * await testnet.broadcast.createTestAccount( * { * username: 'pollen-dev', * password: 'correct horse battery staple', * creator: 'initminer', * metadata: { app: 'pollen-tests' } * }, * initminerActiveKey * ) * ``` */ createTestAccount(options: CreateAccountOptions, key: PrivateKey): Promise; /** * Broadcasts an `account_update` operation. * * @param data - Account update payload, including optional authorities, * memo key, and JSON metadata. * @param key - Private key with sufficient authority for the fields being * changed. * @returns Transaction confirmation containing the generated transaction id. * * @throws RPCError * Thrown when the update lacks required authority or violates account rules. * * @example * ```ts * await client.broadcast.updateAccount( * { * account: 'srbde', * memo_key: memoPublicKey, * json_metadata: JSON.stringify({ profile: { name: 'SRBDE' } }), * owner: undefined, * active: undefined, * posting: undefined * }, * activeKey * ) * ``` */ updateAccount(data: AccountUpdateOperation[1], key: PrivateKey): Promise; /** * Delegates vesting shares from one account to another. * * @param options - Delegation payload containing delegator, delegatee, and * vesting share amount. * @param key - Private active key for `options.delegator`. * @returns Transaction confirmation containing the generated transaction id. * * @remarks * Delegated VESTS remain owned by the delegator, but voting influence and * resource capacity move to the delegatee. Setting `vesting_shares` to zero * removes the delegation; removed shares enter the protocol cooldown period * before they can vote again. * * @throws RPCError * Thrown when the delegator lacks active authority, the asset is invalid, or * the chain rejects the delegation. * * @example * ```ts * await client.broadcast.delegateVestingShares( * { * delegator: 'srbde', * delegatee: 'alice', * vesting_shares: '100.000000 VESTS' * }, * activeKey * ) * ``` */ delegateVestingShares(options: DelegateVestingSharesOperation[1], key: PrivateKey): Promise; /** * Builds, signs, and broadcasts a transaction containing one or more operations. * * @param operations - Ordered Hive operations to include in the transaction. * @param key - Private key or keys required by the operation authorities. * @returns Transaction confirmation containing the generated transaction id. * * @remarks * Pollen reads dynamic global properties to derive TAPOS reference fields, * assigns an expiration based on {@link expireTime}, signs with the client's * chain id, and submits the final signed transaction. * * @throws RPCError * Thrown when property lookup or transaction broadcast fails. * * @example * ```ts * await client.broadcast.sendOperations( * [['vote', { * voter: 'srbde', * author: 'alice', * permlink: 'field-notes', * weight: 5_000 * }]], * postingKey * ) * ``` */ sendOperations(operations: Operation[], key: PrivateKey | PrivateKey[]): Promise; /** * Signs a transaction with one or more private keys. * * @param transaction - Unsigned transaction with TAPOS fields and expiration. * @param key - Private key or keys required by the transaction authorities. * @returns The signed transaction with compact ECDSA signatures. * * @remarks * The signature digest includes the client's chain id, preventing signatures * from being replayed across Hive-compatible networks. * * @example * ```ts * const signed = client.broadcast.sign(transaction, activeKey) * console.log(signed.signatures) * ``` * * @see {@link cryptoUtils.signTransaction} */ sign(transaction: Transaction, key: PrivateKey | PrivateKey[]): SignedTransaction; /** * Broadcasts an already signed transaction to the active RPC node. * * @param transaction - Signed transaction ready for network submission. * @returns Node confirmation enriched with the locally generated transaction id. * * @throws RPCError * Thrown when the node rejects the signed transaction. * * @example * ```ts * const signed = client.broadcast.sign(transaction, activeKey) * const confirmation = await client.broadcast.send(signed) * console.log(confirmation.id) * ``` */ send(transaction: SignedTransaction): Promise; /** * Sends a raw broadcast-related condenser API call. * * @param method - Condenser method name. * @param params - Positional method parameters. * @returns The decoded RPC result. * * @throws RPCError * Thrown when the node rejects the RPC call. * * @example * ```ts * const result = await client.broadcast.call('broadcast_transaction', [signed]) * ``` */ call(method: string, params?: unknown[]): Promise; } export declare const HBD_NAI = "@@000000013"; export declare const HIVE_NAI = "@@000000021"; /** * Hive asset as returned by market_history_api responses. * `amount` is an integer string of thousandths — divide by 1000 for display. */ export interface HiveAsset { amount: string; precision: number; nai: string; } export interface Trade { /** ISO-8601 without trailing Z — append 'Z' before passing to new Date(). */ date: string; current_pays: HiveAsset; open_pays: HiveAsset; maker: string; taker: string; } export interface GetRecentTradesParams { /** Maximum 1000. */ limit: number; } export interface GetRecentTradesResponse { trades: Trade[]; } export interface GetTradeHistoryParams { /** ISO-8601 datetime without Z. */ start: string; /** ISO-8601 datetime without Z. */ end: string; /** Maximum 1000. To paginate, advance start by 1 ms past the last returned date. */ limit: number; } export interface GetTradeHistoryResponse { trades: Trade[]; } export interface GetTickerResponse { /** Last trade price as HIVE/HBD ratio string. */ latest: string; lowest_ask: string; highest_bid: string; /** Signed decimal string, e.g. "-1.856...". */ percent_change: string; /** 24-hour HIVE volume. */ hive_volume: HiveAsset; /** 24-hour HBD volume. */ hbd_volume: HiveAsset; } export interface GetVolumeResponse { hive_volume: HiveAsset; hbd_volume: HiveAsset; } export interface OrderBookEntry { order_price: { base: HiveAsset; quote: HiveAsset; }; /** Decimal string, e.g. "0.04928000000000000". */ real_price: string; /** HIVE in the order (millis). */ hive: number; /** HBD in the order (millis). */ hbd: number; /** ISO-8601 without trailing Z. */ created: string; } export interface GetOrderBookParams { /** * Entries per side. Maximum 500 — requests above this return 0 results * (silent truncation, not an error). No offset/pagination is available. */ limit: number; } export interface GetOrderBookResponse { /** Buy orders sorted highest→lowest price. */ bids: OrderBookEntry[]; /** Sell orders sorted lowest→highest price. */ asks: OrderBookEntry[]; } export interface GetMarketHistoryBucketsResponse { /** Available bucket sizes in seconds, e.g. [15, 60, 300, 3600, 86400]. */ bucket_sizes: number[]; } export interface OHLCVSide { high: number; low: number; open: number; close: number; volume: number; } export interface MarketBucket { id: number; /** ISO-8601 bucket start without trailing Z. */ open: string; seconds: number; /** OHLCV in HIVE units (millis). */ hive: OHLCVSide; /** OHLCV in HBD units (millis). */ non_hive: OHLCVSide; } export interface GetMarketHistoryParams { /** Must be one of the values returned by getMarketHistoryBuckets(). */ bucket_seconds: number; /** ISO-8601 datetime without Z. */ start: string; /** ISO-8601 datetime without Z. */ end: string; } export interface GetMarketHistoryResponse { buckets: MarketBucket[]; } /** * Typed wrapper for the Hive `market_history_api`. * * @remarks * Accessible as `client.market`. All date strings returned by this API lack a * trailing `Z` — append it before constructing a `Date`: `new Date(date + 'Z')`. * All `HiveAsset.amount` values are integer millis strings; divide by 1000 for * display values. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = new Client('https://api.hive.blog') * const ticker = await client.market.getTicker() * console.log(`HIVE/HBD: ${ticker.latest}`) * ``` */ export declare class MarketHistoryAPI { readonly client: Client; constructor(client: Client); call(method: string, params?: unknown): Promise; /** * Returns the most recent trades on the internal market. * * @param params - `limit` up to 1000. * * @example * ```ts * const { trades } = await client.market.getRecentTrades({ limit: 100 }) * ``` */ getRecentTrades(params: GetRecentTradesParams): Promise; /** * Returns trades between two timestamps. * * @param params - `start`, `end` as ISO-8601 strings without Z, `limit` up to 1000. * @remarks * To paginate, take the maximum `date` from the last batch, append 1 ms, and * re-query. Loop until batch size < limit or cursor >= end. * * @example * ```ts * const { trades } = await client.market.getTradeHistory({ * start: '2024-01-01T00:00:00', * end: '2024-01-02T00:00:00', * limit: 1000 * }) * ``` */ getTradeHistory(params: GetTradeHistoryParams): Promise; /** * Returns current ticker data for the HIVE/HBD internal market. * * @example * ```ts * const ticker = await client.market.getTicker() * console.log(ticker.latest, ticker.percent_change) * ``` */ getTicker(): Promise; /** * Returns 24-hour HIVE and HBD trading volume. * * @example * ```ts * const { hive_volume, hbd_volume } = await client.market.getVolume() * ``` */ getVolume(): Promise; /** * Returns the current order book up to `limit` entries per side. * * @param params - `limit` per side, maximum 500. Requests above 500 return * 0 results (silent truncation). There is no pagination beyond 500/side. * * @example * ```ts * const { bids, asks } = await client.market.getOrderBook({ limit: 500 }) * const spread = Number(asks[0].real_price) - Number(bids[0].real_price) * ``` */ getOrderBook(params: GetOrderBookParams): Promise; /** * Returns the available OHLCV bucket sizes supported by this node. * * @example * ```ts * const { bucket_sizes } = await client.market.getMarketHistoryBuckets() * // [15, 60, 300, 3600, 86400] * ``` */ getMarketHistoryBuckets(): Promise; /** * Returns OHLCV candles for a time range at a given bucket size. * * @param params - `bucket_seconds` must be one of the values from * {@link getMarketHistoryBuckets}. `start` and `end` are ISO-8601 without Z. * @remarks * Close price in HBD-per-HIVE: `bucket.hive.close / bucket.non_hive.close`. * Volume values are millis — divide by 1000. * * @example * ```ts * const { buckets } = await client.market.getMarketHistory({ * bucket_seconds: 3600, * start: '2024-01-01T00:00:00', * end: '2024-01-02T00:00:00' * }) * ``` */ getMarketHistory(params: GetMarketHistoryParams): Promise; } /** * A single open limit order as returned by `condenser_api.get_open_orders`. * * @remarks * `sell_price` here uses human-readable asset strings (`"1.000 HIVE"`) rather * than {@link HiveAsset} objects — this differs from {@link LimitOrder} returned * by `database_api.list_limit_orders`. Use the provided `real_price` instead of * computing price from `sell_price`. * * `sell_price.base` reflects the **original** order amount; `for_sale` is what * remains and will be less than the original when the order is partially filled. */ export interface OpenOrder { id: number; /** ISO-8601 without trailing Z. */ created: string; /** ISO-8601 without trailing Z. */ expiration: string; seller: string; orderid: number; /** Millis of the remaining base asset — may be less than original if partially filled. */ for_sale: number; sell_price: { /** Human-readable original order amount, e.g. `"11089.628 HIVE"`. */ base: string; /** Human-readable desired amount, e.g. `"655.397 HBD"`. */ quote: string; }; /** Pre-computed HBD-per-HIVE price as a decimal string. */ real_price: string; /** Legacy field, always false. */ rewarded: boolean; } /** * The payload of a `fill_order` virtual operation. * * @remarks * Amounts are human-readable strings (`"602.975 HIVE"`), not millis integers. * Parse with `s.split(' ')` → `[Number(amount), symbol]`. Do **not** multiply * by 0.001. The same trade generates one entry in both the maker's and taker's * account history — deduplicate on `trx_id + op_in_trx` when joining across accounts. */ export interface FillOrderOp { /** Taker — account whose order triggered the match. */ current_owner: string; current_orderid: number; /** Human-readable asset string, e.g. `"602.975 HIVE"`. */ current_pays: string; /** Maker — account whose resting order was matched. */ open_owner: string; open_orderid: number; /** Human-readable asset string, e.g. `"29.787 HBD"`. */ open_pays: string; } /** * A single entry from `condenser_api.get_account_history`. * * @remarks * Results are returned as `[index, AccountHistoryEntry]` tuples. Narrow the * operation type with `entry.op[0] === 'fill_order'` before casting `entry.op[1]`. */ export interface AccountHistoryEntry { /** Operation tuple: `[operationName, payload]`. */ op: [ string, unknown ]; block: number; trx_id: string; op_in_trx: number; /** ISO-8601 without trailing Z. */ timestamp: string; virtual_op: boolean; } /** * A single open limit order on the Hive internal market, as returned by * `database_api.list_limit_orders`. Includes the seller account name and full * price data — fields not available from `market_history_api.get_order_book`. */ export interface LimitOrder { id: number; /** ISO-8601 without trailing Z. */ created: string; /** ISO-8601 without trailing Z. */ expiration: string; /** Hive account name of the order owner. */ seller: string; /** Seller-assigned order ID. */ orderid: number; /** Amount remaining for sale, in millis of the base asset. */ for_sale: number; sell_price: { /** Asset being sold. */ base: HiveAsset; /** Asset wanted in return. */ quote: HiveAsset; }; } export interface ListLimitOrdersParams { /** * Pagination cursor as `[seller_account, orderid]`. * Use `["", 0]` to start from the beginning. */ start: [ string, number ]; /** Maximum entries per page. Up to 1000. */ limit: number; /** * Must be `"by_account"`. The `"by_price"` value throws a * `bad_cast_exception` on all tested nodes. */ order: "by_account"; } export interface ListLimitOrdersResponse { orders: LimitOrder[]; } /** * Sort or lookup category used by Hive's `get_discussions_by_*` RPC family. * * @remarks * Categories map directly to condenser API method suffixes. For `blog` and * `feed`, Hive expects the query `tag` to be an account name rather than a * content tag. * * @example * ```ts * const posts = await client.database.getDiscussions('trending', { * tag: 'hive-139531', * limit: 10 * }) * ``` */ export type DiscussionQueryCategory = "active" | "blog" | "cashout" | "children" | "comments" | "feed" | "hot" | "promoted" | "trending" | "votes" | "created"; /** * Query shape accepted by Hive discussion listing endpoints. * * @remarks * The name is preserved for API compatibility even though the historical type * spelling is `DisqussionQuery`. * * @example * ```ts * const query: DisqussionQuery = { * tag: 'photography', * limit: 20, * truncate_body: 512 * } * ``` */ export interface DisqussionQuery { /** * Name of author or tag to fetch. */ tag?: string; /** * Number of results, max 100. */ limit: number; filter_tags?: string[]; select_authors?: string[]; select_tags?: string[]; /** * Number of bytes of post body to fetch, default 0 (all) */ truncate_body?: number; /** * Name of author to start from, used for paging. * Should be used in conjunction with `start_permlink`. */ start_author?: string; /** * Permalink of post to start from, used for paging. * Should be used in conjunction with `start_author`. */ start_permlink?: string; parent_author?: string; parent_permlink?: string; } /** * Read-only helper for Hive condenser/database RPC methods. * * @remarks * `DatabaseAPI` wraps the broad read surface used by wallets, indexers, and * publishing tools. Methods here keep raw condenser names visible for protocol * familiarity while returning Pollen chain types such as {@link Asset}, * {@link Price}, and {@link ExtendedAccount} where richer parsing is useful. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = new Client('https://api.hive.blog') * const [account] = await client.database.getAccounts(['srbde']) * * console.log(account.reputation, account.posting_json_metadata) * ``` * * @see {@link Client.call} */ export declare class DatabaseAPI { readonly client: Client; /** * Creates a database helper bound to a client. * * @param client - Client used to send condenser API calls. */ constructor(client: Client); /** * Sends a raw condenser API call through the parent client. * * @param method - Bare condenser method name **without** the `condenser_api.` * prefix. This helper automatically prepends `condenser_api.` before * forwarding the call, so including the prefix yourself will produce a * double-prefixed method name (e.g. `condenser_api.condenser_api.foo`) that * every node will reject with an `RPCError: Unable to map request to endpoint`. * @param params - Positional parameters for the method. * @returns The decoded RPC result. * * @throws RPCError * Thrown when the RPC node rejects the call or the method is unavailable. * * @example * ```ts * // Correct — 'condenser_api.' is added automatically * const result = await client.database.call('get_config') * console.log(result.HIVE_BLOCK_INTERVAL) * * // Also correct * const votes = await client.database.call('list_proposal_votes', [ * [], 100, 'by_voter_proposal', 'ascending', 'votable' * ]) * * // Wrong — sends condenser_api.condenser_api.list_proposal_votes → RPCError * const votes = await client.database.call('condenser_api.list_proposal_votes', [...]) * ``` */ call(method: string, params?: unknown[]): Promise; /** * Fetches the dynamic global state maintained by the current RPC node. * * @returns Head block, irreversible block, supply, vesting, witness, and * timing data used by Hive applications. * * @throws RPCError * Thrown when the node cannot serve `get_dynamic_global_properties`. * * @example * ```ts * const props = await client.database.getDynamicGlobalProperties() * console.log(props.head_block_number, props.time) * ``` */ getDynamicGlobalProperties(): Promise; /** * Fetches witness-voted median chain properties. * * @returns Chain settings such as account creation fee and maximum block size. * * @throws RPCError * Thrown when the RPC node cannot read chain properties. * * @example * ```ts * const props = await client.database.getChainProperties() * console.log(props.account_creation_fee.toString()) * ``` */ getChainProperties(): Promise; /** * Fetches condenser state for a Hive-style URL path. * * @param path - Path component using condenser's routing scheme, such as * `@srbde` or `trending/hive-139531`. * @returns The mixed state bundle returned by the condenser API. * * @remarks * This method mirrors the legacy condenser state endpoint. Prefer focused * helpers such as {@link getAccounts} or {@link getDiscussions} when an app * only needs one resource category. * * @throws RPCError * Thrown when the RPC node rejects the state lookup. * * @example * ```ts * const state = await client.database.getState('trending/hive-139531') * console.log(Object.keys(state.content)) * ``` */ getState(path: string): Promise; /** * Fetches the witness median market price for HIVE denominated in HBD. * * @returns A parsed {@link Price} containing the base and quote assets. * * @throws RPCError * Thrown when the RPC node cannot serve the price feed. * * @example * ```ts * const price = await client.database.getCurrentMedianHistoryPrice() * console.log(`${price.base} per ${price.quote}`) * ``` */ getCurrentMedianHistoryPrice(): Promise; /** * Fetches vesting delegations made by an account. * * @param account - Delegator account name. * @param from - Delegatee account name to start after for pagination. * @param limit - Maximum number of delegations to return, up to 1000. * @returns Delegation records ordered by delegatee. * * @throws RPCError * Thrown when the account is invalid or the node rejects the request. * * @example * ```ts * const delegations = await client.database.getVestingDelegations('srbde', '', 50) * for (const delegation of delegations) { * console.log(delegation.delegatee, delegation.vesting_shares.toString()) * } * ``` */ getVestingDelegations(account: string, from?: string, limit?: number): Promise; /** * Fetches static protocol constants exposed by the RPC node. * * @returns A name-value map of chain configuration constants. * * @remarks * Config values are useful when deriving UI limits, validating operation * payloads, or teaching protocol defaults in the VitePress hub. * * @throws RPCError * Thrown when the node cannot serve `get_config`. * * @example * ```ts * const config = await client.database.getConfig() * console.log(config.HIVE_BLOCK_INTERVAL) * ``` * * @see https://github.com/steemit/steem/blob/master/libraries/protocol/include/steemit/protocol/config.hpp */ getConfig(): Promise<{ [name: string]: string | number | boolean; }>; /** * Fetches the header for a specific block number. * * @param blockNum - One-based Hive block number. * @returns The signed block header without transaction bodies. * * @throws RPCError * Thrown when the block does not exist or the node rejects the request. * * @example * ```ts * const header = await client.database.getBlockHeader(90_000_000) * console.log(header.previous) * ``` */ getBlockHeader(blockNum: number): Promise; /** * Fetches a full signed block by number. * * @param blockNum - One-based Hive block number. * @returns The signed block, including transactions and extensions. * * @throws RPCError * Thrown when the block does not exist or the node rejects the request. * * @example * ```ts * const block = await client.database.getBlock(90_000_000) * console.log(block.transactions.length) * ``` */ getBlock(blockNum: number): Promise; /** * Fetches applied operations recorded in a block. * * @param blockNum - One-based Hive block number. * @param onlyVirtual - When true, returns only virtual operations generated by * chain processing. * @returns Applied operation records with transaction and operation indexes. * * @throws RPCError * Thrown when the block cannot be read or the operation-history plugin is not * available on the node. * * @example * ```ts * const operations = await client.database.getOperations(90_000_000) * console.log(operations.map((applied) => applied.op[0])) * ``` */ getOperations(blockNum: number, onlyVirtual?: boolean): Promise; /** * Fetches discussion records such as posts, comments, blog entries, or feeds. * * @param by - Discussion category that selects the condenser method suffix. * @param query - Category-specific query fields, including tag/account and * pagination values. * @returns Discussion objects as returned by condenser. * * @remarks * For `blog` and `feed`, set `query.tag` to the account name. For tag-based * categories such as `trending`, set it to the community or content tag. * * @throws RPCError * Thrown when the query is invalid or the selected discussion method is * unavailable on the node. * * @example * ```ts * const posts = await client.database.getDiscussions('blog', { * tag: 'srbde', * limit: 5, * truncate_body: 256 * }) * * console.log(posts.map((post) => post.permlink)) * ``` */ getDiscussions(by: DiscussionQueryCategory, query: DisqussionQuery): Promise; /** * Fetches extended account objects for one or more account names. * * @param usernames - Account names to fetch. * @returns Extended account records, including balances, authority metadata, * reputation, and JSON metadata. * * @throws RPCError * Thrown when the RPC node rejects the account lookup. * * @example * ```ts * const [account] = await client.database.getAccounts(['srbde']) * console.log(account.name, account.reputation) * ``` */ getAccounts(usernames: string[]): Promise; /** * Fetches a signed transaction by transaction id. * * @param txId - Hex transaction id. * @returns The signed transaction stored by the account-history plugin. * * @throws RPCError * Thrown when the transaction is unknown or the node lacks transaction lookup * support. * * @example * ```ts * const transaction = await client.database.getTransaction( * '0000000000000000000000000000000000000000' * ) * console.log(transaction.operations) * ``` */ getTransaction(txId: string): Promise; /** * Fetches historical operations for an account. * * @param account - Account whose history should be read. * @param from - Starting history index. Use `-1` for the most recent entry. * Walk backwards by using the lowest index from each batch minus 1 as the * next `from`. * @param limit - Maximum entries to return, up to 1000. * @param filter - Optional `[low, high]` BigInt pair from {@link opFilter}. * Asks the node to return only the selected operation types, avoiding * client-side discard. Must stay as `bigint` through serialization — passing * `Number(bigint)` loses precision for bits ≥ 53 (e.g. `fill_order` is bit 57). * @returns Array of `[index, AccountHistoryEntry]` tuples, newest-first when * walking from `-1`. * * @example * ```ts * import { OP, opFilter } from '@srbde/pollen' * * const [low, high] = opFilter(OP.fill_order) * const history = await client.database.getAccountHistory('srbde', -1, 1000, [low, high]) * const fills = history.filter(([, e]) => e.op[0] === 'fill_order') * ``` */ getAccountHistory(account: string, from: number, limit: number, filter?: [ bigint, bigint ]): Promise<[ number, AccountHistoryEntry ][]>; /** * Fetches all currently open limit orders for a single account. * * @param account - Hive account name. * @returns All open orders for the account in a single call — no pagination. * * @remarks * `sell_price` uses human-readable strings (`"11089.628 HIVE"`) rather than * {@link HiveAsset} millis objects. Use `order.real_price` for the * pre-computed HBD-per-HIVE price. `for_sale` reflects the **remaining** * amount — compare to the parsed `sell_price.base` to detect partial fills. * * To determine bid vs ask: * ```ts * const isAsk = order.sell_price.base.endsWith('HIVE') // selling HIVE for HBD * const isBid = order.sell_price.base.endsWith('HBD') // selling HBD for HIVE * ``` * * @example * ```ts * const orders = await client.database.getOpenOrders('myaccount') * for (const order of orders) { * console.log(order.orderid, order.real_price, order.for_sale) * } * ``` */ getOpenOrders(account: string): Promise; /** * Verifies that a signed transaction satisfies Hive authority rules. * * @param stx - Signed transaction to verify. * @returns True when the signatures satisfy the transaction's required * authorities. * * @throws RPCError * Thrown when the node rejects the transaction or cannot evaluate authority. * * @example * ```ts * const signed = client.broadcast.sign(transaction, privateKey) * const ok = await client.database.verifyAuthority(signed) * console.log(ok) * ``` */ verifyAuthority(stx: SignedTransaction): Promise; /** * Lists open limit orders across the entire internal market, paginated by account. * * @param params - Cursor `start` as `["", 0]` for the first page, then the * last returned `[seller, orderid]` for subsequent pages. `limit` up to 1000. * `order` must be `"by_account"` — `"by_price"` throws a `bad_cast_exception` * on all tested nodes. * @returns Up to `limit` open orders with seller account names and full price data. * * @remarks * Prefer this over `market_history_api.get_order_book` when seller identity or * the complete order book is needed: `get_order_book` caps at 500 entries per * side and omits the seller. As of 2026-06-19 the full market has ~1349 orders, * requiring two pages at `limit=1000`. Use `[seller, orderid]` of the last entry * as the next `start` and loop until batch size < limit. * * To determine bid vs ask from `sell_price`: * ```ts * import { HIVE_NAI, HBD_NAI } from '@srbde/pollen' * * const isAsk = order.sell_price.base.nai === HIVE_NAI // selling HIVE for HBD * const isBid = order.sell_price.base.nai === HBD_NAI // selling HBD for HIVE * ``` * * @example * ```ts * const orders: LimitOrder[] = [] * let cursor: [string, number] = ['', 0] * while (true) { * const { orders: page } = await client.database.listLimitOrders({ * start: cursor, limit: 1000, order: 'by_account' * }) * orders.push(...page) * if (page.length < 1000) break * cursor = [page.at(-1)!.seller, page.at(-1)!.orderid] * } * ``` */ listLimitOrders(params: ListLimitOrdersParams): Promise; /** * Fetches version information from the active RPC node. * * @returns Version fields reported by the node software. * * @throws RPCError * Thrown when the node does not expose `get_version`. * * @example * ```ts * const version = await client.database.getVersion() * console.log(version) * ``` */ getVersion(): Promise; } /** * Community metadata returned by Hivemind bridge calls. * * @remarks * This shape contains presentation metadata, moderation/admin team fields, and * aggregate pending-post counters that Hive front ends use for community pages. * * @example * ```ts * const [community] = await client.hivemind.getCommunity({ * name: 'hive-139531', * observer: 'srbde' * }) * * console.log(community.title, community.subscribers) * ``` */ export interface CommunityDetail { id: number; name: string; title: string; about: string; lang: string; type_id: number; is_nsfw: false; subscribers: number; sum_pending: number; num_pending: number; num_authors: number; created_at: string; avatar_url: string; context: object; description: string; flag_text: string; settings: {}; team?: string[]; admins?: string[]; } /** * Hivemind notification record for an account feed. * * @remarks * Notifications are social/application events generated by Hivemind, not raw * block operations. Use account history when exact protocol operations are * required. * * @example * ```ts * const notifications = await client.hivemind.getAccountNotifications({ * account: 'srbde', * limit: 10 * }) * * console.log(notifications[0]?.msg) * ``` */ export interface Notifications { id: number; type: string; score: number; date: string; msg: string; url: string; } /** * Query options for ranked Hivemind post feeds. * * @remarks * Bridge ranking supports global feeds, community feeds, pagination, and an * observer account for personalized muted/reputation context. * * @example * ```ts * const query: PostsQuery = { * sort: 'trending', * tag: 'hive-139531', * limit: 10, * observer: 'srbde' * } * ``` */ export interface PostsQuery { /** * Number of posts to fetch */ limit?: number; /** * Sorting posts */ sort: "trending" | "hot" | "created" | "promoted" | "payout" | "payout_comments" | "muted"; /** * Filtering with tags */ tag?: string[] | string; /** * Observer account */ observer?: string; /** * Paginating last post author */ start_author?: string; /** * Paginating last post permlink */ start_permlink?: string; } /** * Omitting sort extended from BridgeParam */ /** * Query options for posts associated with a specific account. * * @example * ```ts * const query: AccountPostsQuery = { * account: 'srbde', * sort: 'posts', * limit: 10 * } * ``` */ export interface AccountPostsQuery extends Omit { account: string; sort: "posts"; } /** * Query options for fetching a single community. */ export interface CommunityQuery { name: string; observer: string; } /** * Query options for community role lookups. * * @remarks * Reserved for bridge role endpoints that identify moderators, admins, and * other community team assignments. */ export interface CommunityRolesQuery { community: string; } /** * Query options for an account notification feed. * * @example * ```ts * const query: AccountNotifsQuery = { * account: 'srbde', * limit: 25 * } * ``` */ export interface AccountNotifsQuery { account: Account["name"]; limit: number; type?: "new_community" | "pin_post"; } /** * Query options for listing communities known to Hivemind. * * @example * ```ts * const query: ListCommunitiesQuery = { * limit: 20, * observer: 'srbde' * } * ``` */ export interface ListCommunitiesQuery { /** * Paginating last */ last?: string; /** * Number of communities to fetch */ limit: number; /** * To be developed, not ready yet */ query?: string | any; /** * Observer account */ observer?: Account["name"]; } /** * Helper for Hive Hivemind and bridge API reads. * * @remarks * Hivemind powers social data that is not stored directly in block operations: * ranked posts, community metadata, subscriptions, and notification feeds. This * helper routes calls through the `bridge` API namespace used by modern Hive * front ends. * * @example * ```ts * const posts = await client.hivemind.getRankedPosts({ * sort: 'trending', * tag: 'hive-139531', * limit: 10 * }) * * console.log(posts.map((post) => post.title)) * ``` */ export declare class HivemindAPI { readonly client: Client; /** * Creates a Hivemind helper bound to a client. * * @param client - Client used to call the bridge API namespace. */ constructor(client: Client); /** * Sends a raw bridge API call. * * @param method - Bridge method name. * @param params - Method-specific named parameters. * @returns The decoded bridge result. * * @throws RPCError * Thrown when the active node does not expose bridge or rejects the request. * * @example * ```ts * const posts = await client.hivemind.call('get_ranked_posts', { * sort: 'hot', * tag: 'hive-139531', * limit: 5 * }) * ``` */ call(method: string, params?: unknown): Promise; /** * Fetches ranked posts from Hivemind. * * @param options - Sort, tag/community, pagination, observer, and limit * settings. * @returns Discussion records ordered by the selected ranking mode. * * @throws RPCError * Thrown when bridge rejects the ranking query. * * @example * ```ts * const posts = await client.hivemind.getRankedPosts({ * sort: 'created', * tag: 'hive-139531', * limit: 20, * observer: 'srbde' * }) * ``` */ getRankedPosts(options: PostsQuery): Promise; /** * Fetches posts authored or surfaced by a specific account. * * @param options - Account, pagination, observer, and limit settings. * @returns Discussion records from the account's post feed. * * @throws RPCError * Thrown when bridge rejects the account-post query. * * @example * ```ts * const posts = await client.hivemind.getAccountPosts({ * account: 'srbde', * sort: 'posts', * limit: 10 * }) * ``` */ getAccountPosts(options: AccountPostsQuery): Promise; /** * Fetches community metadata from Hivemind. * * @param options - Community name and observer account. * @returns Community detail records including roles, subscribers, and * display metadata. * * @throws RPCError * Thrown when the community cannot be read. * * @example * ```ts * const [community] = await client.hivemind.getCommunity({ * name: 'hive-139531', * observer: 'srbde' * }) * * console.log(community.title) * ``` */ getCommunity(options: CommunityQuery): Promise; /** * Lists communities followed by an account. * * @param account - Account name or bridge-compatible account parameter. * @returns Subscription records containing community and role information. * * @throws RPCError * Thrown when bridge rejects the subscription lookup. * * @example * ```ts * const subscriptions = await client.hivemind.listAllSubscriptions('srbde') * console.log(subscriptions) * ``` */ listAllSubscriptions(account: Account["name"] | object): Promise; /** * Fetches an account's Hivemind notification feed. * * @param options - Account, limit, and optional notification type filter. * @returns Notification records for the account. * * @throws RPCError * Thrown when bridge rejects the notification query. * * @example * ```ts * const notifications = await client.hivemind.getAccountNotifications({ * account: 'srbde', * limit: 25 * }) * ``` */ getAccountNotifications(options?: AccountNotifsQuery): Promise; /** * Lists communities known to Hivemind. * * @param options - Pagination, limit, query, and observer settings. * @returns Community detail records. * * @throws RPCError * Thrown when bridge rejects the community list query. * * @example * ```ts * const communities = await client.hivemind.listCommunities({ * limit: 20, * observer: 'srbde' * }) * ``` */ listCommunities(options: ListCommunitiesQuery): Promise; } export interface AccountsByKey { /** * Account names grouped by the queried public key order. * * @remarks * Each inner array contains the accounts that reference the corresponding * public key in owner or active authorities. */ accounts: string[][]; } /** * Helper for resolving Hive accounts by authority public key. * * @remarks * The `account_by_key_api` plugin is useful for wallet recovery, ownership * audits, and account discovery from a known owner or active public key. * * @example * ```ts * const references = await client.keys.getKeyReferences([publicKey]) * console.log(references.accounts[0]) * ``` */ export declare class AccountByKeyAPI { readonly client: Client; /** * Creates an account-by-key helper bound to a client. * * @param client - Client used to call `account_by_key_api`. */ constructor(client: Client); /** * Sends a raw `account_by_key_api` call. * * @param method - API method name. * @param params - Method-specific parameter object. * @returns The decoded RPC result. * * @throws RPCError * Thrown when the node does not expose the plugin or rejects the request. * * @example * ```ts * const result = await client.keys.call('get_key_references', { * keys: [publicKey.toString()] * }) * ``` */ call(method: string, params?: unknown): Promise; /** * Fetches accounts that reference the supplied public keys. * * @param keys - Public keys or public-key strings to search. * @returns Account-name groups aligned to the input key order. * * @remarks * Hive returns accounts whose owner or active authorities include each key. * The helper stringifies {@link PublicKey} instances before sending the RPC * payload. * * @throws RPCError * Thrown when account-by-key lookup is unavailable or the node rejects a key. * * @example * ```ts * const references = await client.keys.getKeyReferences([ * 'STM8m5UgaFAAYQRuaNejYdS8FVLVp9Ss3K1qAVk5de6F8s3HnVbvA' * ]) * * console.log(references.accounts[0]) * ``` */ getKeyReferences(keys: (PublicKey | string)[]): Promise; } /** * Global RC pricing parameters for every Hive resource class. * * @remarks * RC pricing separates history bytes, account creation, market bytes, state * bytes, and execution time. Each resource has dynamics parameters and a price * curve used by the chain to compute RC costs. * * @example * ```ts * const params = await client.rc.getResourceParams() * console.log(params.resource_execution_time.price_curve_params) * ``` */ export interface RCParams { resource_history_bytes: Resource; resource_new_accounts: Resource; resource_market_bytes: Resource; resource_state_bytes: Resource; resource_execution_time: Resource; } /** * Pricing configuration for a single RC resource class. */ export interface Resource { resource_dynamics_params: DynamicParam; price_curve_params: PriceCurveParam; } /** * Dynamic RC pool tuning values for one resource class. * * @remarks * These fields describe how the resource pool regenerates, decays, and caps * over time. */ export interface DynamicParam { resource_unit: number; budget_per_time_unit: number; pool_eq: Bignum; max_pool_size: Bignum; decay_params: { decay_per_time_unit: Bignum; decay_per_time_unit_denom_shift: number; }; min_decay: number; } /** * Curve coefficients used to convert resource usage into RC cost. */ export interface PriceCurveParam { coeff_a: Bignum; coeff_b: Bignum; shift: number; } /** * Current available RC pool levels by resource class. * * @example * ```ts * const pool = await client.rc.getResourcePool() * console.log(pool.resource_state_bytes.pool) * ``` */ export interface RCPool { resource_history_bytes: Pool; resource_new_accounts: Pool; resource_market_bytes: Pool; resource_state_bytes: Pool; resource_execution_time: Pool; } /** * Current pool amount for one RC resource class. */ export interface Pool { pool: Bignum; } /** * RC account state returned by `find_rc_accounts`. * * @remarks * `rc_manabar` is a decaying/regenerating value. Use * {@link RCAPI.calculateRCMana} or {@link RCAPI.getRCMana} to project the * current value instead of reading `current_mana` directly. * * @example * ```ts * const [account] = await client.rc.findRCAccounts(['srbde']) * console.log(account.max_rc) * ``` */ export interface RCAccount { account: string; rc_manabar: { current_mana: Bignum; last_update_time: number; }; max_rc_creation_adjustment: SMTAsset | string; max_rc: Bignum; } /** * Projected manabar value returned by Pollen mana helpers. * * @remarks * `percentage` is expressed in hundredths of a percent. Divide by 100 for a * human-readable percent value. * * @example * ```ts * const mana = await client.rc.getVPMana('srbde') * console.log(`${mana.percentage / 100}%`) * ``` */ export interface Manabar { current_mana: number; max_mana: number; percentage: number; } /** * Helper for Hive Resource Credit and voting mana calculations. * * @remarks * `RCAPI` reads `rc_api` data and converts Hive manabar state into current * mana and percentage values. RC mana controls transaction capacity, while * voting mana controls curation influence; both regenerate over Hive's * five-day manabar window. * * @example * ```ts * const rc = await client.rc.getRCMana('srbde') * const vp = await client.rc.getVPMana('srbde') * * console.log(rc.percentage / 100, vp.percentage / 100) * ``` */ export declare class RCAPI { readonly client: Client; /** * Creates an RC helper bound to a client. * * @param client - Client used to call `rc_api` and condenser account data. */ constructor(client: Client); /** * Sends a raw `rc_api` call through the parent client. * * @param method - RC API method name. * @param params - Named parameter object accepted by the method. * @returns The decoded RPC result. * * @throws RPCError * Thrown when the active RPC node does not expose `rc_api` or rejects the * request. * * @example * ```ts * const result = await client.rc.call('find_rc_accounts', { * accounts: ['srbde'] * }) * ``` */ call(method: string, params?: unknown): Promise; /** * Fetches RC account records for one or more usernames. * * @param usernames - Account names to inspect. * @returns RC account records including max RC and current RC manabar state. * * @throws RPCError * Thrown when the node cannot serve `find_rc_accounts`. * * @example * ```ts * const [rcAccount] = await client.rc.findRCAccounts(['srbde']) * console.log(rcAccount.max_rc) * ``` */ findRCAccounts(usernames: string[]): Promise; /** * Fetches global RC resource parameters. * * @returns Chain-wide coefficients used to price CPU, state bytes, history, * execution time, and market bandwidth. * * @throws RPCError * Thrown when the node cannot serve `get_resource_params`. * * @example * ```ts * const params = await client.rc.getResourceParams() * console.log(params.resource_params) * ``` */ getResourceParams(): Promise; /** * Fetches the current RC resource pool. * * @returns Current pool levels for the chain's RC resource classes. * * @throws RPCError * Thrown when the node cannot serve `get_resource_pool`. * * @example * ```ts * const pool = await client.rc.getResourcePool() * console.log(pool.resource_pool) * ``` */ getResourcePool(): Promise; /** * Fetches and calculates current RC mana for an account. * * @param username - Account name to inspect. * @returns Manabar values with current mana, maximum mana, and percentage in * hundredths of a percent. * * @remarks * The calculation projects regeneration from the account's last RC manabar * update to the current wall-clock time. * * @throws RPCError * Thrown when RC account lookup fails. * * @example * ```ts * const mana = await client.rc.getRCMana('srbde') * console.log(`${mana.percentage / 100}% RC`) * ``` */ getRCMana(username: string): Promise; /** * Fetches and calculates current voting mana for an account. * * @param username - Account name to inspect. * @returns Voting manabar values with current mana, maximum mana, and * percentage in hundredths of a percent. * * @remarks * Maximum voting mana is derived from vesting shares, then regenerated across * Hive's five-day voting manabar window. * * @throws RPCError * Thrown when account lookup fails. * * @example * ```ts * const mana = await client.rc.getVPMana('srbde') * console.log(`${mana.percentage / 100}% voting mana`) * ``` */ getVPMana(username: string): Promise; /** * Calculates current RC mana from an RC account record. * * @param rc_account - Account record returned by {@link findRCAccounts}. * @returns Projected manabar state at the current wall-clock time. * * @example * ```ts * const [rcAccount] = await client.rc.findRCAccounts(['srbde']) * const mana = client.rc.calculateRCMana(rcAccount) * ``` */ calculateRCMana(rc_account: RCAccount): Manabar; /** * Calculates current voting mana from a condenser account record. * * @param account - Account object containing vesting shares and voting * manabar state. * @returns Projected voting manabar state at the current wall-clock time. * * @example * ```ts * const [account] = await client.database.getAccounts(['srbde']) * const mana = client.rc.calculateVPMana(account) * ``` */ calculateVPMana(account: Account): Manabar; /** * Internal convenience method to reduce redundant code */ private _calculateManabar; } /** * Lifecycle state reported by Hive's transaction-status plugin. * * @remarks * `within_reversible_block` means the transaction is included but not final. * `within_irreversible_block` is the stable state most applications should wait * for before treating a transaction as final. * * @example * ```ts * const { status } = await client.transaction.findTransaction(txId) * const final = status === 'within_irreversible_block' * ``` */ export type TransactionStatus = "unknown" | "within_mempool" | "within_reversible_block" | "within_irreversible_block" | "expired_reversible" | "expired_irreversible" | "too_old"; /** * Helper for checking Hive transaction inclusion status. * * @remarks * The transaction status plugin reports whether a transaction is still unknown, * in the mempool, included in a reversible block, included irreversibly, or too * old to track. This is useful for user-facing broadcast confirmation flows. * * @example * ```ts * const { status } = await client.transaction.findTransaction(txId) * console.log(status) * ``` */ export declare class TransactionStatusAPI { readonly client: Client; /** * Creates a transaction-status helper bound to a client. * * @param client - Client used to call `transaction_status_api`. */ constructor(client: Client); /** * Sends a raw `transaction_status_api` call. * * @param method - Transaction-status API method name. * @param params - Method-specific parameter object. * @returns The decoded RPC result. * * @throws RPCError * Thrown when the active node does not expose the transaction-status plugin * or rejects the request. * * @example * ```ts * const result = await client.transaction.call('find_transaction', { * transaction_id: txId * }) * ``` */ call(method: string, params?: unknown): Promise; /** * Finds the current lifecycle status of a transaction id. * * @param transaction_id - Hex transaction id to inspect. * @param expiration - Optional transaction expiration timestamp, used by the * plugin to distinguish expired transactions from unknown ones. * @returns The transaction status reported by the node. * * @throws RPCError * Thrown when the plugin is unavailable or the transaction id is malformed. * * @example * ```ts * const { status } = await client.transaction.findTransaction( * confirmation.id, * transaction.expiration * ) * * if (status === 'within_irreversible_block') { * console.log('Final') * } * ``` */ findTransaction(transaction_id: string, expiration?: string): Promise<{ status: TransactionStatus; }>; } /** * Main Hive network chain id as 32 raw bytes. * * @remarks * The chain id is mixed into transaction signatures. Keeping the default here * prevents signatures produced for Hive mainnet from being replayed on a * different chain. * * @example * ```ts * import { DEFAULT_CHAIN_ID } from '@srbde/pollen' * * console.log(toHex(DEFAULT_CHAIN_ID)) * ``` */ export declare const DEFAULT_CHAIN_ID: Uint8Array; /** * Main Hive network public-key address prefix. * * @remarks * Hive-compatible public keys are rendered with a network prefix. Mainnet uses * `STM`, and custom networks can override this through {@link ClientOptions}. */ export declare const DEFAULT_ADDRESS_PREFIX = "STM"; /** * Configuration for a {@link Client} instance. * * @remarks * Options control both protocol identity, such as `chainId` and * `addressPrefix`, and resilience behavior, such as timeout, failover, and * jittered backoff. A single configured client owns the Nectar helpers for * database reads, broadcasting, RC, Hivemind, and transaction-status calls. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = new Client( * ['https://api.hive.blog', 'https://api.openhive.network'], * { * timeout: 45_000, * failoverThreshold: 2, * consoleOnFailover: true * } * ) * ``` */ export interface ClientOptions { /** * Hive chain id. Defaults to main hive network: * need the new id? * `beeab0de00000000000000000000000000000000000000000000000000000000` * */ chainId?: string; /** * Hive address prefix. Defaults to main network: * `STM` */ addressPrefix?: string; /** * Send timeout, how long to wait in milliseconds before giving * up on a rpc call. Note that this is not an exact timeout, * no in-flight requests will be aborted, they will just not * be retried any more past the timeout. * Can be set to 0 to retry forever. Defaults to 60 * 1000 ms. */ timeout?: number; /** * Specifies the amount of times the urls (RPC nodes) should be * iterated and retried in case of timeout errors. * (important) Requires url parameter to be an array (string[])! * Can be set to 0 to iterate and retry forever. Defaults to 3 rounds. */ failoverThreshold?: number; /** * Whether a console.log should be made when RPC failed over to another one */ consoleOnFailover?: boolean; /** * Retry backoff function, returns milliseconds. Defaults to Pollen's * jittered exponential backoff. */ backoff?: (tries: number) => number; /** * Node.js http(s) agent, use if you want http keep-alive. * Defaults to using https.globalAgent. * @see https://nodejs.org/api/http.html#http_new_agent_options. */ agent?: unknown; /** * Options for the node health tracker. * Controls cooldown periods, stale block thresholds, etc. */ healthTrackerOptions?: HealthTrackerOptions; } /** * High-level Hive RPC client used by every Pollen helper. * * @remarks * `Client` centralizes JSON-RPC transport, node failover, API health tracking, * network identity, and helper construction. It can run in Node.js or a browser * bundle and exposes purpose-built helpers such as {@link DatabaseAPI}, * broadcasting, and {@link Blockchain} so application code rarely needs * to assemble raw RPC payloads. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = new Client('https://api.hive.blog') * const props = await client.database.getDynamicGlobalProperties() * * console.log(`Hive head block: ${props.head_block_number}`) * ``` * * @see {@link ClientOptions} * @see {@link RPCError} */ export declare class Client { /** * Client options, *read-only*. */ readonly options: ClientOptions; /** * Address to Hive RPC server. * String or String[] *read-only* */ address: string | string[]; /** * Database API helper. */ readonly database: DatabaseAPI; /** * RC API helper. */ readonly rc: RCAPI; /** * Broadcast API helper. */ readonly broadcast: BroadcastAPI; /** * Blockchain helper. */ readonly blockchain: Blockchain; /** * Market History API helper. */ readonly market: MarketHistoryAPI; /** * Hivemind helper. */ readonly hivemind: HivemindAPI; /** * Accounts by key API helper. */ readonly keys: AccountByKeyAPI; /** * Transaction status API helper. */ readonly transaction: TransactionStatusAPI; /** * Node health tracker for smart failover. * Tracks per-node, per-API health and head block freshness. */ readonly healthTracker: NodeHealthTracker; /** * Chain ID for current network. */ readonly chainId: Uint8Array; /** * Address prefix for current network. */ readonly addressPrefix: string; private timeout; private backoff; private failoverThreshold; private consoleOnFailover; currentAddress: string; /** * Creates a client for one or more Hive RPC endpoints. * * @param address - RPC endpoint URL or ordered failover list. For example, * `https://api.hive.blog` or `['https://api.hive.blog', 'https://api.openhive.network']`. * @param options - Network identity and resilience settings. * * @remarks * The first endpoint becomes the active node. When calls fail, Pollen uses * the configured backoff and health tracker to move across the endpoint * list without requiring callers to recreate helper objects. * * @throws AssertionError * Thrown when `options.chainId` is not exactly 32 bytes after hex decoding. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = new Client( * ['https://api.hive.blog', 'https://api.deathwing.me'], * { timeout: 30_000, failoverThreshold: 2 } * ) * * const accounts = await client.database.getAccounts(['srbde']) * console.log(accounts[0].balance) * ``` */ constructor(address: string | string[], options?: ClientOptions); /** * Creates a client preconfigured for the public Hive testnet. * * @param options - Optional client settings copied into the testnet * configuration. * @returns A {@link Client} targeting `https://api.fake.openhive.network` * with the testnet chain id. * * @remarks * This helper preserves transport options such as custom HTTP agents while * replacing chain identity values so test transactions cannot be confused * with mainnet signatures. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const testnet = Client.testnet({ timeout: 20_000 }) * const props = await testnet.database.getDynamicGlobalProperties() * console.log(props.head_block_number) * ``` */ static testnet(options?: ClientOptions): Client; /** * Creates a Client instance initialized with healthy nodes fetched dynamically * from nectarflower's on-chain metadata. * * @param options - Additional options for the client. * @param bootstrapNodes - Optional list of bootstrap nodes to fetch metadata from. * Defaults to mainnet public nodes. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = await Client.fromNectarflower() * const props = await client.database.getDynamicGlobalProperties() * console.log(props.head_block_number) * ``` */ static fromNectarflower(options?: ClientOptions, bootstrapNodes?: string | string[]): Promise; /** * Sends a JSON-RPC request through the configured failover transport. * * @param api - API namespace to call, such as `condenser_api`. * @param method - Method within the API namespace, such as * `get_dynamic_global_properties`. * @param params - Positional RPC parameters. Defaults to an empty array. * @returns The decoded `result` member returned by the RPC node. * * @remarks * The transport serializes `Uint8Array` values as Hive-compatible hex strings, applies * jittered retry backoff, tracks API-specific node failures, and passively * records head-block freshness from `get_dynamic_global_properties` * responses. Broadcast calls skip the short per-fetch timeout because they * must not be retried as aggressively as read-only calls. * * @throws RPCError * Thrown when the node returns a JSON-RPC error. The `info` property carries * the original error data when the node provides it. * @throws AssertionError * Thrown when the response id does not match the request id. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = new Client('https://api.hive.blog') * const config = await client.call('condenser_api', 'get_config') * * console.log(config.HIVE_BLOCK_INTERVAL) * ``` * * @see {@link retryingFetch} * @see {@link NodeHealthTracker} */ call(api: string, method: string, params?: unknown): Promise; } export declare enum BlockchainMode { /** * Stream only blocks that the Hive consensus protocol has made irreversible. * * @remarks * This is the safest mode for indexing, accounting, and other workflows that * must not react to a block that can still be replaced by a fork. */ Irreversible = 0, /** * Stream from the latest head block, including blocks that are still reversible. * * @remarks * Use this mode when low latency matters more than finality. Applications * should be prepared to reconcile forked blocks when consuming latest mode. */ Latest = 1 } /** * Controls the block range and finality policy used by blockchain streams. * * @example * ```ts * import { BlockchainMode, Client } from '@srbde/pollen' * * const client = new Client('https://api.hive.blog') * * for await (const block of client.blockchain.getBlocks({ * from: 90_000_000, * to: 90_000_010, * mode: BlockchainMode.Irreversible * })) { * console.log(block.block_id) * } * ``` */ export interface BlockchainStreamOptions { /** * Start block number, inclusive. If omitted generation will start from current block height. */ from?: number; /** * End block number, inclusive. If omitted stream will continue indefinitely. */ to?: number; /** * Streaming mode, if set to `Latest` may include blocks that are not applied to the final chain. * Defaults to `Irreversible`. */ mode?: BlockchainMode; } /** * Convenience helper for reading Hive blocks and operations as async iterators * or native Web Streams. * * @remarks * `Blockchain` builds on {@link DatabaseAPI} and adds polling, block-number * range management, and finality selection. It is the preferred entry point for * indexers and Resilience-style background workers that need a steady feed of * blocks or operations without hand-writing polling loops. * * @example * ```ts * import { Client } from '@srbde/pollen' * * const client = new Client('https://api.hive.blog') * * for await (const op of client.blockchain.getOperations({ from: 90_000_000 })) { * console.log(op.op[0], op.trx_id) * } * ``` * * @see {@link BlockchainStreamOptions} * @see {@link DatabaseAPI.getBlock} */ export declare class Blockchain { readonly client: Client; /** * Creates a blockchain helper bound to a client. * * @param client - Client used for database API reads. */ constructor(client: Client); /** * Resolves the current block number for the selected finality mode. * * @param mode - Whether to read the irreversible block number or the latest * head block number. * @returns The current Hive block number for the selected mode. * * @throws RPCError * Thrown when the underlying `get_dynamic_global_properties` call fails. * * @example * ```ts * const irreversible = await client.blockchain.getCurrentBlockNum() * const latest = await client.blockchain.getCurrentBlockNum(BlockchainMode.Latest) * ``` */ getCurrentBlockNum(mode?: BlockchainMode): Promise; /** * Fetches the current block header for the selected finality mode. * * @param mode - Optional finality mode. Defaults to irreversible blocks. * @returns The Hive block header at the resolved current block number. * * @throws RPCError * Thrown when the RPC node rejects either the properties or block-header call. * * @example * ```ts * const header = await client.blockchain.getCurrentBlockHeader() * console.log(header.timestamp) * ``` */ getCurrentBlockHeader(mode?: BlockchainMode): Promise; /** * Fetches the current block for the selected finality mode. * * @param mode - Optional finality mode. Defaults to irreversible blocks. * @returns The signed block at the resolved current block number. * * @throws RPCError * Thrown when the RPC node rejects either the properties or block call. * * @example * ```ts * const block = await client.blockchain.getCurrentBlock() * console.log(block.transactions.length) * ``` */ getCurrentBlock(mode?: BlockchainMode): Promise; /** * Creates an async iterator that yields block numbers as they become available. * * @param options - Stream options, or a block number shorthand for `from`. * @returns An async iterable of monotonically increasing block numbers. * * @remarks * The iterator polls every three seconds, matching Hive block cadence. When * `to` is omitted it continues indefinitely; when `from` is omitted it starts * from the current block height for the selected mode. * * @throws Error * Thrown when `from` is greater than the current block number. * @throws RPCError * Thrown when polling dynamic global properties fails. * * @example * ```ts * for await (const blockNum of client.blockchain.getBlockNumbers({ * from: 90_000_000, * to: 90_000_005 * })) { * console.log(blockNum) * } * ``` */ getBlockNumbers(options?: BlockchainStreamOptions | number): AsyncGenerator; /** * Creates a native Web ReadableStream of block numbers. * * @param options - Same options accepted by {@link getBlockNumbers}. * @returns A stream backed by the async block-number iterator. * * @example * ```ts * const stream = client.blockchain.getBlockNumberStream(90_000_000) * // Use native Web Stream API or async iteration * for await (const blockNum of stream) { * console.log(blockNum) * } * ``` */ getBlockNumberStream(options?: BlockchainStreamOptions | number): ReadableStream; /** * Creates an async iterator that yields full signed blocks. * * @param options - Same options accepted by {@link getBlockNumbers}. * @returns An async iterable of Hive signed blocks. * * @throws RPCError * Thrown when block-number polling or block retrieval fails. * * @example * ```ts * for await (const block of client.blockchain.getBlocks(90_000_000)) { * console.log(block.witness, block.transactions.length) * } * ``` */ getBlocks(options?: BlockchainStreamOptions | number): AsyncGenerator; /** * Creates a native Web ReadableStream of full signed blocks. * * @param options - Same options accepted by {@link getBlockNumbers}. * @returns A stream backed by the async block iterator. * * @example * ```ts * const stream = client.blockchain.getBlockStream({ from: 90_000_000 }) * for await (const block of stream) { * console.log(block.block_id) * } * ``` */ getBlockStream(options?: BlockchainStreamOptions | number): ReadableStream; /** * Creates an async iterator that yields applied operations from each block. * * @param options - Same options accepted by {@link getBlockNumbers}. * @returns An async iterable of applied operations in chain order. * * @remarks * This is the most direct way to build an operation indexer. Pollen reads each * block's operation list through `get_ops_in_block` and yields individual * applied-operation records so callers can filter by operation type. * * @throws RPCError * Thrown when block-number polling or operation retrieval fails. * * @example * ```ts * for await (const applied of client.blockchain.getOperations({ * from: 90_000_000, * to: 90_000_010 * })) { * if (applied.op[0] === 'transfer') { * console.log(applied.op[1]) * } * } * ``` */ getOperations(options?: BlockchainStreamOptions | number): AsyncGenerator; /** * Creates a native Web ReadableStream of applied operations. * * @param options - Same options accepted by {@link getBlockNumbers}. * @returns A stream backed by the async operation iterator. * * @example * ```ts * const stream = client.blockchain.getOperationsStream({ from: 90_000_000 }) * for await (const applied of stream) { * console.log(applied.op[0]) * } * ``` */ getOperationsStream(options?: BlockchainStreamOptions | number): ReadableStream; } /** * Operation filter bitmask constants for condenser_api.get_account_history. * * Pass the [low, high] pair returned by opFilter() as the 4th and 5th params: * client.call('condenser_api', 'get_account_history', [account, -1, 1000, low, high]) * * All bit positions confirmed empirically against live Hive accounts (2026-06-19). * Entries marked ? are inferred from protocol ordering but not yet live-confirmed. * * BigInt is used throughout to avoid IEEE 754 precision loss. Bits >= 53 cannot * be safely represented as Number — pollen's call() serializes BigInt params * correctly via serializeRpcBody(). */ export declare const OP: { readonly vote: bigint; readonly comment: bigint; readonly transfer: bigint; readonly transfer_to_vesting: bigint; readonly withdraw_vesting: bigint; readonly limit_order_create: bigint; readonly limit_order_cancel: bigint; readonly feed_publish: bigint; readonly convert: bigint; readonly account_create: bigint; readonly account_update: bigint; readonly witness_update: bigint; readonly account_witness_vote: bigint; readonly account_witness_proxy: bigint; readonly custom: bigint; readonly pow: bigint; readonly report_over_production: bigint; readonly delete_comment: bigint; readonly custom_json: bigint; readonly comment_options: bigint; readonly set_withdraw_vesting_route: bigint; readonly limit_order_create2: bigint; readonly claim_account: bigint; readonly create_claimed_account: bigint; readonly request_account_recovery: bigint; readonly recover_account: bigint; readonly change_recovery_account: bigint; readonly escrow_transfer: bigint; readonly escrow_dispute: bigint; readonly escrow_release: bigint; readonly escrow_approve: bigint; readonly transfer_to_savings: bigint; readonly transfer_from_savings: bigint; readonly cancel_transfer_from_savings: bigint; readonly custom_binary: bigint; readonly decline_voting_rights: bigint; readonly reset_account: bigint; readonly set_reset_account: bigint; readonly claim_reward_balance: bigint; readonly delegate_vesting_shares: bigint; readonly account_create_with_delegation: bigint; readonly witness_set_properties: bigint; readonly account_update2: bigint; readonly create_proposal: bigint; readonly update_proposal_votes: bigint; readonly remove_proposal: bigint; readonly update_proposal: bigint; readonly collateralized_convert: bigint; readonly recurrent_transfer: bigint; readonly fill_convert_request: bigint; readonly author_reward: bigint; readonly curation_reward: bigint; readonly comment_reward: bigint; readonly liquidity_reward: bigint; readonly interest: bigint; readonly fill_vesting_withdraw: bigint; readonly fill_order: bigint; readonly shutdown_witness: bigint; readonly fill_transfer_from_savings: bigint; readonly hardfork: bigint; readonly comment_payout_update: bigint; readonly return_vesting_delegation: bigint; readonly comment_benefactor_reward: bigint; readonly producer_reward: bigint; readonly clear_null_account_balance: bigint; readonly proposal_pay: bigint; readonly sps_fund: bigint; readonly hardfork_hive: bigint; readonly hardfork_hive_restore: bigint; readonly delayed_voting: bigint; readonly consolidate_treasury_balance: bigint; readonly effective_comment_vote: bigint; readonly ineffective_delete_comment: bigint; readonly sps_convert: bigint; readonly expired_account_notification: bigint; readonly changed_recovery_account: bigint; readonly transfer_to_vesting_completed: bigint; readonly pow_reward: bigint; readonly vesting_shares_split: bigint; readonly account_created: bigint; readonly fill_collateralized_convert_request: bigint; readonly system_warning: bigint; readonly fill_recurrent_transfer: bigint; readonly failed_recurrent_transfer: bigint; readonly limit_order_cancelled: bigint; readonly producer_missed: bigint; readonly proposal_fee: bigint; readonly collateralized_convert_immediate_conversion: bigint; readonly escrow_approved: bigint; readonly escrow_rejected: bigint; readonly proxy_cleared: bigint; readonly declined_voting_rights: bigint; }; export type OpFilterKey = keyof typeof OP; /** * Combines one or more OP bitmasks into the [low, high] BigInt pair expected * by condenser_api.get_account_history params 4 and 5. * * @example * ```ts * import { OP, opFilter } from '@srbde/pollen' * * const [low, high] = opFilter(OP.fill_order) * const history = await client.call( * 'condenser_api', 'get_account_history', * ['myaccount', -1, 1000, low, high] * ) * ``` */ export declare function opFilter(...ops: bigint[]): [ bigint, bigint ]; /** * Function signature for writing one Hive protocol value to Pollen's native * byte writer. * * @param buffer - Destination binary writer. * @param data - Value to serialize. * * @remarks * Serializers are intentionally composable. Complex operation serializers are * built by combining primitive serializers for numbers, native `bigint`-backed * 64-bit values, strings, assets, public keys, arrays, options, and objects. * * @example * ```ts * const writer = new BinaryWriter() * Types.String(writer, 'pollen') * ``` */ export type Serializer = (buffer: BinaryWriter, data: any) => void; /** * Hive protocol serializer registry. * * @remarks * `Types` is the internal engine behind transaction signing, transaction id * generation, memo envelopes, and witness property encoding. Each member writes * one Hive-compatible value into a {@link BinaryWriter}, which is backed by * `Uint8Array` and `DataView` rather than legacy byte-buffer dependencies. The * object is exported for advanced protocol tooling, but most applications * should use higher-level helpers such as `client.broadcast`. * * @example * ```ts * const writer = new BinaryWriter() * Types.Transaction(writer, transaction) * * const bytes = writer.getBuffer() * ``` * * @throws Error * Individual serializers throw when a value cannot be represented in the * expected Hive wire format, such as a binary field with the wrong byte length * or an operation name with no registered serializer. */ export declare const Types: { Array: (itemSerializer: Serializer) => (buffer: BinaryWriter, data: unknown[]) => void; Asset: (buffer: BinaryWriter, data: Asset | string | number) => void; Authority: (buffer: BinaryWriter, data: any) => void; Binary: (size?: number) => (buffer: BinaryWriter, data: Uint8Array | HexBuffer) => void; Boolean: (buffer: BinaryWriter, data: boolean) => void; Date: (buffer: BinaryWriter, data: string) => void; EncryptedMemo: (buffer: BinaryWriter, data: any) => void; FlatMap: (keySerializer: Serializer, valueSerializer: Serializer) => (buffer: BinaryWriter, data: [ unknown, unknown ][]) => void; Int16: (buffer: BinaryWriter, data: number) => void; Int32: (buffer: BinaryWriter, data: number) => void; Int64: (buffer: BinaryWriter, data: number) => void; Int8: (buffer: BinaryWriter, data: number) => void; Object: (keySerializers: [ string, Serializer ][]) => (buffer: BinaryWriter, data: any) => void; Operation: (buffer: BinaryWriter, operation: Operation) => void; Optional: (valueSerializer: Serializer) => (buffer: BinaryWriter, data: unknown) => void; Price: (buffer: BinaryWriter, data: any) => void; PublicKey: (buffer: BinaryWriter, data: PublicKey | string | null) => void; StaticVariant: (itemSerializers: Serializer[]) => (buffer: BinaryWriter, data: [ number, unknown ]) => void; String: (buffer: BinaryWriter, data: string) => void; Transaction: (buffer: BinaryWriter, data: any) => void; UInt16: (buffer: BinaryWriter, data: number) => void; UInt32: (buffer: BinaryWriter, data: number) => void; UInt64: (buffer: BinaryWriter, data: number) => void; UInt8: (buffer: BinaryWriter, data: number) => void; Void: (_buffer: BinaryWriter) => never; }; /** * Hive encrypted memo helper. * * @remarks * `Memo` exposes the two operations most applications need: encode before * broadcasting a transfer memo and decode after reading a transfer memo from * account history. The helper follows Hive's convention that only memos * beginning with `#` are encrypted. * * @example * ```ts * import { Memo } from '@srbde/pollen' * * const encrypted = Memo.encode(senderMemoKey, recipientMemoPublicKey, '#for your eyes') * const plaintext = Memo.decode(recipientMemoKey, encrypted) * ``` */ export declare const Memo: { decode: (private_key: PrivateKey | string, memo: string) => string; encode: (private_key: PrivateKey | string, public_key: PublicKey | string, memo: string, testNonce?: string) => string; }; /** * @file Native error classes for Pollen. * @license BSD-3-Clause-No-Military-License */ /** * Base error class for all Pollen-specific failures. * * @remarks * Pollen error classes preserve the original contextual payload on `info` so * applications can log RPC details, serialization causes, or protocol metadata * without parsing the message string. * * @example * ```ts * try { * await client.database.getAccounts(['srbde']) * } catch (error) { * if (error instanceof PollenError) { * console.error(error.name, error.info) * } * } * ``` */ export declare class PollenError extends Error { readonly info?: unknown; /** * Creates a Pollen error with optional structured context. * * @param message - Human-readable error message. * @param info - Optional structured details from the failing subsystem. */ constructor(message: string, info?: unknown); } /** * Error thrown when a Hive RPC node returns a JSON-RPC error. * * @remarks * The `info` property contains the original RPC error data when the node * provides it, including assertion stacks from `hived` or plugin-specific * details. Catch this around read and broadcast calls when user-facing recovery * should distinguish network/API failures from local validation. * * @example * ```ts * try { * await client.broadcast.transfer(transfer, activeKey) * } catch (error) { * if (error instanceof RPCError) { * console.error('Hive rejected the transaction', error.info) * } * } * ``` */ export declare class RPCError extends PollenError { /** * Creates an RPC error. * * @param message - Formatted RPC error message. * @param info - Raw RPC error data, when provided by the node. */ constructor(message: string, info?: unknown); } /** * Error thrown when Hive binary serialization or deserialization fails. * * @remarks * Transaction signing, transaction id generation, and memo handling all depend * on exact Hive wire encoding. This error indicates that a payload could not be * represented in the expected binary format. * * @example * ```ts * try { * const signed = cryptoUtils.signTransaction(transaction, activeKey) * } catch (error) { * if (error instanceof SerializationError) { * console.error('Invalid transaction shape', error.info) * } * } * ``` */ export declare class SerializationError extends PollenError { /** * Creates a serialization error. * * @param message - Human-readable serialization failure. * @param info - Optional underlying cause or field-level context. */ constructor(message: string, info?: unknown); } declare const _default: "1.0.5"; declare namespace utils { export { BinaryReader, BinaryWriter, RetryContext, WitnessProps, assert$1 as assert, buildWitnessUpdateOp, bytesEqual, concat, copy, exponentialBackoffWithJitter, fromHex, iteratorStream, makeBitMaskFilter, operationOrders, retryingFetch, sleep, toHex }; } export { Comment$1 as Comment, _default as VERSION, utils, }; export {};