diff --git a/app/src/main/java/com/alphawallet/app/di/ToolsModule.java b/app/src/main/java/com/alphawallet/app/di/ToolsModule.java index e3e0cb3808..1c46cf3440 100644 --- a/app/src/main/java/com/alphawallet/app/di/ToolsModule.java +++ b/app/src/main/java/com/alphawallet/app/di/ToolsModule.java @@ -5,6 +5,7 @@ import com.alphawallet.app.C; import com.alphawallet.app.interact.WalletConnectInteract; import com.alphawallet.app.repository.PreferenceRepositoryType; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.service.RealmManager; import com.alphawallet.app.walletconnect.AWWalletConnectClient; import com.google.gson.Gson; @@ -54,8 +55,8 @@ RealmManager provideRealmManager() @Singleton @Provides - AWWalletConnectClient provideAWWalletConnectClient(@ApplicationContext Context context, WalletConnectInteract walletConnectInteract, PreferenceRepositoryType preferenceRepositoryType) + AWWalletConnectClient provideAWWalletConnectClient(@ApplicationContext Context context, WalletConnectInteract walletConnectInteract, PreferenceRepositoryType preferenceRepositoryType, GasService gasService) { - return new AWWalletConnectClient(context, walletConnectInteract, preferenceRepositoryType); + return new AWWalletConnectClient(context, walletConnectInteract, preferenceRepositoryType, gasService); } } diff --git a/app/src/main/java/com/alphawallet/app/entity/tokens/ERC721Token.java b/app/src/main/java/com/alphawallet/app/entity/tokens/ERC721Token.java index de044000c9..1276c54836 100644 --- a/app/src/main/java/com/alphawallet/app/entity/tokens/ERC721Token.java +++ b/app/src/main/java/com/alphawallet/app/entity/tokens/ERC721Token.java @@ -75,7 +75,6 @@ public class ERC721Token extends Token { private final Map tokenBalanceAssets; private static final Map balanceChecks = new ConcurrentHashMap<>(); - private boolean batchProcessingError; public ERC721Token(TokenInfo tokenInfo, Map balanceList, BigDecimal balance, long blancaTime, String networkName, ContractType type) { @@ -90,7 +89,6 @@ public ERC721Token(TokenInfo tokenInfo, Map balanceList, B } setInterfaceSpec(type); group = TokenGroup.NFT; - batchProcessingError = false; } @Override @@ -419,7 +417,7 @@ private void updateEnumerableBalance(Web3j web3j, Realm realm) throws IOExceptio //find tokenIds held long currentBalance = balance != null ? balance.longValue() : 0; - if (EthereumNetworkBase.getBatchProcessingLimit(tokenInfo.chainId) > 0 && !batchProcessingError && currentBalance > 1) //no need to do batch query for 1 + if (EthereumNetworkBase.getBatchProcessingLimit(tokenInfo.chainId) > 0 && currentBalance > 1) //no need to do batch query for 1 { updateEnumerableBatchBalance(web3j, currentBalance, tokenIdsHeld, realm); } @@ -457,11 +455,6 @@ private void updateEnumerableBatchBalance(Web3j web3j, long currentBalance, Hash //do final call handleEnumerableRequests(requests, tokenIdsHeld); } - - if (batchProcessingError) - { - updateEnumerableBalance(web3j, realm); - } } private void handleEnumerableRequests(BatchRequest requests, HashSet tokenIdsHeld) throws IOException @@ -469,7 +462,7 @@ private void handleEnumerableRequests(BatchRequest requests, HashSet BatchResponse responses = requests.send(); if (responses.getResponses().size() != requests.getRequests().size()) { - batchProcessingError = true; + EthereumNetworkBase.setBatchProcessingError(tokenInfo.chainId); return; } @@ -622,7 +615,7 @@ public HashSet processLogsAndStoreTransferEvents(EthLog receiveLogs, private HashSet checkBalances(Web3j web3j, HashSet eventIds) throws IOException { HashSet heldTokens = new HashSet<>(); - if (EthereumNetworkBase.getBatchProcessingLimit(tokenInfo.chainId) > 0 && !batchProcessingError && eventIds.size() > 1) return checkBatchBalances(web3j, eventIds); + if (EthereumNetworkBase.getBatchProcessingLimit(tokenInfo.chainId) > 0 && eventIds.size() > 1) return checkBatchBalances(web3j, eventIds); for (BigInteger tokenId : eventIds) { @@ -659,14 +652,7 @@ private HashSet checkBatchBalances(Web3j web3j, HashSet handleRequests(requests, balanceIds, heldTokens); } - if (batchProcessingError) - { - return checkBalances(web3j, eventIds); - } - else - { - return heldTokens; - } + return heldTokens; } private void handleRequests(BatchRequest requests, List balanceIds, HashSet heldTokens) throws IOException @@ -675,7 +661,7 @@ private void handleRequests(BatchRequest requests, List balanceIds, BatchResponse responses = requests.send(); if (responses.getResponses().size() != requests.getRequests().size()) { - batchProcessingError = true; + EthereumNetworkBase.setBatchProcessingError(tokenInfo.chainId); return; } diff --git a/app/src/main/java/com/alphawallet/app/repository/EthereumNetworkBase.java b/app/src/main/java/com/alphawallet/app/repository/EthereumNetworkBase.java index 31d1a88765..fb884a0d50 100644 --- a/app/src/main/java/com/alphawallet/app/repository/EthereumNetworkBase.java +++ b/app/src/main/java/com/alphawallet/app/repository/EthereumNetworkBase.java @@ -577,6 +577,11 @@ else if (testnetList.contains(chainId)) public static final int INFURA_BATCH_LIMIT = 512; public static final String INFURA_DOMAIN = "infura.io"; + public static void setBatchProcessingError(long chainId) + { + batchProcessingLimitMap.put(chainId, 0); + } + //TODO: Refactor when we bump the version of java to allow switch on Long (Finally!!) //Also TODO: add a test to check these batch limits of each chain we support private static int batchProcessingLimit(long chainId) diff --git a/app/src/main/java/com/alphawallet/app/repository/TokenRepository.java b/app/src/main/java/com/alphawallet/app/repository/TokenRepository.java index 5eb3d6951a..6700e603e0 100644 --- a/app/src/main/java/com/alphawallet/app/repository/TokenRepository.java +++ b/app/src/main/java/com/alphawallet/app/repository/TokenRepository.java @@ -2,6 +2,7 @@ import static com.alphawallet.ethereum.EthereumNetworkBase.MAINNET_ID; import static com.alphawallet.ethereum.EthereumNetworkBase.OKX_ID; +import static com.alphawallet.ethereum.EthereumNetworkBase.POLYGON_TEST_ID; import static org.web3j.protocol.core.methods.request.Transaction.createEthCallTransaction; import static java.util.Arrays.asList; @@ -95,7 +96,9 @@ public class TokenRepository implements TokenRepositoryType { public static final BigInteger INTERFACE_BALANCES_721_TICKET = new BigInteger ("c84aae17", 16); public static final BigInteger INTERFACE_SUPERRARE = new BigInteger ("5b5e139f", 16); public static final BigInteger INTERFACE_ERC1155 = new BigInteger("d9b67a26", 16); + public static final BigInteger INTERFACE_ERC20 = new BigInteger("36372b07", 16); public static final BigInteger INTERFACE_ERC721_ENUMERABLE = new BigInteger("780e9d63", 16); + public static final BigInteger INTERFACE_ERC404 = new BigInteger("b374afc4", 16); private static final int NODE_COMMS_ERROR = -1; private static final int CONTRACT_BALANCE_NULL = -2; @@ -1219,6 +1222,10 @@ else if (getContractData(network, tokenInfo.address, supportsInterface(INTERFACE returnType = ContractType.ERC721_ENUMERABLE; else if (getContractData(network, tokenInfo.address, supportsInterface(INTERFACE_OFFICIAL_ERC721), Boolean.TRUE)) returnType = ContractType.ERC721; + else if (getContractData(network, tokenInfo.address, supportsInterface(INTERFACE_ERC20), Boolean.TRUE)) + returnType = ContractType.ERC20; + else if (getContractData(network, tokenInfo.address, supportsInterface(INTERFACE_ERC404), Boolean.TRUE)) + returnType = ContractType.ERC20; else if (getContractData(network, tokenInfo.address, supportsInterface(INTERFACE_SUPERRARE), Boolean.TRUE)) returnType = ContractType.ERC721; else if (getContractData(network, tokenInfo.address, supportsInterface(INTERFACE_ERC1155), Boolean.TRUE)) diff --git a/app/src/main/java/com/alphawallet/app/repository/TransactionRepository.java b/app/src/main/java/com/alphawallet/app/repository/TransactionRepository.java index a8cf548947..aaaeaefacb 100644 --- a/app/src/main/java/com/alphawallet/app/repository/TransactionRepository.java +++ b/app/src/main/java/com/alphawallet/app/repository/TransactionRepository.java @@ -81,7 +81,7 @@ public RawTransaction formatRawTransaction(Web3Transaction w3Tx, long nonce, lon if (w3Tx.isLegacyTransaction()) { return formatRawTransaction(w3Tx.getTransactionDestination().toString(), w3Tx.value, w3Tx.gasPrice, w3Tx.gasLimit, nonce, - !TextUtils.isEmpty(w3Tx.payload) ? Numeric.hexStringToByteArray(w3Tx.payload) : new byte[0]); + !TextUtils.isEmpty(w3Tx.payload) ? Numeric.hexStringToByteArray(w3Tx.payload) : new byte[0], w3Tx.isConstructor()); } else { @@ -252,11 +252,11 @@ private Single getNonceForTransaction(Web3j web3j, String wallet, lo /** * Format a legacy transaction */ - private RawTransaction formatRawTransaction(String toAddress, BigInteger amount, BigInteger gasPrice, BigInteger gasLimit, long nonce, byte[] data) + private RawTransaction formatRawTransaction(String toAddress, BigInteger amount, BigInteger gasPrice, BigInteger gasLimit, long nonce, byte[] data, boolean isConstructor) { String dataStr = data != null ? Numeric.toHexString(data) : ""; - if (TextUtils.isEmpty(toAddress)) //This transaction is a constructor + if (isConstructor) { return RawTransaction.createContractTransaction( BigInteger.valueOf(nonce), diff --git a/app/src/main/java/com/alphawallet/app/service/GasService.java b/app/src/main/java/com/alphawallet/app/service/GasService.java index 372d9d8605..3ffd5c79f4 100644 --- a/app/src/main/java/com/alphawallet/app/service/GasService.java +++ b/app/src/main/java/com/alphawallet/app/service/GasService.java @@ -19,6 +19,7 @@ import com.alphawallet.app.entity.GasPriceSpread; import com.alphawallet.app.entity.NetworkInfo; import com.alphawallet.app.entity.SuggestEIP1559Kt; +import com.alphawallet.app.entity.TXSpeed; import com.alphawallet.app.entity.Wallet; import com.alphawallet.app.entity.tokens.Token; import com.alphawallet.app.repository.EthereumNetworkBase; @@ -27,6 +28,7 @@ import com.alphawallet.app.repository.HttpServiceHelper; import com.alphawallet.app.repository.KeyProvider; import com.alphawallet.app.repository.KeyProviderFactory; +import com.alphawallet.app.repository.TokenRepository; import com.alphawallet.app.repository.entity.Realm1559Gas; import com.alphawallet.app.repository.entity.RealmGasSpread; import com.alphawallet.app.web3.entity.Web3Transaction; @@ -147,7 +149,7 @@ private void fetchCurrentGasPrice() .isDisposed(); //also update EIP1559 if required and we haven't previously determined there's no EIP1559 support - getEIP1559FeeStructure() + getEIP1559FeeStructure(currentChainId) .map(result -> updateEIP1559Realm(result, currentChainId)) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) @@ -217,11 +219,16 @@ else if (EthereumNetworkRepository.hasGasOverride(currentChainId)) } else { - return Single.fromCallable(() -> web3j.ethGasPrice().send()) + return getNodeEstimate(currentChainId) .map(price -> updateGasPrice(price, currentChainId, updated)); } } + private Single getNodeEstimate(long chainId) + { + return Single.fromCallable(() -> TokenRepository.getWeb3jService(chainId).ethGasPrice().send()); + } + private Boolean updateGasPrice(EthGasPrice ethGasPrice, long chainId, boolean databaseUpdated) { currentGasPrice = ethGasPrice.getGasPrice(); @@ -295,6 +302,37 @@ private void updateRealm(final GasPriceSpread oracleResult, final long chainId) } } + //If for whatever reason gasprice hasn't been fetched or is out of date, use a manual fetch to ensure process goes through. + public Single fetchGasPrice(long chainId, boolean use1559Gas) + { + //fetch relevant average setting + if (use1559Gas) + { + return getEIP1559FeeStructure(chainId) + .map(result -> { + //select average + EIP1559FeeOracleResult standard = (result != null && result.containsKey(TXSpeed.STANDARD)) ? result.get(TXSpeed.STANDARD) : null; + if (standard != null) + { + return standard; + } + else + { + //return legacy calc + EthGasPrice gasPrice = getNodeEstimate(chainId).blockingGet(); + return new EIP1559FeeOracleResult(BigInteger.ZERO, BigInteger.ZERO, gasPrice.getGasPrice()); + } + }); + } + else + { + //get legacy gas + return getNodeEstimate(chainId) + .map(result -> new EIP1559FeeOracleResult(result.getGasPrice(), BigInteger.ZERO, BigInteger.ZERO)); + + } + } + private boolean updateEIP1559Realm(final Map result, final long chainId) { boolean succeeded = true; @@ -420,10 +458,10 @@ private Single ethEstimateGas(long chainId, String fromAddress, return Single.fromCallable(() -> web3j.ethEstimateGas(transaction).send()); } - private Single> getEIP1559FeeStructure() + private Single> getEIP1559FeeStructure(long chainId) { - return InfuraGasAPI.get1559GasEstimates(currentChainId, httpClient) - .flatMap(result -> BlockNativeGasAPI.get(httpClient).get1559GasEstimates(result, currentChainId)) + return InfuraGasAPI.get1559GasEstimates(chainId, httpClient) + .flatMap(result -> BlockNativeGasAPI.get(httpClient).get1559GasEstimates(result, chainId)) .flatMap(this::useCalculationIfRequired); //if interface doesn't have blocknative API then use calculation method } diff --git a/app/src/main/java/com/alphawallet/app/ui/AssetDisplayActivity.java b/app/src/main/java/com/alphawallet/app/ui/AssetDisplayActivity.java index 4b2ae33a76..1c9c46deae 100644 --- a/app/src/main/java/com/alphawallet/app/ui/AssetDisplayActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/AssetDisplayActivity.java @@ -579,4 +579,10 @@ public WalletType getWalletType() { return wallet.type; } + + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } } diff --git a/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java b/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java index 33e3e9bf70..40ca8201d9 100644 --- a/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java +++ b/app/src/main/java/com/alphawallet/app/ui/DappBrowserFragment.java @@ -82,6 +82,7 @@ import com.alphawallet.app.repository.TokenRepository; import com.alphawallet.app.repository.TokensRealmSource; import com.alphawallet.app.repository.entity.RealmToken; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.service.WalletConnectService; import com.alphawallet.app.ui.QRScanning.QRScannerActivity; import com.alphawallet.app.ui.widget.OnDappHomeNavClickListener; @@ -120,13 +121,13 @@ import com.alphawallet.token.entity.SalesOrderMalformed; import com.alphawallet.token.entity.SignMessageType; import com.alphawallet.token.entity.Signable; -import org.web3j.utils.Numeric; import com.alphawallet.token.tools.ParseMagicLink; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.methods.response.EthCall; +import org.web3j.utils.Numeric; import java.io.ByteArrayOutputStream; import java.io.File; @@ -1236,6 +1237,12 @@ public WalletType getWalletType() return wallet.type; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + @Override public void onSignTransaction(Web3Transaction transaction, String url) { diff --git a/app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java b/app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java index 5114cd4629..055ff7b9cd 100644 --- a/app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/FunctionActivity.java @@ -482,6 +482,12 @@ public BigInteger getTokenId() return tokenId; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + private void calculateEstimateDialog() { if (alertDialog != null && alertDialog.isShowing()) alertDialog.dismiss(); diff --git a/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java b/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java index a42b11f50c..6fa50fd33d 100644 --- a/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/HomeActivity.java @@ -64,6 +64,7 @@ import com.alphawallet.app.entity.tokens.TokenCardMeta; import com.alphawallet.app.router.ImportTokenRouter; import com.alphawallet.app.service.DeepLinkService; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.service.PriceAlertsService; import com.alphawallet.app.ui.widget.entity.ActionSheetCallback; import com.alphawallet.app.ui.widget.entity.PagerCallback; @@ -667,6 +668,12 @@ public void onDestroy() } } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + private void showPage(WalletPage page) { WalletPage oldPage = WalletPage.values()[viewPager.getCurrentItem()]; diff --git a/app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java b/app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java index 4920746526..47507e9423 100644 --- a/app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/NFTAssetDetailActivity.java @@ -829,6 +829,12 @@ public WalletType getWalletType() return viewModel.getWallet().type; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + @Override public void completeFunctionSetup() { diff --git a/app/src/main/java/com/alphawallet/app/ui/SendActivity.java b/app/src/main/java/com/alphawallet/app/ui/SendActivity.java index a6351d9544..d26e0b051d 100644 --- a/app/src/main/java/com/alphawallet/app/ui/SendActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/SendActivity.java @@ -58,9 +58,10 @@ import com.alphawallet.hardware.SignatureFromKey; import com.alphawallet.token.entity.SalesOrderMalformed; import com.alphawallet.token.tools.Convert; -import org.web3j.utils.Numeric; import com.alphawallet.token.tools.ParseMagicLink; +import org.web3j.utils.Numeric; + import java.math.BigDecimal; import java.math.BigInteger; import java.net.SocketTimeoutException; @@ -673,6 +674,12 @@ public WalletType getWalletType() return wallet.type; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + private void txWritten(TransactionReturn txData) { confirmationDialog.transactionWritten(txData.hash); diff --git a/app/src/main/java/com/alphawallet/app/ui/SwapActivity.java b/app/src/main/java/com/alphawallet/app/ui/SwapActivity.java index 433debe543..492496e7cb 100644 --- a/app/src/main/java/com/alphawallet/app/ui/SwapActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/SwapActivity.java @@ -33,6 +33,7 @@ import com.alphawallet.app.entity.lifi.Connection; import com.alphawallet.app.entity.lifi.Quote; import com.alphawallet.app.entity.lifi.Token; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.ui.widget.entity.ActionSheetCallback; import com.alphawallet.app.ui.widget.entity.ProgressInfo; import com.alphawallet.app.util.BalanceUtils; @@ -49,9 +50,10 @@ import com.alphawallet.app.widget.TokenSelector; import com.alphawallet.ethereum.EthereumNetworkBase; import com.alphawallet.hardware.SignatureFromKey; -import org.web3j.utils.Numeric; import com.google.android.material.button.MaterialButton; +import org.web3j.utils.Numeric; + import java.util.ArrayList; import java.util.List; @@ -791,4 +793,10 @@ public WalletType getWalletType() { return wallet.type; } + + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } } diff --git a/app/src/main/java/com/alphawallet/app/ui/TokenDetailActivity.java b/app/src/main/java/com/alphawallet/app/ui/TokenDetailActivity.java index 34e9bfca6d..97ea65740c 100644 --- a/app/src/main/java/com/alphawallet/app/ui/TokenDetailActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/TokenDetailActivity.java @@ -357,4 +357,10 @@ public WalletType getWalletType() { return viewModel.getWallet().type; } + + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } } diff --git a/app/src/main/java/com/alphawallet/app/ui/TokenFunctionActivity.java b/app/src/main/java/com/alphawallet/app/ui/TokenFunctionActivity.java index 27c6a75ef5..ae0f7b0da0 100644 --- a/app/src/main/java/com/alphawallet/app/ui/TokenFunctionActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/TokenFunctionActivity.java @@ -494,4 +494,10 @@ public WalletType getWalletType() { return viewModel.getWallet().type; } + + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } } diff --git a/app/src/main/java/com/alphawallet/app/ui/TransactionDetailActivity.java b/app/src/main/java/com/alphawallet/app/ui/TransactionDetailActivity.java index dd07eabbf5..d1c10aba20 100644 --- a/app/src/main/java/com/alphawallet/app/ui/TransactionDetailActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/TransactionDetailActivity.java @@ -34,6 +34,7 @@ import com.alphawallet.app.entity.tokens.Token; import com.alphawallet.app.repository.EthereumNetworkRepository; import com.alphawallet.app.router.HomeRouter; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.ui.widget.entity.ActionSheetCallback; import com.alphawallet.app.ui.widget.entity.TokenTransferData; import com.alphawallet.app.util.BalanceUtils; @@ -48,9 +49,9 @@ import com.alphawallet.app.widget.SignTransactionDialog; import com.alphawallet.app.widget.TokenIcon; import com.alphawallet.hardware.SignatureFromKey; -import org.web3j.utils.Numeric; import org.web3j.crypto.Keys; +import org.web3j.utils.Numeric; import java.math.BigDecimal; import java.math.BigInteger; @@ -542,6 +543,12 @@ public WalletType getWalletType() return wallet.type; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + @Override public void notifyConfirm(String mode) { diff --git a/app/src/main/java/com/alphawallet/app/ui/TransferNFTActivity.java b/app/src/main/java/com/alphawallet/app/ui/TransferNFTActivity.java index db6a203373..3038881dac 100644 --- a/app/src/main/java/com/alphawallet/app/ui/TransferNFTActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/TransferNFTActivity.java @@ -57,9 +57,9 @@ import com.alphawallet.app.widget.SignTransactionDialog; import com.alphawallet.app.widget.SystemView; import com.alphawallet.hardware.SignatureFromKey; -import org.web3j.utils.Numeric; import org.jetbrains.annotations.NotNull; +import org.web3j.utils.Numeric; import java.math.BigDecimal; import java.math.BigInteger; @@ -469,6 +469,12 @@ public WalletType getWalletType() return viewModel.getWallet().type; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + private void txWritten(TransactionReturn txReturn) { actionDialog.transactionWritten(txReturn.hash); diff --git a/app/src/main/java/com/alphawallet/app/ui/TransferTicketDetailActivity.java b/app/src/main/java/com/alphawallet/app/ui/TransferTicketDetailActivity.java index 74c4d07430..996f2896c1 100644 --- a/app/src/main/java/com/alphawallet/app/ui/TransferTicketDetailActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/TransferTicketDetailActivity.java @@ -49,7 +49,6 @@ import com.alphawallet.app.entity.StandardFunctionInterface; import com.alphawallet.app.entity.TransactionReturn; import com.alphawallet.app.entity.WalletType; -import com.alphawallet.hardware.SignatureFromKey; import com.alphawallet.app.entity.tokens.ERC721Token; import com.alphawallet.app.entity.tokens.Token; import com.alphawallet.app.repository.EthereumNetworkBase; @@ -73,9 +72,10 @@ import com.alphawallet.app.widget.ProgressView; import com.alphawallet.app.widget.SignTransactionDialog; import com.alphawallet.app.widget.SystemView; -import org.web3j.utils.Numeric; +import com.alphawallet.hardware.SignatureFromKey; import org.jetbrains.annotations.NotNull; +import org.web3j.utils.Numeric; import java.math.BigDecimal; import java.math.BigInteger; @@ -948,6 +948,12 @@ public WalletType getWalletType() return viewModel.getWallet().type; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + private void txWritten(TransactionReturn transactionReturn) { actionDialog.transactionWritten(transactionReturn.hash); diff --git a/app/src/main/java/com/alphawallet/app/ui/WalletConnectActivity.java b/app/src/main/java/com/alphawallet/app/ui/WalletConnectActivity.java index fdcf7aeff1..288e257240 100644 --- a/app/src/main/java/com/alphawallet/app/ui/WalletConnectActivity.java +++ b/app/src/main/java/com/alphawallet/app/ui/WalletConnectActivity.java @@ -46,6 +46,7 @@ import com.alphawallet.app.entity.walletconnect.WCRequest; import com.alphawallet.app.repository.EthereumNetworkBase; import com.alphawallet.app.repository.SignRecord; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.ui.widget.entity.ActionSheetCallback; import com.alphawallet.app.viewmodel.WalletConnectViewModel; import com.alphawallet.app.walletconnect.AWWalletConnectClient; @@ -1403,6 +1404,12 @@ public void notifyWalletConnectApproval(long selectedChain) } } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + @Override public void denyWalletConnect() { diff --git a/app/src/main/java/com/alphawallet/app/ui/widget/entity/ActionSheetCallback.java b/app/src/main/java/com/alphawallet/app/ui/widget/entity/ActionSheetCallback.java index 15fb09cf3b..ab6c0d3010 100644 --- a/app/src/main/java/com/alphawallet/app/ui/widget/entity/ActionSheetCallback.java +++ b/app/src/main/java/com/alphawallet/app/ui/widget/entity/ActionSheetCallback.java @@ -6,9 +6,10 @@ import com.alphawallet.app.entity.SignAuthenticationCallback; import com.alphawallet.app.entity.WalletType; -import com.alphawallet.hardware.SignatureFromKey; import com.alphawallet.app.entity.tokens.Token; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.web3.entity.Web3Transaction; +import com.alphawallet.hardware.SignatureFromKey; import com.alphawallet.token.entity.Signable; import java.math.BigInteger; @@ -70,4 +71,6 @@ default BigInteger getTokenId() { return BigInteger.ZERO; } + + GasService getGasService(); } diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/DappBrowserViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/DappBrowserViewModel.java index 5249eb4a1d..49f0598d36 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/DappBrowserViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/DappBrowserViewModel.java @@ -497,4 +497,9 @@ public void addNetworkToFilters(NetworkInfo info) tokensService.setupFilter(true); } + + public GasService getGasService() + { + return gasService; + } } diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/HomeViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/HomeViewModel.java index 88e2be31fc..607e1afced 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/HomeViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/HomeViewModel.java @@ -56,6 +56,7 @@ import com.alphawallet.app.service.AlphaWalletNotificationService; import com.alphawallet.app.service.AnalyticsServiceType; import com.alphawallet.app.service.AssetDefinitionService; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.service.RealmManager; import com.alphawallet.app.service.TokensService; import com.alphawallet.app.service.TransactionsService; @@ -132,6 +133,7 @@ public class HomeViewModel extends BaseViewModel private final OkHttpClient httpClient; private final RealmManager realmManager; private final TokensService tokensService; + private final GasService gasService; private final AlphaWalletNotificationService alphaWalletNotificationService; private final MutableLiveData walletName = new MutableLiveData<>(); private final MutableLiveData defaultWallet = new MutableLiveData<>(); @@ -160,7 +162,8 @@ public class HomeViewModel extends BaseViewModel OkHttpClient httpClient, RealmManager realmManager, TokensService tokensService, - AlphaWalletNotificationService alphaWalletNotificationService) + AlphaWalletNotificationService alphaWalletNotificationService, + GasService gasService) { this.preferenceRepository = preferenceRepository; this.importTokenRouter = importTokenRouter; @@ -179,6 +182,7 @@ public class HomeViewModel extends BaseViewModel setAnalyticsService(analyticsService); this.preferenceRepository.incrementLaunchCount(); this.tokensService = tokensService; + this.gasService = gasService; } @Override @@ -216,6 +220,8 @@ public LiveData defaultWallet() return defaultWallet; } + public GasService getGasService() { return gasService; } + public void prepare(Activity activity) { progress.postValue(false); diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/SendViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/SendViewModel.java index 9c91b3b9ca..f9891290c0 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/SendViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/SendViewModel.java @@ -189,4 +189,9 @@ public void transactionError(TransactionReturn txError) { transactionError.postValue(txError); } + + public GasService getGasService() + { + return gasService; + } } diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/SwapViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/SwapViewModel.java index a826abf71e..03e0ca241b 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/SwapViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/SwapViewModel.java @@ -23,6 +23,7 @@ import com.alphawallet.app.repository.SwapRepositoryType; import com.alphawallet.app.service.AnalyticsServiceType; import com.alphawallet.app.service.AssetDefinitionService; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.service.KeyService; import com.alphawallet.app.service.SwapService; import com.alphawallet.app.service.TokensService; @@ -67,6 +68,7 @@ public class SwapViewModel extends BaseViewModel implements TransactionSendHandl private final SwapService swapService; private final CreateTransactionInteract createTransactionInteract; private final KeyService keyService; + private final GasService gasService; private final MutableLiveData> chains = new MutableLiveData<>(); private final MutableLiveData chain = new MutableLiveData<>(); @@ -91,7 +93,8 @@ public SwapViewModel( SwapService swapService, CreateTransactionInteract createTransactionInteract, KeyService keyService, - AnalyticsServiceType analyticsService) + AnalyticsServiceType analyticsService, + GasService gasService) { this.assetDefinitionService = assetDefinitionService; this.preferenceRepository = preferenceRepository; @@ -100,6 +103,7 @@ public SwapViewModel( this.swapService = swapService; this.createTransactionInteract = createTransactionInteract; this.keyService = keyService; + this.gasService = gasService; setAnalyticsService(analyticsService); } @@ -495,4 +499,9 @@ public void transactionError(TransactionReturn error) { transactionError.postValue(error); } + + public GasService getGasService() + { + return gasService; + } } diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/TokenFunctionViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/TokenFunctionViewModel.java index c01a6909dc..a1c81fe785 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/TokenFunctionViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/TokenFunctionViewModel.java @@ -1042,4 +1042,9 @@ private void onAttr(StringBuilder attrs, TokenScriptResult.Attribute attribute) TokenScriptResult.addPair(attrs, attribute); } } + + public GasService getGasService() + { + return gasService; + } } diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/TransactionDetailViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/TransactionDetailViewModel.java index 10a1bfdb0e..a00152d29c 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/TransactionDetailViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/TransactionDetailViewModel.java @@ -375,4 +375,9 @@ protected void onCleared() currentBlockUpdateDisposable.dispose(); } } + + public GasService getGasService() + { + return gasService; + } } diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/TransferTicketDetailViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/TransferTicketDetailViewModel.java index c0af3afc3a..ab0ff54bb2 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/TransferTicketDetailViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/TransferTicketDetailViewModel.java @@ -38,9 +38,10 @@ import com.alphawallet.hardware.SignatureReturnType; import com.alphawallet.token.entity.SalesOrderMalformed; import com.alphawallet.token.entity.SignableBytes; -import org.web3j.utils.Numeric; import com.alphawallet.token.tools.ParseMagicLink; +import org.web3j.utils.Numeric; + import java.math.BigDecimal; import java.math.BigInteger; import java.util.ArrayList; @@ -356,4 +357,9 @@ public void loadWallet(String address) .findWallet(address) .subscribe(this::onDefaultWallet, this::onError); } + + public GasService getGasService() + { + return gasService; + } } diff --git a/app/src/main/java/com/alphawallet/app/viewmodel/WalletConnectViewModel.java b/app/src/main/java/com/alphawallet/app/viewmodel/WalletConnectViewModel.java index 3216301405..ea9450a730 100644 --- a/app/src/main/java/com/alphawallet/app/viewmodel/WalletConnectViewModel.java +++ b/app/src/main/java/com/alphawallet/app/viewmodel/WalletConnectViewModel.java @@ -30,7 +30,6 @@ import com.alphawallet.app.interact.FindDefaultNetworkInteract; import com.alphawallet.app.interact.GenericWalletInteract; import com.alphawallet.app.interact.WalletConnectInteract; -import com.alphawallet.app.repository.EthereumNetworkRepository; import com.alphawallet.app.repository.EthereumNetworkRepositoryType; import com.alphawallet.app.repository.SignRecord; import com.alphawallet.app.repository.entity.RealmWCSession; @@ -53,6 +52,7 @@ import com.alphawallet.hardware.SignatureFromKey; import com.alphawallet.token.entity.EthereumTypedMessage; import com.alphawallet.token.entity.Signable; + import org.web3j.utils.Numeric; import java.math.BigDecimal; @@ -170,6 +170,11 @@ public void prepare() .subscribe(this::onDefaultWallet, this::onError); } + public GasService getGasService() + { + return gasService; + } + public void startGasCycle(long chainId) { gasService.startGasPriceCycle(chainId); diff --git a/app/src/main/java/com/alphawallet/app/walletconnect/AWWalletConnectClient.java b/app/src/main/java/com/alphawallet/app/walletconnect/AWWalletConnectClient.java index 80d0f41c82..1f871d40f9 100644 --- a/app/src/main/java/com/alphawallet/app/walletconnect/AWWalletConnectClient.java +++ b/app/src/main/java/com/alphawallet/app/walletconnect/AWWalletConnectClient.java @@ -31,6 +31,7 @@ import com.alphawallet.app.repository.KeyProvider; import com.alphawallet.app.repository.KeyProviderFactory; import com.alphawallet.app.repository.PreferenceRepositoryType; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.service.WalletConnectV2Service; import com.alphawallet.app.ui.WalletConnectV2Activity; import com.alphawallet.app.ui.widget.entity.ActionSheetCallback; @@ -76,16 +77,18 @@ public class AWWalletConnectClient implements Web3Wallet.WalletDelegate private final MutableLiveData> sessionItemMutableLiveData = new MutableLiveData<>(Collections.emptyList()); private final KeyProvider keyProvider = KeyProviderFactory.get(); private final LongSparseArray requestHandlers = new LongSparseArray<>(); + private final GasService gasService; private ActionSheetCallback actionSheetCallback; private boolean hasConnection; private Application application; private PreferenceRepositoryType preferenceRepository; - public AWWalletConnectClient(Context context, WalletConnectInteract walletConnectInteract, PreferenceRepositoryType preferenceRepository) + public AWWalletConnectClient(Context context, WalletConnectInteract walletConnectInteract, PreferenceRepositoryType preferenceRepository, GasService gasService) { this.context = context; this.walletConnectInteract = walletConnectInteract; this.preferenceRepository = preferenceRepository; + this.gasService = gasService; hasConnection = false; } @@ -513,6 +516,12 @@ public void completeSendTransaction(Web3Transaction tx, SignatureFromKey signatu { } + @Override + public GasService getGasService() + { + return gasService; + } + @Override public void dismissed(String txHash, long callbackId, boolean actionCompleted) { diff --git a/app/src/main/java/com/alphawallet/app/walletconnect/TransactionDialogBuilder.java b/app/src/main/java/com/alphawallet/app/walletconnect/TransactionDialogBuilder.java index b164091bb1..0dc95be988 100644 --- a/app/src/main/java/com/alphawallet/app/walletconnect/TransactionDialogBuilder.java +++ b/app/src/main/java/com/alphawallet/app/walletconnect/TransactionDialogBuilder.java @@ -24,6 +24,7 @@ import com.alphawallet.app.entity.WalletType; import com.alphawallet.app.entity.tokens.Token; import com.alphawallet.app.entity.walletconnect.SignType; +import com.alphawallet.app.service.GasService; import com.alphawallet.app.ui.widget.entity.ActionSheetCallback; import com.alphawallet.app.viewmodel.WalletConnectViewModel; import com.alphawallet.app.walletconnect.entity.WCEthereumTransaction; @@ -113,6 +114,12 @@ public WalletType getWalletType() return fromWallet.type; } + @Override + public GasService getGasService() + { + return viewModel.getGasService(); + } + @Override public void sendTransaction(Web3Transaction tx) { diff --git a/app/src/main/java/com/alphawallet/app/web3/entity/Web3Transaction.java b/app/src/main/java/com/alphawallet/app/web3/entity/Web3Transaction.java index 88a05449af..140555e078 100644 --- a/app/src/main/java/com/alphawallet/app/web3/entity/Web3Transaction.java +++ b/app/src/main/java/com/alphawallet/app/web3/entity/Web3Transaction.java @@ -20,6 +20,7 @@ import java.math.BigDecimal; import java.math.BigInteger; +import java.util.Locale; public class Web3Transaction implements Parcelable @@ -317,7 +318,7 @@ public void writeToParcel(Parcel dest, int flags) public boolean isConstructor() { - return (recipient.equals(Address.EMPTY) && payload != null); + return ((TextUtils.isEmpty(recipient.toString()) || recipient.equals(Address.EMPTY)) && payload != null) && (payload.startsWith("0x6080") || payload.toLowerCase(Locale.ROOT).startsWith("0x5b6080")); } public boolean isBaseTransfer() diff --git a/app/src/main/java/com/alphawallet/app/widget/ActionSheetDialog.java b/app/src/main/java/com/alphawallet/app/widget/ActionSheetDialog.java index 0d6f60a90c..15ebd1fc04 100644 --- a/app/src/main/java/com/alphawallet/app/widget/ActionSheetDialog.java +++ b/app/src/main/java/com/alphawallet/app/widget/ActionSheetDialog.java @@ -19,6 +19,7 @@ import com.alphawallet.app.entity.ActionSheetInterface; import com.alphawallet.app.entity.ActionSheetStatus; import com.alphawallet.app.entity.ContractType; +import com.alphawallet.app.entity.EIP1559FeeOracleResult; import com.alphawallet.app.entity.GasEstimate; import com.alphawallet.app.entity.NetworkInfo; import com.alphawallet.app.entity.SignAuthenticationCallback; @@ -52,7 +53,10 @@ import java.util.Collections; import java.util.List; +import io.reactivex.android.schedulers.AndroidSchedulers; +import io.reactivex.annotations.Nullable; import io.reactivex.disposables.Disposable; +import io.reactivex.schedulers.Schedulers; import io.realm.Realm; /** @@ -90,6 +94,10 @@ public class ActionSheetDialog extends ActionSheet implements StandardFunctionIn private boolean use1559Transactions = false; private Transaction transaction; private final WalletType walletType; + @Nullable + private Disposable backupGasFetchDisposable; + + private EIP1559FeeOracleResult gasToUse = null; public ActionSheetDialog(@NonNull Activity activity, Web3Transaction tx, Token t, String destName, String destAddress, TokensService ts, @@ -148,6 +156,9 @@ else if (activity instanceof WalletConnectActivity) gasWidgetInterface = setupGasWidget(); + //ensure gas service is started + actionSheetCallback.getGasService().startGasPriceCycle(token.tokenInfo.chainId); + if (!tx.gasLimit.equals(BigInteger.ZERO)) { setGasEstimate(new GasEstimate(tx.gasLimit)); @@ -435,11 +446,6 @@ public void updateAmount() public void handleClick(String action, int id) { //first ensure gas estimate is up to date - if (gasEstimateOutOfDate()) - { - functionBar.setPrimaryButtonWaiting(); - return; - } if (walletType == WalletType.HARDWARE) { @@ -454,14 +460,16 @@ public void handleClick(String action, int id) case SEND_TRANSACTION_DAPP: case SPEEDUP_TRANSACTION: case CANCEL_TRANSACTION: - //check gas and warn user - if (!gasWidgetInterface.checkSufficientGas()) + gasToUse = getGasSettingsToUse(); + if (gasToUse == null) { - askUserForInsufficientGasConfirm(); + functionBar.setPrimaryButtonWaiting(); + //call gas collect then push tx again + callGasUpdateAndRePushTx(); } else { - handleTransactionOperation(); + checkGasAndSend(); } break; case SIGN_TRANSACTION: @@ -484,6 +492,36 @@ public void handleClick(String action, int id) } } + private void checkGasAndSend() + { + functionBar.setPrimaryButtonEnabled(true); + //check gas and warn user + if (!gasWidgetInterface.checkSufficientGas()) + { + askUserForInsufficientGasConfirm(); + } + else + { + handleTransactionOperation(); + } + } + + private void callGasUpdateAndRePushTx() + { + //fetch gas and then re-click + backupGasFetchDisposable = actionSheetCallback.getGasService().fetchGasPrice(token.tokenInfo.chainId, use1559Transactions) + .subscribeOn(Schedulers.io()) + .observeOn(AndroidSchedulers.mainThread()) + .subscribe(gasPriceStandard -> { + gasToUse = gasPriceStandard; + if (use1559Transactions && gasToUse.maxFeePerGas.equals(BigInteger.ZERO) && gasToUse.priorityFee.equals(BigInteger.ZERO)) + { + use1559Transactions = false; + } + checkGasAndSend(); + }); + } + @Override public void gasEstimateReady() { @@ -496,9 +534,23 @@ public ActivityResultLauncher gasSelectLauncher() return actionSheetCallback.gasSelectLauncher(); } - private boolean gasEstimateOutOfDate() + private EIP1559FeeOracleResult getGasSettingsToUse() { - return !gasWidget.gasPriceReady(); + if (gasWidgetInterface != null && gasWidgetInterface.gasPriceReady()) + { + if (use1559Transactions) + { + return new EIP1559FeeOracleResult(gasWidgetInterface.getGasMax(), + gasWidgetInterface.getPriorityFee(), gasWidgetInterface.getGasPrice()); + } + else + { + return new EIP1559FeeOracleResult(BigInteger.ZERO, + BigInteger.ZERO, gasWidgetInterface.getGasPrice(candidateTransaction.gasPrice)); + } + } + + return null; } private BigDecimal getTransactionAmount() @@ -629,6 +681,10 @@ private void setupCancelListeners() setOnDismissListener(v -> { actionSheetCallback.dismissed(txHash, callbackId, actionCompleted); if (gasWidgetInterface != null) gasWidgetInterface.onDestroy(); + if (backupGasFetchDisposable != null && !backupGasFetchDisposable.isDisposed()) + { + backupGasFetchDisposable.dispose(); + } }); } @@ -664,14 +720,12 @@ private Web3Transaction formTransaction() //form Web3Transaction if (!use1559Transactions) { - BigInteger currentGasPrice = gasWidgetInterface.getGasPrice(candidateTransaction.gasPrice); // also recalculates the transaction value - establishedTransaction = new Web3Transaction( candidateTransaction.recipient, candidateTransaction.contract, candidateTransaction.sender, gasWidgetInterface.getValue(), - currentGasPrice, + gasToUse.baseFee, gasWidgetInterface.getGasLimit(), gasWidgetInterface.getNonce(), candidateTransaction.payload, @@ -685,8 +739,8 @@ private Web3Transaction formTransaction() candidateTransaction.contract, candidateTransaction.sender, gasWidgetInterface.getValue(), - gasWidgetInterface.getGasMax(), - gasWidgetInterface.getPriorityFee(), + gasToUse.maxFeePerGas, + gasToUse.priorityFee, gasWidgetInterface.getGasLimit(), gasWidgetInterface.getNonce(), candidateTransaction.payload, diff --git a/app/src/main/java/com/alphawallet/app/widget/TransactionDetailWidget.java b/app/src/main/java/com/alphawallet/app/widget/TransactionDetailWidget.java index 1be190c13e..36aaac0541 100644 --- a/app/src/main/java/com/alphawallet/app/widget/TransactionDetailWidget.java +++ b/app/src/main/java/com/alphawallet/app/widget/TransactionDetailWidget.java @@ -71,11 +71,20 @@ public void setupTransaction(Web3Transaction w3tx, long chainId, String symbol, textFunctionName.setText(displayText); } - SignatureLookupService svc = new SignatureLookupService(); - disposable = svc.getFunctionName(w3tx.payload) - .observeOn(AndroidSchedulers.mainThread()) - .subscribeOn(Schedulers.io()) - .subscribe(this::onResult, error -> { }); + if (w3tx.isConstructor()) + { + String constructor = getContext().getString(R.string.constructor); + textTransactionSummary.setText(constructor); + textFunctionName.setText(constructor); + } + else + { + SignatureLookupService svc = new SignatureLookupService(); + disposable = svc.getFunctionName(w3tx.payload) + .observeOn(AndroidSchedulers.mainThread()) + .subscribeOn(Schedulers.io()) + .subscribe(this::onResult, error -> { }); + } layoutHolder.setOnClickListener(v -> { if (layoutDetails.getVisibility() == View.GONE) diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 41142c43fa..82505209c0 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -995,4 +995,5 @@ Anular Anulación del Desarrollador Es posible que esté a punto de firmar una transacción sin saberlo, lo que podría vaciar sus fondos. Es posible que desee firmar el código de bytes como desarrollador y puede anular esta advertencia si configura el modo de desarrollador en la configuración avanzada. + Constructor diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index ba8a7bb9a4..1278eaed8a 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -1009,4 +1009,5 @@ Passer outre Remplacement du Développeur Vous êtes peut-être sur le point de signer sans le savoir une transaction, ce qui pourrait vider vos fonds. Vous souhaiterez peut-être signer le bytecode en tant que développeur et vous pouvez ignorer cet avertissement si vous définissez le mode développeur dans les paramètres avancés. + Constructor diff --git a/app/src/main/res/values-id/strings.xml b/app/src/main/res/values-id/strings.xml index b3ce21920f..bee1732771 100644 --- a/app/src/main/res/values-id/strings.xml +++ b/app/src/main/res/values-id/strings.xml @@ -1000,4 +1000,5 @@ Mengesampingkan Penggantian Pengembang Anda mungkin tanpa sadar menandatangani transaksi, yang dapat mengosongkan dana Anda. Anda mungkin ingin menandatangani bytecode sebagai pengembang, dan Anda dapat mengabaikan peringatan ini jika Anda menyetel mode pengembang di Setelan lanjutan. + Constructor diff --git a/app/src/main/res/values-my/strings.xml b/app/src/main/res/values-my/strings.xml index ccd4169218..4f342d8668 100644 --- a/app/src/main/res/values-my/strings.xml +++ b/app/src/main/res/values-my/strings.xml @@ -1030,4 +1030,5 @@ ပဓာန Developer Override သင့်ငွေများကို အချည်းနှီးဖြစ်စေနိုင်သည့် ငွေပေးငွေယူတစ်ခုအား သင်မသိလိုက်ဘဲ လက်မှတ်ထိုးပါတော့မည်။ သင်သည် ဆော့ဖ်ဝဲအင်ဂျင်နီယာတစ်ဦးအနေဖြင့် bytecode ကို လက်မှတ်ထိုးလိုနိုင်ပြီး၊ Advanced ဆက်တင်များတွင် developer မုဒ်ကို သင်သတ်မှတ်ပါက ဤသတိပေးချက်ကို အစားထိုးနိုင်ပါသည်။ + Constructor diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index cdd527ae30..6efc66ab3b 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -1009,4 +1009,5 @@ Ghi đè Ghi đè Nhà phát triển Bạn có thể sắp vô tình ký một giao dịch, điều này có thể khiến tiền của bạn bị rỗng. Bạn có thể muốn ký mã byte với tư cách là nhà phát triển và bạn có thể ghi đè cảnh báo này nếu bạn đặt chế độ nhà phát triển trong cài đặt Nâng cao. + Constructor diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index cca3a05fce..e384267605 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -996,4 +996,5 @@ 覆盖 开发者覆盖 您可能会在不知情的情况下签署一项交易,这可能会清空您的资金。 您可能希望以开发人员的身份对字节码进行签名,如果您在高级设置中设置开发人员模式,则可以覆盖此警告。 + Constructor diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 473e385230..23ff05a6d3 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1072,4 +1072,5 @@ Override Developer Override You might be about to unknowingly sign a transaction, which could empty your funds. You may want to sign bytecode as a developer, and you can override this warning if you set developer mode in Advanced settings. + Constructor diff --git a/app/src/test/java/com/alphawallet/app/viewmodel/HomeViewModelTest.java b/app/src/test/java/com/alphawallet/app/viewmodel/HomeViewModelTest.java index fa54ad1b4e..87b95c446a 100644 --- a/app/src/test/java/com/alphawallet/app/viewmodel/HomeViewModelTest.java +++ b/app/src/test/java/com/alphawallet/app/viewmodel/HomeViewModelTest.java @@ -25,7 +25,7 @@ public class HomeViewModelTest public void setUp() throws Exception { SharedPreferenceRepository sharedPreferenceRepository = new SharedPreferenceRepository(RuntimeEnvironment.getApplication()); - homeViewModel = new HomeViewModel(sharedPreferenceRepository, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); + homeViewModel = new HomeViewModel(sharedPreferenceRepository, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null); } @Test