tx

package
v1.11.10 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const CodecVersion = 0

Variables

Functions

This section is empty.

Types

type Export

type Export struct {
	// ChainID provides cross chain replay protection
	ChainID ids.ID `serialize:"true" json:"chainID"`
	// Nonce provides internal chain replay protection
	Nonce       uint64      `serialize:"true" json:"nonce"`
	MaxFee      uint64      `serialize:"true" json:"maxFee"`
	PeerChainID ids.ID      `serialize:"true" json:"peerChainID"`
	IsReturn    bool        `serialize:"true" json:"isReturn"`
	Amount      uint64      `serialize:"true" json:"amount"`
	To          ids.ShortID `serialize:"true" json:"to"`
}

func (*Export) Visit

func (e *Export) Visit(v Visitor) error

type Import

type Import struct {
	// Nonce provides internal chain replay protection
	Nonce  uint64 `serialize:"true" json:"nonce"`
	MaxFee uint64 `serialize:"true" json:"maxFee"`
	// Message includes the chainIDs to provide cross chain replay protection
	Message []byte `serialize:"true" json:"message"`
}

func (*Import) Visit

func (i *Import) Visit(v Visitor) error

type Payload

type Payload struct {
	// Sender + Nonce provides replay protection
	Sender   ids.ShortID `serialize:"true" json:"sender"`
	Nonce    uint64      `serialize:"true" json:"nonce"`
	IsReturn bool        `serialize:"true" json:"isReturn"`
	Amount   uint64      `serialize:"true" json:"amount"`
	To       ids.ShortID `serialize:"true" json:"to"`
	// contains filtered or unexported fields
}

func NewPayload

func NewPayload(
	sender ids.ShortID,
	nonce uint64,
	isReturn bool,
	amount uint64,
	to ids.ShortID,
) (*Payload, error)

func ParsePayload

func ParsePayload(bytes []byte) (*Payload, error)

func (*Payload) Bytes

func (p *Payload) Bytes() []byte

type Transfer

type Transfer struct {
	// ChainID provides cross chain replay protection
	ChainID ids.ID `serialize:"true" json:"chainID"`
	// Nonce provides internal chain replay protection
	Nonce   uint64      `serialize:"true" json:"nonce"`
	MaxFee  uint64      `serialize:"true" json:"maxFee"`
	AssetID ids.ID      `serialize:"true" json:"assetID"`
	Amount  uint64      `serialize:"true" json:"amount"`
	To      ids.ShortID `serialize:"true" json:"to"`
}

func (*Transfer) Visit

func (t *Transfer) Visit(v Visitor) error

type Tx

type Tx struct {
	Unsigned  `serialize:"true" json:"unsigned"`
	Signature [secp256k1.SignatureLen]byte `serialize:"true" json:"signature"`
}

func Parse

func Parse(bytes []byte) (*Tx, error)

func Sign

func Sign(utx Unsigned, key *secp256k1.PrivateKey) (*Tx, error)

func (*Tx) ID

func (tx *Tx) ID() (ids.ID, error)

func (*Tx) SenderID

func (tx *Tx) SenderID() (ids.ShortID, error)

type Unsigned

type Unsigned interface {
	Visit(Visitor) error
}

type Visitor

type Visitor interface {
	Transfer(*Transfer) error
	Export(*Export) error
	Import(*Import) error
}

Jump to

Keyboard shortcuts

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