mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-01-27 10:51:09 +00:00
upgrade to whirlpool 1.0.0-beta10
This commit is contained in:
parent
249a01c208
commit
da74089969
6 changed files with 32 additions and 30 deletions
|
@ -124,7 +124,7 @@ dependencies {
|
||||||
exclude group: 'org.slf4j'
|
exclude group: 'org.slf4j'
|
||||||
}
|
}
|
||||||
implementation('com.sparrowwallet.bokmakierie:bokmakierie:1.0')
|
implementation('com.sparrowwallet.bokmakierie:bokmakierie:1.0')
|
||||||
implementation('io.samourai.code.whirlpool:whirlpool-client:1.0.0-beta4')
|
implementation('io.samourai.code.whirlpool:whirlpool-client:1.0.0-beta10')
|
||||||
implementation('io.samourai.code.wallet:java-http-client:2.0.0-beta3')
|
implementation('io.samourai.code.wallet:java-http-client:2.0.0-beta3')
|
||||||
implementation('io.reactivex.rxjava2:rxjava:2.2.15')
|
implementation('io.reactivex.rxjava2:rxjava:2.2.15')
|
||||||
implementation('io.reactivex.rxjava2:rxjavafx:2.2.2')
|
implementation('io.reactivex.rxjava2:rxjavafx:2.2.2')
|
||||||
|
|
|
@ -330,20 +330,18 @@ public class CounterpartyController extends SorobanController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
sorobanWalletCounterparty.counterparty(cahootsContext, initiatorPaymentCode, onProgress)
|
try {
|
||||||
.subscribeOn(Schedulers.io())
|
// TODO run in background thread?
|
||||||
.observeOn(JavaFxScheduler.platform())
|
Cahoots result = sorobanWalletCounterparty.counterparty(cahootsContext, initiatorPaymentCode, onProgress);
|
||||||
.subscribe(cahoots -> {
|
} catch (Exception error) {
|
||||||
// cahoots success
|
log.error("Error creating mix transaction", error);
|
||||||
}, error -> {
|
String cutFrom = "Exception: ";
|
||||||
log.error("Error creating mix transaction", error);
|
int index = error.getMessage().lastIndexOf(cutFrom);
|
||||||
String cutFrom = "Exception: ";
|
String msg = index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length());
|
||||||
int index = error.getMessage().lastIndexOf(cutFrom);
|
msg = msg.replace("#Cahoots", "mix transaction");
|
||||||
String msg = index < 0 ? error.getMessage() : error.getMessage().substring(index + cutFrom.length());
|
step3Desc.setText(msg);
|
||||||
msg = msg.replace("#Cahoots", "mix transaction");
|
sorobanProgressLabel.setVisible(false);
|
||||||
step3Desc.setText(msg);
|
}
|
||||||
sorobanProgressLabel.setVisible(false);
|
|
||||||
});
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
log.error("Error creating mix transaction", e);
|
log.error("Error creating mix transaction", e);
|
||||||
sorobanProgressLabel.setText(e.getMessage());
|
sorobanProgressLabel.setText(e.getMessage());
|
||||||
|
|
|
@ -494,17 +494,16 @@ public class InitiatorController extends SorobanController {
|
||||||
};
|
};
|
||||||
SorobanWalletService sorobanWalletService = soroban.getSorobanWalletService();
|
SorobanWalletService sorobanWalletService = soroban.getSorobanWalletService();
|
||||||
sorobanProgressLabel.setText("Waiting for mix partner...");
|
sorobanProgressLabel.setText("Waiting for mix partner...");
|
||||||
sorobanWalletService.getSorobanWalletInitiator(cahootsWallet).meetAndInitiate(cahootsContext, paymentCodeCounterparty, listener)
|
try {
|
||||||
.subscribeOn(Schedulers.io())
|
// TODO run in background thread?
|
||||||
.observeOn(JavaFxScheduler.platform())
|
Cahoots result = sorobanWalletService.getSorobanWalletInitiator(cahootsWallet).meetAndInitiate(cahootsContext, paymentCodeCounterparty, listener);
|
||||||
.subscribe(sorobanResponse -> {
|
} catch (Exception error){
|
||||||
}, error -> {
|
log.error("Error receiving meeting response", error);
|
||||||
log.error("Error receiving meeting response", error);
|
step2Desc.setText(getErrorMessage(error));
|
||||||
step2Desc.setText(getErrorMessage(error));
|
sorobanProgressLabel.setVisible(false);
|
||||||
sorobanProgressLabel.setVisible(false);
|
meetingFail.setVisible(true);
|
||||||
meetingFail.setVisible(true);
|
requestUserAttention();
|
||||||
requestUserAttention();
|
}
|
||||||
});
|
|
||||||
}, error -> {
|
}, error -> {
|
||||||
log.error("Could not retrieve payment code", error);
|
log.error("Could not retrieve payment code", error);
|
||||||
if(error.getMessage().endsWith("404")) {
|
if(error.getMessage().endsWith("404")) {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class SparrowDataSource extends AbstractDataSource {
|
||||||
super(whirlpoolWallet, bip44w, walletStateSupplier, dataSourceConfig);
|
super(whirlpoolWallet, bip44w, walletStateSupplier, dataSourceConfig);
|
||||||
this.seenBackend = computeSeenBackend(whirlpoolWallet.getConfig());
|
this.seenBackend = computeSeenBackend(whirlpoolWallet.getConfig());
|
||||||
this.pushTx = computePushTx();
|
this.pushTx = computePushTx();
|
||||||
this.utxoSupplier = new SparrowUtxoSupplier(whirlpoolWallet, walletSupplier, utxoConfigSupplier, dataSourceConfig);
|
this.utxoSupplier = new SparrowUtxoSupplier(walletSupplier, utxoConfigSupplier, dataSourceConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ISeenBackend computeSeenBackend(WhirlpoolWalletConfig whirlpoolWalletConfig) {
|
private ISeenBackend computeSeenBackend(WhirlpoolWalletConfig whirlpoolWalletConfig) {
|
||||||
|
|
|
@ -5,6 +5,8 @@ import com.samourai.wallet.api.backend.seenBackend.SeenResponse;
|
||||||
import com.samourai.wallet.httpClient.IHttpClient;
|
import com.samourai.wallet.httpClient.IHttpClient;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class SparrowSeenBackend implements ISeenBackend {
|
public class SparrowSeenBackend implements ISeenBackend {
|
||||||
private IHttpClient httpClient;
|
private IHttpClient httpClient;
|
||||||
|
@ -15,7 +17,11 @@ public class SparrowSeenBackend implements ISeenBackend {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SeenResponse seen(Collection<String> addresses) throws Exception {
|
public SeenResponse seen(Collection<String> addresses) throws Exception {
|
||||||
return null; // TODO implement: check if each address already received funds
|
Map<String,Boolean> map = new LinkedHashMap<>();
|
||||||
|
for (String address : addresses) {
|
||||||
|
map.put(address, seen(address));
|
||||||
|
}
|
||||||
|
return new SeenResponse(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,11 +26,10 @@ public class SparrowUtxoSupplier extends BasicUtxoSupplier {
|
||||||
private static final Logger log = LoggerFactory.getLogger(SparrowUtxoSupplier.class);
|
private static final Logger log = LoggerFactory.getLogger(SparrowUtxoSupplier.class);
|
||||||
|
|
||||||
public SparrowUtxoSupplier(
|
public SparrowUtxoSupplier(
|
||||||
WhirlpoolWallet whirlpoolWallet,
|
|
||||||
WalletSupplier walletSupplier,
|
WalletSupplier walletSupplier,
|
||||||
UtxoConfigSupplier utxoConfigSupplier,
|
UtxoConfigSupplier utxoConfigSupplier,
|
||||||
DataSourceConfig dataSourceConfig) {
|
DataSourceConfig dataSourceConfig) {
|
||||||
super(whirlpoolWallet, walletSupplier, utxoConfigSupplier, dataSourceConfig);
|
super(walletSupplier, utxoConfigSupplier, dataSourceConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue