import { Schema } from "mongoose" ; const RewardRecordScheme = new Schema ( { era : String , reward : String , } ) ; export const AccountingSchema = new Schema ( { stash : String , controller : String , total : String , records : [ RewardRecordScheme ] , } ) ; const FaultEventSchema = new Schema ( { when : Number , reason : String , prevRank : Number , } ) ; const RankEventSchema = new Schema ( { when : Number , startEra : Number , activeEra : Number , } ) ; export const DelayedTxSchema = new Schema ( { number : Number , controller : String , targets : [ String ] , callHash : String , } ) ; export const Identity = new Schema ( { name : String , sub : String , verified : Boolean , } ) ; export const InvalidityReason = new Schema ( { valid : Boolean , type : { type : String , enum : [ "ONLINE" , "VALIDATE_INTENTION" , "CLIENT_UPGRADE" , "CONNECTION_TIME" , "IDENTITY" , "MULTIPLE_IDENTITIES" , "ACCUMULATED_OFFLINE_TIME" , "REWARD_DESTINATION" , "COMMISION" , "SELF_STAKE" , "UNCLAIMED_REWARDS" , "BLOCKED" , "KUSAMA_RANK" , ] , default : "NEW" , } , details : { } , updated : Number , } ) ; export const CandidateSchema = new Schema ( { telemetryId : Number , networkId : String , nodeRefs : Number , name : String , telemetryDetails : [ ] , version : String , discoveredAt : { type : Number , default : 0 } , nominatedAt : { type : Number , default : 0 } , offlineSince : { type : Number , default : 0 } , offlineAccumulated : { type : Number , default : 0 } , onlineSince : { type : Number , default : 0 } , updated : { type : Boolean , default : false } , rank : { type : Number , default : 0 } , faults : { type : Number , default : 0 } , stash : String , controller : String , invalidityReasons : { type : String , default : "" } , faultEvents : { type : [ FaultEventSchema ] , default : [ ] } , rankEvents : { type : [ RankEventSchema ] , default : [ ] } , unclaimedEras : { type : [ Number ] , default : [ ] } , kusamaStash : String , bio : String , inclusion : { type : Number , default : 0.0 } , spanInclusion : { type : Number , default : 0.0 } , valid : Boolean , lastValid : Number , commission : Number , identity : Identity , active : Boolean , rewardDestination : String , queuedKeys : String , nextKeys : String , bonded : Number , skipSelfStake : Boolean , invalidity : [ InvalidityReason ] , location : String , councilStake : { type : String , default : 0 } , councilVotes : [ String ] , totalRewards : Number , avgClaimTimestampDelta : Number , avgClaimBlockDelta : Number , democracyVoteCount : { type : Number , default : 0 } , democracyVotes : [ Number ] , } ) ; export const EraSchema = new Schema ( { lastNominatedEraIndex : { type : String , default : "0" } , nextNomination : Number , when : Number , } ) ; export const NominatorSchema = new Schema ( { address : String , stash : String , proxy : String , bonded : Number , avgStake : { type : Number , default : 0 } , nominateAmount : { type : Number , default : 0 } , proxyDelay : Number , rewardDestination : String , newBondedAmount : Number , current : [ ] , lastNomination : { type : Number , default : 0 } , createdAt : { type : Number , default : 0 } , } ) ; export const NominationSchema = new Schema ( { address : String , era : Number , validators : [ String ] , timestamp : Number , bonded : Number , blockHash : String , } ) ; export const ChainMetadataSchema = new Schema ( { decimals : Number , name : String , } ) ; export const BotClaimEventSchema = new Schema ( { address : String , era : Number , timestamp : Number , blockHash : String , } ) ; export const EraPointsSchema = new Schema ( { era : Number , address : String , eraPoints : Number , } ) ; export const TotalEraPointsSchema = new Schema ( { totalEraPoints : Number , era : Number , median : Number , average : Number , max : Number , min : Number , validatorsEraPoints : [ EraPointsSchema ] , } ) ; export const EraStatsSchema = new Schema ( { when : Number , era : Number , totalNodes : Number , valid : Number , active : Number , } ) ; export const ValidatorScoreSchema = new Schema ( { updated : Number , address : String , total : Number , aggregate : Number , spanInclusion : Number , inclusion : Number , discovered : Number , nominated : Number , rank : Number , unclaimed : Number , bonded : Number , faults : Number , offline : Number , location : Number , councilStake : Number , democracy : Number , randomness : Number , } ) ; export const ValidatorScoreMetadataSchema = new Schema ( { bondedStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , bondedWeight : Number , faultsStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , faultWeight : Number , inclusionStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , inclusionWeight : Number , spanInclusionStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , spanInclusionWeight : Number , discoveredAtStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , discoveredAtWeight : Number , nominatedAtStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , nominatedAtWeight : Number , offlineStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , offlineWeight : Number , rankStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , rankWeight : Number , unclaimedStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , unclaimedWeight : Number , locationStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , locationWeight : Number , councilStakeWeight : Number , councilStakeStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , democracyStats : { values : [ Number ] , absoluteMin : Number , absoluteMax : Number , q10 : Number , q25 : Number , q50 : Number , q75 : Number , q90 : Number , mean : Number , standardDeviation : Number , } , democracyWeight : Number , updated : Number , } ) ; export const ReleaseSchema = new Schema ( { name : String , publishedAt : Number , } ) ; export const LocationStatsSchema = new Schema ( { session : Number , locations : [ { name : String , numberOfNodes : Number , } , ] , updated : Number , } ) ; export const CouncillorSchema = new Schema ( { address : String , status : { type : String , enum : [ "Candidate" , "Member" , "Runner Up" ] , default : "None" , } , backing : Number , updated : Number , } ) ; export const ElectionStatsSchema = new Schema ( { termDuration : Number , candidacyBond : Number , totalMembers : Number , totalRunnersUp : Number , totalCandidates : Number , totalVoters : Number , totalBonded : Number , updated : Number , session : Number , } ) ; export const EraPaidEventSchema = new Schema ( { era : Number , blockNumber : Number , blockTimestamp : Number , eventIndex : String , moduleId : String , eventId : String , totalValidatorReward : Number , totalRemainderReward : Number , updated : Number , } ) ; export const EraRewardSchema = new Schema ( { era : Number , stash : String , rewardDestination : String , validatorStash : String , amount : Number , blockTimestamp : Number , blockNumber : Number , slashKTon : Number , claimTimestampDelta : Number , claimBlockDelta : Number , updated : Number , } ) ; export const ReferendumSchema = new Schema ( { referendumIndex : Number , proposedAt : Number , proposalEnd : Number , proposalDelay : Number , threshold : String , deposit : Number , proposer : String , imageHash : String , voteCount : Number , voteCountAye : Number , voteCountNay : Number , voteAyeAmount : Number , voteNayAmount : Number , voteTotalAmount : Number , isPassing : Boolean , updatedTimestamp : Number , updatedBlockNumber : Number , updatedBlockHash : Number , } ) ; export const ReferendumVoteSchema = new Schema ( { referendumIndex : Number , accountId : String , isDelegating : Boolean , balance : Number , voteDirection : String , conviction : String , updatedTimestamp : Number , updatedBlockNumber : Number , updatedBlockHash : String , } ) ;