Documentation ¶
Index ¶
- Constants
- Variables
- func MarshalBinary(v interface{}) ([]byte, error)
- func StringToName(s string) (val uint64, err error)
- type AccountName
- type Action
- func NewBuyRAM(payer, receiver string, quantity Asset) *Action
- func NewBuyRAMBytes(payer, receiver string, bytes uint32) *Action
- func NewClaim(account, owner string, assertId string) *Action
- func NewContractTransfer(name, from, to string, quantity Asset, memo string) *Action
- func NewDelegateBW(from, receiver string, stakeCPU, stakeNet Asset, transfer bool) *Action
- func NewMine(account, miner string, nonce string) *Action
- func NewNewAccount(creator, newAccount string, publicKey ecc.PublicKey) *Action
- func NewSellRAM(account string, bytes uint64) *Action
- func NewTokenTransfer(contract, from, to string, quantity Asset, memo string) *Action
- func NewTokenTransferAction(contract, from, to, amount, memo, token string, precision uint8) *Action
- func NewTransfer(from, to string, quantity Asset, memo string) *Action
- func NewUndelegateBW(from, receiver string, unstakeCPU, unstakeNet Asset) *Action
- type ActionData
- type ActionName
- type Asset
- type Authority
- type BuyRAM
- type BuyRAMBytes
- type Checksum256
- type Claim
- type CompressionType
- type ContractTransfer
- type DelegateBW
- type Encoder
- type Extension
- type HexBytes
- type JSONTime
- type KeyWeight
- type MarshalerBinary
- type Mine
- type Name
- type NewAccount
- type PackedTransaction
- type PermissionLevel
- type PermissionLevelWeight
- type PermissionName
- type ScopeName
- type SellRAM
- type SetCode
- type SignedTransaction
- type Symbol
- type SymbolCode
- type TableName
- type Transaction
- type TransactionHeader
- type Transfer
- type TxOptions
- type UndelegateBW
- type Varuint32
- type WaitWeight
Constants ¶
const ( CompressionNone = CompressionType(iota) CompressionZlib )
const JSONTimeFormat = "2006-01-02T15:04:05"
Variables ¶
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 REXSymbol = Symbol{Precision: 4, Symbol: "REX"}
REXSymbol represents the standard REX symbol on the chain. It's here just to speed up things.
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 }{ 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, }
var WAXSymbol = Symbol{Precision: 8, Symbol: "WAX"}
WAXSymbol represents the standard WAX symbol on the chain.
Functions ¶
func MarshalBinary ¶
func StringToName ¶
Types ¶
type Action ¶
type Action struct { Account AccountName `json:"account"` Name ActionName `json:"name"` Authorization []PermissionLevel `json:"authorization,omitempty"` ActionData }
func NewBuyRAMBytes ¶
NewBuyRAMBytes will buy at current market price a given number of bytes of RAM, and grant them to the `receiver` account.
func NewClaim ¶
NewClaim creates a new Claim action object. ex. https://wax.bloks.io/transaction/ca77897065604decd0ff16f62624bcea6706abdd688fd1c7743c0630e8db8dda?tab=raw account example: "farmersworld"
func NewContractTransfer ¶
NewContractTransfer creates a new ContractTransfer action object.
func NewDelegateBW ¶
NewDelegateBW returns a `delegatebw` action that lives on the `eosio.system` contract.
func NewNewAccount ¶
NewNewAccount returns a `newaccount` action that lives on the `eosio.system` contract.
func NewSellRAM ¶
NewSellRAM will sell at current market price a given number of bytes of RAM.
func NewTokenTransfer ¶
func NewTokenTransferAction ¶
func NewTransfer ¶
NewTransfer creates a new Transfer action object.
func NewUndelegateBW ¶
NewUndelegateBW returns a `undelegatebw` action that lives on the `eosio.system` contract.
type ActionData ¶
type ActionData struct { HexData []byte `json:"hex_data,omitempty"` Data interface{} `json:"data,omitempty" eos:"-"` // contains filtered or unexported fields }
func NewActionData ¶
func NewActionData(obj interface{}) ActionData
type Asset ¶
func NewEOSAsset ¶
func NewEOSAssetFromString ¶
func NewWAXAsset ¶
func (Asset) MarshalJSON ¶
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 BuyRAM ¶
type BuyRAM struct { Payer AccountName `json:"payer"` Receiver AccountName `json:"receiver"` Quantity Asset `json:"quant"` // specified in EOS }
BuyRAM represents the `eosio.system::buyram` action.
type BuyRAMBytes ¶
type BuyRAMBytes struct { Payer AccountName `json:"payer"` Receiver AccountName `json:"receiver"` Bytes uint32 `json:"bytes"` }
BuyRAMBytes represents the `eosio.system::buyrambytes` action.
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 Claim ¶
type Claim struct { Owner AccountName `json:"owner"` AssetID string `json:"asset_id"` }
Claim represents the `farmersworld` action.
type CompressionType ¶
type CompressionType uint8
func (CompressionType) String ¶
func (c CompressionType) String() string
type ContractTransfer ¶
type ContractTransfer struct { From AccountName `json:"from"` To AccountName `json:"to"` Quantity Asset `json:"quantity"` Memo string `json:"memo"` }
ContractTransfer represents the `transfer` struct on `eosio.token` contract.
type DelegateBW ¶
type DelegateBW struct { From AccountName `json:"from"` Receiver AccountName `json:"receiver"` StakeNet Asset `json:"stake_net_quantity"` StakeCPU Asset `json:"stake_cpu_quantity"` Transfer bool `json:"transfer"` }
DelegateBW represents the `eosio.system::delegatebw` action.
type Encoder ¶
func NewEncoder ¶
type HexBytes ¶
type HexBytes []byte
HexBytes is alias of []byte
func (HexBytes) MarshalJSON ¶
func (*HexBytes) UnmarshalJSON ¶
type JSONTime ¶
func ParseJSONTime ¶
ParseJSONTime will parse a string into a JSONTime object
func (JSONTime) MarshalJSON ¶
func (*JSONTime) UnmarshalJSON ¶
type MarshalerBinary ¶
type Mine ¶
type Mine struct { Miner AccountName `json:"miner"` Nonce string `json:"nonce"` }
type NewAccount ¶
type NewAccount struct { Creator AccountName `json:"creator"` Name AccountName `json:"name"` Owner Authority `json:"owner"` Active Authority `json:"active"` }
NewAccount represents a `newaccount` action on the `eosio.system` contract. It is one of the rare ones to be hard-coded into the blockchain.
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"` }
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)
type PermissionLevel ¶
type PermissionLevel struct { Actor AccountName `json:"actor"` Permission PermissionName `json:"permission"` }
type PermissionLevelWeight ¶
type PermissionLevelWeight struct { Permission PermissionLevel `json:"permission"` Weight uint16 `json:"weight"` // weight_type }
type SellRAM ¶
type SellRAM struct { Account AccountName `json:"account"` Bytes uint64 `json:"bytes"` }
SellRAM represents the `eosio.system::sellram` 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 SignedTransaction ¶
type SignedTransaction struct { *Transaction Signatures []ecc.Signature `json:"signatures"` ContextFreeData [][]byte `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) String ¶
func (s *SignedTransaction) String() string
type Symbol ¶
Symbol NOTE: there's also a new ExtendedSymbol (which includes the contract (as AccountName) on which it is)
func (Symbol) MarshalJSON ¶
func (Symbol) MustSymbolCode ¶
func (s Symbol) MustSymbolCode() (SymbolCode, error)
func (Symbol) SymbolCode ¶
func (s Symbol) SymbolCode() (SymbolCode, error)
type SymbolCode ¶
type SymbolCode uint64
func StringToSymbolCode ¶
func StringToSymbolCode(str string) (SymbolCode, error)
func (SymbolCode) MarshalJSON ¶
func (sc SymbolCode) MarshalJSON() (data []byte, err error)
func (SymbolCode) String ¶
func (sc SymbolCode) String() string
type Transaction ¶
type Transaction struct { TransactionHeader ContextFreeActions []*Action `json:"context_free_actions"` Actions []*Action `json:"actions"` Extensions []*Extension `json:"transaction_extensions"` }
func (*Transaction) Fill ¶
func (tx *Transaction) Fill(headBlockID Checksum256, delaySecs, maxNetUsageWords uint32, maxCPUUsageMS uint8, expiration time.Duration)
func (*Transaction) SetExpiration ¶
func (tx *Transaction) SetExpiration(in time.Duration)
SetExpiration sets the expiration of the transaction.
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 }
TransactionHeader Tx is an EOS transaction.
type Transfer ¶
type Transfer struct { From AccountName `json:"from"` To AccountName `json:"to"` Quantity Asset `json:"quantity"` Memo string `json:"memo"` }
Transfer represents the `transfer` struct on `eosio.token` contract.
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 Expiration time.Duration }
TxOptions represents options you want to pass to the transaction you're sending.
type UndelegateBW ¶
type UndelegateBW struct { From AccountName `json:"from"` Receiver AccountName `json:"receiver"` UnstakeNet Asset `json:"unstake_net_quantity"` UnstakeCPU Asset `json:"unstake_cpu_quantity"` }
UndelegateBW represents the `eosio.system::undelegatebw` action.