Documentation ¶
Index ¶
- func GetTransactionStateFromResult(txResult int) int
- func IsApprovedLayer(l *pb.Layer) bool
- func IsConfirmedLayer(l *pb.Layer) bool
- func NewLayer(in *pb.Layer, networkInfo *NetworkInfo) (*Layer, []*Block, []*Activation, map[string]*Transaction)
- type Account
- type AccountService
- type AccountSummary
- type Activation
- type ActivationService
- type App
- type AppService
- type Block
- type BlockService
- type Epoch
- type EpochService
- type Geo
- type Layer
- type LayerService
- type NetworkInfo
- type Reward
- type RewardService
- type Smesher
- type SmesherService
- type Statistics
- type Stats
- type Transaction
- type TransactionReceipt
- type TransactionService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsApprovedLayer ¶
func IsConfirmedLayer ¶
func NewLayer ¶
func NewLayer(in *pb.Layer, networkInfo *NetworkInfo) (*Layer, []*Block, []*Activation, map[string]*Transaction)
Types ¶
type Account ¶
type Account struct { Address string `json:"address" bson:"address"` // account public address Balance uint64 `json:"balance" bson:"balance"` // known account balance Counter uint64 `json:"counter" bson:"counter"` Created uint64 `json:"created" bson:"created"` // get from ledger collection Sent uint64 `json:"sent" bson:"-"` Received uint64 `json:"received" bson:"-"` Awards uint64 `json:"awards" bson:"-"` Fees uint64 `json:"fees" bson:"-"` LayerTms int32 `json:"timestamp" bson:"-"` Txs int64 `json:"txs" bson:"-"` }
func NewAccount ¶
type AccountService ¶
type AccountService interface { GetAccount(ctx context.Context, accountID string) (*Account, error) GetAccounts(ctx context.Context, page, perPage int64) ([]*Account, int64, error) GetAccountTransactions(ctx context.Context, accountID string, page, perPage int64) ([]*Transaction, int64, error) GetAccountRewards(ctx context.Context, accountID string, page, perPage int64) ([]*Reward, int64, error) }
type AccountSummary ¶ added in v0.0.11
type AccountSummary struct { Sent uint64 `json:"sent" bson:"sent"` Received uint64 `json:"received" bson:"received"` Awards uint64 `json:"awards" bson:"awards"` Fees uint64 `json:"fees" bson:"fees"` LayerTms int32 `json:"timestamp" bson:"timestamp"` }
AccountSummary data taken from `ledger` collection. Not all accounts from api have filled this data.
type Activation ¶
type Activation struct { Id string `json:"id" bson:"id"` //nolint will fix it later. Layer uint32 `json:"layer" bson:"layer"` // the layer that this activation is part of SmesherId string `json:"smesher" bson:"smesher"` //nolint will fix it later // id of smesher who created the ATX Coinbase string `json:"coinbase" bson:"coinbase"` // coinbase account id PrevAtx string `json:"prevAtx" bson:"prevAtx"` // previous ATX pointed to NumUnits uint32 `json:"numunits" bson:"numunits"` // number of PoST data commitment units CommitmentSize uint64 `json:"commitmentSize" bson:"commitmentSize"` Timestamp uint32 `json:"timestamp" bson:"timestamp"` }
func NewActivation ¶
func NewActivation(atx *pb.Activation, timestamp uint32) *Activation
func (*Activation) GetSmesher ¶
func (atx *Activation) GetSmesher(unitSize uint64) *Smesher
type ActivationService ¶
type AppService ¶
type Block ¶
type Block struct { Id string `json:"id" bson:"id"` // nolint will fix it later Layer uint32 `json:"layer" bson:"layer"` Epoch uint32 `json:"epoch" bson:"epoch"` Start uint32 `json:"start" bson:"start"` End uint32 `json:"end" bson:"end"` TxsNumber uint32 `json:"txsnumber" bson:"txsnumber"` TxsValue uint64 `json:"txsvalue" bson:"txsvalue"` }
type BlockService ¶
type Epoch ¶
type Epoch struct { Number int32 `json:"number" bson:"number"` Start uint32 `json:"start" bson:"start"` End uint32 `json:"end" bson:"end"` LayerStart uint32 `json:"layerstart" bson:"layerstart"` LayerEnd uint32 `json:"layerend" bson:"layerend"` Layers uint32 `json:"layers" bson:"layers"` Stats Stats `json:"stats"` }
type EpochService ¶
type EpochService interface { GetEpoch(ctx context.Context, epochNum int) (*Epoch, error) GetEpochs(ctx context.Context, page, perPage int64) (epochs []*Epoch, total int64, err error) GetEpochLayers(ctx context.Context, epochNum int, page, perPage int64) (layers []*Layer, total int64, err error) GetEpochTransactions(ctx context.Context, epochNum int, page, perPage int64) (txs []*Transaction, total int64, err error) GetEpochSmeshers(ctx context.Context, epochNum int, page, perPage int64) (smeshers []*Smesher, total int64, err error) GetEpochRewards(ctx context.Context, epochNum int, page, perPage int64) (rewards []*Reward, total int64, err error) GetEpochActivations(ctx context.Context, epochNum int, page, perPage int64) (atxs []*Activation, total int64, err error) }
type Layer ¶
type Layer struct { Number uint32 `json:"number" bson:"number"` Status int `json:"status" bson:"status"` Txs uint32 `json:"txs" bson:"txs"` Start uint32 `json:"start" bson:"start"` End uint32 `json:"end" bson:"end"` TxsAmount uint64 `json:"txsamount" bson:"txsamount"` AtxNumUnits uint64 `json:"atxnumunits" bson:"atxnumunits"` Rewards uint64 `json:"rewards" bson:"rewards"` Epoch uint32 `json:"epoch" bson:"epoch"` Smeshers uint32 `json:"smeshers" bson:"smeshers"` Hash string `json:"hash" bson:"hash"` BlocksNumber uint32 `json:"blocksnumber" bson:"blocksnumber"` }
type LayerService ¶
type LayerService interface { GetLayer(ctx context.Context, layerNum int) (*Layer, error) //GetLayerByHash(ctx context.Context, layerHash string) (*Layer, error) GetLayers(ctx context.Context, page, perPage int64) (layers []*Layer, total int64, err error) GetLayerTransactions(ctx context.Context, layerNum int, pageNum, pageSize int64) (txs []*Transaction, total int64, err error) GetLayerSmeshers(ctx context.Context, layerNum int, pageNum, pageSize int64) (smeshers []*Smesher, total int64, err error) GetLayerRewards(ctx context.Context, layerNum int, pageNum, pageSize int64) (rewards []*Reward, total int64, err error) GetLayerActivations(ctx context.Context, layerNum int, pageNum, pageSize int64) (atxs []*Activation, total int64, err error) GetLayerBlocks(ctx context.Context, layerNum int, pageNum, pageSize int64) (blocks []*Block, total int64, err error) }
type NetworkInfo ¶
type NetworkInfo struct { GenesisId string `json:"genesisid" bson:"genesisid"` // nolint will fix it later GenesisTime uint32 `json:"genesis" bson:"genesis"` EpochNumLayers uint32 `json:"layers" bson:"layers"` MaxTransactionsPerSecond uint32 `json:"maxtx" bson:"maxtx"` LayerDuration uint32 `json:"duration" bson:"duration"` LastLayer uint32 `json:"lastlayer" bson:"lastlayer"` LastLayerTimestamp uint32 `json:"lastlayerts" bson:"lastlayerts"` LastApprovedLayer uint32 `json:"lastapprovedlayer" bson:"lastapprovedlayer"` LastConfirmedLayer uint32 `json:"lastconfirmedlayer" bson:"lastconfirmedlayer"` ConnectedPeers uint64 `json:"connectedpeers" bson:"connectedpeers"` IsSynced bool `json:"issynced" bson:"issynced"` SyncedLayer uint32 `json:"syncedlayer" bson:"syncedlayer"` TopLayer uint32 `json:"toplayer" bson:"toplayer"` VerifiedLayer uint32 `json:"verifiedlayer" bson:"verifiedlayer"` }
type Reward ¶
type Reward struct { ID string `json:"_id" bson:"_id"` Layer uint32 `json:"layer" bson:"layer"` Total uint64 `json:"total" bson:"total"` LayerReward uint64 `json:"layerReward" bson:"layerReward"` LayerComputed uint32 `json:"layerComputed" bson:"layerComputed"` // layer number of the layer when reward was computed // tx_fee = total - layer_reward Coinbase string `json:"coinbase" bson:"coinbase"` // account awarded this reward Smesher string `json:"smesher" bson:"smesher"` // it will be nice to always have this in reward events Space uint64 `json:"space" bson:"space"` Timestamp uint32 `json:"timestamp" bson:"timestamp"` }
type RewardService ¶
type Smesher ¶
type Smesher struct { Id string `json:"id" bson:"id"` //nolint will fix it later. CommitmentSize uint64 `json:"cSize" bson:"cSize"` Coinbase string `json:"coinbase" bson:"coinbase"` AtxCount uint32 `json:"atxcount" bson:"atxcount"` Timestamp uint32 `json:"timestamp" bson:"timestamp"` Name string `json:"name" bson:"name"` Lat float64 `json:"lat" bson:"lat"` Lon float64 `json:"lon" bson:"lon"` Rewards int64 `json:"rewards" bson:"-"` }
type SmesherService ¶
type SmesherService interface { GetSmesher(ctx context.Context, smesherID string) (*Smesher, error) GetSmeshers(ctx context.Context, page, perPage int64) (smeshers []*Smesher, total int64, err error) GetSmesherActivations(ctx context.Context, smesherID string, page, perPage int64) (atxs []*Activation, total int64, err error) GetSmesherRewards(ctx context.Context, smesherID string, page, perPage int64) (rewards []*Reward, total int64, err error) CountSmesherRewards(ctx context.Context, smesherID string) (total, count int64, err error) }
type Statistics ¶
type Statistics struct { Capacity int64 `json:"capacity" bson:"capacity"` // Average tx/s rate over capacity considering all layers in the current epoch. Decentral int64 `json:"decentral" bson:"decentral"` // Distribution of storage between all active smeshers. Smeshers int64 `json:"smeshers" bson:"smeshers"` // Number of active smeshers in the current epoch. Transactions int64 `json:"transactions" bson:"transactions"` // Total number of transactions processed by the state transition function. Accounts int64 `json:"accounts" bson:"accounts"` // Total number of on-mesh accounts with a non-zero coin balance as of the current epoch. Circulation int64 `json:"circulation" bson:"circulation"` // Total number of Smesh coins in circulation. This is the total balances of all on-mesh accounts. Rewards int64 `json:"rewards" bson:"rewards"` // Total amount of Smesh minted as mining rewards as of the last known reward distribution event. RewardsNumber int64 `json:"rewardsnumber" bson:"rewardsnumber"` Security int64 `json:"security" bson:"security"` // Total amount of storage committed to the network based on the ATXs in the previous epoch. TxsAmount int64 `json:"txsamount" bson:"txsamount"` // Total amount of coin transferred between accounts in the epoch. Incl coin transactions and smart wallet transactions. }
type Stats ¶
type Stats struct { Current Statistics `json:"current"` Cumulative Statistics `json:"cumulative"` }
type Transaction ¶
type Transaction struct { Id string `json:"id" bson:"id"` //nolint will fix it later Layer uint32 `json:"layer" bson:"layer"` Block string `json:"block" bson:"block"` BlockIndex uint32 `json:"blockIndex" bson:"blockIndex"` Index uint32 `json:"index" bson:"index"` // the index of the tx in the ordered list of txs to be executed by stf in the layer State int `json:"state" bson:"state"` Timestamp uint32 `json:"timestamp" bson:"timestamp"` MaxGas uint64 `json:"maxGas" bson:"maxGas"` GasPrice uint64 `json:"gasPrice" bson:"gasPrice"` GasUsed uint64 `bson:"gasUsed" json:"gasUsed"` // gas units used by the transaction (gas price in tx) Fee uint64 `json:"fee" bson:"fee"` // transaction fee charged for the transaction Amount uint64 `json:"amount" bson:"amount"` // amount of coin transferred in this tx by sender Counter uint64 `json:"counter" bson:"counter"` // tx counter aka nonce Type int `json:"type" bson:"type"` Signature string `json:"signature" bson:"signature"` // the signature itself PublicKey string `json:"pubKey" bson:"pubKey"` // included in schemes which require signer to provide a public key Sender string `json:"sender" bson:"sender"` // tx originator, should match signer inside Signature Receiver string `json:"receiver" bson:"receiver"` SvmData string `json:"svmData" bson:"svmData"` // svm binary data. Decode with svm-codec }
func NewTransaction ¶
func NewTransaction(in *pb.Transaction, layer uint32, blockID string, timestamp uint32, blockIndex uint32) (*Transaction, error)
NewTransaction try to parse the transaction and return a new Transaction struct.
type TransactionReceipt ¶
type TransactionReceipt struct { Id string //nolint will fix it later Layer uint32 Index uint32 // the index of the tx in the ordered list of txs to be executed by stf in the layer Result int GasUsed uint64 // gas units used by the transaction (gas price in tx) Fee uint64 // transaction fee charged for the transaction SvmData string // svm binary data. Decode with svm-codec }
func NewTransactionReceipt ¶
func NewTransactionReceipt(txReceipt *pb.TransactionReceipt) *TransactionReceipt
type TransactionService ¶
Click to show internal directories.
Click to hide internal directories.