Commit 9b4b8694 authored by Jü's avatar

Updates for Monero v0.15 hard fork

parent 7f49bd88
......@@ -9,4 +9,5 @@ DerivedData/
Breakpoints_v2.xcbkptlist
.vscode
**/xcuserdata/*
.idea
\ No newline at end of file
.idea
XWallet/external-libs/monero_v*
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>1.10.1</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1.10.1.2</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
......
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.10.1</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1.10.1.2</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
......
This diff is collapsed.
......@@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.10.1</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>1.10.1.2</string>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
......@@ -56,5 +56,7 @@
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIUserInterfaceStyle</key>
<string>Light</string>
</dict>
</plist>
// Copyright (c) 2014-2018, The Monero Project
// Copyright (c) 2014-2019, The Monero Project
//
// All rights reserved.
//
......@@ -37,6 +37,7 @@
#include <set>
#include <ctime>
#include <iostream>
#include <stdexcept>
// Public interface for libwallet library
namespace Monero {
......@@ -324,6 +325,20 @@ struct MultisigState {
uint32_t total;
};
struct DeviceProgress {
DeviceProgress(): m_progress(0), m_indeterminate(false) {}
DeviceProgress(double progress, bool indeterminate=false): m_progress(progress), m_indeterminate(indeterminate) {}
virtual double progress() const { return m_progress; }
virtual bool indeterminate() const { return m_indeterminate; }
protected:
double m_progress;
bool m_indeterminate;
};
struct Wallet;
struct WalletListener
{
virtual ~WalletListener() = 0;
......@@ -364,6 +379,41 @@ struct WalletListener
* @brief refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "refresh" synchronously
*/
virtual void refreshed() = 0;
/**
* @brief called by device if the action is required
*/
virtual void onDeviceButtonRequest(uint64_t code) { (void)code; }
/**
* @brief called by device if the button was pressed
*/
virtual void onDeviceButtonPressed() { }
/**
* @brief called by device when PIN is needed
*/
virtual optional<std::string> onDevicePinRequest() {
throw std::runtime_error("Not supported");
}
/**
* @brief called by device when passphrase entry is needed
*/
virtual optional<std::string> onDevicePassphraseRequest(bool on_device) {
if (!on_device) throw std::runtime_error("Not supported");
return optional<std::string>();
}
/**
* @brief Signalizes device operation progress
*/
virtual void onDeviceProgress(const DeviceProgress & event) { (void)event; };
/**
* @brief If the listener is created before the wallet this enables to set created wallet object
*/
virtual void onSetWallet(Wallet * wallet) { (void)wallet; };
};
......@@ -375,7 +425,8 @@ struct Wallet
{
enum Device {
Device_Software = 0,
Device_Ledger = 1
Device_Ledger = 1,
Device_Trezor = 2
};
enum Status {
......@@ -401,6 +452,8 @@ struct Wallet
//! returns both error and error string atomically. suggested to use in instead of status() and errorString()
virtual void statusWithErrorString(int& status, std::string& errorString) const = 0;
virtual bool setPassword(const std::string &password) = 0;
virtual bool setDevicePin(const std::string &pin) { (void)pin; return false; };
virtual bool setDevicePassphrase(const std::string &passphrase) { (void)passphrase; return false; };
virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const = 0;
std::string mainAddress() const { return address(0, 0); }
virtual std::string path() const = 0;
......@@ -649,6 +702,17 @@ struct Wallet
*/
virtual void refreshAsync() = 0;
/**
* @brief rescanBlockchain - rescans the wallet, updating transactions from daemon
* @return - true if refreshed successfully;
*/
virtual bool rescanBlockchain() = 0;
/**
* @brief rescanBlockchainAsync - rescans wallet asynchronously, starting from genesys
*/
virtual void rescanBlockchainAsync() = 0;
/**
* @brief setAutoRefreshInterval - setup interval for automatic refresh.
* @param seconds - interval in millis. if zero or less than zero - automatic refresh disabled;
......@@ -748,6 +812,26 @@ struct Wallet
* @return PendingTransaction
*/
virtual PendingTransaction* restoreMultisigTransaction(const std::string& signData) = 0;
/*!
* \brief createTransactionMultDest creates transaction with multiple destinations. if dst_addr is an integrated address, payment_id is ignored
* \param dst_addr vector of destination address as string
* \param payment_id optional payment_id, can be empty string
* \param amount vector of amounts
* \param mixin_count mixin count. if 0 passed, wallet will use default value
* \param subaddr_account subaddress account from which the input funds are taken
* \param subaddr_indices set of subaddress indices to use for transfer or sweeping. if set empty, all are chosen when sweeping, and one or more are automatically chosen when transferring. after execution, returns the set of actually used indices
* \param priority
* \return PendingTransaction object. caller is responsible to check PendingTransaction::status()
* after object returned
*/
virtual PendingTransaction * createTransactionMultDest(const std::vector<std::string> &dst_addr, const std::string &payment_id,
optional<std::vector<uint64_t>> amount, uint32_t mixin_count,
PendingTransaction::Priority = PendingTransaction::Priority_Low,
uint32_t subaddr_account = 0,
std::set<uint32_t> subaddr_indices = {}) = 0;
/*!
* \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored
* \param dst_addr destination address as string
......@@ -826,6 +910,19 @@ struct Wallet
*/
virtual void setDefaultMixin(uint32_t arg) = 0;
/*!
* \brief setCacheAttribute - attach an arbitrary string to a wallet cache attribute
* \param key - the key
* \param val - the value
* \return true if successful, false otherwise
*/
virtual bool setCacheAttribute(const std::string &key, const std::string &val) = 0;
/*!
* \brief getCacheAttribute - return an arbitrary string attached to a wallet cache attribute
* \param key - the key
* \return the attached string, or empty string if there is none
*/
virtual std::string getCacheAttribute(const std::string &key) const = 0;
/*!
* \brief setUserNote - attach an arbitrary string note to a txid
* \param txid - the transaction id to attach the note to
......@@ -936,6 +1033,12 @@ struct Wallet
* \return Device they are on
*/
virtual Device getDeviceType() const = 0;
//! cold-device protocol key image sync
virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) = 0;
//! shows address on device display
virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0;
};
/**
......@@ -965,9 +1068,10 @@ struct WalletManager
* \param password Password of wallet file
* \param nettype Network type
* \param kdf_rounds Number of rounds for key derivation function
* \param listener Wallet listener to set to the wallet after creation
* \return Wallet instance (Wallet::status() needs to be called to check if opened successfully)
*/
virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds = 1) = 0;
virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) = 0;
Wallet * openWallet(const std::string &path, const std::string &password, bool testnet = false) // deprecated
{
return openWallet(path, password, testnet ? TESTNET : MAINNET);
......@@ -1079,6 +1183,7 @@ struct WalletManager
* \param restoreHeight restore from start height (0 sets to current height)
* \param subaddressLookahead Size of subaddress lookahead (empty sets to some default low value)
* \param kdf_rounds Number of rounds for key derivation function
* \param listener Wallet listener to set to the wallet after creation
* \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully)
*/
virtual Wallet * createWalletFromDevice(const std::string &path,
......@@ -1087,7 +1192,8 @@ struct WalletManager
const std::string &deviceName,
uint64_t restoreHeight = 0,
const std::string &subaddressLookahead = "",
uint64_t kdf_rounds = 1) = 0;
uint64_t kdf_rounds = 1,
WalletListener * listener = nullptr) = 0;
/*!
* \brief Closes wallet. In case operation succeeded, wallet object deleted. in case operation failed, wallet object not deleted
......
......@@ -67,9 +67,9 @@ struct WalletListernerImplementation: Monero::WalletListener
}
private:
callbackActionRefreshed _refreshedHandler = NULL;
callbackActionNewBlock _newBlockHandler = NULL;
void* _handlerClass = NULL;
callbackActionRefreshed _refreshedHandler = nullptr;
callbackActionNewBlock _newBlockHandler = nullptr;
void* _handlerClass = nullptr;
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment