api

package
v2.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package api ...

Index

Examples

Constants

View Source
const (
	TypeRewardEvent    = "minter/RewardEvent"
	TypeSlashEvent     = "minter/SlashEvent"
	TypeUnbondEvent    = "minter/UnbondEvent"
	TypeStakeKickEvent = "minter/StakeKickEvent"
)

Event type names

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event interface {
	GetAddress() string
	GetValidatorPublicKey() string
	// contains filtered or unexported methods
}

Event interface

func ConvertToEvent

func ConvertToEvent(typeName string, value []byte) (Event, error)
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))
	fmt.Println(event.GetAddress())
	fmt.Println(event.GetValidatorPublicKey())
	fmt.Printf("%#v", event.(*api.RewardEvent))

}
Output:

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

type RewardEvent

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

Events

func (*RewardEvent) GetAddress

func (e *RewardEvent) GetAddress() string

func (*RewardEvent) GetValidatorPublicKey

func (e *RewardEvent) GetValidatorPublicKey() string

type SlashEvent

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

func (*SlashEvent) GetAddress

func (e *SlashEvent) GetAddress() string

func (*SlashEvent) GetValidatorPublicKey

func (e *SlashEvent) GetValidatorPublicKey() string

type StakeKickEvent

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

func (*StakeKickEvent) GetAddress

func (e *StakeKickEvent) GetAddress() string

func (*StakeKickEvent) GetValidatorPublicKey

func (e *StakeKickEvent) GetValidatorPublicKey() string

type UnbondEvent

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

func (*UnbondEvent) GetAddress

func (e *UnbondEvent) GetAddress() string

func (*UnbondEvent) GetValidatorPublicKey

func (e *UnbondEvent) GetValidatorPublicKey() string

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