code.vegaprotocol.io/vega@v0.79.0/wallet/api/node/types/types.go (about)

     1  // Copyright (C) 2023 Gobalsky Labs Limited
     2  //
     3  // This program is free software: you can redistribute it and/or modify
     4  // it under the terms of the GNU Affero General Public License as
     5  // published by the Free Software Foundation, either version 3 of the
     6  // License, or (at your option) any later version.
     7  //
     8  // This program is distributed in the hope that it will be useful,
     9  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    10  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    11  // GNU Affero General Public License for more details.
    12  //
    13  // You should have received a copy of the GNU Affero General Public License
    14  // along with this program.  If not, see <http://www.gnu.org/licenses/>.
    15  
    16  package types
    17  
    18  import "fmt"
    19  
    20  type TransactionError struct {
    21  	ABCICode uint32
    22  	Message  string
    23  }
    24  
    25  func (e TransactionError) Error() string {
    26  	return fmt.Sprintf("%s (ABCI code %d)", e.Message, e.ABCICode)
    27  }
    28  
    29  func (e TransactionError) Is(target error) bool {
    30  	_, ok := target.(TransactionError)
    31  	return ok
    32  }
    33  
    34  type Statistics struct {
    35  	BlockHash   string
    36  	BlockHeight uint64
    37  	ChainID     string
    38  	VegaTime    string
    39  }
    40  
    41  type SpamStatistics struct {
    42  	ChainID           string
    43  	EpochSeq          uint64
    44  	LastBlockHeight   uint64
    45  	Proposals         *SpamStatistic
    46  	Delegations       *SpamStatistic
    47  	Transfers         *SpamStatistic
    48  	NodeAnnouncements *SpamStatistic
    49  	IssuesSignatures  *SpamStatistic
    50  	CreateReferralSet *SpamStatistic
    51  	UpdateReferralSet *SpamStatistic
    52  	ApplyReferralCode *SpamStatistic
    53  	Votes             *VoteSpamStatistics
    54  	PoW               *PoWStatistics
    55  }
    56  
    57  type SpamStatistic struct {
    58  	CountForEpoch uint64
    59  	MaxForEpoch   uint64
    60  	BannedUntil   *string
    61  }
    62  
    63  type VoteSpamStatistics struct {
    64  	Proposals   map[string]uint64
    65  	MaxForEpoch uint64
    66  	BannedUntil *string
    67  }
    68  
    69  type PoWStatistics struct {
    70  	PowBlockStates []PoWBlockState
    71  	PastBlocks     uint64
    72  	BannedUntil    *string
    73  }
    74  
    75  type PoWBlockState struct {
    76  	BlockHeight          uint64
    77  	BlockHash            string
    78  	TransactionsSeen     uint64
    79  	ExpectedDifficulty   *uint64
    80  	HashFunction         string
    81  	Difficulty           uint64
    82  	TxPerBlock           uint64
    83  	IncreasingDifficulty bool
    84  }
    85  
    86  type LastBlock struct {
    87  	ChainID                         string
    88  	BlockHeight                     uint64
    89  	BlockHash                       string
    90  	ProofOfWorkHashFunction         string
    91  	ProofOfWorkDifficulty           uint32
    92  	ProofOfWorkPastBlocks           uint32
    93  	ProofOfWorkTxPerBlock           uint32
    94  	ProofOfWorkIncreasingDifficulty bool
    95  }