aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/api/wallet2_api.h
diff options
context:
space:
mode:
authornaughtyfox <mail.for.milo@gmail.com>2018-03-21 18:57:15 +0300
committernaughtyfox <mail.for.milo@gmail.com>2018-03-28 18:22:13 +0300
commit5a96056600be8fbcce1f7994971eaf1c2d3181f3 (patch)
treeddfb3c81b919acb04d6c8f07dafeb0fe0c9178a0 /src/wallet/api/wallet2_api.h
parentRefactored: work with wallet api statuses to make setting and getting operati... (diff)
downloadmonero-5a96056600be8fbcce1f7994971eaf1c2d3181f3.tar.xz
WalletApi: getMultisigInfo entry for gui wallets
WalletApi: makeMultisig call introduced WalletApi: finalizeMultisig call introduced WalletApi: new calls exportMultisigImages and importMultisigImages WalletApi: method to return multisig wallet creation state WalletApi: create multisig transaction, sign multisig transaction, commit transaction and get multisig data are added WalletApi: identation and style fixes
Diffstat (limited to 'src/wallet/api/wallet2_api.h')
-rw-r--r--src/wallet/api/wallet2_api.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/src/wallet/api/wallet2_api.h b/src/wallet/api/wallet2_api.h
index 6ffef4400..f762f37c5 100644
--- a/src/wallet/api/wallet2_api.h
+++ b/src/wallet/api/wallet2_api.h
@@ -100,6 +100,30 @@ struct PendingTransaction
virtual uint64_t txCount() const = 0;
virtual std::vector<uint32_t> subaddrAccount() const = 0;
virtual std::vector<std::set<uint32_t>> subaddrIndices() const = 0;
+
+ /**
+ * @brief multisigSignData
+ * @return encoded multisig transaction with signers' keys.
+ * Transfer this data to another wallet participant to sign it.
+ * Assumed use case is:
+ * 1. Initiator:
+ * auto data = pendingTransaction->multisigSignData();
+ * 2. Signer1:
+ * pendingTransaction = wallet->restoreMultisigTransaction(data);
+ * pendingTransaction->signMultisigTx();
+ * auto signed = pendingTransaction->multisigSignData();
+ * 3. Signer2:
+ * pendingTransaction = wallet->restoreMultisigTransaction(signed);
+ * pendingTransaction->signMultisigTx();
+ * pendingTransaction->commit();
+ */
+ virtual std::string multisigSignData() = 0;
+ virtual void signMultisigTx() = 0;
+ /**
+ * @brief signersKeys
+ * @return vector of base58-encoded signers' public keys
+ */
+ virtual std::vector<std::string> signersKeys() const = 0;
};
/**
@@ -291,6 +315,15 @@ struct SubaddressAccount
virtual void refresh() = 0;
};
+struct MultisigState {
+ MultisigState() : isMultisig(false), isReady(false), threshold(0), total(0) {}
+
+ bool isMultisig;
+ bool isReady;
+ uint32_t threshold;
+ uint32_t total;
+};
+
struct WalletListener
{
virtual ~WalletListener() = 0;
@@ -630,6 +663,48 @@ struct Wallet
*/
virtual void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0;
+ /**
+ * @brief multisig - returns current state of multisig wallet creation process
+ * @return MultisigState struct
+ */
+ virtual MultisigState multisig() const = 0;
+ /**
+ * @brief getMultisigInfo
+ * @return serialized and signed multisig info string
+ */
+ virtual std::string getMultisigInfo() const = 0;
+ /**
+ * @brief makeMultisig - switches wallet in multisig state. The one and only creation phase for N / N wallets
+ * @param info - vector of multisig infos from other participants obtained with getMulitisInfo call
+ * @param threshold - number of required signers to make valid transaction. Must be equal to number of participants (N) or N - 1
+ * @return in case of N / N wallets returns empty string since no more key exchanges needed. For N - 1 / N wallets returns base58 encoded extra multisig info
+ */
+ virtual std::string makeMultisig(const std::vector<std::string>& info, uint32_t threshold) = 0;
+ /**
+ * @brief finalizeMultisig - finalizes N - 1 / N multisig wallets creation
+ * @param extraMultisigInfo - wallet participants' extra multisig info obtained with makeMultisig call
+ * @return true if success
+ */
+ virtual bool finalizeMultisig(const std::vector<std::string>& extraMultisigInfo) = 0;
+ /**
+ * @brief exportMultisigImages - exports transfers' key images
+ * @param images - output paramter for hex encoded array of images
+ * @return true if success
+ */
+ virtual bool exportMultisigImages(std::string& images) = 0;
+ /**
+ * @brief importMultisigImages - imports other participants' multisig images
+ * @param images - array of hex encoded arrays of images obtained with exportMultisigImages
+ * @return number of imported images
+ */
+ virtual size_t importMultisigImages(const std::vector<std::string>& images) = 0;
+
+ /**
+ * @brief restoreMultisigTransaction creates PendingTransaction from signData
+ * @param signData encrypted unsigned transaction. Obtained with PendingTransaction::multisigSignData
+ * @return PendingTransaction
+ */
+ virtual PendingTransaction* restoreMultisigTransaction(const std::string& signData) = 0;
/*!
* \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored
* \param dst_addr destination address as string