basecoin

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AccountType = "account"

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Type  string      `json:"type"`
	Value AccountData `json:"value"` // TODO: custom encoding?
	// contains filtered or unexported fields
}

func (Account) Bytes

func (a Account) Bytes() []byte

type AccountData

type AccountData struct {
	PubKey   crypto.PubKeyS `json:"pub_key,omitempty"` // May be empty, if not known.
	Sequence int            `json:"sequence"`
	Balance  bc.Coins       `json:"coins"`
}

type AppDataReader

type AppDataReader func(name, txType string, json []byte) ([]byte, error)

AppDataReader takes a plugin name and txType and some json and serializes it into a binary format

type AppTx

type AppTx struct {
	Tx *bc.AppTx
	// contains filtered or unexported fields
}

func (*AppTx) Sign

func (a *AppTx) Sign(pubkey crypto.PubKey, sig crypto.Signature) error

Sign will add a signature and pubkey.

Depending on the Signable, one may be able to call this multiple times for multisig Returns error if called with invalid data or too many times

func (*AppTx) SignBytes

func (a *AppTx) SignBytes() []byte

SignBytes returned the unsigned bytes, needing a signature

func (*AppTx) Signers

func (a *AppTx) Signers() ([]crypto.PubKey, error)

Signers will return the public key(s) that signed if the signature is valid, or an error if there is any issue with the signature, including if there are no signatures

func (*AppTx) TxBytes

func (a *AppTx) TxBytes() ([]byte, error)

TxBytes returns the transaction data as well as all signatures It should return an error if Sign was never called

type BasecoinTx

type BasecoinTx struct {
	// contains filtered or unexported fields
}

func NewBasecoinTx

func NewBasecoinTx(chainID string) BasecoinTx

func (BasecoinTx) ReadSignable

func (t BasecoinTx) ReadSignable(data []byte) (keys.Signable, error)

Turn json into a signable object

func (BasecoinTx) RegisterParser

func (t BasecoinTx) RegisterParser(name, txType string, reader TxReader)

type BasecoinValues

type BasecoinValues struct {
	// contains filtered or unexported fields
}

BasecoinValues handles parsing any binary database values and returning them as structs for introspection or json encoding

func NewBasecoinValues

func NewBasecoinValues() *BasecoinValues

func (*BasecoinValues) ReadValue

func (t *BasecoinValues) ReadValue(key, value []byte) (lc.Value, error)

Turn merkle binary into a json-able struct

func (*BasecoinValues) RegisterPlugin

func (t *BasecoinValues) RegisterPlugin(reader lc.ValueReader)

type SendTx

type SendTx struct {
	Tx *bc.SendTx
	// contains filtered or unexported fields
}

func (*SendTx) Sign

func (s *SendTx) Sign(pubkey crypto.PubKey, sig crypto.Signature) error

Sign will add a signature and pubkey.

Depending on the Signable, one may be able to call this multiple times for multisig Returns error if called with invalid data or too many times

func (*SendTx) SignBytes

func (s *SendTx) SignBytes() []byte

SignBytes returned the unsigned bytes, needing a signature

func (*SendTx) Signers

func (s *SendTx) Signers() ([]crypto.PubKey, error)

Signers will return the public key(s) that signed if the signature is valid, or an error if there is any issue with the signature, including if there are no signatures

func (*SendTx) TxBytes

func (s *SendTx) TxBytes() ([]byte, error)

TxBytes returns the transaction data as well as all signatures It should return an error if Sign was never called

type TxReader

type TxReader func(json []byte) ([]byte, error)

TxReader handles parsing and serializing one particular type

type TxType

type TxType struct {
	Type string           `json:"type"`
	Data *json.RawMessage `json:"data"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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