Skip to content

Commit

Permalink
Add mint blockchain and fix issue with 1559 calc
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSmartCell committed Jul 10, 2024
1 parent 2748b19 commit f1b9bd0
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/src/main/java/com/alphawallet/app/C.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public abstract class C {
public static final String BASE_TESTNET_NAME = "Base Sepolia (Test)";
public static final String MANTLE_MAINNET_NAME = "Mantle";
public static final String MANTLE_TESTNET_NAME = "Mantle Sepolia (Test)";
public static final String MINT_MAINNET_NAME = "Mint";
public static final String MINT_TESTNET_NAME = "Mint Sepolia (Test)";

public static final String ETHEREUM_TICKER_NAME = "ethereum";
public static final String CLASSIC_TICKER_NAME = "ethereum-classic";
Expand Down
10 changes: 9 additions & 1 deletion app/src/main/java/com/alphawallet/app/entity/SuggestEIP1559.kt
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,15 @@ internal fun suggestPriorityFee(firstBlock: Long, feeHistory: FeeHistory, gasSer
ptr -= blockCount + 1
}

if (rewards.isEmpty()) {
var isEmpty = true;
for (thisReward in rewards) {
if (thisReward > ZERO) {
isEmpty = false;
break;
}
}

if (isEmpty || rewards.isEmpty()) {
return@fromCallable calculatePriorityFee(feeHistory)
}
rewards.sort()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
import static com.alphawallet.ethereum.EthereumNetworkBase.MILKOMEDA_C1_RPC;
import static com.alphawallet.ethereum.EthereumNetworkBase.MILKOMEDA_C1_TEST_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.MILKOMEDA_C1_TEST_RPC;
import static com.alphawallet.ethereum.EthereumNetworkBase.MINT_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.MINT_MAINNET_RPC;
import static com.alphawallet.ethereum.EthereumNetworkBase.MINT_SEPOLIA_RPC;
import static com.alphawallet.ethereum.EthereumNetworkBase.MINT_SEPOLIA_TESTNET_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.OKX_ID;
import static com.alphawallet.ethereum.EthereumNetworkBase.OKX_RPC_URL;
import static com.alphawallet.ethereum.EthereumNetworkBase.OPTIMISM_GOERLI_TESTNET_FALLBACK_RPC_URL;
Expand Down Expand Up @@ -175,6 +179,8 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
: KLAYTN_BAOBAB_RPC;
public static final String CRONOS_MAIN_RPC_URL = "https://evm.cronos.org";

public static final String MINT_MAINNET_FALLBACK = "https://asia.rpc.mintchain.io";

// Use the "Free" routes as backup in order to diversify node usage; to avoid single point of failure
public static final String MAINNET_FALLBACK_RPC_URL = usesProductionKey ? FREE_MAINNET_RPC_URL : "https://mainnet.infura.io/v3/" + keyProvider.getSecondaryInfuraKey();
public static final String GOERLI_FALLBACK_RPC_URL = usesProductionKey ? FREE_GOERLI_RPC_URL : "https://goerli.infura.io/v3/" + keyProvider.getSecondaryInfuraKey();
Expand Down Expand Up @@ -212,11 +218,11 @@ public abstract class EthereumNetworkBase implements EthereumNetworkRepositoryTy
//If your wallet prioritises xDai for example, you may want to move the XDAI_ID to the front of this list,
//Then xDai would appear as the first token at the top of the wallet
private static final List<Long> hasValue = new ArrayList<>(Arrays.asList(
MAINNET_ID, GNOSIS_ID, POLYGON_ID, ROOTSTOCK_MAINNET_ID, CLASSIC_ID, LINEA_ID, BASE_MAINNET_ID, MANTLE_MAINNET_ID, BINANCE_MAIN_ID, HECO_ID, AVALANCHE_ID,
MAINNET_ID, GNOSIS_ID, POLYGON_ID, ROOTSTOCK_MAINNET_ID, CLASSIC_ID, LINEA_ID, BASE_MAINNET_ID, MANTLE_MAINNET_ID, MINT_ID, BINANCE_MAIN_ID, HECO_ID, AVALANCHE_ID,
FANTOM_ID, OPTIMISTIC_MAIN_ID, CRONOS_MAIN_ID, ARBITRUM_MAIN_ID, PALM_ID, KLAYTN_ID, IOTEX_MAINNET_ID, AURORA_MAINNET_ID, MILKOMEDA_C1_ID, OKX_ID));

private static final List<Long> testnetList = new ArrayList<>(Arrays.asList(
SEPOLIA_TESTNET_ID, POLYGON_AMOY_ID, HOLESKY_ID, BASE_TESTNET_ID, GOERLI_ID, BINANCE_TEST_ID,
SEPOLIA_TESTNET_ID, POLYGON_AMOY_ID, HOLESKY_ID, BASE_TESTNET_ID, MINT_SEPOLIA_TESTNET_ID, GOERLI_ID, BINANCE_TEST_ID,
ROOTSTOCK_TESTNET_ID, CRONOS_TEST_ID, MANTLE_TESTNET_ID, OPTIMISM_GOERLI_TEST_ID, POLYGON_TEST_ID, ARBITRUM_GOERLI_TEST_ID, LINEA_TEST_ID, KLAYTN_BAOBAB_ID,
FANTOM_TEST_ID, IOTEX_TESTNET_ID, FUJI_TEST_ID, MILKOMEDA_C1_TEST_ID,
AURORA_TESTNET_ID, PALM_TEST_ID));
Expand Down Expand Up @@ -408,6 +414,15 @@ public static boolean isOKX(NetworkInfo networkInfo)
"https://explorer.sepolia.mantle.xyz/api?"));

// Add deprecated networks after this line
put(MINT_ID, new NetworkInfo(C.MINT_MAINNET_NAME, C.ETH_SYMBOL,
MINT_MAINNET_RPC,
"https://explorer.mintchain.io/tx/", MINT_ID, MINT_MAINNET_FALLBACK,
"https://explorer.mintchain.io/api/v2/"));

put(MINT_SEPOLIA_TESTNET_ID, new NetworkInfo(C.MINT_TESTNET_NAME, C.ETH_SYMBOL,
MINT_SEPOLIA_RPC,
"https://sepolia-testnet-explorer.mintchain.io/tx/", MINT_SEPOLIA_TESTNET_ID, MINT_SEPOLIA_RPC,
"https://sepolia-testnet-explorer.mintchain.io/api/v2/")); //https://sepolia-testnet-explorer.mintchain.io/api/v2/addresses/0x76626Fc07d050d59c9fc1Ac5b853a9952B5E9Afe/transactions?filter=to%20%7C%20from
}
};

Expand Down Expand Up @@ -459,6 +474,8 @@ public static boolean isOKX(NetworkInfo networkInfo)
put(BASE_TESTNET_ID, R.drawable.ic_base_test_logo);
put(MANTLE_MAINNET_ID, R.drawable.ic_mantle_logo);
put(MANTLE_TESTNET_ID, R.drawable.ic_mantle_test_logo);
put(MINT_ID, R.drawable.ic_mint_logo);
put(MINT_SEPOLIA_TESTNET_ID, R.drawable.ic_mint_test_logo);
}
};

Expand Down Expand Up @@ -506,6 +523,8 @@ public static boolean isOKX(NetworkInfo networkInfo)
put(BASE_TESTNET_ID, R.drawable.ic_base_test_logo);
put(MANTLE_MAINNET_ID, R.drawable.ic_mantle_logo);
put(MANTLE_TESTNET_ID, R.drawable.ic_mantle_test_logo);
put(MINT_ID, R.drawable.ic_mint_logo);
put(MINT_SEPOLIA_TESTNET_ID, R.drawable.ic_mint_test_logo);
}
};

Expand Down Expand Up @@ -553,6 +572,8 @@ public static boolean isOKX(NetworkInfo networkInfo)
put(BASE_TESTNET_ID, R.color.base_logo);
put(MANTLE_MAINNET_ID, R.color.rootstock);
put(MANTLE_TESTNET_ID, R.color.rootstock);
put(MINT_ID, R.color.mint_chain);
put(MINT_SEPOLIA_TESTNET_ID, R.color.mint_chain);
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import android.widget.LinearLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.content.res.AppCompatResources;
import androidx.core.content.ContextCompat;
Expand Down Expand Up @@ -313,6 +314,7 @@ public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.GasSpeedHo
private final Token baseCurrency;
private final Context context;

@NonNull
@Override
public GasSpeedHolder onCreateViewHolder(ViewGroup parent, int viewType)
{
Expand Down
Binary file added app/src/main/res/drawable/ic_mint_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added app/src/main/res/drawable/ic_mint_test_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/src/main/res/values/colors_misc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,5 @@
<color name="sepolia">#67b1d4</color>
<color name="okx">#000000</color>
<color name="rootstock">#000000</color>
<color name="mint_chain">#30BF54</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ public abstract class EthereumNetworkBase
public static final long BASE_TESTNET_ID = 84532;
public static final long MANTLE_MAINNET_ID = 5000;
public static final long MANTLE_TESTNET_ID = 5003;
public static final long MINT_ID = 185;
public static final long MINT_SEPOLIA_TESTNET_ID = 1687;


public static final String MAINNET_RPC_URL = "https://mainnet.infura.io/v3/da3717f25f824cc1baa32d812386d93f";
Expand Down Expand Up @@ -96,6 +98,8 @@ public abstract class EthereumNetworkBase

public static final String MANTLE_MAINNET_RPC = "https://rpc.mantle.xyz";
public static final String MANTLE_TESTNET_RPC = "https://rpc.sepolia.mantle.xyz";
public static final String MINT_MAINNET_RPC = "https://global.rpc.mintchain.io";
public static final String MINT_SEPOLIA_RPC = "https://sepolia-testnet-rpc.mintchain.io";


static Map<Long, NetworkInfo> networkMap = new LinkedHashMap<Long, NetworkInfo>()
Expand Down Expand Up @@ -188,6 +192,11 @@ public abstract class EthereumNetworkBase
MANTLE_MAINNET_ID, false));
put(MANTLE_TESTNET_ID, new NetworkInfo("Mantle Sepolia (Test)", "ETH", BASE_FREE_TESTNET_RPC, "https://sepolia.basescan.org/tx/",
MANTLE_TESTNET_ID, false));

put(MINT_ID, new NetworkInfo("Mint", "ETH", MINT_MAINNET_RPC, "https://explorer.mintchain.io/tx/",
MINT_ID, false));
put(MINT_SEPOLIA_TESTNET_ID, new NetworkInfo("Mint Sepolia (Test)", "ETH", MINT_SEPOLIA_RPC, "https://sepolia-testnet-explorer.mintchain.io/tx/",
MINT_SEPOLIA_TESTNET_ID, false));
}
};

Expand Down

0 comments on commit f1b9bd0

Please sign in to comment.