Change the insight serverUrl, to make it not a constant but selected by the app

This commit is contained in:
hvarona 2018-09-06 21:44:07 -04:00
parent e6350396be
commit baeaa2d8d0
2 changed files with 8 additions and 2 deletions

View file

@ -31,6 +31,8 @@ public class BroadcastTransaction extends Thread implements Callback<Txi> {
*/ */
private GeneralCoinAccount mAccount; private GeneralCoinAccount mAccount;
private String serverUrl;
/** /**
* Basic Consturctor * Basic Consturctor
* @param RawTx The RawTX in Hex String * @param RawTx The RawTX in Hex String
@ -38,6 +40,7 @@ public class BroadcastTransaction extends Thread implements Callback<Txi> {
* @param context This app context * @param context This app context
*/ */
public BroadcastTransaction(String RawTx, GeneralCoinAccount account, String serverUrl, Context context){ public BroadcastTransaction(String RawTx, GeneralCoinAccount account, String serverUrl, Context context){
this.serverUrl = serverUrl;
this.mServiceGenerator = new InsightApiServiceGenerator(serverUrl); this.mServiceGenerator = new InsightApiServiceGenerator(serverUrl);
this.mContext = context; this.mContext = context;
this.mRawTx = RawTx; this.mRawTx = RawTx;
@ -53,7 +56,7 @@ public class BroadcastTransaction extends Thread implements Callback<Txi> {
if (response.isSuccessful()) { if (response.isSuccessful()) {
//TODO invalidated send //TODO invalidated send
//TODO call getTransactionData //TODO call getTransactionData
GetTransactionData trData = new GetTransactionData(response.body().txid,this.mAccount,this.mContext); GetTransactionData trData = new GetTransactionData(response.body().txid,this.mAccount, this.serverUrl, this.mContext);
trData.start(); trData.start();
} else { } else {
System.out.println("SENDTEST: not succesful " + response.message()); System.out.println("SENDTEST: not succesful " + response.message());

View file

@ -42,6 +42,8 @@ public class GetTransactionByAddress extends Thread implements Callback<AddressT
*/ */
private Context mContext; private Context mContext;
private String serverUrl;
/** /**
* Basic consturcotr * Basic consturcotr
@ -49,6 +51,7 @@ public class GetTransactionByAddress extends Thread implements Callback<AddressT
* @param context This app context * @param context This app context
*/ */
public GetTransactionByAddress(GeneralCoinAccount account, String serverUrl, Context context) { public GetTransactionByAddress(GeneralCoinAccount account, String serverUrl, Context context) {
this.serverUrl = serverUrl;
this.mAccount = account; this.mAccount = account;
this.mServiceGenerator = new InsightApiServiceGenerator(serverUrl); this.mServiceGenerator = new InsightApiServiceGenerator(serverUrl);
this.mContext = context; this.mContext = context;
@ -162,7 +165,7 @@ public class GetTransactionByAddress extends Thread implements Callback<AddressT
}*/ }*/
if (tempAccount != null && transaction.getConfirm() < this.mAccount.getCryptoNet().getConfirmationsNeeded()) { if (tempAccount != null && transaction.getConfirm() < this.mAccount.getCryptoNet().getConfirmationsNeeded()) {
new GetTransactionData(transaction.getTxid(), tempAccount, this.mContext, true).start(); new GetTransactionData(transaction.getTxid(), tempAccount, this.serverUrl, this.mContext, true).start();
} }
for (GeneralCoinAddress address : this.mAddresses) { for (GeneralCoinAddress address : this.mAddresses) {
if (address.updateTransaction(transaction)) { if (address.updateTransaction(transaction)) {