Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSmartCell committed Mar 10, 2024
1 parent 42bbcd3 commit b35c9a2
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 2,502 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tasks.withType(Test).configureEach {
}

detekt {
toolVersion = "1.20.0-RC1"
toolVersion = "1.23.5"
buildUponDefaultConfig = true // preconfigure defaults
allRules = false // activate all available (even unstable) rules.
baseline = file("$projectDir/check/detekt-baseline.xml")
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@
android:name=".ui.SplashActivity"
android:theme="@style/AppTheme.NoActionBar.Splash" />

<service
android:name=".service.WalletConnectService"
android:enabled="true" />

<service
android:name=".service.WalletConnectV2Service"
android:enabled="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ public interface HomeCommsInterface
void backupSuccess(String keyAddress);
void resetTokens();
void resetTransactions();
void openWalletConnect(String sessionId);
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ public void onReceive(Context context, Intent intent)
String keyAddress = bundle != null ? bundle.getString("Key", "") : "";
homeCommsInterface.backupSuccess(keyAddress);
break;
case C.WALLET_CONNECT_REQUEST:
String sessionId = bundle != null ? bundle.getString("sessionid", "") : "";
homeCommsInterface.openWalletConnect(sessionId);
default:
break;
}
Expand Down
14 changes: 10 additions & 4 deletions app/src/main/java/com/alphawallet/app/entity/SuggestEIP1559.kt
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,23 @@ private fun calculateResult(priorityFee: BigInteger, feeHistory: FeeHistory): Si
baseFee[baseFee.size - 1] = (baseFee[baseFee.size - 1].toBigDecimal() * BigDecimal(9 / 8.0)).toBigInteger()
}

((feeHistory.gasUsedRatio.size - 1) downTo 0).forEach { i ->
for (i in (feeHistory.gasUsedRatio.size - 1) downTo 0) {
if (feeHistory.gasUsedRatio[i] > 0.9) {
baseFee[i] = baseFee[i + 1]
}
}

/*((feeHistory.gasUsedRatio.size - 1) downTo 0).forEach { i ->
if (feeHistory.gasUsedRatio[i] > 0.9) {
baseFee[i] = baseFee[i + 1]
}
}*/

val order = (0..feeHistory.gasUsedRatio.size).map { it }.sortedBy { baseFee[it] }

var maxBaseFee = ZERO
val result = mutableMapOf<Int, EIP1559FeeOracleResult>()
(maxTimeFactor downTo 0).forEach { timeFactor ->
for (timeFactor in maxTimeFactor downTo 0) {
var bf: BigInteger
if (timeFactor < 1e-6) {
bf = baseFee.last()
Expand Down Expand Up @@ -145,8 +151,8 @@ internal fun suggestPriorityFee(firstBlock: Long, feeHistory: FeeHistory, gasSer
rewardPercentile.toString()).blockingGet();

val rewardSize = feeHistoryFetch?.reward?.size ?: 0
(0 until rewardSize).forEach {
rewards.add(BigInteger(Numeric.cleanHexPrefix(feeHistoryFetch.reward[it][0].removePrefix("0x")),
for (index in 0 until rewardSize) {
rewards.add(BigInteger(Numeric.cleanHexPrefix(feeHistoryFetch.reward[index][0].removePrefix("0x")),
16))
}
if (rewardSize < blockCount) break
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,17 @@
import android.os.IBinder;

import com.alphawallet.app.entity.WalletConnectActions;
import com.alphawallet.app.entity.lifi.Token;
import com.alphawallet.app.entity.walletconnect.WalletConnectSessionItem;
import com.alphawallet.app.entity.walletconnect.WalletConnectV2SessionItem;
import com.alphawallet.app.repository.entity.RealmWCSession;
import com.alphawallet.app.service.RealmManager;
import com.alphawallet.app.service.WalletConnectService;
import com.alphawallet.app.viewmodel.WalletConnectViewModel;
import com.alphawallet.app.walletconnect.WCClient;
import com.alphawallet.app.walletconnect.entity.WCUtils;
import com.walletconnect.web3.wallet.client.Wallet;
import com.walletconnect.web3.wallet.client.Web3Wallet;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import javax.inject.Inject;
Expand Down
Loading

0 comments on commit b35c9a2

Please sign in to comment.