github.com/cryptohub-digital/blockbook-fork@v0.0.0-20230713133354-673c927af7f1/server/ws_types.go (about) 1 package server 2 3 import "encoding/json" 4 5 type WsReq struct { 6 ID string `json:"id"` 7 Method string `json:"method" ts_type:"'getAccountInfo' | 'getInfo' | 'getBlockHash'| 'getBlock' | 'getAccountUtxo' | 'getBalanceHistory' | 'getTransaction' | 'getTransactionSpecific' | 'estimateFee' | 'sendTransaction' | 'subscribeNewBlock' | 'unsubscribeNewBlock' | 'subscribeNewTransaction' | 'unsubscribeNewTransaction' | 'subscribeAddresses' | 'unsubscribeAddresses' | 'subscribeFiatRates' | 'unsubscribeFiatRates' | 'ping' | 'getCurrentFiatRates' | 'getFiatRatesForTimestamps' | 'getFiatRatesTickersList' | 'getMempoolFilters'"` 8 Params json.RawMessage `json:"params" ts_type:"any"` 9 } 10 11 type WsRes struct { 12 ID string `json:"id"` 13 Data interface{} `json:"data"` 14 } 15 16 type WsAccountInfoReq struct { 17 Descriptor string `json:"descriptor"` 18 Details string `json:"details,omitempty" ts_type:"'basic' | 'tokens' | 'tokenBalances' | 'txids' | 'txslight' | 'txs'"` 19 Tokens string `json:"tokens,omitempty" ts_type:"'derived' | 'used' | 'nonzero'"` 20 PageSize int `json:"pageSize,omitempty"` 21 Page int `json:"page,omitempty"` 22 FromHeight int `json:"from,omitempty"` 23 ToHeight int `json:"to,omitempty"` 24 ContractFilter string `json:"contractFilter,omitempty"` 25 SecondaryCurrency string `json:"secondaryCurrency,omitempty"` 26 Gap int `json:"gap,omitempty"` 27 } 28 29 type WsBackendInfo struct { 30 Version string `json:"version,omitempty"` 31 Subversion string `json:"subversion,omitempty"` 32 ConsensusVersion string `json:"consensus_version,omitempty"` 33 Consensus interface{} `json:"consensus,omitempty"` 34 } 35 36 type WsInfoRes struct { 37 Name string `json:"name"` 38 Shortcut string `json:"shortcut"` 39 Decimals int `json:"decimals"` 40 Version string `json:"version"` 41 BestHeight int `json:"bestHeight"` 42 BestHash string `json:"bestHash"` 43 Block0Hash string `json:"block0Hash"` 44 Testnet bool `json:"testnet"` 45 Backend WsBackendInfo `json:"backend"` 46 } 47 48 type WsBlockHashReq struct { 49 Height int `json:"height"` 50 } 51 52 type WsBlockHashRes struct { 53 Hash string `json:"hash"` 54 } 55 56 type WsBlockReq struct { 57 Id string `json:"id"` 58 PageSize int `json:"pageSize,omitempty"` 59 Page int `json:"page,omitempty"` 60 } 61 62 type WsAccountUtxoReq struct { 63 Descriptor string `json:"descriptor"` 64 } 65 66 type WsBalanceHistoryReq struct { 67 Descriptor string `json:"descriptor"` 68 From int64 `json:"from,omitempty"` 69 To int64 `json:"to,omitempty"` 70 Currencies []string `json:"currencies,omitempty"` 71 Gap int `json:"gap,omitempty"` 72 GroupBy uint32 `json:"groupBy,omitempty"` 73 } 74 75 type WsTransactionReq struct { 76 Txid string `json:"txid"` 77 } 78 79 type WsMempoolFiltersReq struct { 80 ScriptType string `json:"scriptType"` 81 FromTimestamp uint32 `json:"fromTimestamp"` 82 } 83 84 type WsTransactionSpecificReq struct { 85 Txid string `json:"txid"` 86 } 87 88 type WsEstimateFeeReq struct { 89 Blocks []int `json:"blocks,omitempty"` 90 Specific map[string]interface{} `json:"specific,omitempty" ts_type:"{conservative?: boolean;txsize?: number;from?: string;to?: string;data?: string;value?: string;}"` 91 } 92 93 type WsEstimateFeeRes struct { 94 FeePerTx string `json:"feePerTx,omitempty"` 95 FeePerUnit string `json:"feePerUnit,omitempty"` 96 FeeLimit string `json:"feeLimit,omitempty"` 97 } 98 99 type WsSendTransactionReq struct { 100 Hex string `json:"hex"` 101 } 102 103 type WsSubscribeAddressesReq struct { 104 Addresses []string `json:"addresses"` 105 } 106 type WsSubscribeFiatRatesReq struct { 107 Currency string `json:"currency,omitempty"` 108 Tokens []string `json:"tokens,omitempty"` 109 } 110 111 type WsCurrentFiatRatesReq struct { 112 Currencies []string `json:"currencies,omitempty"` 113 Token string `json:"token,omitempty"` 114 } 115 116 type WsFiatRatesForTimestampsReq struct { 117 Timestamps []int64 `json:"timestamps"` 118 Currencies []string `json:"currencies,omitempty"` 119 Token string `json:"token,omitempty"` 120 } 121 122 type WsFiatRatesTickersListReq struct { 123 Timestamp int64 `json:"timestamp,omitempty"` 124 Token string `json:"token,omitempty"` 125 }