Documentation ¶
Index ¶
- Constants
- Variables
- func CalcPackedSize(i interface{}) (int, error)
- func Check(cond bool, msg string)
- func DecodeHash256(hash string) ([]byte, error)
- func DeepGet(m *orderedmap.OrderedMap, keys ...interface{}) (interface{}, bool)
- func GetDebug() bool
- func GetRefBlockNum(refBlock []byte) uint32
- func GetRefBlockPrefix(refBlock []byte) uint32
- func IsSymbolValid(sym string) bool
- func N2S(value uint64) string
- func PackArray(a []Serializer) []byte
- func PackUint64(n uint64) []byte
- func PackVarInt32(v int32) []byte
- func PackVarUint32(val uint32) []byte
- func PackedVarInt32Length(v int32) int
- func PackedVarUint32Length(val uint32) int
- func ParseAsset(v string) ([]byte, bool)
- func S2N(s string) uint64
- func SetDebug(debug bool)
- func StringToInt(s string) (int, error)
- func StripString(v string) (string, bool)
- func UnpackVarInt32(buf []byte) (int32, int)
- func UnpackVarUint32(val []byte) (v uint32, n int)
- type ABI
- func (t *ABI) GetAbiStruct(structName string) *ABIStruct
- func (t *ABI) GetActionStruct(actionName string) *ABIStruct
- func (t *ABI) GetActionStructType(actionName string) string
- func (t *ABI) GetBaseABIType(typ string) (string, bool)
- func (t *ABI) GetBaseName(structName string) (string, bool)
- func (t *ABI) GetVariantType(typ string) (*VariantDef, bool)
- func (t *ABI) PackAbiStruct(enc *Encoder, structName string, m map[string]JsonValue) error
- func (t *ABI) PackAbiType(abiType string, args string) ([]byte, error)
- func (t *ABI) PackAbiValue(enc *Encoder, typ string, abiValue JsonValue) error
- func (t *ABI) PackArrayAbiValue(enc *Encoder, typ string, value []JsonValue) error
- func (t *ABI) ParseAbiStringValue(enc *Encoder, typ string, v string) error
- func (t *ABI) UnpackAbiStruct(dec *Decoder, structName string, result *orderedmap.OrderedMap) error
- func (t *ABI) UnpackAbiType(abiName string, packedValue []byte) ([]byte, error)
- type ABIAction
- type ABISerializer
- func (t *ABISerializer) IsAbiCached(contractName string) bool
- func (t *ABISerializer) PackABI(strABI string) ([]byte, error)
- func (t *ABISerializer) PackAbiType(contractName, abiType string, args string) ([]byte, error)
- func (t *ABISerializer) PackActionArgs(contractName, actionName string, args string) ([]byte, error)
- func (t *ABISerializer) SetContractABI(contractName string, abi []byte) error
- func (t *ABISerializer) UnpackABI(rawAbi []byte) (string, error)
- func (t *ABISerializer) UnpackAbiType(contractName, abiName string, packedValue []byte) ([]byte, error)
- func (t *ABISerializer) UnpackActionArgs(contractName string, actionName string, packedValue []byte) ([]byte, error)
- type ABIStruct
- type ABIStructField
- type ABITable
- type ABIType
- type AbiExtendedAsset
- type AbiExtension
- type Action
- type Asset
- type BlockTimestampType
- type Bytes
- type ChainApi
- func (api *ChainApi) DeployContract(account, codeFile string, abiFile string) error
- func (api *ChainApi) GetAccount(name string) (JsonValue, error)
- func (api *ChainApi) GetTableRows(json bool, code string, scope string, table string, lowerbound string, ...) (JsonValue, error)
- func (api *ChainApi) PushAction(action *Action) (JsonValue, error)
- func (api *ChainApi) PushActionWithArgs(account, action, args string, actor, permission string) (JsonValue, error)
- func (api *ChainApi) PushActions(actions []*Action) (JsonValue, error)
- type ChainContext
- type ChainInfo
- type ClausePair
- type Decoder
- func (dec *Decoder) IsEnd() bool
- func (dec *Decoder) Pos() int
- func (dec *Decoder) Read(b []byte) error
- func (dec *Decoder) ReadBool() (bool, error)
- func (dec *Decoder) ReadFloat32() (float32, error)
- func (dec *Decoder) ReadFloat64() (float64, error)
- func (dec *Decoder) ReadInt16() (int16, error)
- func (dec *Decoder) ReadInt32() (int32, error)
- func (dec *Decoder) ReadInt64() (int64, error)
- func (dec *Decoder) ReadInt8() (int8, error)
- func (dec *Decoder) ReadUint16() (uint16, error)
- func (dec *Decoder) ReadUint32() (uint32, error)
- func (dec *Decoder) ReadUint64() (uint64, error)
- func (dec *Decoder) ReadUint8() (uint8, error)
- func (dec *Decoder) Remains() []byte
- func (dec *Decoder) Unpack(i interface{}) (n int, err error)
- func (dec *Decoder) UnpackAction() (*Action, error)
- func (dec *Decoder) UnpackBool() (bool, error)
- func (dec *Decoder) UnpackBytes() ([]byte, error)
- func (dec *Decoder) UnpackFloat32() (float32, error)
- func (dec *Decoder) UnpackFloat64() (float64, error)
- func (dec *Decoder) UnpackInt16() (int16, error)
- func (dec *Decoder) UnpackInt32() (int32, error)
- func (dec *Decoder) UnpackInt64() (int64, error)
- func (dec *Decoder) UnpackInt8() (int8, error)
- func (dec *Decoder) UnpackLength() (int, error)
- func (dec *Decoder) UnpackName() (Name, error)
- func (dec *Decoder) UnpackString() (string, error)
- func (dec *Decoder) UnpackUint16() (uint16, error)
- func (dec *Decoder) UnpackUint32() (uint32, error)
- func (dec *Decoder) UnpackUint64() (uint64, error)
- func (dec *Decoder) UnpackUint8() (uint8, error)
- func (dec *Decoder) UnpackVarInt32() (int32, error)
- func (dec *Decoder) UnpackVarUint32() (VarUint32, error)
- type Encoder
- func (enc *Encoder) Bytes() []byte
- func (enc *Encoder) GetBytes() []byte
- func (enc *Encoder) Pack(i interface{}) error
- func (enc *Encoder) PackBool(b bool)
- func (enc *Encoder) PackBytes(v []byte)
- func (enc *Encoder) PackFloat32(f float32)
- func (enc *Encoder) PackFloat64(f float64)
- func (enc *Encoder) PackInt16(d int16)
- func (enc *Encoder) PackInt32(d int32)
- func (enc *Encoder) PackInt64(d int64)
- func (enc *Encoder) PackInt8(d int8)
- func (enc *Encoder) PackLength(n int)
- func (enc *Encoder) PackName(name Name)
- func (enc *Encoder) PackString(s string)
- func (enc *Encoder) PackUint16(d uint16)
- func (enc *Encoder) PackUint32(d uint32)
- func (enc *Encoder) PackUint64(d uint64)
- func (enc *Encoder) PackUint8(d uint8)
- func (enc *Encoder) PackVarInt32(n int32)
- func (enc *Encoder) PackVarUint32(n uint32)
- func (enc *Encoder) Reset()
- func (enc *Encoder) Write(b []byte)
- func (enc *Encoder) WriteByte(b byte)
- func (enc *Encoder) WriteBytes(v []byte)
- func (enc *Encoder) WriteInt(d int)
- func (enc *Encoder) WriteInt16(d int16)
- func (enc *Encoder) WriteInt32(d int32)
- func (enc *Encoder) WriteInt64(d int64)
- func (enc *Encoder) WriteUint16(d uint16)
- func (enc *Encoder) WriteUint32(d uint32)
- func (enc *Encoder) WriteUint64(d uint64)
- func (enc *Encoder) WriteUint8(d uint8)
- type ErrorMessage
- type ExtendedAsset
- type Float128
- type GetAccountArgs
- type GetRequiredKeysArgs
- type GetRequiredKeysResult
- type GetTableRowsArgs
- type Int128
- type JsonValue
- func (b *JsonValue) Get(keys ...interface{}) (interface{}, error)
- func (b *JsonValue) GetString(keys ...interface{}) (string, error)
- func (b *JsonValue) GetStringValue() (string, bool)
- func (b *JsonValue) GetTime(keys ...interface{}) (*time.Time, error)
- func (b *JsonValue) GetValue() interface{}
- func (b JsonValue) MarshalJSON() ([]byte, error)
- func (b *JsonValue) SetValue(value interface{}) error
- func (b *JsonValue) UnmarshalJSON(data []byte) error
- type Name
- type PackedSize
- type PackedTransaction
- func (t *PackedTransaction) AddAction(a *Action) error
- func (t *PackedTransaction) Digest(chainId string) (string, error)
- func (t *PackedTransaction) Marshal() string
- func (t *PackedTransaction) Pack(compress bool) string
- func (t *PackedTransaction) SetChainId(chainId string) error
- func (t *PackedTransaction) Sign(pubKey string) (string, error)
- func (t *PackedTransaction) SignByPrivateKey(privKey string) (string, error)
- type Packer
- type PermissionLevel
- type Rpc
- func (r *Rpc) Call(api string, endpoint string, params interface{}) ([]byte, error)
- func (r *Rpc) GetAccount(args *GetAccountArgs) (JsonValue, error)
- func (r *Rpc) GetInfo() (*ChainInfo, error)
- func (r *Rpc) GetRequiredKeys(args *GetRequiredKeysArgs) (*GetRequiredKeysResult, error)
- func (t *Rpc) GetTableRows(args *GetTableRowsArgs) (JsonValue, error)
- func (t *Rpc) PushTransaction(packedTx *PackedTransaction) (JsonValue, error)
- type RpcError
- type Serializer
- type Symbol
- type TimePoint
- type TimePointSec
- type Transaction
- func (t *Transaction) AddAction(a *Action)
- func (t *Transaction) Digest(chainId string) (string, error)
- func (t *Transaction) Pack() []byte
- func (t *Transaction) SetReferenceBlock(refBlock string) error
- func (t *Transaction) Sign(privKey string, chainId string) (string, error)
- func (t *Transaction) Unpack(data []byte) (int, error)
- type TransactionExtension
- type Transfer
- type Uint128
- type Uint256
- type Unpacker
- type VarInt32
- type VarUint32
- type VariantDef
- type Wallet
- func (w *Wallet) GetPrivateKey(pubKey string) (*secp256k1.PrivateKey, error)
- func (w *Wallet) GetPublicKeys() []string
- func (w *Wallet) Import(name string, strPriv string) error
- func (w *Wallet) Remove(name string, pubKey string) bool
- func (w *Wallet) Sign(digest []byte, pubKey string) (*secp256k1.Signature, error)
Constants ¶
View Source
const MAX_AMOUNT = (1 << 62) - 1
Variables ¶
View Source
var (
DEBUG = true
)
Functions ¶
func CalcPackedSize ¶
func DecodeHash256 ¶
func DeepGet ¶
func DeepGet(m *orderedmap.OrderedMap, keys ...interface{}) (interface{}, bool)
func GetRefBlockNum ¶
func GetRefBlockPrefix ¶
func IsSymbolValid ¶
func PackArray ¶
func PackArray(a []Serializer) []byte
func PackUint64 ¶
func PackVarInt32 ¶
func PackVarUint32 ¶
func PackedVarInt32Length ¶
func PackedVarUint32Length ¶
func ParseAsset ¶
func StringToInt ¶
func StripString ¶
func UnpackVarInt32 ¶
func UnpackVarUint32 ¶
Types ¶
type ABI ¶
type ABI struct { Version string `json:"version"` Types []ABIType `json:"types"` Structs []ABIStruct `json:"structs"` Actions []ABIAction `json:"actions"` Tables []ABITable `json:"tables"` RicardianClauses []ClausePair `json:"ricardian_clauses"` ErrorMessages []ErrorMessage `json:"error_messages"` AbiExtensions []AbiExtension `json:"abi_extensions"` Variants []VariantDef `json:"variants"` }
func (*ABI) GetAbiStruct ¶
func (*ABI) GetActionStruct ¶
func (*ABI) GetActionStructType ¶
func (*ABI) GetVariantType ¶
func (t *ABI) GetVariantType(typ string) (*VariantDef, bool)
func (*ABI) PackAbiStruct ¶
func (*ABI) PackAbiValue ¶
func (*ABI) PackArrayAbiValue ¶
func (*ABI) ParseAbiStringValue ¶
func (*ABI) UnpackAbiStruct ¶
func (t *ABI) UnpackAbiStruct(dec *Decoder, structName string, result *orderedmap.OrderedMap) error
type ABISerializer ¶
type ABISerializer struct {
// contains filtered or unexported fields
}
func NewABISerializer ¶
func NewABISerializer() *ABISerializer
func (*ABISerializer) IsAbiCached ¶
func (t *ABISerializer) IsAbiCached(contractName string) bool
func (*ABISerializer) PackAbiType ¶
func (t *ABISerializer) PackAbiType(contractName, abiType string, args string) ([]byte, error)
func (*ABISerializer) PackActionArgs ¶
func (t *ABISerializer) PackActionArgs(contractName, actionName string, args string) ([]byte, error)
func (*ABISerializer) SetContractABI ¶
func (t *ABISerializer) SetContractABI(contractName string, abi []byte) error
func (*ABISerializer) UnpackAbiType ¶
func (t *ABISerializer) UnpackAbiType(contractName, abiName string, packedValue []byte) ([]byte, error)
func (*ABISerializer) UnpackActionArgs ¶
type ABIStruct ¶
type ABIStruct struct { Name string `json:"name"` Base string `json:"base"` Fields []ABIStructField `json:"fields"` }
type ABIStructField ¶
type AbiExtendedAsset ¶
type AbiExtendedAsset struct { Quantity string `json:"quantity"` Contract string `json:"contract"` }
{"quantity":"1.0000 EOS","contract":"eosio.token"}
type AbiExtension ¶
std::vector<std::pair<uint16_t, std::vector<char>>>;
type Action ¶
type Action struct { Account Name `json:"account"` Name Name `json:"name"` Authorization []PermissionLevel `json:"authorization"` Data Bytes `json:"data"` }
func (*Action) AddPermission ¶
type BlockTimestampType ¶
type BlockTimestampType struct {
Slot uint32
}
func (*BlockTimestampType) Pack ¶
func (t *BlockTimestampType) Pack() []byte
func (*BlockTimestampType) Size ¶
func (t *BlockTimestampType) Size() int
type ChainApi ¶
type ChainApi struct { ABISerializer *ABISerializer // contains filtered or unexported fields }
func NewChainApi ¶
func (*ChainApi) DeployContract ¶
func (*ChainApi) GetTableRows ¶
func (*ChainApi) PushActionWithArgs ¶
type ChainContext ¶
type ChainContext struct { ABISerializer *ABISerializer PackedTxs []*PackedTransaction }
func NewChainContext ¶
func NewChainContext() *ChainContext
type ChainInfo ¶
type ChainInfo struct { ServerVersion string `json:"server_version"` ChainID string `json:"chain_id"` HeadBlockNum int64 `json:"head_block_num"` LastIrreversibleBlockNum int64 `json:"last_irreversible_block_num"` LastIrreversibleBlockID string `json:"last_irreversible_block_id"` HeadBlockID string `json:"head_block_id"` HeadBlockTime string `json:"head_block_time"` HeadBlockProducer string `json:"head_block_producer"` 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"` ForkDBHeadBlockNum int64 `json:"fork_db_head_block_num"` ForkDBHeadBlockID string `json:"fork_db_head_block_id"` ServerFullVersionString string `json:"server_full_version_string"` LastIrreversibleBlockTime string `json:"last_irreversible_block_time"` }
func NewChainInfo ¶
type ClausePair ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
func NewDecoder ¶
func (*Decoder) ReadFloat32 ¶
func (*Decoder) ReadFloat64 ¶
func (*Decoder) ReadUint16 ¶
func (*Decoder) ReadUint32 ¶
func (*Decoder) ReadUint64 ¶
func (*Decoder) UnpackAction ¶
func (*Decoder) UnpackBool ¶
func (*Decoder) UnpackBytes ¶
func (*Decoder) UnpackFloat32 ¶
func (*Decoder) UnpackFloat64 ¶
func (*Decoder) UnpackInt16 ¶
func (*Decoder) UnpackInt32 ¶
func (*Decoder) UnpackInt64 ¶
func (*Decoder) UnpackInt8 ¶
func (*Decoder) UnpackLength ¶
func (*Decoder) UnpackName ¶
func (*Decoder) UnpackString ¶
func (*Decoder) UnpackUint16 ¶
func (*Decoder) UnpackUint32 ¶
func (*Decoder) UnpackUint64 ¶
func (*Decoder) UnpackUint8 ¶
func (*Decoder) UnpackVarInt32 ¶
func (*Decoder) UnpackVarUint32 ¶
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
func NewEncoder ¶
func (*Encoder) Pack ¶
Pack supported types: Packer, interface string, bytes byte, uint16, int32, uint32, int64, uint64, float64 Name
func (*Encoder) PackFloat32 ¶
func (*Encoder) PackFloat64 ¶
func (*Encoder) PackLength ¶
func (*Encoder) PackString ¶
func (*Encoder) PackUint16 ¶
func (*Encoder) PackUint32 ¶
func (*Encoder) PackUint64 ¶
func (*Encoder) PackVarInt32 ¶
func (*Encoder) PackVarUint32 ¶
func (*Encoder) WriteBytes ¶
func (*Encoder) WriteInt16 ¶
func (*Encoder) WriteInt32 ¶
func (*Encoder) WriteInt64 ¶
func (*Encoder) WriteUint16 ¶
func (*Encoder) WriteUint32 ¶
func (*Encoder) WriteUint64 ¶
func (*Encoder) WriteUint8 ¶
type ErrorMessage ¶
type ExtendedAsset ¶
func NewExtendedAsset ¶
func NewExtendedAsset(quantity Asset, contract Name) *ExtendedAsset
func (*ExtendedAsset) Pack ¶
func (t *ExtendedAsset) Pack() []byte
func (*ExtendedAsset) Size ¶
func (t *ExtendedAsset) Size() int
type GetAccountArgs ¶
type GetAccountArgs struct {
AccountName string `json:"account_name"`
}
type GetRequiredKeysArgs ¶
type GetRequiredKeysArgs struct { Transaction *Transaction `json:"transaction"` AvailableKeys []string `json:"available_keys"` }
type GetRequiredKeysResult ¶
type GetRequiredKeysResult struct {
RequiredKeys []string `json:"required_keys"`
}
required_keys
type GetTableRowsArgs ¶
type GetTableRowsArgs struct { Json bool `json:"json"` Code string `json:"code"` Scope string `json:"scope"` Table string `json:"table"` LowerBound string `json:"lower_bound"` UpperBound string `json:"upper_bound"` Limit int `json:"limit"` KeyType string `json:"key_type"` IndexPosition int `json:"index_position"` Reverse bool `json:"reverse"` ShowPayer bool `json:"show_payer"` }
type JsonValue ¶
type JsonValue struct {
// contains filtered or unexported fields
}
func NewJsonValue ¶
func NewJsonValue(value interface{}) JsonValue
func (*JsonValue) GetStringValue ¶
func (JsonValue) MarshalJSON ¶
func (*JsonValue) UnmarshalJSON ¶
type PackedSize ¶
type PackedSize interface {
Size() int
}
type PackedTransaction ¶
type PackedTransaction struct { Signatures []string `json:"signatures"` Compression string `json:"compression"` PackedContext Bytes `json:"packed_context_free_data"` PackedTx Bytes `json:"packed_trx"` // contains filtered or unexported fields }
func NewPackedTransaction ¶
func NewPackedTransaction(tx *Transaction) *PackedTransaction
func NewPackedTransactionFromString ¶
func NewPackedTransactionFromString(tx string) (*PackedTransaction, error)
func (*PackedTransaction) AddAction ¶
func (t *PackedTransaction) AddAction(a *Action) error
func (*PackedTransaction) Digest ¶
func (t *PackedTransaction) Digest(chainId string) (string, error)
func (*PackedTransaction) Marshal ¶
func (t *PackedTransaction) Marshal() string
func (*PackedTransaction) Pack ¶
func (t *PackedTransaction) Pack(compress bool) string
func (*PackedTransaction) SetChainId ¶
func (t *PackedTransaction) SetChainId(chainId string) error
SetChainId
func (*PackedTransaction) SignByPrivateKey ¶
func (t *PackedTransaction) SignByPrivateKey(privKey string) (string, error)
type PermissionLevel ¶
func (*PermissionLevel) Pack ¶
func (t *PermissionLevel) Pack() []byte
func (*PermissionLevel) Size ¶
func (t *PermissionLevel) Size() int
type Rpc ¶
type Rpc struct {
// contains filtered or unexported fields
}
func (*Rpc) GetAccount ¶
func (r *Rpc) GetAccount(args *GetAccountArgs) (JsonValue, error)
func (*Rpc) GetRequiredKeys ¶
func (r *Rpc) GetRequiredKeys(args *GetRequiredKeysArgs) (*GetRequiredKeysResult, error)
func (*Rpc) GetTableRows ¶
func (t *Rpc) GetTableRows(args *GetTableRowsArgs) (JsonValue, error)
func (*Rpc) PushTransaction ¶
func (t *Rpc) PushTransaction(packedTx *PackedTransaction) (JsonValue, error)
type RpcError ¶
type RpcError struct {
// contains filtered or unexported fields
}
func NewRpcError ¶
type TimePointSec ¶
type TimePointSec struct {
UTCSeconds uint32
}
func (TimePointSec) MarshalJSON ¶
func (t TimePointSec) MarshalJSON() ([]byte, error)
func (*TimePointSec) Pack ¶
func (t *TimePointSec) Pack() []byte
func (*TimePointSec) Size ¶
func (t *TimePointSec) Size() int
func (*TimePointSec) UnmarshalJSON ¶
func (a *TimePointSec) UnmarshalJSON(b []byte) error
type Transaction ¶
type Transaction struct { // time_point_sec expiration; // uint16_t ref_block_num; // uint32_t ref_block_prefix; // unsigned_int max_net_usage_words = 0UL; /// number of 8 byte words this transaction can serialize into after compressions // uint8_t max_cpu_usage_ms = 0UL; /// number of CPU usage units to bill transaction for // unsigned_int delay_sec = 0UL; /// number of seconds to delay transaction, default: 0 Expiration TimePointSec `json:"expiration"` RefBlockNum uint16 `json:"ref_block_num"` RefBlockPrefix uint32 `json:"ref_block_prefix"` //[VLQ or Base-128 encoding](https://en.wikipedia.org/wiki/Variable-length_quantity) //unsigned_int vaint (eosio.cdt/libraries/eosiolib/core/eosio/varint.hpp) MaxNetUsageWords VarUint32 `json:"max_net_usage_words"` MaxCpuUsageMs uint8 `json:"max_cpu_usage_ms"` DelaySec VarUint32 `json:"delay_sec"` ContextFreeActions []Action `json:"context_free_actions"` Actions []Action `json:"actions"` Extention []TransactionExtension `json:"transaction_extensions"` }
func NewTransaction ¶
func NewTransaction(expiration int) *Transaction
func (*Transaction) AddAction ¶
func (t *Transaction) AddAction(a *Action)
func (*Transaction) Pack ¶
func (t *Transaction) Pack() []byte
func (*Transaction) SetReferenceBlock ¶
func (t *Transaction) SetReferenceBlock(refBlock string) error
type TransactionExtension ¶
func (*TransactionExtension) Pack ¶
func (t *TransactionExtension) Pack() []byte
func (*TransactionExtension) Size ¶
func (a *TransactionExtension) Size() int
type VariantDef ¶
type Wallet ¶
type Wallet struct {
// contains filtered or unexported fields
}
func (*Wallet) GetPrivateKey ¶
func (w *Wallet) GetPrivateKey(pubKey string) (*secp256k1.PrivateKey, error)
Click to show internal directories.
Click to hide internal directories.