Helios API/ API Reference/ Classes/

StakeAddress

Wrapper for Cardano stake address bytes. An StakeAddress consists of two parts internally:

  • Header (1 byte, see CIP 8)
  • Staking witness hash (28 bytes that represent the PubKeyHash or StakingValidatorHash)

Stake addresses are used to query the assets held by given staking credentials.

Index

Constructors

constructor

new StakeAddress(bytes)

Parameters

NameType
bytesnumber[]

Accessors

bytes

get bytes(): number[]

Returns

number[]

hex

get hex(): string

Converts a StakeAddress into its hexadecimal representation.

Returns

string

stakingHash

get stakingHash(): PubKeyHash | StakingValidatorHash

Returns the underlying PubKeyHash or StakingValidatorHash.

Returns

PubKeyHash | StakingValidatorHash

Methods

toBech32

toBech32(): string

Converts a StakeAddress into its Bech32 representation.

Returns

string

toCbor

toCbor(): number[]

Converts a StakeAddress into its CBOR representation.

Returns

number[]

toHex

toHex(): string

Converts a StakeAddress into its hexadecimal representation.

Returns

string

fromAddress

Static fromAddress(addr): StakeAddress

Convert a regular Address into a StakeAddress. Throws an error if the Address doesn't have a staking credential.

Parameters

NameType
addrAddress

Returns

StakeAddress

fromBech32

Static fromBech32(str): StakeAddress

Parameters

NameType
strstring

Returns

StakeAddress

fromCbor

Static fromCbor(bytes): StakeAddress

Parameters

NameType
bytesnumber[]

Returns

StakeAddress

fromHash

Static fromHash(isTestnet, hash): StakeAddress

Converts a PubKeyHash or StakingValidatorHash into StakeAddress.

Parameters

NameType
isTestnetboolean
hashPubKeyHash | StakingValidatorHash

Returns

StakeAddress

fromHex

Static fromHex(hex): StakeAddress

Doesn't check validity

Parameters

NameType
hexstring

Returns

StakeAddress

isForTestnet

Static isForTestnet(sa): boolean

Returns true if the given StakeAddress is a testnet address.

Parameters

NameType
saStakeAddress

Returns

boolean