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
+9 -2
View File
@@ -89,6 +89,12 @@ public:
static QMap<QString, QString> txCache;
static TxFiatHistory *txFiatHistory;
QList<WalletKeysFiles> listWallets() {
// return listing of wallet .keys items
m_walletKeysFilesModel->refresh();
return m_walletKeysFilesModel->listWallets();
}
// libwalletqt
bool refreshed = false;
WalletManager *walletManager;
@@ -111,7 +117,7 @@ public:
public slots:
void onOpenWallet(const QString& path, const QString &password);
void onCreateTransaction(const QString &address, quint64 amount, const QString &description, bool all);
void onCreateTransaction(QString address, quint64 amount, const QString description, bool all);
void onCreateTransactionMultiDest(const QVector<QString> &addresses, const QVector<quint64> &amounts, const QString &description);
void onCancelTransaction(PendingTransaction *tx, const QVector<QString> &address);
void onSweepOutput(const QString &keyImage, QString address, bool churn, int outputs) const;
@@ -150,7 +156,7 @@ signals:
void synchronized();
void blockHeightWSUpdated(QMap<QString, int> heights);
void walletRefreshed();
void walletOpened();
void walletOpened(Wallet *wallet);
void walletCreatedError(const QString &msg);
void walletCreated(Wallet *wallet);
void walletOpenedError(QString msg);
@@ -177,6 +183,7 @@ signals:
void setTitle(const QString &title); // set window title
private:
WalletKeysFilesModel *m_walletKeysFilesModel;
const int m_donationBoundary = 15;
QTimer m_storeTimer;
QUrl m_wsUrl = QUrl(QStringLiteral("ws://feathercitimllbmdktu6cmjo3fizgmyfrntntqzu6xguqa2rlq5cgid.onion/ws"));