Skip to main content
The IWaxBaseInterface provides methods for offline blockchain operations including transaction creation, asset handling, key management, and cryptographic operations.

Properties

ASSETS

Readonly record of asset definitions for HIVE, HBD, and VESTS.

formatter

Access to the WAX formatter for custom formatting operations.

waxify

Shorthand access to the waxify template literal formatter.

chainId

The chain ID configured for this instance.

addressPrefix

The public key address prefix for this chain (e.g., “STM” for mainnet).

config

Protocol configuration for the current chain.

Transaction methods

createTransactionWithTaPoS

Constructs a new transaction object with TaPoS (Transaction as Proof of Stake) data.
TBlockHash
required
Reference block ID (can be head block ID) for TaPoS. This is a 20-byte string or hex string.
TTimestamp
Expiration time for the transaction. Can be:
  • Date object
  • Unix timestamp in milliseconds (number)
  • ISO 8601 date string
  • Relative time: "+10s", "+30m", "+1h"
Maximum expiration time on mainnet is 1 hour. Defaults to "+1m".
ITransaction
Transaction interface ready to receive operations

Usage example

createTransactionFromProto

Constructs a transaction from a protobuf transaction object.

createTransactionFromJson

Converts a Hive API-form transaction (HF26 format) to a transaction object.

createTransactionFromLegacyJson

Converts a legacy Hive API-form transaction to a transaction object.

convertTransactionToBinaryForm

Converts a transaction to HF26 binary form.

convertTransactionFromBinaryForm

Converts a transaction from HF26 binary form to Hive API-form JSON.

Asset methods

hiveCoins

Retrieves HIVE in NAI form with given amount (using decimal precision).
number
required
Amount of HIVE as a decimal number. Accepts JS Double-precision floating-point format (IEEE 754), which does not support numbers greater than 2^53 - 1.

Usage example

hiveSatoshis

Retrieves HIVE in NAI form with given amount (using integer satoshis).
TNaiAssetConvertible
required
Amount of HIVE in satoshis (integer). Can be number, string, or BigInt.

Usage example

hbdCoins

Retrieves HBD in NAI form with given amount (using decimal precision).

hbdSatoshis

Retrieves HBD in NAI form with given amount (using integer satoshis).

vestsCoins

Retrieves VESTS in NAI form with given amount (using decimal precision).

vestsSatoshis

Retrieves VESTS in NAI form with given amount (using integer satoshis).

getAsset

Retrieves asset amount and symbol from NAI data.

Usage example

Asset conversion methods

vestsToHp

Converts VESTS to Hive Power (HP).

hpToVests

Converts Hive Power to VESTS.

hbdToHive

Converts HBD to HIVE using price feed.

hiveToHbd

Converts HIVE to HBD using price feed.

Calculation methods

calculateCurrentManabarValue

Calculates current manabar value for a Hive account.
IManabarData

calculateManabarFullRegenerationTime

Calculates full regeneration time for a manabar.
number
Full regeneration timestamp in seconds

calculateAccountHp

Calculates account Hive Power.

calculateWitnessVotesHp

Calculates witness votes in Hive Power.

calculateHpApr

Calculates current HP APR.
number
HP APR percent with 2 decimals

estimateHbdInterest

Estimates HBD interest value.

estimateHiveCollateral

Estimates HIVE collateral for HBD.

Cryptographic methods

suggestBrainKey

Generates a secure brain key with corresponding private and public keys.
IBrainKeyData

getPrivateKeyFromPassword

Derives a private key for a given role from a master password.
string
required
Account name
string
required
Key role: “active”, “owner”, “posting”, or “memo”
string
required
Master password

calculatePublicKey

Calculates the public key from a private key.

convertRawPrivateKeyToWif

Converts a raw private key (32 bytes hex) to WIF format.

convertRawPublicKeyToWif

Converts a raw public key (33 or 65 bytes hex) to WIF format.

getPublicKeyFromSignature

Retrieves the public key used to create a signature.

Validation methods

isValidAccountName

Checks if an account name is valid.
Account names must:
  • Comply with RFC 1035 grammar
  • Use only lowercase letters
  • Be between 3 and 16 characters (inclusive)

operationGetImpactedAccounts

Retrieves account names impacted by an operation.

operationBinaryViewMetadata

Retrieves binary view metadata for an operation.

Utility methods

extendConfig

Extends the current instance with custom options, creating a copy.

getVersion

Retrieves the bundled package version string.

delete

Deletes the created WAX proto_protocol instance.

TypeScript types

See also