import { JsonRpcSuccessResponse } from "@cosmjs/json-rpc"; import { SubscriptionEvent } from "../../rpcclients"; import * as responses from "../responses"; export interface RpcProofOp { readonly type: string; /** base64 encoded */ readonly key: string; /** base64 encoded */ readonly data: string; } export interface RpcQueryProof { readonly ops: readonly RpcProofOp[]; } /** * EventAttribute from Tendermint. In 0.35 the type of key and value was changed * from bytes to string, such that no base64 encoding is used anymore. */ interface RpcEventAttribute { readonly key: string; readonly value?: string; } interface RpcEvent { readonly type: string; /** Can be omitted (see https://github.com/cosmos/cosmjs/pull/1198) */ readonly attributes?: readonly RpcEventAttribute[]; } export declare function decodeEvent(event: RpcEvent): responses.Event; interface RpcTxData { readonly codespace?: string; readonly code?: number; readonly log?: string; /** base64 encoded */ readonly data?: string; readonly events?: readonly RpcEvent[]; readonly gas_wanted?: string; readonly gas_used?: string; } type RpcPubkey = { readonly type: string; /** base64 encoded */ readonly value: string; } | { readonly Sum: { readonly type: string; readonly value: { /** base64 encoded */ [algorithm: string]: string; }; }; }; interface RpcBlockParams { readonly max_bytes: string; readonly max_gas: string; } interface RpcEvidenceParams { readonly max_age_num_blocks: string; readonly max_age_duration: string; } /** * Example data: * { * "block": { * "max_bytes": "22020096", * "max_gas": "-1", * "time_iota_ms": "1000" * }, * "evidence": { * "max_age_num_blocks": "100000", * "max_age_duration": "172800000000000" * }, * "validator": { * "pub_key_types": [ * "ed25519" * ] * } * } */ interface RpcConsensusParams { readonly block?: RpcBlockParams; readonly evidence?: RpcEvidenceParams; } /** * Validator update for block results. * The type is coming from ABCI. * * @see https://github.com/cometbft/cometbft/blob/v1.0.1/proto/cometbft/abci/v1/types.proto#L518-L525 */ interface RpcValidatorUpdate { readonly pub_key_bytes: string; readonly pub_key_type: string; readonly power?: string; } export declare function decodeValidatorUpdate(data: RpcValidatorUpdate): responses.ValidatorUpdate; interface RpcBlockResultsResponse { readonly height: string; readonly txs_results: readonly RpcTxData[] | null; readonly finalize_block_events: readonly RpcEvent[] | null; readonly validator_updates: readonly RpcValidatorUpdate[] | null; readonly consensus_param_updates: RpcConsensusParams | null; } export declare function decodeBlockResults(data: RpcBlockResultsResponse): responses.BlockResultsResponse; interface RpcBlockId { /** hex encoded */ readonly hash: string; readonly parts: { readonly total: number; /** hex encoded */ readonly hash: string; }; } type RpcSignature = { readonly block_id_flag: number; /** hex encoded */ readonly validator_address: string; readonly timestamp: string; /** * Base64 encoded signature. * There are cases when this is not set, see https://github.com/cosmos/cosmjs/issues/704#issuecomment-797122415. */ readonly signature: string | null; }; interface RpcCommit { readonly block_id: RpcBlockId; readonly height: string; readonly round: string | number; readonly signatures: readonly RpcSignature[] | null; } export declare function decodeCommit(data: RpcCommit): responses.Commit; interface RpcValidatorGenesis { /** hex-encoded */ readonly address: string; readonly pub_key: RpcPubkey; readonly power: string; readonly name: string; } export declare function decodeValidatorGenesis(data: RpcValidatorGenesis): responses.GenesisValidator; interface RpcValidatorInfo { /** hex encoded */ readonly address: string; readonly pub_key: RpcPubkey; readonly voting_power: string; readonly proposer_priority?: string; } export declare function decodeValidatorInfo(data: RpcValidatorInfo): responses.Validator; export declare class Responses { static decodeAbciInfo(response: JsonRpcSuccessResponse): responses.AbciInfoResponse; static decodeAbciQuery(response: JsonRpcSuccessResponse): responses.AbciQueryResponse; static decodeBlock(response: JsonRpcSuccessResponse): responses.BlockResponse; static decodeBlockResults(response: JsonRpcSuccessResponse): responses.BlockResultsResponse; static decodeBlockSearch(response: JsonRpcSuccessResponse): responses.BlockSearchResponse; static decodeBlockchain(response: JsonRpcSuccessResponse): responses.BlockchainResponse; static decodeBroadcastTxSync(response: JsonRpcSuccessResponse): responses.BroadcastTxSyncResponse; static decodeBroadcastTxAsync(response: JsonRpcSuccessResponse): responses.BroadcastTxAsyncResponse; static decodeBroadcastTxCommit(response: JsonRpcSuccessResponse): responses.BroadcastTxCommitResponse; static decodeCommit(response: JsonRpcSuccessResponse): responses.CommitResponse; static decodeGenesis(response: JsonRpcSuccessResponse): responses.GenesisResponse; static decodeHealth(): responses.HealthResponse; static decodeNumUnconfirmedTxs(response: JsonRpcSuccessResponse): responses.NumUnconfirmedTxsResponse; static decodeStatus(response: JsonRpcSuccessResponse): responses.StatusResponse; static decodeNewBlockEvent(event: SubscriptionEvent): responses.NewBlockEvent; static decodeNewBlockHeaderEvent(event: SubscriptionEvent): responses.NewBlockHeaderEvent; static decodeTxEvent(event: SubscriptionEvent): responses.TxEvent; static decodeTx(response: JsonRpcSuccessResponse): responses.TxResponse; static decodeTxSearch(response: JsonRpcSuccessResponse): responses.TxSearchResponse; static decodeValidators(response: JsonRpcSuccessResponse): responses.ValidatorsResponse; } export {};