github.com/trezor/blockbook@v0.4.1-0.20240328132726-e9a08582ee2c/blockbook-api.ts (about)

     1  /* Do not change, this code is generated from Golang structs */
     2  
     3  export interface APIError {
     4      Text: string;
     5      Public: boolean;
     6  }
     7  export interface AddressAlias {
     8      Type: string;
     9      Alias: string;
    10  }
    11  export interface EthereumInternalTransfer {
    12      type: number;
    13      from: string;
    14      to: string;
    15      value: string;
    16  }
    17  export interface EthereumParsedInputParam {
    18      type: string;
    19      values?: string[];
    20  }
    21  export interface EthereumParsedInputData {
    22      methodId: string;
    23      name: string;
    24      function?: string;
    25      params?: EthereumParsedInputParam[];
    26  }
    27  export interface EthereumSpecific {
    28      type?: number;
    29      createdContract?: string;
    30      status: number;
    31      error?: string;
    32      nonce: number;
    33      gasLimit: number;
    34      gasUsed?: number;
    35      gasPrice?: string;
    36      data?: string;
    37      parsedData?: EthereumParsedInputData;
    38      internalTransfers?: EthereumInternalTransfer[];
    39  }
    40  export interface MultiTokenValue {
    41      id?: string;
    42      value?: string;
    43  }
    44  export interface TokenTransfer {
    45      type: string;
    46      from: string;
    47      to: string;
    48      contract: string;
    49      name: string;
    50      symbol: string;
    51      decimals: number;
    52      value?: string;
    53      multiTokenValues?: MultiTokenValue[];
    54  }
    55  export interface Vout {
    56      value?: string;
    57      n: number;
    58      spent?: boolean;
    59      spentTxId?: string;
    60      spentIndex?: number;
    61      spentHeight?: number;
    62      hex?: string;
    63      asm?: string;
    64      addresses: string[];
    65      isAddress: boolean;
    66      isOwn?: boolean;
    67      type?: string;
    68  }
    69  export interface Vin {
    70      txid?: string;
    71      vout?: number;
    72      sequence?: number;
    73      n: number;
    74      addresses?: string[];
    75      isAddress: boolean;
    76      isOwn?: boolean;
    77      value?: string;
    78      hex?: string;
    79      asm?: string;
    80      coinbase?: string;
    81  }
    82  export interface Tx {
    83      txid: string;
    84      version?: number;
    85      lockTime?: number;
    86      vin: Vin[];
    87      vout: Vout[];
    88      blockHash?: string;
    89      blockHeight: number;
    90      confirmations: number;
    91      confirmationETABlocks?: number;
    92      confirmationETASeconds?: number;
    93      blockTime: number;
    94      size?: number;
    95      vsize?: number;
    96      value: string;
    97      valueIn?: string;
    98      fees?: string;
    99      hex?: string;
   100      rbf?: boolean;
   101      coinSpecificData?: any;
   102      tokenTransfers?: TokenTransfer[];
   103      ethereumSpecific?: EthereumSpecific;
   104      addressAliases?: { [key: string]: AddressAlias };
   105  }
   106  export interface FeeStats {
   107      txCount: number;
   108      totalFeesSat: string;
   109      averageFeePerKb: number;
   110      decilesFeePerKb: number[];
   111  }
   112  export interface StakingPool {
   113      contract: string;
   114      pendingBalance: string;
   115      pendingDepositedBalance: string;
   116      depositedBalance: string;
   117      withdrawTotalAmount: string;
   118      claimableAmount: string;
   119      restakedReward: string;
   120      autocompoundBalance: string;
   121  }
   122  export interface ContractInfo {
   123      type: string;
   124      contract: string;
   125      name: string;
   126      symbol: string;
   127      decimals: number;
   128      createdInBlock?: number;
   129      destructedInBlock?: number;
   130  }
   131  export interface Token {
   132      type: 'XPUBAddress' | 'ERC20' | 'ERC721' | 'ERC1155';
   133      name: string;
   134      path?: string;
   135      contract?: string;
   136      transfers: number;
   137      symbol?: string;
   138      decimals?: number;
   139      balance?: string;
   140      baseValue?: number;
   141      secondaryValue?: number;
   142      ids?: string[];
   143      multiTokenValues?: MultiTokenValue[];
   144      totalReceived?: string;
   145      totalSent?: string;
   146  }
   147  export interface Address {
   148      page?: number;
   149      totalPages?: number;
   150      itemsOnPage?: number;
   151      address: string;
   152      balance: string;
   153      totalReceived?: string;
   154      totalSent?: string;
   155      unconfirmedBalance: string;
   156      unconfirmedTxs: number;
   157      txs: number;
   158      addrTxCount?: number;
   159      nonTokenTxs?: number;
   160      internalTxs?: number;
   161      transactions?: Tx[];
   162      txids?: string[];
   163      nonce?: string;
   164      usedTokens?: number;
   165      tokens?: Token[];
   166      secondaryValue?: number;
   167      tokensBaseValue?: number;
   168      tokensSecondaryValue?: number;
   169      totalBaseValue?: number;
   170      totalSecondaryValue?: number;
   171      contractInfo?: ContractInfo;
   172      erc20Contract?: ContractInfo;
   173      addressAliases?: { [key: string]: AddressAlias };
   174      stakingPools?: StakingPool[];
   175  }
   176  export interface Utxo {
   177      txid: string;
   178      vout: number;
   179      value: string;
   180      height?: number;
   181      confirmations: number;
   182      address?: string;
   183      path?: string;
   184      lockTime?: number;
   185      coinbase?: boolean;
   186  }
   187  export interface BalanceHistory {
   188      time: number;
   189      txs: number;
   190      received: string;
   191      sent: string;
   192      sentToSelf: string;
   193      rates?: { [key: string]: number };
   194      txid?: string;
   195  }
   196  export interface BlockInfo {
   197      Hash: string;
   198      Time: number;
   199      Txs: number;
   200      Size: number;
   201      Height: number;
   202  }
   203  export interface Blocks {
   204      page?: number;
   205      totalPages?: number;
   206      itemsOnPage?: number;
   207      blocks: BlockInfo[];
   208  }
   209  export interface Block {
   210      page?: number;
   211      totalPages?: number;
   212      itemsOnPage?: number;
   213      hash: string;
   214      previousBlockHash?: string;
   215      nextBlockHash?: string;
   216      height: number;
   217      confirmations: number;
   218      size: number;
   219      time?: number;
   220      version: string;
   221      merkleRoot: string;
   222      nonce: string;
   223      bits: string;
   224      difficulty: string;
   225      tx?: string[];
   226      txCount: number;
   227      txs?: Tx[];
   228      addressAliases?: { [key: string]: AddressAlias };
   229  }
   230  export interface BlockRaw {
   231      hex: string;
   232  }
   233  export interface BackendInfo {
   234      error?: string;
   235      chain?: string;
   236      blocks?: number;
   237      headers?: number;
   238      bestBlockHash?: string;
   239      difficulty?: string;
   240      sizeOnDisk?: number;
   241      version?: string;
   242      subversion?: string;
   243      protocolVersion?: string;
   244      timeOffset?: number;
   245      warnings?: string;
   246      consensus_version?: string;
   247      consensus?: any;
   248  }
   249  export interface InternalStateColumn {
   250      name: string;
   251      version: number;
   252      rows: number;
   253      keyBytes: number;
   254      valueBytes: number;
   255      updated: string;
   256  }
   257  export interface BlockbookInfo {
   258      coin: string;
   259      host: string;
   260      version: string;
   261      gitCommit: string;
   262      buildTime: string;
   263      syncMode: boolean;
   264      initialSync: boolean;
   265      inSync: boolean;
   266      bestHeight: number;
   267      lastBlockTime: string;
   268      inSyncMempool: boolean;
   269      lastMempoolTime: string;
   270      mempoolSize: number;
   271      decimals: number;
   272      dbSize: number;
   273      hasFiatRates?: boolean;
   274      hasTokenFiatRates?: boolean;
   275      currentFiatRatesTime?: string;
   276      historicalFiatRatesTime?: string;
   277      historicalTokenFiatRatesTime?: string;
   278      stakingPoolContracts?: string[];
   279      dbSizeFromColumns?: number;
   280      dbColumns?: InternalStateColumn[];
   281      about: string;
   282  }
   283  export interface SystemInfo {
   284      blockbook: BlockbookInfo;
   285      backend: BackendInfo;
   286  }
   287  export interface FiatTicker {
   288      ts?: number;
   289      rates: { [key: string]: number };
   290      error?: string;
   291  }
   292  export interface FiatTickers {
   293      tickers: FiatTicker[];
   294  }
   295  export interface AvailableVsCurrencies {
   296      ts?: number;
   297      available_currencies: string[];
   298      error?: string;
   299  }
   300  export interface WsReq {
   301      id: string;
   302      method:
   303          | 'getAccountInfo'
   304          | 'getInfo'
   305          | 'getBlockHash'
   306          | 'getBlock'
   307          | 'getAccountUtxo'
   308          | 'getBalanceHistory'
   309          | 'getTransaction'
   310          | 'getTransactionSpecific'
   311          | 'estimateFee'
   312          | 'sendTransaction'
   313          | 'subscribeNewBlock'
   314          | 'unsubscribeNewBlock'
   315          | 'subscribeNewTransaction'
   316          | 'unsubscribeNewTransaction'
   317          | 'subscribeAddresses'
   318          | 'unsubscribeAddresses'
   319          | 'subscribeFiatRates'
   320          | 'unsubscribeFiatRates'
   321          | 'ping'
   322          | 'getCurrentFiatRates'
   323          | 'getFiatRatesForTimestamps'
   324          | 'getFiatRatesTickersList'
   325          | 'getMempoolFilters';
   326      params: any;
   327  }
   328  export interface WsRes {
   329      id: string;
   330      data: any;
   331  }
   332  export interface WsAccountInfoReq {
   333      descriptor: string;
   334      details?: 'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs';
   335      tokens?: 'derived' | 'used' | 'nonzero';
   336      pageSize?: number;
   337      page?: number;
   338      from?: number;
   339      to?: number;
   340      contractFilter?: string;
   341      secondaryCurrency?: string;
   342      gap?: number;
   343  }
   344  export interface WsBackendInfo {
   345      version?: string;
   346      subversion?: string;
   347      consensus_version?: string;
   348      consensus?: any;
   349  }
   350  export interface WsInfoRes {
   351      name: string;
   352      shortcut: string;
   353      decimals: number;
   354      version: string;
   355      bestHeight: number;
   356      bestHash: string;
   357      block0Hash: string;
   358      testnet: boolean;
   359      backend: WsBackendInfo;
   360  }
   361  export interface WsBlockHashReq {
   362      height: number;
   363  }
   364  export interface WsBlockHashRes {
   365      hash: string;
   366  }
   367  export interface WsBlockReq {
   368      id: string;
   369      pageSize?: number;
   370      page?: number;
   371  }
   372  export interface WsBlockFilterReq {
   373      scriptType: string;
   374      blockHash: string;
   375      M?: number;
   376  }
   377  export interface WsBlockFiltersBatchReq {
   378      scriptType: string;
   379      bestKnownBlockHash: string;
   380      pageSize?: number;
   381      M?: number;
   382  }
   383  export interface WsAccountUtxoReq {
   384      descriptor: string;
   385  }
   386  export interface WsBalanceHistoryReq {
   387      descriptor: string;
   388      from?: number;
   389      to?: number;
   390      currencies?: string[];
   391      gap?: number;
   392      groupBy?: number;
   393  }
   394  export interface WsTransactionReq {
   395      txid: string;
   396  }
   397  export interface WsTransactionSpecificReq {
   398      txid: string;
   399  }
   400  export interface WsEstimateFeeReq {
   401      blocks?: number[];
   402      specific?: {
   403          conservative?: boolean;
   404          txsize?: number;
   405          from?: string;
   406          to?: string;
   407          data?: string;
   408          value?: string;
   409      };
   410  }
   411  export interface WsEstimateFeeRes {
   412      feePerTx?: string;
   413      feePerUnit?: string;
   414      feeLimit?: string;
   415  }
   416  export interface WsSendTransactionReq {
   417      hex: string;
   418  }
   419  export interface WsSubscribeAddressesReq {
   420      addresses: string[];
   421  }
   422  export interface WsSubscribeFiatRatesReq {
   423      currency?: string;
   424      tokens?: string[];
   425  }
   426  export interface WsCurrentFiatRatesReq {
   427      currencies?: string[];
   428      token?: string;
   429  }
   430  export interface WsFiatRatesForTimestampsReq {
   431      timestamps: number[];
   432      currencies?: string[];
   433      token?: string;
   434  }
   435  export interface WsFiatRatesTickersListReq {
   436      timestamp?: number;
   437      token?: string;
   438  }
   439  export interface WsMempoolFiltersReq {
   440      scriptType: string;
   441      fromTimestamp: number;
   442      M?: number;
   443  }
   444  export interface MempoolTxidFilterEntries {
   445      entries?: { [key: string]: string };
   446      usedZeroedKey?: boolean;
   447  }