api

package
v2.2.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package api ...

Index

Examples

Constants

View Source
const (
	// DAOAddress is DAO's address for charging a 10% commission on all rewards
	DAOAddress = "Mx7f0fc21d932f38ca9444f61703174569066cfa50"

	// DevelopersAddress is developers' address for charging a 10% commission on all rewards
	DevelopersAddress = "Mx688568d9d70c57e71d0b9de6480afb0d317f885c"
)
View Source
const (
	// RoleValidator is validator role
	RoleValidator = "Validator"

	// RoleDelegator is delegator role
	RoleDelegator = "Delegator"

	// RoleDAO is DAO role
	RoleDAO = "DAO"

	// RoleDevelopers is developers role
	RoleDevelopers = "Developers"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	Type() EventType
}

Event interface

func ConvertToEvent

func ConvertToEvent(typeName EventType, value []byte) (Event, error)

ConvertToEvent returns interface of Event

Example
package main

import (
	"fmt"
	"github.com/MinterTeam/minter-go-sdk/v2/api"
)

func main() {
	eventValueJSON := `{
        "address": "Mx7f0fc21d932f38ca9444f61703174569066cfa50",
        "amount": "3962700000000000000000",
        "role": "DAO",
        "validator_pub_key": "Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5"
      }`
	event, _ := api.ConvertToEvent("minter/RewardEvent", []byte(eventValueJSON))
	if event.Type() != api.TypeRewardEvent {
		return
	}
	fmt.Printf("%#v", event.(*api.RewardEvent))

}
Output:

&api.RewardEvent{Role:"DAO", Address:"Mx7f0fc21d932f38ca9444f61703174569066cfa50", Amount:"3962700000000000000000", ValidatorPubKey:"Mpd83e627510eea6aefa46d9914b0715dabf4a561ced78d34267b31d41d5f700b5"}

type EventType added in v2.1.0

type EventType string

EventType is string name of events

const (
	TypeRewardEvent            EventType = "minter/RewardEvent"
	TypeSlashEvent             EventType = "minter/SlashEvent"
	TypeUnbondEvent            EventType = "minter/UnbondEvent"
	TypeStakeKickEvent         EventType = "minter/StakeKickEvent"
	TypeStakeMoveEvent         EventType = "minter/StakeMoveEvent"
	TypeUpdateNetworkEvent     EventType = "minter/UpdateNetworkEvent"
	TypeUpdateCommissionsEvent EventType = "minter/UpdateCommissionsEvent"
)

Event type names

type RewardEvent

type RewardEvent struct {
	Role            string `json:"role"`
	Address         string `json:"address"`
	Amount          string `json:"amount"`
	ValidatorPubKey string `json:"validator_pub_key"`
}

RewardEvent is the payment of rewards

func (*RewardEvent) GetAddress

func (e *RewardEvent) GetAddress() string

GetAddress return owner address

func (*RewardEvent) GetValidatorPublicKey

func (e *RewardEvent) GetValidatorPublicKey() string

GetValidatorPublicKey return validator public key

func (*RewardEvent) Type added in v2.2.0

func (e *RewardEvent) Type() EventType

type SlashEvent

type SlashEvent struct {
	Address         string `json:"address"`
	Amount          string `json:"amount"`
	Coin            string `json:"coin"`
	ValidatorPubKey string `json:"validator_pub_key"`
}

SlashEvent is the payment of the validator's penalty by this stake

func (*SlashEvent) GetAddress

func (e *SlashEvent) GetAddress() string

GetAddress return owner address

func (*SlashEvent) GetValidatorPublicKey

func (e *SlashEvent) GetValidatorPublicKey() string

GetValidatorPublicKey return validator public key

func (*SlashEvent) Type added in v2.2.0

func (e *SlashEvent) Type() EventType

type StakeEvent added in v2.2.0

type StakeEvent interface {
	// GetAddress return owner address
	GetAddress() string
	// GetValidatorPublicKey return validator public key
	GetValidatorPublicKey() string
}

Event interface

type StakeKickEvent

type StakeKickEvent struct {
	Address         string `json:"address"`
	Amount          string `json:"amount"`
	Coin            string `json:"coin"`
	ValidatorPubKey string `json:"validator_pub_key"`
}

StakeKickEvent is the knocking out a stake to the waiting list

func (*StakeKickEvent) GetAddress

func (e *StakeKickEvent) GetAddress() string

GetAddress return owner address

func (*StakeKickEvent) GetValidatorPublicKey

func (e *StakeKickEvent) GetValidatorPublicKey() string

GetValidatorPublicKey return validator public key

func (*StakeKickEvent) Type added in v2.2.0

func (e *StakeKickEvent) Type() EventType

type StakeMoveEvent added in v2.2.0

type StakeMoveEvent struct {
	Address         string `json:"address"`
	Amount          string `json:"amount"`
	Coin            string `json:"coin"`
	ValidatorPubKey string `json:"validator_pub_key"`
	WaitList        bool   `json:"waitlist"`
}

StakeMoveEvent ...

func (*StakeMoveEvent) GetAddress added in v2.2.0

func (e *StakeMoveEvent) GetAddress() string

GetAddress return owner address

func (*StakeMoveEvent) GetValidatorPublicKey added in v2.2.0

func (e *StakeMoveEvent) GetValidatorPublicKey() string

GetValidatorPublicKey return validator public key

func (*StakeMoveEvent) Type added in v2.2.0

func (e *StakeMoveEvent) Type() EventType

type UnbondEvent

type UnbondEvent struct {
	Address         string `json:"address"`
	Amount          string `json:"amount"`
	Coin            string `json:"coin"`
	ValidatorPubKey string `json:"validator_pub_key"`
}

UnbondEvent is the unbinding a stake from a validator

func (*UnbondEvent) GetAddress

func (e *UnbondEvent) GetAddress() string

GetAddress return owner address

func (*UnbondEvent) GetValidatorPublicKey

func (e *UnbondEvent) GetValidatorPublicKey() string

GetValidatorPublicKey return validator public key

func (*UnbondEvent) Type added in v2.2.0

func (e *UnbondEvent) Type() EventType

type UpdateCommissionsEvent added in v2.2.0

type UpdateCommissionsEvent struct {
	Coin                    string `json:"coin"`
	PayloadByte             string `json:"payload_byte"`
	Send                    string `json:"send"`
	BuyBancor               string `json:"buy_bancor"`
	SellBancor              string `json:"sell_bancor"`
	SellAllBancor           string `json:"sell_all_bancor"`
	BuyPoolBase             string `json:"buy_pool_base"`
	BuyPoolDelta            string `json:"buy_pool_delta"`
	SellPoolBase            string `json:"sell_pool_base"`
	SellPoolDelta           string `json:"sell_pool_delta"`
	SellAllPoolBase         string `json:"sell_all_pool_base"`
	SellAllPoolDelta        string `json:"sell_all_pool_delta"`
	CreateTicker3           string `json:"create_ticker3"`
	CreateTicker4           string `json:"create_ticker4"`
	CreateTicker5           string `json:"create_ticker5"`
	CreateTicker6           string `json:"create_ticker6"`
	CreateTicker7_10        string `json:"create_ticker7_10"`
	CreateCoin              string `json:"create_coin"`
	CreateToken             string `json:"create_token"`
	RecreateCoin            string `json:"recreate_coin"`
	RecreateToken           string `json:"recreate_token"`
	DeclareCandidacy        string `json:"declare_candidacy"`
	Delegate                string `json:"delegate"`
	Unbond                  string `json:"unbond"`
	RedeemCheck             string `json:"redeem_check"`
	SetCandidateOn          string `json:"set_candidate_on"`
	SetCandidateOff         string `json:"set_candidate_off"`
	CreateMultisig          string `json:"create_multisig"`
	MultisendBase           string `json:"multisend_base"`
	MultisendDelta          string `json:"multisend_delta"`
	EditCandidate           string `json:"edit_candidate"`
	SetHaltBlock            string `json:"set_halt_block"`
	EditTickerOwner         string `json:"edit_ticker_owner"`
	EditMultisig            string `json:"edit_multisig"`
	PriceVote               string `json:"price_vote"`
	EditCandidatePublicKey  string `json:"edit_candidate_public_key"`
	CreateSwapPool          string `json:"create_swap_pool"`
	AddLiquidity            string `json:"add_liquidity"`
	RemoveLiquidity         string `json:"remove_liquidity"`
	EditCandidateCommission string `json:"edit_candidate_commission"`
	MoveStake               string `json:"move_stake"`
	MintToken               string `json:"mint_token"`
	BurnToken               string `json:"burn_token"`
	VoteCommission          string `json:"vote_commission"`
	VoteUpdate              string `json:"vote_update"`
}

func (*UpdateCommissionsEvent) Type added in v2.2.0

type UpdateNetworkEvent added in v2.2.0

type UpdateNetworkEvent struct {
	Version string `json:"version"`
}

func (*UpdateNetworkEvent) Type added in v2.2.0

func (e *UpdateNetworkEvent) Type() EventType

Directories

Path Synopsis
Package grpc_client is the interface for uses gRPC methods.
Package grpc_client is the interface for uses gRPC methods.
Package http_client is the interface for uses API v2 methods.
Package http_client is the interface for uses API v2 methods.

Jump to

Keyboard shortcuts

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