injectivejs 1.9.13 → 1.9.14

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 (40) hide show
  1. package/cosmos/base/v1beta1/coin.js +5 -4
  2. package/cosmos/distribution/v1beta1/distribution.js +11 -10
  3. package/cosmos/gov/v1beta1/gov.js +3 -2
  4. package/cosmos/staking/v1beta1/staking.js +15 -14
  5. package/cosmos/staking/v1beta1/tx.js +3 -2
  6. package/decimals.d.ts +20 -0
  7. package/decimals.js +102 -0
  8. package/esm/cosmos/base/v1beta1/coin.js +5 -4
  9. package/esm/cosmos/distribution/v1beta1/distribution.js +11 -10
  10. package/esm/cosmos/gov/v1beta1/gov.js +3 -2
  11. package/esm/cosmos/staking/v1beta1/staking.js +15 -14
  12. package/esm/cosmos/staking/v1beta1/tx.js +3 -2
  13. package/esm/decimals.js +98 -0
  14. package/esm/injective/auction/v1beta1/auction.js +3 -2
  15. package/esm/injective/exchange/v1beta1/events.js +13 -12
  16. package/esm/injective/exchange/v1beta1/exchange.js +183 -182
  17. package/esm/injective/exchange/v1beta1/genesis.js +5 -4
  18. package/esm/injective/exchange/v1beta1/proposal.js +99 -98
  19. package/esm/injective/exchange/v1beta1/query.js +89 -88
  20. package/esm/injective/exchange/v1beta1/tx.js +81 -80
  21. package/esm/injective/ocr/v1beta1/ocr.js +17 -16
  22. package/esm/injective/oracle/v1beta1/events.js +13 -12
  23. package/esm/injective/oracle/v1beta1/oracle.js +31 -30
  24. package/esm/injective/oracle/v1beta1/query.js +13 -12
  25. package/esm/injective/oracle/v1beta1/tx.js +5 -4
  26. package/esm/injective/stream/v1beta1/query.js +21 -20
  27. package/injective/auction/v1beta1/auction.js +3 -2
  28. package/injective/exchange/v1beta1/events.js +13 -12
  29. package/injective/exchange/v1beta1/exchange.js +183 -182
  30. package/injective/exchange/v1beta1/genesis.js +5 -4
  31. package/injective/exchange/v1beta1/proposal.js +99 -98
  32. package/injective/exchange/v1beta1/query.js +89 -88
  33. package/injective/exchange/v1beta1/tx.js +81 -80
  34. package/injective/ocr/v1beta1/ocr.js +17 -16
  35. package/injective/oracle/v1beta1/events.js +13 -12
  36. package/injective/oracle/v1beta1/oracle.js +31 -30
  37. package/injective/oracle/v1beta1/query.js +13 -12
  38. package/injective/oracle/v1beta1/tx.js +5 -4
  39. package/injective/stream/v1beta1/query.js +21 -20
  40. package/package.json +8 -8
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DecProto = exports.IntProto = exports.DecCoin = exports.Coin = void 0;
4
4
  const binary_1 = require("../../../binary");
5
+ const decimals_1 = require("../../../decimals");
5
6
  function createBaseCoin() {
6
7
  return {
7
8
  denom: "",
@@ -111,7 +112,7 @@ exports.DecCoin = {
111
112
  writer.uint32(10).string(message.denom);
112
113
  }
113
114
  if (message.amount !== "") {
114
- writer.uint32(18).string(message.amount);
115
+ writer.uint32(18).string(decimals_1.Decimal.fromUserInput(message.amount, 18).atomics);
115
116
  }
116
117
  return writer;
117
118
  },
@@ -126,7 +127,7 @@ exports.DecCoin = {
126
127
  message.denom = reader.string();
127
128
  break;
128
129
  case 2:
129
- message.amount = reader.string();
130
+ message.amount = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
130
131
  break;
131
132
  default:
132
133
  reader.skipType(tag & 7);
@@ -273,7 +274,7 @@ exports.DecProto = {
273
274
  },
274
275
  encode(message, writer = binary_1.BinaryWriter.create()) {
275
276
  if (message.dec !== "") {
276
- writer.uint32(10).string(message.dec);
277
+ writer.uint32(10).string(decimals_1.Decimal.fromUserInput(message.dec, 18).atomics);
277
278
  }
278
279
  return writer;
279
280
  },
@@ -285,7 +286,7 @@ exports.DecProto = {
285
286
  const tag = reader.uint32();
286
287
  switch (tag >>> 3) {
287
288
  case 1:
288
- message.dec = reader.string();
289
+ message.dec = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
289
290
  break;
290
291
  default:
291
292
  reader.skipType(tag & 7);
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.CommunityPoolSpendProposalWithDeposit = exports.DelegationDelegatorReward = exports.DelegatorStartingInfo = exports.CommunityPoolSpendProposal = exports.FeePool = exports.ValidatorSlashEvents = exports.ValidatorSlashEvent = exports.ValidatorOutstandingRewards = exports.ValidatorAccumulatedCommission = exports.ValidatorCurrentRewards = exports.ValidatorHistoricalRewards = exports.Params = void 0;
4
4
  const coin_1 = require("../../base/v1beta1/coin");
5
5
  const binary_1 = require("../../../binary");
6
+ const decimals_1 = require("../../../decimals");
6
7
  const registry_1 = require("../../../registry");
7
8
  function createBaseParams() {
8
9
  return {
@@ -23,13 +24,13 @@ exports.Params = {
23
24
  },
24
25
  encode(message, writer = binary_1.BinaryWriter.create()) {
25
26
  if (message.communityTax !== "") {
26
- writer.uint32(10).string(message.communityTax);
27
+ writer.uint32(10).string(decimals_1.Decimal.fromUserInput(message.communityTax, 18).atomics);
27
28
  }
28
29
  if (message.baseProposerReward !== "") {
29
- writer.uint32(18).string(message.baseProposerReward);
30
+ writer.uint32(18).string(decimals_1.Decimal.fromUserInput(message.baseProposerReward, 18).atomics);
30
31
  }
31
32
  if (message.bonusProposerReward !== "") {
32
- writer.uint32(26).string(message.bonusProposerReward);
33
+ writer.uint32(26).string(decimals_1.Decimal.fromUserInput(message.bonusProposerReward, 18).atomics);
33
34
  }
34
35
  if (message.withdrawAddrEnabled === true) {
35
36
  writer.uint32(32).bool(message.withdrawAddrEnabled);
@@ -44,13 +45,13 @@ exports.Params = {
44
45
  const tag = reader.uint32();
45
46
  switch (tag >>> 3) {
46
47
  case 1:
47
- message.communityTax = reader.string();
48
+ message.communityTax = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
48
49
  break;
49
50
  case 2:
50
- message.baseProposerReward = reader.string();
51
+ message.baseProposerReward = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
51
52
  break;
52
53
  case 3:
53
- message.bonusProposerReward = reader.string();
54
+ message.bonusProposerReward = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
54
55
  break;
55
56
  case 4:
56
57
  message.withdrawAddrEnabled = reader.bool();
@@ -489,7 +490,7 @@ exports.ValidatorSlashEvent = {
489
490
  writer.uint32(8).uint64(message.validatorPeriod);
490
491
  }
491
492
  if (message.fraction !== "") {
492
- writer.uint32(18).string(message.fraction);
493
+ writer.uint32(18).string(decimals_1.Decimal.fromUserInput(message.fraction, 18).atomics);
493
494
  }
494
495
  return writer;
495
496
  },
@@ -504,7 +505,7 @@ exports.ValidatorSlashEvent = {
504
505
  message.validatorPeriod = reader.uint64();
505
506
  break;
506
507
  case 2:
507
- message.fraction = reader.string();
508
+ message.fraction = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
508
509
  break;
509
510
  default:
510
511
  reader.skipType(tag & 7);
@@ -863,7 +864,7 @@ exports.DelegatorStartingInfo = {
863
864
  writer.uint32(8).uint64(message.previousPeriod);
864
865
  }
865
866
  if (message.stake !== "") {
866
- writer.uint32(18).string(message.stake);
867
+ writer.uint32(18).string(decimals_1.Decimal.fromUserInput(message.stake, 18).atomics);
867
868
  }
868
869
  if (message.height !== BigInt(0)) {
869
870
  writer.uint32(24).uint64(message.height);
@@ -881,7 +882,7 @@ exports.DelegatorStartingInfo = {
881
882
  message.previousPeriod = reader.uint64();
882
883
  break;
883
884
  case 2:
884
- message.stake = reader.string();
885
+ message.stake = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
885
886
  break;
886
887
  case 3:
887
888
  message.height = reader.uint64();
@@ -19,6 +19,7 @@ const proposal_3 = require("../../../injective/peggy/v1/proposal");
19
19
  const proposal_4 = require("../../../injective/wasmx/v1/proposal");
20
20
  const helpers_1 = require("../../../helpers");
21
21
  const binary_1 = require("../../../binary");
22
+ const decimals_1 = require("../../../decimals");
22
23
  const registry_1 = require("../../../registry");
23
24
  /** VoteOption enumerates the valid vote options for a given governance proposal. */
24
25
  var VoteOption;
@@ -174,7 +175,7 @@ exports.WeightedVoteOption = {
174
175
  writer.uint32(8).int32(message.option);
175
176
  }
176
177
  if (message.weight !== "") {
177
- writer.uint32(18).string(message.weight);
178
+ writer.uint32(18).string(decimals_1.Decimal.fromUserInput(message.weight, 18).atomics);
178
179
  }
179
180
  return writer;
180
181
  },
@@ -189,7 +190,7 @@ exports.WeightedVoteOption = {
189
190
  message.option = reader.int32();
190
191
  break;
191
192
  case 2:
192
- message.weight = reader.string();
193
+ message.weight = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
193
194
  break;
194
195
  default:
195
196
  reader.skipType(tag & 7);
@@ -14,6 +14,7 @@ const types_2 = require("../../../tendermint/abci/types");
14
14
  const binary_1 = require("../../../binary");
15
15
  const registry_1 = require("../../../registry");
16
16
  const helpers_1 = require("../../../helpers");
17
+ const decimals_1 = require("../../../decimals");
17
18
  const pubkey_1 = require("@interchainjs/pubkey");
18
19
  /** BondStatus is the status of a validator. */
19
20
  var BondStatus;
@@ -219,13 +220,13 @@ exports.CommissionRates = {
219
220
  },
220
221
  encode(message, writer = binary_1.BinaryWriter.create()) {
221
222
  if (message.rate !== "") {
222
- writer.uint32(10).string(message.rate);
223
+ writer.uint32(10).string(decimals_1.Decimal.fromUserInput(message.rate, 18).atomics);
223
224
  }
224
225
  if (message.maxRate !== "") {
225
- writer.uint32(18).string(message.maxRate);
226
+ writer.uint32(18).string(decimals_1.Decimal.fromUserInput(message.maxRate, 18).atomics);
226
227
  }
227
228
  if (message.maxChangeRate !== "") {
228
- writer.uint32(26).string(message.maxChangeRate);
229
+ writer.uint32(26).string(decimals_1.Decimal.fromUserInput(message.maxChangeRate, 18).atomics);
229
230
  }
230
231
  return writer;
231
232
  },
@@ -237,13 +238,13 @@ exports.CommissionRates = {
237
238
  const tag = reader.uint32();
238
239
  switch (tag >>> 3) {
239
240
  case 1:
240
- message.rate = reader.string();
241
+ message.rate = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
241
242
  break;
242
243
  case 2:
243
- message.maxRate = reader.string();
244
+ message.maxRate = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
244
245
  break;
245
246
  case 3:
246
- message.maxChangeRate = reader.string();
247
+ message.maxChangeRate = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
247
248
  break;
248
249
  default:
249
250
  reader.skipType(tag & 7);
@@ -561,7 +562,7 @@ exports.Validator = {
561
562
  writer.uint32(42).string(message.tokens);
562
563
  }
563
564
  if (message.delegatorShares !== "") {
564
- writer.uint32(50).string(message.delegatorShares);
565
+ writer.uint32(50).string(decimals_1.Decimal.fromUserInput(message.delegatorShares, 18).atomics);
565
566
  }
566
567
  if (message.description !== undefined) {
567
568
  exports.Description.encode(message.description, writer.uint32(58).fork()).ldelim();
@@ -611,7 +612,7 @@ exports.Validator = {
611
612
  message.tokens = reader.string();
612
613
  break;
613
614
  case 6:
614
- message.delegatorShares = reader.string();
615
+ message.delegatorShares = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
615
616
  break;
616
617
  case 7:
617
618
  message.description = exports.Description.decode(reader, reader.uint32());
@@ -1213,7 +1214,7 @@ exports.Delegation = {
1213
1214
  writer.uint32(18).string(message.validatorAddress);
1214
1215
  }
1215
1216
  if (message.shares !== "") {
1216
- writer.uint32(26).string(message.shares);
1217
+ writer.uint32(26).string(decimals_1.Decimal.fromUserInput(message.shares, 18).atomics);
1217
1218
  }
1218
1219
  return writer;
1219
1220
  },
@@ -1231,7 +1232,7 @@ exports.Delegation = {
1231
1232
  message.validatorAddress = reader.string();
1232
1233
  break;
1233
1234
  case 3:
1234
- message.shares = reader.string();
1235
+ message.shares = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
1235
1236
  break;
1236
1237
  default:
1237
1238
  reader.skipType(tag & 7);
@@ -1563,7 +1564,7 @@ exports.RedelegationEntry = {
1563
1564
  writer.uint32(26).string(message.initialBalance);
1564
1565
  }
1565
1566
  if (message.sharesDst !== "") {
1566
- writer.uint32(34).string(message.sharesDst);
1567
+ writer.uint32(34).string(decimals_1.Decimal.fromUserInput(message.sharesDst, 18).atomics);
1567
1568
  }
1568
1569
  if (message.unbondingId !== BigInt(0)) {
1569
1570
  writer.uint32(40).uint64(message.unbondingId);
@@ -1590,7 +1591,7 @@ exports.RedelegationEntry = {
1590
1591
  message.initialBalance = reader.string();
1591
1592
  break;
1592
1593
  case 4:
1593
- message.sharesDst = reader.string();
1594
+ message.sharesDst = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
1594
1595
  break;
1595
1596
  case 5:
1596
1597
  message.unbondingId = reader.uint64();
@@ -1824,7 +1825,7 @@ exports.Params = {
1824
1825
  writer.uint32(42).string(message.bondDenom);
1825
1826
  }
1826
1827
  if (message.minCommissionRate !== "") {
1827
- writer.uint32(50).string(message.minCommissionRate);
1828
+ writer.uint32(50).string(decimals_1.Decimal.fromUserInput(message.minCommissionRate, 18).atomics);
1828
1829
  }
1829
1830
  return writer;
1830
1831
  },
@@ -1851,7 +1852,7 @@ exports.Params = {
1851
1852
  message.bondDenom = reader.string();
1852
1853
  break;
1853
1854
  case 6:
1854
- message.minCommissionRate = reader.string();
1855
+ message.minCommissionRate = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
1855
1856
  break;
1856
1857
  default:
1857
1858
  reader.skipType(tag & 7);
@@ -9,6 +9,7 @@ const binary_1 = require("../../../binary");
9
9
  const registry_1 = require("../../../registry");
10
10
  const helpers_1 = require("../../../helpers");
11
11
  const pubkey_1 = require("@interchainjs/pubkey");
12
+ const decimals_1 = require("../../../decimals");
12
13
  function createBaseMsgCreateValidator() {
13
14
  return {
14
15
  description: staking_1.Description.fromPartial({}),
@@ -249,7 +250,7 @@ exports.MsgEditValidator = {
249
250
  writer.uint32(18).string(message.validatorAddress);
250
251
  }
251
252
  if (message.commissionRate !== "") {
252
- writer.uint32(26).string(message.commissionRate);
253
+ writer.uint32(26).string(decimals_1.Decimal.fromUserInput(message.commissionRate, 18).atomics);
253
254
  }
254
255
  if (message.minSelfDelegation !== "") {
255
256
  writer.uint32(34).string(message.minSelfDelegation);
@@ -270,7 +271,7 @@ exports.MsgEditValidator = {
270
271
  message.validatorAddress = reader.string();
271
272
  break;
272
273
  case 3:
273
- message.commissionRate = reader.string();
274
+ message.commissionRate = decimals_1.Decimal.fromAtomics(reader.string(), 18).toString();
274
275
  break;
275
276
  case 4:
276
277
  message.minSelfDelegation = reader.string();
package/decimals.d.ts ADDED
@@ -0,0 +1,20 @@
1
+ /**
2
+ * This file and any referenced files were automatically generated by @cosmology/telescope@1.11.20
3
+ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
4
+ * and run the transpile command or npm scripts command that is used to regenerate this bundle.
5
+ */
6
+ /**
7
+ * A type for arbitrary precision, non-negative decimals.
8
+ *
9
+ * Instances of this class are immutable.
10
+ */
11
+ export declare class Decimal {
12
+ static fromUserInput(input: string, fractionalDigits: number): Decimal;
13
+ static fromAtomics(atomics: string, fractionalDigits: number): Decimal;
14
+ private static verifyFractionalDigits;
15
+ get atomics(): string;
16
+ get fractionalDigits(): number;
17
+ private readonly data;
18
+ private constructor();
19
+ toString(): string;
20
+ }
package/decimals.js ADDED
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ /**
3
+ * This file and any referenced files were automatically generated by @cosmology/telescope@1.11.20
4
+ * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain
5
+ * and run the transpile command or npm scripts command that is used to regenerate this bundle.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.Decimal = void 0;
9
+ // The largest value we need is 18 (Ether).
10
+ const maxFractionalDigits = 30;
11
+ /**
12
+ * A type for arbitrary precision, non-negative decimals.
13
+ *
14
+ * Instances of this class are immutable.
15
+ */
16
+ class Decimal {
17
+ static fromUserInput(input, fractionalDigits) {
18
+ Decimal.verifyFractionalDigits(fractionalDigits);
19
+ const badCharacter = input.match(/[^0-9.]/);
20
+ if (badCharacter) {
21
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
22
+ throw new Error(`Invalid character at position ${badCharacter.index + 1}`);
23
+ }
24
+ let whole;
25
+ let fractional;
26
+ if (input === "") {
27
+ whole = "0";
28
+ fractional = "";
29
+ }
30
+ else if (input.search(/\./) === -1) {
31
+ // integer format, no separator
32
+ whole = input;
33
+ fractional = "";
34
+ }
35
+ else {
36
+ const parts = input.split(".");
37
+ switch (parts.length) {
38
+ case 0:
39
+ case 1:
40
+ throw new Error("Fewer than two elements in split result. This must not happen here.");
41
+ case 2:
42
+ if (!parts[1])
43
+ throw new Error("Fractional part missing");
44
+ whole = parts[0];
45
+ fractional = parts[1].replace(/0+$/, "");
46
+ break;
47
+ default:
48
+ throw new Error("More than one separator found");
49
+ }
50
+ }
51
+ if (fractional.length > fractionalDigits) {
52
+ throw new Error("Got more fractional digits than supported");
53
+ }
54
+ const quantity = `${whole}${fractional.padEnd(fractionalDigits, "0")}`;
55
+ return new Decimal(quantity, fractionalDigits);
56
+ }
57
+ static fromAtomics(atomics, fractionalDigits) {
58
+ Decimal.verifyFractionalDigits(fractionalDigits);
59
+ return new Decimal(atomics, fractionalDigits);
60
+ }
61
+ static verifyFractionalDigits(fractionalDigits) {
62
+ if (!Number.isInteger(fractionalDigits))
63
+ throw new Error("Fractional digits is not an integer");
64
+ if (fractionalDigits < 0)
65
+ throw new Error("Fractional digits must not be negative");
66
+ if (fractionalDigits > maxFractionalDigits) {
67
+ throw new Error(`Fractional digits must not exceed ${maxFractionalDigits}`);
68
+ }
69
+ }
70
+ get atomics() {
71
+ return this.data.atomics.toString();
72
+ }
73
+ get fractionalDigits() {
74
+ return this.data.fractionalDigits;
75
+ }
76
+ data;
77
+ constructor(atomics, fractionalDigits) {
78
+ if (!atomics.match(/^[0-9]+$/)) {
79
+ throw new Error("Invalid string format. Only non-negative integers in decimal representation supported.");
80
+ }
81
+ this.data = {
82
+ atomics: BigInt(atomics),
83
+ fractionalDigits: fractionalDigits,
84
+ };
85
+ }
86
+ toString() {
87
+ const factor = BigInt(10) ** BigInt(this.data.fractionalDigits);
88
+ const whole = this.data.atomics / factor;
89
+ const fractional = this.data.atomics % factor;
90
+ if (fractional === 0n) {
91
+ return whole.toString();
92
+ }
93
+ else {
94
+ const fullFractionalPart = fractional
95
+ .toString()
96
+ .padStart(this.data.fractionalDigits, "0");
97
+ const trimmedFractionalPart = fullFractionalPart.replace(/0+$/, "");
98
+ return `${whole.toString()}.${trimmedFractionalPart}`;
99
+ }
100
+ }
101
+ }
102
+ exports.Decimal = Decimal;
@@ -1,4 +1,5 @@
1
1
  import { BinaryReader, BinaryWriter } from "../../../binary";
2
+ import { Decimal } from "../../../decimals";
2
3
  function createBaseCoin() {
3
4
  return {
4
5
  denom: "",
@@ -108,7 +109,7 @@ export const DecCoin = {
108
109
  writer.uint32(10).string(message.denom);
109
110
  }
110
111
  if (message.amount !== "") {
111
- writer.uint32(18).string(message.amount);
112
+ writer.uint32(18).string(Decimal.fromUserInput(message.amount, 18).atomics);
112
113
  }
113
114
  return writer;
114
115
  },
@@ -123,7 +124,7 @@ export const DecCoin = {
123
124
  message.denom = reader.string();
124
125
  break;
125
126
  case 2:
126
- message.amount = reader.string();
127
+ message.amount = Decimal.fromAtomics(reader.string(), 18).toString();
127
128
  break;
128
129
  default:
129
130
  reader.skipType(tag & 7);
@@ -270,7 +271,7 @@ export const DecProto = {
270
271
  },
271
272
  encode(message, writer = BinaryWriter.create()) {
272
273
  if (message.dec !== "") {
273
- writer.uint32(10).string(message.dec);
274
+ writer.uint32(10).string(Decimal.fromUserInput(message.dec, 18).atomics);
274
275
  }
275
276
  return writer;
276
277
  },
@@ -282,7 +283,7 @@ export const DecProto = {
282
283
  const tag = reader.uint32();
283
284
  switch (tag >>> 3) {
284
285
  case 1:
285
- message.dec = reader.string();
286
+ message.dec = Decimal.fromAtomics(reader.string(), 18).toString();
286
287
  break;
287
288
  default:
288
289
  reader.skipType(tag & 7);
@@ -1,5 +1,6 @@
1
1
  import { DecCoin, Coin } from "../../base/v1beta1/coin";
2
2
  import { BinaryReader, BinaryWriter } from "../../../binary";
3
+ import { Decimal } from "../../../decimals";
3
4
  import { GlobalDecoderRegistry } from "../../../registry";
4
5
  function createBaseParams() {
5
6
  return {
@@ -20,13 +21,13 @@ export const Params = {
20
21
  },
21
22
  encode(message, writer = BinaryWriter.create()) {
22
23
  if (message.communityTax !== "") {
23
- writer.uint32(10).string(message.communityTax);
24
+ writer.uint32(10).string(Decimal.fromUserInput(message.communityTax, 18).atomics);
24
25
  }
25
26
  if (message.baseProposerReward !== "") {
26
- writer.uint32(18).string(message.baseProposerReward);
27
+ writer.uint32(18).string(Decimal.fromUserInput(message.baseProposerReward, 18).atomics);
27
28
  }
28
29
  if (message.bonusProposerReward !== "") {
29
- writer.uint32(26).string(message.bonusProposerReward);
30
+ writer.uint32(26).string(Decimal.fromUserInput(message.bonusProposerReward, 18).atomics);
30
31
  }
31
32
  if (message.withdrawAddrEnabled === true) {
32
33
  writer.uint32(32).bool(message.withdrawAddrEnabled);
@@ -41,13 +42,13 @@ export const Params = {
41
42
  const tag = reader.uint32();
42
43
  switch (tag >>> 3) {
43
44
  case 1:
44
- message.communityTax = reader.string();
45
+ message.communityTax = Decimal.fromAtomics(reader.string(), 18).toString();
45
46
  break;
46
47
  case 2:
47
- message.baseProposerReward = reader.string();
48
+ message.baseProposerReward = Decimal.fromAtomics(reader.string(), 18).toString();
48
49
  break;
49
50
  case 3:
50
- message.bonusProposerReward = reader.string();
51
+ message.bonusProposerReward = Decimal.fromAtomics(reader.string(), 18).toString();
51
52
  break;
52
53
  case 4:
53
54
  message.withdrawAddrEnabled = reader.bool();
@@ -486,7 +487,7 @@ export const ValidatorSlashEvent = {
486
487
  writer.uint32(8).uint64(message.validatorPeriod);
487
488
  }
488
489
  if (message.fraction !== "") {
489
- writer.uint32(18).string(message.fraction);
490
+ writer.uint32(18).string(Decimal.fromUserInput(message.fraction, 18).atomics);
490
491
  }
491
492
  return writer;
492
493
  },
@@ -501,7 +502,7 @@ export const ValidatorSlashEvent = {
501
502
  message.validatorPeriod = reader.uint64();
502
503
  break;
503
504
  case 2:
504
- message.fraction = reader.string();
505
+ message.fraction = Decimal.fromAtomics(reader.string(), 18).toString();
505
506
  break;
506
507
  default:
507
508
  reader.skipType(tag & 7);
@@ -860,7 +861,7 @@ export const DelegatorStartingInfo = {
860
861
  writer.uint32(8).uint64(message.previousPeriod);
861
862
  }
862
863
  if (message.stake !== "") {
863
- writer.uint32(18).string(message.stake);
864
+ writer.uint32(18).string(Decimal.fromUserInput(message.stake, 18).atomics);
864
865
  }
865
866
  if (message.height !== BigInt(0)) {
866
867
  writer.uint32(24).uint64(message.height);
@@ -878,7 +879,7 @@ export const DelegatorStartingInfo = {
878
879
  message.previousPeriod = reader.uint64();
879
880
  break;
880
881
  case 2:
881
- message.stake = reader.string();
882
+ message.stake = Decimal.fromAtomics(reader.string(), 18).toString();
882
883
  break;
883
884
  case 3:
884
885
  message.height = reader.uint64();
@@ -12,6 +12,7 @@ import { BlacklistEthereumAddressesProposal, RevokeEthereumBlacklistProposal } f
12
12
  import { ContractRegistrationRequestProposal, BatchContractRegistrationRequestProposal, BatchContractDeregistrationProposal, ContractRegistrationRequest, BatchStoreCodeProposal } from "../../../injective/wasmx/v1/proposal";
13
13
  import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers";
14
14
  import { BinaryReader, BinaryWriter } from "../../../binary";
15
+ import { Decimal } from "../../../decimals";
15
16
  import { GlobalDecoderRegistry } from "../../../registry";
16
17
  /** VoteOption enumerates the valid vote options for a given governance proposal. */
17
18
  export var VoteOption;
@@ -167,7 +168,7 @@ export const WeightedVoteOption = {
167
168
  writer.uint32(8).int32(message.option);
168
169
  }
169
170
  if (message.weight !== "") {
170
- writer.uint32(18).string(message.weight);
171
+ writer.uint32(18).string(Decimal.fromUserInput(message.weight, 18).atomics);
171
172
  }
172
173
  return writer;
173
174
  },
@@ -182,7 +183,7 @@ export const WeightedVoteOption = {
182
183
  message.option = reader.int32();
183
184
  break;
184
185
  case 2:
185
- message.weight = reader.string();
186
+ message.weight = Decimal.fromAtomics(reader.string(), 18).toString();
186
187
  break;
187
188
  default:
188
189
  reader.skipType(tag & 7);
@@ -7,6 +7,7 @@ import { ValidatorUpdate } from "../../../tendermint/abci/types";
7
7
  import { BinaryReader, BinaryWriter } from "../../../binary";
8
8
  import { GlobalDecoderRegistry } from "../../../registry";
9
9
  import { toTimestamp, fromTimestamp, isSet } from "../../../helpers";
10
+ import { Decimal } from "../../../decimals";
10
11
  import { encodePubkey, decodePubkey } from "@interchainjs/pubkey";
11
12
  /** BondStatus is the status of a validator. */
12
13
  export var BondStatus;
@@ -212,13 +213,13 @@ export const CommissionRates = {
212
213
  },
213
214
  encode(message, writer = BinaryWriter.create()) {
214
215
  if (message.rate !== "") {
215
- writer.uint32(10).string(message.rate);
216
+ writer.uint32(10).string(Decimal.fromUserInput(message.rate, 18).atomics);
216
217
  }
217
218
  if (message.maxRate !== "") {
218
- writer.uint32(18).string(message.maxRate);
219
+ writer.uint32(18).string(Decimal.fromUserInput(message.maxRate, 18).atomics);
219
220
  }
220
221
  if (message.maxChangeRate !== "") {
221
- writer.uint32(26).string(message.maxChangeRate);
222
+ writer.uint32(26).string(Decimal.fromUserInput(message.maxChangeRate, 18).atomics);
222
223
  }
223
224
  return writer;
224
225
  },
@@ -230,13 +231,13 @@ export const CommissionRates = {
230
231
  const tag = reader.uint32();
231
232
  switch (tag >>> 3) {
232
233
  case 1:
233
- message.rate = reader.string();
234
+ message.rate = Decimal.fromAtomics(reader.string(), 18).toString();
234
235
  break;
235
236
  case 2:
236
- message.maxRate = reader.string();
237
+ message.maxRate = Decimal.fromAtomics(reader.string(), 18).toString();
237
238
  break;
238
239
  case 3:
239
- message.maxChangeRate = reader.string();
240
+ message.maxChangeRate = Decimal.fromAtomics(reader.string(), 18).toString();
240
241
  break;
241
242
  default:
242
243
  reader.skipType(tag & 7);
@@ -554,7 +555,7 @@ export const Validator = {
554
555
  writer.uint32(42).string(message.tokens);
555
556
  }
556
557
  if (message.delegatorShares !== "") {
557
- writer.uint32(50).string(message.delegatorShares);
558
+ writer.uint32(50).string(Decimal.fromUserInput(message.delegatorShares, 18).atomics);
558
559
  }
559
560
  if (message.description !== undefined) {
560
561
  Description.encode(message.description, writer.uint32(58).fork()).ldelim();
@@ -604,7 +605,7 @@ export const Validator = {
604
605
  message.tokens = reader.string();
605
606
  break;
606
607
  case 6:
607
- message.delegatorShares = reader.string();
608
+ message.delegatorShares = Decimal.fromAtomics(reader.string(), 18).toString();
608
609
  break;
609
610
  case 7:
610
611
  message.description = Description.decode(reader, reader.uint32());
@@ -1206,7 +1207,7 @@ export const Delegation = {
1206
1207
  writer.uint32(18).string(message.validatorAddress);
1207
1208
  }
1208
1209
  if (message.shares !== "") {
1209
- writer.uint32(26).string(message.shares);
1210
+ writer.uint32(26).string(Decimal.fromUserInput(message.shares, 18).atomics);
1210
1211
  }
1211
1212
  return writer;
1212
1213
  },
@@ -1224,7 +1225,7 @@ export const Delegation = {
1224
1225
  message.validatorAddress = reader.string();
1225
1226
  break;
1226
1227
  case 3:
1227
- message.shares = reader.string();
1228
+ message.shares = Decimal.fromAtomics(reader.string(), 18).toString();
1228
1229
  break;
1229
1230
  default:
1230
1231
  reader.skipType(tag & 7);
@@ -1556,7 +1557,7 @@ export const RedelegationEntry = {
1556
1557
  writer.uint32(26).string(message.initialBalance);
1557
1558
  }
1558
1559
  if (message.sharesDst !== "") {
1559
- writer.uint32(34).string(message.sharesDst);
1560
+ writer.uint32(34).string(Decimal.fromUserInput(message.sharesDst, 18).atomics);
1560
1561
  }
1561
1562
  if (message.unbondingId !== BigInt(0)) {
1562
1563
  writer.uint32(40).uint64(message.unbondingId);
@@ -1583,7 +1584,7 @@ export const RedelegationEntry = {
1583
1584
  message.initialBalance = reader.string();
1584
1585
  break;
1585
1586
  case 4:
1586
- message.sharesDst = reader.string();
1587
+ message.sharesDst = Decimal.fromAtomics(reader.string(), 18).toString();
1587
1588
  break;
1588
1589
  case 5:
1589
1590
  message.unbondingId = reader.uint64();
@@ -1817,7 +1818,7 @@ export const Params = {
1817
1818
  writer.uint32(42).string(message.bondDenom);
1818
1819
  }
1819
1820
  if (message.minCommissionRate !== "") {
1820
- writer.uint32(50).string(message.minCommissionRate);
1821
+ writer.uint32(50).string(Decimal.fromUserInput(message.minCommissionRate, 18).atomics);
1821
1822
  }
1822
1823
  return writer;
1823
1824
  },
@@ -1844,7 +1845,7 @@ export const Params = {
1844
1845
  message.bondDenom = reader.string();
1845
1846
  break;
1846
1847
  case 6:
1847
- message.minCommissionRate = reader.string();
1848
+ message.minCommissionRate = Decimal.fromAtomics(reader.string(), 18).toString();
1848
1849
  break;
1849
1850
  default:
1850
1851
  reader.skipType(tag & 7);