build

package
v0.0.0-...-9098a98 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package build defines various convient methods to construct a transaction.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilTx = errors.New("tx is nil")
)

Functions

This section is empty.

Types

type AccountID

type AccountID struct {
	AccountID string
}

AccountID sets the AccountID field in the Tx.

func (*AccountID) Mutate

func (a *AccountID) Mutate(tx *ultpb.Tx) error

Mutate changes the corresponding AccountID field of the Tx.

type Asset

type Asset struct {
	AssetType AssetType
	AssetName string
	Issuer    string
}

Asset contains the required information of working with an asset.

type AssetType

type AssetType uint8
const (
	// The native asset.
	NATIVE AssetType = iota
	// The custom asset.
	CUSTOM
)

type CreateAccount

type CreateAccount struct {
	AccountID string
	Balance   int64
}

CreateAccount adds a CreateAccount op to the OpList field of tx.

func (*CreateAccount) Mutate

func (ca *CreateAccount) Mutate(tx *ultpb.Tx) error

Mutate appends a CreateAccount op to the OpList.

type Fee

type Fee struct {
	BaseFee int64
}

Fee computes the total fees for the Tx.

func (*Fee) Mutate

func (f *Fee) Mutate(tx *ultpb.Tx) error

Mutate changes the corresponding Fee field of the Tx.

type Note

type Note struct {
	Note string
}

Note sets the Note field in the tx.

func (*Note) Mutate

func (n *Note) Mutate(tx *ultpb.Tx) error

Mutate changes the corresponding Note field of the Tx.

type Payment

type Payment struct {
	AccountID string
	Asset     *Asset
	Amount    int64
}

Payment adds a Payment operation to the OpList field of Tx.

func (*Payment) Mutate

func (p *Payment) Mutate(tx *ultpb.Tx) error

Mutates appends a Payment operation to the OpList of the Tx.

type SeqNum

type SeqNum struct {
	SeqNum uint64
}

SeqNum sets the SeqNum field in the tx.

func (*SeqNum) Mutate

func (s *SeqNum) Mutate(tx *ultpb.Tx) error

Mutate changes the corresponding SeqNum field of the Tx.

type Trust

type Trust struct {
	Asset *Asset
	Limit int64
}

Trust adds a Trust operation to the OpList field of the Tx.

func (*Trust) Mutate

func (t *Trust) Mutate(tx *ultpb.Tx) error

Mutate appends a Trust operation to the OpList of the Tx.

type Tx

type Tx struct {
	Tx *ultpb.Tx
}

Tx serves as the main object for building an transaction.

func NewTx

func NewTx() *Tx

func (*Tx) Add

func (t *Tx) Add(ms ...TxMutator) error

Add adds one or more mutators to the underlying transaction builder and if any of the mutation fails the method fails.

func (*Tx) GetTxKey

func (t *Tx) GetTxKey() (string, error)

Get the tx key.

func (*Tx) Sign

func (t *Tx) Sign(seed string) ([]byte, string, error)

Sign the transaction data with supplied secret seed.

type TxMutator

type TxMutator interface {
	Mutate(tx *ultpb.Tx) error
}

TxMutator defines the method which all the transaction mutators should implement.

Jump to

Keyboard shortcuts

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