spec

package
v0.0.0-...-2935fa7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAmount uint64 = 0
View Source
const DefaultPegged uint64 = 0
View Source
const DefaultPower uint64 = 0

Variables

View Source
var (
	ErrInvalidLengthSpec        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowSpec          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupSpec = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type GenesisSpec

type GenesisSpec struct {
	GenesisTime       *time.Time        `json:",omitempty" toml:",omitempty"`
	ChainName         string            `json:",omitempty" toml:",omitempty"`
	Params            params            `json:",omitempty" toml:",omitempty"`
	Salt              []byte            `json:",omitempty" toml:",omitempty"`
	GlobalPermissions []string          `json:",omitempty" toml:",omitempty"`
	Accounts          []TemplateAccount `json:",omitempty" toml:",omitempty"`
}

A GenesisSpec is schematic representation of a genesis state, that is it is a template for a GenesisDoc excluding that which needs to be instantiated at the point of genesis so it describes the type and number of accounts, the genesis salt, but not the account keys or addresses, or the GenesisTime. It is responsible for generating keys by interacting with the KeysClient it is passed and other information not known at specification time

func DeveloperAccount

func DeveloperAccount(name string) GenesisSpec

func FullAccount

func FullAccount(name string) GenesisSpec

func GenesisSpecFromJSON

func GenesisSpecFromJSON(jsonBlob []byte) (*GenesisSpec, error)

func MergeGenesisSpecs

func MergeGenesisSpecs(genesisSpecs ...GenesisSpec) GenesisSpec

func ParticipantAccount

func ParticipantAccount(name string) GenesisSpec

func RootAccount

func RootAccount(name string) GenesisSpec

func ValidatorAccount

func ValidatorAccount(name string) GenesisSpec

func (*GenesisSpec) GenesisDoc

func (gs *GenesisSpec) GenesisDoc(keyClient keys.KeyClient, curve crypto.CurveType) (*genesis.GenesisDoc, error)

Produce a fully realised GenesisDoc from a template GenesisDoc that may omit values

func (*GenesisSpec) Hash

func (gs *GenesisSpec) Hash() []byte

func (*GenesisSpec) JSONBytes

func (gs *GenesisSpec) JSONBytes() ([]byte, error)

func (*GenesisSpec) ShortHash

func (gs *GenesisSpec) ShortHash() []byte

type TemplateAccount

type TemplateAccount struct {
	Name             string                                          `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`
	Address          *github_com_klyed_hivesmartchain_crypto.Address `` /* 136-byte string literal not displayed */
	PublicKey        *crypto.PublicKey                               `protobuf:"bytes,3,opt,name=PublicKey,proto3" json:",omitempty" toml:",omitempty"`
	Amounts          []balance.Balance                               `protobuf:"bytes,4,rep,name=Amounts,proto3" json:",omitempty" toml:",omitempty"`
	Permissions      []string                                        `protobuf:"bytes,5,rep,name=Permissions,proto3" json:",omitempty" toml:",omitempty"`
	Roles            []string                                        `protobuf:"bytes,6,rep,name=Roles,proto3" json:",omitempty" toml:",omitempty"`
	Code             *github_com_klyed_hivesmartchain_acm.Bytecode   `protobuf:"bytes,7,opt,name=Code,proto3,customtype=github.com/klyed/hivesmartchain/acm.Bytecode" json:"Code,omitempty"`
	XXX_unrecognized []byte                                          `json:"-"`
}

func (TemplateAccount) AccountPermissions

func (ta TemplateAccount) AccountPermissions() (permission.AccountPermissions, error)

func (TemplateAccount) Balances

func (ta TemplateAccount) Balances() balance.Balances

func (*TemplateAccount) Descriptor

func (*TemplateAccount) Descriptor() ([]byte, []int)

func (TemplateAccount) GenesisAccount

func (ta TemplateAccount) GenesisAccount(keyClient keys.KeyClient, index int, curve crypto.CurveType) (*genesis.Account, error)

func (*TemplateAccount) GetAmounts

func (m *TemplateAccount) GetAmounts() []balance.Balance

func (*TemplateAccount) GetName

func (m *TemplateAccount) GetName() string

func (*TemplateAccount) GetPermissions

func (m *TemplateAccount) GetPermissions() []string

func (*TemplateAccount) GetPublicKey

func (m *TemplateAccount) GetPublicKey() *crypto.PublicKey

func (*TemplateAccount) GetRoles

func (m *TemplateAccount) GetRoles() []string

func (*TemplateAccount) Marshal

func (m *TemplateAccount) Marshal() (dAtA []byte, err error)

func (*TemplateAccount) MarshalTo

func (m *TemplateAccount) MarshalTo(dAtA []byte) (int, error)

func (*TemplateAccount) MarshalToSizedBuffer

func (m *TemplateAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*TemplateAccount) ProtoMessage

func (*TemplateAccount) ProtoMessage()

func (TemplateAccount) RealisePublicKeyAndAddress

func (ta TemplateAccount) RealisePublicKeyAndAddress(keyClient keys.KeyClient, curve crypto.CurveType) (pubKey *crypto.PublicKey, address crypto.Address, err error)

Adds a public key and address to the template. If PublicKey will try to fetch it by Address. If both PublicKey and Address are not set will use the keyClient to generate a new keypair

func (*TemplateAccount) Reset

func (m *TemplateAccount) Reset()

func (*TemplateAccount) Size

func (m *TemplateAccount) Size() (n int)

func (*TemplateAccount) String

func (m *TemplateAccount) String() string

func (*TemplateAccount) Unmarshal

func (m *TemplateAccount) Unmarshal(dAtA []byte) error

func (TemplateAccount) Validator

func (ta TemplateAccount) Validator(keyClient keys.KeyClient, index int, curve crypto.CurveType) (*genesis.Validator, error)

func (*TemplateAccount) XXX_DiscardUnknown

func (m *TemplateAccount) XXX_DiscardUnknown()

func (*TemplateAccount) XXX_Marshal

func (m *TemplateAccount) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TemplateAccount) XXX_Merge

func (m *TemplateAccount) XXX_Merge(src proto.Message)

func (*TemplateAccount) XXX_MessageName

func (*TemplateAccount) XXX_MessageName() string

func (*TemplateAccount) XXX_Size

func (m *TemplateAccount) XXX_Size() int

func (*TemplateAccount) XXX_Unmarshal

func (m *TemplateAccount) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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