Documentation ¶
Index ¶
- 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 MalfeasanceProof
- 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:"-"` Txs int64 `json:"txs" bson:"-"` LastActivity int32 `json:"lastActivity" 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"` LastActivity int32 `json:"lastActivity" bson:"-"` }
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. 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"` PublishEpoch uint32 `json:"publishEpoch" bson:"publishEpoch"` TargetEpoch uint32 `json:"targetEpoch" bson:"targetEpoch"` TickCount uint64 `json:"tickCount" bson:"tickCount"` Weight uint64 `json:"weight" bson:"weight"` EffectiveNumUnits uint32 `json:"effectiveNumUnits" bson:"effectiveNumUnits"` Received int64 `json:"received" bson:"received"` }
func NewActivation ¶
func NewActivation(atx *types.VerifiedActivationTx) *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"` Rewards uint64 `json:"rewards" bson:"rewards"` Epoch uint32 `json:"epoch" bson:"epoch"` 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 MalfeasanceProof ¶ added in v1.1.0
type MalfeasanceProof struct { Smesher string `json:"smesher" bson:"smesher"` Layer uint32 `json:"layer" bson:"layer"` Kind string `json:"kind" bson:"kind"` }
func NewMalfeasanceProof ¶ added in v1.1.0
func NewMalfeasanceProof(in *pb.MalfeasanceProof) *MalfeasanceProof
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"` PostUnitSize uint64 `json:"postUnitSize" bson:"postUnitSize"` 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"` 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 uint64 `json:"timestamp" bson:"timestamp"` Rewards int64 `json:"rewards" bson:"-"` AtxLayer uint32 `json:"atxLayer" bson:"atxLayer"` Proofs []MalfeasanceProof `json:"proofs,omitempty" bson:"proofs,omitempty"` Epochs []uint32 `json:"epochs,omitempty" bson:"epochs,omitempty"` }
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"` Result int `json:"result" bson:"result"` 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 Message string `json:"message" bson:"message"` TouchedAddresses []string `json:"touchedAddresses" bson:"touchedAddresses"` }
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.
func NewTransactionResult ¶ added in v1.2.2
func NewTransactionResult(res *pb.TransactionResult, state *pb.TransactionState, networkInfo NetworkInfo) (*Transaction, error)
type TransactionReceipt ¶
type TransactionService ¶
Click to show internal directories.
Click to hide internal directories.