This commit introduces a websocket server via the --daemon argument.

```
./wowlet --daemon 127.0.0.1:1234 --daemon-password "sekrit"
```

The wallet will start in the background and expose a websocket port that you can connect to using a websocket client. This way, you will be able to control the wallet via websockets. The commands are defined in wsserver.cpp, in the `processBinaryMessage()` function.

- `openWallet` - opens a wallet by path/password.
- `closeWallet` - close current wallet.
- `addressList` - Returns a list of receive addresses.
- `sendTransaction` - Creates and sends a transaction.
- `createWallet` - Create a wallet by path/password.
- `transactionHistory` - Returns the complete list of transactions
- `addressBook` - Returns the complete list of address book entries.

Messages sent back and forth between the server and client are JSON. There is a Python example client available over at https://git.wownero.com/wownero/wowlet-ws-client
This commit is contained in:
dsc
2021-03-28 21:50:55 +02:00
parent 40a575a5d6
commit 8968a8cbce
24 changed files with 732 additions and 80 deletions
+16
View File
@@ -154,6 +154,22 @@ int AddressBookModel::lookupPaymentID(const QString &payment_id) const
return m_addressBook->lookupPaymentID(payment_id);
}
QJsonArray AddressBookModel::toJsonArray(){
QJsonArray arr;
for(int i = 0; i < this->rowCount(); i++) {
QJsonObject item;
QModelIndex index = this->index(i, 0);
const auto description = this->data(index.siblingAtColumn(AddressBookModel::Description), Qt::UserRole).toString().replace("\"", "");
const auto address = this->data(index.siblingAtColumn(AddressBookModel::Address), Qt::UserRole).toString();
if(address.isEmpty()) continue;
item["description"] = description;
item["address"] = address;
arr << item;
}
return arr;
}
bool AddressBookModel::writeCSV(const QString &path) {
QString csv = "";
for(int i = 0; i < this->rowCount(); i++) {