Documentation
¶
Index ¶
- Constants
- Variables
- func NewCustomDecoder(r io.Reader, fn abi.DecodeFunc) *abi.Decoder
- func NewCustomEncoder(w io.Writer, fn abi.EncodeFunc) *abi.Encoder
- func NewDecoder(r io.Reader) *abi.Decoder
- func NewEncoder(w io.Writer) *abi.Encoder
- type Abi
- func (a Abi) Decode(r io.Reader, name string) (interface{}, error)
- func (a Abi) DecodeAction(r io.Reader, name Name) (interface{}, error)
- func (a Abi) DecodeTable(r io.Reader, name Name) (interface{}, error)
- func (a Abi) Encode(w io.Writer, name string, v interface{}) error
- func (a Abi) EncodeAction(w io.Writer, name Name, v interface{}) error
- func (a Abi) EncodeTable(w io.Writer, name Name, v interface{}) error
- func (a Abi) GetAction(name Name) *AbiAction
- func (a Abi) GetStruct(name string) *AbiStruct
- func (a Abi) GetTable(name Name) *AbiTable
- func (a Abi) GetType(name string) *AbiType
- func (a Abi) GetVariant(name string) *AbiVariant
- type AbiAction
- type AbiClause
- type AbiErrorMessage
- type AbiExtension
- type AbiField
- type AbiStruct
- type AbiTable
- type AbiType
- type AbiVariant
- type Action
- type Asset
- type Blob
- type BlockHeader
- type BlockNum
- type BlockTimestamp
- func (bts BlockTimestamp) MarshalABI(e *abi.Encoder) error
- func (bts BlockTimestamp) MarshalText() (text []byte, err error)
- func (bts BlockTimestamp) String() string
- func (bts BlockTimestamp) Time() time.Time
- func (bts *BlockTimestamp) UnmarshalABI(d *abi.Decoder) error
- func (bts *BlockTimestamp) UnmarshalText(text []byte) error
- type Bytes
- type Checksum160
- type Checksum256
- type Checksum512
- type CompressionType
- type ExtendedAsset
- type Float128
- type Int128
- func (i128 Int128) BigInt() *big.Int
- func (i128 Int128) Bytes(o binary.ByteOrder) []byte
- func (i128 Int128) MarshalABI(e *abi.Encoder) error
- func (i128 Int128) MarshalText() (text []byte, err error)
- func (i128 Int128) String() string
- func (i128 *Int128) UnmarshalABI(d *abi.Decoder) error
- func (i128 *Int128) UnmarshalText(text []byte) error
- type KeyType
- type Name
- type PackedTransaction
- type PermissionLevel
- type ProducerKey
- type ProducerSchedule
- type PublicKey
- func (pk *PublicKey) LegacyString(prefix string) string
- func (pk PublicKey) MarshalABI(e *abi.Encoder) error
- func (pk PublicKey) MarshalText() (text []byte, err error)
- func (pk *PublicKey) String() string
- func (pk *PublicKey) UnmarshalABI(d *abi.Decoder) error
- func (pk *PublicKey) UnmarshalText(text []byte) error
- type Signature
- type Symbol
- func (s Symbol) Code() SymbolCode
- func (s Symbol) Decimals() int
- func (s Symbol) MarshalABI(e *abi.Encoder) error
- func (s Symbol) MarshalText() (text []byte, err error)
- func (s Symbol) Name() string
- func (s Symbol) Precision() int64
- func (s Symbol) String() string
- func (s *Symbol) UnmarshalABI(d *abi.Decoder) error
- func (s *Symbol) UnmarshalText(text []byte) error
- type SymbolCode
- type TimePoint
- type TimePointSec
- func (tps TimePointSec) MarshalABI(e *abi.Encoder) error
- func (tps TimePointSec) MarshalText() (text []byte, err error)
- func (tps TimePointSec) String() string
- func (tps TimePointSec) Time() time.Time
- func (tps *TimePointSec) UnmarshalABI(d *abi.Decoder) error
- func (tps *TimePointSec) UnmarshalText(text []byte) error
- type Transaction
- type TransactionExtension
- type TransactionHeader
- type TransactionReceiptHeader
- type TransactionStatus
- type Uint64
- type Uint128
- func (u128 Uint128) BigInt() *big.Int
- func (u128 Uint128) Bytes(o binary.ByteOrder) []byte
- func (u128 Uint128) MarshalABI(e *abi.Encoder) error
- func (u128 Uint128) MarshalText() (text []byte, err error)
- func (u128 Uint128) String() string
- func (u128 *Uint128) UnmarshalABI(d *abi.Decoder) error
- func (u128 *Uint128) UnmarshalText(text []byte) error
Constants ¶
const ( CompressionNone = CompressionType(iota) CompressionZlib )
const ( TimePointFormat = "2006-01-02T15:04:05.000" // shared with BlockTimestamp TimePointSecFormat = "2006-01-02T15:04:05" )
Variables ¶
var ErrInvalidAssetString = errors.New("invalid asset string")
Functions ¶
func NewCustomDecoder ¶
func NewCustomEncoder ¶
Types ¶
type Abi ¶
type Abi struct {
Version string `json:"version"`
Types []AbiType `json:"types,omitempty"`
Structs []AbiStruct `json:"structs,omitempty"`
Actions []AbiAction `json:"actions,omitempty"`
Tables []AbiTable `json:"tables,omitempty"`
RicardianClauses []AbiClause `json:"ricardian_clauses,omitempty"`
ErrorMessages []AbiErrorMessage `json:"error_messages,omitempty"`
Extensions []*AbiExtension `json:"abi_extensions,omitempty"`
Variants []AbiVariant `json:"variants,omitempty" eosio:"extension"`
}
EOSIO ABI definition, describes the binary representation of a collection of types.
func (Abi) DecodeTable ¶ added in v0.1.4
func (Abi) EncodeTable ¶ added in v0.1.4
func (Abi) GetVariant ¶
func (a Abi) GetVariant(name string) *AbiVariant
type AbiErrorMessage ¶
type AbiExtension ¶
type AbiVariant ¶
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, authorization []PermissionLevel, data Bytes) *Action
func (Action) DecodeInto ¶
func (Action) Digest ¶
func (a Action) Digest() Checksum256
type Asset ¶
func NewAssetFromString ¶
Create new asset from string, e.g. "1.0000 EOS"
func (*Asset) FloatValue ¶
func (Asset) MarshalText ¶
func (*Asset) UnmarshalText ¶
type Blob ¶
type Blob []byte
Exactly like Bytes but serializes as Base64 instead of Base16 (hex) when encoded as JSON Worth noting is that this version encodes to valid Base64 while the eosio variant does not see https://github.com/EOSIO/eos/issues/8161
func (Blob) MarshalText ¶
func (*Blob) UnmarshalText ¶
type BlockHeader ¶
type BlockHeader struct {
Timestamp BlockTimestamp `json:"timestamp"`
Producer Name `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"`
// EOSIO 1.x
NewProducersV1 *ProducerSchedule `json:"new_producers,omitempty" eosio:"optional"`
HeaderExtensions []TransactionExtension `json:"header_extensions"`
}
type BlockNum ¶
type BlockNum uint32
Type representing a block number, EOSIO chains are only expected to live for 68 years, sorry kids!
func (BlockNum) MarshalJSON ¶
func (*BlockNum) UnmarshalJSON ¶
type BlockTimestamp ¶
type BlockTimestamp uint32
func NewBlockTimestamp ¶
func NewBlockTimestamp(t time.Time) BlockTimestamp
func NewBlockTimestampFromString ¶
func NewBlockTimestampFromString(s string) (BlockTimestamp, error)
func (BlockTimestamp) MarshalABI ¶
func (bts BlockTimestamp) MarshalABI(e *abi.Encoder) error
func (BlockTimestamp) MarshalText ¶
func (bts BlockTimestamp) MarshalText() (text []byte, err error)
func (BlockTimestamp) String ¶
func (bts BlockTimestamp) String() string
func (BlockTimestamp) Time ¶
func (bts BlockTimestamp) Time() time.Time
func (*BlockTimestamp) UnmarshalABI ¶
func (bts *BlockTimestamp) UnmarshalABI(d *abi.Decoder) error
func (*BlockTimestamp) UnmarshalText ¶
func (bts *BlockTimestamp) UnmarshalText(text []byte) error
type Bytes ¶
type Bytes []byte
Binary data type, encodes to hex string in JSON. Use the Blob type instead where possible since it encodes to base64.
func (Bytes) MarshalText ¶
func (*Bytes) UnmarshalText ¶
type Checksum160 ¶
type Checksum160 [20]byte
ripemd160 checksum type
func Checksum160Digest ¶
func Checksum160Digest(message []byte) Checksum160
Return ripemd160 hash of message
func (*Checksum160) MarshalABI ¶
func (c160 *Checksum160) MarshalABI(e *abi.Encoder) error
func (Checksum160) MarshalText ¶
func (c160 Checksum160) MarshalText() (text []byte, err error)
func (Checksum160) String ¶
func (c Checksum160) String() string
func (*Checksum160) UnmarshalABI ¶
func (c160 *Checksum160) UnmarshalABI(d *abi.Decoder) error
func (*Checksum160) UnmarshalText ¶
func (c160 *Checksum160) UnmarshalText(text []byte) error
type Checksum256 ¶
type Checksum256 [32]byte
sha256 checksum type
func Checksum256Digest ¶
func Checksum256Digest(message []byte) Checksum256
Return sha256 hash of message
func (*Checksum256) MarshalABI ¶
func (c256 *Checksum256) MarshalABI(e *abi.Encoder) error
func (Checksum256) MarshalText ¶
func (c256 Checksum256) MarshalText() (text []byte, err error)
func (Checksum256) String ¶
func (c Checksum256) String() string
func (*Checksum256) UnmarshalABI ¶
func (c256 *Checksum256) UnmarshalABI(d *abi.Decoder) error
func (*Checksum256) UnmarshalText ¶
func (c256 *Checksum256) UnmarshalText(text []byte) error
type Checksum512 ¶
type Checksum512 [64]byte
sha512 checksum type
func Checksum512Digest ¶
func Checksum512Digest(message []byte) Checksum512
Return sha512 hash of message
func (*Checksum512) MarshalABI ¶
func (c512 *Checksum512) MarshalABI(e *abi.Encoder) error
func (Checksum512) MarshalText ¶
func (c512 Checksum512) MarshalText() (text []byte, err error)
func (Checksum512) String ¶
func (c Checksum512) String() string
func (*Checksum512) UnmarshalABI ¶
func (c512 *Checksum512) UnmarshalABI(d *abi.Decoder) error
func (*Checksum512) UnmarshalText ¶
func (c512 *Checksum512) UnmarshalText(text []byte) error
type CompressionType ¶
type CompressionType uint8
func (CompressionType) MarshalABI ¶
func (b CompressionType) MarshalABI(e *abi.Encoder) error
func (CompressionType) String ¶
func (c CompressionType) String() string
func (*CompressionType) UnmarshalABI ¶
func (b *CompressionType) UnmarshalABI(d *abi.Decoder) error
type ExtendedAsset ¶
func (*ExtendedAsset) MarshalABI ¶
func (ea *ExtendedAsset) MarshalABI(e *abi.Encoder) error
func (*ExtendedAsset) UnmarshalABI ¶
func (ea *ExtendedAsset) UnmarshalABI(d *abi.Decoder) error
type Float128 ¶
type Float128 struct {
Data [16]byte // not sure what the best way to represent this is, abieos seems to use a hex string ¯\_(ツ)_/¯
}
func (Float128) MarshalText ¶
func (*Float128) UnmarshalText ¶
type Int128 ¶
type Int128 Uint128
func NewInt128FromString ¶
func (Int128) MarshalText ¶
func (*Int128) UnmarshalText ¶
type Name ¶
type Name uint64
Type representing an EOSIO name.
func (Name) MarshalText ¶
func (*Name) UnmarshalText ¶
type PackedTransaction ¶
type PackedTransaction struct {
Signatures []Signature `json:"signatures"`
Compression CompressionType `json:"compression"` // in C++, it's an enum, not sure how it Binary-marshals..
PackedContextFreeData Bytes `json:"packed_context_free_data"`
PackedTransaction Bytes `json:"packed_trx"`
}
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.
type PermissionLevel ¶
func (PermissionLevel) MarshalABI ¶
func (pl PermissionLevel) MarshalABI(e *abi.Encoder) error
func (*PermissionLevel) UnmarshalABI ¶
func (pl *PermissionLevel) UnmarshalABI(d *abi.Decoder) error
type ProducerKey ¶
type ProducerSchedule ¶
type ProducerSchedule struct {
Version uint32 `json:"version"`
Producers []ProducerKey `json:"producers"`
}
type PublicKey ¶
func NewPublicKey ¶
func NewPublicKeyFromString ¶
func (*PublicKey) LegacyString ¶
panics if key type isn't k1
func (PublicKey) MarshalText ¶
func (*PublicKey) UnmarshalText ¶
type Signature ¶
func MustNewSignatureString ¶
func NewSignature ¶
func NewSignatureString ¶
func (*Signature) MarshalText ¶
func (*Signature) UnmarshalText ¶
type Symbol ¶
type Symbol uint64
func NewSymbolFromString ¶
Create new asset symbol from string, e.g. "4,EOS"
func (Symbol) MarshalText ¶
func (*Symbol) UnmarshalText ¶
type SymbolCode ¶
type SymbolCode uint64
func (SymbolCode) MarshalABI ¶
func (sc SymbolCode) MarshalABI(e *abi.Encoder) error
func (SymbolCode) MarshalText ¶
func (sc SymbolCode) MarshalText() (text []byte, err error)
func (*SymbolCode) UnmarshalABI ¶
func (sc *SymbolCode) UnmarshalABI(d *abi.Decoder) error
func (*SymbolCode) UnmarshalText ¶
func (sc *SymbolCode) UnmarshalText(text []byte) error
type TimePoint ¶
type TimePoint int64
func NewTimePoint ¶
func NewTimePointFromString ¶
func (TimePoint) MarshalText ¶
func (*TimePoint) UnmarshalText ¶
type TimePointSec ¶
type TimePointSec uint32
func NewTimePointSec ¶
func NewTimePointSec(t time.Time) TimePointSec
func NewTimePointSecFromString ¶
func NewTimePointSecFromString(s string) (TimePointSec, error)
func (TimePointSec) MarshalABI ¶
func (tps TimePointSec) MarshalABI(e *abi.Encoder) error
func (TimePointSec) MarshalText ¶
func (tps TimePointSec) MarshalText() (text []byte, err error)
func (TimePointSec) String ¶
func (tps TimePointSec) String() string
func (TimePointSec) Time ¶
func (tps TimePointSec) Time() time.Time
func (*TimePointSec) UnmarshalABI ¶
func (tps *TimePointSec) UnmarshalABI(d *abi.Decoder) error
func (*TimePointSec) UnmarshalText ¶
func (tps *TimePointSec) UnmarshalText(text []byte) error
type Transaction ¶
type Transaction struct {
TransactionHeader
ContextFreeActions []Action `json:"context_free_actions"`
Actions []Action `json:"actions"`
Extensions []TransactionExtension `json:"transaction_extensions"`
}
func (Transaction) MarshalABI ¶
func (tx Transaction) MarshalABI(e *abi.Encoder) error
func (*Transaction) UnmarshalABI ¶
func (tx *Transaction) UnmarshalABI(d *abi.Decoder) error
type TransactionExtension ¶
func (TransactionExtension) MarshalABI ¶
func (txe TransactionExtension) MarshalABI(e *abi.Encoder) error
func (*TransactionExtension) UnmarshalABI ¶
func (txe *TransactionExtension) UnmarshalABI(d *abi.Decoder) error
type TransactionHeader ¶
type TransactionHeader struct {
Expiration TimePointSec `json:"expiration"`
RefBlockNum uint16 `json:"ref_block_num"`
RefBlockPrefix uint32 `json:"ref_block_prefix"`
MaxNetUsageWords uint `json:"max_net_usage_words"`
MaxCpuUsageMs uint8 `json:"max_cpu_usage_ms"`
DelaySec uint `json:"delay_sec"`
}
func (TransactionHeader) MarshalABI ¶
func (txh TransactionHeader) MarshalABI(e *abi.Encoder) error
func (*TransactionHeader) UnmarshalABI ¶
func (txh *TransactionHeader) UnmarshalABI(d *abi.Decoder) error
type TransactionReceiptHeader ¶
type TransactionReceiptHeader struct {
Status TransactionStatus `json:"status"`
CPUUsageMicroSeconds uint32 `json:"cpu_usage_us"`
NetUsageWords uint `json:"net_usage_words"`
}
type TransactionStatus ¶
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) MarshalABI ¶
func (txs TransactionStatus) MarshalABI(e *abi.Encoder) error
func (TransactionStatus) String ¶
func (txs TransactionStatus) String() string
func (*TransactionStatus) UnmarshalABI ¶
func (txs *TransactionStatus) UnmarshalABI(d *abi.Decoder) error
type Uint64 ¶
type Uint64 uint64
uint64 alias that encodes to string for values above 32bit instead of scientific notation in JSON
func (Uint64) MarshalJSON ¶
func (*Uint64) UnmarshalJSON ¶
type Uint128 ¶
func NewUint128 ¶
Create new Uint128 from big.Int, panics if big.Int is too large.