@bze/bzejs 1.8.3 → 1.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/bze/bundle.d.ts +67 -53
  2. package/bze/bundle.js +70 -70
  3. package/bze/lcd.d.ts +3 -0
  4. package/bze/lcd.js +5 -0
  5. package/bze/rpc.query.d.ts +11 -0
  6. package/bze/rpc.query.js +3 -0
  7. package/cosmos/base/tendermint/v1beta1/query.d.ts +924 -0
  8. package/cosmos/base/tendermint/v1beta1/query.js +1716 -0
  9. package/cosmos/base/tendermint/v1beta1/query.lcd.d.ts +15 -0
  10. package/cosmos/base/tendermint/v1beta1/query.lcd.js +87 -0
  11. package/cosmos/base/tendermint/v1beta1/query.rpc.Service.d.ts +46 -0
  12. package/cosmos/base/tendermint/v1beta1/query.rpc.Service.js +85 -0
  13. package/cosmos/base/tendermint/v1beta1/types.d.ts +185 -0
  14. package/cosmos/base/tendermint/v1beta1/types.js +340 -0
  15. package/cosmos/bundle.d.ts +6360 -6054
  16. package/cosmos/bundle.js +366 -353
  17. package/cosmos/lcd.d.ts +3 -0
  18. package/cosmos/lcd.js +5 -0
  19. package/cosmos/rpc.query.d.ts +11 -0
  20. package/cosmos/rpc.query.js +3 -0
  21. package/esm/bze/bundle.js +70 -70
  22. package/esm/bze/lcd.js +5 -0
  23. package/esm/bze/rpc.query.js +3 -0
  24. package/esm/cosmos/base/tendermint/v1beta1/query.js +1713 -0
  25. package/esm/cosmos/base/tendermint/v1beta1/query.lcd.js +83 -0
  26. package/esm/cosmos/base/tendermint/v1beta1/query.rpc.Service.js +80 -0
  27. package/esm/cosmos/base/tendermint/v1beta1/types.js +337 -0
  28. package/esm/cosmos/bundle.js +366 -353
  29. package/esm/cosmos/lcd.js +5 -0
  30. package/esm/cosmos/rpc.query.js +3 -0
  31. package/esm/gogoproto/bundle.js +2 -2
  32. package/esm/google/bundle.js +7 -7
  33. package/esm/ibc/bundle.js +189 -189
  34. package/esm/ibc/lcd.js +5 -0
  35. package/esm/ibc/rpc.query.js +3 -0
  36. package/esm/tendermint/bundle.js +18 -18
  37. package/gogoproto/bundle.js +2 -2
  38. package/google/bundle.d.ts +438 -438
  39. package/google/bundle.js +7 -7
  40. package/ibc/bundle.d.ts +3670 -3656
  41. package/ibc/bundle.js +189 -189
  42. package/ibc/lcd.d.ts +3 -0
  43. package/ibc/lcd.js +5 -0
  44. package/ibc/rpc.query.d.ts +11 -0
  45. package/ibc/rpc.query.js +3 -0
  46. package/package.json +1 -1
  47. package/tendermint/bundle.d.ts +852 -852
  48. package/tendermint/bundle.js +18 -18
@@ -0,0 +1,83 @@
1
+ //@ts-nocheck
2
+ import { setPaginationParams } from "../../../../helpers";
3
+ export class LCDQueryClient {
4
+ req;
5
+ constructor({ requestClient }) {
6
+ this.req = requestClient;
7
+ this.getNodeInfo = this.getNodeInfo.bind(this);
8
+ this.getSyncing = this.getSyncing.bind(this);
9
+ this.getLatestBlock = this.getLatestBlock.bind(this);
10
+ this.getBlockByHeight = this.getBlockByHeight.bind(this);
11
+ this.getLatestValidatorSet = this.getLatestValidatorSet.bind(this);
12
+ this.getValidatorSetByHeight = this.getValidatorSetByHeight.bind(this);
13
+ this.aBCIQuery = this.aBCIQuery.bind(this);
14
+ }
15
+ /* GetNodeInfo queries the current node info. */
16
+ async getNodeInfo(_params = {}) {
17
+ const endpoint = `cosmos/base/tendermint/v1beta1/node_info`;
18
+ return await this.req.get(endpoint);
19
+ }
20
+ /* GetSyncing queries node syncing. */
21
+ async getSyncing(_params = {}) {
22
+ const endpoint = `cosmos/base/tendermint/v1beta1/syncing`;
23
+ return await this.req.get(endpoint);
24
+ }
25
+ /* GetLatestBlock returns the latest block. */
26
+ async getLatestBlock(_params = {}) {
27
+ const endpoint = `cosmos/base/tendermint/v1beta1/blocks/latest`;
28
+ return await this.req.get(endpoint);
29
+ }
30
+ /* GetBlockByHeight queries block for given height. */
31
+ async getBlockByHeight(params) {
32
+ const endpoint = `cosmos/base/tendermint/v1beta1/blocks/${params.height}`;
33
+ return await this.req.get(endpoint);
34
+ }
35
+ /* GetLatestValidatorSet queries latest validator-set. */
36
+ async getLatestValidatorSet(params = {
37
+ pagination: undefined
38
+ }) {
39
+ const options = {
40
+ params: {}
41
+ };
42
+ if (typeof params?.pagination !== "undefined") {
43
+ setPaginationParams(options, params.pagination);
44
+ }
45
+ const endpoint = `cosmos/base/tendermint/v1beta1/validatorsets/latest`;
46
+ return await this.req.get(endpoint, options);
47
+ }
48
+ /* GetValidatorSetByHeight queries validator-set at a given height. */
49
+ async getValidatorSetByHeight(params) {
50
+ const options = {
51
+ params: {}
52
+ };
53
+ if (typeof params?.pagination !== "undefined") {
54
+ setPaginationParams(options, params.pagination);
55
+ }
56
+ const endpoint = `cosmos/base/tendermint/v1beta1/validatorsets/${params.height}`;
57
+ return await this.req.get(endpoint, options);
58
+ }
59
+ /* ABCIQuery defines a query handler that supports ABCI queries directly to the
60
+ application, bypassing Tendermint completely. The ABCI query must contain
61
+ a valid and supported path, including app, custom, p2p, and store.
62
+
63
+ Since: cosmos-sdk 0.46 */
64
+ async aBCIQuery(params) {
65
+ const options = {
66
+ params: {}
67
+ };
68
+ if (typeof params?.data !== "undefined") {
69
+ options.params.data = params.data;
70
+ }
71
+ if (typeof params?.path !== "undefined") {
72
+ options.params.path = params.path;
73
+ }
74
+ if (typeof params?.height !== "undefined") {
75
+ options.params.height = params.height;
76
+ }
77
+ if (typeof params?.prove !== "undefined") {
78
+ options.params.prove = params.prove;
79
+ }
80
+ const endpoint = `cosmos/base/tendermint/v1beta1/abci_query`;
81
+ return await this.req.get(endpoint, options);
82
+ }
83
+ }
@@ -0,0 +1,80 @@
1
+ import { BinaryReader } from "../../../../binary";
2
+ import { createProtobufRpcClient } from "@cosmjs/stargate";
3
+ import { GetNodeInfoRequest, GetNodeInfoResponse, GetSyncingRequest, GetSyncingResponse, GetLatestBlockRequest, GetLatestBlockResponse, GetBlockByHeightRequest, GetBlockByHeightResponse, GetLatestValidatorSetRequest, GetLatestValidatorSetResponse, GetValidatorSetByHeightRequest, GetValidatorSetByHeightResponse, ABCIQueryRequest, ABCIQueryResponse } from "./query";
4
+ export class ServiceClientImpl {
5
+ rpc;
6
+ constructor(rpc) {
7
+ this.rpc = rpc;
8
+ this.getNodeInfo = this.getNodeInfo.bind(this);
9
+ this.getSyncing = this.getSyncing.bind(this);
10
+ this.getLatestBlock = this.getLatestBlock.bind(this);
11
+ this.getBlockByHeight = this.getBlockByHeight.bind(this);
12
+ this.getLatestValidatorSet = this.getLatestValidatorSet.bind(this);
13
+ this.getValidatorSetByHeight = this.getValidatorSetByHeight.bind(this);
14
+ this.aBCIQuery = this.aBCIQuery.bind(this);
15
+ }
16
+ getNodeInfo(request = {}) {
17
+ const data = GetNodeInfoRequest.encode(request).finish();
18
+ const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetNodeInfo", data);
19
+ return promise.then(data => GetNodeInfoResponse.decode(new BinaryReader(data)));
20
+ }
21
+ getSyncing(request = {}) {
22
+ const data = GetSyncingRequest.encode(request).finish();
23
+ const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetSyncing", data);
24
+ return promise.then(data => GetSyncingResponse.decode(new BinaryReader(data)));
25
+ }
26
+ getLatestBlock(request = {}) {
27
+ const data = GetLatestBlockRequest.encode(request).finish();
28
+ const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetLatestBlock", data);
29
+ return promise.then(data => GetLatestBlockResponse.decode(new BinaryReader(data)));
30
+ }
31
+ getBlockByHeight(request) {
32
+ const data = GetBlockByHeightRequest.encode(request).finish();
33
+ const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetBlockByHeight", data);
34
+ return promise.then(data => GetBlockByHeightResponse.decode(new BinaryReader(data)));
35
+ }
36
+ getLatestValidatorSet(request = {
37
+ pagination: undefined
38
+ }) {
39
+ const data = GetLatestValidatorSetRequest.encode(request).finish();
40
+ const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetLatestValidatorSet", data);
41
+ return promise.then(data => GetLatestValidatorSetResponse.decode(new BinaryReader(data)));
42
+ }
43
+ getValidatorSetByHeight(request) {
44
+ const data = GetValidatorSetByHeightRequest.encode(request).finish();
45
+ const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "GetValidatorSetByHeight", data);
46
+ return promise.then(data => GetValidatorSetByHeightResponse.decode(new BinaryReader(data)));
47
+ }
48
+ aBCIQuery(request) {
49
+ const data = ABCIQueryRequest.encode(request).finish();
50
+ const promise = this.rpc.request("cosmos.base.tendermint.v1beta1.Service", "ABCIQuery", data);
51
+ return promise.then(data => ABCIQueryResponse.decode(new BinaryReader(data)));
52
+ }
53
+ }
54
+ export const createRpcQueryExtension = (base) => {
55
+ const rpc = createProtobufRpcClient(base);
56
+ const queryService = new ServiceClientImpl(rpc);
57
+ return {
58
+ getNodeInfo(request) {
59
+ return queryService.getNodeInfo(request);
60
+ },
61
+ getSyncing(request) {
62
+ return queryService.getSyncing(request);
63
+ },
64
+ getLatestBlock(request) {
65
+ return queryService.getLatestBlock(request);
66
+ },
67
+ getBlockByHeight(request) {
68
+ return queryService.getBlockByHeight(request);
69
+ },
70
+ getLatestValidatorSet(request) {
71
+ return queryService.getLatestValidatorSet(request);
72
+ },
73
+ getValidatorSetByHeight(request) {
74
+ return queryService.getValidatorSetByHeight(request);
75
+ },
76
+ aBCIQuery(request) {
77
+ return queryService.aBCIQuery(request);
78
+ }
79
+ };
80
+ };
@@ -0,0 +1,337 @@
1
+ //@ts-nocheck
2
+ import { Data, Commit, BlockID } from "../../../../tendermint/types/types";
3
+ import { EvidenceList } from "../../../../tendermint/types/evidence";
4
+ import { Consensus } from "../../../../tendermint/version/types";
5
+ import { Timestamp } from "../../../../google/protobuf/timestamp";
6
+ import { BinaryReader, BinaryWriter } from "../../../../binary";
7
+ import { toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers";
8
+ function createBaseBlock() {
9
+ return {
10
+ header: Header.fromPartial({}),
11
+ data: Data.fromPartial({}),
12
+ evidence: EvidenceList.fromPartial({}),
13
+ lastCommit: undefined
14
+ };
15
+ }
16
+ export const Block = {
17
+ typeUrl: "/cosmos.base.tendermint.v1beta1.Block",
18
+ encode(message, writer = BinaryWriter.create()) {
19
+ if (message.header !== undefined) {
20
+ Header.encode(message.header, writer.uint32(10).fork()).ldelim();
21
+ }
22
+ if (message.data !== undefined) {
23
+ Data.encode(message.data, writer.uint32(18).fork()).ldelim();
24
+ }
25
+ if (message.evidence !== undefined) {
26
+ EvidenceList.encode(message.evidence, writer.uint32(26).fork()).ldelim();
27
+ }
28
+ if (message.lastCommit !== undefined) {
29
+ Commit.encode(message.lastCommit, writer.uint32(34).fork()).ldelim();
30
+ }
31
+ return writer;
32
+ },
33
+ decode(input, length) {
34
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
35
+ let end = length === undefined ? reader.len : reader.pos + length;
36
+ const message = createBaseBlock();
37
+ while (reader.pos < end) {
38
+ const tag = reader.uint32();
39
+ switch (tag >>> 3) {
40
+ case 1:
41
+ message.header = Header.decode(reader, reader.uint32());
42
+ break;
43
+ case 2:
44
+ message.data = Data.decode(reader, reader.uint32());
45
+ break;
46
+ case 3:
47
+ message.evidence = EvidenceList.decode(reader, reader.uint32());
48
+ break;
49
+ case 4:
50
+ message.lastCommit = Commit.decode(reader, reader.uint32());
51
+ break;
52
+ default:
53
+ reader.skipType(tag & 7);
54
+ break;
55
+ }
56
+ }
57
+ return message;
58
+ },
59
+ fromPartial(object) {
60
+ const message = createBaseBlock();
61
+ message.header = object.header !== undefined && object.header !== null ? Header.fromPartial(object.header) : undefined;
62
+ message.data = object.data !== undefined && object.data !== null ? Data.fromPartial(object.data) : undefined;
63
+ message.evidence = object.evidence !== undefined && object.evidence !== null ? EvidenceList.fromPartial(object.evidence) : undefined;
64
+ message.lastCommit = object.lastCommit !== undefined && object.lastCommit !== null ? Commit.fromPartial(object.lastCommit) : undefined;
65
+ return message;
66
+ },
67
+ fromAmino(object) {
68
+ const message = createBaseBlock();
69
+ if (object.header !== undefined && object.header !== null) {
70
+ message.header = Header.fromAmino(object.header);
71
+ }
72
+ if (object.data !== undefined && object.data !== null) {
73
+ message.data = Data.fromAmino(object.data);
74
+ }
75
+ if (object.evidence !== undefined && object.evidence !== null) {
76
+ message.evidence = EvidenceList.fromAmino(object.evidence);
77
+ }
78
+ if (object.last_commit !== undefined && object.last_commit !== null) {
79
+ message.lastCommit = Commit.fromAmino(object.last_commit);
80
+ }
81
+ return message;
82
+ },
83
+ toAmino(message) {
84
+ const obj = {};
85
+ obj.header = message.header ? Header.toAmino(message.header) : Header.toAmino(Header.fromPartial({}));
86
+ obj.data = message.data ? Data.toAmino(message.data) : Data.toAmino(Data.fromPartial({}));
87
+ obj.evidence = message.evidence ? EvidenceList.toAmino(message.evidence) : EvidenceList.toAmino(EvidenceList.fromPartial({}));
88
+ obj.last_commit = message.lastCommit ? Commit.toAmino(message.lastCommit) : undefined;
89
+ return obj;
90
+ },
91
+ fromAminoMsg(object) {
92
+ return Block.fromAmino(object.value);
93
+ },
94
+ toAminoMsg(message) {
95
+ return {
96
+ type: "cosmos-sdk/Block",
97
+ value: Block.toAmino(message)
98
+ };
99
+ },
100
+ fromProtoMsg(message) {
101
+ return Block.decode(message.value);
102
+ },
103
+ toProto(message) {
104
+ return Block.encode(message).finish();
105
+ },
106
+ toProtoMsg(message) {
107
+ return {
108
+ typeUrl: "/cosmos.base.tendermint.v1beta1.Block",
109
+ value: Block.encode(message).finish()
110
+ };
111
+ }
112
+ };
113
+ function createBaseHeader() {
114
+ return {
115
+ version: Consensus.fromPartial({}),
116
+ chainId: "",
117
+ height: BigInt(0),
118
+ time: new Date(),
119
+ lastBlockId: BlockID.fromPartial({}),
120
+ lastCommitHash: new Uint8Array(),
121
+ dataHash: new Uint8Array(),
122
+ validatorsHash: new Uint8Array(),
123
+ nextValidatorsHash: new Uint8Array(),
124
+ consensusHash: new Uint8Array(),
125
+ appHash: new Uint8Array(),
126
+ lastResultsHash: new Uint8Array(),
127
+ evidenceHash: new Uint8Array(),
128
+ proposerAddress: ""
129
+ };
130
+ }
131
+ export const Header = {
132
+ typeUrl: "/cosmos.base.tendermint.v1beta1.Header",
133
+ encode(message, writer = BinaryWriter.create()) {
134
+ if (message.version !== undefined) {
135
+ Consensus.encode(message.version, writer.uint32(10).fork()).ldelim();
136
+ }
137
+ if (message.chainId !== "") {
138
+ writer.uint32(18).string(message.chainId);
139
+ }
140
+ if (message.height !== BigInt(0)) {
141
+ writer.uint32(24).int64(message.height);
142
+ }
143
+ if (message.time !== undefined) {
144
+ Timestamp.encode(toTimestamp(message.time), writer.uint32(34).fork()).ldelim();
145
+ }
146
+ if (message.lastBlockId !== undefined) {
147
+ BlockID.encode(message.lastBlockId, writer.uint32(42).fork()).ldelim();
148
+ }
149
+ if (message.lastCommitHash.length !== 0) {
150
+ writer.uint32(50).bytes(message.lastCommitHash);
151
+ }
152
+ if (message.dataHash.length !== 0) {
153
+ writer.uint32(58).bytes(message.dataHash);
154
+ }
155
+ if (message.validatorsHash.length !== 0) {
156
+ writer.uint32(66).bytes(message.validatorsHash);
157
+ }
158
+ if (message.nextValidatorsHash.length !== 0) {
159
+ writer.uint32(74).bytes(message.nextValidatorsHash);
160
+ }
161
+ if (message.consensusHash.length !== 0) {
162
+ writer.uint32(82).bytes(message.consensusHash);
163
+ }
164
+ if (message.appHash.length !== 0) {
165
+ writer.uint32(90).bytes(message.appHash);
166
+ }
167
+ if (message.lastResultsHash.length !== 0) {
168
+ writer.uint32(98).bytes(message.lastResultsHash);
169
+ }
170
+ if (message.evidenceHash.length !== 0) {
171
+ writer.uint32(106).bytes(message.evidenceHash);
172
+ }
173
+ if (message.proposerAddress !== "") {
174
+ writer.uint32(114).string(message.proposerAddress);
175
+ }
176
+ return writer;
177
+ },
178
+ decode(input, length) {
179
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
180
+ let end = length === undefined ? reader.len : reader.pos + length;
181
+ const message = createBaseHeader();
182
+ while (reader.pos < end) {
183
+ const tag = reader.uint32();
184
+ switch (tag >>> 3) {
185
+ case 1:
186
+ message.version = Consensus.decode(reader, reader.uint32());
187
+ break;
188
+ case 2:
189
+ message.chainId = reader.string();
190
+ break;
191
+ case 3:
192
+ message.height = reader.int64();
193
+ break;
194
+ case 4:
195
+ message.time = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
196
+ break;
197
+ case 5:
198
+ message.lastBlockId = BlockID.decode(reader, reader.uint32());
199
+ break;
200
+ case 6:
201
+ message.lastCommitHash = reader.bytes();
202
+ break;
203
+ case 7:
204
+ message.dataHash = reader.bytes();
205
+ break;
206
+ case 8:
207
+ message.validatorsHash = reader.bytes();
208
+ break;
209
+ case 9:
210
+ message.nextValidatorsHash = reader.bytes();
211
+ break;
212
+ case 10:
213
+ message.consensusHash = reader.bytes();
214
+ break;
215
+ case 11:
216
+ message.appHash = reader.bytes();
217
+ break;
218
+ case 12:
219
+ message.lastResultsHash = reader.bytes();
220
+ break;
221
+ case 13:
222
+ message.evidenceHash = reader.bytes();
223
+ break;
224
+ case 14:
225
+ message.proposerAddress = reader.string();
226
+ break;
227
+ default:
228
+ reader.skipType(tag & 7);
229
+ break;
230
+ }
231
+ }
232
+ return message;
233
+ },
234
+ fromPartial(object) {
235
+ const message = createBaseHeader();
236
+ message.version = object.version !== undefined && object.version !== null ? Consensus.fromPartial(object.version) : undefined;
237
+ message.chainId = object.chainId ?? "";
238
+ message.height = object.height !== undefined && object.height !== null ? BigInt(object.height.toString()) : BigInt(0);
239
+ message.time = object.time ?? undefined;
240
+ message.lastBlockId = object.lastBlockId !== undefined && object.lastBlockId !== null ? BlockID.fromPartial(object.lastBlockId) : undefined;
241
+ message.lastCommitHash = object.lastCommitHash ?? new Uint8Array();
242
+ message.dataHash = object.dataHash ?? new Uint8Array();
243
+ message.validatorsHash = object.validatorsHash ?? new Uint8Array();
244
+ message.nextValidatorsHash = object.nextValidatorsHash ?? new Uint8Array();
245
+ message.consensusHash = object.consensusHash ?? new Uint8Array();
246
+ message.appHash = object.appHash ?? new Uint8Array();
247
+ message.lastResultsHash = object.lastResultsHash ?? new Uint8Array();
248
+ message.evidenceHash = object.evidenceHash ?? new Uint8Array();
249
+ message.proposerAddress = object.proposerAddress ?? "";
250
+ return message;
251
+ },
252
+ fromAmino(object) {
253
+ const message = createBaseHeader();
254
+ if (object.version !== undefined && object.version !== null) {
255
+ message.version = Consensus.fromAmino(object.version);
256
+ }
257
+ if (object.chain_id !== undefined && object.chain_id !== null) {
258
+ message.chainId = object.chain_id;
259
+ }
260
+ if (object.height !== undefined && object.height !== null) {
261
+ message.height = BigInt(object.height);
262
+ }
263
+ if (object.time !== undefined && object.time !== null) {
264
+ message.time = fromTimestamp(Timestamp.fromAmino(object.time));
265
+ }
266
+ if (object.last_block_id !== undefined && object.last_block_id !== null) {
267
+ message.lastBlockId = BlockID.fromAmino(object.last_block_id);
268
+ }
269
+ if (object.last_commit_hash !== undefined && object.last_commit_hash !== null) {
270
+ message.lastCommitHash = bytesFromBase64(object.last_commit_hash);
271
+ }
272
+ if (object.data_hash !== undefined && object.data_hash !== null) {
273
+ message.dataHash = bytesFromBase64(object.data_hash);
274
+ }
275
+ if (object.validators_hash !== undefined && object.validators_hash !== null) {
276
+ message.validatorsHash = bytesFromBase64(object.validators_hash);
277
+ }
278
+ if (object.next_validators_hash !== undefined && object.next_validators_hash !== null) {
279
+ message.nextValidatorsHash = bytesFromBase64(object.next_validators_hash);
280
+ }
281
+ if (object.consensus_hash !== undefined && object.consensus_hash !== null) {
282
+ message.consensusHash = bytesFromBase64(object.consensus_hash);
283
+ }
284
+ if (object.app_hash !== undefined && object.app_hash !== null) {
285
+ message.appHash = bytesFromBase64(object.app_hash);
286
+ }
287
+ if (object.last_results_hash !== undefined && object.last_results_hash !== null) {
288
+ message.lastResultsHash = bytesFromBase64(object.last_results_hash);
289
+ }
290
+ if (object.evidence_hash !== undefined && object.evidence_hash !== null) {
291
+ message.evidenceHash = bytesFromBase64(object.evidence_hash);
292
+ }
293
+ if (object.proposer_address !== undefined && object.proposer_address !== null) {
294
+ message.proposerAddress = object.proposer_address;
295
+ }
296
+ return message;
297
+ },
298
+ toAmino(message) {
299
+ const obj = {};
300
+ obj.version = message.version ? Consensus.toAmino(message.version) : Consensus.toAmino(Consensus.fromPartial({}));
301
+ obj.chain_id = message.chainId === "" ? undefined : message.chainId;
302
+ obj.height = message.height !== BigInt(0) ? message.height?.toString() : undefined;
303
+ obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : new Date();
304
+ obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : BlockID.toAmino(BlockID.fromPartial({}));
305
+ obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined;
306
+ obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined;
307
+ obj.validators_hash = message.validatorsHash ? base64FromBytes(message.validatorsHash) : undefined;
308
+ obj.next_validators_hash = message.nextValidatorsHash ? base64FromBytes(message.nextValidatorsHash) : undefined;
309
+ obj.consensus_hash = message.consensusHash ? base64FromBytes(message.consensusHash) : undefined;
310
+ obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined;
311
+ obj.last_results_hash = message.lastResultsHash ? base64FromBytes(message.lastResultsHash) : undefined;
312
+ obj.evidence_hash = message.evidenceHash ? base64FromBytes(message.evidenceHash) : undefined;
313
+ obj.proposer_address = message.proposerAddress === "" ? undefined : message.proposerAddress;
314
+ return obj;
315
+ },
316
+ fromAminoMsg(object) {
317
+ return Header.fromAmino(object.value);
318
+ },
319
+ toAminoMsg(message) {
320
+ return {
321
+ type: "cosmos-sdk/Header",
322
+ value: Header.toAmino(message)
323
+ };
324
+ },
325
+ fromProtoMsg(message) {
326
+ return Header.decode(message.value);
327
+ },
328
+ toProto(message) {
329
+ return Header.encode(message).finish();
330
+ },
331
+ toProtoMsg(message) {
332
+ return {
333
+ typeUrl: "/cosmos.base.tendermint.v1beta1.Header",
334
+ value: Header.encode(message).finish()
335
+ };
336
+ }
337
+ };