All files / src/types debug.ts

66.66% Statements 8/12
42.85% Branches 3/7
100% Functions 2/2
66.66% Lines 8/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274                                                                                                                                                                                                                                                                33x 33x 33x 33x 33x     33x 2x   2x                                                                                                                                                                                                                                                                              
import { BZZ, DAI } from '../utils/tokens'
import { EthAddress, PeerAddress, PublicKey, TransactionId } from '../utils/typed-bytes'
import { NumberString } from './index'
 
export interface Settlements {
  peer: string
  received: BZZ
  sent: BZZ
}
 
export interface AllSettlements {
  totalReceived: BZZ
  totalSent: BZZ
  settlements: Settlements[]
}
 
export interface NodeAddresses {
  overlay: PeerAddress
  underlay: string[]
  ethereum: EthAddress
  publicKey: PublicKey
  pssPublicKey: PublicKey
}
 
export interface Peer {
  address: string
  fullNode?: boolean
}
 
export interface ChequebookAddressResponse {
  chequebookAddress: string
}
 
export interface ChequebookBalanceResponse {
  totalBalance: BZZ
  availableBalance: BZZ
}
 
export interface TransactionOptions {
  /**
   * Gas price for the cashout transaction in WEI
   */
  gasPrice?: NumberString | string | bigint
 
  /**
   * Gas limit for the cashout transaction in WEI
   */
  gasLimit?: NumberString | string | bigint
}
 
export interface CashoutResult {
  recipient: string
  lastPayout: BZZ
  bounced: boolean
}
 
export interface LastCashoutActionResponse {
  peer: string
  uncashedAmount: BZZ
  transactionHash: string | null
  lastCashedCheque: Cheque | null
  result: CashoutResult | null
}
 
export interface TransactionResponse {
  transactionHash: TransactionId
}
 
export interface Cheque {
  beneficiary: EthAddress
  chequebook: EthAddress
  payout: BZZ
}
 
export interface LastChequesForPeerResponse {
  peer: string
  lastreceived: Cheque | null
  lastsent: Cheque | null
}
 
export interface LastChequesResponse {
  lastcheques: LastChequesForPeerResponse[]
}
 
export interface PeerBalance {
  peer: string
  balance: BZZ
}
 
export interface BalanceResponse {
  balances: PeerBalance[]
}
 
export interface DebugStatus {
  overlay: string
  proximity: number
  beeMode: BeeModes
  reserveSize: number
  reserveSizeWithinRadius: number
  pullsyncRate: number
  storageRadius: number
  connectedPeers: number
  neighborhoodSize: number
  batchCommitment: number
  isReachable: boolean
  lastSyncedBlock: number
  committedDepth: number
}
 
export interface Health {
  status: 'ok'
  version: string
  apiVersion: string
}
 
export interface Readiness {
  status: 'ready' | string
  version: string
  apiVersion: string
}
 
export interface BeeVersions {
  supportedBeeVersion: string
  supportedBeeApiVersion: string
  beeVersion: string
  beeApiVersion: string
}
 
export enum BeeModes {
  FULL = 'full',
  LIGHT = 'light',
  ULTRA_LIGHT = 'ultra-light',
  DEV = 'dev',
}
 
export function toBeeMode(value: string) {
  switch (value) {
    case 'full':
      return BeeModes.FULL
    case 'light':
      return BeeModes.LIGHT
    case 'ultra-light':
      return BeeModes.ULTRA_LIGHT
    case 'dev':
      return BeeModes.DEV
    default:
      throw new Error(`Unknown Bee mode: ${value}`)
  }
}
 
export interface RedistributionState {
  minimumGasFunds: DAI
  hasSufficientFunds: boolean
  isFrozen: boolean
  isFullySynced: boolean
  phase: string
  round: number
  lastWonRound: number
  lastPlayedRound: number
  lastFrozenRound: number
  lastSelectedRound: number
  lastSampleDurationSeconds: number
  block: number
  reward: BZZ
  fees: DAI
  isHealthy: boolean
}
 
/**
 * Information about Bee node and its configuration
 */
export interface NodeInfo {
  /**
   * Indicates in what mode Bee is running.
   */
  beeMode: BeeModes
 
  /**
   * Indicates whether the Bee node has its own deployed chequebook.
   *
   * @see [Bee docs - Chequebook](https://docs.ethswarm.org/docs/references/glossary/#cheques--chequebook)
   */
  chequebookEnabled: boolean
 
  /**
   * Indicates whether SWAP is enabled for the Bee node.
   *
   * @see [Bee docs - SWAP](https://docs.ethswarm.org/docs/references/glossary/#swap)
   */
  swapEnabled: boolean
}
 
export interface RemovePeerResponse {
  message: string
  code: 0
}
 
export interface Bin {
  population: number
  connected: number
  disconnectedPeers: Peer[]
  connectedPeers: Peer[]
}
 
export interface Topology {
  baseAddr: string
  population: number
  connected: number
  timestamp: string
  nnLowWatermark: number
  depth: number
  reachability: string
  networkAvailability: string
  bins: {
    bin_0: Bin
    bin_1: Bin
    bin_2: Bin
    bin_3: Bin
    bin_4: Bin
    bin_5: Bin
    bin_6: Bin
    bin_7: Bin
    bin_8: Bin
    bin_9: Bin
    bin_10: Bin
    bin_11: Bin
    bin_12: Bin
    bin_13: Bin
    bin_14: Bin
    bin_15: Bin
    bin_16: Bin
    bin_17: Bin
    bin_18: Bin
    bin_19: Bin
    bin_20: Bin
    bin_21: Bin
    bin_22: Bin
    bin_23: Bin
    bin_24: Bin
    bin_25: Bin
    bin_26: Bin
    bin_27: Bin
    bin_28: Bin
    bin_29: Bin
    bin_30: Bin
    bin_31: Bin
  }
}
 
export interface PingResponse {
  rtt: string
}
 
export interface ReserveState {
  radius: number
  storageRadius: number
  commitment: number
}
 
export interface ChainState {
  chainTip: number
  block: number
  totalAmount: NumberString
  currentPrice: number
}
 
export interface WalletBalance {
  bzzBalance: BZZ
  nativeTokenBalance: DAI
  chainID: number
  chequebookContractAddress: string
  walletAddress: string
}