Documentation ¶
Index ¶
- Variables
- type Account
- type Addressable
- type AddressableSigner
- type Bytecode
- func (bc Bytecode) Bytes() []byte
- func (bc Bytecode) MarshalJSON() ([]byte, error)
- func (bc Bytecode) MarshalText() ([]byte, error)
- func (bc Bytecode) String() string
- func (bc Bytecode) Tokens() ([]string, error)
- func (bc *Bytecode) UnmarshalJSON(data []byte) error
- func (bc *Bytecode) UnmarshalText(text []byte) error
- type ConcreteAccount
- type ConcretePrivateAccount
- type ConcreteValidator
- type MutableAccount
- type PrivateAccount
- type Validator
Constants ¶
This section is empty.
Variables ¶
var GlobalPermissionsAddress = crypto.Address(binary.Zero160)
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account interface { Addressable // The value held by this account in terms of the chain-native token Balance() uint64 // The EVM byte code held by this account (or equivalently, this contract) Code() Bytecode // The sequence number of this account, incremented each time a mutation of the // Account is persisted to the blockchain state Sequence() uint64 // The hash of all the values in this accounts storage (typically the root of some subtree // in the merkle tree of global storage state) StorageRoot() []byte // The permission flags and roles for this account Permissions() ptypes.AccountPermissions // Obtain a deterministic serialisation of this account // (i.e. update order and Go runtime independent) Encode() ([]byte, error) // String representation of the account String() string }
The default immutable interface to an account
type Addressable ¶ added in v0.18.0
type AddressableSigner ¶ added in v0.18.0
type AddressableSigner interface { Addressable crypto.Signer }
func SigningAccounts ¶ added in v0.18.0
func SigningAccounts(concretePrivateAccounts []*ConcretePrivateAccount) []AddressableSigner
Convert slice of ConcretePrivateAccounts to slice of SigningAccounts
type Bytecode ¶ added in v0.18.0
type Bytecode []byte
func BytecodeFromHex ¶ added in v0.18.0
func NewBytecode ¶ added in v0.18.0
Builds new bytecode using the Splice helper to map byte-like and byte-slice-like types to a flat bytecode slice
func (Bytecode) MarshalJSON ¶ added in v0.18.0
func (Bytecode) MarshalText ¶ added in v0.18.0
func (*Bytecode) UnmarshalJSON ¶ added in v0.18.0
func (*Bytecode) UnmarshalText ¶ added in v0.18.0
type ConcreteAccount ¶ added in v0.18.0
type ConcreteAccount struct { Address crypto.Address PublicKey crypto.PublicKey Sequence uint64 Balance uint64 Code Bytecode StorageRoot []byte Permissions ptypes.AccountPermissions }
ConcreteAccount is the canonical serialisation and bash-in-place object for an Account
func AsConcreteAccount ¶ added in v0.18.0
func AsConcreteAccount(account Account) *ConcreteAccount
Returns a mutable, serialisable ConcreteAccount by copying from account
func DecodeConcrete ¶ added in v0.18.0
func DecodeConcrete(accBytes []byte) (*ConcreteAccount, error)
func NewConcreteAccount ¶ added in v0.18.0
func NewConcreteAccount(pubKey crypto.PublicKey) ConcreteAccount
func NewConcreteAccountFromSecret ¶ added in v0.18.0
func NewConcreteAccountFromSecret(secret string) ConcreteAccount
func (ConcreteAccount) Account ¶ added in v0.18.0
func (acc ConcreteAccount) Account() Account
Return as immutable Account
func (*ConcreteAccount) Copy ¶ added in v0.18.0
func (acc *ConcreteAccount) Copy() *ConcreteAccount
func (*ConcreteAccount) Encode ¶ added in v0.18.0
func (acc *ConcreteAccount) Encode() ([]byte, error)
func (ConcreteAccount) MutableAccount ¶ added in v0.18.0
func (acc ConcreteAccount) MutableAccount() MutableAccount
Return as mutable MutableAccount
func (*ConcreteAccount) String ¶ added in v0.18.0
func (acc *ConcreteAccount) String() string
type ConcretePrivateAccount ¶ added in v0.18.0
type ConcretePrivateAccount struct { Address crypto.Address PublicKey crypto.PublicKey PrivateKey crypto.PrivateKey }
func AsConcretePrivateAccount ¶ added in v0.18.0
func AsConcretePrivateAccount(privateAccount PrivateAccount) *ConcretePrivateAccount
func (ConcretePrivateAccount) PrivateAccount ¶ added in v0.18.0
func (pa ConcretePrivateAccount) PrivateAccount() PrivateAccount
func (ConcretePrivateAccount) Sign ¶ added in v0.18.0
func (pa ConcretePrivateAccount) Sign(msg []byte) (crypto.Signature, error)
func (*ConcretePrivateAccount) String ¶ added in v0.18.0
func (pa *ConcretePrivateAccount) String() string
type ConcreteValidator ¶ added in v0.18.0
Neither abci_types or tm_types has quite the representation we want
func AsConcreteValidator ¶ added in v0.18.0
func AsConcreteValidator(validator Validator) *ConcreteValidator
func (*ConcreteValidator) Copy ¶ added in v0.18.0
func (cv *ConcreteValidator) Copy() *ConcreteValidator
func (*ConcreteValidator) String ¶ added in v0.18.0
func (cv *ConcreteValidator) String() string
func (ConcreteValidator) Validator ¶ added in v0.18.0
func (cv ConcreteValidator) Validator() Validator
type MutableAccount ¶ added in v0.18.0
type MutableAccount interface { Account // Set public key (needed for lazy initialisation), should also set the dependent address SetPublicKey(pubKey crypto.PublicKey) MutableAccount // Subtract amount from account balance (will panic if amount is greater than balance) SubtractFromBalance(amount uint64) (MutableAccount, error) // Add amount to balance (will panic if amount plus balance is a uint64 overflow) AddToBalance(amount uint64) (MutableAccount, error) // Set EVM byte code associated with account SetCode(code []byte) MutableAccount // Increment Sequence number by 1 (capturing the current Sequence number as the index for any pending mutations) IncSequence() MutableAccount // Set the storage root hash SetStorageRoot(storageRoot []byte) MutableAccount // Set account permissions SetPermissions(permissions ptypes.AccountPermissions) MutableAccount // Get a pointer this account's AccountPermissions in order to mutate them MutablePermissions() *ptypes.AccountPermissions // Create a complete copy of this MutableAccount that is itself mutable Copy() MutableAccount }
func AsMutableAccount ¶ added in v0.18.0
func AsMutableAccount(account Account) MutableAccount
Returns a MutableAccount by copying from account
func FromAddressable ¶ added in v0.18.0
func FromAddressable(addressable Addressable) MutableAccount
Creates an otherwise zeroed Account from an Addressable and returns it as MutableAccount
type PrivateAccount ¶ added in v0.18.0
type PrivateAccount interface { AddressableSigner PrivateKey() crypto.PrivateKey }
func GeneratePrivateAccount ¶ added in v0.18.0
func GeneratePrivateAccount() (PrivateAccount, error)
Generates a new account with private key.
func GeneratePrivateAccountFromPrivateKeyBytes ¶ added in v0.18.0
func GeneratePrivateAccountFromPrivateKeyBytes(privKeyBytes []byte) (PrivateAccount, error)
func GeneratePrivateAccountFromSecret ¶ added in v0.18.0
func GeneratePrivateAccountFromSecret(secret string) PrivateAccount
Generates a new account with private key from SHA256 hash of a secret
type Validator ¶ added in v0.18.0
type Validator interface { Addressable // The validator's voting power Power() uint64 }