goforceio: github.com/eosforce/goforceio Index | Examples | Files | Directories

package eos

import "github.com/eosforce/goforceio"



Package Files

abi.go abidecoder.go abiencoder.go actions.go api.go decoder.go encoder.go error.go logger.go name.go p2p.go p2ptypes.go responses.go signer.go transaction.go types.go


const (
    GoAwayNoReason = GoAwayReason(iota)
const (
    CompressionNone = CompressionType(iota)
const BlockTimestampFormat = "2006-01-02T15:04:05.999"
const JSONTimeFormat = "2006-01-02T15:04:05"


var EOSSymbol = Symbol{Precision: 4, Symbol: "EOS"}

EOSSymbol represents the standard EOS symbol on the chain. It's here just to speed up things.

var ErrNotFound = errors.New("resource not found")
var ErrUnknownMessageType = errors.New("unknown type")
var ErrVarIntBufferSize = errors.New("varint: invalid buffer size")
var RegisteredActions = map[AccountName]map[ActionName]reflect.Type{}
var TypeSize = struct {
    Byte           int
    Int8           int
    UInt8          int
    UInt16         int
    Int16          int
    UInt32         int
    UInt64         int
    UInt128        int
    Float32        int
    Float64        int
    Checksum160    int
    Checksum256    int
    Checksum512    int
    PublicKey      int
    Signature      int
    Tstamp         int
    BlockTimestamp int
    CurrencyName   int
    Bool           int
    Byte:           1,
    Int8:           1,
    UInt8:          1,
    UInt16:         2,
    Int16:          2,
    UInt32:         4,
    UInt64:         8,
    UInt128:        16,
    Float32:        4,
    Float64:        8,
    Checksum160:    20,
    Checksum256:    32,
    Checksum512:    64,
    PublicKey:      34,
    Signature:      66,
    Tstamp:         8,
    BlockTimestamp: 4,
    CurrencyName:   7,
    Bool:           1,

func BlockNum Uses

func BlockNum(blockID string) uint32

BlockNum extracts the block number (or height) from a hex-encoded block ID.

func EnableABIDecoderLogging Uses

func EnableABIDecoderLogging()

func EnableABIEncoderLogging Uses

func EnableABIEncoderLogging()

func EnableDecoderLogging Uses

func EnableDecoderLogging()

func EnableEncoderLogging Uses

func EnableEncoderLogging()

func ExtendedStringToName Uses

func ExtendedStringToName(s string) (val uint64, err error)

ExtendedStringToName acts similar to StringToName with the big differences that it will automtically try to infer from which format to convert to a name. Current rules are: - If the `s` contains a `,` character, assumes it's a `Symbol` - If the `s` contains only upper-case characters and length is <= 7, assumes it's a `SymbolCode` - Otherwise, forwards `s` to `StringToName` directly

func MarshalBinary Uses

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

func NameToString Uses

func NameToString(in uint64) string

func NewLogger Uses

func NewLogger(production bool) *zap.Logger

NewLogger a wrap to newLogger

func RegisterAction Uses

func RegisterAction(accountName AccountName, actionName ActionName, obj interface{})

Registers Action objects..

func SigDigest Uses

func SigDigest(chainID, payload, contextFreeData []byte) []byte

func StringToName Uses

func StringToName(s string) (val uint64, err error)

func UnmarshalBinary Uses

func UnmarshalBinary(data []byte, v interface{}) (err error)

func UnmarshalBinaryReader Uses

func UnmarshalBinaryReader(reader io.Reader, v interface{}) (err error)

type ABI Uses

type ABI struct {
    Version          string            `json:"version"`
    Types            []ABIType         `json:"types,omitempty"`
    Structs          []StructDef       `json:"structs,omitempty"`
    Actions          []ActionDef       `json:"actions,omitempty"`
    Tables           []TableDef        `json:"tables,omitempty"`
    RicardianClauses []ClausePair      `json:"ricardian_clauses,omitempty"`
    ErrorMessages    []ABIErrorMessage `json:"error_messages,omitempty"`
    Extensions       []*Extension      `json:"abi_extensions,omitempty"`

see: libraries/chain/contracts/abi_serializer.cpp:53... see: libraries/chain/include/eosio/chain/contracts/types.hpp:100

func NewABI Uses

func NewABI(r io.Reader) (*ABI, error)

func (*ABI) ActionForName Uses

func (a *ABI) ActionForName(name ActionName) *ActionDef

func (*ABI) DecodeAction Uses

func (a *ABI) DecodeAction(data []byte, actionName ActionName) ([]byte, error)

func (*ABI) DecodeTableRow Uses

func (a *ABI) DecodeTableRow(tableName TableName, data []byte) ([]byte, error)

func (*ABI) DecodeTableRowTyped Uses

func (a *ABI) DecodeTableRowTyped(tableType string, data []byte) ([]byte, error)


package main

import (

    eos "github.com/eoscanada/eos-go"

func main() {
    abi, err := eos.NewABI(strings.NewReader(abiJSON()))
    if err != nil {
        panic(fmt.Errorf("get ABI: %s", err))

    tableDef := abi.TableForName(eos.TableName("activebets"))
    if tableDef == nil {
        panic(fmt.Errorf("table be should be present"))

    bytes, err := abi.DecodeTableRowTyped(tableDef.Type, data())
    if err != nil {
        panic(fmt.Errorf("decode row: %s", err))


func data() []byte {
    bytes, err := hex.DecodeString(`1358285f09db6dc0`)
    if err != nil {
        panic(fmt.Errorf("decode data: %s", err))

    return bytes

func abiJSON() string {
    return `{
			"structs": [
					"name": "bet",
					"fields": [
						{ "name": "id", "type": "uint64" }
			"actions": [],
			"tables": [
					"name": "activebets",
					"type": "bet"

func (*ABI) EncodeAction Uses

func (a *ABI) EncodeAction(actionName ActionName, json []byte) ([]byte, error)

func (*ABI) StructForName Uses

func (a *ABI) StructForName(name string) *StructDef

func (*ABI) TableForName Uses

func (a *ABI) TableForName(name TableName) *TableDef

func (*ABI) TypeNameForNewTypeName Uses

func (a *ABI) TypeNameForNewTypeName(typeName string) (resolvedTypeName string, isAlias bool)

type ABIBinToJSONResp Uses

type ABIBinToJSONResp struct {
    Args M `json:"args"`

type ABIEncoder Uses

type ABIEncoder struct {
    // contains filtered or unexported fields

type ABIErrorMessage Uses

type ABIErrorMessage struct {
    Code    Uint64 `json:"error_code"`
    Message string `json:"error_msg"`

type ABIJSONToBinResp Uses

type ABIJSONToBinResp struct {
    Binargs string `json:"binargs"`

type ABIType Uses

type ABIType struct {
    NewTypeName string `json:"new_type_name"`
    Type        string `json:"type"`

type API Uses

type API struct {
    HttpClient *http.Client
    BaseURL    string
    Signer     Signer
    Debug      bool
    Compress   CompressionType
    // Header is one or more headers to be added to all outgoing calls
    Header                  http.Header
    DefaultMaxCPUUsageMS    uint8
    DefaultMaxNetUsageWords uint32 // in 8-bytes words
    // contains filtered or unexported fields

func New Uses

func New(baseURL string) *API

func (*API) ABIBinToJSON Uses

func (api *API) ABIBinToJSON(code AccountName, action Name, payload HexBytes) (out M, err error)

func (*API) ABIJSONToBin Uses

func (api *API) ABIJSONToBin(code AccountName, action Name, payload M) (out HexBytes, err error)

func (*API) CreateSnapshot Uses

func (api *API) CreateSnapshot() (out *CreateSnapshotResp, err error)

CreateSnapshot will write a snapshot file on a nodeos with `producer_api` plugin loaded.

func (*API) EnableKeepAlives Uses

func (api *API) EnableKeepAlives() bool

func (*API) FixKeepAlives Uses

func (api *API) FixKeepAlives() bool

FixKeepAlives tests the remote server for keepalive support (the main `nodeos` software doesn't in the version from March 22nd 2018). Some endpoints front their node with a keep-alive supporting web server. Adjust the `KeepAlive` support of the client accordingly.

func (*API) GetABI Uses

func (api *API) GetABI(account AccountName) (out *GetABIResp, err error)

func (*API) GetAccount Uses

func (api *API) GetAccount(name AccountName) (out *AccountResp, err error)


api := eos.New(getAPIURL())

account := eos.AccountName("eos.rex")
info, err := api.GetAccount(account)
if err != nil {
    if err == eos.ErrNotFound {
        fmt.Printf("unknown account: %s", account)

    panic(fmt.Errorf("get account: %s", err))

bytes, err := json.Marshal(info)
if err != nil {
    panic(fmt.Errorf("json marshal response: %s", err))


func (*API) GetActions Uses

func (api *API) GetActions(params GetActionsRequest) (out *ActionsResp, err error)

func (*API) GetBlockByID Uses

func (api *API) GetBlockByID(id string) (out *BlockResp, err error)

func (*API) GetBlockByNum Uses

func (api *API) GetBlockByNum(num uint32) (out *BlockResp, err error)

func (*API) GetBlockByNumOrID Uses

func (api *API) GetBlockByNumOrID(query string) (out *SignedBlock, err error)

func (*API) GetBlockByNumOrIDRaw Uses

func (api *API) GetBlockByNumOrIDRaw(query string) (out interface{}, err error)

func (*API) GetCode Uses

func (api *API) GetCode(account AccountName) (out *GetCodeResp, err error)

func (*API) GetCodeHash Uses

func (api *API) GetCodeHash(account AccountName) (out Checksum256, err error)

func (*API) GetControlledAccounts Uses

func (api *API) GetControlledAccounts(controllingAccount string) (out *ControlledAccountsResp, err error)

func (*API) GetCurrencyBalance Uses

func (api *API) GetCurrencyBalance(account AccountName, symbol string, code AccountName) (out []Asset, err error)

func (*API) GetCurrencyStats Uses

func (api *API) GetCurrencyStats(code AccountName, symbol string) (out *GetCurrencyStatsResp, err error)

func (*API) GetDBSize Uses

func (api *API) GetDBSize() (out *DBSizeResp, err error)

func (*API) GetFee Uses

func (api *API) GetFee(tx *Transaction) (out *GetFeeResp, err error)

GetFee call /get_required_fee to get fee

func (*API) GetInfo Uses

func (api *API) GetInfo() (out *InfoResp, err error)


api := eos.New(getAPIURL())

info, err := api.GetInfo()
if err != nil {
    panic(fmt.Errorf("get info: %s", err))

bytes, err := json.Marshal(info)
if err != nil {
    panic(fmt.Errorf("json marshal response: %s", err))


func (*API) GetIntegrityHash Uses

func (api *API) GetIntegrityHash() (out *GetIntegrityHashResp, err error)

GetIntegrityHash will produce a hash corresponding to current state. Requires `producer_api` and useful when loading from a snapshot

func (*API) GetKeyAccounts Uses

func (api *API) GetKeyAccounts(publicKey string) (out *KeyAccountsResp, err error)

func (*API) GetNetConnections Uses

func (api *API) GetNetConnections() (out []*NetConnectionsResp, err error)

func (*API) GetNetStatus Uses

func (api *API) GetNetStatus(host string) (out *NetStatusResp, err error)

func (*API) GetProducers Uses

func (api *API) GetProducers() (out *ProducersResp, err error)

func (*API) GetPublicKeys Uses

func (api *API) GetPublicKeys() (out []*ecc.PublicKey, err error)

func (*API) GetRawABI Uses

func (api *API) GetRawABI(params GetRawABIRequest) (out *GetRawABIResp, err error)

func (*API) GetRawCodeAndABI Uses

func (api *API) GetRawCodeAndABI(account AccountName) (out *GetRawCodeAndABIResp, err error)

func (*API) GetRequiredKeys Uses

func (api *API) GetRequiredKeys(tx *Transaction) (out *GetRequiredKeysResp, err error)

func (*API) GetScheduledTransactions Uses

func (api *API) GetScheduledTransactions() (out *ScheduledTransactionsResp, err error)

GetScheduledTransactions returns the Top 100 scheduled transactions

func (*API) GetScheduledTransactionsWithBounds Uses

func (api *API) GetScheduledTransactionsWithBounds(lower_bound string, limit uint32) (out *ScheduledTransactionsResp, err error)

GetScheduledTransactionsWithBounds returns scheduled transactions within specified bounds

func (*API) GetTableByScope Uses

func (api *API) GetTableByScope(params GetTableByScopeRequest) (out *GetTableByScopeResp, err error)

func (*API) GetTableRows Uses

func (api *API) GetTableRows(params GetTableRowsRequest) (out *GetTableRowsResp, err error)

func (*API) GetTransaction Uses

func (api *API) GetTransaction(id string) (out *TransactionResp, err error)

func (*API) GetTransactionRaw Uses

func (api *API) GetTransactionRaw(id string) (out json.RawMessage, err error)

func (*API) GetTransactions Uses

func (api *API) GetTransactions(name AccountName) (out *TransactionsResp, err error)

func (*API) IsProducerPaused Uses

func (api *API) IsProducerPaused() (out bool, err error)

IsProducerPaused queries the blockchain for the pause statement of block production.

func (*API) ListKeys Uses

func (api *API) ListKeys(walletNames ...string) (out []*ecc.PrivateKey, err error)

func (*API) ListWallets Uses

func (api *API) ListWallets(walletName ...string) (out []string, err error)

func (*API) NetConnect Uses

func (api *API) NetConnect(host string) (out NetConnectResp, err error)

func (*API) NetDisconnect Uses

func (api *API) NetDisconnect(host string) (out NetDisconnectResp, err error)

func (*API) ProducerPause Uses

func (api *API) ProducerPause() error

ProducerPause will pause block production on a nodeos with `producer_api` plugin loaded.

func (*API) ProducerResume Uses

func (api *API) ProducerResume() error

ProducerResume will resume block production on a nodeos with `producer_api` plugin loaded. Obviously, this needs to be a producing node on the producers schedule for it to do anything.

func (*API) PushTransaction Uses

func (api *API) PushTransaction(tx *PackedTransaction) (out *PushTransactionFullResp, err error)

PushTransaction submits a properly filled (tapos), packed and signed transaction to the blockchain.

func (*API) PushTransactionRaw Uses

func (api *API) PushTransactionRaw(tx *PackedTransaction) (out json.RawMessage, err error)

func (*API) SetCustomGetRequiredKeys Uses

func (api *API) SetCustomGetRequiredKeys(f func(tx *Transaction) ([]ecc.PublicKey, error))

func (*API) SetSigner Uses

func (api *API) SetSigner(s Signer)

func (*API) SignPushActions Uses

func (api *API) SignPushActions(a ...*Action) (out *PushTransactionFullResp, err error)

SignPushActions will create a transaction, fill it with default values, sign it and submit it to the chain. It is the highest level function on top of the `/v1/chain/push_transaction` endpoint.

func (*API) SignPushActionsWithOpts Uses

func (api *API) SignPushActionsWithOpts(actions []*Action, opts *TxOptions) (out *PushTransactionFullResp, err error)

func (*API) SignPushTransaction Uses

func (api *API) SignPushTransaction(tx *Transaction, chainID Checksum256, compression CompressionType) (out *PushTransactionFullResp, err error)

SignPushTransaction will sign a transaction and submit it to the chain.

func (*API) SignTransaction Uses

func (api *API) SignTransaction(tx *Transaction, chainID Checksum256, compression CompressionType) (*SignedTransaction, *PackedTransaction, error)

SignTransaction will sign and pack a transaction, but not submit to the chain. It lives on the `api` object because it might query the blockchain to learn which keys are required to sign this particular transaction.

You can override the way we request keys (which defaults to `api.GetRequiredKeys()`) with SetCustomGetRequiredKeys().

To sign a transaction, you need a Signer defined on the `API` object. See SetSigner.

func (*API) WalletCreate Uses

func (api *API) WalletCreate(walletName string) (err error)

func (*API) WalletImportKey Uses

func (api *API) WalletImportKey(walletName, wifPrivKey string) (err error)

WalletImportKey loads a new WIF-encoded key into the wallet.

func (*API) WalletLock Uses

func (api *API) WalletLock(walletName string) (err error)

func (*API) WalletLockAll Uses

func (api *API) WalletLockAll() (err error)

func (*API) WalletOpen Uses

func (api *API) WalletOpen(walletName string) (err error)

func (*API) WalletPublicKeys Uses

func (api *API) WalletPublicKeys() (out []ecc.PublicKey, err error)

func (*API) WalletSetTimeout Uses

func (api *API) WalletSetTimeout(timeout int32) (err error)

func (*API) WalletSignTransaction Uses

func (api *API) WalletSignTransaction(tx *SignedTransaction, chainID []byte, pubKeys ...ecc.PublicKey) (out *WalletSignTransactionResp, err error)

func (*API) WalletUnlock Uses

func (api *API) WalletUnlock(walletName, password string) (err error)

type APIError Uses

type APIError struct {
    Code        int    `json:"code"` // http code
    Message     string `json:"message"`
    ErrorStruct struct {
        Code    int              `json:"code"` // https://docs.google.com/spreadsheets/d/1uHeNDLnCVygqYK-V01CFANuxUwgRkNkrmeLm9MLqu9c/edit#gid=0
        Name    string           `json:"name"`
        What    string           `json:"what"`
        Details []APIErrorDetail `json:"details"`
    }   `json:"error"`

APIError represents the errors as reported by the server

func NewAPIError Uses

func NewAPIError(httpCode int, msg string, e eoserr.Error) *APIError

func (APIError) Error Uses

func (e APIError) Error() string

func (APIError) IsUnknownKeyError Uses

func (e APIError) IsUnknownKeyError() bool

IsUnknowKeyError determines if the APIError is a 500 error with an `unknown key` message in at least one of the detail element. Some endpoint like `/v1/chain/get_account` returns a body in the form:


 	"code": 500,
 	"message": "Internal Service Error",
 	"error": {
 		"code": 0,
 		"name": "exception",
 		"what": "unspecified",
 		"details": [
		 			"message": "unknown key (<... redacted ...>): (0 eos.rex)",
		 			"file": "http_plugin.cpp",
		 			"line_number": 589,
		 			"method": "handle_exception"


This will check if root code is a 500, that inner error code is 0 and there is a detail message starting with prefix `"unknown key"`.

type APIErrorDetail Uses

type APIErrorDetail struct {
    Message    string `json:"message"`
    File       string `json:"file"`
    LineNumber int    `json:"line_number"`
    Method     string `json:"method"`

type AccountName Uses

type AccountName Name

func AN Uses

func AN(in string) AccountName

type AccountResourceLimit Uses

type AccountResourceLimit struct {
    Used      Int64 `json:"used"`
    Available Int64 `json:"available"`
    Max       Int64 `json:"max"`

type AccountResp Uses

type AccountResp struct {
    AccountName            AccountName          `json:"account_name"`
    Privileged             bool                 `json:"privileged"`
    LastCodeUpdate         JSONTime             `json:"last_code_update"`
    Created                JSONTime             `json:"created"`
    CoreLiquidBalance      Asset                `json:"core_liquid_balance"`
    RAMQuota               Int64                `json:"ram_quota"`
    RAMUsage               Int64                `json:"ram_usage"`
    NetWeight              Int64                `json:"net_weight"`
    CPUWeight              Int64                `json:"cpu_weight"`
    NetLimit               AccountResourceLimit `json:"net_limit"`
    CPULimit               AccountResourceLimit `json:"cpu_limit"`
    Permissions            []Permission         `json:"permissions"`
    TotalResources         TotalResources       `json:"total_resources"`
    SelfDelegatedBandwidth DelegatedBandwidth   `json:"self_delegated_bandwidth"`
    RefundRequest          *RefundRequest       `json:"refund_request"`
    VoterInfo              VoterInfo            `json:"voter_info"`

type Action Uses

type Action struct {
    Account       AccountName       `json:"account"`
    Name          ActionName        `json:"name"`
    Authorization []PermissionLevel `json:"authorization,omitempty"`


func (Action) Digest Uses

func (a Action) Digest() Checksum256

func (*Action) MapToRegisteredAction Uses

func (a *Action) MapToRegisteredAction() error

func (*Action) MarshalJSON Uses

func (a *Action) MarshalJSON() ([]byte, error)

type ActionData Uses

type ActionData struct {
    HexData HexBytes    `json:"hex_data,omitempty"`
    Data    interface{} `json:"data,omitempty" eos:"-"`
    // contains filtered or unexported fields

func NewActionData Uses

func NewActionData(obj interface{}) ActionData

func NewActionDataFromHexData Uses

func NewActionDataFromHexData(data []byte) ActionData

func (*ActionData) EncodeActionData Uses

func (data *ActionData) EncodeActionData() ([]byte, error)

func (*ActionData) SetToServer Uses

func (a *ActionData) SetToServer(toServer bool)

type ActionDef Uses

type ActionDef struct {
    Name              ActionName `json:"name"`
    Type              string     `json:"type"`
    RicardianContract string     `json:"ricardian_contract"`

type ActionName Uses

type ActionName Name

func ActN Uses

func ActN(in string) ActionName

type ActionResp Uses

type ActionResp struct {
    GlobalSeq  JSONInt64   `json:"global_action_seq"`
    AccountSeq JSONInt64   `json:"account_action_seq"`
    BlockNum   uint32      `json:"block_num"`
    BlockTime  JSONTime    `json:"block_time"`
    Trace      ActionTrace `json:"action_trace"`

type ActionTrace Uses

type ActionTrace struct {
    Receipt struct {
        Receiver        AccountName                    `json:"receiver"`
        ActionDigest    string                         `json:"act_digest"`
        GlobalSequence  Uint64                         `json:"global_sequence"`
        ReceiveSequence Uint64                         `json:"recv_sequence"`
        AuthSequence    []TransactionTraceAuthSequence `json:"auth_sequence"` // [["account", sequence], ["account", sequence]]
        CodeSequence    Uint64                         `json:"code_sequence"`
        ABISequence     Uint64                         `json:"abi_sequence"`
    }   `json:"receipt"`
    Action        *Action        `json:"act"`
    Elapsed       int            `json:"elapsed"`
    CPUUsage      int            `json:"cpu_usage"`
    Console       string         `json:"console"`
    TotalCPUUsage int            `json:"total_cpu_usage"`
    TransactionID Checksum256    `json:"trx_id"`
    InlineTraces  []*ActionTrace `json:"inline_traces"`

type ActionsResp Uses

type ActionsResp struct {
    Actions               []ActionResp `json:"actions"`
    LastIrreversibleBlock uint32       `json:"last_irreversible_block"`

type Asset Uses

type Asset struct {
    Amount Int64

NOTE: there's also ExtendedAsset which is a quantity with the attached contract (AccountName)

func NewAsset Uses

func NewAsset(in string) (out Asset, err error)

NewAsset parses a string like `1000.0000 EOS` into a properly setup Asset

func NewEOSAsset Uses

func NewEOSAsset(amount int64) Asset

func NewEOSAssetFromString Uses

func NewEOSAssetFromString(amount string) (out Asset, err error)

func (Asset) Add Uses

func (a Asset) Add(other Asset) Asset

func (Asset) MarshalJSON Uses

func (a Asset) MarshalJSON() (data []byte, err error)

func (Asset) String Uses

func (a Asset) String() string

func (Asset) Sub Uses

func (a Asset) Sub(other Asset) Asset

func (*Asset) UnmarshalJSON Uses

func (a *Asset) UnmarshalJSON(data []byte) error

type Authority Uses

type Authority struct {
    Threshold uint32                  `json:"threshold"`
    Keys      []KeyWeight             `json:"keys,omitempty"`
    Accounts  []PermissionLevelWeight `json:"accounts,omitempty"`
    Waits     []WaitWeight            `json:"waits,omitempty"`

type Blob Uses

type Blob string

Blob is base64 encoded data https://github.com/EOSIO/fc/blob/0e74738e938c2fe0f36c5238dbc549665ddaef82/include/fc/variant.hpp#L47

func (Blob) Data Uses

func (b Blob) Data() ([]byte, error)

Data returns decoded base64 data

func (Blob) String Uses

func (b Blob) String() string

String returns the blob as a string

type BlockHeader Uses

type BlockHeader struct {
    Timestamp        BlockTimestamp            `json:"timestamp"`
    Producer         AccountName               `json:"producer"`
    Confirmed        uint16                    `json:"confirmed"`
    Previous         Checksum256               `json:"previous"`
    TransactionMRoot Checksum256               `json:"transaction_mroot"`
    ActionMRoot      Checksum256               `json:"action_mroot"`
    ScheduleVersion  uint32                    `json:"schedule_version"`
    NewProducers     *OptionalProducerSchedule `json:"new_producers" eos:"optional"`
    HeaderExtensions []*Extension              `json:"header_extensions"`

func (*BlockHeader) BlockID Uses

func (b *BlockHeader) BlockID() (Checksum256, error)

func (*BlockHeader) BlockNumber Uses

func (b *BlockHeader) BlockNumber() uint32

type BlockResp Uses

type BlockResp struct {
    ID             Checksum256 `json:"id"`
    BlockNum       uint32      `json:"block_num"`
    RefBlockPrefix uint32      `json:"ref_block_prefix"`

type BlockTimestamp Uses

type BlockTimestamp struct {

func (BlockTimestamp) MarshalJSON Uses

func (t BlockTimestamp) MarshalJSON() ([]byte, error)

func (*BlockTimestamp) UnmarshalJSON Uses

func (t *BlockTimestamp) UnmarshalJSON(data []byte) (err error)

type Bool Uses

type Bool bool

func (*Bool) UnmarshalJSON Uses

func (b *Bool) UnmarshalJSON(data []byte) error

type ChainSizeMessage Uses

type ChainSizeMessage struct {
    LastIrreversibleBlockNum uint32      `json:"last_irreversible_block_num"`
    LastIrreversibleBlockID  Checksum256 `json:"last_irreversible_block_id"`
    HeadNum                  uint32      `json:"head_num"`
    HeadID                   Checksum256 `json:"head_id"`

func (*ChainSizeMessage) GetType Uses

func (m *ChainSizeMessage) GetType() P2PMessageType

type Checksum160 Uses

type Checksum160 []byte

func (Checksum160) MarshalJSON Uses

func (t Checksum160) MarshalJSON() ([]byte, error)

func (*Checksum160) UnmarshalJSON Uses

func (t *Checksum160) UnmarshalJSON(data []byte) (err error)

type Checksum256 Uses

type Checksum256 []byte

func (Checksum256) MarshalJSON Uses

func (t Checksum256) MarshalJSON() ([]byte, error)

func (Checksum256) String Uses

func (t Checksum256) String() string

func (*Checksum256) UnmarshalJSON Uses

func (t *Checksum256) UnmarshalJSON(data []byte) (err error)

type Checksum512 Uses

type Checksum512 []byte

func (Checksum512) MarshalJSON Uses

func (t Checksum512) MarshalJSON() ([]byte, error)

func (*Checksum512) UnmarshalJSON Uses

func (t *Checksum512) UnmarshalJSON(data []byte) (err error)

type ClausePair Uses

type ClausePair struct {
    ID   string `json:"id"`
    Body string `json:"body"`

ClausePair represents clauses, related to Ricardian Contracts.

type CompressionType Uses

type CompressionType uint8

func (CompressionType) MarshalJSON Uses

func (c CompressionType) MarshalJSON() ([]byte, error)

func (CompressionType) String Uses

func (c CompressionType) String() string

func (*CompressionType) UnmarshalJSON Uses

func (c *CompressionType) UnmarshalJSON(data []byte) error

type ControlledAccountsResp Uses

type ControlledAccountsResp struct {
    ControlledAccounts []string `json:"controlled_accounts"`

type CreateSnapshotResp Uses

type CreateSnapshotResp struct {
    SnapshotName string `json:"snapshot_name"`
    HeadBlockID  string `json:"head_block_id"`

type Currency Uses

type Currency struct {
    Precision uint8
    Name      CurrencyName

type CurrencyBalanceResp Uses

type CurrencyBalanceResp struct {
    EOSBalance        Asset    `json:"eos_balance"`
    StakedBalance     Asset    `json:"staked_balance"`
    UnstakingBalance  Asset    `json:"unstaking_balance"`
    LastUnstakingTime JSONTime `json:"last_unstaking_time"`

type CurrencyName Uses

type CurrencyName string

type DBSizeResp Uses

type DBSizeResp struct {
    FreeBytes Int64 `json:"free_bytes"`
    UsedBytes Int64 `json:"used_bytes"`
    Size      Int64 `json:"size"`
    Indices   []struct {
        Index    string `json:"index"`
        RowCount Int64  `json:"row_count"`
    }   `json:"indices"`

type DataAccess Uses

type DataAccess struct {
    Type     string      `json:"type"` // "write", "read"?
    Code     AccountName `json:"code"`
    Scope    AccountName `json:"scope"`
    Sequence int         `json:"sequence"`

type Decoder Uses

type Decoder struct {
    // contains filtered or unexported fields

Decoder implements the EOS unpacking, similar to FC_BUFFER

func NewDecoder Uses

func NewDecoder(data []byte) *Decoder

func (*Decoder) Decode Uses

func (d *Decoder) Decode(v interface{}) (err error)

func (*Decoder) DecodeActions Uses

func (d *Decoder) DecodeActions(decode bool)

func (*Decoder) DecodeP2PMessage Uses

func (d *Decoder) DecodeP2PMessage(decode bool)

func (*Decoder) ReadActionData Uses

func (d *Decoder) ReadActionData(action *Action) (err error)

func (*Decoder) ReadAsset Uses

func (d *Decoder) ReadAsset() (out Asset, err error)

func (*Decoder) ReadBlockTimestamp Uses

func (d *Decoder) ReadBlockTimestamp() (out BlockTimestamp, err error)

func (*Decoder) ReadBool Uses

func (d *Decoder) ReadBool() (out bool, err error)

func (*Decoder) ReadByte Uses

func (d *Decoder) ReadByte() (out byte, err error)

func (*Decoder) ReadByteArray Uses

func (d *Decoder) ReadByteArray() (out []byte, err error)

func (*Decoder) ReadChecksum160 Uses

func (d *Decoder) ReadChecksum160() (out Checksum160, err error)

func (*Decoder) ReadChecksum256 Uses

func (d *Decoder) ReadChecksum256() (out Checksum256, err error)

func (*Decoder) ReadChecksum512 Uses

func (d *Decoder) ReadChecksum512() (out Checksum512, err error)

func (*Decoder) ReadCurrencyName Uses

func (d *Decoder) ReadCurrencyName() (out CurrencyName, err error)

func (*Decoder) ReadExtendedAsset Uses

func (d *Decoder) ReadExtendedAsset() (out ExtendedAsset, err error)

func (*Decoder) ReadFloat32 Uses

func (d *Decoder) ReadFloat32() (out float32, err error)

func (*Decoder) ReadFloat64 Uses

func (d *Decoder) ReadFloat64() (out float64, err error)

func (*Decoder) ReadInt16 Uses

func (d *Decoder) ReadInt16() (out int16, err error)

func (*Decoder) ReadInt32 Uses

func (d *Decoder) ReadInt32() (out int32, err error)

func (*Decoder) ReadInt64 Uses

func (d *Decoder) ReadInt64() (out int64, err error)

func (*Decoder) ReadInt8 Uses

func (d *Decoder) ReadInt8() (out int8, err error)

func (*Decoder) ReadJSONTime Uses

func (d *Decoder) ReadJSONTime() (jsonTime JSONTime, err error)

func (*Decoder) ReadName Uses

func (d *Decoder) ReadName() (out Name, err error)

func (*Decoder) ReadP2PMessageEnvelope Uses

func (d *Decoder) ReadP2PMessageEnvelope() (out *Packet, err error)

func (*Decoder) ReadPublicKey Uses

func (d *Decoder) ReadPublicKey() (out ecc.PublicKey, err error)

func (*Decoder) ReadSignature Uses

func (d *Decoder) ReadSignature() (out ecc.Signature, err error)

func (*Decoder) ReadString Uses

func (d *Decoder) ReadString() (out string, err error)

func (*Decoder) ReadSymbol Uses

func (d *Decoder) ReadSymbol() (out *Symbol, err error)

func (*Decoder) ReadSymbolCode Uses

func (d *Decoder) ReadSymbolCode() (out SymbolCode, err error)

func (*Decoder) ReadTimePoint Uses

func (d *Decoder) ReadTimePoint() (out TimePoint, err error)

func (*Decoder) ReadTimePointSec Uses

func (d *Decoder) ReadTimePointSec() (out TimePointSec, err error)

func (*Decoder) ReadTstamp Uses

func (d *Decoder) ReadTstamp() (out Tstamp, err error)

func (*Decoder) ReadUInt8 Uses

func (d *Decoder) ReadUInt8() (out uint8, err error)

func (*Decoder) ReadUint128 Uses

func (d *Decoder) ReadUint128(typeName string) (out Uint128, err error)

func (*Decoder) ReadUint16 Uses

func (d *Decoder) ReadUint16() (out uint16, err error)

func (*Decoder) ReadUint32 Uses

func (d *Decoder) ReadUint32() (out uint32, err error)

func (*Decoder) ReadUint64 Uses

func (d *Decoder) ReadUint64() (out uint64, err error)

func (*Decoder) ReadUvarint32 Uses

func (d *Decoder) ReadUvarint32() (out uint32, err error)

func (*Decoder) ReadUvarint64 Uses

func (d *Decoder) ReadUvarint64() (uint64, error)

func (*Decoder) ReadVarint32 Uses

func (d *Decoder) ReadVarint32() (out int32, err error)

func (*Decoder) ReadVarint64 Uses

func (d *Decoder) ReadVarint64() (out int64, err error)

type DeferredTransaction Uses

type DeferredTransaction struct {

    SenderID   uint32      `json:"sender_id"`
    Sender     AccountName `json:"sender"`
    DelayUntil JSONTime    `json:"delay_until"`

type DelegatedBandwidth Uses

type DelegatedBandwidth struct {
    From      AccountName `json:"from"`
    To        AccountName `json:"to"`
    NetWeight Asset       `json:"net_weight"`
    CPUWeight Asset       `json:"cpu_weight"`

type Encoder Uses

type Encoder struct {
    Order binary.ByteOrder
    // contains filtered or unexported fields

-------------------------------------------------------------- Encoder implements the EOS packing, similar to FC_BUFFER --------------------------------------------------------------

func NewEncoder Uses

func NewEncoder(w io.Writer) *Encoder

func (*Encoder) Encode Uses

func (e *Encoder) Encode(v interface{}) (err error)

type ExtendedAsset Uses

type ExtendedAsset struct {
    Asset    Asset `json:"asset"`
    Contract AccountName

type Extension Uses

type Extension struct {
    Type uint16
    Data HexBytes

func (*Extension) MarshalJSON Uses

func (e *Extension) MarshalJSON() ([]byte, error)

func (*Extension) UnmarshalJSON Uses

func (e *Extension) UnmarshalJSON(data []byte) error

type FieldDef Uses

type FieldDef struct {
    Name string `json:"name"`
    Type string `json:"type"`

type Float128 Uses

type Float128 Uint128

func (Float128) MarshalJSON Uses

func (i Float128) MarshalJSON() (data []byte, err error)

func (*Float128) UnmarshalJSON Uses

func (i *Float128) UnmarshalJSON(data []byte) error

type GetABIResp Uses

type GetABIResp struct {
    AccountName AccountName `json:"account_name"`
    ABI         ABI         `json:"abi"`

type GetActionsRequest Uses

type GetActionsRequest struct {
    AccountName AccountName `json:"account_name"`
    Pos         int64       `json:"pos"`
    Offset      int64       `json:"offset"`

type GetCodeHashResp Uses

type GetCodeHashResp struct {
    AccountName AccountName `json:"account_name"`
    CodeHash    string      `json:"code_hash"`

type GetCodeResp Uses

type GetCodeResp struct {
    AccountName AccountName `json:"account_name"`
    CodeHash    string      `json:"code_hash"`
    WASM        string      `json:"wasm"`
    ABI         ABI         `json:"abi"`

type GetCurrencyStatsResp Uses

type GetCurrencyStatsResp struct {
    Supply    Asset       `json:"supply"`
    MaxSupply Asset       `json:"max_supply"`
    Issuer    AccountName `json:"issuer"`

type GetFeeResp Uses

type GetFeeResp struct {
    Fee Asset `json:"required_fee"`

type GetIntegrityHashResp Uses

type GetIntegrityHashResp struct {
    HeadBlockID  string `json:"head_block_id"`
    SnapshotName string `json:"integrity_hash"`

type GetRawABIRequest Uses

type GetRawABIRequest struct {
    AccountName string      `json:"account_name"`
    ABIHash     Checksum256 `json:"abi_hash,omitempty"`

type GetRawABIResp Uses

type GetRawABIResp struct {
    AccountName string      `json:"account_name"`
    CodeHash    Checksum256 `json:"code_hash"`
    ABIHash     Checksum256 `json:"abi_hash"`
    ABI         Blob        `json:"abi"`

type GetRawCodeAndABIResp Uses

type GetRawCodeAndABIResp struct {
    AccountName  AccountName `json:"account_name"`
    WASMasBase64 string      `json:"wasm"`
    ABIasBase64  string      `json:"abi"`

type GetRequiredKeysResp Uses

type GetRequiredKeysResp struct {
    RequiredKeys []ecc.PublicKey `json:"required_keys"`

type GetTableByScopeRequest Uses

type GetTableByScopeRequest struct {
    Code       string `json:"code"`
    Table      string `json:"table"`
    LowerBound string `json:"lower_bound,omitempty"`
    UpperBound string `json:"upper_bound,omitempty"`
    Limit      uint32 `json:"limit,omitempty"`

type GetTableByScopeResp Uses

type GetTableByScopeResp struct {
    More bool            `json:"more"`
    Rows json.RawMessage `json:"rows"`

type GetTableRowsRequest Uses

type GetTableRowsRequest struct {
    Code       string `json:"code"` // Contract "code" account where table lives
    Scope      string `json:"scope"`
    Table      string `json:"table"`
    LowerBound string `json:"lower_bound,omitempty"`
    UpperBound string `json:"upper_bound,omitempty"`
    Limit      uint32 `json:"limit,omitempty"`          // defaults to 10 => chain_plugin.hpp:struct get_table_rows_params
    KeyType    string `json:"key_type,omitempty"`       // The key type of --index, primary only supports (i64), all others support (i64, i128, i256, float64, float128, ripemd160, sha256). Special type 'name' indicates an account name.
    Index      string `json:"index_position,omitempty"` // Index number, 1 - primary (first), 2 - secondary index (in order defined by multi_index), 3 - third index, etc. Number or name of index can be specified, e.g. 'secondary' or '2'.
    EncodeType string `json:"encode_type,omitempty"`    // The encoding type of key_type (i64 , i128 , float64, float128) only support decimal encoding e.g. 'dec'" "i256 - supports both 'dec' and 'hex', ripemd160 and sha256 is 'hex' only
    JSON       bool   `json:"json"`                     // JSON output if true, binary if false

type GetTableRowsResp Uses

type GetTableRowsResp struct {
    More bool            `json:"more"`
    Rows json.RawMessage `json:"rows"` // defer loading, as it depends on `JSON` being true/false.

func (*GetTableRowsResp) BinaryToStructs Uses

func (resp *GetTableRowsResp) BinaryToStructs(v interface{}) error

func (*GetTableRowsResp) JSONToStructs Uses

func (resp *GetTableRowsResp) JSONToStructs(v interface{}) error

type Global Uses

type Global struct {
    MaxBlockNetUsage               int     `json:"max_block_net_usage"`
    TargetBlockNetUsagePct         int     `json:"target_block_net_usage_pct"`
    MaxTransactionNetUsage         int     `json:"max_transaction_net_usage"`
    BasePerTransactionNetUsage     int     `json:"base_per_transaction_net_usage"`
    NetUsageLeeway                 int     `json:"net_usage_leeway"`
    ContextFreeDiscountNetUsageNum int     `json:"context_free_discount_net_usage_num"`
    ContextFreeDiscountNetUsageDen int     `json:"context_free_discount_net_usage_den"`
    MaxBlockCPUUsage               int     `json:"max_block_cpu_usage"`
    TargetBlockCPUUsagePct         int     `json:"target_block_cpu_usage_pct"`
    MaxTransactionCPUUsage         int     `json:"max_transaction_cpu_usage"`
    MinTransactionCPUUsage         int     `json:"min_transaction_cpu_usage"`
    MaxTransactionLifetime         int     `json:"max_transaction_lifetime"`
    DeferredTrxExpirationWindow    int     `json:"deferred_trx_expiration_window"`
    MaxTransactionDelay            int     `json:"max_transaction_delay"`
    MaxInlineActionSize            int     `json:"max_inline_action_size"`
    MaxInlineActionDepth           int     `json:"max_inline_action_depth"`
    MaxAuthorityDepth              int     `json:"max_authority_depth"`
    MaxRAMSize                     string  `json:"max_ram_size"`
    TotalRAMBytesReserved          Int64   `json:"total_ram_bytes_reserved"`
    TotalRAMStake                  Int64   `json:"total_ram_stake"`
    LastProducerScheduleUpdate     string  `json:"last_producer_schedule_update"`
    LastPervoteBucketFill          int64   `json:"last_pervote_bucket_fill,string"`
    PervoteBucket                  int     `json:"pervote_bucket"`
    PerblockBucket                 int     `json:"perblock_bucket"`
    TotalUnpaidBlocks              int     `json:"total_unpaid_blocks"`
    TotalActivatedStake            float64 `json:"total_activated_stake,string"`
    ThreshActivatedStakeTime       int64   `json:"thresh_activated_stake_time,string"`
    LastProducerScheduleSize       int     `json:"last_producer_schedule_size"`
    TotalProducerVoteWeight        float64 `json:"total_producer_vote_weight,string"`
    LastNameClose                  string  `json:"last_name_close"`

type GoAwayMessage Uses

type GoAwayMessage struct {
    Reason GoAwayReason `json:"reason"`
    NodeID Checksum256  `json:"node_id"`

func (*GoAwayMessage) GetType Uses

func (m *GoAwayMessage) GetType() P2PMessageType

func (*GoAwayMessage) String Uses

func (m *GoAwayMessage) String() string

type GoAwayReason Uses

type GoAwayReason uint8

func (GoAwayReason) String Uses

func (r GoAwayReason) String() string

type HandshakeMessage Uses

type HandshakeMessage struct {
    // net_plugin/protocol.hpp handshake_message
    NetworkVersion           uint16        `json:"network_version"`
    ChainID                  Checksum256   `json:"chain_id"`
    NodeID                   Checksum256   `json:"node_id"` // sha256
    Key                      ecc.PublicKey `json:"key"`     // can be empty, producer key, or peer key
    Time                     Tstamp        `json:"time"`    // time?!
    Token                    Checksum256   `json:"token"`   // digest of time to prove we own the private `key`
    Signature                ecc.Signature `json:"sig"`     // can be empty if no key, signature of the digest above
    P2PAddress               string        `json:"p2p_address"`
    LastIrreversibleBlockNum uint32        `json:"last_irreversible_block_num"`
    LastIrreversibleBlockID  Checksum256   `json:"last_irreversible_block_id"`
    HeadNum                  uint32        `json:"head_num"`
    HeadID                   Checksum256   `json:"head_id"`
    OS                       string        `json:"os"`
    Agent                    string        `json:"agent"`
    Generation               int16         `json:"generation"`

func (*HandshakeMessage) GetType Uses

func (m *HandshakeMessage) GetType() P2PMessageType

func (*HandshakeMessage) String Uses

func (m *HandshakeMessage) String() string

type HexBytes Uses

type HexBytes []byte

func (HexBytes) MarshalJSON Uses

func (t HexBytes) MarshalJSON() ([]byte, error)

func (HexBytes) String Uses

func (t HexBytes) String() string

func (*HexBytes) UnmarshalJSON Uses

func (t *HexBytes) UnmarshalJSON(data []byte) (err error)

type IDListMode Uses

type IDListMode byte

type InfoResp Uses

type InfoResp struct {
    ServerVersion            string      `json:"server_version"` // "2cc40a4e"
    ChainID                  Checksum256 `json:"chain_id"`
    HeadBlockNum             uint32      `json:"head_block_num"`              // 2465669,
    LastIrreversibleBlockNum uint32      `json:"last_irreversible_block_num"` // 2465655
    LastIrreversibleBlockID  Checksum256 `json:"last_irreversible_block_id"`  // "00000008f98f0580d7efe7abc60abaaf8a865c9428a4267df30ff7d1937a1084"
    HeadBlockID              Checksum256 `json:"head_block_id"`               // "00259f856bfa142d1d60aff77e70f0c4f3eab30789e9539d2684f9f8758f1b88",
    HeadBlockTime            JSONTime    `json:"head_block_time"`             //  "2018-02-02T04:19:32"
    HeadBlockProducer        AccountName `json:"head_block_producer"`         // "inita"

    VirtualBlockCPULimit Int64  `json:"virtual_block_cpu_limit"`
    VirtualBlockNetLimit Int64  `json:"virtual_block_net_limit"`
    BlockCPULimit        Int64  `json:"block_cpu_limit"`
    BlockNetLimit        Int64  `json:"block_net_limit"`
    ServerVersionString  string `json:"server_version_string"`

type Int128 Uses

type Int128 Uint128

func (Int128) MarshalJSON Uses

func (i Int128) MarshalJSON() (data []byte, err error)

func (*Int128) UnmarshalJSON Uses

func (i *Int128) UnmarshalJSON(data []byte) error

type Int64 Uses

type Int64 int64

func (Int64) MarshalJSON Uses

func (i Int64) MarshalJSON() (data []byte, err error)

func (*Int64) UnmarshalJSON Uses

func (i *Int64) UnmarshalJSON(data []byte) error

type JSONFloat64 Uses

type JSONFloat64 float64

func (*JSONFloat64) UnmarshalJSON Uses

func (f *JSONFloat64) UnmarshalJSON(data []byte) error

type JSONInt64 Uses

type JSONInt64 = Int64

JSONInt64 is deprecated in favor of Int64.

type JSONTime Uses

type JSONTime struct {

func ParseJSONTime Uses

func ParseJSONTime(date string) (JSONTime, error)

ParseJSONTime will parse a string into a JSONTime object

func (JSONTime) MarshalJSON Uses

func (t JSONTime) MarshalJSON() ([]byte, error)

func (*JSONTime) UnmarshalJSON Uses

func (t *JSONTime) UnmarshalJSON(data []byte) (err error)

type KeyAccountsResp Uses

type KeyAccountsResp struct {
    AccountNames []string `json:"account_names"`

type KeyBag Uses

type KeyBag struct {
    Keys []*ecc.PrivateKey `json:"keys"`

KeyBag holds private keys in memory, for signing transactions.

func NewKeyBag Uses

func NewKeyBag() *KeyBag

func (*KeyBag) Add Uses

func (b *KeyBag) Add(wifKey string) error

func (*KeyBag) AvailableKeys Uses

func (b *KeyBag) AvailableKeys() (out []ecc.PublicKey, err error)

func (*KeyBag) ImportFromFile Uses

func (b *KeyBag) ImportFromFile(path string) error

func (*KeyBag) ImportPrivateKey Uses

func (b *KeyBag) ImportPrivateKey(wifPrivKey string) (err error)

func (*KeyBag) Sign Uses

func (b *KeyBag) Sign(tx *SignedTransaction, chainID []byte, requiredKeys ...ecc.PublicKey) (*SignedTransaction, error)

func (*KeyBag) SignDigest Uses

func (b *KeyBag) SignDigest(digest []byte, requiredKey ecc.PublicKey) (ecc.Signature, error)

type KeyWeight Uses

type KeyWeight struct {
    PublicKey ecc.PublicKey `json:"key"`
    Weight    uint16        `json:"weight"` // weight_type

type M Uses

type M map[string]interface{}

type MessageReflectTypes Uses

type MessageReflectTypes struct {
    Name        string
    ReflectType reflect.Type

type MyStruct Uses

type MyStruct struct {
    Balance uint64

type Name Uses

type Name string

type NetConnectResp Uses

type NetConnectResp string

type NetConnectionsResp Uses

type NetConnectionsResp struct {
    Peer          string           `json:"peer"`
    Connecting    bool             `json:"connecting"`
    Syncing       bool             `json:"syncing"`
    LastHandshake HandshakeMessage `json:"last_handshake"`


type NetDisconnectResp Uses

type NetDisconnectResp string

type NetStatusResp Uses

type NetStatusResp struct {

type NoticeMessage Uses

type NoticeMessage struct {
    KnownTrx    OrderedBlockIDs `json:"known_trx"`
    KnownBlocks OrderedBlockIDs `json:"known_blocks"`

func (*NoticeMessage) GetType Uses

func (m *NoticeMessage) GetType() P2PMessageType

func (*NoticeMessage) String Uses

func (n *NoticeMessage) String() string

type OptionalProducerSchedule Uses

type OptionalProducerSchedule struct {

type OrderedBlockIDs Uses

type OrderedBlockIDs struct {
    Mode    [4]byte       `json:"mode"`
    Pending uint32        `json:"pending"`
    IDs     []Checksum256 `json:"ids"`

func (*OrderedBlockIDs) String Uses

func (o *OrderedBlockIDs) String() string

type OrderedTransactionIDs Uses

type OrderedTransactionIDs struct {
    Mode    [4]byte       `json:"mode"`
    Pending uint32        `json:"pending"`
    IDs     []Checksum256 `json:"ids"`

type P2PMessage Uses

type P2PMessage interface {
    GetType() P2PMessageType

type P2PMessageType Uses

type P2PMessageType byte
const (
    HandshakeMessageType P2PMessageType = iota // 0
    GoAwayMessageType // 2
    NoticeMessageType // 4
    SyncRequestMessageType       // 6
    SignedBlockType              // 7
    PackedTransactionMessageType // 8

func NewMessageType Uses

func NewMessageType(aType byte) (t P2PMessageType, err error)

func (P2PMessageType) Name Uses

func (t P2PMessageType) Name() (string, bool)

type PackedTransaction Uses

type PackedTransaction struct {
    Signatures            []ecc.Signature `json:"signatures"`
    Compression           CompressionType `json:"compression"` // in C++, it's an enum, not sure how it Binary-marshals..
    PackedContextFreeData HexBytes        `json:"packed_context_free_data"`
    PackedTransaction     HexBytes        `json:"packed_trx"`
    // contains filtered or unexported fields

PackedTransaction represents a fully packed transaction, with signatures, and all. They circulate like that on the P2P net, and that's how they are stored.

func (*PackedTransaction) ID Uses

func (p *PackedTransaction) ID() (Checksum256, error)

ID returns the hash of a transaction.

func (*PackedTransaction) Unpack Uses

func (p *PackedTransaction) Unpack() (signedTx *SignedTransaction, err error)

Unpack decodes the bytestream of the transaction, and attempts to decode the registered actions.


package main

import (

    eos "github.com/eoscanada/eos-go"

func main() {
    var packedTrx *eos.PackedTransaction
    err := json.Unmarshal(packedTrxData(), &packedTrx)
    if err != nil {
        panic(fmt.Errorf("unmarshaling to PackedTransaction: %s", err))

    var signedTrx *eos.SignedTransaction
    signedTrx, err = packedTrx.Unpack()
    if err != nil {
        panic(fmt.Errorf("unpacking transaction: %s", err))

    fmt.Printf("%#v\n", signedTrx.Actions)

func packedTrxData() []byte {
    return []byte(`
		"signatures": [
		"compression": "none",
		"packed_context_free_data": "",
		"packed_trx": "a67a815c0d358ee0065800000000011082422e6575305500405647ed48b1ba0140a7c3066575305500000000489aa6b94a1c88ee2531ab18a800201ee9053cde8078023ba1229389f58a0c72ef7fe9ee942e6be7705021630a03e206b016a9711064ee11cc894100701a1160f12c37000903729a1b60f3c7b0117900"

func (*PackedTransaction) UnpackBare Uses

func (p *PackedTransaction) UnpackBare() (signedTx *SignedTransaction, err error)

UnpackBare decodes the transcation payload, but doesn't decode the nested action data structure. See also `Unpack`.

type PackedTransactionMessage Uses

type PackedTransactionMessage struct {

func (*PackedTransactionMessage) GetType Uses

func (m *PackedTransactionMessage) GetType() P2PMessageType

func (PackedTransactionMessage) String Uses

func (m PackedTransactionMessage) String() string

type Packet Uses

type Packet struct {
    Length     uint32         `json:"length"`
    Type       P2PMessageType `json:"type"`
    Payload    []byte         `json:"-"`
    P2PMessage P2PMessage     `json:"message" eos:"-"`
    Raw        []byte         `json:"-"`

func ReadPacket Uses

func ReadPacket(r io.Reader) (packet *Packet, err error)

type Permission Uses

type Permission struct {
    PermName     string    `json:"perm_name"`
    Parent       string    `json:"parent"`
    RequiredAuth Authority `json:"required_auth"`

type PermissionLevel Uses

type PermissionLevel struct {
    Actor      AccountName    `json:"actor"`
    Permission PermissionName `json:"permission"`

func NewPermissionLevel Uses

func NewPermissionLevel(in string) (out PermissionLevel, err error)

NewPermissionLevel parses strings like `account@active`, `otheraccount@owner` and builds a PermissionLevel struct. It validates that there is a single optional @ (where permission defaults to 'active'), and validates length of account and permission names.

type PermissionLevelWeight Uses

type PermissionLevelWeight struct {
    Permission PermissionLevel `json:"permission"`
    Weight     uint16          `json:"weight"` // weight_type

type PermissionName Uses

type PermissionName Name

func PN Uses

func PN(in string) PermissionName

type ProcessedTransaction Uses

type ProcessedTransaction struct {
    Transaction SignedTransaction `json:"trx"`

type Producer Uses

type Producer struct {
    Owner         string      `json:"owner"`
    TotalVotes    float64     `json:"total_votes,string"`
    ProducerKey   string      `json:"producer_key"`
    IsActive      int         `json:"is_active"`
    URL           string      `json:"url"`
    UnpaidBlocks  int         `json:"unpaid_blocks"`
    LastClaimTime JSONFloat64 `json:"last_claim_time"`
    Location      int         `json:"location"`

type ProducerChange Uses

type ProducerChange struct {

type ProducerKey Uses

type ProducerKey struct {
    AccountName     AccountName   `json:"producer_name"`
    BlockSigningKey ecc.PublicKey `json:"block_signing_key"`

type ProducerSchedule Uses

type ProducerSchedule struct {
    Version   uint32        `json:"version"`
    Producers []ProducerKey `json:"producers"`

type ProducersResp Uses

type ProducersResp struct {
    Producers []Producer `json:"producers"`

type PushTransactionFullResp Uses

type PushTransactionFullResp struct {
    StatusCode    string
    TransactionID string               `json:"transaction_id"`
    Processed     TransactionProcessed `json:"processed"` // WARN: is an `fc::variant` in server..
    BlockID       string               `json:"block_id"`
    BlockNum      uint32               `json:"block_num"`

PushTransactionFullResp unwraps the responses from a successful `push_transaction`. FIXME: REVIEW the actual output, things have moved here.

type PushTransactionShortResp Uses

type PushTransactionShortResp struct {
    TransactionID string `json:"transaction_id"`
    Processed     bool   `json:"processed"` // WARN: is an `fc::variant` in server..

type RefundRequest Uses

type RefundRequest struct {
    Owner       AccountName `json:"owner"`
    RequestTime JSONTime    `json:"request_time"` //         {"name":"request_time", "type":"time_point_sec"},
    NetAmount   Asset       `json:"net_amount"`
    CPUAmount   Asset       `json:"cpu_amount"`

type RequestMessage Uses

type RequestMessage struct {
    ReqTrx    OrderedBlockIDs `json:"req_trx"`
    ReqBlocks OrderedBlockIDs `json:"req_blocks"`

func (*RequestMessage) GetType Uses

func (m *RequestMessage) GetType() P2PMessageType

func (*RequestMessage) String Uses

func (r *RequestMessage) String() string

type SHA256Bytes Uses

type SHA256Bytes = Checksum256

SHA256Bytes is deprecated and renamed to Checksum256 for consistency. Please update your code as this type will eventually be phased out.

type ScheduledTransaction Uses

type ScheduledTransaction struct {
    TransactionID Checksum256 `json:"trx_id"`
    Sender        AccountName `json:"sender"`
    SenderID      string      `json:"sender_id"`
    Payer         AccountName `json:"payer"`
    DelayUntil    JSONTime    `json:"delay_until"`
    Expiration    JSONTime    `json:"expiration"`
    Published     JSONTime    `json:"published"`

    Transaction *Transaction `json:"transaction"`

type ScheduledTransactionsResp Uses

type ScheduledTransactionsResp struct {
    Transactions []ScheduledTransaction `json:"transactions"`
    More         string                 `json:"more"`

type ScopeName Uses

type ScopeName Name

type SequencedTransactionResp Uses

type SequencedTransactionResp struct {
    SeqNum int `json:"seq_num"`

type SetABI Uses

type SetABI struct {
    Account AccountName `json:"account"`
    ABI     ABI         `json:"abi"`

SetABI represents the hard-coded `setabi` action.

type SetCode Uses

type SetCode struct {
    Account   AccountName `json:"account"`
    VMType    byte        `json:"vmtype"`
    VMVersion byte        `json:"vmversion"`
    Code      HexBytes    `json:"code"`

SetCode represents the hard-coded `setcode` action.

type SignedBlock Uses

type SignedBlock struct {
    Transactions    []TransactionReceipt `json:"transactions"`
    BlockExtensions []*Extension         `json:"block_extensions"`

func (*SignedBlock) GetType Uses

func (m *SignedBlock) GetType() P2PMessageType

func (*SignedBlock) String Uses

func (m *SignedBlock) String() string

type SignedBlockHeader Uses

type SignedBlockHeader struct {
    ProducerSignature ecc.Signature `json:"producer_signature"`

type SignedTransaction Uses

type SignedTransaction struct {

    Signatures      []ecc.Signature `json:"signatures"`
    ContextFreeData []HexBytes      `json:"context_free_data"`
    // contains filtered or unexported fields

func NewSignedTransaction Uses

func NewSignedTransaction(tx *Transaction) *SignedTransaction

func (*SignedTransaction) Pack Uses

func (s *SignedTransaction) Pack(compression CompressionType) (*PackedTransaction, error)

func (*SignedTransaction) PackedTransactionAndCFD Uses

func (s *SignedTransaction) PackedTransactionAndCFD() ([]byte, []byte, error)

func (*SignedTransaction) SignedByKeys Uses

func (s *SignedTransaction) SignedByKeys(chainID Checksum256) (out []ecc.PublicKey, err error)

func (*SignedTransaction) String Uses

func (s *SignedTransaction) String() string

type SignedTransactionMessage Uses

type SignedTransactionMessage struct {
    Signatures      []ecc.Signature `json:"signatures"`
    ContextFreeData []byte          `json:"context_free_data"`

type Signer Uses

type Signer interface {
    AvailableKeys() (out []ecc.PublicKey, err error)

    // Sign signs a `tx` transaction. It gets passed a
    // SignedTransaction because it is possible that it holds a few
    // signatures and requests this wallet only to add one or more
    // signatures it requires.
    Sign(tx *SignedTransaction, chainID []byte, requiredKeys ...ecc.PublicKey) (*SignedTransaction, error)

    ImportPrivateKey(wifPrivKey string) error

type StructDef Uses

type StructDef struct {
    Name   string     `json:"name"`
    Base   string     `json:"base"`
    Fields []FieldDef `json:"fields,omitempty"`

type Symbol Uses

type Symbol struct {
    Precision uint8
    Symbol    string
    // contains filtered or unexported fields

NOTE: there's also a new ExtendedSymbol (which includes the contract (as AccountName) on which it is)

func NameToSymbol Uses

func NameToSymbol(name Name) (Symbol, error)

func StringToSymbol Uses

func StringToSymbol(str string) (Symbol, error)

func (Symbol) MustSymbolCode Uses

func (s Symbol) MustSymbolCode() SymbolCode

func (Symbol) String Uses

func (s Symbol) String() string

func (Symbol) SymbolCode Uses

func (s Symbol) SymbolCode() (SymbolCode, error)

func (Symbol) ToName Uses

func (s Symbol) ToName() (string, error)

func (Symbol) ToUint64 Uses

func (s Symbol) ToUint64() (uint64, error)

type SymbolCode Uses

type SymbolCode uint64

func NameToSymbolCode Uses

func NameToSymbolCode(name Name) (SymbolCode, error)

func StringToSymbolCode Uses

func StringToSymbolCode(str string) (SymbolCode, error)

func (SymbolCode) String Uses

func (sc SymbolCode) String() string

func (SymbolCode) ToName Uses

func (sc SymbolCode) ToName() string

type SyncRequestMessage Uses

type SyncRequestMessage struct {
    StartBlock uint32 `json:"start_block"`
    EndBlock   uint32 `json:"end_block"`

func (*SyncRequestMessage) GetType Uses

func (m *SyncRequestMessage) GetType() P2PMessageType

func (*SyncRequestMessage) String Uses

func (m *SyncRequestMessage) String() string

type TableDef Uses

type TableDef struct {
    Name      TableName `json:"name"`
    IndexType string    `json:"index_type"`
    KeyNames  []string  `json:"key_names,omitempty"`
    KeyTypes  []string  `json:"key_types,omitempty"`
    Type      string    `json:"type"`

TableDef defines a table. See libraries/chain/include/eosio/chain/contracts/types.hpp:78

type TableName Uses

type TableName Name

type TimeMessage Uses

type TimeMessage struct {
    Origin      Tstamp `json:"org"`
    Receive     Tstamp `json:"rec"`
    Transmit    Tstamp `json:"xmt"`
    Destination Tstamp `json:"dst"`

func (*TimeMessage) GetType Uses

func (m *TimeMessage) GetType() P2PMessageType

func (*TimeMessage) String Uses

func (t *TimeMessage) String() string

type TimePoint Uses

type TimePoint uint64

TimePoint represents the number of microseconds since EPOCH (Jan 1st 1970)

type TimePointSec Uses

type TimePointSec uint32

TimePointSec represents the number of seconds since EPOCH (Jan 1st 1970)

type TotalResources Uses

type TotalResources struct {
    Owner     AccountName `json:"owner"`
    NetWeight Asset       `json:"net_weight"`
    CPUWeight Asset       `json:"cpu_weight"`
    RAMBytes  Int64       `json:"ram_bytes"`

type Trace Uses

type Trace struct {
    Receiver AccountName `json:"receiver"`
    // Action     Action       `json:"act"` // FIXME: how do we unpack that ? what's on the other side anyway?
    Console    string       `json:"console"`
    DataAccess []DataAccess `json:"data_access"`

type Transaction Uses

type Transaction struct {

    ContextFreeActions []*Action    `json:"context_free_actions"`
    Actions            []*Action    `json:"actions"`
    Extensions         []*Extension `json:"transaction_extensions"`

func NewTransaction Uses

func NewTransaction(actions []*Action, opts *TxOptions) *Transaction

NewTransaction creates a transaction. Unless you plan on adding HeadBlockID later, to be complete, opts should contain it. Sign

func (*Transaction) Fill Uses

func (tx *Transaction) Fill(headBlockID Checksum256, delaySecs, maxNetUsageWords uint32, maxCPUUsageMS uint8)

Fill sets the fields on a transaction. If you pass `headBlockID`, then `api` can be nil. If you don't pass `headBlockID`, then the `api` is going to be called to fetch

func (*Transaction) SetExpiration Uses

func (tx *Transaction) SetExpiration(in time.Duration)

type TransactionHeader Uses

type TransactionHeader struct {
    Expiration     JSONTime `json:"expiration"`
    RefBlockNum    uint16   `json:"ref_block_num"`
    RefBlockPrefix uint32   `json:"ref_block_prefix"`

    MaxNetUsageWords Varuint32 `json:"max_net_usage_words"`
    MaxCPUUsageMS    uint8     `json:"max_cpu_usage_ms"`
    DelaySec         Varuint32 `json:"delay_sec"` // number of secs to delay, making it cancellable for that duration

type TransactionProcessed Uses

type TransactionProcessed struct {
    Status               string      `json:"status"`
    ID                   Checksum256 `json:"id"`
    ActionTraces         []Trace     `json:"action_traces"`
    DeferredTransactions []string    `json:"deferred_transactions"` // that's not right... dig to find what's there..

type TransactionReceipt Uses

type TransactionReceipt struct {
    Transaction TransactionWithID `json:"trx"`

type TransactionReceiptHeader Uses

type TransactionReceiptHeader struct {
    Status               TransactionStatus `json:"status"`
    CPUUsageMicroSeconds uint32            `json:"cpu_usage_us"`
    NetUsageWords        Varuint32         `json:"net_usage_words"`

type TransactionResp Uses

type TransactionResp struct {
    ID      Checksum256 `json:"id"`
    Receipt struct {
        Status            TransactionStatus `json:"status"`
        CPUUsageMicrosec  int               `json:"cpu_usage_us"`
        NetUsageWords     int               `json:"net_usage_words"`
        PackedTransaction TransactionWithID `json:"trx"`
    }   `json:"receipt"`
    Transaction           ProcessedTransaction `json:"trx"`
    BlockTime             JSONTime             `json:"block_time"`
    BlockNum              uint32               `json:"block_num"`
    LastIrreversibleBlock uint32               `json:"last_irreversible_block"`
    Traces                []ActionTrace        `json:"traces"`

type TransactionStatus Uses

type TransactionStatus uint8
const (
    TransactionStatusExecuted TransactionStatus = iota ///< succeed, no error handler executed
    TransactionStatusSoftFail                          ///< objectively failed (not executed), error handler executed
    TransactionStatusHardFail                          ///< objectively failed and error handler objectively failed thus no state change
    TransactionStatusDelayed                           ///< transaction delayed
    TransactionStatusExpired                           ///< transaction expired
    TransactionStatusUnknown  = TransactionStatus(255)

func (TransactionStatus) MarshalJSON Uses

func (s TransactionStatus) MarshalJSON() (data []byte, err error)

func (TransactionStatus) String Uses

func (s TransactionStatus) String() string

func (*TransactionStatus) UnmarshalJSON Uses

func (s *TransactionStatus) UnmarshalJSON(data []byte) error

type TransactionTraceAuthSequence Uses

type TransactionTraceAuthSequence struct {
    Account  AccountName
    Sequence Uint64

func (TransactionTraceAuthSequence) MarshalJSON Uses

func (auth TransactionTraceAuthSequence) MarshalJSON() (data []byte, err error)

func (*TransactionTraceAuthSequence) UnmarshalJSON Uses

func (auth *TransactionTraceAuthSequence) UnmarshalJSON(data []byte) error

[ ["account", 123123], ["account2", 345] ]

type TransactionWithID Uses

type TransactionWithID struct {
    ID     Checksum256
    Packed *PackedTransaction

func (TransactionWithID) MarshalJSON Uses

func (t TransactionWithID) MarshalJSON() ([]byte, error)

func (*TransactionWithID) UnmarshalJSON Uses

func (t *TransactionWithID) UnmarshalJSON(data []byte) error

type TransactionsResp Uses

type TransactionsResp struct {
    Transactions []SequencedTransactionResp

type Tstamp Uses

type Tstamp struct {

func (Tstamp) MarshalJSON Uses

func (t Tstamp) MarshalJSON() ([]byte, error)

func (*Tstamp) UnmarshalJSON Uses

func (t *Tstamp) UnmarshalJSON(data []byte) (err error)

type TxOptions Uses

type TxOptions struct {
    ChainID          Checksum256 // If specified, we won't hit the API to fetch it
    HeadBlockID      Checksum256 // If provided, don't hit API to fetch it.  This allows offline transaction signing.
    MaxNetUsageWords uint32
    DelaySecs        uint32
    MaxCPUUsageMS    uint8 // If you want to override the CPU usage (in counts of 1024)
    //ExtraKCPUUsage uint32 // If you want to *add* some CPU usage to the estimated amount (in counts of 1024)
    Compress CompressionType

TxOptions represents options you want to pass to the transaction you're sending.

func (*TxOptions) FillFromChain Uses

func (opts *TxOptions) FillFromChain(api *API) error

FillFromChain will load ChainID (for signing transactions) and HeadBlockID (to fill transaction with TaPoS data).

type Uint128 Uses

type Uint128 struct {
    Lo  uint64
    Hi  uint64

func (Uint128) MarshalJSON Uses

func (i Uint128) MarshalJSON() (data []byte, err error)

func (Uint128) String Uses

func (i Uint128) String() string

func (*Uint128) UnmarshalJSON Uses

func (i *Uint128) UnmarshalJSON(data []byte) error

type Uint64 Uses

type Uint64 uint64

func (Uint64) MarshalJSON Uses

func (i Uint64) MarshalJSON() (data []byte, err error)

func (*Uint64) UnmarshalJSON Uses

func (i *Uint64) UnmarshalJSON(data []byte) error

type Varint32 Uses

type Varint32 int32

type Varuint32 Uses

type Varuint32 uint32

type VoterInfo Uses

type VoterInfo struct {
    Owner             AccountName   `json:"owner"`
    Proxy             AccountName   `json:"proxy"`
    Producers         []AccountName `json:"producers"`
    Staked            Int64         `json:"staked"`
    LastVoteWeight    JSONFloat64   `json:"last_vote_weight"`
    ProxiedVoteWeight JSONFloat64   `json:"proxied_vote_weight"`
    IsProxy           byte          `json:"is_proxy"`

type WaitWeight Uses

type WaitWeight struct {
    WaitSec uint32 `json:"wait_sec"`
    Weight  uint16 `json:"weight"` // weight_type

type WalletSignTransactionResp Uses

type WalletSignTransactionResp struct {
    Signatures []ecc.Signature `json:"signatures"`

type WalletSigner Uses

type WalletSigner struct {
    // contains filtered or unexported fields

`eosiowd` wallet-based signer

func NewWalletSigner Uses

func NewWalletSigner(api *API, walletName string) *WalletSigner

NewWalletSigner takes an `api`, because often the wallet will be a second endpoint, and not the server node with whom you're pushing transactions to.

func (*WalletSigner) AvailableKeys Uses

func (s *WalletSigner) AvailableKeys() (out []ecc.PublicKey, err error)

func (*WalletSigner) ImportPrivateKey Uses

func (s *WalletSigner) ImportPrivateKey(wifKey string) (err error)

func (*WalletSigner) Sign Uses

func (s *WalletSigner) Sign(tx *SignedTransaction, chainID []byte, requiredKeys ...ecc.PublicKey) (*SignedTransaction, error)


btcsuite/btcd/btcecPackage btcec implements support for the elliptic curves needed for bitcoin.
btcsuite/btcutilPackage btcutil provides bitcoin-specific convenience functions and types.
btcsuite/btcutil/base58Package base58 provides an API for working with modified base58 and Base58Check encodings.

Package eos imports 30 packages (graph) and is imported by 11 packages. Updated 2019-11-29. Refresh now. Tools for package owners.