// package: ocap
// file: type.proto

import * as google_protobuf_timestamp_pb from "google-protobuf/google/protobuf/timestamp_pb";
import * as google_protobuf_any_pb from "google-protobuf/google/protobuf/any_pb";
import * as vendor_pb from "./vendor_pb";
import * as enum_pb from "./enum_pb";

export type TBigUint = {
  value: Uint8Array | string,
}

export type TBigSint = {
  value: Uint8Array | string,
  minus: boolean,
}

export type TTokenSymbol = {
  address: string,
  symbol: string,
  decimal: number,
  unit: string,
}

export type TTokenInfo = {
  address: string,
  symbol: string,
  decimal: number,
  unit: string,
  name: string,
  description: string,
  icon: string,
  maxTotalSupply: string,
  metadata?: google_protobuf_any_pb.Any,
  website: string,
  spenders: Array<string>,
  minters: Array<string>,
  type: string,
}

export type TWalletType = {
  pk: enum_pb.KeyTypeMap[keyof enum_pb.KeyTypeMap],
  hash: enum_pb.HashTypeMap[keyof enum_pb.HashTypeMap],
  address: enum_pb.EncodingTypeMap[keyof enum_pb.EncodingTypeMap],
  role: enum_pb.RoleTypeMap[keyof enum_pb.RoleTypeMap],
}

export type TWalletInfo = {
  type?: TWalletType,
  sk: Uint8Array | string,
  pk: Uint8Array | string,
  address: string,
}

export type TChainInfo = {
  id: string,
  network: string,
  moniker: string,
  consensusVersion: string,
  synced: boolean,
  appHash: Uint8Array | string,
  blockHash: Uint8Array | string,
  blockHeight: string,
  blockTime?: google_protobuf_timestamp_pb.Timestamp,
  address: string,
  votingPower: string,
  totalTxs: string,
  version: string,
  forgeAppsVersionMap: Array<[string, string]>,
  supportedTxs: Array<string>,
}

export type TNodeInfo = {
  id: string,
  network: string,
  moniker: string,
  consensusVersion: string,
  synced: boolean,
  appHash: Uint8Array | string,
  blockHash: Uint8Array | string,
  blockHeight: string,
  blockTime?: google_protobuf_timestamp_pb.Timestamp,
  address: string,
  votingPower: string,
  totalTxs: string,
  version: string,
  forgeAppsVersionMap: Array<[string, string]>,
  supportedTxs: Array<string>,
  ip: string,
  geoInfo?: TGeoInfo,
  p2pAddress: string,
}

export type TValidator = {
  address: string,
  power: string,
}

export type TConsensusParams = {
  maxBytes: string,
  maxGas: string,
  maxValidators: number,
  maxCandidates: number,
  pubKeyTypes: Array<string>,
  validators: Array<TValidator>,
  validatorChanged: boolean,
  paramChanged: boolean,
}

export type TUpgradeTask = {
  type: enum_pb.UpgradeTypeMap[keyof enum_pb.UpgradeTypeMap],
  dataHash: string,
  actions: Array<enum_pb.UpgradeActionMap[keyof enum_pb.UpgradeActionMap]>,
}

export type TUpgradeTasks = {
  item: Array<TUpgradeTask>,
}

export type TMultisig = {
  signer: string,
  pk: Uint8Array | string,
  signature: Uint8Array | string,
  delegator: string,
  data?: google_protobuf_any_pb.Any,
}

export type TTransaction = {
  from: string,
  nonce: number,
  chainId: string,
  pk: Uint8Array | string,
  gas: number,
  delegator: string,
  signature: Uint8Array | string,
  signatures: Array<TMultisig>,
  itx?: google_protobuf_any_pb.Any,
  receipts: Array<TTransactionReceipt>,
  serviceFee: string,
}

export type TTransactionInfo = {
  tx?: TTransaction,
  height: string,
  index: number,
  hash: string,
  tags: Array<vendor_pb.TKVPair>,
  code: enum_pb.StatusCodeMap[keyof enum_pb.StatusCodeMap],
  time?: google_protobuf_timestamp_pb.Timestamp,
  receipts: Array<TTransactionReceipt>,
  sender: string,
  receiver: string,
  tokenSymbols: Array<TTokenSymbol>,
}

export type TTransactionReceipt = {
  address: string,
  changes: Array<TReceiptChange>,
}

export type TReceiptChange = {
  target: string,
  action: string,
  value: string,
}

export type TTokenInput = {
  address: string,
  value: string,
}

export type TTransactionInput = {
  owner: string,
  tokens: Array<TTokenInput>,
  assets: Array<string>,
}

export type TVariableInput = {
  name: string,
  value: string,
  description: string,
  required: boolean,
}

export type TDelegateConfig = {
  deltaInterval: number,
  typeUrls: Array<string>,
}

export type TVaultConfig = {
  slashedStake: string,
  txFee: string,
  txGas: Array<string>,
}

export type TTxFeeConfig = {
  typeUrl: string,
  fee: string,
}

export type TTxGasConfig = {
  price: number,
  createState: number,
  updateState: number,
  dataStorage: number,
  minStake: string,
  maxStake: string,
  stakeLockPeriod: number,
}

export type TTxStakeConfig = {
  createToken: number,
  createTokenLockPeriod: number,
}

export type TTransactionConfig = {
  maxAssetSize: number,
  maxListSize: number,
  maxMultisig: number,
  delegate?: TDelegateConfig,
  txFee: Array<TTxFeeConfig>,
  txGas?: TTxGasConfig,
  txStake?: TTxStakeConfig,
}

export type TBlockInfo = {
  height: string,
  numTxs: number,
  time?: google_protobuf_timestamp_pb.Timestamp,
  appHash: Uint8Array | string,
  proposer: Uint8Array | string,
  txs: Array<TTransactionInfo>,
  totalTxs: string,
  invalidTxs: Array<TTransactionInfo>,
  txsHashes: Array<string>,
  invalidTxsHashes: Array<string>,
  consensusHash: Uint8Array | string,
  dataHash: Uint8Array | string,
  evidenceHash: Uint8Array | string,
  lastCommitHash: Uint8Array | string,
  lastResultsHash: Uint8Array | string,
  nextValidatorsHash: Uint8Array | string,
  validatorsHash: Uint8Array | string,
  version?: vendor_pb.TVersion,
  lastBlockId?: vendor_pb.TBlockID,
}

export type TBlockInfoSimple = {
  height: string,
  numTxs: number,
  time?: google_protobuf_timestamp_pb.Timestamp,
  appHash: Uint8Array | string,
  proposer: Uint8Array | string,
  totalTxs: string,
  txsHashes: Array<string>,
  invalidTxsHashes: Array<string>,
  consensusHash: Uint8Array | string,
  dataHash: Uint8Array | string,
  evidenceHash: Uint8Array | string,
  lastCommitHash: Uint8Array | string,
  lastResultsHash: Uint8Array | string,
  nextValidatorsHash: Uint8Array | string,
  validatorsHash: Uint8Array | string,
  version?: vendor_pb.TVersion,
  lastBlockId?: vendor_pb.TBlockID,
}

export type TStateContext = {
  genesisTx: string,
  renaissanceTx: string,
  genesisTime?: google_protobuf_timestamp_pb.Timestamp,
  renaissanceTime?: google_protobuf_timestamp_pb.Timestamp,
}

export type TStakeSummary = {
  totalStakes?: TBigUint,
  totalUnstakes?: TBigUint,
  context?: TStateContext,
}

export type TUnconfirmedTxs = {
  nTxs: number,
  txs: Array<TTransaction>,
}

export type TNetInfo = {
  listening: boolean,
  listeners: Array<string>,
  nPeers: number,
  peers: Array<TPeerInfo>,
}

export type TGeoInfo = {
  city: string,
  country: string,
  latitude: number,
  longitude: number,
}

export type TPeerInfo = {
  id: string,
  network: string,
  consensusVersion: string,
  moniker: string,
  ip: string,
  geoInfo?: TGeoInfo,
}

export type TValidatorsInfo = {
  blockHeight: string,
  validators: Array<TValidatorInfo>,
}

export type TValidatorInfo = {
  address: string,
  pubKey?: vendor_pb.TPubKey,
  votingPower: string,
  proposerPriority: string,
  name: string,
  geoInfo?: TGeoInfo,
}

export type TForgeToken = {
  name: string,
  symbol: string,
  unit: string,
  description: string,
  icon: Uint8Array | string,
  decimal: number,
  initialSupply: string,
  totalSupply: string,
  inflationRate: number,
  address: string,
}

export type TUpgradeInfo = {
  height: string,
  version: string,
}

export type TWithdrawItem = {
  hash: string,
  value?: TBigUint,
}

export type TAccountConfig = {
  address: string,
  pk: Uint8Array | string,
  balance?: TBigUint,
}

export type TEvidence = {
  hash: string,
}

export type TNFTEndpoint = {
  id: string,
  scope: string,
}

export type TNFTDisplay = {
  type: string,
  content: string,
}

export type TNFTIssuer = {
  id: string,
  pk: string,
  name: string,
}

export type TAssetFactoryHook = {
  name: string,
  type: string,
  hook: string,
}

export type TIndexedTokenInput = {
  address: string,
  value: string,
  decimal: number,
  unit: string,
  symbol: string,
}

export type TIndexedFactoryInput = {
  value: string,
  tokens: Array<TIndexedTokenInput>,
  assets: Array<string>,
  variables: Array<TVariableInput>,
}

export type TRollupValidator = {
  pk: string,
  address: string,
  endpoint: string,
}

export type TRollupSignature = {
  signer: string,
  signature: string,
}

export type TForeignToken = {
  type: string,
  contractAddress: string,
  chainType: string,
  chainName: string,
  chainId: number,
}

export type TRevokedStake = {
  tokens: Array<TTokenInput>,
  assets: Array<string>,
}

export type TForgeStats = {
  numBlocks: Array<string>,
  numTxs: Array<string>,
  numStakes: Array<TBigUint>,
  numValidators: Array<number>,
  numAccountMigrateTxs: Array<string>,
  numCreateAssetTxs: Array<string>,
  numConsensusUpgradeTxs: Array<number>,
  numDeclareTxs: Array<string>,
  numDeclareFileTxs: Array<string>,
  numExchangeTxs: Array<string>,
  numStakeTxs: Array<string>,
  numSysUpgradeTxs: Array<number>,
  numTransferTxs: Array<string>,
  numUpdateAssetTxs: Array<string>,
  numConsumeAssetTxs: Array<string>,
  tps: Array<number>,
  maxTps: number,
  avgTps: number,
  avgBlockTime: number,
}

export type TGasEstimate = {
  max: string,
}

export type TRateLimit = {
  interval: number,
  anchor: number,
}

export type TTokenLimit = {
  address: string,
  to: Array<string>,
  txCount: number,
  txAllowance: string,
  totalAllowance: string,
  validUntil: number,
  rate?: TRateLimit,
  txSent: number,
  spentAllowance: string,
  lastTx: number,
  decimal: number,
  symbol: string,
}

export type TAssetLimit = {
  address: Array<string>,
  to: Array<string>,
  txCount: number,
  validUntil: number,
  rate?: TRateLimit,
  txSent: number,
  lastTx: number,
}

export type TDelegateLimit = {
  tokens: Array<TTokenLimit>,
  assets: Array<TAssetLimit>,
}

export type TCurveConfig = {
  type: string,
  basePrice: string,
  slope: string,
  fixedPrice: string,
  constant: number,
}
