Documentation ¶
Index ¶
- Constants
- Variables
- func BlockNum(blockID string) uint32
- func EnableDebugLogging(l *zap.Logger)
- func ExtendedStringToName(s string) (val uint64, err error)
- func MarshalBinary(v interface{}) ([]byte, error)
- func MustStringToName(s string) (val uint64)
- func NameToString(in uint64) string
- func NewLogger(production bool) *zap.Logger
- func RegisterAction(accountName AccountName, actionName ActionName, obj interface{})
- func SetFloat64MarshalingTypeIntoNumber()
- func SetFloat64MarshalingTypeIntoString()
- func SigDigest(chainID, payload, contextFreeData []byte) []byte
- func StringToName(s string) (val uint64, err error)
- func UnmarshalBinary(data []byte, v interface{}) (err error)
- func UnmarshalBinaryReader(reader io.Reader, v interface{}) (err error)
- type ABI
- func (a *ABI) ActionForName(name ActionName) *ActionDef
- func (a *ABI) ActionResultForName(name ActionName) *ActionResultDef
- func (a *ABI) Decode(binaryDecoder *Decoder, structName string) ([]byte, error)
- func (a *ABI) DecodeAction(data []byte, actionName ActionName) ([]byte, error)
- func (a *ABI) DecodeActionResult(data []byte, actionName ActionName) ([]byte, error)
- func (a *ABI) DecodeTableRow(tableName TableName, data []byte) ([]byte, error)
- func (a *ABI) DecodeTableRowTyped(tableType string, data []byte) ([]byte, error)
- func (a *ABI) EncodeAction(actionName ActionName, json []byte) ([]byte, error)
- func (a *ABI) EncodeStruct(structName string, json []byte) ([]byte, error)
- func (a *ABI) EncodeTable(tableName TableName, json []byte) ([]byte, error)
- func (a *ABI) SetFitNodeos(v bool)
- func (a *ABI) StructForName(name string) *StructDef
- func (a *ABI) TableForName(name TableName) *TableDef
- func (a *ABI) TypeNameForNewTypeName(typeName string) (resolvedTypeName string, isAlias bool)
- func (a *ABI) VariantForName(name string) *VariantDef
- type ABIBinToJSONResp
- type ABIEncoder
- type ABIErrorMessage
- type ABIJSONToBinResp
- type ABIType
- type API
- func (api *API) ABIBinToJSON(ctx context.Context, code AccountName, action Name, payload HexBytes) (out M, err error)
- func (api *API) ABIJSONToBin(ctx context.Context, code AccountName, action Name, payload M) (out HexBytes, err error)
- func (api *API) CreateSnapshot(ctx context.Context) (out *CreateSnapshotResp, err error)
- func (api *API) EnableKeepAlives() bool
- func (api *API) FixKeepAlives(ctx context.Context) bool
- func (api *API) GetABI(ctx context.Context, account AccountName) (out *GetABIResp, err error)
- func (api *API) GetAccount(ctx context.Context, name AccountName, opts ...GetAccountOption) (out *AccountResp, err error)
- func (api *API) GetAccountsByAuthorizers(ctx context.Context, authorizations []PermissionLevel, keys []ecc.PublicKey) (out *GetAccountsByAuthorizersResp, err error)
- func (api *API) GetActions(ctx context.Context, params GetActionsRequest) (out *ActionsResp, err error)
- func (api *API) GetBlockByID(ctx context.Context, id string) (out *BlockResp, err error)
- func (api *API) GetBlockByNum(ctx context.Context, num uint32) (out *BlockResp, err error)
- func (api *API) GetBlockByNumOrID(ctx context.Context, query string) (out *SignedBlock, err error)
- func (api *API) GetBlockByNumOrIDRaw(ctx context.Context, query string) (out interface{}, err error)
- func (api *API) GetBlockTraceByNum(ctx context.Context, num uint32) (out *BlockTraceResp, err error)
- func (api *API) GetCode(ctx context.Context, account AccountName) (out *GetCodeResp, err error)
- func (api *API) GetCodeHash(ctx context.Context, account AccountName) (out Checksum256, err error)
- func (api *API) GetControlledAccounts(ctx context.Context, controllingAccount string) (out *ControlledAccountsResp, err error)
- func (api *API) GetCurrencyBalance(ctx context.Context, account AccountName, symbol string, code AccountName) (out []Asset, err error)
- func (api *API) GetCurrencyStats(ctx context.Context, code AccountName, symbol string) (out *GetCurrencyStatsResp, err error)
- func (api *API) GetDBSize(ctx context.Context) (out *DBSizeResp, err error)
- func (api *API) GetInfo(ctx context.Context) (out *InfoResp, err error)
- func (api *API) GetIntegrityHash(ctx context.Context) (out *GetIntegrityHashResp, err error)
- func (api *API) GetKeyAccounts(ctx context.Context, publicKey string) (out *KeyAccountsResp, err error)
- func (api *API) GetNetConnections(ctx context.Context) (out []*NetConnectionsResp, err error)
- func (api *API) GetNetStatus(ctx context.Context, host string) (out *NetStatusResp, err error)
- func (api *API) GetProducerProtocolFeatures(ctx context.Context) (out []ProtocolFeature, err error)
- func (api *API) GetProducers(ctx context.Context) (out *ProducersResp, err error)
- func (api *API) GetPublicKeys(ctx context.Context) (out []*ecc.PublicKey, err error)
- func (api *API) GetRawABI(ctx context.Context, params GetRawABIRequest) (out *GetRawABIResp, err error)
- func (api *API) GetRawCodeAndABI(ctx context.Context, account AccountName) (out *GetRawCodeAndABIResp, err error)
- func (api *API) GetRequiredKeys(ctx context.Context, tx *Transaction) (out *GetRequiredKeysResp, err error)
- func (api *API) GetScheduledTransactions(ctx context.Context) (out *ScheduledTransactionsResp, err error)
- func (api *API) GetScheduledTransactionsWithBounds(ctx context.Context, lower_bound string, limit uint32) (out *ScheduledTransactionsResp, err error)
- func (api *API) GetTableByScope(ctx context.Context, params GetTableByScopeRequest) (out *GetTableByScopeResp, err error)
- func (api *API) GetTableRows(ctx context.Context, params GetTableRowsRequest) (out *GetTableRowsResp, err error)
- func (api *API) GetTransaction(ctx context.Context, id string) (out *TransactionResp, err error)
- func (api *API) GetTransactionRaw(ctx context.Context, id string) (out json.RawMessage, err error)
- func (api *API) GetTransactions(ctx context.Context, name AccountName) (out *TransactionsResp, err error)
- func (api *API) IsProducerPaused(ctx context.Context) (out bool, err error)
- func (api *API) ListKeys(ctx context.Context, walletNames ...string) (out []*ecc.PrivateKey, err error)
- func (api *API) ListWallets(ctx context.Context, walletName ...string) (out []string, err error)
- func (api *API) NetConnect(ctx context.Context, host string) (out NetConnectResp, err error)
- func (api *API) NetDisconnect(ctx context.Context, host string) (out NetDisconnectResp, err error)
- func (api *API) ProducerPause(ctx context.Context) error
- func (api *API) ProducerResume(ctx context.Context) error
- func (api *API) PushTransaction(ctx context.Context, tx *PackedTransaction) (out *PushTransactionFullResp, err error)
- func (api *API) PushTransactionRaw(ctx context.Context, tx *PackedTransaction) (out json.RawMessage, err error)
- func (api *API) ScheduleProducerProtocolFeatureActivations(ctx context.Context, protocolFeaturesToActivate []Checksum256) error
- func (api *API) SendTransaction(ctx context.Context, tx *PackedTransaction) (out *PushTransactionFullResp, err error)
- func (api *API) SendTransactionRaw(ctx context.Context, tx *PackedTransaction) (out json.RawMessage, err error)
- func (api *API) SetCustomGetRequiredKeys(f func(ctx context.Context, tx *Transaction) ([]ecc.PublicKey, error))
- func (api *API) SetSigner(s Signer)
- func (api *API) SignPushActions(ctx context.Context, a ...*Action) (out *PushTransactionFullResp, err error)
- func (api *API) SignPushActionsWithOpts(ctx context.Context, actions []*Action, opts *TxOptions) (out *PushTransactionFullResp, err error)
- func (api *API) SignPushTransaction(ctx context.Context, tx *Transaction, chainID Checksum256, ...) (out *PushTransactionFullResp, err error)
- func (api *API) SignTransaction(ctx context.Context, tx *Transaction, chainID Checksum256, ...) (*SignedTransaction, *PackedTransaction, error)
- func (api *API) UsePartialRequiredKeys()
- func (api *API) WalletCreate(ctx context.Context, walletName string) (err error)
- func (api *API) WalletImportKey(ctx context.Context, walletName, wifPrivKey string) (err error)
- func (api *API) WalletLock(ctx context.Context, walletName string) (err error)
- func (api *API) WalletLockAll(ctx context.Context) (err error)
- func (api *API) WalletOpen(ctx context.Context, walletName string) (err error)
- func (api *API) WalletPublicKeys(ctx context.Context) (out []ecc.PublicKey, err error)
- func (api *API) WalletSetTimeout(ctx context.Context, timeout int32) (err error)
- func (api *API) WalletSignTransaction(ctx context.Context, tx *SignedTransaction, chainID []byte, ...) (out *WalletSignTransactionResp, err error)
- func (api *API) WalletUnlock(ctx context.Context, walletName, password string) (err error)
- type APIError
- type APIErrorDetail
- type AccountDelta
- type AccountName
- type AccountRAMDeltadeprecated
- type AccountResourceLimit
- type AccountResp
- type AccountResult
- type ActTrace
- type Action
- type ActionData
- type ActionDef
- type ActionName
- type ActionResp
- type ActionResultDef
- type ActionTrace
- type ActionTraceReceipt
- type ActionsResp
- type Asset
- func NewAsset(in string) (out Asset, err error)deprecated
- func NewAssetFromString(in string) (out Asset, err error)
- func NewEOSAsset(amount int64) Asset
- func NewEOSAssetFromString(input string) (Asset, error)
- func NewFixedSymbolAssetFromString(symbol Symbol, input string) (out Asset, err error)
- func NewREXAssetFromString(input string) (Asset, error)
- func NewTNTAssetFromString(input string) (Asset, error)
- type Authority
- type BaseVariant
- func (a *BaseVariant) Assign(typeID uint32, impl interface{})
- func (a *BaseVariant) MarshalJSON(def *VariantDefinition) ([]byte, error)
- func (a *BaseVariant) Obtain(def *VariantDefinition) (typeID uint32, typeName string, impl interface{})
- func (a *BaseVariant) UnmarshalBinaryVariant(decoder *Decoder, def *VariantDefinition) error
- func (a *BaseVariant) UnmarshalJSON(data []byte, def *VariantDefinition) error
- type Blob
- type BlockHeader
- type BlockHeaderExtension
- type BlockHeaderExtensionType
- type BlockResp
- type BlockSigningAuthority
- type BlockSigningAuthorityV0
- type BlockState
- type BlockTimestamp
- type BlockTraceResp
- type Bool
- type ChainSizeMessage
- type Checksum160
- type Checksum256
- type Checksum512
- type ClausePair
- type CompressionType
- type ControlledAccountsResp
- type CreateSnapshotResp
- type Currency
- type CurrencyBalanceResp
- type CurrencyName
- type DBSizeResp
- type DataAccess
- type DecodeOption
- type Decoder
- func (d *Decoder) Decode(v interface{}, options ...DecodeOption) (err error)
- func (d *Decoder) DecodeActions(decode bool)
- func (d *Decoder) DecodeP2PMessage(decode bool)
- func (d *Decoder) LastPos() int
- func (d *Decoder) ReadActionData(action *Action) (err error)
- func (d *Decoder) ReadAsset() (out Asset, err error)
- func (d *Decoder) ReadBlockTimestamp() (out BlockTimestamp, err error)
- func (d *Decoder) ReadBool() (out bool, err error)
- func (d *Decoder) ReadByte() (out byte, err error)
- func (d *Decoder) ReadByteArray() (out []byte, err error)
- func (d *Decoder) ReadChecksum160() (out Checksum160, err error)
- func (d *Decoder) ReadChecksum256() (out Checksum256, err error)
- func (d *Decoder) ReadChecksum512() (out Checksum512, err error)
- func (d *Decoder) ReadCurrencyName() (out CurrencyName, err error)
- func (d *Decoder) ReadExtendedAsset() (out ExtendedAsset, err error)
- func (d *Decoder) ReadFloat32() (out float32, err error)
- func (d *Decoder) ReadFloat64() (out float64, err error)
- func (d *Decoder) ReadInt128() (out Int128, err error)
- func (d *Decoder) ReadInt16() (out int16, err error)
- func (d *Decoder) ReadInt32() (out int32, err error)
- func (d *Decoder) ReadInt64() (out int64, err error)
- func (d *Decoder) ReadInt8() (out int8, err error)
- func (d *Decoder) ReadJSONTime() (jsonTime JSONTime, err error)
- func (d *Decoder) ReadName() (out Name, err error)
- func (d *Decoder) ReadNodeosFloat32() (out float32, err error)
- func (d *Decoder) ReadP2PMessageEnvelope() (out *Packet, err error)
- func (d *Decoder) ReadPublicKey() (out ecc.PublicKey, err error)
- func (d *Decoder) ReadSignature() (out ecc.Signature, err error)
- func (d *Decoder) ReadString() (out string, err error)
- func (d *Decoder) ReadSymbol() (out *Symbol, err error)
- func (d *Decoder) ReadSymbolCode() (out SymbolCode, err error)
- func (d *Decoder) ReadTimePoint() (out TimePoint, err error)
- func (d *Decoder) ReadTimePointSec() (out TimePointSec, err error)
- func (d *Decoder) ReadTstamp() (out Tstamp, err error)
- func (d *Decoder) ReadUInt8() (out uint8, err error)deprecated
- func (d *Decoder) ReadUint128(typeName string) (out Uint128, err error)
- func (d *Decoder) ReadUint16() (out uint16, err error)
- func (d *Decoder) ReadUint32() (out uint32, err error)
- func (d *Decoder) ReadUint64() (out uint64, err error)
- func (d *Decoder) ReadUint8() (out uint8, err error)
- func (d *Decoder) ReadUvarint32() (out uint32, err error)
- func (d *Decoder) ReadUvarint64() (uint64, error)
- func (d *Decoder) ReadVarint32() (out int32, err error)
- func (d *Decoder) ReadVarint64() (out int64, err error)
- func (d *Decoder) SafeReadUTF8String() (out string, err error)
- type DeferredTransaction
- type DelegatedBandwidth
- type Encoder
- type Except
- type ExceptLogContext
- type ExceptLogLevel
- type ExceptLogMessage
- type ExtendedAsset
- type Extension
- type FieldDef
- type Float128
- type Float64
- type GetABIResp
- type GetAccountOption
- type GetAccountsByAuthorizersResp
- type GetActionsRequest
- type GetCodeHashResp
- type GetCodeResp
- type GetCurrencyStatsResp
- type GetIntegrityHashResp
- type GetRawABIRequest
- type GetRawABIResp
- type GetRawCodeAndABIResp
- type GetRequiredKeysResp
- type GetTableByScopeRequest
- type GetTableByScopeResp
- type GetTableRowsRequest
- type GetTableRowsResp
- type Global
- type GoAwayMessage
- type GoAwayReason
- type HandshakeMessage
- type HexBytes
- type IDListMode
- type InfoResp
- type Int128
- type Int64
- type JSONFloat64
- type JSONInt64
- type JSONTime
- type KeyAccountsResp
- type KeyBag
- func (b *KeyBag) Add(wifKey string) error
- func (b *KeyBag) Append(privateKey *ecc.PrivateKey) error
- func (b *KeyBag) AvailableKeys(ctx context.Context) (out []ecc.PublicKey, err error)
- func (b *KeyBag) ImportFromFile(path string) error
- func (b *KeyBag) ImportPrivateKey(ctx context.Context, wifPrivKey string) (err error)
- func (b *KeyBag) Sign(ctx context.Context, tx *SignedTransaction, chainID []byte, ...) (*SignedTransaction, error)
- func (b *KeyBag) SignDigest(digest []byte, requiredKey ecc.PublicKey) (ecc.Signature, error)
- type KeyWeight
- type LinkedAction
- type M
- type MarshalerBinary
- type MerkleRoot
- type MessageReflectTypes
- type MyStruct
- type Name
- type NetConnectResp
- type NetConnectionsResp
- type NetDisconnectResp
- type NetStatusResp
- type NoticeMessage
- type OnVariant
- type OrderedBlockIDs
- type OrderedTransactionIDs
- type P2PMessage
- type P2PMessageType
- type PackedTransaction
- type PackedTransactionMessage
- type Packet
- type PairAccountNameBlockNum
- type PendingSchedule
- type PermLevel
- type Permission
- type PermissionLevel
- type PermissionLevelWeight
- type PermissionName
- type ProcessedTransaction
- type Producer
- type ProducerAuthority
- type ProducerAuthoritySchedule
- type ProducerChange
- type ProducerKey
- type ProducerSchedule
- type ProducerScheduleChangeExtension
- type ProducerScheduleOrAuthoritySchedule
- type ProducersResp
- type ProtocolFeature
- type ProtocolFeatureActivationExtension
- type ProtocolFeatureActivationSet
- type ProtocolFeatureSpecification
- type PushTransactionFullResp
- type PushTransactionShortResp
- type Receipt
- type RefundRequest
- type RequestMessage
- type RexInfo
- type SHA256Bytes
- type SafeString
- type ScheduledTransaction
- type ScheduledTransactionsResp
- type ScopeName
- type SequencedTransactionResp
- type SetABI
- type SetCode
- type SignedBlock
- type SignedBlockHeader
- type SignedTransaction
- func (s *SignedTransaction) Pack(compression CompressionType) (*PackedTransaction, error)
- func (s *SignedTransaction) PackedTransactionAndCFD() ([]byte, []byte, error)
- func (s *SignedTransaction) SignedByKeys(chainID Checksum256) (out []ecc.PublicKey, err error)
- func (s *SignedTransaction) String() string
- type SignedTransactionMessage
- type Signer
- type StructDef
- type SubjectiveRestriction
- type Symbol
- type SymbolCode
- type SyncRequestMessage
- type TableDef
- type TableName
- type TimeMessage
- type TimePoint
- type TimePointSec
- type TotalResources
- type Trace
- type Transaction
- type TransactionHeader
- type TransactionProcessed
- type TransactionReceipt
- type TransactionReceiptHeader
- type TransactionResp
- type TransactionStatus
- type TransactionTrace
- type TransactionTraceAuthSequence
- type TransactionWithID
- type TransactionsResp
- type TrxTrace
- type Tstamp
- type TxOptions
- type Uint128
- type Uint64
- type UnmarshalerBinary
- type Variant
- type VariantDef
- type VariantDefinition
- type VariantImplFactory
- type VariantType
- type Varint32
- type Varuint32
- type VoterInfo
- type WaitWeight
- type WalletSignTransactionResp
- type WalletSigner
Examples ¶
Constants ¶
const ( GoAwayNoReason = GoAwayReason(iota) GoAwaySelfConnect GoAwayDuplicate GoAwayWrongChain GoAwayWrongVersion GoAwayForked GoAwayUnlinkable GoAwayBadTransaction GoAwayValidation GoAwayBenignOther GoAwayFatalOther GoAwayAuthentication )
See plugins/net_plugin/include/eosio/net_plugin/protocol.hpp#L39
const ( CompressionNone = CompressionType(iota) CompressionZlib )
const JSONTimeFormat = "2006-01-02T15:04:05"
const OptionalField optionalFieldType = true
Variables ¶
var BlockSigningAuthorityVariant = NewVariantDefinition([]VariantType{ {"block_signing_authority_v0", (*BlockSigningAuthorityV0)(nil)}, })
See libraries/chain/include/eosio/chain/producer_schedule.hpp#L161
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 REXSymbol = Symbol{Precision: 4, Symbol: "REX"}
REXSymbol represents the standard REX symbol on the chain. It's here just to speed up things.
var RegisteredActions = map[AccountName]map[ActionName]reflect.Type{}
var TNTSymbol = Symbol{Precision: 4, Symbol: "TNT"}
TNTSymbol represents the standard EOSIO Testnet symbol on the testnet chain. Temporary Network Token (TNT) is the native token of the EOSIO Testnet. It's here just to speed up things.
var TypeSize = struct { Bool int Byte int Int8 int Int16 int Uint8 int Uint16 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 // Deprecated: use Uint8 instead UInt8 int // Deprecated: use Uint16 instead UInt16 int // Deprecated: use Uint32 instead UInt32 int // Deprecated: use Uint64 instead UInt64 int // Deprecated: use Uint128 instead UInt128 int }{ Byte: 1, Bool: 1, Int8: 1, Int16: 2, Uint8: 1, Uint16: 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, }
Functions ¶
func EnableDebugLogging ¶ added in v0.10.4
func ExtendedStringToName ¶ added in v0.8.10
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 ¶
func MustStringToName ¶ added in v0.10.4
func NameToString ¶
func RegisterAction ¶
func RegisterAction(accountName AccountName, actionName ActionName, obj interface{})
Registers Action objects..
func SetFloat64MarshalingTypeIntoNumber ¶ added in v0.10.7
func SetFloat64MarshalingTypeIntoNumber()
func SetFloat64MarshalingTypeIntoString ¶ added in v0.10.7
func SetFloat64MarshalingTypeIntoString()
func StringToName ¶
func UnmarshalBinary ¶
func UnmarshalBinaryReader ¶
Types ¶
type ABI ¶
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"` Variants []VariantDef `json:"variants,omitempty" eos:"binary_extension"` ActionResults []ActionResultDef `json:"action_results,omitempty" eos:"binary_extension"` // contains filtered or unexported fields }
see: libraries/chain/contracts/abi_serializer.cpp:53... see: libraries/chain/include/eosio/chain/contracts/types.hpp:100
func (*ABI) ActionForName ¶
func (a *ABI) ActionForName(name ActionName) *ActionDef
func (*ABI) ActionResultForName ¶ added in v0.10.7
func (a *ABI) ActionResultForName(name ActionName) *ActionResultDef
func (*ABI) DecodeAction ¶
func (a *ABI) DecodeAction(data []byte, actionName ActionName) ([]byte, error)
func (*ABI) DecodeActionResult ¶ added in v0.10.7
func (a *ABI) DecodeActionResult(data []byte, actionName ActionName) ([]byte, error)
func (*ABI) DecodeTableRow ¶
func (*ABI) DecodeTableRowTyped ¶
Example ¶
package main import ( "encoding/hex" "fmt" "strings" eos "github.com/qqtou/eos-go" ) func main() { abi, err := eos.NewABI(strings.NewReader(abiJSON())) if err != nil { panic(fmt.Errorf("get ABI: %w", err)) } tableDef := abi.TableForName(eos.TableName("votes")) 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: %w", err)) } fmt.Println(string(bytes)) } func data() []byte { bytes, err := hex.DecodeString(`424e544441505000`) if err != nil { panic(fmt.Errorf("decode data: %w", err)) } return bytes } func abiJSON() string { return `{ "structs": [ { "name": "vote_t", "fields": [ { "name": "symbl", "type": "symbol_code" } ] } ], "actions": [], "tables": [ { "name": "votes", "type": "vote_t" } ] }` }
Output:
func (*ABI) EncodeAction ¶
func (a *ABI) EncodeAction(actionName ActionName, json []byte) ([]byte, error)
func (*ABI) EncodeStruct ¶ added in v0.10.4
func (*ABI) EncodeTable ¶ added in v0.10.4
func (*ABI) SetFitNodeos ¶ added in v0.10.4
func (*ABI) StructForName ¶
func (*ABI) TableForName ¶
func (*ABI) TypeNameForNewTypeName ¶
func (*ABI) VariantForName ¶ added in v0.8.15
func (a *ABI) VariantForName(name string) *VariantDef
type ABIBinToJSONResp ¶
type ABIBinToJSONResp struct {
Args M `json:"args"`
}
type ABIEncoder ¶
type ABIEncoder struct {
// contains filtered or unexported fields
}
type ABIErrorMessage ¶
type ABIJSONToBinResp ¶
type ABIJSONToBinResp struct {
Binargs string `json:"binargs"`
}
type API ¶
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 (*API) ABIBinToJSON ¶
func (*API) ABIJSONToBin ¶
func (*API) CreateSnapshot ¶
func (api *API) CreateSnapshot(ctx context.Context) (out *CreateSnapshotResp, err error)
CreateSnapshot will write a snapshot file on a nodeos with `producer_api` plugin loaded.
func (*API) EnableKeepAlives ¶
func (*API) FixKeepAlives ¶
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 ¶
func (api *API) GetABI(ctx context.Context, account AccountName) (out *GetABIResp, err error)
func (*API) GetAccount ¶
func (api *API) GetAccount(ctx context.Context, name AccountName, opts ...GetAccountOption) (out *AccountResp, err error)
Example ¶
api := eos.New(getAPIURL()) account := eos.AccountName("eos.rex") info, err := api.GetAccount(context.Background(), account) if err != nil { if err == eos.ErrNotFound { fmt.Printf("unknown account: %s", account) return } panic(fmt.Errorf("get account: %w", err)) } bytes, err := json.Marshal(info) if err != nil { panic(fmt.Errorf("json marshal response: %w", err)) } fmt.Println(string(bytes))
Output:
func (*API) GetAccountsByAuthorizers ¶ added in v0.10.4
func (api *API) GetAccountsByAuthorizers(ctx context.Context, authorizations []PermissionLevel, keys []ecc.PublicKey) (out *GetAccountsByAuthorizersResp, err error)
func (*API) GetActions ¶
func (api *API) GetActions(ctx context.Context, params GetActionsRequest) (out *ActionsResp, err error)
func (*API) GetBlockByID ¶
func (*API) GetBlockByNum ¶
func (*API) GetBlockByNumOrID ¶
func (*API) GetBlockByNumOrIDRaw ¶
func (*API) GetBlockTraceByNum ¶ added in v0.10.5
func (*API) GetCode ¶
func (api *API) GetCode(ctx context.Context, account AccountName) (out *GetCodeResp, err error)
func (*API) GetCodeHash ¶
func (api *API) GetCodeHash(ctx context.Context, account AccountName) (out Checksum256, err error)
func (*API) GetControlledAccounts ¶ added in v0.8.8
func (*API) GetCurrencyBalance ¶
func (api *API) GetCurrencyBalance(ctx context.Context, account AccountName, symbol string, code AccountName) (out []Asset, err error)
func (*API) GetCurrencyStats ¶ added in v0.8.1
func (api *API) GetCurrencyStats(ctx context.Context, code AccountName, symbol string) (out *GetCurrencyStatsResp, err error)
func (*API) GetInfo ¶
Example ¶
api := eos.New(getAPIURL()) info, err := api.GetInfo(context.Background()) if err != nil { panic(fmt.Errorf("get info: %w", err)) } bytes, err := json.Marshal(info) if err != nil { panic(fmt.Errorf("json marshal response: %w", err)) } fmt.Println(string(bytes))
Output:
func (*API) GetIntegrityHash ¶
func (api *API) GetIntegrityHash(ctx context.Context) (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 ¶ added in v0.8.8
func (*API) GetNetConnections ¶
func (api *API) GetNetConnections(ctx context.Context) (out []*NetConnectionsResp, err error)
func (*API) GetNetStatus ¶
func (*API) GetProducerProtocolFeatures ¶ added in v0.10.4
func (api *API) GetProducerProtocolFeatures(ctx context.Context) (out []ProtocolFeature, err error)
func (*API) GetProducers ¶
func (api *API) GetProducers(ctx context.Context) (out *ProducersResp, err error)
Example ¶
api := eos.New(getAPIURL()) resp, err := api.GetProducers(context.Background()) if err != nil { panic(fmt.Errorf("get account: %w", err)) } sort.Slice(resp.Producers, func(i, j int) bool { if resp.Producers[i].IsActive && !resp.Producers[j].IsActive { return true } return resp.Producers[i].TotalVotes < resp.Producers[j].TotalVotes }) for _, producer := range resp.Producers { fmt.Printf("Producer %s (%s) with %.5f votes (last claimed %s)\n", producer.Owner, producer.URL, producer.TotalVotes, producer.LastClaimTime) } fmt.Printf("Total Vote Weight: %.4f\n", resp.TotalProducerVoteWeight) fmt.Printf("More: %s\n", resp.More)
Output:
func (*API) GetPublicKeys ¶
func (*API) GetRawABI ¶ added in v0.8.1
func (api *API) GetRawABI(ctx context.Context, params GetRawABIRequest) (out *GetRawABIResp, err error)
func (*API) GetRawCodeAndABI ¶
func (api *API) GetRawCodeAndABI(ctx context.Context, account AccountName) (out *GetRawCodeAndABIResp, err error)
func (*API) GetRequiredKeys ¶
func (api *API) GetRequiredKeys(ctx context.Context, tx *Transaction) (out *GetRequiredKeysResp, err error)
func (*API) GetScheduledTransactions ¶
func (api *API) GetScheduledTransactions(ctx context.Context) (out *ScheduledTransactionsResp, err error)
GetScheduledTransactions returns the Top 100 scheduled transactions
func (*API) GetScheduledTransactionsWithBounds ¶
func (api *API) GetScheduledTransactionsWithBounds(ctx context.Context, lower_bound string, limit uint32) (out *ScheduledTransactionsResp, err error)
GetScheduledTransactionsWithBounds returns scheduled transactions within specified bounds
func (*API) GetTableByScope ¶ added in v0.8.1
func (api *API) GetTableByScope(ctx context.Context, params GetTableByScopeRequest) (out *GetTableByScopeResp, err error)
func (*API) GetTableRows ¶
func (api *API) GetTableRows(ctx context.Context, params GetTableRowsRequest) (out *GetTableRowsResp, err error)
func (*API) GetTransaction ¶
func (*API) GetTransactionRaw ¶
func (*API) GetTransactions ¶
func (api *API) GetTransactions(ctx context.Context, name AccountName) (out *TransactionsResp, err error)
func (*API) IsProducerPaused ¶
IsProducerPaused queries the blockchain for the pause statement of block production.
func (*API) ListWallets ¶
func (*API) NetConnect ¶
func (*API) NetDisconnect ¶
func (*API) ProducerPause ¶
ProducerPause will pause block production on a nodeos with `producer_api` plugin loaded.
func (*API) ProducerResume ¶
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 ¶
func (api *API) PushTransaction(ctx context.Context, tx *PackedTransaction) (out *PushTransactionFullResp, err error)
PushTransaction submits a properly filled (tapos), packed and signed transaction to the blockchain.
Example (Transfer_EOS) ¶
package main import ( "context" "encoding/hex" "encoding/json" "fmt" "os" eos "github.com/qqtou/eos-go" "github.com/qqtou/eos-go/token" ) func main() { api := eos.New(getAPIURL()) keyBag := &eos.KeyBag{} err := keyBag.ImportPrivateKey(context.Background(), readPrivateKey()) if err != nil { panic(fmt.Errorf("import private key: %w", err)) } api.SetSigner(keyBag) from := eos.AccountName("eosuser1") to := eos.AccountName("eosuser2") quantity, err := eos.NewEOSAssetFromString("1.0000 EOS") memo := "" if err != nil { panic(fmt.Errorf("invalid quantity: %w", err)) } txOpts := &eos.TxOptions{} if err := txOpts.FillFromChain(context.Background(), api); err != nil { panic(fmt.Errorf("filling tx opts: %w", err)) } tx := eos.NewTransaction([]*eos.Action{token.NewTransfer(from, to, quantity, memo)}, txOpts) signedTx, packedTx, err := api.SignTransaction(context.Background(), tx, txOpts.ChainID, eos.CompressionNone) if err != nil { panic(fmt.Errorf("sign transaction: %w", err)) } content, err := json.MarshalIndent(signedTx, "", " ") if err != nil { panic(fmt.Errorf("json marshalling transaction: %w", err)) } fmt.Println(string(content)) fmt.Println() response, err := api.PushTransaction(context.Background(), packedTx) if err != nil { panic(fmt.Errorf("push transaction: %w", err)) } fmt.Printf("Transaction [%s] submitted to the network succesfully.\n", hex.EncodeToString(response.Processed.ID)) } func readPrivateKey() string { // Right now, the key is read from an environment variable, it's an example after all. // In a real-world scenario, would you probably integrate with a real wallet or something similar envName := "EOS_GO_PRIVATE_KEY" privateKey := os.Getenv(envName) if privateKey == "" { panic(fmt.Errorf("private key environment variable %q must be set", envName)) } return privateKey }
Output:
func (*API) PushTransactionRaw ¶
func (api *API) PushTransactionRaw(ctx context.Context, tx *PackedTransaction) (out json.RawMessage, err error)
func (*API) ScheduleProducerProtocolFeatureActivations ¶ added in v0.10.4
func (api *API) ScheduleProducerProtocolFeatureActivations(ctx context.Context, protocolFeaturesToActivate []Checksum256) error
func (*API) SendTransaction ¶ added in v0.10.4
func (api *API) SendTransaction(ctx context.Context, tx *PackedTransaction) (out *PushTransactionFullResp, err error)
func (*API) SendTransactionRaw ¶ added in v0.10.4
func (api *API) SendTransactionRaw(ctx context.Context, tx *PackedTransaction) (out json.RawMessage, err error)
func (*API) SetCustomGetRequiredKeys ¶
func (*API) SignPushActions ¶
func (api *API) SignPushActions(ctx context.Context, 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 ¶
func (*API) SignPushTransaction ¶
func (api *API) SignPushTransaction(ctx context.Context, tx *Transaction, chainID Checksum256, compression CompressionType) (out *PushTransactionFullResp, err error)
SignPushTransaction will sign a transaction and submit it to the chain.
func (*API) SignTransaction ¶
func (api *API) SignTransaction(ctx context.Context, 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) UsePartialRequiredKeys ¶ added in v0.10.4
func (api *API) UsePartialRequiredKeys()
func (*API) WalletCreate ¶
func (*API) WalletImportKey ¶
WalletImportKey loads a new WIF-encoded key into the wallet.
func (*API) WalletLock ¶
func (*API) WalletOpen ¶
func (*API) WalletPublicKeys ¶
func (*API) WalletSetTimeout ¶
func (*API) WalletSignTransaction ¶
func (api *API) WalletSignTransaction(ctx context.Context, tx *SignedTransaction, chainID []byte, pubKeys ...ecc.PublicKey) (out *WalletSignTransactionResp, err error)
type APIError ¶
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 (APIError) IsUnknownKeyError ¶ added in v0.8.6
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 ¶
type AccountDelta ¶ added in v0.10.4
type AccountDelta struct { Account AccountName `json:"account"` Delta Int64 `json:"delta"` }
type AccountName ¶
type AccountName Name
func AN ¶
func AN(in string) AccountName
func (AccountName) String ¶ added in v0.10.4
func (n AccountName) String() string
type AccountRAMDelta
deprecated
added in
v0.10.4
type AccountRAMDelta struct { Account AccountName `json:"account"` Delta Int64 `json:"delta"` }
AccountRAMDelta
Deprecated: Use AccountDelta instead which is the struct name used in EOSIO
type AccountResourceLimit ¶
type AccountResp ¶
type AccountResp struct { AccountName AccountName `json:"account_name"` Privileged bool `json:"privileged"` LastCodeUpdate BlockTimestamp `json:"last_code_update"` // modified since EOSIO/Leap v2.0 YYYY-MM-DDTHH:MM:SS -> YYYY-MM-DDTHH:MM:SS.sss Created BlockTimestamp `json:"created"` // modified since EOSIO/Leap v2.0 YYYY-MM-DDTHH:MM:SS -> YYYY-MM-DDTHH:MM:SS.sss 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"` HeadBlockNum uint64 `json:"head_block_num"` // added since EOSIO/Leap v2.0 HeadBlockTime BlockTimestamp `json:"head_block_time"` // added since EOSIO/Leap v2.0 RexInfo *RexInfo `json:"rex_info,omitempty"` // added since EOSIO/Leap v2.0 SubjectiveSpuBillLimit AccountResourceLimit `json:"subjective_cpu_bill_limit"` // added since EOSIO/Leap v2.0 EosioAnyLinkedActions []LinkedAction `json:"eosio_any_linked_actions"` // added since EOSIO/Leap v2.0 }
type AccountResult ¶ added in v0.10.4
type AccountResult struct { Account AccountName `json:"account_name"` Permission PermissionName `json:"permission_name"` AuthorizingAccount *PermissionLevel `json:"authorizing_account,omitempty"` AuthorizingKey *ecc.PublicKey `json:"authorizing_key,omitempty"` Weight uint16 `json:"weight"` Threshold uint32 `json:"threshold"` }
TODO: what's the name of the struct
type ActTrace ¶ added in v0.10.5
type ActTrace struct { GlobalSequence Uint64 `json:"global_sequence"` Receiver AccountName `json:"receiver"` Account AccountName `json:"account"` Action ActionName `json:"action"` Authorization []PermLevel `json:"authorization"` Data HexBytes `json:"data,omitempty"` ReturnValue string `json:"return_value"` }
type Action ¶
type Action struct { Account AccountName `json:"account"` Name ActionName `json:"name"` Authorization []PermissionLevel `json:"authorization,omitempty"` ActionData }
Action
func (Action) Digest ¶
func (a Action) Digest() Checksum256
func (*Action) MapToRegisteredAction ¶
func (*Action) MarshalJSON ¶
type ActionData ¶
type ActionData struct { HexData HexBytes `json:"hex_data,omitempty"` Data interface{} `json:"data,omitempty" eos:"-"` // contains filtered or unexported fields }
func NewActionData ¶
func NewActionData(obj interface{}) ActionData
func NewActionDataFromHexData ¶
func NewActionDataFromHexData(data []byte) ActionData
func (*ActionData) EncodeActionData ¶
func (data *ActionData) EncodeActionData() ([]byte, error)
func (*ActionData) SetToServer ¶
func (a *ActionData) SetToServer(toServer bool)
type ActionDef ¶
type ActionDef struct { Name ActionName `json:"name"` Type string `json:"type"` RicardianContract string `json:"ricardian_contract"` }
type ActionName ¶
type ActionName Name
func ActN ¶
func ActN(in string) ActionName
func (ActionName) String ¶ added in v0.10.4
func (n ActionName) String() string
type ActionResp ¶
type ActionResp struct { GlobalSeq JSONInt64 `json:"global_action_seq"` AccountSeq JSONInt64 `json:"account_action_seq"` BlockNum uint32 `json:"block_num"` BlockTime BlockTimestamp `json:"block_time"` Trace ActionTrace `json:"action_trace"` Irreversible bool `json:"irreversible"` }
type ActionResultDef ¶ added in v0.10.7
type ActionResultDef struct { Name ActionName `json:"name"` ResultType string `json:"result_type"` }
type ActionTrace ¶
type ActionTrace struct { ActionOrdinal Varuint32 `json:"action_ordinal"` CreatorActionOrdinal Varuint32 `json:"creator_action_ordinal"` ClosestUnnotifiedAncestorActionOrdinal Varuint32 `json:"closest_unnotified_ancestor_action_ordinal"` Receipt *ActionTraceReceipt `json:"receipt,omitempty" eos:"optional"` Receiver AccountName `json:"receiver"` Action *Action `json:"act"` ContextFree bool `json:"context_free"` Elapsed Int64 `json:"elapsed"` Console SafeString `json:"console"` TransactionID Checksum256 `json:"trx_id"` BlockNum uint32 `json:"block_num"` BlockTime BlockTimestamp `json:"block_time"` ProducerBlockID Checksum256 `json:"producer_block_id" eos:"optional"` AccountRAMDeltas []*AccountRAMDelta `json:"account_ram_deltas"` Except *Except `json:"except,omitempty" eos:"optional"` ErrorCode *Uint64 `json:"error_code,omitempty" eos:"optional"` // Not present in EOSIO >= 1.8.x InlineTraces []ActionTrace `json:"inline_traces,omitempty" eos:"-"` }
type ActionTraceReceipt ¶ added in v0.8.14
type ActionTraceReceipt struct { Receiver AccountName `json:"receiver"` ActionDigest Checksum256 `json:"act_digest"` GlobalSequence Uint64 `json:"global_sequence"` ReceiveSequence Uint64 `json:"recv_sequence"` AuthSequence []TransactionTraceAuthSequence `json:"auth_sequence"` // [["account", sequence], ["account", sequence]] CodeSequence Varuint32 `json:"code_sequence"` ABISequence Varuint32 `json:"abi_sequence"` }
type ActionsResp ¶
type ActionsResp struct { Actions []ActionResp `json:"actions"` LastIrreversibleBlock uint32 `json:"last_irreversible_block"` }
type Asset ¶
NOTE: there's also ExtendedAsset which is a quantity with the attached contract (AccountName)
func NewAssetFromString ¶ added in v0.8.13
NewAssetFromString reads a string an decode it to an eos.Asset structure if possible. The input must contains an amount and a symbol. The precision is inferred based on the actual number of decimals present.
func NewEOSAsset ¶
func NewEOSAssetFromString ¶
func NewFixedSymbolAssetFromString ¶ added in v0.8.14
func NewREXAssetFromString ¶ added in v0.8.13
func NewTNTAssetFromString ¶ added in v0.10.4
func (Asset) MarshalJSON ¶
func (*Asset) UnmarshalJSON ¶
type Authority ¶
type Authority struct { Threshold uint32 `json:"threshold"` Keys []KeyWeight `json:"keys,omitempty"` Accounts []PermissionLevelWeight `json:"accounts,omitempty"` Waits []WaitWeight `json:"waits,omitempty"` }
type BaseVariant ¶ added in v0.10.4
type BaseVariant struct { TypeID uint32 Impl interface{} }
func (*BaseVariant) Assign ¶ added in v0.10.4
func (a *BaseVariant) Assign(typeID uint32, impl interface{})
func (*BaseVariant) MarshalJSON ¶ added in v0.10.4
func (a *BaseVariant) MarshalJSON(def *VariantDefinition) ([]byte, error)
func (*BaseVariant) Obtain ¶ added in v0.10.4
func (a *BaseVariant) Obtain(def *VariantDefinition) (typeID uint32, typeName string, impl interface{})
func (*BaseVariant) UnmarshalBinaryVariant ¶ added in v0.10.4
func (a *BaseVariant) UnmarshalBinaryVariant(decoder *Decoder, def *VariantDefinition) error
func (*BaseVariant) UnmarshalJSON ¶ added in v0.10.4
func (a *BaseVariant) UnmarshalJSON(data []byte, def *VariantDefinition) error
type Blob ¶ added in v0.8.1
type Blob string
Blob is base64 encoded data https://github.com/EOSIO/fc/blob/0e74738e938c2fe0f36c5238dbc549665ddaef82/include/fc/variant.hpp#L47
type BlockHeader ¶
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"` // EOSIO 1.x NewProducersV1 *ProducerSchedule `json:"new_producers,omitempty" eos:"optional"` HeaderExtensions []*Extension `json:"header_extensions"` }
func (*BlockHeader) BlockID ¶
func (b *BlockHeader) BlockID() (Checksum256, error)
func (*BlockHeader) BlockNumber ¶
func (b *BlockHeader) BlockNumber() uint32
type BlockHeaderExtension ¶ added in v0.10.4
type BlockHeaderExtension interface {
TypeID() BlockHeaderExtensionType
}
type BlockHeaderExtensionType ¶ added in v0.10.4
type BlockHeaderExtensionType uint16
const ( EOS_ProtocolFeatureActivation BlockHeaderExtensionType = iota EOS_ProducerScheduleChangeExtension )
type BlockResp ¶
type BlockResp struct { SignedBlock ID Checksum256 `json:"id"` BlockNum uint32 `json:"block_num"` RefBlockPrefix uint32 `json:"ref_block_prefix"` }
type BlockSigningAuthority ¶ added in v0.10.4
type BlockSigningAuthority struct {
BaseVariant
}
func (*BlockSigningAuthority) MarshalJSON ¶ added in v0.10.4
func (a *BlockSigningAuthority) MarshalJSON() ([]byte, error)
func (*BlockSigningAuthority) UnmarshalBinary ¶ added in v0.10.4
func (a *BlockSigningAuthority) UnmarshalBinary(decoder *Decoder) error
func (*BlockSigningAuthority) UnmarshalJSON ¶ added in v0.10.4
func (a *BlockSigningAuthority) UnmarshalJSON(data []byte) error
type BlockSigningAuthorityV0 ¶ added in v0.10.4
type BlockSigningAuthorityV0 struct { Threshold uint32 `json:"threshold"` Keys []*KeyWeight `json:"keys"` }
See libraries/chain/include/eosio/chain/producer_schedule.hpp#L100
type BlockState ¶ added in v0.10.4
type BlockState struct { BlockNum uint32 `json:"block_num"` DPoSProposedIrreversibleBlockNum uint32 `json:"dpos_proposed_irreversible_blocknum"` DPoSIrreversibleBlockNum uint32 `json:"dpos_irreversible_blocknum"` // Hybrid (dynamic types) ActiveSchedule *ProducerScheduleOrAuthoritySchedule `json:"active_schedule"` BlockrootMerkle *MerkleRoot `json:"blockroot_merkle,omitempty"` ProducerToLastProduced []PairAccountNameBlockNum `json:"producer_to_last_produced,omitempty"` ProducerToLastImpliedIRB []PairAccountNameBlockNum `json:"producer_to_last_implied_irb,omitempty"` // EOSIO 2.x ValidBlockSigningAuthorityV2 *BlockSigningAuthority `json:"valid_block_signing_authority,omitempty"` ConfirmCount []uint8 `json:"confirm_count,omitempty"` BlockID Checksum256 `json:"id"` Header *SignedBlockHeader `json:"header,omitempty"` PendingSchedule *PendingSchedule `json:"pending_schedule"` ActivatedProtocolFeatures *ProtocolFeatureActivationSet `json:"activated_protocol_features,omitempty" eos:"optional"` AdditionalSignatures []ecc.Signature `json:"additional_signatures"` SignedBlock *SignedBlock `json:"block,omitempty" eos:"optional"` Validated bool `json:"validated"` // EOSIO 1.x BlockSigningKeyV1 *ecc.PublicKey `json:"block_signing_key,omitempty" eos:"-"` }
FIXME: This structure supports both EOS 1.8.x as well as EOS 2.0.x. However, the binary encoding
format does only support the 2.0.x version for now. It's not clear how we would do thing to propagate the information that encoding/decoding of binary should be performed with one variant or the other. When this comment was added, the binary encoding/decoding was not working for either version, so supporting EOS 2.0.x only is a fair improvements. Will need to understand better if this is required for other chains for example.
type BlockTimestamp ¶
func (BlockTimestamp) MarshalJSON ¶
func (t BlockTimestamp) MarshalJSON() ([]byte, error)
func (*BlockTimestamp) UnmarshalJSON ¶
func (t *BlockTimestamp) UnmarshalJSON(data []byte) (err error)
type BlockTraceResp ¶ added in v0.10.5
type BlockTraceResp struct { BlockHeader ID Checksum256 `json:"id"` Number uint32 `json:"number"` PreviousId string `json:"previous_id"` Status string `json:"status"` Transactions []TrxTrace `json:"transactions"` }
type ChainSizeMessage ¶
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 ¶
func (m *ChainSizeMessage) GetType() P2PMessageType
type Checksum160 ¶
type Checksum160 []byte
func (Checksum160) MarshalJSON ¶
func (t Checksum160) MarshalJSON() ([]byte, error)
func (*Checksum160) UnmarshalJSON ¶
func (t *Checksum160) UnmarshalJSON(data []byte) (err error)
type Checksum256 ¶
type Checksum256 []byte
func (Checksum256) MarshalJSON ¶
func (t Checksum256) MarshalJSON() ([]byte, error)
func (Checksum256) String ¶
func (t Checksum256) String() string
func (*Checksum256) UnmarshalJSON ¶
func (t *Checksum256) UnmarshalJSON(data []byte) (err error)
type Checksum512 ¶
type Checksum512 []byte
func (Checksum512) MarshalJSON ¶
func (t Checksum512) MarshalJSON() ([]byte, error)
func (*Checksum512) UnmarshalJSON ¶
func (t *Checksum512) UnmarshalJSON(data []byte) (err error)
type ClausePair ¶
ClausePair represents clauses, related to Ricardian Contracts.
type CompressionType ¶
type CompressionType uint8
func (CompressionType) MarshalJSON ¶
func (c CompressionType) MarshalJSON() ([]byte, error)
func (CompressionType) String ¶
func (c CompressionType) String() string
func (*CompressionType) UnmarshalJSON ¶
func (c *CompressionType) UnmarshalJSON(data []byte) error
type ControlledAccountsResp ¶ added in v0.8.8
type ControlledAccountsResp struct {
ControlledAccounts []string `json:"controlled_accounts"`
}
type CreateSnapshotResp ¶
type Currency ¶
type Currency struct { Precision uint8 Name CurrencyName }
type CurrencyBalanceResp ¶
type CurrencyName ¶
type CurrencyName string
type DBSizeResp ¶
type DataAccess ¶
type DataAccess struct { Type string `json:"type"` // "write", "read"? Code AccountName `json:"code"` Scope AccountName `json:"scope"` Sequence int `json:"sequence"` }
type DecodeOption ¶ added in v0.10.4
type DecodeOption = interface{}
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder implements the EOS unpacking, similar to FC_BUFFER
func NewDecoder ¶
func (*Decoder) Decode ¶
func (d *Decoder) Decode(v interface{}, options ...DecodeOption) (err error)
func (*Decoder) DecodeActions ¶
func (*Decoder) DecodeP2PMessage ¶
func (*Decoder) ReadActionData ¶
func (*Decoder) ReadBlockTimestamp ¶
func (d *Decoder) ReadBlockTimestamp() (out BlockTimestamp, err error)
func (*Decoder) ReadByteArray ¶
func (*Decoder) ReadChecksum160 ¶
func (d *Decoder) ReadChecksum160() (out Checksum160, err error)
func (*Decoder) ReadChecksum256 ¶
func (d *Decoder) ReadChecksum256() (out Checksum256, err error)
func (*Decoder) ReadChecksum512 ¶
func (d *Decoder) ReadChecksum512() (out Checksum512, err error)
func (*Decoder) ReadCurrencyName ¶
func (d *Decoder) ReadCurrencyName() (out CurrencyName, err error)
func (*Decoder) ReadExtendedAsset ¶
func (d *Decoder) ReadExtendedAsset() (out ExtendedAsset, err error)
func (*Decoder) ReadFloat32 ¶
func (*Decoder) ReadFloat64 ¶
func (*Decoder) ReadInt128 ¶ added in v0.10.4
func (*Decoder) ReadJSONTime ¶
func (*Decoder) ReadNodeosFloat32 ¶ added in v0.10.4
func (*Decoder) ReadP2PMessageEnvelope ¶
func (*Decoder) ReadString ¶
func (*Decoder) ReadSymbol ¶
func (*Decoder) ReadSymbolCode ¶
func (d *Decoder) ReadSymbolCode() (out SymbolCode, err error)
func (*Decoder) ReadTimePoint ¶
func (*Decoder) ReadTimePointSec ¶
func (d *Decoder) ReadTimePointSec() (out TimePointSec, err error)
func (*Decoder) ReadTstamp ¶
func (*Decoder) ReadUint128 ¶
func (*Decoder) ReadUint16 ¶
func (*Decoder) ReadUint32 ¶
func (*Decoder) ReadUint64 ¶
func (*Decoder) ReadUvarint32 ¶
func (*Decoder) ReadUvarint64 ¶
func (*Decoder) ReadVarint32 ¶
func (*Decoder) ReadVarint64 ¶
func (*Decoder) SafeReadUTF8String ¶ added in v0.10.4
type DeferredTransaction ¶
type DeferredTransaction struct { *Transaction SenderID uint32 `json:"sender_id"` Sender AccountName `json:"sender"` DelayUntil JSONTime `json:"delay_until"` }
type DelegatedBandwidth ¶
type DelegatedBandwidth struct { From AccountName `json:"from"` To AccountName `json:"to"` NetWeight Asset `json:"net_weight"` CPUWeight Asset `json:"cpu_weight"` }
type Encoder ¶
-------------------------------------------------------------- Encoder implements the EOS packing, similar to FC_BUFFER --------------------------------------------------------------
func NewEncoder ¶
type Except ¶ added in v0.10.4
type Except struct { Code Int64 `json:"code"` Name string `json:"name"` Message string `json:"message"` Stack []*ExceptLogMessage `json:"stack"` }
type ExceptLogContext ¶ added in v0.10.4
type ExceptLogContext struct { Level ExceptLogLevel `json:"level"` File string `json:"file"` Line uint64 `json:"line"` Method string `json:"method"` Hostname string `json:"hostname"` ThreadName string `json:"thread_name"` Timestamp JSONTime `json:"timestamp"` Context *ExceptLogContext `json:"context,omitempty"` }
type ExceptLogLevel ¶ added in v0.10.4
type ExceptLogLevel uint8
const ( ExceptLogLevelAll ExceptLogLevel = iota ExceptLogLevelDebug ExceptLogLevelInfo ExceptLogLevelWarn ExceptLogLevelError ExceptLogLevelOff )
func (*ExceptLogLevel) FromString ¶ added in v0.10.4
func (s *ExceptLogLevel) FromString(input string)
func (ExceptLogLevel) MarshalJSON ¶ added in v0.10.4
func (s ExceptLogLevel) MarshalJSON() (data []byte, err error)
func (ExceptLogLevel) String ¶ added in v0.10.4
func (s ExceptLogLevel) String() string
func (*ExceptLogLevel) UnmarshalJSON ¶ added in v0.10.4
func (s *ExceptLogLevel) UnmarshalJSON(data []byte) error
type ExceptLogMessage ¶ added in v0.10.4
type ExceptLogMessage struct { Context ExceptLogContext `json:"context"` Format string `json:"format"` Data json.RawMessage `json:"data"` }
LogMessage is a line of message in an exception.
func (*ExceptLogMessage) UnmarshalBinary ¶ added in v0.10.4
func (m *ExceptLogMessage) UnmarshalBinary(decoder *Decoder) error
type ExtendedAsset ¶
type ExtendedAsset struct { Asset Asset `json:"quantity"` Contract AccountName `json:"contract"` }
type Extension ¶
func (*Extension) AsBlockHeaderExtension ¶ added in v0.10.4
func (e *Extension) AsBlockHeaderExtension(chain string) (BlockHeaderExtension, error)
AsBlockHeaderExtension turns the given `Extension` object into one of the known `BlockHeaderExtension` concrete type.
func (*Extension) MarshalJSON ¶ added in v0.8.11
func (*Extension) UnmarshalBinary ¶ added in v0.10.4
func (*Extension) UnmarshalJSON ¶ added in v0.8.11
type Float128 ¶
type Float128 Uint128
func (Float128) MarshalJSON ¶
func (*Float128) UnmarshalJSON ¶
type Float64 ¶ added in v0.10.4
type Float64 float64
func (*Float64) MarshalJSON ¶ added in v0.10.4
func (*Float64) UnmarshalJSON ¶ added in v0.10.4
type GetABIResp ¶
type GetABIResp struct { AccountName AccountName `json:"account_name"` ABI ABI `json:"abi"` }
type GetAccountOption ¶ added in v0.10.4
type GetAccountOption interface {
// contains filtered or unexported methods
}
func WithCoreSymbol ¶ added in v0.10.4
func WithCoreSymbol(symbol Symbol) GetAccountOption
type GetAccountsByAuthorizersResp ¶ added in v0.10.4
type GetAccountsByAuthorizersResp struct {
Accounts []AccountResult `json:"accounts"`
}
type GetActionsRequest ¶
type GetActionsRequest struct { AccountName AccountName `json:"account_name"` Pos Int64 `json:"pos"` Offset Int64 `json:"offset"` }
type GetCodeHashResp ¶
type GetCodeHashResp struct { AccountName AccountName `json:"account_name"` CodeHash string `json:"code_hash"` }
type GetCodeResp ¶
type GetCodeResp struct { AccountName AccountName `json:"account_name"` CodeHash string `json:"code_hash"` WASM string `json:"wasm"` ABI ABI `json:"abi"` }
type GetCurrencyStatsResp ¶ added in v0.8.1
type GetCurrencyStatsResp struct { Supply Asset `json:"supply"` MaxSupply Asset `json:"max_supply"` Issuer AccountName `json:"issuer"` }
type GetIntegrityHashResp ¶
type GetRawABIRequest ¶ added in v0.8.1
type GetRawABIRequest struct { AccountName string `json:"account_name"` ABIHash Checksum256 `json:"abi_hash,omitempty"` }
type GetRawABIResp ¶ added in v0.8.1
type GetRawABIResp struct { AccountName string `json:"account_name"` CodeHash Checksum256 `json:"code_hash"` ABIHash Checksum256 `json:"abi_hash"` ABI Blob `json:"abi"` }
type GetRawCodeAndABIResp ¶
type GetRawCodeAndABIResp struct { AccountName AccountName `json:"account_name"` WASMasBase64 string `json:"wasm"` ABIasBase64 string `json:"abi"` }
type GetRequiredKeysResp ¶
type GetTableByScopeRequest ¶ added in v0.8.1
type GetTableByScopeResp ¶ added in v0.8.1
type GetTableByScopeResp struct { More string `json:"more"` Rows json.RawMessage `json:"rows"` }
type GetTableRowsRequest ¶
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 Reverse bool `json:"reverse,omitempty"` // Get rows in reverse of the index JSON bool `json:"json"` // JSON expectOutput if true, binary if false }
type GetTableRowsResp ¶
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 ¶
func (resp *GetTableRowsResp) BinaryToStructs(v interface{}) error
func (*GetTableRowsResp) JSONToStructs ¶
func (resp *GetTableRowsResp) JSONToStructs(v interface{}) error
type Global ¶
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 ¶
type GoAwayMessage struct { Reason GoAwayReason `json:"reason"` NodeID Checksum256 `json:"node_id"` }
func (*GoAwayMessage) GetType ¶
func (m *GoAwayMessage) GetType() P2PMessageType
func (*GoAwayMessage) String ¶
func (m *GoAwayMessage) String() string
type GoAwayReason ¶
type GoAwayReason uint8
func (GoAwayReason) String ¶
func (r GoAwayReason) String() string
type HandshakeMessage ¶
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 ¶
func (m *HandshakeMessage) GetType() P2PMessageType
func (*HandshakeMessage) String ¶
func (m *HandshakeMessage) String() string
type IDListMode ¶
type IDListMode byte
type InfoResp ¶
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 BlockTimestamp `json:"head_block_time"` // "2018-02-02T04:19:32" HeadBlockProducer AccountName `json:"head_block_producer"` // "inita" EarliestAvailableBlockNum uint64 `json:"earliest_available_block_num"` // added since EOSIO/Leap v2.0 ForkDbHeadBlockNum uint64 `json:"fork_db_head_block_num"` // added since EOSIO/Leap v2.0 ForkDbHeadBlockId string `json:"fork_db_head_block_id"` // added since EOSIO/Leap v2.0 LastIrreversibleBlockTime BlockTimestamp `json:"last_irreversible_block_time"` // added since EOSIO/Leap v2.0 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"` TotalCpuWeight Int64 `json:"total_cpu_weight"` // added since EOSIO/Leap v2.0 TotalNetWeight Int64 `json:"total_net_weight"` // added since EOSIO/Leap v2.0 ServerVersionString string `json:"server_version_string"` ServerFullVersionString string `json:"server_full_version_string"` // added since EOSIO/Leap v2.0 }
type Int128 ¶
type Int128 Uint128
Int128
func (Int128) DecimalString ¶ added in v0.10.4
func (Int128) MarshalJSON ¶
func (*Int128) UnmarshalJSON ¶
type JSONFloat64 ¶
type JSONFloat64 = Float64
type JSONTime ¶
func ParseJSONTime ¶
ParseJSONTime will parse a string into a JSONTime object
func (JSONTime) MarshalJSON ¶
func (*JSONTime) UnmarshalJSON ¶
type KeyAccountsResp ¶ added in v0.8.8
type KeyAccountsResp struct {
AccountNames []string `json:"account_names"`
}
type KeyBag ¶
type KeyBag struct {
Keys []*ecc.PrivateKey `json:"keys"`
}
KeyBag holds private keys in memory, for signing transactions.
func (*KeyBag) AvailableKeys ¶
func (*KeyBag) ImportFromFile ¶
func (*KeyBag) ImportPrivateKey ¶
type LinkedAction ¶ added in v0.10.7
type LinkedAction struct { Account AccountName `json:"account"` Action ActionName `json:"action,omitempty"` }
SimpleAction was added since EOSIO/Leap v2.0 chain_plugin/chain_plugin.hpp::eosio::chain_apis::linked_action
type MarshalerBinary ¶ added in v0.10.4
MarshalerBinary is the interface implemented by types that can marshal to an EOSIO binary description of themselves.
**Warning** This is experimental, exposed only for internal usage for now.
type MerkleRoot ¶ added in v0.10.4
type MerkleRoot struct { ActiveNodes []Checksum256 `json:"_active_nodes"` NodeCount uint64 `json:"_node_count"` }
type MessageReflectTypes ¶
type NetConnectResp ¶
type NetConnectResp string
type NetConnectionsResp ¶
type NetConnectionsResp struct { Peer string `json:"peer"` Connecting bool `json:"connecting"` Syncing bool `json:"syncing"` LastHandshake HandshakeMessage `json:"last_handshake"` }
NetConnectionResp
type NetDisconnectResp ¶
type NetDisconnectResp string
type NetStatusResp ¶
type NetStatusResp struct { }
type NoticeMessage ¶
type NoticeMessage struct { KnownTrx OrderedBlockIDs `json:"known_trx"` KnownBlocks OrderedBlockIDs `json:"known_blocks"` }
func (*NoticeMessage) GetType ¶
func (m *NoticeMessage) GetType() P2PMessageType
func (*NoticeMessage) String ¶
func (n *NoticeMessage) String() string
type OrderedBlockIDs ¶
type OrderedBlockIDs struct { Mode [4]byte `json:"mode"` Pending uint32 `json:"pending"` IDs []Checksum256 `json:"ids"` }
func (*OrderedBlockIDs) String ¶
func (o *OrderedBlockIDs) String() string
type OrderedTransactionIDs ¶
type OrderedTransactionIDs struct { Mode [4]byte `json:"mode"` Pending uint32 `json:"pending"` IDs []Checksum256 `json:"ids"` }
type P2PMessage ¶
type P2PMessage interface { fmt.Stringer GetType() P2PMessageType }
type P2PMessageType ¶
type P2PMessageType byte
const ( HandshakeMessageType P2PMessageType = iota // 0 ChainSizeType GoAwayMessageType // 2 TimeMessageType NoticeMessageType // 4 RequestMessageType SyncRequestMessageType // 6 SignedBlockType // 7 PackedTransactionMessageType // 8 )
func NewMessageType ¶
func NewMessageType(aType byte) (t P2PMessageType, err error)
func (P2PMessageType) Name ¶
func (t P2PMessageType) Name() (string, bool)
type PackedTransaction ¶
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"` Transaction Transaction `json:"transaction"` // 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 ¶
func (p *PackedTransaction) ID() (Checksum256, error)
ID returns the hash of a transaction.
func (*PackedTransaction) Unpack ¶
func (p *PackedTransaction) Unpack() (signedTx *SignedTransaction, err error)
Unpack decodes the bytestream of the transaction, and attempts to decode the registered actions.
Example ¶
package main import ( "encoding/json" "fmt" eos "github.com/qqtou/eos-go" ) func main() { var packedTrx *eos.PackedTransaction err := json.Unmarshal(packedTrxData(), &packedTrx) if err != nil { panic(fmt.Errorf("unmarshaling to PackedTransaction: %w", err)) } var signedTrx *eos.SignedTransaction signedTrx, err = packedTrx.Unpack() if err != nil { panic(fmt.Errorf("unpacking transaction: %w", err)) } fmt.Printf("%#v\n", signedTrx.Actions) } func packedTrxData() []byte { return []byte(` { "signatures": [ "SIG_K1_K8VSYk76oK4Hdy23UtAJwwRHtBNP8mbu8uo9TVKsT3si5cujPbRqif8eqxqTwLbKREDFm7eK7YG3skLg9LVXZ54KrEoTuJ" ], "compression": "none", "packed_context_free_data": "", "packed_trx": "a67a815c0d358ee0065800000000011082422e6575305500405647ed48b1ba0140a7c3066575305500000000489aa6b94a1c88ee2531ab18a800201ee9053cde8078023ba1229389f58a0c72ef7fe9ee942e6be7705021630a03e206b016a9711064ee11cc894100701a1160f12c37000903729a1b60f3c7b0117900" } `) }
Output:
func (*PackedTransaction) UnpackBare ¶
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 ¶
type PackedTransactionMessage struct {
PackedTransaction
}
func (*PackedTransactionMessage) GetType ¶
func (m *PackedTransactionMessage) GetType() P2PMessageType
func (PackedTransactionMessage) String ¶
func (m PackedTransactionMessage) String() string
type Packet ¶
type Packet struct { Length uint32 `json:"length"` Type P2PMessageType `json:"type"` Payload []byte `json:"-"` P2PMessage P2PMessage `json:"message" eos:"-"` Raw []byte `json:"-"` }
type PairAccountNameBlockNum ¶ added in v0.10.4
type PairAccountNameBlockNum struct { AccountName AccountName BlockNum uint32 }
func (PairAccountNameBlockNum) MarshalJSON ¶ added in v0.10.4
func (c PairAccountNameBlockNum) MarshalJSON() ([]byte, error)
func (*PairAccountNameBlockNum) UnmarshalBinary ¶ added in v0.10.4
func (c *PairAccountNameBlockNum) UnmarshalBinary(decoder *Decoder) error
func (*PairAccountNameBlockNum) UnmarshalJSON ¶ added in v0.10.4
func (c *PairAccountNameBlockNum) UnmarshalJSON(data []byte) error
type PendingSchedule ¶ added in v0.10.4
type PendingSchedule struct { ScheduleLIBNum uint32 `json:"schedule_lib_num"` ScheduleHash Checksum256 `json:"schedule_hash"` Schedule *ProducerScheduleOrAuthoritySchedule `json:"schedule"` }
type PermLevel ¶ added in v0.10.5
type PermLevel struct { Account AccountName `json:"account"` Permission PermissionName `json:"permission"` }
type Permission ¶
type Permission struct { PermName string `json:"perm_name"` Parent string `json:"parent"` RequiredAuth Authority `json:"required_auth"` LinkedActions []LinkedAction `json:"linked_actions"` // added since EOSIO/Leap v2.0, TODO: find the better type from the current implementation }
type PermissionLevel ¶
type PermissionLevel struct { Actor AccountName `json:"actor"` Permission PermissionName `json:"permission"` }
func NewPermissionLevel ¶
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 ¶
type PermissionLevelWeight struct { Permission PermissionLevel `json:"permission"` Weight uint16 `json:"weight"` // weight_type }
type PermissionName ¶
type PermissionName Name
func PN ¶
func PN(in string) PermissionName
func (PermissionName) String ¶ added in v0.10.4
func (n PermissionName) String() string
type ProcessedTransaction ¶
type ProcessedTransaction struct {
Transaction SignedTransaction `json:"trx"`
}
type Producer ¶
type Producer struct { Owner Name `json:"owner"` TotalVotes Float64 `json:"total_votes,string"` ProducerKey ecc.PublicKey `json:"producer_key"` IsActive Bool `json:"is_active"` URL string `json:"url"` UnpaidBlocks int `json:"unpaid_blocks"` LastClaimTime JSONTime `json:"last_claim_time"` Location int `json:"location"` }
type ProducerAuthority ¶ added in v0.10.4
type ProducerAuthority struct { AccountName AccountName `json:"producer_name"` BlockSigningAuthority *BlockSigningAuthority `json:"authority"` }
type ProducerAuthoritySchedule ¶ added in v0.10.4
type ProducerAuthoritySchedule struct { Version uint32 `json:"version"` Producers []*ProducerAuthority `json:"producers"` }
type ProducerChange ¶
type ProducerChange struct { }
type ProducerKey ¶
type ProducerKey struct { AccountName AccountName `json:"producer_name"` BlockSigningKey ecc.PublicKey `json:"block_signing_key"` }
type ProducerSchedule ¶
type ProducerSchedule struct { Version uint32 `json:"version"` Producers []ProducerKey `json:"producers"` }
type ProducerScheduleChangeExtension ¶ added in v0.10.4
type ProducerScheduleChangeExtension struct {
ProducerAuthoritySchedule
}
ProducerScheduleChangeExtension is a block header extension present in the signed block when a new producer authority schedule should be applied.
func (*ProducerScheduleChangeExtension) TypeID ¶ added in v0.10.4
func (e *ProducerScheduleChangeExtension) TypeID() BlockHeaderExtensionType
type ProducerScheduleOrAuthoritySchedule ¶ added in v0.10.4
type ProducerScheduleOrAuthoritySchedule struct { // EOSIO 1.x V1 *ProducerSchedule // EOSIO 2.x V2 *ProducerAuthoritySchedule }
func (*ProducerScheduleOrAuthoritySchedule) MarshalJSON ¶ added in v0.10.4
func (p *ProducerScheduleOrAuthoritySchedule) MarshalJSON() ([]byte, error)
func (*ProducerScheduleOrAuthoritySchedule) UnmarshalBinary ¶ added in v0.10.4
func (p *ProducerScheduleOrAuthoritySchedule) UnmarshalBinary(decoder *Decoder) error
func (*ProducerScheduleOrAuthoritySchedule) UnmarshalJSON ¶ added in v0.10.4
func (p *ProducerScheduleOrAuthoritySchedule) UnmarshalJSON(data []byte) error
type ProducersResp ¶
type ProtocolFeature ¶ added in v0.10.4
type ProtocolFeature struct { FeatureDigest Checksum256 `json:"feature_digest"` SubjectiveRestriction SubjectiveRestriction `json:"subjective_restrictions"` DescriptionDigest Checksum256 `json:"description_digest"` Dependencies []Checksum256 `json:"dependencies"` ProtocolFeatureType string `json:"protocol_feature_type"` Specification []ProtocolFeatureSpecification `json:"specification"` }
type ProtocolFeatureActivationExtension ¶ added in v0.10.4
type ProtocolFeatureActivationExtension struct {
FeatureDigests []Checksum256 `json:"protocol_features"`
}
ProtocolFeatureActivationExtension is a block header extension present in the signed block when a particular set of protocol features has been activated by this blockl.
func (*ProtocolFeatureActivationExtension) TypeID ¶ added in v0.10.4
func (e *ProtocolFeatureActivationExtension) TypeID() BlockHeaderExtensionType
type ProtocolFeatureActivationSet ¶ added in v0.10.4
type ProtocolFeatureActivationSet struct {
ProtocolFeatures []Checksum256 `json:"protocol_features"`
}
type ProtocolFeatureSpecification ¶ added in v0.10.4
type PushTransactionFullResp ¶
type PushTransactionFullResp struct { TransactionID string `json:"transaction_id"` Processed TransactionProcessed `json:"processed"` // WARN: is an `fc::variant` in server.. }
PushTransactionFullResp unwraps the responses from a successful `push_transaction`. FIXME: REVIEW the actual expectOutput, things have moved here.
type RefundRequest ¶
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 ¶
type RequestMessage struct { ReqTrx OrderedBlockIDs `json:"req_trx"` ReqBlocks OrderedBlockIDs `json:"req_blocks"` }
func (*RequestMessage) GetType ¶
func (m *RequestMessage) GetType() P2PMessageType
func (*RequestMessage) String ¶
func (r *RequestMessage) String() string
type RexInfo ¶ added in v0.10.7
type RexInfo struct { Version uint32 `json:"version"` Owner AccountName `json:"owner"` VoteStake Asset `json:"vote_stake"` RexBalance Asset `json:"rex_balance"` MaturedRex uint64 `json:"matured_rex"` // TODO: set the exact type RexMaturities []interface{} `json:"rex_maturities"` }
RexInfo was added since EOSIO/Leap v2.0
type SHA256Bytes ¶
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 SafeString ¶ added in v0.10.4
type SafeString string
func (*SafeString) UnmarshalBinary ¶ added in v0.10.4
func (ss *SafeString) UnmarshalBinary(d *Decoder) error
type ScheduledTransaction ¶
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 ¶
type ScheduledTransactionsResp struct { Transactions []ScheduledTransaction `json:"transactions"` More string `json:"more"` }
type SequencedTransactionResp ¶
type SequencedTransactionResp struct { SeqNum int `json:"seq_num"` TransactionResp }
type SetABI ¶
type SetABI struct { Account AccountName `json:"account"` ABI ABI `json:"abi"` }
SetABI represents the hard-coded `setabi` action.
type SetCode ¶
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 ¶
type SignedBlock struct { SignedBlockHeader Transactions []TransactionReceipt `json:"transactions"` BlockExtensions []*Extension `json:"block_extensions"` }
func (*SignedBlock) GetType ¶
func (m *SignedBlock) GetType() P2PMessageType
func (*SignedBlock) String ¶
func (m *SignedBlock) String() string
type SignedBlockHeader ¶
type SignedBlockHeader struct { BlockHeader ProducerSignature ecc.Signature `json:"producer_signature"` }
type SignedTransaction ¶
type SignedTransaction struct { *Transaction Signatures []ecc.Signature `json:"signatures"` ContextFreeData []HexBytes `json:"context_free_data"` // contains filtered or unexported fields }
func NewSignedTransaction ¶
func NewSignedTransaction(tx *Transaction) *SignedTransaction
func (*SignedTransaction) Pack ¶
func (s *SignedTransaction) Pack(compression CompressionType) (*PackedTransaction, error)
func (*SignedTransaction) PackedTransactionAndCFD ¶
func (s *SignedTransaction) PackedTransactionAndCFD() ([]byte, []byte, error)
func (*SignedTransaction) SignedByKeys ¶
func (s *SignedTransaction) SignedByKeys(chainID Checksum256) (out []ecc.PublicKey, err error)
func (*SignedTransaction) String ¶
func (s *SignedTransaction) String() string
type Signer ¶
type Signer interface { AvailableKeys(ctx context.Context) (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(ctx context.Context, tx *SignedTransaction, chainID []byte, requiredKeys ...ecc.PublicKey) (*SignedTransaction, error) ImportPrivateKey(ctx context.Context, wifPrivKey string) error }
type SubjectiveRestriction ¶ added in v0.10.4
type Symbol ¶
NOTE: there's also a new ExtendedSymbol (which includes the contract (as AccountName) on which it is)
func MustStringToSymbol ¶ added in v0.8.13
func NameToSymbol ¶ added in v0.8.10
func NewSymbolFromUint64 ¶ added in v0.10.4
func StringToSymbol ¶ added in v0.8.10
func (Symbol) MustSymbolCode ¶ added in v0.8.10
func (s Symbol) MustSymbolCode() SymbolCode
func (Symbol) SymbolCode ¶ added in v0.8.10
func (s Symbol) SymbolCode() (SymbolCode, error)
func (*Symbol) UnmarshalJSON ¶ added in v0.10.7
type SymbolCode ¶
type SymbolCode uint64
func NameToSymbolCode ¶ added in v0.8.10
func NameToSymbolCode(name Name) (SymbolCode, error)
func StringToSymbolCode ¶ added in v0.8.10
func StringToSymbolCode(str string) (SymbolCode, error)
func (SymbolCode) MarshalJSON ¶ added in v0.10.4
func (sc SymbolCode) MarshalJSON() (data []byte, err error)
func (SymbolCode) String ¶ added in v0.8.10
func (sc SymbolCode) String() string
func (SymbolCode) ToName ¶ added in v0.8.10
func (sc SymbolCode) ToName() string
type SyncRequestMessage ¶
type SyncRequestMessage struct { StartBlock uint32 `json:"start_block"` EndBlock uint32 `json:"end_block"` }
func (*SyncRequestMessage) GetType ¶
func (m *SyncRequestMessage) GetType() P2PMessageType
func (*SyncRequestMessage) String ¶
func (m *SyncRequestMessage) String() string
type TableDef ¶
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 TimeMessage ¶
type TimeMessage struct { Origin Tstamp `json:"org"` Receive Tstamp `json:"rec"` Transmit Tstamp `json:"xmt"` Destination Tstamp `json:"dst"` }
func (*TimeMessage) GetType ¶
func (m *TimeMessage) GetType() P2PMessageType
func (*TimeMessage) String ¶
func (t *TimeMessage) String() string
type TimePoint ¶
type TimePoint uint64
TimePoint represents the number of microseconds since EPOCH (Jan 1st 1970)
func (TimePoint) MarshalJSON ¶ added in v0.10.4
func (*TimePoint) UnmarshalJSON ¶ added in v0.10.4
type TimePointSec ¶
type TimePointSec uint32
TimePointSec represents the number of seconds since EPOCH (Jan 1st 1970)
func (TimePointSec) AsTime ¶ added in v0.10.7
func (f TimePointSec) AsTime() time.Time
AsTime returns the TimePointSec as time.Time in UTC
func (TimePointSec) MarshalJSON ¶ added in v0.10.4
func (f TimePointSec) MarshalJSON() ([]byte, error)
func (TimePointSec) String ¶ added in v0.10.4
func (f TimePointSec) String() string
func (*TimePointSec) UnmarshalJSON ¶ added in v0.10.4
func (f *TimePointSec) UnmarshalJSON(data []byte) error
type TotalResources ¶
type TotalResources struct { Owner AccountName `json:"owner"` NetWeight Asset `json:"net_weight"` CPUWeight Asset `json:"cpu_weight"` RAMBytes Int64 `json:"ram_bytes"` }
type Trace ¶
type Trace struct { ActionOrdinal uint32 `json:"action_ordinal"` CreatorActionOrdinal uint32 `json:"creator_action_ordinal"` ClosestUnnotifiedAncestorActionOrdinal uint32 `json:"closest_unnotified_ancestor_action_ordinal"` Receipt ActionTraceReceipt `json:"receipt,omitempty" eos:"optional"` Receiver string `json:"receiver"` Action Action `json:"act"` ContextFree bool `json:"context_free"` Elapsed int64 `json:"elapsed"` Console string `json:"console"` TransactionID string `json:"trx_id"` BlockNum uint32 `json:"block_num"` BlockTime string `json:"block_time"` ProducerBlockID string `json:"producer_block_id" eos:"optional"` AccountRAMDeltas []AccountRAMDelta `json:"account_ram_deltas"` Except string `json:"except,omitempty" eos:"optional"` ErrorCode string `json:"error_code,omitempty" eos:"optional"` // Not present in EOSIO >= 1.8.x InlineTraces []Trace `json:"inline_traces,omitempty" eos:"-"` }
type Transaction ¶
type Transaction struct { TransactionHeader ContextFreeActions []*Action `json:"context_free_actions"` Actions []*Action `json:"actions"` Extensions []*Extension `json:"transaction_extensions"` }
Transaction represents an EOS transaction that is no signed yet.
**Note** In EOSIO codebase, used within both `signed_transaction` and `transaction`.
func NewTransaction ¶
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 ¶
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 ¶
func (tx *Transaction) SetExpiration(in time.Duration)
type TransactionHeader ¶
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 ¶
type TransactionProcessed struct { Status string `json:"status"` ID Checksum256 `json:"id"` BlockNum uint32 `json:"block_num"` ActionTraces []Trace `json:"action_traces"` DeferredTransactions []string `json:"deferred_transactions"` // that's not right... dig to find what's there.. BlockTime string `json:"block_time"` ProducerBlockID string `json:"producer_block_id" eos:"optional"` Receipt Receipt `json:"receipt"` Elapsed int64 `json:"elapsed"` NetUsage int `json:"net_usage"` Scheduled bool `json:"scheduled"` AccountRAMDelta string `json:"account_ram_delta" eos:"optional"` Except string `json:"except" eos:"optional"` ErrorCode string `json:"error_code" eos:"optional"` }
type TransactionReceipt ¶
type TransactionReceipt struct { TransactionReceiptHeader Transaction TransactionWithID `json:"trx"` }
type TransactionReceiptHeader ¶
type TransactionReceiptHeader struct { Status TransactionStatus `json:"status"` CPUUsageMicroSeconds uint32 `json:"cpu_usage_us"` NetUsageWords Varuint32 `json:"net_usage_words"` }
type TransactionResp ¶
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 BlockTimestamp `json:"block_time"` BlockNum uint32 `json:"block_num"` LastIrreversibleBlock uint32 `json:"last_irreversible_block"` Traces []ActionTrace `json:"traces"` }
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) MarshalJSON ¶
func (s TransactionStatus) MarshalJSON() (data []byte, err error)
func (TransactionStatus) String ¶
func (s TransactionStatus) String() string
func (*TransactionStatus) UnmarshalJSON ¶
func (s *TransactionStatus) UnmarshalJSON(data []byte) error
type TransactionTrace ¶ added in v0.10.4
type TransactionTrace struct { ID Checksum256 `json:"id"` BlockNum uint32 `json:"block_num"` BlockTime BlockTimestamp `json:"block_time"` ProducerBlockID Checksum256 `json:"producer_block_id" eos:"optional"` Receipt *TransactionReceiptHeader `json:"receipt,omitempty" eos:"optional"` Elapsed Int64 `json:"elapsed"` NetUsage Uint64 `json:"net_usage"` Scheduled bool `json:"scheduled"` ActionTraces []ActionTrace `json:"action_traces"` AccountRamDelta *struct { AccountName AccountName `json:"account_name"` Delta Int64 `json:"delta"` } `json:"account_ram_delta" eos:"optional"` FailedDtrxTrace *TransactionTrace `json:"failed_dtrx_trace,omitempty" eos:"optional"` Except *Except `json:"except,omitempty" eos:"optional"` ErrorCode *Uint64 `json:"error_code,omitempty" eos:"optional"` }
type TransactionTraceAuthSequence ¶
type TransactionTraceAuthSequence struct { Account AccountName Sequence Uint64 }
func (TransactionTraceAuthSequence) MarshalJSON ¶
func (auth TransactionTraceAuthSequence) MarshalJSON() (data []byte, err error)
func (*TransactionTraceAuthSequence) UnmarshalJSON ¶
func (auth *TransactionTraceAuthSequence) UnmarshalJSON(data []byte) error
[ ["account", 123123], ["account2", 345] ]
type TransactionWithID ¶
type TransactionWithID struct { ID Checksum256 Packed *PackedTransaction }
func (TransactionWithID) MarshalJSON ¶
func (t TransactionWithID) MarshalJSON() ([]byte, error)
func (*TransactionWithID) UnmarshalJSON ¶
func (t *TransactionWithID) UnmarshalJSON(data []byte) error
type TransactionsResp ¶
type TransactionsResp struct {
Transactions []SequencedTransactionResp
}
type TrxTrace ¶ added in v0.10.5
type TrxTrace struct { ID Checksum256 `json:"id"` Actions []ActTrace `json:"actions"` Status string `json:"status"` CPUUsageMicrosec int `json:"cpu_usage_us"` NetUsageWords int `json:"net_usage_words"` Signatures []ecc.Signature `json:"signatures"` TransactionHeader TransactionHeader `json:"transaction_header"` }
type TxOptions ¶
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.
type Uint128 ¶
uint128
func (Uint128) DecimalString ¶ added in v0.10.4
func (Uint128) MarshalJSON ¶
func (*Uint128) UnmarshalJSON ¶
type Uint64 ¶
type Uint64 uint64
func (Uint64) MarshalBinary ¶ added in v0.10.4
func (Uint64) MarshalJSON ¶
func (*Uint64) UnmarshalJSON ¶
type UnmarshalerBinary ¶ added in v0.10.4
UnmarshalerBinary is the interface implemented by types that can unmarshal an EOSIO binary description of themselves.
**Warning** This is experimental, exposed only for internal usage for now.
type VariantDef ¶ added in v0.8.15
VariantDef defines a variant type. See libraries/chain/include/eosio/chain/contracts/types.hpp:78
type VariantDefinition ¶ added in v0.10.4
type VariantDefinition struct {
// contains filtered or unexported fields
}
func NewVariantDefinition ¶ added in v0.10.4
func NewVariantDefinition(types []VariantType) (out *VariantDefinition)
NewVariantDefinition creates a variant definition based on the *ordered* provided types. It's the ordering that defines the binary variant value just like in native `nodeos` C++ and in Smart Contract via the `std::variant` type. It's important to pass the entries in the right order!
This variant definition can now be passed to functions of `BaseVariant` to implement marshal/unmarshaling functionalities for binary & JSON.
func (*VariantDefinition) TypeID ¶ added in v0.10.4
func (d *VariantDefinition) TypeID(name string) uint32
type VariantImplFactory ¶ added in v0.10.4
type VariantImplFactory = func() interface{}
type VariantType ¶ added in v0.10.4
type VariantType struct { Name string Type interface{} }
type VoterInfo ¶
type VoterInfo struct { Owner AccountName `json:"owner"` Proxy AccountName `json:"proxy"` Producers []AccountName `json:"producers"` Staked Int64 `json:"staked"` LastVoteWeight Float64 `json:"last_vote_weight"` ProxiedVoteWeight Float64 `json:"proxied_vote_weight"` IsProxy byte `json:"is_proxy"` Flags1 int64 `json:"flags1"` // added since EOSIO/Leap v2.0 Reserved2 int64 `json:"reserved2"` // added since EOSIO/Leap v2.0 Reserved3 Asset `json:"reserved3"` // added since EOSIO/Leap v2.0 }
type WaitWeight ¶
type WalletSigner ¶
type WalletSigner struct {
// contains filtered or unexported fields
}
`eosiowd` wallet-based signer
func NewWalletSigner ¶
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 ¶
func (*WalletSigner) ImportPrivateKey ¶
func (s *WalletSigner) ImportPrivateKey(ctx context.Context, wifKey string) (err error)
func (*WalletSigner) Sign ¶
func (s *WalletSigner) Sign(ctx context.Context, tx *SignedTransaction, chainID []byte, requiredKeys ...ecc.PublicKey) (*SignedTransaction, error)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
btcsuite
|
|
btcd/btcec
Package btcec implements support for the elliptic curves needed for bitcoin.
|
Package btcec implements support for the elliptic curves needed for bitcoin. |
btcutil
Package btcutil provides bitcoin-specific convenience functions and types.
|
Package btcutil provides bitcoin-specific convenience functions and types. |
btcutil/base58
Package base58 provides an API for working with modified base58 and Base58Check encodings.
|
Package base58 provides an API for working with modified base58 and Base58Check encodings. |
cmd
|
|