fat0

package
v0.0.0-...-d06cbcf Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2020 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

Package fat0 provides data types corresponding to valid FAT-0 entries for Transaction and Issuance as well as methods for validating the structure and content of the factom entry.

Index

Constants

View Source
const Type = fat.TypeFAT0

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressAmountMap

type AddressAmountMap map[factom.FAAddress]uint64

AddressAmountMap relates a factom.FAAddress to its amount for the Inputs and Outputs of a Transaction.

func (AddressAmountMap) MarshalJSON

func (m AddressAmountMap) MarshalJSON() ([]byte, error)

MarshalJSON marshals a list of addresses and amounts used in the inputs or outputs of a transaction. Addresses with a 0 amount are omitted.

func (AddressAmountMap) Sum

func (m AddressAmountMap) Sum() uint64

Sum returns the sum of all amount values.

func (*AddressAmountMap) UnmarshalJSON

func (m *AddressAmountMap) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals a list of addresses and amounts used in the inputs or outputs of a transaction. Duplicate addresses or addresses with a 0 amount cause an error.

type Transaction

type Transaction struct {
	Inputs  AddressAmountMap `json:"inputs"`
	Outputs AddressAmountMap `json:"outputs"`

	Metadata json.RawMessage `json:"metadata,omitempty"`

	Entry factom.Entry `json:"-"`
}

Transaction represents a fat0 transaction, which can be a normal account transaction or a coinbase transaction depending on the Inputs and the RCD/signature pair.

func NewTransaction

func NewTransaction(e factom.Entry, idKey *factom.Bytes32) (Transaction, error)

func (Transaction) IsCoinbase

func (t Transaction) IsCoinbase() bool

func (Transaction) Sign

func (t Transaction) Sign(signingSet ...factom.RCDSigner) (factom.Entry, error)

func (Transaction) String

func (t Transaction) String() string

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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