File tree Expand file tree Collapse file tree 5 files changed +43
-6
lines changed 
common/src/main/java/jp/co/soramitsu/common 
runtime/src/main/java/jp/co/soramitsu/runtime/network/rpc Expand file tree Collapse file tree 5 files changed +43
-6
lines changed Original file line number Diff line number Diff line change 11buildscript  {
22    ext {
33        //  App version
4-         versionName =  ' 2.0.12 ' 
5-         versionCode =  73 
4+         versionName =  ' 2.0.13 ' 
5+         versionCode =  74 
66
77        //  SDK and tools
88        compileSdkVersion =  31 
Original file line number Diff line number Diff line change @@ -3,6 +3,6 @@ package jp.co.soramitsu.common.data.network.runtime.calls
33import  jp.co.soramitsu.fearless_utils.wsrpc.request.runtime.RuntimeRequest 
44
55class  FeeCalculationRequest (extrinsicInHex :  String ) : RuntimeRequest(
6-     method = " payment_queryInfo " 
6+     method = " payment_queryFeeDetails " 
77    params = listOf(extrinsicInHex)
88)
Original file line number Diff line number Diff line change 11package  jp.co.soramitsu.common.data.network.runtime.model 
22
33import  java.math.BigInteger 
4+ import  jp.co.soramitsu.fearless_utils.extensions.fromHex 
5+ import  jp.co.soramitsu.fearless_utils.extensions.fromUnsignedBytes 
6+ import  jp.co.soramitsu.fearless_utils.extensions.requireHexPrefix 
47
58//  todo there were a field which caused an errors:
69//  val weight: Long
@@ -11,6 +14,33 @@ import java.math.BigInteger
1114//       "class":"normal",
1215//       "partialFee":"15407544760"
1316//  }
17+ 
1418class  FeeResponse (
15-     val  partialFee :   BigInteger 
19+     val  inclusionFee :   InclusionFee 
1620)
21+ 
22+ class  InclusionFee (
23+     private  val  baseFee :  String? ,
24+     private  val  lenFee :  String? ,
25+     private  val  adjustedWeightFee :  String? ,
26+ ) {
27+     val  sum:  BigInteger 
28+         get() =  baseFee.decodeBigInt() +  lenFee.decodeBigInt() +  adjustedWeightFee.decodeBigInt()
29+ 
30+     private  fun  String?.decodeBigInt (): BigInteger  {
31+         //  because substrate returns hexes with different length:
32+         //  0x3b9aca00
33+         //  0x3486ced00
34+         //  0xb320334
35+         if  (this  ==  null ) return  BigInteger .ZERO 
36+         return  if  (this .length.isEven.not ()) {
37+             val  withoutPrefix =  removePrefix(" 0x" 
38+             " 0$withoutPrefix " 
39+         } else  {
40+             this 
41+         }.fromHex().fromUnsignedBytes()
42+     }
43+ 
44+     private  val  Int .isEven:  Boolean 
45+         get() =  this  %  2  ==  0 
46+ }
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package jp.co.soramitsu.common.utils
22
33import  android.content.Context 
44import  android.text.format.DateUtils 
5+ import  android.util.Log 
56import  java.math.BigDecimal 
67import  java.math.RoundingMode 
78import  java.text.DecimalFormat 
@@ -83,7 +84,13 @@ fun Long.formatDaysSinceEpoch(context: Context): String? {
8384    val  currentDays =  System .currentTimeMillis().daysFromMillis()
8485    val  diff =  currentDays -  this 
8586
86-     if  (diff <  0 ) throw  IllegalArgumentException (" Past date should be less than current" 
87+     if  (diff <  0 ) {
88+         Log .e(
89+             " jp.co.soramitsu.common.utils.NumberFormattersKt.formatDaysSinceEpoch" 
90+             " Error: diff < 0: " 
91+             IllegalArgumentException (" Past date should be less than current" 
92+         )
93+     }
8794
8895    return  when  (diff) {
8996        0L  ->  context.getString(R .string.today)
Original file line number Diff line number Diff line change @@ -110,7 +110,7 @@ class RpcCalls(
110110
111111        val  feeResponse =  socketFor(chainId).executeAsync(request, mapper =  pojo<FeeResponse >().nonNull())
112112
113-         return  feeResponse.partialFee 
113+         return  feeResponse.inclusionFee.sum 
114114    }
115115
116116    suspend  fun  submitExtrinsic (chainId :  ChainId , extrinsic :  String ): String  {
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments