tx

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidSigner = errors.New("invalid signer address")

ErrInvalidSigner is returned when the signer address is not valid.

Functions

This section is empty.

Types

type BasicCheckError added in v0.15.0

type BasicCheckError struct {
	Reason string
}

BasicCheckError is returned when the basic check on the transaction fails.

func (BasicCheckError) Error added in v0.15.0

func (e BasicCheckError) Error() string

type ID

type ID = hash.Hash

type InvalidPayloadTypeError added in v0.15.0

type InvalidPayloadTypeError struct {
	PayloadType payload.Type
}

InvalidPayloadTypeError is returned when the payload type is not valid.

func (InvalidPayloadTypeError) Error added in v0.15.0

func (e InvalidPayloadTypeError) Error() string

type Tx

type Tx struct {
	// contains filtered or unexported fields
}

func FromBytes

func FromBytes(bs []byte) (*Tx, error)

FromBytes constructs a new transaction from byte array.

func NewBondTx

func NewBondTx(lockTime uint32,
	sender, receiver crypto.Address,
	pubKey *bls.PublicKey,
	stake, fee amount.Amount, opts ...TxOption,
) *Tx

func NewSortitionTx

func NewSortitionTx(lockTime uint32,
	addr crypto.Address,
	proof sortition.Proof,
) *Tx

func NewSubsidyTx

func NewSubsidyTx(lockTime uint32,
	receiver crypto.Address, amt amount.Amount, opts ...TxOption,
) *Tx

func NewTransferTx added in v0.11.0

func NewTransferTx(lockTime uint32,
	sender, receiver crypto.Address,
	amt, fee amount.Amount, opts ...TxOption,
) *Tx

func NewUnbondTx

func NewUnbondTx(lockTime uint32,
	val crypto.Address,
	opts ...TxOption,
) *Tx

func NewWithdrawTx

func NewWithdrawTx(lockTime uint32,
	val, acc crypto.Address,
	amt, fee amount.Amount,
	opts ...TxOption,
) *Tx

func (*Tx) BasicCheck added in v0.15.0

func (tx *Tx) BasicCheck() error

func (*Tx) Bytes

func (tx *Tx) Bytes() ([]byte, error)

Bytes returns the serialized bytes for the Transaction.

func (*Tx) Decode

func (tx *Tx) Decode(r io.Reader) error

func (*Tx) Encode

func (tx *Tx) Encode(w io.Writer) error

func (*Tx) Fee

func (tx *Tx) Fee() amount.Amount

func (*Tx) ID

func (tx *Tx) ID() ID

func (*Tx) IsBondTx

func (tx *Tx) IsBondTx() bool

func (*Tx) IsFreeTx

func (tx *Tx) IsFreeTx() bool

IsFreeTx checks if the transaction fee should be set to zero.

func (*Tx) IsPublicKeyStriped added in v0.15.0

func (tx *Tx) IsPublicKeyStriped() bool

IsPublicKeyStriped returns true if the public key stripped from the transaction.

func (*Tx) IsSigned added in v1.0.0

func (tx *Tx) IsSigned() bool

IsSigned returns true if the transaction has been signed and includes the signature.

func (*Tx) IsSortitionTx

func (tx *Tx) IsSortitionTx() bool

func (*Tx) IsSubsidyTx

func (tx *Tx) IsSubsidyTx() bool

func (*Tx) IsTransferTx added in v0.13.0

func (tx *Tx) IsTransferTx() bool

func (*Tx) IsUnbondTx

func (tx *Tx) IsUnbondTx() bool

func (*Tx) IsWithdrawTx

func (tx *Tx) IsWithdrawTx() bool

func (*Tx) LockTime

func (tx *Tx) LockTime() uint32

func (*Tx) MarshalCBOR

func (tx *Tx) MarshalCBOR() ([]byte, error)

func (*Tx) Memo

func (tx *Tx) Memo() string

func (*Tx) Payload

func (tx *Tx) Payload() payload.Payload

func (*Tx) PublicKey

func (tx *Tx) PublicKey() crypto.PublicKey

func (*Tx) SerializeSize

func (tx *Tx) SerializeSize() int

SerializeSize returns the number of bytes it would take to serialize the transaction.

func (*Tx) SetPublicKey

func (tx *Tx) SetPublicKey(pub crypto.PublicKey)

func (*Tx) SetSignature

func (tx *Tx) SetSignature(sig crypto.Signature)

func (*Tx) SignBytes

func (tx *Tx) SignBytes() []byte

func (*Tx) Signature

func (tx *Tx) Signature() crypto.Signature

func (*Tx) String added in v0.15.0

func (tx *Tx) String() string

func (*Tx) StripPublicKey added in v0.15.0

func (tx *Tx) StripPublicKey()

StripPublicKey removes the public key from the transaction. It is an alias function for `SetPublicKey(nil)`.

func (*Tx) UnmarshalCBOR

func (tx *Tx) UnmarshalCBOR(bs []byte) error

func (*Tx) Version

func (tx *Tx) Version() uint8

type TxOption added in v1.5.0

type TxOption func(*txData)

func WithMemo added in v1.5.0

func WithMemo(memo string) TxOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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