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
orStakingValidatorHash
)
Stake addresses are used to query the assets held by given staking credentials.
Index
Constructors
constructor
• new StakeAddress(bytes
)
Parameters
Name | Type |
---|---|
bytes | number [] |
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
Name | Type |
---|---|
addr | Address |
Returns
fromBech32
▸ Static
fromBech32(str
): StakeAddress
Parameters
Name | Type |
---|---|
str | string |
Returns
fromCbor
▸ Static
fromCbor(bytes
): StakeAddress
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
fromHash
▸ Static
fromHash(isTestnet
, hash
): StakeAddress
Converts a PubKeyHash
or StakingValidatorHash
into StakeAddress
.
Parameters
Name | Type |
---|---|
isTestnet | boolean |
hash | PubKeyHash | StakingValidatorHash |
Returns
fromHex
▸ Static
fromHex(hex
): StakeAddress
Doesn't check validity
Parameters
Name | Type |
---|---|
hex | string |
Returns
isForTestnet
▸ Static
isForTestnet(sa
): boolean
Returns true
if the given StakeAddress
is a testnet address.
Parameters
Name | Type |
---|---|
sa | StakeAddress |
Returns
boolean