@burnt-labs/xion-types 16.0.0 → 18.0.0

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 (100) hide show
  1. package/package.json +7 -20
  2. package/README.md +0 -111
  3. package/types/.gitkeep +0 -0
  4. package/types/generated/amino/amino.ts +0 -9
  5. package/types/generated/cosmos/app/v1alpha1/config.ts +0 -336
  6. package/types/generated/cosmos/app/v1alpha1/query.ts +0 -265
  7. package/types/generated/cosmos/auth/v1beta1/auth.ts +0 -520
  8. package/types/generated/cosmos/auth/v1beta1/query.ts +0 -1852
  9. package/types/generated/cosmos/authz/v1beta1/authz.ts +0 -404
  10. package/types/generated/cosmos/authz/v1beta1/query.ts +0 -774
  11. package/types/generated/cosmos/autocli/v1/options.ts +0 -1016
  12. package/types/generated/cosmos/autocli/v1/query.ts +0 -379
  13. package/types/generated/cosmos/bank/v1beta1/bank.ts +0 -752
  14. package/types/generated/cosmos/bank/v1beta1/query.ts +0 -2789
  15. package/types/generated/cosmos/base/abci/v1beta1/abci.ts +0 -1447
  16. package/types/generated/cosmos/base/node/v1beta1/query.ts +0 -587
  17. package/types/generated/cosmos/base/query/v1beta1/pagination.ts +0 -317
  18. package/types/generated/cosmos/base/tendermint/v1beta1/query.ts +0 -2228
  19. package/types/generated/cosmos/base/tendermint/v1beta1/types.ts +0 -522
  20. package/types/generated/cosmos/base/v1beta1/coin.ts +0 -326
  21. package/types/generated/cosmos/circuit/v1/query.ts +0 -606
  22. package/types/generated/cosmos/circuit/v1/types.ts +0 -353
  23. package/types/generated/cosmos/consensus/v1/query.ts +0 -271
  24. package/types/generated/cosmos/crypto/multisig/v1beta1/multisig.ts +0 -212
  25. package/types/generated/cosmos/distribution/v1beta1/distribution.ts +0 -1143
  26. package/types/generated/cosmos/distribution/v1beta1/query.ts +0 -2005
  27. package/types/generated/cosmos/evidence/v1beta1/query.ts +0 -526
  28. package/types/generated/cosmos/feegrant/v1beta1/feegrant.ts +0 -502
  29. package/types/generated/cosmos/feegrant/v1beta1/query.ts +0 -725
  30. package/types/generated/cosmos/gov/v1/gov.ts +0 -1656
  31. package/types/generated/cosmos/gov/v1/query.ts +0 -1847
  32. package/types/generated/cosmos/gov/v1beta1/gov.ts +0 -1239
  33. package/types/generated/cosmos/gov/v1beta1/query.ts +0 -1658
  34. package/types/generated/cosmos/group/v1/query.ts +0 -2840
  35. package/types/generated/cosmos/group/v1/types.ts +0 -1803
  36. package/types/generated/cosmos/ics23/v1/proofs.ts +0 -1685
  37. package/types/generated/cosmos/mint/v1beta1/mint.ts +0 -273
  38. package/types/generated/cosmos/mint/v1beta1/query.ts +0 -589
  39. package/types/generated/cosmos/msg/v1/msg.ts +0 -9
  40. package/types/generated/cosmos/nft/v1beta1/nft.ts +0 -333
  41. package/types/generated/cosmos/nft/v1beta1/query.ts +0 -1362
  42. package/types/generated/cosmos/orm/query/v1alpha1/query.ts +0 -1016
  43. package/types/generated/cosmos/params/v1beta1/params.ts +0 -227
  44. package/types/generated/cosmos/params/v1beta1/query.ts +0 -545
  45. package/types/generated/cosmos/query/v1/query.ts +0 -9
  46. package/types/generated/cosmos/slashing/v1beta1/query.ts +0 -626
  47. package/types/generated/cosmos/slashing/v1beta1/slashing.ts +0 -409
  48. package/types/generated/cosmos/staking/v1beta1/query.ts +0 -2912
  49. package/types/generated/cosmos/staking/v1beta1/staking.ts +0 -2515
  50. package/types/generated/cosmos/tx/signing/v1beta1/signing.ts +0 -608
  51. package/types/generated/cosmos/tx/v1beta1/service.ts +0 -2111
  52. package/types/generated/cosmos/tx/v1beta1/tx.ts +0 -1613
  53. package/types/generated/cosmos/upgrade/v1beta1/query.ts +0 -1007
  54. package/types/generated/cosmos/upgrade/v1beta1/upgrade.ts +0 -507
  55. package/types/generated/cosmos_proto/cosmos.ts +0 -299
  56. package/types/generated/cosmwasm/wasm/v1/query.ts +0 -2984
  57. package/types/generated/cosmwasm/wasm/v1/types.ts +0 -962
  58. package/types/generated/gogoproto/gogo.ts +0 -9
  59. package/types/generated/google/api/annotations.ts +0 -9
  60. package/types/generated/google/api/http.ts +0 -757
  61. package/types/generated/google/protobuf/any.ts +0 -253
  62. package/types/generated/google/protobuf/descriptor.ts +0 -4958
  63. package/types/generated/google/protobuf/duration.ts +0 -186
  64. package/types/generated/google/protobuf/timestamp.ts +0 -215
  65. package/types/generated/ibc/applications/fee/v1/fee.ts +0 -391
  66. package/types/generated/ibc/applications/fee/v1/genesis.ts +0 -553
  67. package/types/generated/ibc/applications/fee/v1/query.ts +0 -2056
  68. package/types/generated/ibc/applications/interchain_accounts/controller/v1/controller.ts +0 -100
  69. package/types/generated/ibc/applications/interchain_accounts/controller/v1/query.ts +0 -447
  70. package/types/generated/ibc/applications/interchain_accounts/host/v1/host.ts +0 -235
  71. package/types/generated/ibc/applications/interchain_accounts/host/v1/query.ts +0 -265
  72. package/types/generated/ibc/applications/transfer/v1/query.ts +0 -1135
  73. package/types/generated/ibc/applications/transfer/v1/transfer.ts +0 -213
  74. package/types/generated/ibc/core/channel/v1/channel.ts +0 -1329
  75. package/types/generated/ibc/core/channel/v1/query.ts +0 -4214
  76. package/types/generated/ibc/core/channel/v1/upgrade.ts +0 -330
  77. package/types/generated/ibc/core/client/v1/client.ts +0 -726
  78. package/types/generated/ibc/core/client/v1/query.ts +0 -2208
  79. package/types/generated/ibc/core/commitment/v1/commitment.ts +0 -329
  80. package/types/generated/ibc/core/connection/v1/connection.ts +0 -813
  81. package/types/generated/ibc/core/connection/v1/query.ts +0 -1442
  82. package/types/generated/ibc/lightclients/wasm/v1/query.ts +0 -484
  83. package/types/generated/tendermint/abci/types.ts +0 -6429
  84. package/types/generated/tendermint/crypto/keys.ts +0 -137
  85. package/types/generated/tendermint/crypto/proof.ts +0 -506
  86. package/types/generated/tendermint/p2p/types.ts +0 -514
  87. package/types/generated/tendermint/types/block.ts +0 -151
  88. package/types/generated/tendermint/types/evidence.ts +0 -493
  89. package/types/generated/tendermint/types/params.ts +0 -687
  90. package/types/generated/tendermint/types/types.ts +0 -2069
  91. package/types/generated/tendermint/types/validator.ts +0 -409
  92. package/types/generated/tendermint/version/types.ts +0 -202
  93. package/types/generated/xion/globalfee/v1/genesis.ts +0 -219
  94. package/types/generated/xion/globalfee/v1/query.ts +0 -269
  95. package/types/generated/xion/jwk/v1/audience.ts +0 -188
  96. package/types/generated/xion/jwk/v1/params.ts +0 -118
  97. package/types/generated/xion/jwk/v1/query.ts +0 -1061
  98. package/types/generated/xion/mint/v1/mint.ts +0 -273
  99. package/types/generated/xion/mint/v1/query.ts +0 -589
  100. package/types/generated/xion/v1/query.ts +0 -878
@@ -1,1239 +0,0 @@
1
- // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
- // versions:
3
- // protoc-gen-ts_proto v1.181.2
4
- // protoc unknown
5
- // source: cosmos/gov/v1beta1/gov.proto
6
-
7
- /* eslint-disable */
8
- import Long from "long";
9
- import _m0 from "protobufjs/minimal";
10
- import { Any } from "../../../google/protobuf/any";
11
- import { Duration } from "../../../google/protobuf/duration";
12
- import { Timestamp } from "../../../google/protobuf/timestamp";
13
- import { Coin } from "../../base/v1beta1/coin";
14
-
15
- export const protobufPackage = "cosmos.gov.v1beta1";
16
-
17
- /** VoteOption enumerates the valid vote options for a given governance proposal. */
18
- export enum VoteOption {
19
- /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */
20
- VOTE_OPTION_UNSPECIFIED = 0,
21
- /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */
22
- VOTE_OPTION_YES = 1,
23
- /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */
24
- VOTE_OPTION_ABSTAIN = 2,
25
- /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */
26
- VOTE_OPTION_NO = 3,
27
- /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */
28
- VOTE_OPTION_NO_WITH_VETO = 4,
29
- UNRECOGNIZED = -1,
30
- }
31
-
32
- export function voteOptionFromJSON(object: any): VoteOption {
33
- switch (object) {
34
- case 0:
35
- case "VOTE_OPTION_UNSPECIFIED":
36
- return VoteOption.VOTE_OPTION_UNSPECIFIED;
37
- case 1:
38
- case "VOTE_OPTION_YES":
39
- return VoteOption.VOTE_OPTION_YES;
40
- case 2:
41
- case "VOTE_OPTION_ABSTAIN":
42
- return VoteOption.VOTE_OPTION_ABSTAIN;
43
- case 3:
44
- case "VOTE_OPTION_NO":
45
- return VoteOption.VOTE_OPTION_NO;
46
- case 4:
47
- case "VOTE_OPTION_NO_WITH_VETO":
48
- return VoteOption.VOTE_OPTION_NO_WITH_VETO;
49
- case -1:
50
- case "UNRECOGNIZED":
51
- default:
52
- return VoteOption.UNRECOGNIZED;
53
- }
54
- }
55
-
56
- export function voteOptionToJSON(object: VoteOption): string {
57
- switch (object) {
58
- case VoteOption.VOTE_OPTION_UNSPECIFIED:
59
- return "VOTE_OPTION_UNSPECIFIED";
60
- case VoteOption.VOTE_OPTION_YES:
61
- return "VOTE_OPTION_YES";
62
- case VoteOption.VOTE_OPTION_ABSTAIN:
63
- return "VOTE_OPTION_ABSTAIN";
64
- case VoteOption.VOTE_OPTION_NO:
65
- return "VOTE_OPTION_NO";
66
- case VoteOption.VOTE_OPTION_NO_WITH_VETO:
67
- return "VOTE_OPTION_NO_WITH_VETO";
68
- case VoteOption.UNRECOGNIZED:
69
- default:
70
- return "UNRECOGNIZED";
71
- }
72
- }
73
-
74
- /** ProposalStatus enumerates the valid statuses of a proposal. */
75
- export enum ProposalStatus {
76
- /** PROPOSAL_STATUS_UNSPECIFIED - PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. */
77
- PROPOSAL_STATUS_UNSPECIFIED = 0,
78
- /**
79
- * PROPOSAL_STATUS_DEPOSIT_PERIOD - PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit
80
- * period.
81
- */
82
- PROPOSAL_STATUS_DEPOSIT_PERIOD = 1,
83
- /**
84
- * PROPOSAL_STATUS_VOTING_PERIOD - PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting
85
- * period.
86
- */
87
- PROPOSAL_STATUS_VOTING_PERIOD = 2,
88
- /**
89
- * PROPOSAL_STATUS_PASSED - PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has
90
- * passed.
91
- */
92
- PROPOSAL_STATUS_PASSED = 3,
93
- /**
94
- * PROPOSAL_STATUS_REJECTED - PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has
95
- * been rejected.
96
- */
97
- PROPOSAL_STATUS_REJECTED = 4,
98
- /**
99
- * PROPOSAL_STATUS_FAILED - PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has
100
- * failed.
101
- */
102
- PROPOSAL_STATUS_FAILED = 5,
103
- UNRECOGNIZED = -1,
104
- }
105
-
106
- export function proposalStatusFromJSON(object: any): ProposalStatus {
107
- switch (object) {
108
- case 0:
109
- case "PROPOSAL_STATUS_UNSPECIFIED":
110
- return ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED;
111
- case 1:
112
- case "PROPOSAL_STATUS_DEPOSIT_PERIOD":
113
- return ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD;
114
- case 2:
115
- case "PROPOSAL_STATUS_VOTING_PERIOD":
116
- return ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD;
117
- case 3:
118
- case "PROPOSAL_STATUS_PASSED":
119
- return ProposalStatus.PROPOSAL_STATUS_PASSED;
120
- case 4:
121
- case "PROPOSAL_STATUS_REJECTED":
122
- return ProposalStatus.PROPOSAL_STATUS_REJECTED;
123
- case 5:
124
- case "PROPOSAL_STATUS_FAILED":
125
- return ProposalStatus.PROPOSAL_STATUS_FAILED;
126
- case -1:
127
- case "UNRECOGNIZED":
128
- default:
129
- return ProposalStatus.UNRECOGNIZED;
130
- }
131
- }
132
-
133
- export function proposalStatusToJSON(object: ProposalStatus): string {
134
- switch (object) {
135
- case ProposalStatus.PROPOSAL_STATUS_UNSPECIFIED:
136
- return "PROPOSAL_STATUS_UNSPECIFIED";
137
- case ProposalStatus.PROPOSAL_STATUS_DEPOSIT_PERIOD:
138
- return "PROPOSAL_STATUS_DEPOSIT_PERIOD";
139
- case ProposalStatus.PROPOSAL_STATUS_VOTING_PERIOD:
140
- return "PROPOSAL_STATUS_VOTING_PERIOD";
141
- case ProposalStatus.PROPOSAL_STATUS_PASSED:
142
- return "PROPOSAL_STATUS_PASSED";
143
- case ProposalStatus.PROPOSAL_STATUS_REJECTED:
144
- return "PROPOSAL_STATUS_REJECTED";
145
- case ProposalStatus.PROPOSAL_STATUS_FAILED:
146
- return "PROPOSAL_STATUS_FAILED";
147
- case ProposalStatus.UNRECOGNIZED:
148
- default:
149
- return "UNRECOGNIZED";
150
- }
151
- }
152
-
153
- /**
154
- * WeightedVoteOption defines a unit of vote for vote split.
155
- *
156
- * Since: cosmos-sdk 0.43
157
- */
158
- export interface WeightedVoteOption {
159
- /** option defines the valid vote options, it must not contain duplicate vote options. */
160
- option: VoteOption;
161
- /** weight is the vote weight associated with the vote option. */
162
- weight: string;
163
- }
164
-
165
- /**
166
- * TextProposal defines a standard text proposal whose changes need to be
167
- * manually updated in case of approval.
168
- */
169
- export interface TextProposal {
170
- /** title of the proposal. */
171
- title: string;
172
- /** description associated with the proposal. */
173
- description: string;
174
- }
175
-
176
- /**
177
- * Deposit defines an amount deposited by an account address to an active
178
- * proposal.
179
- */
180
- export interface Deposit {
181
- /** proposal_id defines the unique id of the proposal. */
182
- proposalId: Long;
183
- /** depositor defines the deposit addresses from the proposals. */
184
- depositor: string;
185
- /** amount to be deposited by depositor. */
186
- amount: Coin[];
187
- }
188
-
189
- /** Proposal defines the core field members of a governance proposal. */
190
- export interface Proposal {
191
- /** proposal_id defines the unique id of the proposal. */
192
- proposalId: Long;
193
- /** content is the proposal's content. */
194
- content?:
195
- | Any
196
- | undefined;
197
- /** status defines the proposal status. */
198
- status: ProposalStatus;
199
- /**
200
- * final_tally_result is the final tally result of the proposal. When
201
- * querying a proposal via gRPC, this field is not populated until the
202
- * proposal's voting period has ended.
203
- */
204
- finalTallyResult?:
205
- | TallyResult
206
- | undefined;
207
- /** submit_time is the time of proposal submission. */
208
- submitTime?:
209
- | Date
210
- | undefined;
211
- /** deposit_end_time is the end time for deposition. */
212
- depositEndTime?:
213
- | Date
214
- | undefined;
215
- /** total_deposit is the total deposit on the proposal. */
216
- totalDeposit: Coin[];
217
- /** voting_start_time is the starting time to vote on a proposal. */
218
- votingStartTime?:
219
- | Date
220
- | undefined;
221
- /** voting_end_time is the end time of voting on a proposal. */
222
- votingEndTime?: Date | undefined;
223
- }
224
-
225
- /** TallyResult defines a standard tally for a governance proposal. */
226
- export interface TallyResult {
227
- /** yes is the number of yes votes on a proposal. */
228
- yes: string;
229
- /** abstain is the number of abstain votes on a proposal. */
230
- abstain: string;
231
- /** no is the number of no votes on a proposal. */
232
- no: string;
233
- /** no_with_veto is the number of no with veto votes on a proposal. */
234
- noWithVeto: string;
235
- }
236
-
237
- /**
238
- * Vote defines a vote on a governance proposal.
239
- * A Vote consists of a proposal ID, the voter, and the vote option.
240
- */
241
- export interface Vote {
242
- /** proposal_id defines the unique id of the proposal. */
243
- proposalId: Long;
244
- /** voter is the voter address of the proposal. */
245
- voter: string;
246
- /**
247
- * Deprecated: Prefer to use `options` instead. This field is set in queries
248
- * if and only if `len(options) == 1` and that option has weight 1. In all
249
- * other cases, this field will default to VOTE_OPTION_UNSPECIFIED.
250
- *
251
- * @deprecated
252
- */
253
- option: VoteOption;
254
- /**
255
- * options is the weighted vote options.
256
- *
257
- * Since: cosmos-sdk 0.43
258
- */
259
- options: WeightedVoteOption[];
260
- }
261
-
262
- /** DepositParams defines the params for deposits on governance proposals. */
263
- export interface DepositParams {
264
- /** Minimum deposit for a proposal to enter voting period. */
265
- minDeposit: Coin[];
266
- /**
267
- * Maximum period for Atom holders to deposit on a proposal. Initial value: 2
268
- * months.
269
- */
270
- maxDepositPeriod?: Duration | undefined;
271
- }
272
-
273
- /** VotingParams defines the params for voting on governance proposals. */
274
- export interface VotingParams {
275
- /** Duration of the voting period. */
276
- votingPeriod?: Duration | undefined;
277
- }
278
-
279
- /** TallyParams defines the params for tallying votes on governance proposals. */
280
- export interface TallyParams {
281
- /**
282
- * Minimum percentage of total stake needed to vote for a result to be
283
- * considered valid.
284
- */
285
- quorum: Uint8Array;
286
- /** Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. */
287
- threshold: Uint8Array;
288
- /**
289
- * Minimum value of Veto votes to Total votes ratio for proposal to be
290
- * vetoed. Default value: 1/3.
291
- */
292
- vetoThreshold: Uint8Array;
293
- }
294
-
295
- function createBaseWeightedVoteOption(): WeightedVoteOption {
296
- return { option: 0, weight: "" };
297
- }
298
-
299
- export const WeightedVoteOption = {
300
- encode(message: WeightedVoteOption, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
301
- if (message.option !== 0) {
302
- writer.uint32(8).int32(message.option);
303
- }
304
- if (message.weight !== "") {
305
- writer.uint32(18).string(message.weight);
306
- }
307
- return writer;
308
- },
309
-
310
- decode(input: _m0.Reader | Uint8Array, length?: number): WeightedVoteOption {
311
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
312
- let end = length === undefined ? reader.len : reader.pos + length;
313
- const message = createBaseWeightedVoteOption();
314
- while (reader.pos < end) {
315
- const tag = reader.uint32();
316
- switch (tag >>> 3) {
317
- case 1:
318
- if (tag !== 8) {
319
- break;
320
- }
321
-
322
- message.option = reader.int32() as any;
323
- continue;
324
- case 2:
325
- if (tag !== 18) {
326
- break;
327
- }
328
-
329
- message.weight = reader.string();
330
- continue;
331
- }
332
- if ((tag & 7) === 4 || tag === 0) {
333
- break;
334
- }
335
- reader.skipType(tag & 7);
336
- }
337
- return message;
338
- },
339
-
340
- fromJSON(object: any): WeightedVoteOption {
341
- return {
342
- option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0,
343
- weight: isSet(object.weight) ? globalThis.String(object.weight) : "",
344
- };
345
- },
346
-
347
- toJSON(message: WeightedVoteOption): unknown {
348
- const obj: any = {};
349
- if (message.option !== 0) {
350
- obj.option = voteOptionToJSON(message.option);
351
- }
352
- if (message.weight !== "") {
353
- obj.weight = message.weight;
354
- }
355
- return obj;
356
- },
357
-
358
- create<I extends Exact<DeepPartial<WeightedVoteOption>, I>>(base?: I): WeightedVoteOption {
359
- return WeightedVoteOption.fromPartial(base ?? ({} as any));
360
- },
361
- fromPartial<I extends Exact<DeepPartial<WeightedVoteOption>, I>>(object: I): WeightedVoteOption {
362
- const message = createBaseWeightedVoteOption();
363
- message.option = object.option ?? 0;
364
- message.weight = object.weight ?? "";
365
- return message;
366
- },
367
- };
368
-
369
- function createBaseTextProposal(): TextProposal {
370
- return { title: "", description: "" };
371
- }
372
-
373
- export const TextProposal = {
374
- encode(message: TextProposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
375
- if (message.title !== "") {
376
- writer.uint32(10).string(message.title);
377
- }
378
- if (message.description !== "") {
379
- writer.uint32(18).string(message.description);
380
- }
381
- return writer;
382
- },
383
-
384
- decode(input: _m0.Reader | Uint8Array, length?: number): TextProposal {
385
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
386
- let end = length === undefined ? reader.len : reader.pos + length;
387
- const message = createBaseTextProposal();
388
- while (reader.pos < end) {
389
- const tag = reader.uint32();
390
- switch (tag >>> 3) {
391
- case 1:
392
- if (tag !== 10) {
393
- break;
394
- }
395
-
396
- message.title = reader.string();
397
- continue;
398
- case 2:
399
- if (tag !== 18) {
400
- break;
401
- }
402
-
403
- message.description = reader.string();
404
- continue;
405
- }
406
- if ((tag & 7) === 4 || tag === 0) {
407
- break;
408
- }
409
- reader.skipType(tag & 7);
410
- }
411
- return message;
412
- },
413
-
414
- fromJSON(object: any): TextProposal {
415
- return {
416
- title: isSet(object.title) ? globalThis.String(object.title) : "",
417
- description: isSet(object.description) ? globalThis.String(object.description) : "",
418
- };
419
- },
420
-
421
- toJSON(message: TextProposal): unknown {
422
- const obj: any = {};
423
- if (message.title !== "") {
424
- obj.title = message.title;
425
- }
426
- if (message.description !== "") {
427
- obj.description = message.description;
428
- }
429
- return obj;
430
- },
431
-
432
- create<I extends Exact<DeepPartial<TextProposal>, I>>(base?: I): TextProposal {
433
- return TextProposal.fromPartial(base ?? ({} as any));
434
- },
435
- fromPartial<I extends Exact<DeepPartial<TextProposal>, I>>(object: I): TextProposal {
436
- const message = createBaseTextProposal();
437
- message.title = object.title ?? "";
438
- message.description = object.description ?? "";
439
- return message;
440
- },
441
- };
442
-
443
- function createBaseDeposit(): Deposit {
444
- return { proposalId: Long.UZERO, depositor: "", amount: [] };
445
- }
446
-
447
- export const Deposit = {
448
- encode(message: Deposit, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
449
- if (!message.proposalId.equals(Long.UZERO)) {
450
- writer.uint32(8).uint64(message.proposalId);
451
- }
452
- if (message.depositor !== "") {
453
- writer.uint32(18).string(message.depositor);
454
- }
455
- for (const v of message.amount) {
456
- Coin.encode(v!, writer.uint32(26).fork()).ldelim();
457
- }
458
- return writer;
459
- },
460
-
461
- decode(input: _m0.Reader | Uint8Array, length?: number): Deposit {
462
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
463
- let end = length === undefined ? reader.len : reader.pos + length;
464
- const message = createBaseDeposit();
465
- while (reader.pos < end) {
466
- const tag = reader.uint32();
467
- switch (tag >>> 3) {
468
- case 1:
469
- if (tag !== 8) {
470
- break;
471
- }
472
-
473
- message.proposalId = reader.uint64() as Long;
474
- continue;
475
- case 2:
476
- if (tag !== 18) {
477
- break;
478
- }
479
-
480
- message.depositor = reader.string();
481
- continue;
482
- case 3:
483
- if (tag !== 26) {
484
- break;
485
- }
486
-
487
- message.amount.push(Coin.decode(reader, reader.uint32()));
488
- continue;
489
- }
490
- if ((tag & 7) === 4 || tag === 0) {
491
- break;
492
- }
493
- reader.skipType(tag & 7);
494
- }
495
- return message;
496
- },
497
-
498
- fromJSON(object: any): Deposit {
499
- return {
500
- proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO,
501
- depositor: isSet(object.depositor) ? globalThis.String(object.depositor) : "",
502
- amount: globalThis.Array.isArray(object?.amount) ? object.amount.map((e: any) => Coin.fromJSON(e)) : [],
503
- };
504
- },
505
-
506
- toJSON(message: Deposit): unknown {
507
- const obj: any = {};
508
- if (!message.proposalId.equals(Long.UZERO)) {
509
- obj.proposalId = (message.proposalId || Long.UZERO).toString();
510
- }
511
- if (message.depositor !== "") {
512
- obj.depositor = message.depositor;
513
- }
514
- if (message.amount?.length) {
515
- obj.amount = message.amount.map((e) => Coin.toJSON(e));
516
- }
517
- return obj;
518
- },
519
-
520
- create<I extends Exact<DeepPartial<Deposit>, I>>(base?: I): Deposit {
521
- return Deposit.fromPartial(base ?? ({} as any));
522
- },
523
- fromPartial<I extends Exact<DeepPartial<Deposit>, I>>(object: I): Deposit {
524
- const message = createBaseDeposit();
525
- message.proposalId = (object.proposalId !== undefined && object.proposalId !== null)
526
- ? Long.fromValue(object.proposalId)
527
- : Long.UZERO;
528
- message.depositor = object.depositor ?? "";
529
- message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || [];
530
- return message;
531
- },
532
- };
533
-
534
- function createBaseProposal(): Proposal {
535
- return {
536
- proposalId: Long.UZERO,
537
- content: undefined,
538
- status: 0,
539
- finalTallyResult: undefined,
540
- submitTime: undefined,
541
- depositEndTime: undefined,
542
- totalDeposit: [],
543
- votingStartTime: undefined,
544
- votingEndTime: undefined,
545
- };
546
- }
547
-
548
- export const Proposal = {
549
- encode(message: Proposal, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
550
- if (!message.proposalId.equals(Long.UZERO)) {
551
- writer.uint32(8).uint64(message.proposalId);
552
- }
553
- if (message.content !== undefined) {
554
- Any.encode(message.content, writer.uint32(18).fork()).ldelim();
555
- }
556
- if (message.status !== 0) {
557
- writer.uint32(24).int32(message.status);
558
- }
559
- if (message.finalTallyResult !== undefined) {
560
- TallyResult.encode(message.finalTallyResult, writer.uint32(34).fork()).ldelim();
561
- }
562
- if (message.submitTime !== undefined) {
563
- Timestamp.encode(toTimestamp(message.submitTime), writer.uint32(42).fork()).ldelim();
564
- }
565
- if (message.depositEndTime !== undefined) {
566
- Timestamp.encode(toTimestamp(message.depositEndTime), writer.uint32(50).fork()).ldelim();
567
- }
568
- for (const v of message.totalDeposit) {
569
- Coin.encode(v!, writer.uint32(58).fork()).ldelim();
570
- }
571
- if (message.votingStartTime !== undefined) {
572
- Timestamp.encode(toTimestamp(message.votingStartTime), writer.uint32(66).fork()).ldelim();
573
- }
574
- if (message.votingEndTime !== undefined) {
575
- Timestamp.encode(toTimestamp(message.votingEndTime), writer.uint32(74).fork()).ldelim();
576
- }
577
- return writer;
578
- },
579
-
580
- decode(input: _m0.Reader | Uint8Array, length?: number): Proposal {
581
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
582
- let end = length === undefined ? reader.len : reader.pos + length;
583
- const message = createBaseProposal();
584
- while (reader.pos < end) {
585
- const tag = reader.uint32();
586
- switch (tag >>> 3) {
587
- case 1:
588
- if (tag !== 8) {
589
- break;
590
- }
591
-
592
- message.proposalId = reader.uint64() as Long;
593
- continue;
594
- case 2:
595
- if (tag !== 18) {
596
- break;
597
- }
598
-
599
- message.content = Any.decode(reader, reader.uint32());
600
- continue;
601
- case 3:
602
- if (tag !== 24) {
603
- break;
604
- }
605
-
606
- message.status = reader.int32() as any;
607
- continue;
608
- case 4:
609
- if (tag !== 34) {
610
- break;
611
- }
612
-
613
- message.finalTallyResult = TallyResult.decode(reader, reader.uint32());
614
- continue;
615
- case 5:
616
- if (tag !== 42) {
617
- break;
618
- }
619
-
620
- message.submitTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
621
- continue;
622
- case 6:
623
- if (tag !== 50) {
624
- break;
625
- }
626
-
627
- message.depositEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
628
- continue;
629
- case 7:
630
- if (tag !== 58) {
631
- break;
632
- }
633
-
634
- message.totalDeposit.push(Coin.decode(reader, reader.uint32()));
635
- continue;
636
- case 8:
637
- if (tag !== 66) {
638
- break;
639
- }
640
-
641
- message.votingStartTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
642
- continue;
643
- case 9:
644
- if (tag !== 74) {
645
- break;
646
- }
647
-
648
- message.votingEndTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
649
- continue;
650
- }
651
- if ((tag & 7) === 4 || tag === 0) {
652
- break;
653
- }
654
- reader.skipType(tag & 7);
655
- }
656
- return message;
657
- },
658
-
659
- fromJSON(object: any): Proposal {
660
- return {
661
- proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO,
662
- content: isSet(object.content) ? Any.fromJSON(object.content) : undefined,
663
- status: isSet(object.status) ? proposalStatusFromJSON(object.status) : 0,
664
- finalTallyResult: isSet(object.finalTallyResult) ? TallyResult.fromJSON(object.finalTallyResult) : undefined,
665
- submitTime: isSet(object.submitTime) ? fromJsonTimestamp(object.submitTime) : undefined,
666
- depositEndTime: isSet(object.depositEndTime) ? fromJsonTimestamp(object.depositEndTime) : undefined,
667
- totalDeposit: globalThis.Array.isArray(object?.totalDeposit)
668
- ? object.totalDeposit.map((e: any) => Coin.fromJSON(e))
669
- : [],
670
- votingStartTime: isSet(object.votingStartTime) ? fromJsonTimestamp(object.votingStartTime) : undefined,
671
- votingEndTime: isSet(object.votingEndTime) ? fromJsonTimestamp(object.votingEndTime) : undefined,
672
- };
673
- },
674
-
675
- toJSON(message: Proposal): unknown {
676
- const obj: any = {};
677
- if (!message.proposalId.equals(Long.UZERO)) {
678
- obj.proposalId = (message.proposalId || Long.UZERO).toString();
679
- }
680
- if (message.content !== undefined) {
681
- obj.content = Any.toJSON(message.content);
682
- }
683
- if (message.status !== 0) {
684
- obj.status = proposalStatusToJSON(message.status);
685
- }
686
- if (message.finalTallyResult !== undefined) {
687
- obj.finalTallyResult = TallyResult.toJSON(message.finalTallyResult);
688
- }
689
- if (message.submitTime !== undefined) {
690
- obj.submitTime = message.submitTime.toISOString();
691
- }
692
- if (message.depositEndTime !== undefined) {
693
- obj.depositEndTime = message.depositEndTime.toISOString();
694
- }
695
- if (message.totalDeposit?.length) {
696
- obj.totalDeposit = message.totalDeposit.map((e) => Coin.toJSON(e));
697
- }
698
- if (message.votingStartTime !== undefined) {
699
- obj.votingStartTime = message.votingStartTime.toISOString();
700
- }
701
- if (message.votingEndTime !== undefined) {
702
- obj.votingEndTime = message.votingEndTime.toISOString();
703
- }
704
- return obj;
705
- },
706
-
707
- create<I extends Exact<DeepPartial<Proposal>, I>>(base?: I): Proposal {
708
- return Proposal.fromPartial(base ?? ({} as any));
709
- },
710
- fromPartial<I extends Exact<DeepPartial<Proposal>, I>>(object: I): Proposal {
711
- const message = createBaseProposal();
712
- message.proposalId = (object.proposalId !== undefined && object.proposalId !== null)
713
- ? Long.fromValue(object.proposalId)
714
- : Long.UZERO;
715
- message.content = (object.content !== undefined && object.content !== null)
716
- ? Any.fromPartial(object.content)
717
- : undefined;
718
- message.status = object.status ?? 0;
719
- message.finalTallyResult = (object.finalTallyResult !== undefined && object.finalTallyResult !== null)
720
- ? TallyResult.fromPartial(object.finalTallyResult)
721
- : undefined;
722
- message.submitTime = object.submitTime ?? undefined;
723
- message.depositEndTime = object.depositEndTime ?? undefined;
724
- message.totalDeposit = object.totalDeposit?.map((e) => Coin.fromPartial(e)) || [];
725
- message.votingStartTime = object.votingStartTime ?? undefined;
726
- message.votingEndTime = object.votingEndTime ?? undefined;
727
- return message;
728
- },
729
- };
730
-
731
- function createBaseTallyResult(): TallyResult {
732
- return { yes: "", abstain: "", no: "", noWithVeto: "" };
733
- }
734
-
735
- export const TallyResult = {
736
- encode(message: TallyResult, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
737
- if (message.yes !== "") {
738
- writer.uint32(10).string(message.yes);
739
- }
740
- if (message.abstain !== "") {
741
- writer.uint32(18).string(message.abstain);
742
- }
743
- if (message.no !== "") {
744
- writer.uint32(26).string(message.no);
745
- }
746
- if (message.noWithVeto !== "") {
747
- writer.uint32(34).string(message.noWithVeto);
748
- }
749
- return writer;
750
- },
751
-
752
- decode(input: _m0.Reader | Uint8Array, length?: number): TallyResult {
753
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
754
- let end = length === undefined ? reader.len : reader.pos + length;
755
- const message = createBaseTallyResult();
756
- while (reader.pos < end) {
757
- const tag = reader.uint32();
758
- switch (tag >>> 3) {
759
- case 1:
760
- if (tag !== 10) {
761
- break;
762
- }
763
-
764
- message.yes = reader.string();
765
- continue;
766
- case 2:
767
- if (tag !== 18) {
768
- break;
769
- }
770
-
771
- message.abstain = reader.string();
772
- continue;
773
- case 3:
774
- if (tag !== 26) {
775
- break;
776
- }
777
-
778
- message.no = reader.string();
779
- continue;
780
- case 4:
781
- if (tag !== 34) {
782
- break;
783
- }
784
-
785
- message.noWithVeto = reader.string();
786
- continue;
787
- }
788
- if ((tag & 7) === 4 || tag === 0) {
789
- break;
790
- }
791
- reader.skipType(tag & 7);
792
- }
793
- return message;
794
- },
795
-
796
- fromJSON(object: any): TallyResult {
797
- return {
798
- yes: isSet(object.yes) ? globalThis.String(object.yes) : "",
799
- abstain: isSet(object.abstain) ? globalThis.String(object.abstain) : "",
800
- no: isSet(object.no) ? globalThis.String(object.no) : "",
801
- noWithVeto: isSet(object.noWithVeto) ? globalThis.String(object.noWithVeto) : "",
802
- };
803
- },
804
-
805
- toJSON(message: TallyResult): unknown {
806
- const obj: any = {};
807
- if (message.yes !== "") {
808
- obj.yes = message.yes;
809
- }
810
- if (message.abstain !== "") {
811
- obj.abstain = message.abstain;
812
- }
813
- if (message.no !== "") {
814
- obj.no = message.no;
815
- }
816
- if (message.noWithVeto !== "") {
817
- obj.noWithVeto = message.noWithVeto;
818
- }
819
- return obj;
820
- },
821
-
822
- create<I extends Exact<DeepPartial<TallyResult>, I>>(base?: I): TallyResult {
823
- return TallyResult.fromPartial(base ?? ({} as any));
824
- },
825
- fromPartial<I extends Exact<DeepPartial<TallyResult>, I>>(object: I): TallyResult {
826
- const message = createBaseTallyResult();
827
- message.yes = object.yes ?? "";
828
- message.abstain = object.abstain ?? "";
829
- message.no = object.no ?? "";
830
- message.noWithVeto = object.noWithVeto ?? "";
831
- return message;
832
- },
833
- };
834
-
835
- function createBaseVote(): Vote {
836
- return { proposalId: Long.UZERO, voter: "", option: 0, options: [] };
837
- }
838
-
839
- export const Vote = {
840
- encode(message: Vote, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
841
- if (!message.proposalId.equals(Long.UZERO)) {
842
- writer.uint32(8).uint64(message.proposalId);
843
- }
844
- if (message.voter !== "") {
845
- writer.uint32(18).string(message.voter);
846
- }
847
- if (message.option !== 0) {
848
- writer.uint32(24).int32(message.option);
849
- }
850
- for (const v of message.options) {
851
- WeightedVoteOption.encode(v!, writer.uint32(34).fork()).ldelim();
852
- }
853
- return writer;
854
- },
855
-
856
- decode(input: _m0.Reader | Uint8Array, length?: number): Vote {
857
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
858
- let end = length === undefined ? reader.len : reader.pos + length;
859
- const message = createBaseVote();
860
- while (reader.pos < end) {
861
- const tag = reader.uint32();
862
- switch (tag >>> 3) {
863
- case 1:
864
- if (tag !== 8) {
865
- break;
866
- }
867
-
868
- message.proposalId = reader.uint64() as Long;
869
- continue;
870
- case 2:
871
- if (tag !== 18) {
872
- break;
873
- }
874
-
875
- message.voter = reader.string();
876
- continue;
877
- case 3:
878
- if (tag !== 24) {
879
- break;
880
- }
881
-
882
- message.option = reader.int32() as any;
883
- continue;
884
- case 4:
885
- if (tag !== 34) {
886
- break;
887
- }
888
-
889
- message.options.push(WeightedVoteOption.decode(reader, reader.uint32()));
890
- continue;
891
- }
892
- if ((tag & 7) === 4 || tag === 0) {
893
- break;
894
- }
895
- reader.skipType(tag & 7);
896
- }
897
- return message;
898
- },
899
-
900
- fromJSON(object: any): Vote {
901
- return {
902
- proposalId: isSet(object.proposalId) ? Long.fromValue(object.proposalId) : Long.UZERO,
903
- voter: isSet(object.voter) ? globalThis.String(object.voter) : "",
904
- option: isSet(object.option) ? voteOptionFromJSON(object.option) : 0,
905
- options: globalThis.Array.isArray(object?.options)
906
- ? object.options.map((e: any) => WeightedVoteOption.fromJSON(e))
907
- : [],
908
- };
909
- },
910
-
911
- toJSON(message: Vote): unknown {
912
- const obj: any = {};
913
- if (!message.proposalId.equals(Long.UZERO)) {
914
- obj.proposalId = (message.proposalId || Long.UZERO).toString();
915
- }
916
- if (message.voter !== "") {
917
- obj.voter = message.voter;
918
- }
919
- if (message.option !== 0) {
920
- obj.option = voteOptionToJSON(message.option);
921
- }
922
- if (message.options?.length) {
923
- obj.options = message.options.map((e) => WeightedVoteOption.toJSON(e));
924
- }
925
- return obj;
926
- },
927
-
928
- create<I extends Exact<DeepPartial<Vote>, I>>(base?: I): Vote {
929
- return Vote.fromPartial(base ?? ({} as any));
930
- },
931
- fromPartial<I extends Exact<DeepPartial<Vote>, I>>(object: I): Vote {
932
- const message = createBaseVote();
933
- message.proposalId = (object.proposalId !== undefined && object.proposalId !== null)
934
- ? Long.fromValue(object.proposalId)
935
- : Long.UZERO;
936
- message.voter = object.voter ?? "";
937
- message.option = object.option ?? 0;
938
- message.options = object.options?.map((e) => WeightedVoteOption.fromPartial(e)) || [];
939
- return message;
940
- },
941
- };
942
-
943
- function createBaseDepositParams(): DepositParams {
944
- return { minDeposit: [], maxDepositPeriod: undefined };
945
- }
946
-
947
- export const DepositParams = {
948
- encode(message: DepositParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
949
- for (const v of message.minDeposit) {
950
- Coin.encode(v!, writer.uint32(10).fork()).ldelim();
951
- }
952
- if (message.maxDepositPeriod !== undefined) {
953
- Duration.encode(message.maxDepositPeriod, writer.uint32(18).fork()).ldelim();
954
- }
955
- return writer;
956
- },
957
-
958
- decode(input: _m0.Reader | Uint8Array, length?: number): DepositParams {
959
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
960
- let end = length === undefined ? reader.len : reader.pos + length;
961
- const message = createBaseDepositParams();
962
- while (reader.pos < end) {
963
- const tag = reader.uint32();
964
- switch (tag >>> 3) {
965
- case 1:
966
- if (tag !== 10) {
967
- break;
968
- }
969
-
970
- message.minDeposit.push(Coin.decode(reader, reader.uint32()));
971
- continue;
972
- case 2:
973
- if (tag !== 18) {
974
- break;
975
- }
976
-
977
- message.maxDepositPeriod = Duration.decode(reader, reader.uint32());
978
- continue;
979
- }
980
- if ((tag & 7) === 4 || tag === 0) {
981
- break;
982
- }
983
- reader.skipType(tag & 7);
984
- }
985
- return message;
986
- },
987
-
988
- fromJSON(object: any): DepositParams {
989
- return {
990
- minDeposit: globalThis.Array.isArray(object?.minDeposit)
991
- ? object.minDeposit.map((e: any) => Coin.fromJSON(e))
992
- : [],
993
- maxDepositPeriod: isSet(object.maxDepositPeriod) ? Duration.fromJSON(object.maxDepositPeriod) : undefined,
994
- };
995
- },
996
-
997
- toJSON(message: DepositParams): unknown {
998
- const obj: any = {};
999
- if (message.minDeposit?.length) {
1000
- obj.minDeposit = message.minDeposit.map((e) => Coin.toJSON(e));
1001
- }
1002
- if (message.maxDepositPeriod !== undefined) {
1003
- obj.maxDepositPeriod = Duration.toJSON(message.maxDepositPeriod);
1004
- }
1005
- return obj;
1006
- },
1007
-
1008
- create<I extends Exact<DeepPartial<DepositParams>, I>>(base?: I): DepositParams {
1009
- return DepositParams.fromPartial(base ?? ({} as any));
1010
- },
1011
- fromPartial<I extends Exact<DeepPartial<DepositParams>, I>>(object: I): DepositParams {
1012
- const message = createBaseDepositParams();
1013
- message.minDeposit = object.minDeposit?.map((e) => Coin.fromPartial(e)) || [];
1014
- message.maxDepositPeriod = (object.maxDepositPeriod !== undefined && object.maxDepositPeriod !== null)
1015
- ? Duration.fromPartial(object.maxDepositPeriod)
1016
- : undefined;
1017
- return message;
1018
- },
1019
- };
1020
-
1021
- function createBaseVotingParams(): VotingParams {
1022
- return { votingPeriod: undefined };
1023
- }
1024
-
1025
- export const VotingParams = {
1026
- encode(message: VotingParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1027
- if (message.votingPeriod !== undefined) {
1028
- Duration.encode(message.votingPeriod, writer.uint32(10).fork()).ldelim();
1029
- }
1030
- return writer;
1031
- },
1032
-
1033
- decode(input: _m0.Reader | Uint8Array, length?: number): VotingParams {
1034
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1035
- let end = length === undefined ? reader.len : reader.pos + length;
1036
- const message = createBaseVotingParams();
1037
- while (reader.pos < end) {
1038
- const tag = reader.uint32();
1039
- switch (tag >>> 3) {
1040
- case 1:
1041
- if (tag !== 10) {
1042
- break;
1043
- }
1044
-
1045
- message.votingPeriod = Duration.decode(reader, reader.uint32());
1046
- continue;
1047
- }
1048
- if ((tag & 7) === 4 || tag === 0) {
1049
- break;
1050
- }
1051
- reader.skipType(tag & 7);
1052
- }
1053
- return message;
1054
- },
1055
-
1056
- fromJSON(object: any): VotingParams {
1057
- return { votingPeriod: isSet(object.votingPeriod) ? Duration.fromJSON(object.votingPeriod) : undefined };
1058
- },
1059
-
1060
- toJSON(message: VotingParams): unknown {
1061
- const obj: any = {};
1062
- if (message.votingPeriod !== undefined) {
1063
- obj.votingPeriod = Duration.toJSON(message.votingPeriod);
1064
- }
1065
- return obj;
1066
- },
1067
-
1068
- create<I extends Exact<DeepPartial<VotingParams>, I>>(base?: I): VotingParams {
1069
- return VotingParams.fromPartial(base ?? ({} as any));
1070
- },
1071
- fromPartial<I extends Exact<DeepPartial<VotingParams>, I>>(object: I): VotingParams {
1072
- const message = createBaseVotingParams();
1073
- message.votingPeriod = (object.votingPeriod !== undefined && object.votingPeriod !== null)
1074
- ? Duration.fromPartial(object.votingPeriod)
1075
- : undefined;
1076
- return message;
1077
- },
1078
- };
1079
-
1080
- function createBaseTallyParams(): TallyParams {
1081
- return { quorum: new Uint8Array(0), threshold: new Uint8Array(0), vetoThreshold: new Uint8Array(0) };
1082
- }
1083
-
1084
- export const TallyParams = {
1085
- encode(message: TallyParams, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
1086
- if (message.quorum.length !== 0) {
1087
- writer.uint32(10).bytes(message.quorum);
1088
- }
1089
- if (message.threshold.length !== 0) {
1090
- writer.uint32(18).bytes(message.threshold);
1091
- }
1092
- if (message.vetoThreshold.length !== 0) {
1093
- writer.uint32(26).bytes(message.vetoThreshold);
1094
- }
1095
- return writer;
1096
- },
1097
-
1098
- decode(input: _m0.Reader | Uint8Array, length?: number): TallyParams {
1099
- const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input);
1100
- let end = length === undefined ? reader.len : reader.pos + length;
1101
- const message = createBaseTallyParams();
1102
- while (reader.pos < end) {
1103
- const tag = reader.uint32();
1104
- switch (tag >>> 3) {
1105
- case 1:
1106
- if (tag !== 10) {
1107
- break;
1108
- }
1109
-
1110
- message.quorum = reader.bytes();
1111
- continue;
1112
- case 2:
1113
- if (tag !== 18) {
1114
- break;
1115
- }
1116
-
1117
- message.threshold = reader.bytes();
1118
- continue;
1119
- case 3:
1120
- if (tag !== 26) {
1121
- break;
1122
- }
1123
-
1124
- message.vetoThreshold = reader.bytes();
1125
- continue;
1126
- }
1127
- if ((tag & 7) === 4 || tag === 0) {
1128
- break;
1129
- }
1130
- reader.skipType(tag & 7);
1131
- }
1132
- return message;
1133
- },
1134
-
1135
- fromJSON(object: any): TallyParams {
1136
- return {
1137
- quorum: isSet(object.quorum) ? bytesFromBase64(object.quorum) : new Uint8Array(0),
1138
- threshold: isSet(object.threshold) ? bytesFromBase64(object.threshold) : new Uint8Array(0),
1139
- vetoThreshold: isSet(object.vetoThreshold) ? bytesFromBase64(object.vetoThreshold) : new Uint8Array(0),
1140
- };
1141
- },
1142
-
1143
- toJSON(message: TallyParams): unknown {
1144
- const obj: any = {};
1145
- if (message.quorum.length !== 0) {
1146
- obj.quorum = base64FromBytes(message.quorum);
1147
- }
1148
- if (message.threshold.length !== 0) {
1149
- obj.threshold = base64FromBytes(message.threshold);
1150
- }
1151
- if (message.vetoThreshold.length !== 0) {
1152
- obj.vetoThreshold = base64FromBytes(message.vetoThreshold);
1153
- }
1154
- return obj;
1155
- },
1156
-
1157
- create<I extends Exact<DeepPartial<TallyParams>, I>>(base?: I): TallyParams {
1158
- return TallyParams.fromPartial(base ?? ({} as any));
1159
- },
1160
- fromPartial<I extends Exact<DeepPartial<TallyParams>, I>>(object: I): TallyParams {
1161
- const message = createBaseTallyParams();
1162
- message.quorum = object.quorum ?? new Uint8Array(0);
1163
- message.threshold = object.threshold ?? new Uint8Array(0);
1164
- message.vetoThreshold = object.vetoThreshold ?? new Uint8Array(0);
1165
- return message;
1166
- },
1167
- };
1168
-
1169
- function bytesFromBase64(b64: string): Uint8Array {
1170
- if ((globalThis as any).Buffer) {
1171
- return Uint8Array.from(globalThis.Buffer.from(b64, "base64"));
1172
- } else {
1173
- const bin = globalThis.atob(b64);
1174
- const arr = new Uint8Array(bin.length);
1175
- for (let i = 0; i < bin.length; ++i) {
1176
- arr[i] = bin.charCodeAt(i);
1177
- }
1178
- return arr;
1179
- }
1180
- }
1181
-
1182
- function base64FromBytes(arr: Uint8Array): string {
1183
- if ((globalThis as any).Buffer) {
1184
- return globalThis.Buffer.from(arr).toString("base64");
1185
- } else {
1186
- const bin: string[] = [];
1187
- arr.forEach((byte) => {
1188
- bin.push(globalThis.String.fromCharCode(byte));
1189
- });
1190
- return globalThis.btoa(bin.join(""));
1191
- }
1192
- }
1193
-
1194
- type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;
1195
-
1196
- export type DeepPartial<T> = T extends Builtin ? T
1197
- : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>>
1198
- : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>>
1199
- : T extends {} ? { [K in keyof T]?: DeepPartial<T[K]> }
1200
- : Partial<T>;
1201
-
1202
- type KeysOfUnion<T> = T extends T ? keyof T : never;
1203
- export type Exact<P, I extends P> = P extends Builtin ? P
1204
- : P & { [K in keyof P]: Exact<P[K], I[K]> } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never };
1205
-
1206
- function toTimestamp(date: Date): Timestamp {
1207
- const seconds = numberToLong(Math.trunc(date.getTime() / 1_000));
1208
- const nanos = (date.getTime() % 1_000) * 1_000_000;
1209
- return { seconds, nanos };
1210
- }
1211
-
1212
- function fromTimestamp(t: Timestamp): Date {
1213
- let millis = (t.seconds.toNumber() || 0) * 1_000;
1214
- millis += (t.nanos || 0) / 1_000_000;
1215
- return new globalThis.Date(millis);
1216
- }
1217
-
1218
- function fromJsonTimestamp(o: any): Date {
1219
- if (o instanceof globalThis.Date) {
1220
- return o;
1221
- } else if (typeof o === "string") {
1222
- return new globalThis.Date(o);
1223
- } else {
1224
- return fromTimestamp(Timestamp.fromJSON(o));
1225
- }
1226
- }
1227
-
1228
- function numberToLong(number: number) {
1229
- return Long.fromNumber(number);
1230
- }
1231
-
1232
- if (_m0.util.Long !== Long) {
1233
- _m0.util.Long = Long as any;
1234
- _m0.configure();
1235
- }
1236
-
1237
- function isSet(value: any): boolean {
1238
- return value !== null && value !== undefined;
1239
- }