sebak: boscoin.io/sebak/lib/transaction Index | Files | Directories

package transaction

import "boscoin.io/sebak/lib/transaction"

Index

Package Files

checker.go pool.go test.go transaction.go

Variables

var TransactionWellFormedCheckerFuncs = []common.CheckerFunc{
    CheckOverOperationsLimit,
    CheckSource,
    CheckBaseFee,
    CheckOperationTypes,
    CheckOperations,
    CheckVerifySignature,
}

func CheckBaseFee Uses

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

func CheckOperationTypes Uses

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

func CheckOperations Uses

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

func CheckOverOperationsLimit Uses

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

func CheckSource Uses

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

func CheckVerifySignature Uses

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

type Body Uses

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 Uses

func (tb Body) MakeHash() []byte

func (Body) MakeHashString Uses

func (tb Body) MakeHashString() string

type Checker Uses

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 Uses

type Pool struct {
    sync.RWMutex

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

func NewPool Uses

func NewPool(cfg common.Config) *Pool

func (*Pool) Add Uses

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

func (*Pool) AddFromClient Uses

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

func (*Pool) AddFromNode Uses

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

func (*Pool) AvailableTransactions Uses

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

func (*Pool) Get Uses

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

func (*Pool) GetFromSource Uses

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

func (*Pool) Has Uses

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

func (*Pool) IsSameSource Uses

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

func (*Pool) Len Uses

func (tp *Pool) Len() int

func (*Pool) Remove Uses

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

func (*Pool) RemoveFromSources Uses

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

type Transaction Uses

type Transaction struct {
    H   Header
    B   Body
}

func MakeTransactionCreateAccount Uses

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

func MakeTransactionPayment Uses

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

func NewTransaction Uses

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

func TestMakeTransaction Uses

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

func TestMakeTransactionWithKeypair Uses

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

func (Transaction) Equal Uses

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

func (Transaction) GetHash Uses

func (tx Transaction) GetHash() string

func (Transaction) GetType Uses

func (tx Transaction) GetType() common.MessageType

func (Transaction) IsEmpty Uses

func (tx Transaction) IsEmpty() bool

func (Transaction) IsValidSequenceID Uses

func (tx Transaction) IsValidSequenceID(sequenceID uint64) bool

func (Transaction) IsValidVersion Uses

func (tx Transaction) IsValidVersion(version string) bool

func (Transaction) IsWellFormed Uses

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

func (Transaction) Serialize Uses

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

func (*Transaction) Sign Uses

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

func (Transaction) Source Uses

func (tx Transaction) Source() string

func (Transaction) String Uses

func (tx Transaction) String() string

func (Transaction) TotalAmount Uses

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 Uses

func (tx Transaction) TotalBaseFee() common.Amount

TotalBaseFee returns the minimum fee of transaction.

func (*Transaction) UnmarshalJSON Uses

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

func (Transaction) Version Uses

func (tx Transaction) Version() string

Directories

PathSynopsis
operation

Package transaction imports 11 packages (graph) and is imported by 22 packages. Updated 2019-02-20. Refresh now. Tools for package owners.