Documentation ¶
Index ¶
- Constants
- Variables
- func FillMetadata(metadata []byte) ([]byte, error)
- func ParseID(id string) (uint64, error)
- func ParsePeerAddress(addr string) (launchtypes.Peer, error)
- func PeerAddress(peer launchtypes.Peer) (string, error)
- type Chain
- type CosmosClient
- type JoinOption
- type Network
- func (n Network) AccountAddress() (string, error)
- func (n Network) Balances(ctx context.Context, address string) (sdk.Coins, error)
- func (n Network) ChainID(ctx context.Context) (string, error)
- func (n Network) ChainLaunch(ctx context.Context, id uint64) (networktypes.ChainLaunch, error)
- func (n Network) ChainLaunchesWithReward(ctx context.Context, pagination *query.PageRequest) ([]networktypes.ChainLaunch, error)
- func (n Network) ChainReward(ctx context.Context, launchID uint64) (rewardtypes.RewardPool, error)
- func (n Network) Coordinator(ctx context.Context, address string) (networktypes.Coordinator, error)
- func (n Network) CoordinatorIDByAddress(ctx context.Context, address string) (uint64, error)
- func (n Network) CreateClient(ctx context.Context, launchID uint64, unbondingTime int64, ...) (string, error)
- func (n Network) CreateProject(ctx context.Context, name, metadata string, totalSupply sdk.Coins) (uint64, error)
- func (n Network) GenesisAccount(ctx context.Context, launchID uint64, address string) (networktypes.GenesisAccount, error)
- func (n Network) GenesisAccounts(ctx context.Context, launchID uint64) (genAccs []networktypes.GenesisAccount, err error)
- func (n Network) GenesisInformation(ctx context.Context, launchID uint64) (gi networktypes.GenesisInformation, err error)
- func (n Network) GenesisValidator(ctx context.Context, launchID uint64, address string) (networktypes.GenesisValidator, error)
- func (n Network) GenesisValidators(ctx context.Context, launchID uint64) (genVals []networktypes.GenesisValidator, err error)
- func (n Network) GetJoinRequestContents(ctx context.Context, c Chain, launchID uint64, gentxPath string, ...) (reqs []launchtypes.RequestContent, err error)
- func (n Network) InitializeMainnet(ctx context.Context, projectID uint64, sourceURL, sourceHash string, ...) (uint64, error)
- func (n Network) LaunchParams(ctx context.Context) (launchtypes.Params, error)
- func (n Network) MainnetAccount(ctx context.Context, projectID uint64, address string) (acc networktypes.MainnetAccount, err error)
- func (n Network) MainnetAccounts(ctx context.Context, projectID uint64) (genAccs []networktypes.MainnetAccount, err error)
- func (n Network) ParamChanges(ctx context.Context, launchID uint64) (paramChanges []networktypes.ParamChange, err error)
- func (n Network) Profile(ctx context.Context, projectID uint64) (networktypes.Profile, error)
- func (n Network) Project(ctx context.Context, projectID uint64) (networktypes.Project, error)
- func (n Network) Projects(ctx context.Context) ([]networktypes.Project, error)
- func (n Network) Publish(ctx context.Context, c Chain, options ...PublishOption) (launchID, projectID uint64, err error)
- func (n Network) Request(ctx context.Context, launchID, requestID uint64) (networktypes.Request, error)
- func (n Network) RequestFromIDs(ctx context.Context, launchID uint64, requestIDs ...uint64) (reqs []networktypes.Request, err error)
- func (n Network) Requests(ctx context.Context, launchID uint64) ([]networktypes.Request, error)
- func (n Network) RevertLaunch(ctx context.Context, launchID uint64, _ Chain) error
- func (n Network) RewardIBCInfo(ctx context.Context, launchID uint64) (networktypes.RewardIBCInfo, error)
- func (n Network) RewardsInfo(ctx context.Context, launchID uint64, height int64) (rewardsInfo networktypes.Reward, lastRewardHeight int64, unboundingTime int64, ...)
- func (n Network) SendRequest(ctx context.Context, launchID uint64, content launchtypes.RequestContent) error
- func (n Network) SendRequests(ctx context.Context, launchID uint64, contents []launchtypes.RequestContent) error
- func (n Network) SetCoordinatorDescription(ctx context.Context, description profiletypes.CoordinatorDescription) error
- func (n Network) SetReward(ctx context.Context, launchID uint64, lastRewardHeight int64, coins sdk.Coins) error
- func (n Network) SetValidatorDescription(ctx context.Context, validator profiletypes.Validator) error
- func (n Network) SubmitRequestReviewals(ctx context.Context, launchID uint64, reviewal ...Reviewal) error
- func (n Network) TriggerLaunch(ctx context.Context, launchID uint64, launchTime time.Time) error
- func (n Network) UpdateProject(ctx context.Context, id uint64, props ...Prop) error
- func (n Network) Validator(ctx context.Context, address string) (networktypes.Validator, error)
- func (n Network) VestingAccount(ctx context.Context, launchID uint64, address string) (networktypes.VestingAccount, error)
- func (n Network) VestingAccounts(ctx context.Context, launchID uint64) (vestingAccs []networktypes.VestingAccount, err error)
- type Node
- type Option
- func CollectEvents(ev events.Bus) Option
- func WithBankQueryClient(client banktypes.QueryClient) Option
- func WithCustomClock(clock xtime.Clock) Option
- func WithLaunchQueryClient(client launchtypes.QueryClient) Option
- func WithMonitoringConsumerQueryClient(client monitoringctypes.QueryClient) Option
- func WithProfileQueryClient(client profiletypes.QueryClient) Option
- func WithProjectQueryClient(client projecttypes.QueryClient) Option
- func WithRewardQueryClient(client rewardtypes.QueryClient) Option
- func WithStakingQueryClient(client stakingtypes.QueryClient) Option
- type Prop
- type PublishOption
- func Mainnet() PublishOption
- func WithAccountBalance(accountBalance sdk.Coins) PublishOption
- func WithChainID(chainID string) PublishOption
- func WithCustomGenesisConfig(configFile string) PublishOption
- func WithCustomGenesisURL(url string) PublishOption
- func WithMetadata(metadata string) PublishOption
- func WithPercentageShares(sharePercentages []SharePercent) PublishOption
- func WithProject(id uint64) PublishOption
- func WithTotalSupply(totalSupply sdk.Coins) PublishOption
- type Reviewal
- type SharePercent
- type SharePercents
Constants ¶
const MinLaunchTimeOffset = time.Second * 30
MinLaunchTimeOffset represents an offset used when minimum launch time is used minimum launch time will be block time + minimum launch time duration param block time when tx is executed is not predicable, therefore we add few seconds to ensure the minimum duration is reached.
Variables ¶
var ErrObjectNotFound = errors.New("query object not found")
ErrObjectNotFound is returned when the query returns a not found error.
Functions ¶
func FillMetadata ¶
FillMetadata fills the metadata of the chain with the plugin version
func ParsePeerAddress ¶
func ParsePeerAddress(addr string) (launchtypes.Peer, error)
func PeerAddress ¶
func PeerAddress(peer launchtypes.Peer) (string, error)
Types ¶
type Chain ¶
type Chain interface { ID() (string, error) ChainID() (string, error) Name() string SourceURL() string SourceHash() string GenesisPath() (string, error) GentxsPath() (string, error) DefaultGentxPath() (string, error) AppTOMLPath() (string, error) ConfigTOMLPath() (string, error) NodeID(ctx context.Context) (string, error) CacheBinary(launchID uint64) error }
type CosmosClient ¶
type CosmosClient interface { Context() client.Context BroadcastTx(ctx context.Context, account cosmosaccount.Account, msgs ...sdktypes.Msg) (cosmosclient.Response, error) Status(ctx context.Context) (*ctypes.ResultStatus, error) ConsensusInfo(ctx context.Context, height int64) (cosmosclient.ConsensusInfo, error) }
type JoinOption ¶
type JoinOption func(*joinOptions)
func WithAccountRequest ¶
func WithAccountRequest(amount sdk.Coins) JoinOption
WithAccountRequest allows to join the chain by requesting a genesis account with the specified amount of tokens.
func WithPublicAddress ¶
func WithPublicAddress(addr string) JoinOption
WithPublicAddress allows to specify a peer public address for the node.
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
Network is network builder.
func New ¶
func New(cosmos CosmosClient, account cosmosaccount.Account, options ...Option) Network
New creates a Builder.
func (Network) AccountAddress ¶
AccountAddress returns the address of the account used by the network builder
func (Network) ChainLaunch ¶
func (n Network) ChainLaunch(ctx context.Context, id uint64) (networktypes.ChainLaunch, error)
ChainLaunch fetches the chain launch from Network by launch id.
func (Network) ChainLaunchesWithReward ¶
func (n Network) ChainLaunchesWithReward(ctx context.Context, pagination *query.PageRequest) ([]networktypes.ChainLaunch, error)
ChainLaunchesWithReward fetches the chain launches with rewards from Network.
func (Network) ChainReward ¶
func (n Network) ChainReward(ctx context.Context, launchID uint64) (rewardtypes.RewardPool, error)
ChainReward fetches the chain reward from SPN by launch id.
func (Network) Coordinator ¶
func (n Network) Coordinator(ctx context.Context, address string) (networktypes.Coordinator, error)
Coordinator returns the Coordinator by address from SPN.
func (Network) CoordinatorIDByAddress ¶
CoordinatorIDByAddress returns the CoordinatorByAddress from SPN.
func (Network) CreateClient ¶
func (n Network) CreateClient( ctx context.Context, launchID uint64, unbondingTime int64, rewardsInfo networktypes.Reward, ) (string, error)
CreateClient send create client message to SPN.
func (Network) CreateProject ¶
func (n Network) CreateProject(ctx context.Context, name, metadata string, totalSupply sdk.Coins) (uint64, error)
CreateProject creates a project in Network.
func (Network) GenesisAccount ¶
func (n Network) GenesisAccount(ctx context.Context, launchID uint64, address string) (networktypes.GenesisAccount, error)
func (Network) GenesisAccounts ¶
func (n Network) GenesisAccounts(ctx context.Context, launchID uint64) (genAccs []networktypes.GenesisAccount, err error)
GenesisAccounts returns the list of approved genesis accounts for a launch from SPN.
func (Network) GenesisInformation ¶
func (n Network) GenesisInformation(ctx context.Context, launchID uint64) (gi networktypes.GenesisInformation, err error)
GenesisInformation returns all the information to construct the genesis from a chain ID.
func (Network) GenesisValidator ¶
func (n Network) GenesisValidator(ctx context.Context, launchID uint64, address string) (networktypes.GenesisValidator, error)
func (Network) GenesisValidators ¶
func (n Network) GenesisValidators(ctx context.Context, launchID uint64) (genVals []networktypes.GenesisValidator, err error)
GenesisValidators returns the list of approved genesis validators for a launch from SPN.
func (Network) GetJoinRequestContents ¶
func (n Network) GetJoinRequestContents( ctx context.Context, c Chain, launchID uint64, gentxPath string, options ...JoinOption, ) (reqs []launchtypes.RequestContent, err error)
GetJoinRequestContents returns the request contents to join a chain as a validator
func (Network) InitializeMainnet ¶
func (n Network) InitializeMainnet( ctx context.Context, projectID uint64, sourceURL, sourceHash string, mainnetChainID string, ) (uint64, error)
InitializeMainnet Initialize the mainnet of the project.
func (Network) LaunchParams ¶
LaunchParams fetches the chain launch module params from SPN.
func (Network) MainnetAccount ¶
func (n Network) MainnetAccount( ctx context.Context, projectID uint64, address string, ) (acc networktypes.MainnetAccount, err error)
MainnetAccount returns the project mainnet account for a launch from SPN.
func (Network) MainnetAccounts ¶
func (n Network) MainnetAccounts(ctx context.Context, projectID uint64) (genAccs []networktypes.MainnetAccount, err error)
MainnetAccounts returns the list of project mainnet accounts for a launch from SPN.
func (Network) ParamChanges ¶
func (n Network) ParamChanges(ctx context.Context, launchID uint64) (paramChanges []networktypes.ParamChange, err error)
ParamChanges returns the list of approved param changes for a launch from SPN.
func (Network) Publish ¶
func (n Network) Publish(ctx context.Context, c Chain, options ...PublishOption) (launchID, projectID uint64, err error)
Publish submits Genesis to SPN to announce a new network.
func (Network) Request ¶
func (n Network) Request(ctx context.Context, launchID, requestID uint64) (networktypes.Request, error)
Request fetches the chain request from SPN by launch and request id.
func (Network) RequestFromIDs ¶
func (n Network) RequestFromIDs(ctx context.Context, launchID uint64, requestIDs ...uint64) (reqs []networktypes.Request, err error)
RequestFromIDs fetches the chain requested from SPN by launch and provided request IDs TODO: once implemented, use the SPN query from https://github.com/tendermint/spn/issues/420
func (Network) RevertLaunch ¶
RevertLaunch reverts a launched chain as a coordinator.
func (Network) RewardIBCInfo ¶
func (n Network) RewardIBCInfo(ctx context.Context, launchID uint64) (networktypes.RewardIBCInfo, error)
RewardIBCInfo returns IBC info to relay packets for a chain to claim rewards.
func (Network) RewardsInfo ¶
func (n Network) RewardsInfo( ctx context.Context, launchID uint64, height int64, ) ( rewardsInfo networktypes.Reward, lastRewardHeight int64, unboundingTime int64, err error, )
RewardsInfo Fetches the consensus state with the validator set, the unbounding time, and the last block height from chain rewards.
func (Network) SendRequest ¶
func (n Network) SendRequest( ctx context.Context, launchID uint64, content launchtypes.RequestContent, ) error
SendRequest creates and sends the Request message to SPN.
func (Network) SendRequests ¶
func (n Network) SendRequests( ctx context.Context, launchID uint64, contents []launchtypes.RequestContent, ) error
SendRequests creates and sends the Request message to SPN
func (Network) SetCoordinatorDescription ¶
func (n Network) SetCoordinatorDescription(ctx context.Context, description profiletypes.CoordinatorDescription) error
SetCoordinatorDescription set the description of a coordinator or creates the coordinator if it doesn't exist yet for the sender address.
func (Network) SetReward ¶
func (n Network) SetReward(ctx context.Context, launchID uint64, lastRewardHeight int64, coins sdk.Coins) error
SetReward set a chain reward.
func (Network) SetValidatorDescription ¶
func (n Network) SetValidatorDescription(ctx context.Context, validator profiletypes.Validator) error
SetValidatorDescription set a validator profile.
func (Network) SubmitRequestReviewals ¶
func (n Network) SubmitRequestReviewals(ctx context.Context, launchID uint64, reviewal ...Reviewal) error
SubmitRequestReviewals submits reviewals for proposals in batch for chain.
func (Network) TriggerLaunch ¶
TriggerLaunch launches a chain as a coordinator.
func (Network) UpdateProject ¶
UpdateProject updates the project name or metadata.
func (Network) VestingAccount ¶
func (n Network) VestingAccount(ctx context.Context, launchID uint64, address string) (networktypes.VestingAccount, error)
func (Network) VestingAccounts ¶
func (n Network) VestingAccounts(ctx context.Context, launchID uint64) (vestingAccs []networktypes.VestingAccount, err error)
VestingAccounts returns the list of approved genesis vesting accounts for a launch from SPN.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is node builder.
func (Node) RewardIBCInfo ¶
func (n Node) RewardIBCInfo(ctx context.Context) (networktypes.RewardIBCInfo, error)
RewardIBCInfo returns IBC info to relay packets to claim rewards for the chain.
func (Node) RewardsInfo ¶
func (n Node) RewardsInfo(ctx context.Context) ( reward networktypes.Reward, chainID string, unbondingTimeSeconds int64, err error, )
RewardsInfo Fetches the consensus state with the validator set and the unbounding time.
type Option ¶
type Option func(*Network)
func CollectEvents ¶
CollectEvents collects events from the network builder.
func WithBankQueryClient ¶
func WithBankQueryClient(client banktypes.QueryClient) Option
func WithCustomClock ¶
func WithLaunchQueryClient ¶
func WithLaunchQueryClient(client launchtypes.QueryClient) Option
func WithMonitoringConsumerQueryClient ¶
func WithMonitoringConsumerQueryClient(client monitoringctypes.QueryClient) Option
func WithProfileQueryClient ¶
func WithProfileQueryClient(client profiletypes.QueryClient) Option
func WithProjectQueryClient ¶
func WithProjectQueryClient(client projecttypes.QueryClient) Option
func WithRewardQueryClient ¶
func WithRewardQueryClient(client rewardtypes.QueryClient) Option
func WithStakingQueryClient ¶
func WithStakingQueryClient(client stakingtypes.QueryClient) Option
type Prop ¶
type Prop func(*updateProp)
Prop updates project proposal.
func WithProjectMetadata ¶
WithProjectMetadata provides a meta data proposal to update the project.
func WithProjectName ¶
WithProjectName provides a name proposal to update the project.
func WithProjectTotalSupply ¶
WithProjectTotalSupply provides a total supply proposal to update the project.
type PublishOption ¶
type PublishOption func(*publishOptions)
PublishOption configures chain creation.
func WithAccountBalance ¶
func WithAccountBalance(accountBalance sdk.Coins) PublishOption
WithAccountBalance set a balance used for all genesis account of the chain.
func WithChainID ¶
func WithChainID(chainID string) PublishOption
WithChainID use a custom chain id.
func WithCustomGenesisConfig ¶
func WithCustomGenesisConfig(configFile string) PublishOption
WithCustomGenesisConfig enables using a custom genesis during publish.
func WithCustomGenesisURL ¶
func WithCustomGenesisURL(url string) PublishOption
WithCustomGenesisURL enables using a custom genesis during publish.
func WithMetadata ¶
func WithMetadata(metadata string) PublishOption
WithMetadata provides a meta data proposal to update the project.
func WithPercentageShares ¶
func WithPercentageShares(sharePercentages []SharePercent) PublishOption
WithPercentageShares enables minting vouchers for shares.
func WithTotalSupply ¶
func WithTotalSupply(totalSupply sdk.Coins) PublishOption
WithTotalSupply provides a total supply proposal to update the project.
type Reviewal ¶
Reviewal keeps a request's reviewal.
func ApproveRequest ¶
ApproveRequest returns approval for a request with id.
func RejectRequest ¶
RejectRequest returns rejection for a request with id.
type SharePercent ¶
type SharePercent struct {
// contains filtered or unexported fields
}
SharePercent represent percent of total share.
func NewSharePercent ¶
func NewSharePercent(denom string, nominator, denominator uint64) (SharePercent, error)
NewSharePercent creates new share percent representation.
func SharePercentFromString ¶
func SharePercentFromString(str string) (SharePercent, error)
SharePercentFromString parses share percent from string format: 11.87%foo
type SharePercents ¶
type SharePercents []SharePercent
func ParseSharePercents ¶
func ParseSharePercents(percents string) (SharePercents, error)
ParseSharePercents parses SharePercentage list from string format: 12.4%foo,10%bar,0.133%baz
func (SharePercents) Empty ¶
func (sp SharePercents) Empty() bool