networktypes

package
v0.0.0-...-7149754 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SPN name used as an address prefix and as a home dir for chains to publish.
	SPN = "spn"

	// SPNDenom is the denom used for the spn chain native token
	SPNDenom = "uspn"
)

Variables

This section is empty.

Functions

func NewWrappedErrInvalidRequest

func NewWrappedErrInvalidRequest(requestID uint64, message string) error

NewWrappedErrInvalidRequest returns a wrapped ErrInvalidRequest

func VerifyAddValidatorRequest

func VerifyAddValidatorRequest(req *launchtypes.RequestContent_GenesisValidator) error

VerifyAddValidatorRequest verify the validator request parameters

func VerifyRequest

func VerifyRequest(request Request) error

VerifyRequest verifies the validity of the request from its content (static check)

Types

type Campaign

type Campaign struct {
	ID                 uint64    `json:"ID"`
	Name               string    `json:"Name"`
	CoordinatorID      uint64    `json:"CoordinatorID"`
	MainnetID          uint64    `json:"MainnetID"`
	MainnetInitialized bool      `json:"MainnetInitialized"`
	TotalSupply        sdk.Coins `json:"TotalSupply"`
	AllocatedShares    string    `json:"AllocatedShares"`
	Metadata           string    `json:"Metadata"`
}

Campaign represents the campaign of a chain on SPN

func ToCampaign

func ToCampaign(campaign campaigntypes.Campaign) Campaign

ToCampaign converts a campaign data from SPN and returns a Campaign object

type ChainLaunch

type ChainLaunch struct {
	ID                     uint64      `json:"ID"`
	ConsumerRevisionHeight int64       `json:"ConsumerRevisionHeight"`
	ChainID                string      `json:"ChainID"`
	SourceURL              string      `json:"SourceURL"`
	SourceHash             string      `json:"SourceHash"`
	GenesisURL             string      `json:"GenesisURL"`
	GenesisHash            string      `json:"GenesisHash"`
	LaunchTime             int64       `json:"LaunchTime"`
	CampaignID             uint64      `json:"CampaignID"`
	LaunchTriggered        bool        `json:"LaunchTriggered"`
	Network                NetworkType `json:"Network"`
	Reward                 string      `json:"Reward,omitempty"`
}

ChainLaunch represents the launch of a chain on SPN

func ToChainLaunch

func ToChainLaunch(chain launchtypes.Chain) ChainLaunch

ToChainLaunch converts a chain launch data from SPN and returns a ChainLaunch object

type ErrInvalidRequest

type ErrInvalidRequest struct {
	// contains filtered or unexported fields
}

ErrInvalidRequest is an error returned in methods manipulating requests when they are invalid

func (ErrInvalidRequest) Error

func (err ErrInvalidRequest) Error() string

Error implements error

type GenesisAccount

type GenesisAccount struct {
	Address string
	Coins   string
}

GenesisAccount represents an account with initial coin allocation for the chain for the chain genesis

func ToGenesisAccount

func ToGenesisAccount(acc launchtypes.GenesisAccount) GenesisAccount

ToGenesisAccount converts genesis account from SPN

type GenesisInformation

type GenesisInformation struct {
	GenesisAccounts   []GenesisAccount
	VestingAccounts   []VestingAccount
	GenesisValidators []GenesisValidator
}

GenesisInformation represents all information for a chain to construct the genesis. This structure indexes accounts and validators by their address for better performance

func NewGenesisInformation

func NewGenesisInformation(
	genAccs []GenesisAccount,
	vestingAccs []VestingAccount,
	genVals []GenesisValidator,
) (gi GenesisInformation)

NewGenesisInformation initializes a new GenesisInformation

func (*GenesisInformation) AddGenesisAccount

func (gi *GenesisInformation) AddGenesisAccount(acc GenesisAccount)

func (*GenesisInformation) AddGenesisValidator

func (gi *GenesisInformation) AddGenesisValidator(val GenesisValidator)

func (*GenesisInformation) AddVestingAccount

func (gi *GenesisInformation) AddVestingAccount(acc VestingAccount)

func (GenesisInformation) ApplyRequest

func (gi GenesisInformation) ApplyRequest(request Request) (GenesisInformation, error)

ApplyRequest applies to the genesisInformation the changes implied by the approval of a request

func (GenesisInformation) ContainsGenesisAccount

func (gi GenesisInformation) ContainsGenesisAccount(address string) bool

func (GenesisInformation) ContainsGenesisValidator

func (gi GenesisInformation) ContainsGenesisValidator(address string) bool

func (GenesisInformation) ContainsVestingAccount

func (gi GenesisInformation) ContainsVestingAccount(address string) bool

func (*GenesisInformation) RemoveGenesisAccount

func (gi *GenesisInformation) RemoveGenesisAccount(address string)

func (*GenesisInformation) RemoveGenesisValidator

func (gi *GenesisInformation) RemoveGenesisValidator(address string)

func (*GenesisInformation) RemoveVestingAccount

func (gi *GenesisInformation) RemoveVestingAccount(address string)

type GenesisValidator

type GenesisValidator struct {
	Address        string
	Gentx          []byte
	Peer           launchtypes.Peer
	SelfDelegation sdk.Coin
}

GenesisValidator represents a genesis validator associated with a gentx in the chain genesis

func ToGenesisValidator

func ToGenesisValidator(val launchtypes.GenesisValidator) GenesisValidator

ToGenesisValidator converts genesis validator from SPN

type MainnetAccount

type MainnetAccount struct {
	Address string               `json:"Address"`
	Shares  campaigntypes.Shares `json:"Shares"`
}

MainnetAccount represents the campaign mainnet account of a chain on SPN

func ToMainnetAccount

func ToMainnetAccount(acc campaigntypes.MainnetAccount) MainnetAccount

ToMainnetAccount converts a mainnet account data from SPN and returns a MainnetAccount object

type MainnetVestingAccount

type MainnetVestingAccount struct {
	Address     string               `json:"Address"`
	TotalShares campaigntypes.Shares `json:"TotalShares"`
	Vesting     campaigntypes.Shares `json:"Vesting"`
	EndTime     int64                `json:"EndTime"`
}

MainnetVestingAccount represents the campaign mainnet vesting account of a chain on SPN

func ToMainnetVestingAccount

func ToMainnetVestingAccount(acc campaigntypes.MainnetVestingAccount) MainnetVestingAccount

ToMainnetVestingAccount converts a mainnet vesting account data from SPN and returns a MainnetVestingAccount object

type NetworkType

type NetworkType string
const (
	NetworkTypeMainnet NetworkType = "mainnet"
	NetworkTypeTestnet NetworkType = "testnet"
)

func (NetworkType) String

func (n NetworkType) String() string

type Request

type Request struct {
	LaunchID  uint64                     `json:"LaunchID"`
	RequestID uint64                     `json:"RequestID"`
	Creator   string                     `json:"Creator"`
	CreatedAt string                     `json:"CreatedAt"`
	Content   launchtypes.RequestContent `json:"Content"`
	Status    string                     `json:"Status"`
}

Request represents the launch Request of a chain on SPN

func ToRequest

func ToRequest(request launchtypes.Request) Request

ToRequest converts a request data from SPN and returns a Request object

type VestingAccount

type VestingAccount struct {
	Address      string
	TotalBalance string
	Vesting      string
	EndTime      int64
}

VestingAccount represents a vesting account with initial coin allocation and vesting option for the chain genesis VestingAccount supports currently only delayed vesting option

func ToVestingAccount

func ToVestingAccount(acc launchtypes.VestingAccount) (VestingAccount, error)

ToVestingAccount converts vesting account from SPN

Jump to

Keyboard shortcuts

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