transaction

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: MIT Imports: 8 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidCode

func ValidCode(u uint16) bool

ValidCode validates as uint16

func Verify

func Verify(from mint.PublicKey, payload []byte, signature mint.Signature) error

Verify transaction payload

Types

type Code

type Code uint16

Code is a transaction name/code

const (
	// RegisterNodeTx ...
	RegisterNodeTx Code = 1
	// UnregisterNodeTx ...
	UnregisterNodeTx Code = 2
	// SetWalletTagTx ...
	SetWalletTagTx Code = 3
	// UnsetWalletTagTx ...
	UnsetWalletTagTx Code = 4
	// UserDataTx ...
	UserDataTx Code = 7
	// TransferAssetTx ...
	TransferAssetTx Code = 10
	// DistributionFeeTx ...
	DistributionFeeTx Code = 11
)

func ParseCode

func ParseCode(s string) (Code, error)

ParseCode from string

func (Code) String

func (t Code) String() string

String representation

type DistributionFee

type DistributionFee struct {
	OwnerAddress mint.PublicKey
	AmountMNT    *amount.Amount
	AmountGOLD   *amount.Amount
}

DistributionFee transaction data

func (*DistributionFee) Code

func (t *DistributionFee) Code() Code

Code impl

func (*DistributionFee) Parse

Parse impl.

func (*DistributionFee) Sign

func (t *DistributionFee) Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)

Sign impl

type ParsedTransaction

type ParsedTransaction struct {
	Nonce     uint64
	From      mint.PublicKey
	Digest    mint.Digest
	Signature mint.Signature
}

ParsedTransaction data

type RegisterNode

type RegisterNode struct {
	NodeAddress mint.PublicKey
	NodeIP      string
}

RegisterNode transaction data

func (*RegisterNode) Code

func (t *RegisterNode) Code() Code

Code impl

func (*RegisterNode) Parse

func (t *RegisterNode) Parse(r io.Reader) (*ParsedTransaction, error)

Parse impl

func (*RegisterNode) Sign

func (t *RegisterNode) Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)

Sign impl

type SetWalletTag

type SetWalletTag struct {
	Address mint.PublicKey
	Tag     mint.WalletTag
}

SetWalletTag transaction data

func (*SetWalletTag) Code

func (t *SetWalletTag) Code() Code

Code impl

func (*SetWalletTag) Parse

func (t *SetWalletTag) Parse(r io.Reader) (*ParsedTransaction, error)

Parse impl

func (*SetWalletTag) Sign

func (t *SetWalletTag) Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)

Sign impl

type SignedTransaction

type SignedTransaction struct {
	Digest    mint.Digest
	Data      []byte
	Signature mint.Signature
}

SignedTransaction data

type Transactioner

type Transactioner interface {
	Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)
	Parse(r io.Reader) (*ParsedTransaction, error)
	Code() Code
}

Transactioner is a transaction interface

func CodeToTransaction

func CodeToTransaction(code Code) (Transactioner, error)

CodeToTransaction returns corresponding transaction data holder

type TransferAsset

type TransferAsset struct {
	Address mint.PublicKey
	Token   mint.Token
	Amount  *amount.Amount
}

TransferAsset transaction data

func (*TransferAsset) Code

func (t *TransferAsset) Code() Code

Code impl

func (*TransferAsset) Parse

func (t *TransferAsset) Parse(r io.Reader) (*ParsedTransaction, error)

Parse impl

func (*TransferAsset) Sign

func (t *TransferAsset) Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)

Sign impl

type UnregisterNode

type UnregisterNode struct {
	NodeAddress mint.PublicKey
}

UnregisterNode transaction data

func (*UnregisterNode) Code

func (t *UnregisterNode) Code() Code

Code impl

func (*UnregisterNode) Parse

Parse impl

func (*UnregisterNode) Sign

func (t *UnregisterNode) Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)

Sign impl

type UnsetWalletTag

type UnsetWalletTag struct {
	Address mint.PublicKey
	Tag     mint.WalletTag
}

UnsetWalletTag transaction data

func (*UnsetWalletTag) Code

func (t *UnsetWalletTag) Code() Code

Code impl

func (*UnsetWalletTag) Parse

Parse impl

func (*UnsetWalletTag) Sign

func (t *UnsetWalletTag) Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)

Sign impl

type UserData

type UserData struct {
	Data []byte
}

UserData transaction data

func (*UserData) Code

func (t *UserData) Code() Code

Code impl

func (*UserData) Parse

func (t *UserData) Parse(r io.Reader) (*ParsedTransaction, error)

Parse impl

func (*UserData) Sign

func (t *UserData) Sign(signer *signer.Signer, nonce uint64) (*SignedTransaction, error)

Sign impl

Jump to

Keyboard shortcuts

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