uuoskit

package
v0.0.0-...-a8fe813 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_AMOUNT = (1 << 62) - 1

Variables

View Source
var (
	DEBUG = true
)

Functions

func CalcPackedSize

func CalcPackedSize(i interface{}) (int, error)

func Check

func Check(cond bool, msg string)

func DecodeHash256

func DecodeHash256(hash string) ([]byte, error)

func DeepGet

func DeepGet(m *orderedmap.OrderedMap, keys ...interface{}) (interface{}, bool)

func GetDebug

func GetDebug() bool

func GetRefBlockNum

func GetRefBlockNum(refBlock []byte) uint32

func GetRefBlockPrefix

func GetRefBlockPrefix(refBlock []byte) uint32

func IsSymbolValid

func IsSymbolValid(sym string) bool

func N2S

func N2S(value uint64) string

func PackArray

func PackArray(a []Serializer) []byte

func PackUint64

func PackUint64(n uint64) []byte

func PackVarInt32

func PackVarInt32(v int32) []byte

func PackVarUint32

func PackVarUint32(val uint32) []byte

func PackedVarInt32Length

func PackedVarInt32Length(v int32) int

func PackedVarUint32Length

func PackedVarUint32Length(val uint32) int

func ParseAsset

func ParseAsset(v string) ([]byte, bool)

func S2N

func S2N(s string) uint64

func SetDebug

func SetDebug(debug bool)

func StringToInt

func StringToInt(s string) (int, error)

func StripString

func StripString(v string) (string, bool)

func UnpackVarInt32

func UnpackVarInt32(buf []byte) (int32, int)

func UnpackVarUint32

func UnpackVarUint32(val []byte) (v uint32, n int)

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 (t *ABI) GetAbiStruct(structName string) *ABIStruct

func (*ABI) GetActionStruct

func (t *ABI) GetActionStruct(actionName string) *ABIStruct

func (*ABI) GetActionStructType

func (t *ABI) GetActionStructType(actionName string) string

func (*ABI) GetBaseABIType

func (t *ABI) GetBaseABIType(typ string) (string, bool)

func (*ABI) GetBaseName

func (t *ABI) GetBaseName(structName string) (string, bool)

func (*ABI) GetVariantType

func (t *ABI) GetVariantType(typ string) (*VariantDef, bool)

func (*ABI) PackAbiStruct

func (t *ABI) PackAbiStruct(enc *Encoder, structName string, m map[string]JsonValue) error

func (*ABI) PackAbiType

func (t *ABI) PackAbiType(abiType string, args string) ([]byte, error)

func (*ABI) PackAbiValue

func (t *ABI) PackAbiValue(enc *Encoder, typ string, abiValue JsonValue) error

func (*ABI) PackArrayAbiValue

func (t *ABI) PackArrayAbiValue(enc *Encoder, typ string, value []JsonValue) error

func (*ABI) ParseAbiStringValue

func (t *ABI) ParseAbiStringValue(enc *Encoder, typ string, v string) error

func (*ABI) UnpackAbiStruct

func (t *ABI) UnpackAbiStruct(dec *Decoder, structName string, result *orderedmap.OrderedMap) error

func (*ABI) UnpackAbiType

func (t *ABI) UnpackAbiType(abiName string, packedValue []byte) ([]byte, error)

type ABIAction

type ABIAction struct {
	Name              string `json:"name"`
	Type              string `json:"type"`
	RicardianContract string `json:"ricardian_contract"`
}

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) PackABI

func (t *ABISerializer) PackABI(strABI string) ([]byte, error)

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) UnpackABI

func (t *ABISerializer) UnpackABI(rawAbi []byte) (string, error)

func (*ABISerializer) UnpackAbiType

func (t *ABISerializer) UnpackAbiType(contractName, abiName string, packedValue []byte) ([]byte, error)

func (*ABISerializer) UnpackActionArgs

func (t *ABISerializer) UnpackActionArgs(contractName string, actionName string, packedValue []byte) ([]byte, error)

type ABIStruct

type ABIStruct struct {
	Name   string           `json:"name"`
	Base   string           `json:"base"`
	Fields []ABIStructField `json:"fields"`
}

type ABIStructField

type ABIStructField struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type ABITable

type ABITable struct {
	Name      string   `json:"name"`
	Type      string   `json:"type"`
	IndexType string   `json:"index_type"`
	KeyNames  []string `json:"key_names"`
	KeyTypes  []string `json:"key_types"`
}

type ABIType

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

type AbiExtendedAsset

type AbiExtendedAsset struct {
	Quantity string `json:"quantity"`
	Contract string `json:"contract"`
}

{"quantity":"1.0000 EOS","contract":"eosio.token"}

type AbiExtension

type AbiExtension struct {
	Type      uint16 `json:"type_name"`
	Extension []byte `json:"extension"`
}

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 NewAction

func NewAction(account Name, name Name, args ...interface{}) *Action

func (*Action) AddPermission

func (a *Action) AddPermission(actor Name, permission Name)

func (*Action) Pack

func (a *Action) Pack() []byte

func (*Action) SetData

func (a *Action) SetData(data []byte)

func (*Action) Size

func (a *Action) Size() int

func (*Action) Unpack

func (a *Action) Unpack(b []byte) (int, error)

type Asset

type Asset struct {
	Amount int64
	Symbol Symbol
}

func NewAsset

func NewAsset(amount int64, symbol Symbol) *Asset

func (*Asset) Add

func (a *Asset) Add(b *Asset) *Asset

func (*Asset) Div

func (a *Asset) Div(b *Asset) *Asset

func (*Asset) IsValid

func (a *Asset) IsValid() bool

func (*Asset) Mul

func (a *Asset) Mul(b *Asset) *Asset

func (*Asset) Pack

func (a *Asset) Pack() []byte

func (*Asset) Size

func (t *Asset) Size() int

func (*Asset) Sub

func (a *Asset) Sub(b *Asset) *Asset

func (*Asset) Unpack

func (a *Asset) Unpack(data []byte) (int, error)

type BlockTimestampType

type BlockTimestampType struct {
	Slot uint32
}

func (*BlockTimestampType) Pack

func (t *BlockTimestampType) Pack() []byte

func (*BlockTimestampType) Size

func (t *BlockTimestampType) Size() int

func (*BlockTimestampType) Unpack

func (t *BlockTimestampType) Unpack(data []byte) (int, error)

type Bytes

type Bytes []byte

func (Bytes) MarshalJSON

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

func (*Bytes) UnmarshalJSON

func (a *Bytes) UnmarshalJSON(b []byte) error

type ChainApi

type ChainApi struct {
	ABISerializer *ABISerializer
	// contains filtered or unexported fields
}

func NewChainApi

func NewChainApi(rpcUrl string) *ChainApi

func (*ChainApi) DeployContract

func (api *ChainApi) DeployContract(account, codeFile string, abiFile string) error

func (*ChainApi) GetAccount

func (api *ChainApi) GetAccount(name string) (JsonValue, error)

func (*ChainApi) GetTableRows

func (api *ChainApi) GetTableRows(
	json bool,
	code string,
	scope string,
	table string,
	lowerbound string,
	upperbound string,
	limit int,
	keyType string,
	indexPosition int,
	reverse bool,
	showPayer bool,
) (JsonValue, error)

func (*ChainApi) PushAction

func (api *ChainApi) PushAction(action *Action) (JsonValue, error)

func (*ChainApi) PushActionWithArgs

func (api *ChainApi) PushActionWithArgs(account, action, args string, actor, permission string) (JsonValue, error)

func (*ChainApi) PushActions

func (api *ChainApi) PushActions(actions []*Action) (JsonValue, error)

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

func NewChainInfo(info []byte) (*ChainInfo, error)

type ClausePair

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

type Decoder

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

func NewDecoder

func NewDecoder(buf []byte) *Decoder

func (*Decoder) IsEnd

func (dec *Decoder) IsEnd() bool

func (*Decoder) Pos

func (dec *Decoder) Pos() int

func (*Decoder) Read

func (dec *Decoder) Read(b []byte) error

func (*Decoder) ReadBool

func (dec *Decoder) ReadBool() (bool, error)

func (*Decoder) ReadFloat32

func (dec *Decoder) ReadFloat32() (float32, error)

func (*Decoder) ReadFloat64

func (dec *Decoder) ReadFloat64() (float64, error)

func (*Decoder) ReadInt16

func (dec *Decoder) ReadInt16() (int16, error)

func (*Decoder) ReadInt32

func (dec *Decoder) ReadInt32() (int32, error)

func (*Decoder) ReadInt64

func (dec *Decoder) ReadInt64() (int64, error)

func (*Decoder) ReadInt8

func (dec *Decoder) ReadInt8() (int8, error)

func (*Decoder) ReadUint16

func (dec *Decoder) ReadUint16() (uint16, error)

func (*Decoder) ReadUint32

func (dec *Decoder) ReadUint32() (uint32, error)

func (*Decoder) ReadUint64

func (dec *Decoder) ReadUint64() (uint64, error)

func (*Decoder) ReadUint8

func (dec *Decoder) ReadUint8() (uint8, error)

func (*Decoder) Remains

func (dec *Decoder) Remains() []byte

func (*Decoder) Unpack

func (dec *Decoder) Unpack(i interface{}) (n int, err error)

func (*Decoder) UnpackAction

func (dec *Decoder) UnpackAction() (*Action, error)

func (*Decoder) UnpackBool

func (dec *Decoder) UnpackBool() (bool, error)

func (*Decoder) UnpackBytes

func (dec *Decoder) UnpackBytes() ([]byte, error)

func (*Decoder) UnpackFloat32

func (dec *Decoder) UnpackFloat32() (float32, error)

func (*Decoder) UnpackFloat64

func (dec *Decoder) UnpackFloat64() (float64, error)

func (*Decoder) UnpackInt16

func (dec *Decoder) UnpackInt16() (int16, error)

func (*Decoder) UnpackInt32

func (dec *Decoder) UnpackInt32() (int32, error)

func (*Decoder) UnpackInt64

func (dec *Decoder) UnpackInt64() (int64, error)

func (*Decoder) UnpackInt8

func (dec *Decoder) UnpackInt8() (int8, error)

func (*Decoder) UnpackLength

func (dec *Decoder) UnpackLength() (int, error)

func (*Decoder) UnpackName

func (dec *Decoder) UnpackName() (Name, error)

func (*Decoder) UnpackString

func (dec *Decoder) UnpackString() (string, error)

func (*Decoder) UnpackUint16

func (dec *Decoder) UnpackUint16() (uint16, error)

func (*Decoder) UnpackUint32

func (dec *Decoder) UnpackUint32() (uint32, error)

func (*Decoder) UnpackUint64

func (dec *Decoder) UnpackUint64() (uint64, error)

func (*Decoder) UnpackUint8

func (dec *Decoder) UnpackUint8() (uint8, error)

func (*Decoder) UnpackVarInt32

func (dec *Decoder) UnpackVarInt32() (int32, error)

func (*Decoder) UnpackVarUint32

func (dec *Decoder) UnpackVarUint32() (VarUint32, error)

type Encoder

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

func NewEncoder

func NewEncoder(initSize int) *Encoder

func (*Encoder) Bytes

func (enc *Encoder) Bytes() []byte

func (*Encoder) GetBytes

func (enc *Encoder) GetBytes() []byte

func (*Encoder) Pack

func (enc *Encoder) Pack(i interface{}) error

Pack supported types: Packer, interface string, bytes byte, uint16, int32, uint32, int64, uint64, float64 Name

func (*Encoder) PackBool

func (enc *Encoder) PackBool(b bool)

func (*Encoder) PackBytes

func (enc *Encoder) PackBytes(v []byte)

func (*Encoder) PackFloat32

func (enc *Encoder) PackFloat32(f float32)

func (*Encoder) PackFloat64

func (enc *Encoder) PackFloat64(f float64)

func (*Encoder) PackInt16

func (enc *Encoder) PackInt16(d int16)

func (*Encoder) PackInt32

func (enc *Encoder) PackInt32(d int32)

func (*Encoder) PackInt64

func (enc *Encoder) PackInt64(d int64)

func (*Encoder) PackInt8

func (enc *Encoder) PackInt8(d int8)

func (*Encoder) PackLength

func (enc *Encoder) PackLength(n int)

func (*Encoder) PackName

func (enc *Encoder) PackName(name Name)

func (*Encoder) PackString

func (enc *Encoder) PackString(s string)

func (*Encoder) PackUint16

func (enc *Encoder) PackUint16(d uint16)

func (*Encoder) PackUint32

func (enc *Encoder) PackUint32(d uint32)

func (*Encoder) PackUint64

func (enc *Encoder) PackUint64(d uint64)

func (*Encoder) PackUint8

func (enc *Encoder) PackUint8(d uint8)

func (*Encoder) PackVarInt32

func (enc *Encoder) PackVarInt32(n int32)

func (*Encoder) PackVarUint32

func (enc *Encoder) PackVarUint32(n uint32)

func (*Encoder) Reset

func (enc *Encoder) Reset()

func (*Encoder) Write

func (enc *Encoder) Write(b []byte)

func (*Encoder) WriteByte

func (enc *Encoder) WriteByte(b byte)

func (*Encoder) WriteBytes

func (enc *Encoder) WriteBytes(v []byte)

func (*Encoder) WriteInt

func (enc *Encoder) WriteInt(d int)

func (*Encoder) WriteInt16

func (enc *Encoder) WriteInt16(d int16)

func (*Encoder) WriteInt32

func (enc *Encoder) WriteInt32(d int32)

func (*Encoder) WriteInt64

func (enc *Encoder) WriteInt64(d int64)

func (*Encoder) WriteUint16

func (enc *Encoder) WriteUint16(d uint16)

func (*Encoder) WriteUint32

func (enc *Encoder) WriteUint32(d uint32)

func (*Encoder) WriteUint64

func (enc *Encoder) WriteUint64(d uint64)

func (*Encoder) WriteUint8

func (enc *Encoder) WriteUint8(d uint8)

type ErrorMessage

type ErrorMessage struct {
	ErrorCode uint64 `json:"error_code"`
	ErrorMsg  string `json:"error_msg"`
}

type ExtendedAsset

type ExtendedAsset struct {
	Quantity Asset
	Contract Name
}

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

func (*ExtendedAsset) Unpack

func (t *ExtendedAsset) Unpack(data []byte) (int, error)

type Float128

type Float128 [16]byte

func (*Float128) Pack

func (n *Float128) Pack() []byte

func (*Float128) Size

func (t *Float128) Size() int

func (*Float128) Unpack

func (n *Float128) Unpack(data []byte) (int, error)

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 Int128

type Int128 [16]byte

func (*Int128) Pack

func (n *Int128) Pack() []byte

func (*Int128) Size

func (t *Int128) Size() int

func (*Int128) Unpack

func (n *Int128) Unpack(data []byte) (int, error)

type JsonValue

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

func NewJsonValue

func NewJsonValue(value interface{}) JsonValue

func (*JsonValue) Get

func (b *JsonValue) Get(keys ...interface{}) (interface{}, error)

return string, []JsonValue, or map[string]JsonValue

func (*JsonValue) GetString

func (b *JsonValue) GetString(keys ...interface{}) (string, error)

func (*JsonValue) GetStringValue

func (b *JsonValue) GetStringValue() (string, bool)

func (*JsonValue) GetTime

func (b *JsonValue) GetTime(keys ...interface{}) (*time.Time, error)

func (*JsonValue) GetValue

func (b *JsonValue) GetValue() interface{}

func (JsonValue) MarshalJSON

func (b JsonValue) MarshalJSON() ([]byte, error)

func (*JsonValue) SetValue

func (b *JsonValue) SetValue(value interface{}) error

func (*JsonValue) UnmarshalJSON

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

type Name

type Name struct {
	N uint64
}

func NewName

func NewName(s string) Name

func (*Name) MarshalJSON

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

func (*Name) Pack

func (a *Name) Pack() []byte

func (*Name) Size

func (t *Name) Size() int

func (*Name) String

func (a *Name) String() string

func (*Name) UnmarshalJSON

func (a *Name) UnmarshalJSON(b []byte) error

func (*Name) Unpack

func (a *Name) Unpack(data []byte) (int, error)

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) Sign

func (t *PackedTransaction) Sign(pubKey string) (string, error)

func (*PackedTransaction) SignByPrivateKey

func (t *PackedTransaction) SignByPrivateKey(privKey string) (string, error)

type Packer

type Packer interface {
	Pack() []byte
}

type PermissionLevel

type PermissionLevel struct {
	Actor      Name `json:"actor"`
	Permission Name `json:"permission"`
}

func (*PermissionLevel) Pack

func (t *PermissionLevel) Pack() []byte

func (*PermissionLevel) Size

func (t *PermissionLevel) Size() int

func (*PermissionLevel) Unpack

func (t *PermissionLevel) Unpack(data []byte) (int, error)

type Rpc

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

func NewRpc

func NewRpc(url string) *Rpc

func (*Rpc) Call

func (r *Rpc) Call(api string, endpoint string, params interface{}) ([]byte, error)

func (*Rpc) GetAccount

func (r *Rpc) GetAccount(args *GetAccountArgs) (JsonValue, error)

func (*Rpc) GetInfo

func (r *Rpc) GetInfo() (*ChainInfo, 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

func NewRpcError(err string) *RpcError

func (*RpcError) Error

func (r *RpcError) Error() string

type Serializer

type Serializer interface {
	Pack() []byte
	Unpack([]byte) (int, uint64)
}

type Symbol

type Symbol struct {
	Value uint64
}

func NewSymbol

func NewSymbol(name string, precision int) Symbol

func (*Symbol) Code

func (a *Symbol) Code() uint64

func (*Symbol) IsValid

func (a *Symbol) IsValid() bool

func (*Symbol) Pack

func (a *Symbol) Pack() []byte

func (*Symbol) Precision

func (a *Symbol) Precision() uint64

func (*Symbol) Unpack

func (a *Symbol) Unpack(data []byte) (int, error)

type TimePoint

type TimePoint struct {
	Elapsed uint64
}

func (*TimePoint) Pack

func (t *TimePoint) Pack() []byte

func (*TimePoint) Size

func (t *TimePoint) Size() int

func (*TimePoint) Unpack

func (t *TimePoint) Unpack(data []byte) (int, error)

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

func (*TimePointSec) Unpack

func (t *TimePointSec) Unpack(data []byte) (int, 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) Digest

func (t *Transaction) Digest(chainId string) (string, error)

func (*Transaction) Pack

func (t *Transaction) Pack() []byte

func (*Transaction) SetReferenceBlock

func (t *Transaction) SetReferenceBlock(refBlock string) error

func (*Transaction) Sign

func (t *Transaction) Sign(privKey string, chainId string) (string, error)

func (*Transaction) Unpack

func (t *Transaction) Unpack(data []byte) (int, error)

type TransactionExtension

type TransactionExtension struct {
	Type uint16
	Data []byte
}

func (*TransactionExtension) Pack

func (t *TransactionExtension) Pack() []byte

func (*TransactionExtension) Size

func (a *TransactionExtension) Size() int

func (*TransactionExtension) Unpack

func (t *TransactionExtension) Unpack(data []byte) (int, error)

type Transfer

type Transfer struct {
	From     Name
	To       Name
	Quantity Asset
	Memo     string
}

func (*Transfer) Pack

func (a *Transfer) Pack() []byte

func (*Transfer) Unpack

func (a *Transfer) Unpack(data []byte) (int, error)

type Uint128

type Uint128 [16]byte

func (*Uint128) Pack

func (n *Uint128) Pack() []byte

func (*Uint128) SetUint64

func (n *Uint128) SetUint64(v uint64)

func (*Uint128) Size

func (t *Uint128) Size() int

func (*Uint128) Uint64

func (n *Uint128) Uint64() uint64

func (*Uint128) Unpack

func (n *Uint128) Unpack(data []byte) (int, error)

type Uint256

type Uint256 [32]uint8

func (*Uint256) Pack

func (n *Uint256) Pack() []byte

func (*Uint256) SetUint64

func (n *Uint256) SetUint64(v uint64)

func (*Uint256) Size

func (t *Uint256) Size() int

func (*Uint256) Uint64

func (n *Uint256) Uint64() uint64

func (*Uint256) Unpack

func (n *Uint256) Unpack(data []byte) (int, error)

type Unpacker

type Unpacker interface {
	Unpack(data []byte) (int, error)
}

type VarInt32

type VarInt32 int32

func (*VarInt32) Pack

func (t *VarInt32) Pack() []byte

func (*VarInt32) Size

func (t *VarInt32) Size() int

func (*VarInt32) Unpack

func (t *VarInt32) Unpack(data []byte) (int, error)

type VarUint32

type VarUint32 uint32

func (*VarUint32) MarshalJSON

func (t *VarUint32) MarshalJSON() ([]byte, error)

func (*VarUint32) Pack

func (t *VarUint32) Pack() []byte

func (*VarUint32) Size

func (t *VarUint32) Size() int

func (*VarUint32) Unpack

func (t *VarUint32) Unpack(data []byte) (int, error)

type VariantDef

type VariantDef struct {
	Name  string   `json:"name"`
	Types []string `json:"types"`
}

type Wallet

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

func GetWallet

func GetWallet() *Wallet

func (*Wallet) GetPrivateKey

func (w *Wallet) GetPrivateKey(pubKey string) (*secp256k1.PrivateKey, error)

func (*Wallet) GetPublicKeys

func (w *Wallet) GetPublicKeys() []string

GetPublicKeys

func (*Wallet) Import

func (w *Wallet) Import(name string, strPriv string) error

func (*Wallet) Remove

func (w *Wallet) Remove(name string, pubKey string) bool

func (*Wallet) Sign

func (w *Wallet) Sign(digest []byte, pubKey string) (*secp256k1.Signature, error)

Jump to

Keyboard shortcuts

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