Helios API/ API Reference/ Classes/
Address
Wrapper for Cardano address bytes. An Address
consists of three parts internally:
- Header (1 byte, see CIP 19)
- Witness hash (28 bytes that represent the
PubKeyHash
orValidatorHash
) - Optional staking credential (0 or 28 bytes)
Hierarchy
-
↳
Address
Index
Constructors
constructor
• new Address(bytesOrBech32String
)
Parameters
Name | Type |
---|---|
bytesOrBech32String | string | number [] |
Overrides
Accessors
bytes
• get
bytes(): number
[]
Returns
number
[]
hex
• get
hex(): string
Converts a Address
into its hexadecimal representation.
Returns
string
pubKeyHash
• get
pubKeyHash(): null
| PubKeyHash
Returns the underlying PubKeyHash
of a simple payment address, or null
for a script address.
Returns
null
| PubKeyHash
stakingHash
• get
stakingHash(): null
| PubKeyHash
| StakingValidatorHash
Returns the underlying PubKeyHash
or StakingValidatorHash
, or null
for non-staked addresses.
Returns
null
| PubKeyHash
| StakingValidatorHash
validatorHash
• get
validatorHash(): null
| ValidatorHash
Returns the underlying ValidatorHash
of a script address, or null
for a regular payment address.
Returns
null
| ValidatorHash
Methods
dump
▸ dump(): any
Returns
any
eq
▸ eq(other
): boolean
Parameters
Name | Type |
---|---|
other | Address |
Returns
boolean
toBech32
▸ toBech32(): string
Converts an Address
into its Bech32 representation.
Returns
string
toCbor
▸ toCbor(): number
[]
Returns
number
[]
Inherited from
toCborHex
▸ toCborHex(): string
Returns
string
Inherited from
toHex
▸ toHex(): string
Converts a Address
into its hexadecimal representation.
Returns
string
toSchemaJson
▸ toSchemaJson(): string
Returns
string
Inherited from
dummy
▸ Static
dummy(): Address
Returns a dummy address (based on a PubKeyHash with all null bytes)
Returns
fromBech32
▸ Static
fromBech32(str
): Address
Converts a Bech32 string into an Address
.
Parameters
Name | Type |
---|---|
str | string |
Returns
fromCbor
▸ Static
fromCbor(bytes
): Address
Deserializes bytes into an Address
.
Parameters
Name | Type |
---|---|
bytes | number [] |
Returns
fromHash
▸ Static
fromHash(hash
, isTestnet?
): Address
Constructs an Address using either a PubKeyHash
(i.e. simple payment address)
or ValidatorHash
(i.e. script address),
without a staking hash.
Parameters
Name | Type | Description |
---|---|---|
hash | PubKeyHash | ValidatorHash | |
isTestnet? | boolean | Defaults to config.IS_TESTNET |
Returns
fromHashes
▸ Static
fromHashes(hash
, stakingHash?
, isTestnet?
): Address
Constructs an Address using either a PubKeyHash
(i.e. simple payment address)
or ValidatorHash
(i.e. script address),
in combination with an optional staking hash (PubKeyHash
or StakingValidatorHash
).
Parameters
Name | Type | Description |
---|---|---|
hash | PubKeyHash | ValidatorHash | |
stakingHash? | null | PubKeyHash | StakingValidatorHash | |
isTestnet? | boolean | Defaults to config.IS_TESTNET |
Returns
fromHex
▸ Static
fromHex(hex
): Address
Constructs an Address
using a hexadecimal string representation of the address bytes.
Doesn't check validity.
Parameters
Name | Type |
---|---|
hex | string |
Returns
fromProps
▸ Static
fromProps(props
): Address
Parameters
Name | Type |
---|---|
props | Address | AddressProps |
Returns
fromUplcData
▸ Static
fromUplcData(data
, isTestnet?
): Address
Parameters
Name | Type |
---|---|
data | UplcData |
isTestnet? | boolean |
Returns
isForTestnet
▸ Static
isForTestnet(address
): boolean
Returns true
if the given Address
is a testnet address.
Parameters
Name | Type |
---|---|
address | Address |
Returns
boolean