Documentation ¶
Index ¶
- Constants
- func ComputeHrp(address_type uint8, network uint8) string
- type Address
- func (addr Address) Bytes() []byte
- func (addr *Address) Debug() string
- func (addr *Address) Equal(other *Address) bool
- func (addr *Address) MarshalCBOR() ([]byte, error)
- func (addr Address) String() string
- func (addr *Address) ToCbor() (string, error)
- func (addr *Address) UnmarshalCBOR(value []byte) error
Constants ¶
View Source
const ( BYRON = 0b1000 KEY_KEY = 0b0000 SCRIPT_KEY = 0b0001 KEY_SCRIPT = 0b0010 SCRIPT_SCRIPT = 0b0011 KEY_POINTER = 0b0100 SCRIPT_POINTER = 0b0101 KEY_NONE = 0b0110 SCRIPT_NONE = 0b0111 NONE_KEY = 0b1110 NONE_SCRIPT = 0b1111 )
View Source
const ( MAINNET = 1 TESTNET = 0 )
Variables ¶
This section is empty.
Functions ¶
func ComputeHrp ¶
*
ComputeHrp computes the human-readable part (Hrp) for an address based on its address type and network. Params: address_type (uint8): The type of the address. network (uint8): The network identifier (1 for mainnet, 0 for testnet). Returns: string: The computed Hrp for address encoding.
Types ¶
type Address ¶
type Address struct { PaymentPart []byte StakingPart []byte Network byte AddressType byte HeaderByte byte Hrp string }
func DecodeAddress ¶
*
This function decodes a string representation of an address into its corresponding Address structure. Parameters: value (string): The string representation of the address to decode. Returns: Address: The decoded Address structure. error: An error, if any, encountered during the decoding process.
func WalletAddressFromBytes ¶ added in v1.0.5
func (Address) Bytes ¶
*
This function returns the binary representation of the address. It constructs and returns the binary representation of teh address containing the header byte, payment part, and staking part (if present). Returns: []byte: A byte slice representing the binary data of the address.
func (*Address) Debug ¶
*
Debug method returns a formatted string representation of the address for debugging Returns: string: A formatted debug string representing the address.
func (*Address) MarshalCBOR ¶
*
MarshalCBOR encodes an address to its CBOR (Concise Binary Object Representation) format. Returns: []byte: A slice of bytes representing the address in CBOR format. error: An error, if any, encountered during the encoding process.
func (Address) String ¶
*
This function returns the string representation of the address. Returns: string: A string representing the address in Bech32 format.
func (*Address) ToCbor ¶
*
It converts an address to its CBOR (Concise Binary Object Representation) format and returns it as a hexadecimal string. This function marshals the address into its binary representation using the CBOR encoding. In case of success, it returns the binary data encoded as a hexadecimal string, otherwise a fatal error is logged. Returns: string: A hexadecimal string representation of the address in CBOR format. error: An error if the convertion fails.
func (*Address) UnmarshalCBOR ¶
*
UnmarshalCBOR decodes a CBOR (Concise Binary Object Representation) encoded address from a byte slice. Params: value ([]byte): A byte slice containing the CBOR-encoded address. Returns: error: An error, if any, encountered during the decoding process.
Click to show internal directories.
Click to hide internal directories.