navexplorer

package module
v0.0.0-...-877db2f Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2021 License: MIT Imports: 9 Imported by: 2

README

navexplorer-api-go-sdk

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorExplorerConnectionError = errors.New("Could not connect to the NavExplorer API")
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Hash               string `json:"hash"`
	Received           int64  `json:"received"`
	ReceivedCount      uint   `json:"receivedCount"`
	Sent               int64  `json:"sent"`
	SentCount          uint   `json:"sentCount"`
	Staked             int64  `json:"staked"`
	StakedCount        uint   `json:"stakedCount"`
	ColdStaked         int64  `json:"coldStaked"`
	ColdStakedCount    uint   `json:"coldStakedCount"`
	ColdStakedSent     int64  `json:"coldSent"`
	ColdStakedReceived int64  `json:"coldStakedReceived"`
	ColdStakedBalance  int64  `json:"coldStakedBalance"`
	Balance            int64  `json:"balance"`
	Position           int64  `json:"position"`
}

type Balance

type Balance struct {
	Hash         string `json:"hash"`
	Height       uint64 `json:"height"`
	Spendable    uint64 `json:"spendable"`
	Stakable     uint64 `json:"stakable"`
	VotingWeight uint64 `json:"voting_weight"`
}

type ExplorerApi

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

func NewExplorerApi

func NewExplorerApi(host string, network string) (*ExplorerApi, error)

func (*ExplorerApi) GetAddress

func (e *ExplorerApi) GetAddress(hash string) (address Address, err error)

func (*ExplorerApi) GetAddressTransactions

func (e *ExplorerApi) GetAddressTransactions(hash string, filters []TransactionType, page int, size int) (transactions []Transaction, paginator Paginator, err error)

func (*ExplorerApi) GetAddresses

func (e *ExplorerApi) GetAddresses(page int, size int) (addresses []Address, paginator Paginator, err error)

func (*ExplorerApi) GetBalances

func (e *ExplorerApi) GetBalances(addresses []string) (balances []Balance, err error)

func (*ExplorerApi) GetStakingRewardsForAddresses

func (e *ExplorerApi) GetStakingRewardsForAddresses(addresses []string) (rewards []Reward, err error)

func (*ExplorerApi) ValidateAddress

func (e *ExplorerApi) ValidateAddress(hash string) (validateAddress ValidateAddress, err error)

type ExplorerClient

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

func NewClient

func NewClient(host string, network string) (c *ExplorerClient, err error)

type Paginator

type Paginator struct {
	CurrentPage int   `json:"currentPage"`
	First       bool  `json:"first"`
	Last        bool  `json:"last"`
	Total       int64 `json:"total"`
	Size        int   `json:"size"`
	Pages       int   `json:"total_pages"`
	Elements    int   `json:"number_of_elements"`
}

type Reward

type Reward struct {
	Address string         `json:"address"`
	Periods []RewardPeriod `json:"periods"`
}

type RewardPeriod

type RewardPeriod struct {
	Period  string `json:"period"`
	Stakes  int64  `json:"stakes"`
	Balance int64  `json:"balance"`
}

type Transaction

type Transaction struct {
	Time                time.Time `json:"time"`
	Address             string    `json:"address"`
	Type                string    `json:"type"`
	Transaction         string    `json:"transaction"`
	Height              int       `json:"height"`
	Balance             float64   `json:"balance"`
	Sent                float64   `json:"sent"`
	Received            float64   `json:"received"`
	ColdStaking         bool      `json:"coldStaking"`
	ColdStakingBalance  float64   `json:"coldStakingBalance"`
	ColdStakingSent     float64   `json:"coldStakingSent"`
	ColdStakingReceived float64   `json:"coldStakingReceived"`
}

type TransactionType

type TransactionType string
const (
	TX_SEND         TransactionType = "SEND"
	TX_RECEIVE      TransactionType = "RECEIVE"
	TX_STAKING      TransactionType = "STAKING"
	TX_COLD_STAKING TransactionType = "COLD_STAKING"
)

type ValidateAddress

type ValidateAddress struct {
	Valid           bool   `json:"isValid"`
	Address         string `json:"address"`
	StakingAddress  string `json:"stakingAddress"`
	SpendingAddress string `json:"spendingAddress"`
	ColdStaking     bool   `json:"isColdStaking"`
}

Jump to

Keyboard shortcuts

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