BtcAddressRepr
A parsed Bitcoin address: a PoXAddressVersion and the hash or witness program bytes. It carries no network. BtcAddress.parse and parseSignerCalldata return it, and BtcAddress.stringify and buildSignerCalldata accept it.
Usage
import { BtcAddress } from '@stacks/bitcoin-staking';
const repr = BtcAddress.parse('bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4');
// { version: PoXAddressVersion.P2WPKH, data: Uint8Array(20) } (hash 751e76e8199196d454941c45d1b3a323f1433bd6)
BtcAddress.stringify(repr, 'testnet'); // 'tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx'Definition
export interface BtcAddressRepr {
/** PoX address version byte. */
version: PoXAddressVersion;
/** Hash / witness-program bytes. */
data: Uint8Array;
}Properties
Property
Type
Description
version
Address type. Encoded as the one-byte version of a { version, hashbytes } tuple
data
Uint8Array
Hash or witness program: 20 bytes for versions 0x00 to 0x04, 32 bytes for 0x05 and 0x06. Encoded as hashbytes
Was this helpful?