@@ -5,6 +5,7 @@ import { Duration, DurationAmino } from "../../../google/protobuf/duration";
5
5
import { Coin , CoinAmino } from "../../base/v1beta1/coin" ;
6
6
import { BinaryReader , BinaryWriter } from "../../../binary" ;
7
7
import { DeepPartial , toTimestamp , fromTimestamp } from "../../../helpers" ;
8
+ import { Decimal } from "@interchainjs/math" ;
8
9
import { encodePubkey , decodePubkey } from "@interchainjs/pubkey" ;
9
10
import { Pubkey } from "@cosmjs/amino" ;
10
11
/** BondStatus is the status of a validator. */
@@ -750,13 +751,13 @@ export const CommissionRates = {
750
751
aminoType : "cosmos-sdk/CommissionRates" ,
751
752
encode ( message : CommissionRates , writer : BinaryWriter = BinaryWriter . create ( ) ) : BinaryWriter {
752
753
if ( message . rate !== "" ) {
753
- writer . uint32 ( 10 ) . string ( message . rate ) ;
754
+ writer . uint32 ( 10 ) . string ( Decimal . fromUserInput ( message . rate , 18 ) . atomics ) ;
754
755
}
755
756
if ( message . maxRate !== "" ) {
756
- writer . uint32 ( 18 ) . string ( message . maxRate ) ;
757
+ writer . uint32 ( 18 ) . string ( Decimal . fromUserInput ( message . maxRate , 18 ) . atomics ) ;
757
758
}
758
759
if ( message . maxChangeRate !== "" ) {
759
- writer . uint32 ( 26 ) . string ( message . maxChangeRate ) ;
760
+ writer . uint32 ( 26 ) . string ( Decimal . fromUserInput ( message . maxChangeRate , 18 ) . atomics ) ;
760
761
}
761
762
return writer ;
762
763
} ,
@@ -768,13 +769,13 @@ export const CommissionRates = {
768
769
const tag = reader . uint32 ( ) ;
769
770
switch ( tag >>> 3 ) {
770
771
case 1 :
771
- message . rate = reader . string ( ) ;
772
+ message . rate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
772
773
break ;
773
774
case 2 :
774
- message . maxRate = reader . string ( ) ;
775
+ message . maxRate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
775
776
break ;
776
777
case 3 :
777
- message . maxChangeRate = reader . string ( ) ;
778
+ message . maxChangeRate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
778
779
break ;
779
780
default :
780
781
reader . skipType ( tag & 7 ) ;
@@ -1067,7 +1068,7 @@ export const Validator = {
1067
1068
writer . uint32 ( 42 ) . string ( message . tokens ) ;
1068
1069
}
1069
1070
if ( message . delegatorShares !== "" ) {
1070
- writer . uint32 ( 50 ) . string ( message . delegatorShares ) ;
1071
+ writer . uint32 ( 50 ) . string ( Decimal . fromUserInput ( message . delegatorShares , 18 ) . atomics ) ;
1071
1072
}
1072
1073
if ( message . description !== undefined ) {
1073
1074
Description . encode ( message . description , writer . uint32 ( 58 ) . fork ( ) ) . ldelim ( ) ;
@@ -1109,7 +1110,7 @@ export const Validator = {
1109
1110
message . tokens = reader . string ( ) ;
1110
1111
break ;
1111
1112
case 6 :
1112
- message . delegatorShares = reader . string ( ) ;
1113
+ message . delegatorShares = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
1113
1114
break ;
1114
1115
case 7 :
1115
1116
message . description = Description . decode ( reader , reader . uint32 ( ) ) ;
@@ -1632,7 +1633,7 @@ export const Delegation = {
1632
1633
writer . uint32 ( 18 ) . string ( message . validatorAddress ) ;
1633
1634
}
1634
1635
if ( message . shares !== "" ) {
1635
- writer . uint32 ( 26 ) . string ( message . shares ) ;
1636
+ writer . uint32 ( 26 ) . string ( Decimal . fromUserInput ( message . shares , 18 ) . atomics ) ;
1636
1637
}
1637
1638
return writer ;
1638
1639
} ,
@@ -1650,7 +1651,7 @@ export const Delegation = {
1650
1651
message . validatorAddress = reader . string ( ) ;
1651
1652
break ;
1652
1653
case 3 :
1653
- message . shares = reader . string ( ) ;
1654
+ message . shares = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
1654
1655
break ;
1655
1656
default :
1656
1657
reader . skipType ( tag & 7 ) ;
@@ -1932,7 +1933,7 @@ export const RedelegationEntry = {
1932
1933
writer . uint32 ( 26 ) . string ( message . initialBalance ) ;
1933
1934
}
1934
1935
if ( message . sharesDst !== "" ) {
1935
- writer . uint32 ( 34 ) . string ( message . sharesDst ) ;
1936
+ writer . uint32 ( 34 ) . string ( Decimal . fromUserInput ( message . sharesDst , 18 ) . atomics ) ;
1936
1937
}
1937
1938
return writer ;
1938
1939
} ,
@@ -1953,7 +1954,7 @@ export const RedelegationEntry = {
1953
1954
message . initialBalance = reader . string ( ) ;
1954
1955
break ;
1955
1956
case 4 :
1956
- message . sharesDst = reader . string ( ) ;
1957
+ message . sharesDst = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
1957
1958
break ;
1958
1959
default :
1959
1960
reader . skipType ( tag & 7 ) ;
@@ -2154,7 +2155,7 @@ export const Params = {
2154
2155
writer . uint32 ( 42 ) . string ( message . bondDenom ) ;
2155
2156
}
2156
2157
if ( message . minCommissionRate !== "" ) {
2157
- writer . uint32 ( 50 ) . string ( message . minCommissionRate ) ;
2158
+ writer . uint32 ( 50 ) . string ( Decimal . fromUserInput ( message . minCommissionRate , 18 ) . atomics ) ;
2158
2159
}
2159
2160
return writer ;
2160
2161
} ,
@@ -2181,7 +2182,7 @@ export const Params = {
2181
2182
message . bondDenom = reader . string ( ) ;
2182
2183
break ;
2183
2184
case 6 :
2184
- message . minCommissionRate = reader . string ( ) ;
2185
+ message . minCommissionRate = Decimal . fromAtomics ( reader . string ( ) , 18 ) . toString ( ) ;
2185
2186
break ;
2186
2187
default :
2187
2188
reader . skipType ( tag & 7 ) ;
0 commit comments