types

package
v0.0.0-...-330973d Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2016 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCreateAccount = 0x01
	ActionRemoveAccount = 0x02
	ActionSubmitForm    = 0x03
)
View Source
const FORM_ID_LENGTH = 16
View Source
const MaxBlocks = 50
View Source
const MinTxLength = 20

Variables

This section is empty.

Functions

func ResultToError

func ResultToError(result interface{}) error

func Upgrader

func Upgrader() *ws.Upgrader

func XOR

func XOR(bytes []byte, items ...string) []byte

Types

type Account

type Account struct {
	FormIDs  []string      `json:"form_ids"`
	PubKey   crypto.PubKey `json:"pub_key"`
	Sequence int           `json:"sequence"`
	Username string        `json:"username"`
}

func NewAccount

func NewAccount(pubKey crypto.PubKey, username string) *Account

func (*Account) AddformID

func (acc *Account) AddformID(info Info)

func (*Account) Copy

func (acc *Account) Copy() *Account

type AccountGetter

type AccountGetter interface {
	GetAccount(addr []byte) *Account
}

type AccountGetterSetter

type AccountGetterSetter interface {
	GetAccount(addr []byte) *Account
	SetAccount(addr []byte, acc *Account)
}

type AccountSetter

type AccountSetter interface {
	SetAccount(addr []byte, acc *Account)
}

type Action

type Action struct {
	Type  byte         `json: "type"`
	Input *ActionInput `json: "input"`
	Data  []byte       `json: "data"`
}

func NewAction

func NewAction(actionType byte, data []byte) Action

func (Action) ID

func (a Action) ID(chainID string) []byte

func (Action) Prepare

func (a Action) Prepare(pubKey crypto.PubKey, seq int)

func (Action) Sign

func (a Action) Sign(privKey crypto.PrivKey, chainID string)

func (Action) SignBytes

func (a Action) SignBytes(chainID string) []byte

func (Action) String

func (a Action) String() string

func (Action) StringIndented

func (a Action) StringIndented(indent string) string

func (Action) Tx

func (a Action) Tx() tndr.Tx

type ActionInput

type ActionInput struct {
	Address   []byte           `json: "address"`
	Sequence  int              `json: "sequence"`
	Signature crypto.Signature `json: "signature"`
	PubKey    crypto.PubKey    `json: "public-key"`
}

func (ActionInput) String

func (in ActionInput) String() string

func (ActionInput) StringIndented

func (in ActionInput) StringIndented(indent string) string

func (ActionInput) ValidateBasic

func (in ActionInput) ValidateBasic() tmsp.Result

type Cache

type Cache struct {
	*KVMap
	// contains filtered or unexported fields
}

func NewCache

func NewCache(store Store) *Cache

func (*Cache) Get

func (c *Cache) Get(key []byte) (value []byte)

func (*Cache) Reset

func (c *Cache) Reset()

func (*Cache) Set

func (c *Cache) Set(key []byte, value []byte)

func (*Cache) Sync

func (c *Cache) Sync()

type Form

type Form struct {
	ContentType string `json:"content_type, omitempty"`
	Data        []byte `json:"data, omitempty"`
	Description string `json:"description"`
	Issue       string `json:"issue"`
	Location    string `json:"location"`
	SubmittedAt string `json:"submitted_at"`
	Submitter   string `json:"submitter"`
}

func (Form) ID

func (form Form) ID() []byte

func (Form) String

func (form Form) String() string

func (Form) StringIndented

func (form Form) StringIndented(indent string) string

type Idpair

type Idpair struct {
	FormID    string `json:"form_id"`
	ContentID string `json:"content_id"`
}

func NewIdpair

func NewIdpair(form Form, cid *cid.Cid) *Idpair

type Info

type Info struct {
	ContentID *cid.Cid `json:"content_id"`
	FormID    []byte   `json:"form_id"`
	Issue     string   `json:"issue"`
	Location  string   `json:"location"`
	Submitter string   `json:"submitter"`
}

func NewInfo

func NewInfo(contentID *cid.Cid, form Form) Info

type KVList

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

func NewKVList

func NewKVList() *KVList

func (*KVList) Push

func (kvl *KVList) Push(key []byte, value []byte) *KVNode

func (*KVList) Update

func (kvl *KVList) Update(value []byte, kvn *KVNode)

type KVMap

type KVMap struct {
	*KVList
	// contains filtered or unexported fields
}

func NewKVMap

func NewKVMap() *KVMap

func (*KVMap) Get

func (kvm *KVMap) Get(key []byte) []byte

func (*KVMap) Set

func (kvm *KVMap) Set(key []byte, value []byte)

type KVNode

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

type Keypair

type Keypair struct {
	PrivKeystr string `json:"priv_key"`
	PubKeystr  string `json:"pub_key"`
}

func NewKeypair

func NewKeypair(pubKey crypto.PubKey, privKey crypto.PrivKey) *Keypair

type Logger

type Logger log.Logger

func NewLogger

func NewLogger(module string) Logger

type MemStore

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

func NewMemStore

func NewMemStore() *MemStore

func (*MemStore) Get

func (mstore *MemStore) Get(key []byte) (value []byte)

func (*MemStore) Set

func (mstore *MemStore) Set(key []byte, value []byte)

type Message

type Message struct {
	Action string      `json:"action"`
	Data   interface{} `json:"data, omitempty"`
	Error  error       `json:"error, omitempty"`
}

func MessageChainID

func MessageChainID(err error) *Message

func MessageCreateAccount

func MessageCreateAccount(data *Keypair, err error) *Message

func MessageFindForm

func MessageFindForm(data *Form, err error) *Message

func MessageIssues

func MessageIssues(data []string, err error) *Message

func MessageLogin

func MessageLogin(err error) *Message

func MessageRemoveAccount

func MessageRemoveAccount(err error) *Message

func MessageSubmitForm

func MessageSubmitForm(data *Idpair, err error) *Message

type PrivAccount

type PrivAccount struct {
	*Account
	PrivKey crypto.PrivKey
}

func NewPrivAccount

func NewPrivAccount(acc *Account, privKey crypto.PrivKey) *PrivAccount

type Proxy

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

func NewProxy

func NewProxy(remote, endpoint string) *Proxy

func (*Proxy) BroadcastTx

func (p *Proxy) BroadcastTx(mode string, tx tndr.Tx) (*ctypes.ResultBroadcastTx, error)

func (*Proxy) GetBlock

func (p *Proxy) GetBlock(height int) (*ctypes.ResultBlock, error)

func (*Proxy) GetChain

func (p *Proxy) GetChain(min, max int) (*ctypes.ResultBlockchainInfo, error)

func (*Proxy) GetStatus

func (p *Proxy) GetStatus() (*ctypes.ResultStatus, error)

func (*Proxy) GetValidators

func (p *Proxy) GetValidators() (*ctypes.ResultValidators, error)

func (*Proxy) ReadResult

func (p *Proxy) ReadResult(event string, evData tndr.TMEventData) (tndr.TMEventData, error)

func (*Proxy) StartWS

func (p *Proxy) StartWS() (err error)

func (*Proxy) StopWS

func (p *Proxy) StopWS() error

func (*Proxy) SubscribeNewBlock

func (p *Proxy) SubscribeNewBlock() error

func (*Proxy) TMSPQuery

func (p *Proxy) TMSPQuery(query []byte) (*ctypes.ResultTMSPQuery, error)

func (*Proxy) UnsubscribeNewBlock

func (p *Proxy) UnsubscribeNewBlock() error

func (*Proxy) WriteWS

func (p *Proxy) WriteWS(mode string, v interface{}) error

type Receipt

type Receipt struct {
	AppHash     []byte `json:"app_hash"`
	BlockHeight int    `json:"block_height"`
	FormID      string `json:"form_id"`
}

func NewReceipt

func NewReceipt(blockHeight int, formID []byte) *Receipt
type Search struct {
	After  time.Time `json:"after"`
	Before time.Time `json:"before"`
	Issue  string    `json:"issue"`
}

Search specifies issue, location and time range

func NewSearch

func NewSearch(after, before, issue string) Search

type Store

type Store interface {
	Set(key, value []byte)
	Get(key []byte) (value []byte)
}

type Update

type Update struct {
	Error   error    `json:"error, omitempty"`
	Form    *Form    `json:"form, omitempty"`
	Receipt *Receipt `json:"receipt, omitempty"`
	Type    string   `json:"type"`
}

func NewUpdate

func NewUpdate(v interface{}, err error) (*Update, error)

Jump to

Keyboard shortcuts

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