transaction

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 9 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	ChainID ChainID
}

func NewBuilder

func NewBuilder(chainID ChainID) *Builder

func (*Builder) NewTransaction

func (b *Builder) NewTransaction(data DataInterface) (Interface, error)

type ChainID

type ChainID byte
const (
	TestNetChainID ChainID
)

type Coin

type Coin [10]byte

func (Coin) String

func (c Coin) String() string

type DataInterface

type DataInterface interface {
	// contains filtered or unexported methods
}

type EncodeInterface

type EncodeInterface interface {
	Encode() (string, error)
}

type Interface

type Interface interface {
	EncodeInterface

	SetSignatureType(signatureType SignatureType) Interface

	SetNonce(nonce uint64) Interface
	SetGasCoin(name string) Interface
	SetGasPrice(price uint8) Interface
	SetPayload(payload []byte) Interface
	Sign(prKey string, multisigPrKeys ...string) (SignedTransaction, error)
	// contains filtered or unexported methods
}

type SendData

type SendData struct {
	Coin  Coin
	To    [20]byte
	Value *big.Int
}

func NewSendData

func NewSendData() *SendData

func (*SendData) MustSetTo

func (d *SendData) MustSetTo(address string) *SendData

func (*SendData) SetCoin

func (d *SendData) SetCoin(symbol string) *SendData

func (*SendData) SetTo

func (d *SendData) SetTo(address string) (*SendData, error)

func (*SendData) SetValue

func (d *SendData) SetValue(value *big.Int) *SendData

type Signature

type Signature struct {
	V *big.Int
	R *big.Int
	S *big.Int
}

type SignatureType

type SignatureType byte
const (
	SignatureTypeSingle SignatureType
)

type SignedTransaction

type SignedTransaction interface {
	EncodeInterface
	Fee() *big.Int
	Hash() (string, error)
	Sign(prKey string, multisigPrKeys ...string) (SignedTransaction, error)
}

type Transaction

type Transaction struct {
	Nonce         uint64
	ChainID       ChainID
	GasPrice      uint8
	GasCoin       Coin
	Type          Type
	Data          []byte
	Payload       []byte
	ServiceData   []byte
	SignatureType SignatureType
	SignatureData []byte
}

func (*Transaction) Encode

func (tx *Transaction) Encode() (string, error)

type Type

type Type byte
const (
	TypeSend Type = iota + 1
)

Jump to

Keyboard shortcuts

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