Documentation ¶
Index ¶
- Constants
- Variables
- func EncodeTx(tx Tx) ([]byte, error)
- func EventStringAccCall(addr []byte) string
- func EventStringAccInput(addr []byte) string
- func EventStringAccOutput(addr []byte) string
- func EventStringBond() string
- func EventStringCompleteProposal() string
- func EventStringDupeout() string
- func EventStringFork() string
- func EventStringLock() string
- func EventStringLogEvent(addr []byte) string
- func EventStringNameReg(name string) string
- func EventStringNewBlock() string
- func EventStringNewRound() string
- func EventStringPermissions(name string) string
- func EventStringPolka() string
- func EventStringRebond() string
- func EventStringRelock() string
- func EventStringTimeoutPropose() string
- func EventStringTimeoutWait() string
- func EventStringUnbond() string
- func EventStringUnlock() string
- func EventStringVote() string
- func NameBaseCost(name, data string) int64
- func NameCostPerBlock(baseCost int64) int64
- func NewContractAddress(caller []byte, nonce int) []byte
- func TxHash(chainID string, tx Tx) []byte
- type AccountGetter
- type BondTx
- func (tx *BondTx) AddInput(st AccountGetter, pubkey crypto.PubKey, amt int64) error
- func (tx *BondTx) AddInputWithNonce(pubkey crypto.PubKey, amt int64, nonce int) error
- func (tx *BondTx) AddOutput(addr []byte, amt int64) error
- func (tx *BondTx) SignBond(chainID string, privAccount *acm.PrivAccount) error
- func (tx *BondTx) SignInput(chainID string, i int, privAccount *acm.PrivAccount) error
- func (tx *BondTx) String() string
- func (tx *BondTx) WriteSignBytes(chainID string, w io.Writer, n *int, err *error)
- type CallData
- type CallTx
- type DupeoutTx
- type ErrTxInvalidSequence
- type ErrTxInvalidString
- type EventData
- type EventDataCall
- type EventDataLog
- type EventDataNewBlock
- type EventDataNewBlockHeader
- type EventDataRoundState
- type EventDataTx
- type EventDataVote
- type NameTx
- type PermissionsTx
- type RebondTx
- type Receipt
- type ResultListNames
- type SendTx
- func (tx *SendTx) AddInput(st AccountGetter, pubkey crypto.PubKey, amt int64) error
- func (tx *SendTx) AddInputWithNonce(pubkey crypto.PubKey, amt int64, nonce int) error
- func (tx *SendTx) AddOutput(addr []byte, amt int64) error
- func (tx *SendTx) SignInput(chainID string, i int, privAccount *acm.PrivAccount) error
- func (tx *SendTx) String() string
- func (tx *SendTx) WriteSignBytes(chainID string, w io.Writer, n *int, err *error)
- type Tx
- type TxInput
- type TxOutput
- type UnbondTx
- type UnconfirmedTxs
Constants ¶
View Source
const ( EventDataTypeNewBlock = byte(0x01) EventDataTypeFork = byte(0x02) EventDataTypeTx = byte(0x03) EventDataTypeCall = byte(0x04) EventDataTypeLog = byte(0x05) EventDataTypeNewBlockHeader = byte(0x06) EventDataTypeRoundState = byte(0x11) EventDataTypeVote = byte(0x12) )
View Source
const ( // Account transactions TxTypeSend = byte(0x01) TxTypeCall = byte(0x02) TxTypeName = byte(0x03) // Validation transactions TxTypeBond = byte(0x11) TxTypeUnbond = byte(0x12) TxTypeRebond = byte(0x13) TxTypeDupeout = byte(0x14) // Admin transactions TxTypePermissions = byte(0x20) )
Types of Tx implementations
Variables ¶
View Source
var ( MinNameRegistrationPeriod int = 5 // cost for storing a name for a block is // CostPerBlock*CostPerByte*(len(data) + 32) NameByteCostMultiplier int64 = 1 NameBlockCostMultiplier int64 = 1 MaxNameLength = 64 MaxDataLength = 1 << 16 )
View Source
var ( ErrTxInvalidAddress = errors.New("Error invalid address") ErrTxDuplicateAddress = errors.New("Error duplicate address") ErrTxInvalidAmount = errors.New("Error invalid amount") ErrTxInsufficientFunds = errors.New("Error insufficient funds") ErrTxInsufficientGasPrice = errors.New("Error insufficient gas price") ErrTxUnknownPubKey = errors.New("Error unknown pubkey") ErrTxInvalidPubKey = errors.New("Error invalid pubkey") ErrTxInvalidSignature = errors.New("Error invalid signature") ErrTxPermissionDenied = errors.New("Error permission denied") )
Functions ¶
func EventStringAccCall ¶
func EventStringAccInput ¶
func EventStringAccOutput ¶
func EventStringBond ¶
func EventStringBond() string
func EventStringCompleteProposal ¶
func EventStringCompleteProposal() string
func EventStringDupeout ¶
func EventStringDupeout() string
func EventStringFork ¶
func EventStringFork() string
func EventStringLock ¶
func EventStringLock() string
func EventStringLogEvent ¶
func EventStringNameReg ¶
func EventStringNewBlock ¶
func EventStringNewBlock() string
func EventStringNewRound ¶
func EventStringNewRound() string
func EventStringPermissions ¶
func EventStringPolka ¶
func EventStringPolka() string
func EventStringRebond ¶
func EventStringRebond() string
func EventStringRelock ¶
func EventStringRelock() string
func EventStringTimeoutPropose ¶
func EventStringTimeoutPropose() string
func EventStringTimeoutWait ¶
func EventStringTimeoutWait() string
func EventStringUnbond ¶
func EventStringUnbond() string
func EventStringUnlock ¶
func EventStringUnlock() string
func EventStringVote ¶
func EventStringVote() string
func NameBaseCost ¶
base cost is "effective" number of bytes
func NameCostPerBlock ¶
func NewContractAddress ¶
Types ¶
type AccountGetter ¶
type BondTx ¶
type BondTx struct { PubKey crypto.PubKeyEd25519 `json:"pub_key"` // NOTE: these don't have type byte Signature crypto.SignatureEd25519 `json:"signature"` Inputs []*TxInput `json:"inputs"` UnbondTo []*TxOutput `json:"unbond_to"` }
func (*BondTx) AddInput ¶
func (tx *BondTx) AddInput(st AccountGetter, pubkey crypto.PubKey, amt int64) error
func (*BondTx) AddInputWithNonce ¶
func (*BondTx) SignBond ¶
func (tx *BondTx) SignBond(chainID string, privAccount *acm.PrivAccount) error
type CallTx ¶
type CallTx struct { Input *TxInput `json:"input"` Address []byte `json:"address"` GasLimit int64 `json:"gas_limit"` Fee int64 `json:"fee"` Data []byte `json:"data"` }
func NewCallTx ¶
func NewCallTx(st AccountGetter, from crypto.PubKey, to, data []byte, amt, gasLimit, fee int64) (*CallTx, error)
func NewCallTxWithNonce ¶
type DupeoutTx ¶
type DupeoutTx struct { Address []byte `json:"address"` VoteA tendermint_types.Vote `json:"vote_a"` VoteB tendermint_types.Vote `json:"vote_b"` }
type ErrTxInvalidSequence ¶
func (ErrTxInvalidSequence) Error ¶
func (e ErrTxInvalidSequence) Error() string
type ErrTxInvalidString ¶
type ErrTxInvalidString struct {
Msg string
}
func (ErrTxInvalidString) Error ¶
func (e ErrTxInvalidString) Error() string
type EventDataCall ¶
type EventDataCall struct { CallData *CallData `json:"call_data"` Origin []byte `json:"origin"` TxID []byte `json:"tx_id"` Return []byte `json:"return"` Exception string `json:"exception"` }
EventDataCall fires when we call a contract, and when a contract calls another contract
func (EventDataCall) AssertIsEventData ¶
func (_ EventDataCall) AssertIsEventData()
type EventDataLog ¶
type EventDataLog struct { Address Word256 `json:"address"` Topics []Word256 `json:"topics"` Data []byte `json:"data"` Height int64 `json:"height"` }
EventDataLog fires when a contract executes the LOG opcode
func (EventDataLog) AssertIsEventData ¶
func (_ EventDataLog) AssertIsEventData()
type EventDataNewBlock ¶
func (EventDataNewBlock) AssertIsEventData ¶
func (_ EventDataNewBlock) AssertIsEventData()
type EventDataNewBlockHeader ¶
func (EventDataNewBlockHeader) AssertIsEventData ¶
func (_ EventDataNewBlockHeader) AssertIsEventData()
type EventDataRoundState ¶
type EventDataRoundState struct { CurrentTime time.Time `json:"current_time"` Height int `json:"height"` Round int `json:"round"` Step string `json:"step"` StartTime time.Time `json:"start_time"` CommitTime time.Time `json:"commit_time"` Proposal *tm_types.Proposal `json:"proposal"` ProposalBlock *tm_types.Block `json:"proposal_block"` LockedRound int `json:"locked_round"` LockedBlock *tm_types.Block `json:"locked_block"` POLRound int `json:"pol_round"` }
We fire the most recent round state that led to the event (ie. NewRound will have the previous rounds state)
func (EventDataRoundState) AssertIsEventData ¶
func (_ EventDataRoundState) AssertIsEventData()
type EventDataTx ¶
type EventDataTx struct { Tx Tx `json:"tx"` Return []byte `json:"return"` Exception string `json:"exception"` }
All txs fire EventDataTx, but only CallTx might have Return or Exception
func (EventDataTx) AssertIsEventData ¶
func (_ EventDataTx) AssertIsEventData()
type EventDataVote ¶
func (EventDataVote) AssertIsEventData ¶
func (_ EventDataVote) AssertIsEventData()
type NameTx ¶
type NameTx struct { Input *TxInput `json:"input"` Name string `json:"name"` Data string `json:"data"` Fee int64 `json:"fee"` }
func NewNameTx ¶
func NewNameTx(st AccountGetter, from crypto.PubKey, name, data string, amt, fee int64) (*NameTx, error)
func NewNameTxWithNonce ¶
func (*NameTx) ValidateStrings ¶
type PermissionsTx ¶
func NewPermissionsTx ¶
func NewPermissionsTx(st AccountGetter, from crypto.PubKey, args ptypes.PermArgs) (*PermissionsTx, error)
func NewPermissionsTxWithNonce ¶
func NewPermissionsTxWithNonce(from crypto.PubKey, args ptypes.PermArgs, nonce int) *PermissionsTx
func (*PermissionsTx) Sign ¶
func (tx *PermissionsTx) Sign(chainID string, privAccount *acm.PrivAccount)
func (*PermissionsTx) String ¶
func (tx *PermissionsTx) String() string
func (*PermissionsTx) WriteSignBytes ¶
type RebondTx ¶
type RebondTx struct { Address []byte `json:"address"` Height int `json:"height"` Signature crypto.SignatureEd25519 `json:"signature"` }
func NewRebondTx ¶
type Receipt ¶
type Receipt struct { TxHash []byte `json:"tx_hash"` CreatesContract uint8 `json:"creates_contract"` ContractAddr []byte `json:"contract_addr"` }
BroadcastTx or Transact
func GenerateReceipt ¶
type ResultListNames ¶
type ResultListNames struct { BlockHeight int `json:"block_height"` Names []*core_types.NameRegEntry `json:"names"` }
XXX: vestige of an older time
type SendTx ¶
func (*SendTx) AddInput ¶
func (tx *SendTx) AddInput(st AccountGetter, pubkey crypto.PubKey, amt int64) error
func (*SendTx) AddInputWithNonce ¶
type TxInput ¶
type TxInput struct { Address []byte `json:"address"` // Hash of the PubKey Amount int64 `json:"amount"` // Must not exceed account balance 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"` // Must not be nil, may be nil }
func (*TxInput) ValidateBasic ¶
type TxOutput ¶
type TxOutput struct { Address []byte `json:"address"` // Hash of the PubKey Amount int64 `json:"amount"` // The sum of all outputs must not exceed the inputs. }
func (*TxOutput) ValidateBasic ¶
Click to show internal directories.
Click to hide internal directories.