transaction

package
v0.0.0-...-8aa4d74 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2019 License: GPL-3.0 Imports: 11 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

Functions

func CheckBaseFee

func CheckBaseFee(c common.Checker, args ...interface{}) (err error)

func CheckOperationTypes

func CheckOperationTypes(c common.Checker, args ...interface{}) (err error)

func CheckOperations

func CheckOperations(c common.Checker, args ...interface{}) (err error)

func CheckOverOperationsLimit

func CheckOverOperationsLimit(c common.Checker, args ...interface{}) (err error)

func CheckSource

func CheckSource(c common.Checker, args ...interface{}) (err error)

func CheckVerifySignature

func CheckVerifySignature(c common.Checker, args ...interface{}) (err error)

Types

type Body

type Body struct {
	Source     string                `json:"source"`
	Fee        common.Amount         `json:"fee"`
	SequenceID uint64                `json:"sequence_id"`
	Operations []operation.Operation `json:"operations"`
}

func (Body) MakeHash

func (tb Body) MakeHash() []byte

func (Body) MakeHashString

func (tb Body) MakeHashString() string

type Checker

type Checker struct {
	common.DefaultChecker

	NetworkID   []byte
	Transaction Transaction
	Conf        common.Config
}
type Header struct {
	Version string `json:"version"`
	Created string `json:"created"`
	// Hash of this transaction
	// This is cached and not serialized when sent, because the remote node
	// has to validate it anyway.
	Hash      string `json:"-"`
	Signature string `json:"signature"`
}

type Pool

type Pool struct {
	sync.RWMutex

	Pool map[string]Transaction
	// contains filtered or unexported fields
}

func NewPool

func NewPool(cfg common.Config) *Pool

func (*Pool) Add

func (tp *Pool) Add(tx Transaction) error

func (*Pool) AddFromClient

func (tp *Pool) AddFromClient(tx Transaction) error

func (*Pool) AddFromNode

func (tp *Pool) AddFromNode(tx Transaction) error

func (*Pool) AvailableTransactions

func (tp *Pool) AvailableTransactions(transactionLimit int) []string

func (*Pool) Get

func (tp *Pool) Get(hash string) (Transaction, bool)

func (*Pool) GetFromSource

func (tp *Pool) GetFromSource(source string) (Transaction, bool)

func (*Pool) Has

func (tp *Pool) Has(hash string) bool

func (*Pool) IsSameSource

func (tp *Pool) IsSameSource(source string) (found bool)

func (*Pool) Len

func (tp *Pool) Len() int

func (*Pool) Remove

func (tp *Pool) Remove(hashes ...string)

func (*Pool) RemoveFromSources

func (tp *Pool) RemoveFromSources(sources ...string)

type Transaction

type Transaction struct {
	H Header
	B Body
}

func MakeTransactionCreateAccount

func MakeTransactionCreateAccount(networkID []byte, kpSource *keypair.Full, target string, amount common.Amount) (tx Transaction)

func MakeTransactionPayment

func MakeTransactionPayment(networkID []byte, kpSource *keypair.Full, target string, amount common.Amount) (tx Transaction)

func NewTransaction

func NewTransaction(source string, sequenceID uint64, ops ...operation.Operation) (tx Transaction, err error)

func TestMakeTransaction

func TestMakeTransaction(networkID []byte, n int) (kp *keypair.Full, tx Transaction)

func TestMakeTransactionWithKeypair

func TestMakeTransactionWithKeypair(networkID []byte, n int, srcKp *keypair.Full, targetKps ...*keypair.Full) (tx Transaction)

func (Transaction) Equal

func (tx Transaction) Equal(m common.Message) bool

func (Transaction) GetHash

func (tx Transaction) GetHash() string

func (Transaction) GetType

func (tx Transaction) GetType() common.MessageType

func (Transaction) IsEmpty

func (tx Transaction) IsEmpty() bool

func (Transaction) IsValidSequenceID

func (tx Transaction) IsValidSequenceID(sequenceID uint64) bool

func (Transaction) IsValidVersion

func (tx Transaction) IsValidVersion(version string) bool

func (Transaction) IsWellFormed

func (tx Transaction) IsWellFormed(conf common.Config) (err error)

func (Transaction) Serialize

func (tx Transaction) Serialize() (encoded []byte, err error)

func (*Transaction) Sign

func (tx *Transaction) Sign(kp keypair.KP, networkID []byte)

func (Transaction) Source

func (tx Transaction) Source() string

func (Transaction) String

func (tx Transaction) String() string

func (Transaction) TotalAmount

func (tx Transaction) TotalAmount(withFee bool) common.Amount

TotalAmount returns the sum of Amount of operations.

Returns:

the total monetary value of this transaction,
which is the sum of its operations,
optionally with fees

Params:

withFee = If fee should be included in the total

func (Transaction) TotalBaseFee

func (tx Transaction) TotalBaseFee() common.Amount

TotalBaseFee returns the minimum fee of transaction.

func (*Transaction) UnmarshalJSON

func (t *Transaction) UnmarshalJSON(b []byte) (err error)

func (Transaction) Version

func (tx Transaction) Version() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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