mirror of
https://github.com/monero-project/monero.git
synced 2025-01-28 18:56:31 +02:00
More methods
This commit is contained in:
parent
c1ea0ef1fc
commit
46417193b9
@ -70,6 +70,33 @@ amount_t Wallet::getUnlockedBalance() const {
|
||||
return fromMini(getUnlockedBalanceMini());
|
||||
}
|
||||
|
||||
const std::vector<Transfer> Wallet::getIncomingTransfers() const {
|
||||
|
||||
std::vector<Transfer> lTransfers;
|
||||
|
||||
tools::wallet2::transfer_container lIncomingTransfers;
|
||||
|
||||
|
||||
/* TODO : Throw exception */
|
||||
wallet_impl->get_transfers(lIncomingTransfers);
|
||||
|
||||
|
||||
for(tools::wallet2::transfer_details lTransferDetail : lIncomingTransfers) {
|
||||
Transfer lTransfer;
|
||||
lTransfer.block_height = lTransferDetail.m_block_height;
|
||||
lTransfer.global_output_index = lTransferDetail.m_global_output_index;
|
||||
lTransfer.local_output_index = lTransferDetail.m_internal_output_index;
|
||||
lTransfer.spent = lTransferDetail.m_spent;
|
||||
lTransfer.amount_mini = lTransferDetail.amount();
|
||||
|
||||
lTransfer.amount = fromMini(lTransfer.amount_mini);
|
||||
|
||||
lTransfers.push_back(lTransfer);
|
||||
}
|
||||
|
||||
return lTransfers;
|
||||
|
||||
}
|
||||
|
||||
bool Wallet::walletExists(const std::string pWalletFile, bool& oWallet_data_exists, bool& oWallet_keys_exist) {
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
// #include <inttypes.h>
|
||||
#include <vector>
|
||||
#include <inttypes.h>
|
||||
|
||||
namespace tools { class wallet2; }
|
||||
|
||||
@ -44,6 +45,15 @@ namespace Errors {
|
||||
|
||||
}
|
||||
|
||||
struct Transfer {
|
||||
uint64_t block_height;
|
||||
uint64_t global_output_index;
|
||||
size_t local_output_index;
|
||||
bool spent;
|
||||
amount_mini_t amount_mini;
|
||||
amount_t amount;
|
||||
};
|
||||
|
||||
class Wallet {
|
||||
|
||||
public:
|
||||
@ -63,6 +73,8 @@ public:
|
||||
static bool walletExists(const std::string pWalletFile, bool& oWallet_data_exists, bool& oWallet_keys_exist);
|
||||
static Wallet generateWallet(const std::string pWalletFile, const std::string& pWalletPassword);
|
||||
|
||||
const std::vector<Transfer> getIncomingTransfers() const;
|
||||
|
||||
private:
|
||||
tools::wallet2* wallet_impl;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user