lib

package
v0.0.0-...-45e38ec Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SYSTEM_ISSUER = crypto.Address("KING_OF_TOKEN")
)

Functions

func MarshalBinary

func MarshalBinary(o interface{}) ([]byte, error)

func MarshalJSON

func MarshalJSON(o interface{}) ([]byte, error)

func UnmarshalBinary

func UnmarshalBinary(bz []byte, ptr interface{}) error

func UnmarshalJSON

func UnmarshalJSON(bz []byte, ptr interface{}) error

Types

type IssuePayload

type IssuePayload struct {
	Issuer crypto.Address
	To     crypto.Address
	Value  int
}

func NewIssuePayload

func NewIssuePayload(issuer, to crypto.Address, value int) *IssuePayload

func (*IssuePayload) GetSignBytes

func (pld *IssuePayload) GetSignBytes() []byte

func (*IssuePayload) GetSigner

func (pld *IssuePayload) GetSigner() crypto.Address

func (*IssuePayload) GetType

func (pld *IssuePayload) GetType() string

type Payload

type Payload interface {
	GetSigner() crypto.Address
	GetSignBytes() []byte
	GetType() string
}

type TokenApp

type TokenApp struct {
	types.BaseApplication
	Accounts map[string]int
}

func NewTokenApp

func NewTokenApp() *TokenApp

func (*TokenApp) CheckTx

func (app *TokenApp) CheckTx(raw []byte) (rsp types.ResponseCheckTx)

func (*TokenApp) DeliverTx

func (app *TokenApp) DeliverTx(raw []byte) (rsp types.ResponseDeliverTx)

func (*TokenApp) Dump

func (app *TokenApp) Dump()

func (*TokenApp) Query

func (app *TokenApp) Query(req types.RequestQuery) (rsp types.ResponseQuery)

type TransferPayload

type TransferPayload struct {
	From  crypto.Address
	To    crypto.Address
	Value int
}

func NewTransferPayload

func NewTransferPayload(from, to crypto.Address, value int) *TransferPayload

func (*TransferPayload) GetSignBytes

func (pld *TransferPayload) GetSignBytes() []byte

func (*TransferPayload) GetSigner

func (pld *TransferPayload) GetSigner() crypto.Address

func (*TransferPayload) GetType

func (pld *TransferPayload) GetType() string

type Tx

type Tx struct {
	Payload   Payload
	Signature []byte
	PubKey    crypto.PubKey
	Sequence  int64
}

func NewTx

func NewTx(payload Payload) *Tx

func (*Tx) Sign

func (tx *Tx) Sign(priv crypto.PrivKey) error

func (*Tx) Verify

func (tx *Tx) Verify() bool

type Wallet

type Wallet struct {
	Keys map[string]crypto.PrivKey
}

func LoadWallet

func LoadWallet(wfn string) *Wallet

func NewWallet

func NewWallet() *Wallet

func (*Wallet) GenPrivKey

func (wallet *Wallet) GenPrivKey(label string) crypto.PrivKey

func (*Wallet) GetAddress

func (wallet *Wallet) GetAddress(label string) crypto.Address

func (*Wallet) GetPrivKey

func (wallet *Wallet) GetPrivKey(label string) crypto.PrivKey

func (*Wallet) GetPubKey

func (wallet *Wallet) GetPubKey(label string) crypto.PubKey

func (*Wallet) Save

func (wallet *Wallet) Save(wfn string)

Jump to

Keyboard shortcuts

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