api

package
v0.0.7-alphanet Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: GPL-3.0 Imports: 21 Imported by: 6

Documentation

Index

Constants

View Source
const (
	RpcMaxPageSize  = 1024
	RpcMaxCountSize = 1024
)

Variables

View Source
var (
	ErrPageSizeParamTooBig  = common.NewErrorWCode(-32000, "page-size parameter is too big")
	ErrPageIndexParamTooBig = common.NewErrorWCode(-32000, "page-index parameter is too big")
	ErrCountParamTooBig     = common.NewErrorWCode(-32000, "count parameter is too big")
	ErrHeightParamIsZero    = common.NewErrorWCode(-32000, "height parameter must be strictly greater than zero")
	ErrParamIsNull          = common.NewErrorWCode(-32000, "parameter must not be null")
)

Functions

func GetRange

func GetRange(index, count, listLen uint32) (uint32, uint32)

Types

type AccountBlock

type AccountBlock struct {
	nom.AccountBlock

	TokenInfo          *Token                          `json:"token"`
	ConfirmationDetail *AccountBlockConfirmationDetail `json:"confirmationDetail"`
	PairedAccountBlock *AccountBlock                   `json:"pairedAccountBlock"`
}

func (*AccountBlock) ComputeHash

func (block *AccountBlock) ComputeHash() (*types.Hash, error)

func (*AccountBlock) MarshalJSON

func (block *AccountBlock) MarshalJSON() ([]byte, error)

func (*AccountBlock) ToAccountBlockMarshal

func (block *AccountBlock) ToAccountBlockMarshal() *AccountBlockMarshal

func (*AccountBlock) ToLedgerBlock

func (block *AccountBlock) ToLedgerBlock() (*nom.AccountBlock, error)

func (*AccountBlock) UnmarshalJSON

func (block *AccountBlock) UnmarshalJSON(data []byte) error

type AccountBlockConfirmationDetail

type AccountBlockConfirmationDetail struct {
	NumConfirmations  uint64     `json:"numConfirmations"`
	MomentumHeight    uint64     `json:"momentumHeight"`
	MomentumHash      types.Hash `json:"momentumHash"`
	MomentumTimestamp int64      `json:"momentumTimestamp"`
}

type AccountBlockList

type AccountBlockList struct {
	List  []*AccountBlock `json:"list"`
	Count int             `json:"count"`
	More  bool            `json:"more"`
}

func (*AccountBlockList) MarshalJSON

func (abl *AccountBlockList) MarshalJSON() ([]byte, error)

func (*AccountBlockList) ToAccountBlockListMarshal

func (abl *AccountBlockList) ToAccountBlockListMarshal() *AccountBlockListMarshal

func (*AccountBlockList) UnmarshalJSON

func (abl *AccountBlockList) UnmarshalJSON(data []byte) error

type AccountBlockListMarshal

type AccountBlockListMarshal struct {
	List  []*AccountBlockMarshal `json:"list"`
	Count int                    `json:"count"`
	More  bool                   `json:"more"`
}

type AccountBlockMarshal

type AccountBlockMarshal struct {
	nom.AccountBlockMarshal
	TokenInfo          *TokenMarshal                   `json:"token"`
	ConfirmationDetail *AccountBlockConfirmationDetail `json:"confirmationDetail"`
	PairedAccountBlock *AccountBlockMarshal            `json:"pairedAccountBlock"`
}

func (*AccountBlockMarshal) FromApiMarshalJson

func (a *AccountBlockMarshal) FromApiMarshalJson() *AccountBlock

type AccountInfo

type AccountInfo struct {
	Address        types.Address                             `json:"address"`
	AccountHeight  uint64                                    `json:"accountHeight"`
	BalanceInfoMap map[types.ZenonTokenStandard]*BalanceInfo `json:"balanceInfoMap"`
}

type BalanceInfo

type BalanceInfo struct {
	TokenInfo *Token   `json:"token"`
	Balance   *big.Int `json:"balance"`
}

func (*BalanceInfo) MarshalJSON

func (b *BalanceInfo) MarshalJSON() ([]byte, error)

func (*BalanceInfo) ToBalanceInfoMarshal

func (b *BalanceInfo) ToBalanceInfoMarshal() BalanceInfoMarshal

func (*BalanceInfo) UnmarshalJSON

func (b *BalanceInfo) UnmarshalJSON(data []byte) error

type BalanceInfoMarshal

type BalanceInfoMarshal struct {
	TokenMarshal `json:"token"`
	Balance      string `json:"balance"`
}

type DetailedMomentum

type DetailedMomentum struct {
	AccountBlocks []*AccountBlock `json:"blocks"`
	Momentum      *Momentum       `json:"momentum"`
}

type DetailedMomentumList

type DetailedMomentumList struct {
	List  []*DetailedMomentum `json:"list"`
	Count int                 `json:"count"`
}

type LedgerApi

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

func NewLedgerApi

func NewLedgerApi(z zenon.Zenon) *LedgerApi

func (*LedgerApi) GetAccountBlockByHash

func (l *LedgerApi) GetAccountBlockByHash(blockHash types.Hash) (*AccountBlock, error)

func (*LedgerApi) GetAccountBlocksByHeight

func (l *LedgerApi) GetAccountBlocksByHeight(address types.Address, height, count uint64) (*AccountBlockList, error)

func (*LedgerApi) GetAccountBlocksByPage

func (l *LedgerApi) GetAccountBlocksByPage(address types.Address, pageIndex, pageSize uint32) (*AccountBlockList, error)

func (*LedgerApi) GetAccountInfoByAddress

func (l *LedgerApi) GetAccountInfoByAddress(address types.Address) (*AccountInfo, error)

func (*LedgerApi) GetDetailedMomentumsByHeight

func (l *LedgerApi) GetDetailedMomentumsByHeight(height, count uint64) (*DetailedMomentumList, error)

func (*LedgerApi) GetFrontierAccountBlock

func (l *LedgerApi) GetFrontierAccountBlock(address types.Address) (*AccountBlock, error)

AccountBlocks

func (*LedgerApi) GetFrontierMomentum

func (l *LedgerApi) GetFrontierMomentum() (*Momentum, error)

Momentum

func (*LedgerApi) GetMomentumBeforeTime

func (l *LedgerApi) GetMomentumBeforeTime(timestamp int64) (*Momentum, error)

func (*LedgerApi) GetMomentumByHash

func (l *LedgerApi) GetMomentumByHash(hash types.Hash) (*Momentum, error)

func (*LedgerApi) GetMomentumsByHeight

func (l *LedgerApi) GetMomentumsByHeight(height, count uint64) (*MomentumList, error)

func (*LedgerApi) GetMomentumsByPage

func (l *LedgerApi) GetMomentumsByPage(pageIndex, pageSize uint32) (*MomentumList, error)

func (*LedgerApi) GetUnconfirmedBlocksByAddress

func (l *LedgerApi) GetUnconfirmedBlocksByAddress(address types.Address, pageIndex, pageSize uint32) (*AccountBlockList, error)

Unconfirmed AccountBlocks

func (*LedgerApi) GetUnreceivedBlocksByAddress

func (l *LedgerApi) GetUnreceivedBlocksByAddress(address types.Address, pageIndex, pageSize uint32) (*AccountBlockList, error)

func (*LedgerApi) PublishRawTransaction

func (l *LedgerApi) PublishRawTransaction(block *AccountBlock) error

func (LedgerApi) String

func (l LedgerApi) String() string

type Momentum

type Momentum struct {
	*nom.Momentum
	Producer types.Address `json:"producer"`
}

type MomentumHeader

type MomentumHeader struct {
	Hash      types.Hash `json:"hash"`
	Height    uint64     `json:"height"`
	Timestamp int64      `json:"timestamp"`
}

type MomentumList

type MomentumList struct {
	List  []*Momentum `json:"list"`
	Count int         `json:"count"`
}

type NetworkInfoResponse

type NetworkInfoResponse struct {
	NumPeers int     `json:"numPeers"`
	Peers    []*Peer `json:"peers"`
	Self     *Peer   `json:"self"`
}

type OsInfoResponse

type OsInfoResponse struct {
	Os              string `json:"os"`
	Platform        string `json:"platform"`
	PlatformFamily  string `json:"platformFamily"`
	PlatformVersion string `json:"platformVersion"`
	KernelVersion   string `json:"kernelVersion"`
	MemoryTotal     uint64 `json:"memoryTotal"`
	MemoryFree      uint64 `json:"memoryFree"`
	NumCPU          int    `json:"numCPU"`
	NumGoroutine    int    `json:"numGoroutine"`
}

type Peer

type Peer struct {
	PublicKey string `json:"publicKey"`
	IP        string `json:"ip"`
	Name      string `json:"name"`
}

type ProcessInfoResponse

type ProcessInfoResponse struct {
	Version string `json:"version"`
	Commit  string `json:"commit"`
}

type StatsApi

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

func NewStatsApi

func NewStatsApi(z zenon.Zenon, p2p *p2p.Server) *StatsApi

func (*StatsApi) NetworkInfo

func (api *StatsApi) NetworkInfo() (*NetworkInfoResponse, error)

func (*StatsApi) OsInfo

func (api *StatsApi) OsInfo() (*OsInfoResponse, error)

func (*StatsApi) ProcessInfo

func (api *StatsApi) ProcessInfo() (*ProcessInfoResponse, error)

func (*StatsApi) SyncInfo

func (api *StatsApi) SyncInfo() (*protocol.SyncInfo, error)

type Token

type Token struct {
	TokenName          string                   `json:"name"`
	TokenSymbol        string                   `json:"symbol"`
	TokenDomain        string                   `json:"domain"`
	TotalSupply        *big.Int                 `json:"totalSupply"`
	Decimals           uint8                    `json:"decimals"`
	Owner              types.Address            `json:"owner"`
	ZenonTokenStandard types.ZenonTokenStandard `json:"tokenStandard"`
	MaxSupply          *big.Int                 `json:"maxSupply"`
	IsBurnable         bool                     `json:"isBurnable"`
	IsMintable         bool                     `json:"isMintable"`
	IsUtility          bool                     `json:"isUtility"`
}

func LedgerTokenInfoToRpc

func LedgerTokenInfoToRpc(tokenInfo *definition.TokenInfo) *Token

func LedgerTokenInfosToRpc

func LedgerTokenInfosToRpc(list []*definition.TokenInfo) []*Token

func (*Token) MarshalJSON

func (t *Token) MarshalJSON() ([]byte, error)

func (*Token) ToTokenMarshal

func (t *Token) ToTokenMarshal() *TokenMarshal

func (*Token) UnmarshalJSON

func (t *Token) UnmarshalJSON(data []byte) error

type TokenMarshal

type TokenMarshal struct {
	TokenName          string                   `json:"name"`
	TokenSymbol        string                   `json:"symbol"`
	TokenDomain        string                   `json:"domain"`
	TotalSupply        string                   `json:"totalSupply"`
	Decimals           uint8                    `json:"decimals"`
	Owner              types.Address            `json:"owner"`
	ZenonTokenStandard types.ZenonTokenStandard `json:"tokenStandard"`
	MaxSupply          string                   `json:"maxSupply"`
	IsBurnable         bool                     `json:"isBurnable"`
	IsMintable         bool                     `json:"isMintable"`
	IsUtility          bool                     `json:"isUtility"`
}

func (*TokenMarshal) FromTokenMarshal

func (t *TokenMarshal) FromTokenMarshal() *Token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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