import { Tx, TxSDKType } from "./tx"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultSDKType } from "../../base/abci/v1beta1/abci"; import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../tendermint/types/block"; import * as _m0 from "protobufjs/minimal"; import { isSet, bytesFromBase64, base64FromBytes, Long } from "../../../helpers"; /** OrderBy defines the sorting order */ export enum OrderBy { /** ORDER_BY_UNSPECIFIED - ORDER_BY_UNSPECIFIED specifies an unknown sorting order. OrderBy defaults to ASC in this case. */ ORDER_BY_UNSPECIFIED = 0, /** ORDER_BY_ASC - ORDER_BY_ASC defines ascending order */ ORDER_BY_ASC = 1, /** ORDER_BY_DESC - ORDER_BY_DESC defines descending order */ ORDER_BY_DESC = 2, UNRECOGNIZED = -1, } export const OrderBySDKType = OrderBy; export function orderByFromJSON(object: any): OrderBy { switch (object) { case 0: case "ORDER_BY_UNSPECIFIED": return OrderBy.ORDER_BY_UNSPECIFIED; case 1: case "ORDER_BY_ASC": return OrderBy.ORDER_BY_ASC; case 2: case "ORDER_BY_DESC": return OrderBy.ORDER_BY_DESC; case -1: case "UNRECOGNIZED": default: return OrderBy.UNRECOGNIZED; } } export function orderByToJSON(object: OrderBy): string { switch (object) { case OrderBy.ORDER_BY_UNSPECIFIED: return "ORDER_BY_UNSPECIFIED"; case OrderBy.ORDER_BY_ASC: return "ORDER_BY_ASC"; case OrderBy.ORDER_BY_DESC: return "ORDER_BY_DESC"; case OrderBy.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** BroadcastMode specifies the broadcast mode for the TxService.Broadcast RPC method. */ export enum BroadcastMode { /** BROADCAST_MODE_UNSPECIFIED - zero-value for mode ordering */ BROADCAST_MODE_UNSPECIFIED = 0, /** * BROADCAST_MODE_BLOCK - BROADCAST_MODE_BLOCK defines a tx broadcasting mode where the client waits for * the tx to be committed in a block. */ BROADCAST_MODE_BLOCK = 1, /** * BROADCAST_MODE_SYNC - BROADCAST_MODE_SYNC defines a tx broadcasting mode where the client waits for * a CheckTx execution response only. */ BROADCAST_MODE_SYNC = 2, /** * BROADCAST_MODE_ASYNC - BROADCAST_MODE_ASYNC defines a tx broadcasting mode where the client returns * immediately. */ BROADCAST_MODE_ASYNC = 3, UNRECOGNIZED = -1, } export const BroadcastModeSDKType = BroadcastMode; export function broadcastModeFromJSON(object: any): BroadcastMode { switch (object) { case 0: case "BROADCAST_MODE_UNSPECIFIED": return BroadcastMode.BROADCAST_MODE_UNSPECIFIED; case 1: case "BROADCAST_MODE_BLOCK": return BroadcastMode.BROADCAST_MODE_BLOCK; case 2: case "BROADCAST_MODE_SYNC": return BroadcastMode.BROADCAST_MODE_SYNC; case 3: case "BROADCAST_MODE_ASYNC": return BroadcastMode.BROADCAST_MODE_ASYNC; case -1: case "UNRECOGNIZED": default: return BroadcastMode.UNRECOGNIZED; } } export function broadcastModeToJSON(object: BroadcastMode): string { switch (object) { case BroadcastMode.BROADCAST_MODE_UNSPECIFIED: return "BROADCAST_MODE_UNSPECIFIED"; case BroadcastMode.BROADCAST_MODE_BLOCK: return "BROADCAST_MODE_BLOCK"; case BroadcastMode.BROADCAST_MODE_SYNC: return "BROADCAST_MODE_SYNC"; case BroadcastMode.BROADCAST_MODE_ASYNC: return "BROADCAST_MODE_ASYNC"; case BroadcastMode.UNRECOGNIZED: default: return "UNRECOGNIZED"; } } /** * GetTxsEventRequest is the request type for the Service.TxsByEvents * RPC method. */ export interface GetTxsEventRequest { /** events is the list of transaction event type. */ events: string[]; /** pagination defines a pagination for the request. */ pagination?: PageRequest; orderBy: OrderBy; } /** * GetTxsEventRequest is the request type for the Service.TxsByEvents * RPC method. */ export interface GetTxsEventRequestSDKType { events: string[]; pagination?: PageRequestSDKType; order_by: OrderBy; } /** * GetTxsEventResponse is the response type for the Service.TxsByEvents * RPC method. */ export interface GetTxsEventResponse { /** txs is the list of queried transactions. */ txs: Tx[]; /** tx_responses is the list of queried TxResponses. */ txResponses: TxResponse[]; /** pagination defines a pagination for the response. */ pagination?: PageResponse; } /** * GetTxsEventResponse is the response type for the Service.TxsByEvents * RPC method. */ export interface GetTxsEventResponseSDKType { txs: TxSDKType[]; tx_responses: TxResponseSDKType[]; pagination?: PageResponseSDKType; } /** * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest * RPC method. */ export interface BroadcastTxRequest { /** tx_bytes is the raw transaction. */ txBytes: Uint8Array; mode: BroadcastMode; } /** * BroadcastTxRequest is the request type for the Service.BroadcastTxRequest * RPC method. */ export interface BroadcastTxRequestSDKType { tx_bytes: Uint8Array; mode: BroadcastMode; } /** * BroadcastTxResponse is the response type for the * Service.BroadcastTx method. */ export interface BroadcastTxResponse { /** tx_response is the queried TxResponses. */ txResponse?: TxResponse; } /** * BroadcastTxResponse is the response type for the * Service.BroadcastTx method. */ export interface BroadcastTxResponseSDKType { tx_response?: TxResponseSDKType; } /** * SimulateRequest is the request type for the Service.Simulate * RPC method. */ export interface SimulateRequest { /** * tx is the transaction to simulate. * Deprecated. Send raw tx bytes instead. */ /** @deprecated */ tx?: Tx; /** * tx_bytes is the raw transaction. * * Since: cosmos-sdk 0.43 */ txBytes: Uint8Array; } /** * SimulateRequest is the request type for the Service.Simulate * RPC method. */ export interface SimulateRequestSDKType { /** @deprecated */ tx?: TxSDKType; tx_bytes: Uint8Array; } /** * SimulateResponse is the response type for the * Service.SimulateRPC method. */ export interface SimulateResponse { /** gas_info is the information about gas used in the simulation. */ gasInfo?: GasInfo; /** result is the result of the simulation. */ result?: Result; } /** * SimulateResponse is the response type for the * Service.SimulateRPC method. */ export interface SimulateResponseSDKType { gas_info?: GasInfoSDKType; result?: ResultSDKType; } /** * GetTxRequest is the request type for the Service.GetTx * RPC method. */ export interface GetTxRequest { /** hash is the tx hash to query, encoded as a hex string. */ hash: string; } /** * GetTxRequest is the request type for the Service.GetTx * RPC method. */ export interface GetTxRequestSDKType { hash: string; } /** GetTxResponse is the response type for the Service.GetTx method. */ export interface GetTxResponse { /** tx is the queried transaction. */ tx?: Tx; /** tx_response is the queried TxResponses. */ txResponse?: TxResponse; } /** GetTxResponse is the response type for the Service.GetTx method. */ export interface GetTxResponseSDKType { tx?: TxSDKType; tx_response?: TxResponseSDKType; } /** * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs * RPC method. * * Since: cosmos-sdk 0.45.2 */ export interface GetBlockWithTxsRequest { /** height is the height of the block to query. */ height: Long; /** pagination defines a pagination for the request. */ pagination?: PageRequest; } /** * GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs * RPC method. * * Since: cosmos-sdk 0.45.2 */ export interface GetBlockWithTxsRequestSDKType { height: Long; pagination?: PageRequestSDKType; } /** * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. * * Since: cosmos-sdk 0.45.2 */ export interface GetBlockWithTxsResponse { /** txs are the transactions in the block. */ txs: Tx[]; blockId?: BlockID; block?: Block; /** pagination defines a pagination for the response. */ pagination?: PageResponse; } /** * GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method. * * Since: cosmos-sdk 0.45.2 */ export interface GetBlockWithTxsResponseSDKType { txs: TxSDKType[]; block_id?: BlockIDSDKType; block?: BlockSDKType; pagination?: PageResponseSDKType; } function createBaseGetTxsEventRequest(): GetTxsEventRequest { return { events: [], pagination: undefined, orderBy: 0 }; } export const GetTxsEventRequest = { encode(message: GetTxsEventRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { for (const v of message.events) { writer.uint32(10).string(v!); } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } if (message.orderBy !== 0) { writer.uint32(24).int32(message.orderBy); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxsEventRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.events.push(reader.string()); break; case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; case 3: message.orderBy = (reader.int32() as any); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): GetTxsEventRequest { return { events: Array.isArray(object?.events) ? object.events.map((e: any) => String(e)) : [], pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined, orderBy: isSet(object.orderBy) ? orderByFromJSON(object.orderBy) : 0 }; }, toJSON(message: GetTxsEventRequest): unknown { const obj: any = {}; if (message.events) { obj.events = message.events.map(e => e); } else { obj.events = []; } message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); message.orderBy !== undefined && (obj.orderBy = orderByToJSON(message.orderBy)); return obj; }, fromPartial(object: Partial): GetTxsEventRequest { const message = createBaseGetTxsEventRequest(); message.events = object.events?.map(e => e) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; message.orderBy = object.orderBy ?? 0; return message; } }; function createBaseGetTxsEventResponse(): GetTxsEventResponse { return { txs: [], txResponses: [], pagination: undefined }; } export const GetTxsEventResponse = { encode(message: GetTxsEventResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); } for (const v of message.txResponses) { TxResponse.encode(v!, writer.uint32(18).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(26).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GetTxsEventResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxsEventResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.txs.push(Tx.decode(reader, reader.uint32())); break; case 2: message.txResponses.push(TxResponse.decode(reader, reader.uint32())); break; case 3: message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): GetTxsEventResponse { return { txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], txResponses: Array.isArray(object?.txResponses) ? object.txResponses.map((e: any) => TxResponse.fromJSON(e)) : [], pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, toJSON(message: GetTxsEventResponse): unknown { const obj: any = {}; if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toJSON(e) : undefined); } else { obj.txs = []; } if (message.txResponses) { obj.txResponses = message.txResponses.map(e => e ? TxResponse.toJSON(e) : undefined); } else { obj.txResponses = []; } message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, fromPartial(object: Partial): GetTxsEventResponse { const message = createBaseGetTxsEventResponse(); message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; message.txResponses = object.txResponses?.map(e => TxResponse.fromPartial(e)) || []; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; } }; function createBaseBroadcastTxRequest(): BroadcastTxRequest { return { txBytes: new Uint8Array(), mode: 0 }; } export const BroadcastTxRequest = { encode(message: BroadcastTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.txBytes.length !== 0) { writer.uint32(10).bytes(message.txBytes); } if (message.mode !== 0) { writer.uint32(16).int32(message.mode); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBroadcastTxRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.txBytes = reader.bytes(); break; case 2: message.mode = (reader.int32() as any); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): BroadcastTxRequest { return { txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array(), mode: isSet(object.mode) ? broadcastModeFromJSON(object.mode) : 0 }; }, toJSON(message: BroadcastTxRequest): unknown { const obj: any = {}; message.txBytes !== undefined && (obj.txBytes = base64FromBytes(message.txBytes !== undefined ? message.txBytes : new Uint8Array())); message.mode !== undefined && (obj.mode = broadcastModeToJSON(message.mode)); return obj; }, fromPartial(object: Partial): BroadcastTxRequest { const message = createBaseBroadcastTxRequest(); message.txBytes = object.txBytes ?? new Uint8Array(); message.mode = object.mode ?? 0; return message; } }; function createBaseBroadcastTxResponse(): BroadcastTxResponse { return { txResponse: undefined }; } export const BroadcastTxResponse = { encode(message: BroadcastTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.txResponse !== undefined) { TxResponse.encode(message.txResponse, writer.uint32(10).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): BroadcastTxResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseBroadcastTxResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.txResponse = TxResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): BroadcastTxResponse { return { txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; }, toJSON(message: BroadcastTxResponse): unknown { const obj: any = {}; message.txResponse !== undefined && (obj.txResponse = message.txResponse ? TxResponse.toJSON(message.txResponse) : undefined); return obj; }, fromPartial(object: Partial): BroadcastTxResponse { const message = createBaseBroadcastTxResponse(); message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; return message; } }; function createBaseSimulateRequest(): SimulateRequest { return { tx: undefined, txBytes: new Uint8Array() }; } export const SimulateRequest = { encode(message: SimulateRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); } if (message.txBytes.length !== 0) { writer.uint32(18).bytes(message.txBytes); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SimulateRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSimulateRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.tx = Tx.decode(reader, reader.uint32()); break; case 2: message.txBytes = reader.bytes(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): SimulateRequest { return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, txBytes: isSet(object.txBytes) ? bytesFromBase64(object.txBytes) : new Uint8Array() }; }, toJSON(message: SimulateRequest): unknown { const obj: any = {}; message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); message.txBytes !== undefined && (obj.txBytes = base64FromBytes(message.txBytes !== undefined ? message.txBytes : new Uint8Array())); return obj; }, fromPartial(object: Partial): SimulateRequest { const message = createBaseSimulateRequest(); message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; message.txBytes = object.txBytes ?? new Uint8Array(); return message; } }; function createBaseSimulateResponse(): SimulateResponse { return { gasInfo: undefined, result: undefined }; } export const SimulateResponse = { encode(message: SimulateResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.gasInfo !== undefined) { GasInfo.encode(message.gasInfo, writer.uint32(10).fork()).ldelim(); } if (message.result !== undefined) { Result.encode(message.result, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): SimulateResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseSimulateResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.gasInfo = GasInfo.decode(reader, reader.uint32()); break; case 2: message.result = Result.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): SimulateResponse { return { gasInfo: isSet(object.gasInfo) ? GasInfo.fromJSON(object.gasInfo) : undefined, result: isSet(object.result) ? Result.fromJSON(object.result) : undefined }; }, toJSON(message: SimulateResponse): unknown { const obj: any = {}; message.gasInfo !== undefined && (obj.gasInfo = message.gasInfo ? GasInfo.toJSON(message.gasInfo) : undefined); message.result !== undefined && (obj.result = message.result ? Result.toJSON(message.result) : undefined); return obj; }, fromPartial(object: Partial): SimulateResponse { const message = createBaseSimulateResponse(); message.gasInfo = object.gasInfo !== undefined && object.gasInfo !== null ? GasInfo.fromPartial(object.gasInfo) : undefined; message.result = object.result !== undefined && object.result !== null ? Result.fromPartial(object.result) : undefined; return message; } }; function createBaseGetTxRequest(): GetTxRequest { return { hash: "" }; } export const GetTxRequest = { encode(message: GetTxRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.hash !== "") { writer.uint32(10).string(message.hash); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GetTxRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.hash = reader.string(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): GetTxRequest { return { hash: isSet(object.hash) ? String(object.hash) : "" }; }, toJSON(message: GetTxRequest): unknown { const obj: any = {}; message.hash !== undefined && (obj.hash = message.hash); return obj; }, fromPartial(object: Partial): GetTxRequest { const message = createBaseGetTxRequest(); message.hash = object.hash ?? ""; return message; } }; function createBaseGetTxResponse(): GetTxResponse { return { tx: undefined, txResponse: undefined }; } export const GetTxResponse = { encode(message: GetTxResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.tx !== undefined) { Tx.encode(message.tx, writer.uint32(10).fork()).ldelim(); } if (message.txResponse !== undefined) { TxResponse.encode(message.txResponse, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GetTxResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetTxResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.tx = Tx.decode(reader, reader.uint32()); break; case 2: message.txResponse = TxResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): GetTxResponse { return { tx: isSet(object.tx) ? Tx.fromJSON(object.tx) : undefined, txResponse: isSet(object.txResponse) ? TxResponse.fromJSON(object.txResponse) : undefined }; }, toJSON(message: GetTxResponse): unknown { const obj: any = {}; message.tx !== undefined && (obj.tx = message.tx ? Tx.toJSON(message.tx) : undefined); message.txResponse !== undefined && (obj.txResponse = message.txResponse ? TxResponse.toJSON(message.txResponse) : undefined); return obj; }, fromPartial(object: Partial): GetTxResponse { const message = createBaseGetTxResponse(); message.tx = object.tx !== undefined && object.tx !== null ? Tx.fromPartial(object.tx) : undefined; message.txResponse = object.txResponse !== undefined && object.txResponse !== null ? TxResponse.fromPartial(object.txResponse) : undefined; return message; } }; function createBaseGetBlockWithTxsRequest(): GetBlockWithTxsRequest { return { height: Long.ZERO, pagination: undefined }; } export const GetBlockWithTxsRequest = { encode(message: GetBlockWithTxsRequest, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (!message.height.isZero()) { writer.uint32(8).int64(message.height); } if (message.pagination !== undefined) { PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsRequest { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetBlockWithTxsRequest(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.height = (reader.int64() as Long); break; case 2: message.pagination = PageRequest.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): GetBlockWithTxsRequest { return { height: isSet(object.height) ? Long.fromValue(object.height) : Long.ZERO, pagination: isSet(object.pagination) ? PageRequest.fromJSON(object.pagination) : undefined }; }, toJSON(message: GetBlockWithTxsRequest): unknown { const obj: any = {}; message.height !== undefined && (obj.height = (message.height || Long.ZERO).toString()); message.pagination !== undefined && (obj.pagination = message.pagination ? PageRequest.toJSON(message.pagination) : undefined); return obj; }, fromPartial(object: Partial): GetBlockWithTxsRequest { const message = createBaseGetBlockWithTxsRequest(); message.height = object.height !== undefined && object.height !== null ? Long.fromValue(object.height) : Long.ZERO; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageRequest.fromPartial(object.pagination) : undefined; return message; } }; function createBaseGetBlockWithTxsResponse(): GetBlockWithTxsResponse { return { txs: [], blockId: undefined, block: undefined, pagination: undefined }; } export const GetBlockWithTxsResponse = { encode(message: GetBlockWithTxsResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { for (const v of message.txs) { Tx.encode(v!, writer.uint32(10).fork()).ldelim(); } if (message.blockId !== undefined) { BlockID.encode(message.blockId, writer.uint32(18).fork()).ldelim(); } if (message.block !== undefined) { Block.encode(message.block, writer.uint32(26).fork()).ldelim(); } if (message.pagination !== undefined) { PageResponse.encode(message.pagination, writer.uint32(34).fork()).ldelim(); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): GetBlockWithTxsResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseGetBlockWithTxsResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.txs.push(Tx.decode(reader, reader.uint32())); break; case 2: message.blockId = BlockID.decode(reader, reader.uint32()); break; case 3: message.block = Block.decode(reader, reader.uint32()); break; case 4: message.pagination = PageResponse.decode(reader, reader.uint32()); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): GetBlockWithTxsResponse { return { txs: Array.isArray(object?.txs) ? object.txs.map((e: any) => Tx.fromJSON(e)) : [], blockId: isSet(object.blockId) ? BlockID.fromJSON(object.blockId) : undefined, block: isSet(object.block) ? Block.fromJSON(object.block) : undefined, pagination: isSet(object.pagination) ? PageResponse.fromJSON(object.pagination) : undefined }; }, toJSON(message: GetBlockWithTxsResponse): unknown { const obj: any = {}; if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toJSON(e) : undefined); } else { obj.txs = []; } message.blockId !== undefined && (obj.blockId = message.blockId ? BlockID.toJSON(message.blockId) : undefined); message.block !== undefined && (obj.block = message.block ? Block.toJSON(message.block) : undefined); message.pagination !== undefined && (obj.pagination = message.pagination ? PageResponse.toJSON(message.pagination) : undefined); return obj; }, fromPartial(object: Partial): GetBlockWithTxsResponse { const message = createBaseGetBlockWithTxsResponse(); message.txs = object.txs?.map(e => Tx.fromPartial(e)) || []; message.blockId = object.blockId !== undefined && object.blockId !== null ? BlockID.fromPartial(object.blockId) : undefined; message.block = object.block !== undefined && object.block !== null ? Block.fromPartial(object.block) : undefined; message.pagination = object.pagination !== undefined && object.pagination !== null ? PageResponse.fromPartial(object.pagination) : undefined; return message; } };