Documentation ¶
Index ¶
- Constants
- func AccountKey(addr []byte) []byte
- func LegibleBytes(data []byte) string
- func SetAccount(store KVStore, addr []byte, acc *Account)
- func SignTx(chainID string, tx *SendTx, accs ...PrivAccount)
- func TxID(chainID string, tx Tx) []byte
- type Account
- type AccountGetter
- type AccountGetterSetter
- type AccountSetter
- type AppTx
- type CallContext
- type Coin
- type Coins
- func (coinsA Coins) IsEqual(coinsB Coins) bool
- func (coinsA Coins) IsGTE(coinsB Coins) bool
- func (coins Coins) IsNonnegative() bool
- func (coins Coins) IsPositive() bool
- func (coins Coins) IsValid() bool
- func (coins Coins) IsZero() bool
- func (c Coins) Len() int
- func (c Coins) Less(i, j int) bool
- func (coinsA Coins) Minus(coinsB Coins) Coins
- func (coins Coins) Negative() Coins
- func (coinsA Coins) Plus(coinsB Coins) Coins
- func (c Coins) Sort()
- func (coins Coins) String() string
- func (c Coins) Swap(i, j int)
- type KVCache
- type KVStore
- type MemKVStore
- type Plugin
- type Plugins
- type PrivAccount
- type SendTx
- type Tx
- type TxInput
- type TxOutput
- type TxS
Constants ¶
View Source
const ( // Account transactions TxTypeSend = byte(0x01) TxTypeApp = byte(0x02) TxNameSend = "send" TxNameApp = "app" )
Types of Tx implementations
Variables ¶
This section is empty.
Functions ¶
func AccountKey ¶ added in v0.6.2
func LegibleBytes ¶ added in v0.6.2
func SetAccount ¶ added in v0.6.2
func SignTx ¶ added in v0.6.2
func SignTx(chainID string, tx *SendTx, accs ...PrivAccount)
Types ¶
type Account ¶
type Account struct { PubKey crypto.PubKey `json:"pub_key"` // May be nil, if not known. Sequence int `json:"sequence"` Balance Coins `json:"coins"` }
func GetAccount ¶ added in v0.6.2
type AccountGetter ¶ added in v0.6.2
type AccountGetterSetter ¶ added in v0.6.2
type AccountSetter ¶ added in v0.6.2
type AppTx ¶ added in v0.6.2
type AppTx struct { Gas int64 `json:"gas"` // Gas Fee Coin `json:"fee"` // Fee Name string `json:"type"` // Which plugin Input TxInput `json:"input"` // Hmmm do we want coins? Data json.RawMessage `json:"data"` }
func (*AppTx) AssertIsTx ¶ added in v0.6.2
func (_ *AppTx) AssertIsTx()
func (*AppTx) SetSignature ¶ added in v0.6.2
type CallContext ¶ added in v0.6.2
type CallContext struct { CallerAddress []byte // Caller's Address (hash of PubKey) CallerAccount *Account // Caller's Account, w/ fee & TxInputs deducted Coins Coins // The coins that the caller wishes to spend, excluding fees }
func NewCallContext ¶ added in v0.6.2
func NewCallContext(callerAddress []byte, callerAccount *Account, coins Coins) CallContext
type Coins ¶
type Coins []Coin
func ParseCoins ¶
func (Coins) IsNonnegative ¶ added in v0.6.2
func (Coins) IsPositive ¶
type KVCache ¶ added in v0.6.2
type KVCache struct {
// contains filtered or unexported fields
}
A Cache that enforces deterministic sync order.
func NewKVCache ¶ added in v0.6.2
NOTE: If store is nil, creates a new MemKVStore
func (*KVCache) ClearLogLines ¶ added in v0.6.2
func (kvc *KVCache) ClearLogLines()
func (*KVCache) GetLogLines ¶ added in v0.6.2
func (*KVCache) SetLogging ¶ added in v0.6.2
func (kvc *KVCache) SetLogging()
type MemKVStore ¶ added in v0.6.2
type MemKVStore struct {
// contains filtered or unexported fields
}
func NewMemKVStore ¶ added in v0.6.2
func NewMemKVStore() *MemKVStore
func (*MemKVStore) Get ¶ added in v0.6.2
func (mkv *MemKVStore) Get(key []byte) (value []byte)
func (*MemKVStore) Set ¶ added in v0.6.2
func (mkv *MemKVStore) Set(key []byte, value []byte)
type Plugin ¶ added in v0.6.2
type Plugin interface { // Name of this plugin, should be short. Name() string // Run a transaction from ABCI DeliverTx RunTx(store KVStore, ctx CallContext, txBytes []byte) (res abci.Result) // Other ABCI message handlers SetOption(store KVStore, key, value string) (log string) InitChain(store KVStore, vals []*abci.Validator) BeginBlock(store KVStore, hash []byte, header *abci.Header) EndBlock(store KVStore, height uint64) abci.ResponseEndBlock }
type Plugins ¶ added in v0.6.2
type Plugins struct {
// contains filtered or unexported fields
}
func NewPlugins ¶ added in v0.6.2
func NewPlugins() *Plugins
func (*Plugins) RegisterPlugin ¶ added in v0.6.2
type PrivAccount ¶ added in v0.6.2
type PrivAccount struct { crypto.PrivKey Account }
func MakeAcc ¶ added in v0.6.2
func MakeAcc(secret string) PrivAccount
func PrivAccountFromSecret ¶ added in v0.6.2
func PrivAccountFromSecret(secret string) PrivAccount
Creates a PrivAccount from secret. The amount is not set.
func RandAccounts ¶ added in v0.6.2
func RandAccounts(num int, minAmount int64, maxAmount int64) []PrivAccount
Make `num` random accounts
type SendTx ¶ added in v0.6.2
type SendTx struct { Gas int64 `json:"gas"` // Gas Fee Coin `json:"fee"` // Fee Inputs []TxInput `json:"inputs"` Outputs []TxOutput `json:"outputs"` }
func MakeSendTx ¶ added in v0.6.2
func MakeSendTx(seq int, accOut PrivAccount, accsIn ...PrivAccount) *SendTx
func (*SendTx) AssertIsTx ¶ added in v0.6.2
func (_ *SendTx) AssertIsTx()
func (*SendTx) SetSignature ¶ added in v0.6.2
type Tx ¶
Tx (Transaction) is an atomic operation on the ledger state.
Account Types:
- SendTx Send coins to address
- AppTx Send a msg to a contract that runs in the vm
type TxInput ¶ added in v0.6.2
type TxInput struct { Address data.Bytes `json:"address"` // Hash of the PubKey Coins Coins `json:"coins"` // Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput Signature crypto.Signature `json:"signature"` // Depends on the PubKey type and the whole Tx PubKey crypto.PubKey `json:"pub_key"` // Is present iff Sequence == 0 }
func Accs2TxInputs ¶ added in v0.6.2
func Accs2TxInputs(seq int, accs ...PrivAccount) []TxInput
func NewTxInput ¶ added in v0.6.2
func (TxInput) ValidateBasic ¶ added in v0.6.2
type TxOutput ¶ added in v0.6.2
type TxOutput struct { Address data.Bytes `json:"address"` // Hash of the PubKey Coins Coins `json:"coins"` // }
func Accs2TxOutputs ¶ added in v0.6.2
func Accs2TxOutputs(accs ...PrivAccount) []TxOutput
turn a list of accounts into basic list of transaction outputs
func (TxOutput) ChainAndAddress ¶ added in v0.6.2
An output destined for another chain may be formatted as `chainID/address`. ChainAndAddress returns the chainID prefix and the address. If there is no chainID prefix, the first returned value is nil.
func (TxOutput) ValidateBasic ¶ added in v0.6.2
Click to show internal directories.
Click to hide internal directories.