api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Output

type Output struct {
	Reference *StateReference
	ID        string // Unique Identifier of this Output
	Raw       []byte // Raw representation of the state
	Birth     Script // Birth script descriptor
	Death     Script // Death script descriptor
}

func (*Output) Equals

func (o1 *Output) Equals(o2 *Output) bool

type Script

type Script struct {
	Type string // Unique identifier of this script
	Raw  []byte // Payload of the script. The content depends on the script's type.
}

Script models a UTXO script

func (*Script) Equal

func (s *Script) Equal(s2 *Script) bool

type Scripts

type Scripts struct {
	Birth *Script
	Death *Script
}

type StateReference

type StateReference struct {
	TxID  string // Transaction ID
	Index uint64 // Output’s index in the transaction
}

StateReference models the index of an output

func (StateReference) String

func (s StateReference) String() string

type StateValidator

type StateValidator interface {
	Validate(tx Transaction, index uint32) error
}

type Transaction

type Transaction interface {
	// ID returns the transaction's id
	ID() string

	// Inputs returns the inputs referenced by this transaction
	Inputs() []*StateReference

	// Outputs returns the outputs defined by this transaction
	Outputs() []*Output

	// NumInputs returns the number of inputs in this transaction
	NumInputs() int

	// NumOutputs returns the number of inputs in this transaction
	NumOutputs() int

	// GetInputAt retrieves the state referenced by the index-th input. In addition, it returns
	// the worldstate reference to that state and the associated birth and death scripts
	GetInputAt(index int, state interface{}) (*StateReference, *Scripts, error)

	// GetInputScriptsAt returns the birth and death scripts associated to worldstate
	// referenced by the index-th input
	GetInputScriptsAt(index int) (*Scripts, error)

	// GetOutputAt retrieves the state referenced by the index-th output. In addition, it returns
	// the associated birth and death scripts
	GetOutputAt(index int, state interface{}) (*Scripts, error)

	// GetOutputScriptsAt returns the birth and death scripts associated to transaction's output
	// referenced by the index-th input
	GetOutputScriptsAt(index int) (*Scripts, error)

	// HasBeenSignedBy returns nil if all the passed parties have endorsed this transaction
	HasBeenSignedBy(parties ...view.Identity) error

	// NumSignatures returns the number of signatures carried by this transaction
	NumSignatures() int
}

Transaction provides a UTXO transaction abstraction

Jump to

Keyboard shortcuts

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