abi_serializer

package
v0.0.0-...-8f1dc17 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2021 License: MIT Imports: 21 Imported by: 0

README

abi_serializer

fork from https://github.com/eoscanada/eos-go thanks eoscanada

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode_Decode

func Encode_Decode() common.Pair

func FromVariant

func FromVariant(v *common.Variants, o *types.SignedTransaction, resolver func(account common.AccountName) *AbiSerializer, maxSerialization common.Microseconds)

template<typename M, typename Resolver, not_require_abi_t<M> = 1> static void extract( const variant& v, M& o, Resolver, abi_traverse_context& ctx )

{
  auto h = ctx.enter_scope();
  from_variant(v, o);
}

func FromVariantToActionData

func FromVariantToActionData(actionParams *types.ContractTypesInterface, v *common.Variants, resolver func(account common.AccountName) *AbiSerializer, maxSerialization common.Microseconds)

func ToABI

func ToABI(abiVec common.HexBytes, abi *AbiDef) bool

func ToVariant

func ToVariant()

func ToVariantFromActionData

func ToVariantFromActionData(actionParams *types.ContractTypesInterface, v *common.Variants, resolver func(account common.AccountName) *AbiSerializer, maxSerialization common.Microseconds)

Types

type ABIEncoder

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

type AbiDef

type AbiDef struct {
	Version          string             `json:"version"`
	Types            []TypeDef          `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    []ErrorMessage     `json:"error_messages,omitempty"`
	Extensions       []*types.Extension `json:"abi_extensions,omitempty"`
	Variants         []VariantDef       `json:"variants,omitempty"` // TODO may not exit
}

func NewABI

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

func (*AbiDef) ActionForName

func (a *AbiDef) ActionForName(name common.ActionName) *ActionDef

func (*AbiDef) DecodeAction

func (a *AbiDef) DecodeAction(actionName string, data []byte) ([]byte, error)

func (*AbiDef) DecodeStruct

func (a *AbiDef) DecodeStruct(structType string, data []byte) ([]byte, error)

func (*AbiDef) EncodeAction

func (a *AbiDef) EncodeAction(actionName common.ActionName, json []byte) ([]byte, error)

func (*AbiDef) EncodeStruct

func (a *AbiDef) EncodeStruct(structName typeName, json []byte) ([]byte, error)

func (AbiDef) IsEmpty

func (a AbiDef) IsEmpty() bool

func (*AbiDef) StructForName

func (a *AbiDef) StructForName(name typeName) *StructDef

func (*AbiDef) TableForName

func (a *AbiDef) TableForName(name common.TableName) *TableDef

func (*AbiDef) TypeNameForNewTypeName

func (a *AbiDef) TypeNameForNewTypeName(typeName string) string

type AbiSerializer

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

func NewAbiSerializer

func NewAbiSerializer(abi *AbiDef, maxSerializationTime common.Microseconds) *AbiSerializer

func (AbiSerializer) BinaryToVariant

func (a AbiSerializer) BinaryToVariant(rtype typeName, binary []byte, maxSerializationTime common.Microseconds, shortPath bool) common.Variants

fc::variant abi_serializer::binary_to_variant( const type_name& type, const bytes& binary, const fc::microseconds& max_serialization_time, bool short_path )const { impl::binary_to_variant_context ctx(*this, max_serialization_time, type); ctx.short_path = short_path; return _binary_to_variant(type, binary, ctx); } todo shortPath default is false

func (AbiSerializer) BinaryToVariant2

func (a AbiSerializer) BinaryToVariant2(rtype typeName, binary []byte, maxSerializationTime common.Microseconds, shortPath bool) []byte

func (AbiSerializer) BinaryToVariantPrint

func (a AbiSerializer) BinaryToVariantPrint(rtype typeName, binary []byte, maxSerializationTime common.Microseconds, shortPath bool) interface{}

func (*AbiSerializer) ConfigureBuiltInTypes

func (a *AbiSerializer) ConfigureBuiltInTypes()

func (AbiSerializer) FundamentalType

func (a AbiSerializer) FundamentalType(stype typeName) string

func (AbiSerializer) GetActionType

func (a AbiSerializer) GetActionType(action common.Name) typeName

func (AbiSerializer) GetErrorMessage

func (a AbiSerializer) GetErrorMessage(errorCode uint64) string

func (AbiSerializer) GetIntegerSize

func (a AbiSerializer) GetIntegerSize(stype typeName) int

func (AbiSerializer) GetStruct

func (a AbiSerializer) GetStruct(stype typeName) *StructDef

func (AbiSerializer) GetTableType

func (a AbiSerializer) GetTableType(action common.Name) typeName

func (AbiSerializer) IsArray

func (a AbiSerializer) IsArray(stype typeName) bool

func (AbiSerializer) IsBuiltinType

func (a AbiSerializer) IsBuiltinType(stype typeName) bool

func (AbiSerializer) IsEmpty

func (a AbiSerializer) IsEmpty() bool

func (AbiSerializer) IsInteger

func (a AbiSerializer) IsInteger(stype typeName) bool

func (AbiSerializer) IsOptional

func (a AbiSerializer) IsOptional(stype typeName) bool

func (AbiSerializer) IsStruct

func (a AbiSerializer) IsStruct(stype typeName) bool

func (AbiSerializer) IsType

func (a AbiSerializer) IsType(rtype typeName, recursionDepth common.SizeT, deadline *common.TimePoint, maxSerializationTime common.Microseconds) bool

func (AbiSerializer) ResolveType

func (a AbiSerializer) ResolveType(stype typeName) typeName

func (*AbiSerializer) SetAbi

func (a *AbiSerializer) SetAbi(abi *AbiDef, maxSerializationTime common.Microseconds)

func (*AbiSerializer) VariantToBinary

func (a *AbiSerializer) VariantToBinary(name typeName, body *common.Variants, maxSerializationTime common.Microseconds) []byte

type ActionDef

type ActionDef struct {
	Name              common.ActionName `json:"name"`
	Type              typeName          `json:"type"`
	RicardianContract string            `json:"ricardian_contract"`
}

type ClausePair

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

ClausePair represents clauses, related to Ricardian Contracts.

type ErrorMessage

type ErrorMessage struct {
	Code    uint64 `json:"error_code"`
	Message string `json:"error_msg"`
}

type FieldDef

type FieldDef struct {
	Name fieldName `json:"name"`
	Type typeName  `json:"type"`
}

type Float128

type Float128 Uint128

func (Float128) MarshalJSON

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

func (*Float128) UnmarshalJSON

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

type Int128

type Int128 Uint128

func (Int128) MarshalJSON

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

func (*Int128) UnmarshalJSON

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

type Int64

type Int64 int64

func (Int64) MarshalJSON

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

func (*Int64) UnmarshalJSON

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

type StructDef

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

type TableDef

type TableDef struct {
	Name      common.TableName `json:"name"`
	IndexType typeName         `json:"index_type"`
	KeyNames  []fieldName      `json:"key_names,omitempty"`
	KeyTypes  []typeName       `json:"key_types,omitempty"`
	Type      typeName         `json:"type"`
}

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

type TypeDef

type TypeDef struct {
	NewTypeName typeName `json:"new_type_name"`
	Type        typeName `json:"type"`
}

func CommonTypeDefs

func CommonTypeDefs() []TypeDef

type Uint128

type Uint128 struct {
	Lo uint64
	Hi uint64
}

func (Uint128) MarshalJSON

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

func (Uint128) String

func (i Uint128) String() string

func (*Uint128) UnmarshalJSON

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

type Uint64

type Uint64 uint64

func (Uint64) MarshalJSON

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

func (*Uint64) UnmarshalJSON

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

type VariantDef

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

Jump to

Keyboard shortcuts

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