mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-22 18:54:33 +00:00
Bump to swap tool v 0.13.0
This commit is contained in:
parent
ce38f3e36e
commit
a84ff2ef03
3 changed files with 56 additions and 27 deletions
|
@ -60,11 +60,11 @@ void AtomicConfigDialog::downloadBinary() {
|
|||
auto operatingSystem = Config::instance()->get(Config::operatingSystem).toString().toStdString();
|
||||
if(strcmp("WIN",operatingSystem.c_str()) == 0) {
|
||||
// HARD CODED DOWNload URL CHANGE IF PROBLEMS
|
||||
url = QString("https://github.com/comit-network/xmr-btc-swap/releases/download/0.12.3/swap_0.12.3_Windows_x86_64.zip");
|
||||
url = QString("https://github.com/comit-network/xmr-btc-swap/releases/tag/0.13.0/swap_0.13.0_Windows_x86_64.zip");
|
||||
} else if (strcmp("LINUX",operatingSystem.c_str())==0){
|
||||
url = QString("https://github.com/comit-network/xmr-btc-swap/releases/download/0.12.3/swap_0.12.3_Linux_x86_64.tar");
|
||||
url = QString("https://github.com/comit-network/xmr-btc-swap/releases/tag/0.13.0/swap_0.13.0_Linux_x86_64.tar");
|
||||
} else {
|
||||
url = QString("https://github.com/comit-network/xmr-btc-swap/releases/download/0.12.3/swap_0.12.3_Darwin_x86_64.tar");
|
||||
url = QString("https://github.com/comit-network/xmr-btc-swap/releases/tag/0.13.0/swap_0.13.0_Darwin_x86_64.tar");
|
||||
}
|
||||
|
||||
archive = network->get(this, url);
|
||||
|
|
|
@ -53,31 +53,20 @@ AtomicWidget::AtomicWidget(QWidget *parent)
|
|||
QStringList pointList = m_instance->get(Config::rendezVous).toStringList();
|
||||
for(QString point :pointList)
|
||||
AtomicWidget::list(point);
|
||||
});
|
||||
|
||||
/*
|
||||
QList<QFuture<void>> tempList;
|
||||
for (int i=0; i<pointList.size();i++){
|
||||
tempList.append(QtConcurrent::run([this, pointList, i]{
|
||||
return AtomicWidget::list(pointList[i]);
|
||||
}));
|
||||
connect(ui->btn_swap, &QPushButton::clicked, this, [this]{
|
||||
auto rows = ui->offerBookTable->selectionModel()->selectedRows();
|
||||
if (rows.size() < 1){
|
||||
ui->meta_label->setText("You must select an offer to use for swap, refresh if there aren't any");
|
||||
} else {
|
||||
QModelIndex index = rows.at(0);
|
||||
QString seller = index.sibling(index.row(), 3).data().toString();
|
||||
//Add proper error checking on ui input after rest of swap is implemented
|
||||
QString btcChange = ui->change_address->text();
|
||||
QString xmrReceive = ui->xmr_address->text();
|
||||
runSwap(seller,btcChange, xmrReceive);
|
||||
}
|
||||
|
||||
sleep(130);
|
||||
for (int i=0; i<pointList.size();i++){
|
||||
qDebug() << "Starting to read offers";
|
||||
auto offers = tempList[i].result();
|
||||
for (auto offer: offers){
|
||||
offerList->append(offer);
|
||||
}
|
||||
}
|
||||
qDebug() << "done";
|
||||
|
||||
/*for(auto offer: AtomicWidget::list(Config::instance()->get(Config::rendezVous).toStringList()[0])){
|
||||
offerList->append(offer);
|
||||
}
|
||||
o_model->updateOffers(*offerList);
|
||||
|
||||
*/
|
||||
});
|
||||
|
||||
connect(ui->btn_addRendezvous, &QPushButton::clicked, this, [this]{
|
||||
|
@ -116,6 +105,45 @@ void AtomicWidget::updateStatus() {
|
|||
|
||||
}
|
||||
|
||||
void AtomicWidget::runSwap(QString seller, QString btcChange, QString xmrReceive) {
|
||||
qDebug() << "starting swap";
|
||||
QStringList arguments;
|
||||
auto m_instance = Config::instance();
|
||||
arguments << "--data-base-dir";
|
||||
arguments << Config::defaultConfigDir().absolutePath();
|
||||
// Remove after testing
|
||||
//arguments << "--testnet";
|
||||
arguments << "-j";
|
||||
arguments << "buy-xmr";
|
||||
arguments << "--change-address";
|
||||
arguments << btcChange;
|
||||
arguments << "--receive-address";
|
||||
arguments << xmrReceive;
|
||||
arguments << "--seller";
|
||||
arguments << seller;
|
||||
arguments << "--tor-socks5-port";
|
||||
arguments << m_instance->get(Config::socks5Port).toString();
|
||||
|
||||
auto *swap = new QProcess();
|
||||
swap->setReadChannel(QProcess::StandardError);
|
||||
connect(swap, &QProcess::readyReadStandardError,this, [this, swap] {
|
||||
while(swap->canReadLine()){
|
||||
QJsonParseError err;
|
||||
QJsonDocument line = QJsonDocument::fromJson(swap->readLine(), &err);
|
||||
qDebug() << line;
|
||||
if (line["fields"]["message"].toString().contains("Connected to Alice")){
|
||||
qDebug() << "Succesfully connected";
|
||||
} else if (!line["fields"]["deposit_address"].toString().isEmpty()){
|
||||
qDebug() << "Deposit to btc to segwit address";
|
||||
} else if ()
|
||||
//Insert line conditionals here
|
||||
}
|
||||
});
|
||||
swap->start(m_instance->get(Config::swapPath).toString(),arguments);
|
||||
qDebug() << "process started";
|
||||
|
||||
}
|
||||
|
||||
void AtomicWidget::list(QString rendezvous) {
|
||||
QStringList arguments;
|
||||
QList<QSharedPointer<OfferEntry>> list;
|
||||
|
@ -131,7 +159,7 @@ void AtomicWidget::list(QString rendezvous) {
|
|||
arguments << "--rendezvous-point";
|
||||
arguments << rendezvous;
|
||||
auto *swap = new QProcess();
|
||||
swap->setReadChannel(QProcess::StandardOutput);
|
||||
swap->setReadChannel(QProcess::StandardError);
|
||||
//swap->start(m_instance->get(Config::swapPath).toString(), arguments);
|
||||
connect(swap, &QProcess::finished, this, [this, swap]{
|
||||
QJsonDocument parsedLine;
|
||||
|
|
|
@ -30,6 +30,7 @@ public slots:
|
|||
|
||||
private slots:
|
||||
void showAtomicConfigureDialog();
|
||||
void runSwap(QString seller, QString btcChange, QString xmrReceive);
|
||||
|
||||
private:
|
||||
void updateStatus();
|
||||
|
|
Loading…
Reference in a new issue