@@ -6,6 +6,7 @@ import { Coin } from "../../base/v1beta1/coin";
6
6
import { ValidatorUpdate } from "../../../tendermint/abci/types" ;
7
7
import { BinaryReader , BinaryWriter } from "../../../binary" ;
8
8
import { DeepPartial , toTimestamp , fromTimestamp } from "../../../helpers" ;
9
+ import { Decimal } from "../../../decimals" ;
9
10
/** BondStatus is the status of a validator. */
10
11
export enum BondStatus {
11
12
/** BOND_STATUS_UNSPECIFIED - UNSPECIFIED defines an invalid validator status. */
@@ -391,13 +392,13 @@ export const CommissionRates = {
391
392
aminoType : "cosmos-sdk/CommissionRates" ,
392
393
encode ( message : CommissionRates , writer : BinaryWriter = BinaryWriter . create ( ) ) : BinaryWriter {
393
394
if ( message . rate !== "" ) {
394
- writer . uint32 ( 10 ) . string ( message . rate ) ;
395
+ writer . uint32 ( 10 ) . string ( Decimal . fromUserInput ( message . rate , 18 ) . atomics ) ;
395
396
}
396
397
if ( message . maxRate !== "" ) {
397
- writer . uint32 ( 18 ) . string ( message . maxRate ) ;
398
+ writer . uint32 ( 18 ) . string ( Decimal . fromUserInput ( message . maxRate , 18 ) . atomics ) ;
398
399
}
399
400
if ( message . maxChangeRate !== "" ) {
400
- writer . uint32 ( 26 ) . string ( message . maxChangeRate ) ;
401
+ writer . uint32 ( 26 ) . string ( Decimal . fromUserInput ( message . maxChangeRate , 18 ) . atomics ) ;
401
402
}
402
403
return writer ;
403
404
} ,
@@ -409,13 +410,13 @@ export const CommissionRates = {
409
410
const tag = reader . uint32 ( ) ;
410
411
switch ( tag >>> 3 ) {
411
412
case 1 :
412
- message . rate = reader . string ( ) ;
413
+ message . rate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
413
414
break ;
414
415
case 2 :
415
- message . maxRate = reader . string ( ) ;
416
+ message . maxRate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
416
417
break ;
417
418
case 3 :
418
- message . maxChangeRate = reader . string ( ) ;
419
+ message . maxChangeRate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
419
420
break ;
420
421
default :
421
422
reader . skipType ( tag & 7 ) ;
@@ -583,7 +584,7 @@ export const Validator = {
583
584
writer . uint32 ( 42 ) . string ( message . tokens ) ;
584
585
}
585
586
if ( message . delegatorShares !== "" ) {
586
- writer . uint32 ( 50 ) . string ( message . delegatorShares ) ;
587
+ writer . uint32 ( 50 ) . string ( Decimal . fromUserInput ( message . delegatorShares , 18 ) . atomics ) ;
587
588
}
588
589
if ( message . description !== undefined ) {
589
590
Description . encode ( message . description , writer . uint32 ( 58 ) . fork ( ) ) . ldelim ( ) ;
@@ -633,7 +634,7 @@ export const Validator = {
633
634
message . tokens = reader . string ( ) ;
634
635
break ;
635
636
case 6 :
636
- message . delegatorShares = reader . string ( ) ;
637
+ message . delegatorShares = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
637
638
break ;
638
639
case 7 :
639
640
message . description = Description . decode ( reader , reader . uint32 ( ) ) ;
@@ -915,7 +916,7 @@ export const Delegation = {
915
916
writer . uint32 ( 18 ) . string ( message . validatorAddress ) ;
916
917
}
917
918
if ( message . shares !== "" ) {
918
- writer . uint32 ( 26 ) . string ( message . shares ) ;
919
+ writer . uint32 ( 26 ) . string ( Decimal . fromUserInput ( message . shares , 18 ) . atomics ) ;
919
920
}
920
921
return writer ;
921
922
} ,
@@ -933,7 +934,7 @@ export const Delegation = {
933
934
message . validatorAddress = reader . string ( ) ;
934
935
break ;
935
936
case 3 :
936
- message . shares = reader . string ( ) ;
937
+ message . shares = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
937
938
break ;
938
939
default :
939
940
reader . skipType ( tag & 7 ) ;
@@ -1104,7 +1105,7 @@ export const RedelegationEntry = {
1104
1105
writer . uint32 ( 26 ) . string ( message . initialBalance ) ;
1105
1106
}
1106
1107
if ( message . sharesDst !== "" ) {
1107
- writer . uint32 ( 34 ) . string ( message . sharesDst ) ;
1108
+ writer . uint32 ( 34 ) . string ( Decimal . fromUserInput ( message . sharesDst , 18 ) . atomics ) ;
1108
1109
}
1109
1110
if ( message . unbondingId !== BigInt ( 0 ) ) {
1110
1111
writer . uint32 ( 40 ) . uint64 ( message . unbondingId ) ;
@@ -1131,7 +1132,7 @@ export const RedelegationEntry = {
1131
1132
message . initialBalance = reader . string ( ) ;
1132
1133
break ;
1133
1134
case 4 :
1134
- message . sharesDst = reader . string ( ) ;
1135
+ message . sharesDst = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
1135
1136
break ;
1136
1137
case 5 :
1137
1138
message . unbondingId = reader . uint64 ( ) ;
@@ -1248,7 +1249,7 @@ export const Params = {
1248
1249
writer . uint32 ( 42 ) . string ( message . bondDenom ) ;
1249
1250
}
1250
1251
if ( message . minCommissionRate !== "" ) {
1251
- writer . uint32 ( 50 ) . string ( message . minCommissionRate ) ;
1252
+ writer . uint32 ( 50 ) . string ( Decimal . fromUserInput ( message . minCommissionRate , 18 ) . atomics ) ;
1252
1253
}
1253
1254
return writer ;
1254
1255
} ,
@@ -1275,7 +1276,7 @@ export const Params = {
1275
1276
message . bondDenom = reader . string ( ) ;
1276
1277
break ;
1277
1278
case 6 :
1278
- message . minCommissionRate = reader . string ( ) ;
1279
+ message . minCommissionRate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
1279
1280
break ;
1280
1281
default :
1281
1282
reader . skipType ( tag & 7 ) ;
0 commit comments