address

package
v0.0.0-...-e64d2f0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Address

type Address struct {
	Network NetworkType
	Version AddressType
	Payload []byte
}

Address is a generic representation of a Bitcoin Cash address for converting to various string representations.

func NewFromCashAddress

func NewFromCashAddress(addr *cashaddress.Address) (*Address, error)

NewFromCashAddress takes a cashaddress.Address and returns a generic `Address` struct.

func NewFromLegacy

func NewFromLegacy(addr *legacy.Address) (*Address, error)

NewFromLegacy takes a cashaddress.Address and returns a generic `Address` struct.

func NewFromString

func NewFromString(addr string) (*Address, error)

NewFromString takes a address string in Legacy or CashAddress format and returns an `*Address` or an error.

func (*Address) CashAddress

func (addr *Address) CashAddress() (*cashaddress.Address, error)

CashAddress converts various address fields to create a `*cashaddress.Address`

func (*Address) Copay

func (addr *Address) Copay() (*legacy.Address, error)

Copay returns a legacy address struct with the appropriate fields set to encode to the correct copay address version

func (*Address) Hex

func (addr *Address) Hex() string

Hex returns a string representation of the Address payload in hexadecimal.

func (*Address) Legacy

func (addr *Address) Legacy() (*legacy.Address, error)

Legacy returns a legacy address struct with the appropriate fields set to encode to the correct legacy address version

func (*Address) Verify

func (r *Address) Verify() error

Verify checks to make sure the network and address type are valid.

type AddressType

type AddressType byte
const (
	P2KH AddressType = 0
	P2SH AddressType = 1
)

type NetworkType

type NetworkType string
const (
	RegTest NetworkType = "bchreg"
	TestNet NetworkType = "bchtest"
	MainNet NetworkType = "bitcoincash"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL