Skip to content

Commit

Permalink
Fix for TokenScript RPC inject
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSmartCell committed Feb 10, 2024
1 parent 9677256 commit 1fd3d1f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ private static String getNodeRPC(String infuraKey, long chainId)
}
else
{
return info.backupNodeUrl != null ? info.backupNodeUrl : info.rpcServerUrl;
return info.rpcServerUrl; // Not Infura, use directly
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public void setChainId(long chainId)
public void setTSChainId(long chainId)
{
this.chainId = chainId;
this.rpcUrl = EthereumNetworkRepository.getTSNodeURL(chainId);
this.rpcUrl = EthereumNetworkRepository.getDefaultNodeURL(chainId);
}

public String initJs(Context context)
Expand Down
30 changes: 1 addition & 29 deletions app/src/main/java/com/alphawallet/app/web3/Web3TokenView.java
Original file line number Diff line number Diff line change
Expand Up @@ -153,35 +153,7 @@ private void init() {
@Override
public boolean onConsoleMessage(ConsoleMessage msg)
{
if (!showingError && msg.messageLevel() == ConsoleMessage.MessageLevel.ERROR)
{
if (msg.message().contains(REFRESH_ERROR)) return true; //don't stop for refresh error
String errorLine = "";
try
{
LineNumberReader lineNumberReader = new LineNumberReader(new StringReader(unencodedPage));
lineNumberReader.setLineNumber(0);

String lineStr;
while ((lineStr = lineNumberReader.readLine()) != null)
{
if (lineNumberReader.getLineNumber() == msg.lineNumber())
{
errorLine = Utils.escapeHTML(lineStr); //ensure string is displayed exactly how it is read
break;
}
}
}
catch (Exception e)
{
errorLine = "";
}

String errorMessage = RENDERING_ERROR.replace("${ERR1}", msg.message());
if (!TextUtils.isEmpty(errorLine)) errorMessage += RENDERING_ERROR_SUPPLIMENTAL.replace("$ERR1", String.valueOf(msg.lineNumber())).replace("$ERR2", errorLine); //.replace("$ERR2", errorMessage)
showError(errorMessage);
unencodedPage = null;
}
Timber.w("Web3Token Message: %s", msg.message());
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:7.4.2'
//NB - there is an issue with newer versions of gradle. The APK balloons out, so far haven't diagnosed why.
//If you want to try upgrading gradle plugin past 3.5.4 you will need to also diagnose the APK ballooning issue.
classpath "io.realm:realm-gradle-plugin:10.16.1"
classpath "io.realm:realm-gradle-plugin:10.18.0"
// WARNING WARNING WARNING
// you are about to add here a dependency to be used in the Android app
// don't do that. add that dependency to app/build.gradle
Expand Down

0 comments on commit 1fd3d1f

Please sign in to comment.