api

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2024 License: LGPL-2.1 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const NetworkStartDate = int64(1706468787000)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainInfo

type ChainInfo struct {
	StartTime                   *big.Int
	StartBlock                  *big.Int
	CurrentBlock                *big.Int
	CurrentEpoch                *big.Int
	CurrentCycle                *big.Int
	ChainId                     configs.ChainId
	ValidatorLicenseCount       *big.Int
	ValidatorActiveLicenseCount *big.Int
	SentryLicenseCount          *big.Int
	SentryActiveLicenseCount    *big.Int
}

type EthereumAPI

type EthereumAPI struct {
	// Protocol Protocol
	EthConfig configs.EthConfig
	// contains filtered or unexported fields
}

func NewEthAPI

func NewEthAPI(chainId configs.ChainId, ethConfig configs.EthConfig, privateKey *[]byte) (*EthereumAPI, error)

func (EthereumAPI) ClaimReward

func (n EthereumAPI) ClaimReward(claim *entities.ClaimData) (hash []byte, err error)

func (EthereumAPI) Claimed

func (n EthereumAPI) Claimed(validator []byte, cycle *big.Int, index *big.Int) (bool, error)

func (EthereumAPI) GetChainInfo

func (n EthereumAPI) GetChainInfo() (info *ChainInfo, err error)

func (EthereumAPI) GetCurrentBlockNumber

func (n EthereumAPI) GetCurrentBlockNumber() (*big.Int, error)

func (EthereumAPI) GetCurrentCycle

func (n EthereumAPI) GetCurrentCycle() (*big.Int, error)

func (EthereumAPI) GetCurrentEpoch

func (n EthereumAPI) GetCurrentEpoch() (*big.Int, error)

func (EthereumAPI) GetCurrentMessagePrice

func (n EthereumAPI) GetCurrentMessagePrice() (*big.Int, error)

func (EthereumAPI) GetCurrentYear

func (n EthereumAPI) GetCurrentYear() (*big.Int, error)

func (EthereumAPI) GetCycle

func (n EthereumAPI) GetCycle(blockNumber *big.Int) (*big.Int, error)

func (EthereumAPI) GetEpoch

func (n EthereumAPI) GetEpoch(blockNumber *big.Int) (*big.Int, error)

func (EthereumAPI) GetMessagePrice

func (n EthereumAPI) GetMessagePrice(cycle *big.Int) (*big.Int, error)

func (EthereumAPI) GetMinStakeAmountForSentry

func (n EthereumAPI) GetMinStakeAmountForSentry() (*big.Int, error)

func (EthereumAPI) GetSentryActiveLicenseCount

func (n EthereumAPI) GetSentryActiveLicenseCount(cycle *big.Int) (*big.Int, error)

func (EthereumAPI) GetSentryLicenseOperator

func (n EthereumAPI) GetSentryLicenseOperator(license *big.Int) ([]byte, error)

func (EthereumAPI) GetSentryLicenseOwnerAddress

func (n EthereumAPI) GetSentryLicenseOwnerAddress(publicKey []byte) ([]byte, error)

func (EthereumAPI) GetSentryLicenses

func (n EthereumAPI) GetSentryLicenses(operator []byte, cycle *big.Int) ([]*big.Int, error)

func (EthereumAPI) GetSentryNodeOperators

func (n EthereumAPI) GetSentryNodeOperators(page *big.Int, perPage *big.Int) ([]OperatorInfo, error)

func (EthereumAPI) GetSentryOperatorCycleLicenseCount

func (n EthereumAPI) GetSentryOperatorCycleLicenseCount(operator []byte, cycle *big.Int) (*big.Int, error)

func (EthereumAPI) GetStartBlock

func (n EthereumAPI) GetStartBlock() (*big.Int, error)

func (EthereumAPI) GetStartTime

func (n EthereumAPI) GetStartTime() (*big.Int, error)

func (EthereumAPI) GetSubnetBalance

func (n EthereumAPI) GetSubnetBalance(id [16]byte) (*big.Int, error)

func (EthereumAPI) GetValidatorActiveLicenseCount

func (n EthereumAPI) GetValidatorActiveLicenseCount(cycle *big.Int) (*big.Int, error)

func (EthereumAPI) GetValidatorLicenseOperator

func (n EthereumAPI) GetValidatorLicenseOperator(license *big.Int) ([]byte, error)

func (EthereumAPI) GetValidatorLicenseOwnerAddress

func (n EthereumAPI) GetValidatorLicenseOwnerAddress(publicKey []byte) ([]byte, error)

func (EthereumAPI) GetValidatorLicenses

func (n EthereumAPI) GetValidatorLicenses(operator []byte, cycle *big.Int) ([]*big.Int, error)

func (EthereumAPI) GetValidatorNodeOperators

func (n EthereumAPI) GetValidatorNodeOperators(page *big.Int, perPage *big.Int) ([]OperatorInfo, error)

func (EthereumAPI) GetValidatorOperatorCycleLicenseCount

func (n EthereumAPI) GetValidatorOperatorCycleLicenseCount(operator []byte, cycle *big.Int) (*big.Int, error)

func (EthereumAPI) IsSentryLicenseOwner

func (n EthereumAPI) IsSentryLicenseOwner(address string) (bool, error)

func (EthereumAPI) IsSentryNodeOperator

func (n EthereumAPI) IsSentryNodeOperator(publicKey []byte, cycle *big.Int) (bool, error)

func (EthereumAPI) IsValidatorLicenseOwner

func (n EthereumAPI) IsValidatorLicenseOwner(address string) (bool, error)

func (EthereumAPI) IsValidatorNodeOperator

func (n EthereumAPI) IsValidatorNodeOperator(publicKey []byte, cycle *big.Int) (bool, error)

func (*EthereumAPI) LicenseOperator

func (n *EthereumAPI) LicenseOperator(license *big.Int) ([]byte, error)

type GenericAPI

type GenericAPI struct {
	IChainAPI configs.ChainId
	// contains filtered or unexported fields
}
var API GenericAPI

func NewGenericAPI

func NewGenericAPI() *GenericAPI
func Init(chainId configs.ChainId, api IChainAPI) {
	// API = *NewGenericAPI(chainId)
	ChainId configs.ChainId
}

func (GenericAPI) ClaimReward

func (n GenericAPI) ClaimReward(claim *entities.ClaimData) (hash []byte, err error)

func (GenericAPI) Claimed

func (n GenericAPI) Claimed(validator []byte, cycle *big.Int, index *big.Int) (bool, error)

func (GenericAPI) GetChainInfo

func (n GenericAPI) GetChainInfo() (*ChainInfo, error)

func (GenericAPI) GetCurrentBlockNumber

func (n GenericAPI) GetCurrentBlockNumber() (*big.Int, error)

func (GenericAPI) GetCurrentCycle

func (n GenericAPI) GetCurrentCycle() (*big.Int, error)

func (GenericAPI) GetCurrentEpoch

func (n GenericAPI) GetCurrentEpoch() (*big.Int, error)

func (GenericAPI) GetCurrentMessagePrice

func (n GenericAPI) GetCurrentMessagePrice() (*big.Int, error)

func (GenericAPI) GetCurrentYear

func (n GenericAPI) GetCurrentYear() (*big.Int, error)

func (GenericAPI) GetCycle

func (n GenericAPI) GetCycle(blockNumber *big.Int) (*big.Int, error)

func (GenericAPI) GetEpoch

func (n GenericAPI) GetEpoch(blockNumber *big.Int) (*big.Int, error)

func (GenericAPI) GetMessagePrice

func (n GenericAPI) GetMessagePrice(cycle *big.Int) (*big.Int, error)

func (GenericAPI) GetMinStakeAmountForSentry

func (n GenericAPI) GetMinStakeAmountForSentry() (*big.Int, error)

func (GenericAPI) GetSentryActiveLicenseCount

func (n GenericAPI) GetSentryActiveLicenseCount(cycle *big.Int) (*big.Int, error)

func (GenericAPI) GetSentryLicenseOperator

func (n GenericAPI) GetSentryLicenseOperator(license *big.Int) ([]byte, error)

func (GenericAPI) GetSentryLicenseOwnerAddress

func (n GenericAPI) GetSentryLicenseOwnerAddress(publicKey []byte) ([]byte, error)

func (GenericAPI) GetSentryLicenses

func (n GenericAPI) GetSentryLicenses(operator []byte, cycle *big.Int) ([]*big.Int, error)

func (GenericAPI) GetSentryNodeOperators

func (n GenericAPI) GetSentryNodeOperators(page *big.Int, perPage *big.Int) ([]OperatorInfo, error)

func (GenericAPI) GetSentryOperatorCycleLicenseCount

func (n GenericAPI) GetSentryOperatorCycleLicenseCount(operator []byte, cycle *big.Int) (*big.Int, error)

func (GenericAPI) GetStakeBalance

func (n GenericAPI) GetStakeBalance(address entities.DIDString) big.Int

func (GenericAPI) GetStartBlock

func (n GenericAPI) GetStartBlock() (*big.Int, error)

func (GenericAPI) GetStartTime

func (n GenericAPI) GetStartTime() (*big.Int, error)

func (GenericAPI) GetSubnetBalance

func (n GenericAPI) GetSubnetBalance(id [16]byte) (*big.Int, error)

func (GenericAPI) GetValidatorActiveLicenseCount

func (n GenericAPI) GetValidatorActiveLicenseCount(cycle *big.Int) (*big.Int, error)

func (GenericAPI) GetValidatorLicenseOperator

func (n GenericAPI) GetValidatorLicenseOperator(license *big.Int) ([]byte, error)

func (GenericAPI) GetValidatorLicenseOwnerAddress

func (n GenericAPI) GetValidatorLicenseOwnerAddress(publicKey []byte) ([]byte, error)

func (GenericAPI) GetValidatorLicenses

func (n GenericAPI) GetValidatorLicenses(operator []byte, cycle *big.Int) ([]*big.Int, error)

func (GenericAPI) GetValidatorNodeOperators

func (n GenericAPI) GetValidatorNodeOperators(page *big.Int, perPage *big.Int) ([]OperatorInfo, error)

func (GenericAPI) GetValidatorOperatorCycleLicenseCount

func (n GenericAPI) GetValidatorOperatorCycleLicenseCount(operator []byte, cycle *big.Int) (*big.Int, error)

func (GenericAPI) IsSentryLicenseOwner

func (n GenericAPI) IsSentryLicenseOwner(address string) (bool, error)

func (GenericAPI) IsSentryNodeOperator

func (n GenericAPI) IsSentryNodeOperator(publicKey []byte, cycle *big.Int) (bool, error)

func (GenericAPI) IsValidatorLicenseOwner

func (n GenericAPI) IsValidatorLicenseOwner(address string) (bool, error)

func (GenericAPI) IsValidatorNodeOperator

func (n GenericAPI) IsValidatorNodeOperator(publicKey []byte, cycle *big.Int) (bool, error)

func (*GenericAPI) LicenseOperator

func (n *GenericAPI) LicenseOperator(license *big.Int) ([]byte, error)

type IChainAPI

type IChainAPI interface {
	// general
	GetChainInfo() (*ChainInfo, error)
	GetStartTime() (*big.Int, error)
	GetStartBlock() (*big.Int, error)
	GetEpoch(blockNumber *big.Int) (*big.Int, error)
	GetCycle(blockNumber *big.Int) (*big.Int, error)
	GetCurrentCycle() (*big.Int, error)
	GetCurrentBlockNumber() (*big.Int, error)
	GetCurrentEpoch() (*big.Int, error)
	GetCurrentYear() (*big.Int, error)

	// license
	GetSentryActiveLicenseCount(cycle *big.Int) (*big.Int, error)
	GetValidatorActiveLicenseCount(cycle *big.Int) (*big.Int, error)
	GetSentryOperatorCycleLicenseCount(operator []byte, cycle *big.Int) (*big.Int, error)
	GetValidatorOperatorCycleLicenseCount(operator []byte, cycle *big.Int) (*big.Int, error)
	GetSentryLicenseOperator(license *big.Int) ([]byte, error)
	GetValidatorLicenseOperator(license *big.Int) ([]byte, error)

	GetValidatorNodeOperators(page *big.Int, perPage *big.Int) ([]OperatorInfo, error)
	GetSentryNodeOperators(page *big.Int, perPage *big.Int) ([]OperatorInfo, error)

	IsValidatorLicenseOwner(address string) (bool, error)
	IsSentryLicenseOwner(address string) (bool, error)

	IsValidatorNodeOperator(publicKey []byte, cycle *big.Int) (bool, error)
	IsSentryNodeOperator(publicKey []byte, cycle *big.Int) (bool, error)

	GetValidatorLicenseOwnerAddress(publicKey []byte) ([]byte, error)
	GetSentryLicenseOwnerAddress(publicKey []byte) ([]byte, error)

	// subnet
	GetSubnetBalance(id [16]byte) (*big.Int, error)

	// sentry
	// GetMinStakeAmountForValidators() (*big.Int, error)
	GetMinStakeAmountForSentry() (*big.Int, error)
	GetCurrentMessagePrice() (*big.Int, error)
	GetMessagePrice(cycle *big.Int) (*big.Int, error)
	// GetChannelBalance(address entities.DIDString) *big.Int
	ClaimReward(claim *entities.ClaimData) ([]byte, error)
	Claimed(validator []byte, cycle *big.Int, index *big.Int) (bool, error)
	GetSentryLicenses(operator []byte, cycle *big.Int) ([]*big.Int, error)
	GetValidatorLicenses(operator []byte, cycle *big.Int) ([]*big.Int, error)
}

type OperatorInfo

type OperatorInfo struct {
	PublicKey    []byte
	LicenseOwner string
	EddKey       [32]byte
}

type Protocol

type Protocol string
const (
	Ws    Protocol = "ws"
	Https Protocol = "https"
)

Jump to

Keyboard shortcuts

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