mirror of
https://github.com/oxen-io/oxen-core.git
synced 2023-12-14 02:22:56 +01:00
Merge remote-tracking branch 'origin/stable' into dev
This commit is contained in:
commit
2861648627
21 changed files with 341 additions and 87 deletions
|
@ -1,6 +1,6 @@
|
|||
local default_deps_base='libsystemd-dev libboost-thread-dev libgtest-dev ' +
|
||||
'libboost-serialization-dev libboost-program-options-dev libunbound-dev nettle-dev libevent-dev libminiupnpc-dev ' +
|
||||
'libunwind8-dev libsodium-dev libssl-dev libreadline-dev libhidapi-dev libusb-1.0-0-dev libprotobuf-dev protobuf-compiler python3 ' +
|
||||
'libunwind8-dev libsodium-dev libssl-dev libreadline-dev libhidapi-dev libusb-1.0-0-dev python3 ' +
|
||||
'pkg-config libsqlite3-dev qttools5-dev libcurl4-openssl-dev';
|
||||
local default_deps='g++ ' + default_deps_base; // g++ sometimes needs replacement
|
||||
|
||||
|
@ -242,9 +242,8 @@ local gui_wallet_step_darwin = {
|
|||
+ android_build_steps('armeabi-v7a', cmake_extra='-DARCH=armv7-a -DARCH_ID=arm32')
|
||||
+ android_build_steps('arm64-v8a', cmake_extra='-DARCH=armv8-a -DARCH_ID=arm64')
|
||||
+ android_build_steps('x86_64', cmake_extra='-DARCH="x86-64 -msse4.2 -mpopcnt" -DARCH_ID=x86-64')
|
||||
+ android_build_steps('x86', cmake_extra='-DARCH="i686 -mssse3 -mfpmath=sse" -DARCH_ID=i386')
|
||||
+ [
|
||||
'./utils/build_scripts/drone-android-static-upload.sh armeabi-v7a arm64-v8a x86_64 x86'
|
||||
'./utils/build_scripts/drone-android-static-upload.sh armeabi-v7a arm64-v8a x86_64'
|
||||
]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -247,6 +247,8 @@ if (BUILD_TESTS)
|
|||
add_definitions(-DUNIT_TEST)
|
||||
endif()
|
||||
|
||||
OPTION(USE_DEVICE_TREZOR "Build Trezor support (currently non-functional)" OFF)
|
||||
|
||||
find_package(Git)
|
||||
if(NOT MANUAL_SUBMODULES)
|
||||
if(GIT_FOUND)
|
||||
|
@ -496,8 +498,9 @@ add_subdirectory(external)
|
|||
|
||||
target_compile_definitions(easylogging PRIVATE AUTO_INITIALIZE_EASYLOGGINGPP)
|
||||
|
||||
# Trezor support check
|
||||
include(CheckTrezor)
|
||||
if(USE_DEVICE_TREZOR)
|
||||
include(CheckTrezor)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__")
|
||||
|
@ -983,7 +986,16 @@ set(git_tag "-unknown")
|
|||
if(GIT_FOUND)
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --abbrev-ref HEAD RESULT_VARIABLE ret OUTPUT_VARIABLE branch OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT ret AND branch STREQUAL "stable")
|
||||
set(git_tag "") # No tag if we're building the stable branch
|
||||
# Get the tag description; for a tagged release this will be just the tag (v1.2.3); for
|
||||
# something following a tag this will be something like "v1.2.3-2-abcdef" for something 2
|
||||
# commits beyond the tag, currently at commit "abcdef".
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tags --abbrev=6 HEAD RESULT_VARIABLE ret OUTPUT_VARIABLE tag OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT ret AND tag MATCHES "v[0-9]+\\.[0-9]+\\.[0-9]+(-.*)")
|
||||
# We're building something following a tagged release, so append the post-version git tag info
|
||||
set(git_tag "${CMAKE_MATCH_1}")
|
||||
else()
|
||||
set(git_tag "") # No tag appended if we're building a tagged stable branch release
|
||||
endif()
|
||||
else()
|
||||
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short=9 HEAD RESULT_VARIABLE ret OUTPUT_VARIABLE commithash OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
if(NOT ret)
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
OPTION(USE_DEVICE_TREZOR "Trezor support compilation" ON)
|
||||
OPTION(USE_DEVICE_TREZOR_LIBUSB "Trezor LibUSB compilation" ON)
|
||||
OPTION(USE_DEVICE_TREZOR_UDP_RELEASE "Trezor UdpTransport in release mode" OFF)
|
||||
OPTION(USE_DEVICE_TREZOR_DEBUG "Trezor Debugging enabled" OFF)
|
||||
|
|
|
@ -540,25 +540,27 @@ endif()
|
|||
|
||||
|
||||
|
||||
set(protobuf_extra "")
|
||||
if(ANDROID)
|
||||
set(protobuf_extra "LDFLAGS=-llog")
|
||||
if(USE_DEVICE_TREZOR)
|
||||
set(protobuf_extra "")
|
||||
if(ANDROID)
|
||||
set(protobuf_extra "LDFLAGS=-llog")
|
||||
endif()
|
||||
build_external(protobuf
|
||||
CONFIGURE_COMMAND
|
||||
./configure ${cross_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic
|
||||
"CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}" "CXXFLAGS=${deps_CXXFLAGS}"
|
||||
${cross_extra} ${protobuf_extra}
|
||||
"CPP=${deps_cc} -E" "CXXCPP=${deps_cxx} -E"
|
||||
"CC_FOR_BUILD=${deps_cc}" "CXX_FOR_BUILD=${deps_cxx}" # Thanks Google for making people hunt for undocumented magic variables
|
||||
BUILD_BYPRODUCTS
|
||||
${DEPS_DESTDIR}/lib/libprotobuf-lite.a
|
||||
${DEPS_DESTDIR}/lib/libprotobuf.a
|
||||
${DEPS_DESTDIR}/lib/libprotoc.a
|
||||
${DEPS_DESTDIR}/include/google/protobuf
|
||||
)
|
||||
add_static_target(protobuf_lite protobuf_external libprotobuf-lite.a)
|
||||
add_static_target(protobuf_bloated protobuf_external libprotobuf.a)
|
||||
endif()
|
||||
build_external(protobuf
|
||||
CONFIGURE_COMMAND
|
||||
./configure ${cross_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic
|
||||
"CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}" "CXXFLAGS=${deps_CXXFLAGS}"
|
||||
${cross_extra} ${protobuf_extra}
|
||||
"CPP=${deps_cc} -E" "CXXCPP=${deps_cxx} -E"
|
||||
"CC_FOR_BUILD=${deps_cc}" "CXX_FOR_BUILD=${deps_cxx}" # Thanks Google for making people hunt for undocumented magic variables
|
||||
BUILD_BYPRODUCTS
|
||||
${DEPS_DESTDIR}/lib/libprotobuf-lite.a
|
||||
${DEPS_DESTDIR}/lib/libprotobuf.a
|
||||
${DEPS_DESTDIR}/lib/libprotoc.a
|
||||
${DEPS_DESTDIR}/include/google/protobuf
|
||||
)
|
||||
add_static_target(protobuf_lite protobuf_external libprotobuf-lite.a)
|
||||
add_static_target(protobuf_bloated protobuf_external libprotobuf.a)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -95,6 +95,11 @@ function(combine_archives output_archive)
|
|||
endfunction(combine_archives)
|
||||
|
||||
if (STATIC AND BUILD_STATIC_DEPS)
|
||||
set(merged_protobuf)
|
||||
if(TARGET protobuf_lite)
|
||||
set(merged_protobuf protobuf_lite)
|
||||
endif()
|
||||
|
||||
combine_archives(wallet_merged
|
||||
wallet_api
|
||||
wallet
|
||||
|
@ -124,7 +129,7 @@ if (STATIC AND BUILD_STATIC_DEPS)
|
|||
expat
|
||||
libunbound
|
||||
sqlite3
|
||||
protobuf_lite
|
||||
${merged_protobuf}
|
||||
sodium
|
||||
libzmq
|
||||
CURL::libcurl
|
||||
|
|
|
@ -38,12 +38,15 @@
|
|||
#include <vector>
|
||||
|
||||
namespace Wallet {
|
||||
|
||||
|
||||
EXPORT
|
||||
AddressBook::~AddressBook() {}
|
||||
|
||||
|
||||
EXPORT
|
||||
AddressBookImpl::AddressBookImpl(WalletImpl *wallet)
|
||||
: m_wallet(wallet), m_errorCode(Status_Ok) {}
|
||||
|
||||
EXPORT
|
||||
bool AddressBookImpl::addRow(const std::string &dst_addr, const std::string &description)
|
||||
{
|
||||
clearStatus();
|
||||
|
@ -63,6 +66,7 @@ bool AddressBookImpl::addRow(const std::string &dst_addr, const std::string &des
|
|||
return r;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void AddressBookImpl::refresh()
|
||||
{
|
||||
LOG_PRINT_L2("Refreshing addressbook");
|
||||
|
@ -85,6 +89,7 @@ void AddressBookImpl::refresh()
|
|||
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool AddressBookImpl::deleteRow(std::size_t rowId)
|
||||
{
|
||||
LOG_PRINT_L2("Deleting address book row " << rowId);
|
||||
|
@ -94,6 +99,7 @@ bool AddressBookImpl::deleteRow(std::size_t rowId)
|
|||
return r;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void AddressBookImpl::clearRows() {
|
||||
for (auto r : m_rows) {
|
||||
delete r;
|
||||
|
@ -101,17 +107,20 @@ void AddressBookImpl::clearRows() {
|
|||
m_rows.clear();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void AddressBookImpl::clearStatus(){
|
||||
m_errorString = "";
|
||||
m_errorCode = 0;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<AddressBookRow*> AddressBookImpl::getAll() const
|
||||
{
|
||||
return m_rows;
|
||||
}
|
||||
|
||||
|
||||
EXPORT
|
||||
AddressBookImpl::~AddressBookImpl()
|
||||
{
|
||||
clearRows();
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef WALLET_API_COMMON_DEFINES_H__
|
||||
#define WALLET_API_COMMON_DEFINES_H__
|
||||
#pragma once
|
||||
|
||||
#define tr(x) (x)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define EXPORT __attribute__((visibility("default"))) __attribute__((used))
|
||||
#else
|
||||
#define EXPORT
|
||||
#endif
|
||||
|
||||
|
|
|
@ -44,27 +44,33 @@
|
|||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
PendingTransaction::~PendingTransaction() {}
|
||||
|
||||
|
||||
EXPORT
|
||||
PendingTransactionImpl::PendingTransactionImpl(WalletImpl &wallet)
|
||||
: m_wallet(wallet), m_status{Status_Ok, ""}
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT
|
||||
PendingTransactionImpl::PendingTransactionImpl(WalletImpl& wallet, std::vector<tools::wallet2::pending_tx> pending_tx)
|
||||
: m_wallet{wallet}, m_status{Status_Ok, ""}, m_pending_tx{std::move(pending_tx)}
|
||||
{}
|
||||
|
||||
EXPORT
|
||||
PendingTransactionImpl::~PendingTransactionImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void PendingTransactionImpl::setError(std::string error_msg) {
|
||||
m_status = {Status_Error, tr(error_msg)};
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<std::string> PendingTransactionImpl::txid() const
|
||||
{
|
||||
std::vector<std::string> txid;
|
||||
|
@ -73,6 +79,7 @@ std::vector<std::string> PendingTransactionImpl::txid() const
|
|||
return txid;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool PendingTransactionImpl::commit(std::string_view filename_, bool overwrite, bool blink)
|
||||
{
|
||||
|
||||
|
@ -148,6 +155,7 @@ bool PendingTransactionImpl::commit(std::string_view filename_, bool overwrite,
|
|||
return good();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t PendingTransactionImpl::amount() const
|
||||
{
|
||||
uint64_t result = 0;
|
||||
|
@ -159,6 +167,7 @@ uint64_t PendingTransactionImpl::amount() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t PendingTransactionImpl::dust() const
|
||||
{
|
||||
uint64_t result = 0;
|
||||
|
@ -168,6 +177,7 @@ uint64_t PendingTransactionImpl::dust() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t PendingTransactionImpl::fee() const
|
||||
{
|
||||
uint64_t result = 0;
|
||||
|
@ -177,11 +187,13 @@ uint64_t PendingTransactionImpl::fee() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t PendingTransactionImpl::txCount() const
|
||||
{
|
||||
return m_pending_tx.size();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<uint32_t> PendingTransactionImpl::subaddrAccount() const
|
||||
{
|
||||
std::vector<uint32_t> result;
|
||||
|
@ -190,6 +202,7 @@ std::vector<uint32_t> PendingTransactionImpl::subaddrAccount() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<std::set<uint32_t>> PendingTransactionImpl::subaddrIndices() const
|
||||
{
|
||||
std::vector<std::set<uint32_t>> result;
|
||||
|
@ -198,6 +211,7 @@ std::vector<std::set<uint32_t>> PendingTransactionImpl::subaddrIndices() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::string PendingTransactionImpl::multisigSignData() {
|
||||
try {
|
||||
if (!m_wallet.multisig().isMultisig) {
|
||||
|
@ -217,6 +231,7 @@ std::string PendingTransactionImpl::multisigSignData() {
|
|||
return std::string();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void PendingTransactionImpl::signMultisigTx() {
|
||||
try {
|
||||
std::vector<crypto::hash> ignore;
|
||||
|
@ -236,6 +251,7 @@ void PendingTransactionImpl::signMultisigTx() {
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<std::string> PendingTransactionImpl::signersKeys() const {
|
||||
std::vector<std::string> keys;
|
||||
keys.reserve(m_signers.size());
|
||||
|
|
|
@ -1,31 +1,37 @@
|
|||
#include "stake_unlock_result.h"
|
||||
#include "common_defines.h"
|
||||
#include "pending_transaction.h"
|
||||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
StakeUnlockResultImpl::StakeUnlockResultImpl(WalletImpl& w, tools::wallet2::request_stake_unlock_result res)
|
||||
: wallet{w}, result(std::move(res))
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT
|
||||
StakeUnlockResultImpl::~StakeUnlockResultImpl()
|
||||
{
|
||||
LOG_PRINT_L3("Stake Unlock Result Deleted");
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
EXPORT
|
||||
bool StakeUnlockResultImpl::success()
|
||||
{
|
||||
return result.success;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
EXPORT
|
||||
std::string StakeUnlockResultImpl::msg()
|
||||
{
|
||||
return result.msg;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
EXPORT
|
||||
PendingTransaction* StakeUnlockResultImpl::ptx()
|
||||
{
|
||||
return new PendingTransactionImpl{wallet, {{result.ptx}}};
|
||||
|
|
|
@ -36,17 +36,21 @@
|
|||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
Subaddress::~Subaddress() {}
|
||||
|
||||
EXPORT
|
||||
SubaddressImpl::SubaddressImpl(WalletImpl *wallet)
|
||||
: m_wallet(wallet) {}
|
||||
|
||||
EXPORT
|
||||
void SubaddressImpl::addRow(uint32_t accountIndex, const std::string &label)
|
||||
{
|
||||
m_wallet->m_wallet->add_subaddress(accountIndex, label);
|
||||
refresh(accountIndex);
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void SubaddressImpl::setLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label)
|
||||
{
|
||||
try
|
||||
|
@ -60,6 +64,7 @@ void SubaddressImpl::setLabel(uint32_t accountIndex, uint32_t addressIndex, cons
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void SubaddressImpl::refresh(uint32_t accountIndex)
|
||||
{
|
||||
LOG_PRINT_L2("Refreshing subaddress");
|
||||
|
@ -71,6 +76,7 @@ void SubaddressImpl::refresh(uint32_t accountIndex)
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void SubaddressImpl::clearRows() {
|
||||
for (auto r : m_rows) {
|
||||
delete r;
|
||||
|
@ -78,11 +84,13 @@ void SubaddressImpl::clearRows() {
|
|||
m_rows.clear();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<SubaddressRow*> SubaddressImpl::getAll() const
|
||||
{
|
||||
return m_rows;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
SubaddressImpl::~SubaddressImpl()
|
||||
{
|
||||
clearRows();
|
||||
|
|
|
@ -36,23 +36,28 @@
|
|||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
SubaddressAccount::~SubaddressAccount() {}
|
||||
|
||||
EXPORT
|
||||
SubaddressAccountImpl::SubaddressAccountImpl(WalletImpl *wallet)
|
||||
: m_wallet(wallet) {}
|
||||
|
||||
EXPORT
|
||||
void SubaddressAccountImpl::addRow(const std::string &label)
|
||||
{
|
||||
m_wallet->m_wallet->add_subaddress_account(label);
|
||||
refresh();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void SubaddressAccountImpl::setLabel(uint32_t accountIndex, const std::string &label)
|
||||
{
|
||||
m_wallet->m_wallet->set_subaddress_label({accountIndex, 0}, label);
|
||||
refresh();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void SubaddressAccountImpl::refresh()
|
||||
{
|
||||
LOG_PRINT_L2("Refreshing subaddress account");
|
||||
|
@ -70,6 +75,7 @@ void SubaddressAccountImpl::refresh()
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void SubaddressAccountImpl::clearRows() {
|
||||
for (auto r : m_rows) {
|
||||
delete r;
|
||||
|
@ -77,11 +83,13 @@ void SubaddressAccountImpl::clearRows() {
|
|||
m_rows.clear();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<SubaddressAccountRow*> SubaddressAccountImpl::getAll() const
|
||||
{
|
||||
return m_rows;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
SubaddressAccountImpl::~SubaddressAccountImpl()
|
||||
{
|
||||
clearRows();
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "transaction_history.h"
|
||||
#include "transaction_info.h"
|
||||
#include "wallet.h"
|
||||
#include "common_defines.h"
|
||||
|
||||
#include "crypto/hash.h"
|
||||
#include "wallet/wallet2.h"
|
||||
|
@ -42,21 +43,25 @@
|
|||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
TransactionHistory::~TransactionHistory() {}
|
||||
|
||||
|
||||
EXPORT
|
||||
TransactionHistoryImpl::TransactionHistoryImpl(WalletImpl *wallet)
|
||||
: m_wallet(wallet)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
EXPORT
|
||||
TransactionHistoryImpl::~TransactionHistoryImpl()
|
||||
{
|
||||
for (auto t : m_history)
|
||||
delete t;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
int TransactionHistoryImpl::count() const
|
||||
{
|
||||
std::shared_lock lock{m_historyMutex};
|
||||
|
@ -64,6 +69,7 @@ int TransactionHistoryImpl::count() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
TransactionInfo *TransactionHistoryImpl::transaction(int index) const
|
||||
{
|
||||
std::shared_lock lock{m_historyMutex};
|
||||
|
@ -74,6 +80,7 @@ TransactionInfo *TransactionHistoryImpl::transaction(int index) const
|
|||
return index_ < m_history.size() ? m_history[index_] : nullptr;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
TransactionInfo *TransactionHistoryImpl::transaction(std::string_view id) const
|
||||
{
|
||||
std::shared_lock lock{m_historyMutex};
|
||||
|
@ -84,6 +91,7 @@ TransactionInfo *TransactionHistoryImpl::transaction(std::string_view id) const
|
|||
return itr != m_history.end() ? *itr : nullptr;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<TransactionInfo *> TransactionHistoryImpl::getAll() const
|
||||
{
|
||||
std::shared_lock lock{m_historyMutex};
|
||||
|
@ -98,6 +106,7 @@ static reward_type from_pay_type(wallet::pay_type ptype) {
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void TransactionHistoryImpl::refresh()
|
||||
{
|
||||
// multithreaded access:
|
||||
|
|
|
@ -29,16 +29,20 @@
|
|||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include "transaction_info.h"
|
||||
#include "common_defines.h"
|
||||
|
||||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
TransactionInfo::~TransactionInfo() {}
|
||||
|
||||
EXPORT
|
||||
TransactionInfo::Transfer::Transfer(uint64_t _amount, std::string _address)
|
||||
: amount(_amount), address(std::move(_address)) {}
|
||||
|
||||
|
||||
EXPORT
|
||||
TransactionInfoImpl::TransactionInfoImpl()
|
||||
: m_direction(Direction_Out)
|
||||
, m_pending(false)
|
||||
|
@ -55,92 +59,110 @@ TransactionInfoImpl::TransactionInfoImpl()
|
|||
|
||||
}
|
||||
|
||||
EXPORT
|
||||
TransactionInfoImpl::~TransactionInfoImpl()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
EXPORT
|
||||
int TransactionInfoImpl::direction() const
|
||||
{
|
||||
return m_direction;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool TransactionInfoImpl::isServiceNodeReward() const
|
||||
{
|
||||
return m_reward_type == reward_type::service_node;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool TransactionInfoImpl::isMinerReward() const
|
||||
{
|
||||
return m_reward_type == reward_type::miner;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool TransactionInfoImpl::isPending() const
|
||||
{
|
||||
return m_pending;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool TransactionInfoImpl::isFailed() const
|
||||
{
|
||||
return m_failed;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t TransactionInfoImpl::amount() const
|
||||
{
|
||||
return m_amount;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t TransactionInfoImpl::fee() const
|
||||
{
|
||||
return m_fee;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t TransactionInfoImpl::blockHeight() const
|
||||
{
|
||||
return m_blockheight;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::set<uint32_t> TransactionInfoImpl::subaddrIndex() const
|
||||
{
|
||||
return m_subaddrIndex;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint32_t TransactionInfoImpl::subaddrAccount() const
|
||||
{
|
||||
return m_subaddrAccount;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::string TransactionInfoImpl::label() const
|
||||
{
|
||||
return m_label;
|
||||
}
|
||||
|
||||
|
||||
EXPORT
|
||||
std::string TransactionInfoImpl::hash() const
|
||||
{
|
||||
return m_hash;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::time_t TransactionInfoImpl::timestamp() const
|
||||
{
|
||||
return m_timestamp;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::string TransactionInfoImpl::paymentId() const
|
||||
{
|
||||
return m_paymentid;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
const std::vector<TransactionInfo::Transfer> &TransactionInfoImpl::transfers() const
|
||||
{
|
||||
return m_transfers;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t TransactionInfoImpl::confirmations() const
|
||||
{
|
||||
return m_confirmations;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t TransactionInfoImpl::unlockTime() const
|
||||
{
|
||||
return m_unlock_time;
|
||||
|
|
|
@ -42,19 +42,23 @@
|
|||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
UnsignedTransaction::~UnsignedTransaction() {}
|
||||
|
||||
|
||||
EXPORT
|
||||
UnsignedTransactionImpl::UnsignedTransactionImpl(WalletImpl &wallet)
|
||||
: m_wallet(wallet), m_status{Status_Ok, ""}
|
||||
{
|
||||
}
|
||||
|
||||
EXPORT
|
||||
UnsignedTransactionImpl::~UnsignedTransactionImpl()
|
||||
{
|
||||
LOG_PRINT_L3("Unsigned tx deleted");
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool UnsignedTransactionImpl::sign(std::string_view signedFileName_)
|
||||
{
|
||||
auto signedFileName = fs::u8path(signedFileName_);
|
||||
|
@ -82,6 +86,7 @@ bool UnsignedTransactionImpl::sign(std::string_view signedFileName_)
|
|||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
EXPORT
|
||||
bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_num_txes, const std::function<const wallet::tx_construction_data&(size_t)> &get_tx, const std::string &extra_message)
|
||||
{
|
||||
// gather info to ask the user
|
||||
|
@ -197,6 +202,7 @@ bool UnsignedTransactionImpl::checkLoadedTx(const std::function<size_t()> get_nu
|
|||
return true;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<uint64_t> UnsignedTransactionImpl::amount() const
|
||||
{
|
||||
std::vector<uint64_t> result;
|
||||
|
@ -208,6 +214,7 @@ std::vector<uint64_t> UnsignedTransactionImpl::amount() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<uint64_t> UnsignedTransactionImpl::fee() const
|
||||
{
|
||||
std::vector<uint64_t> result;
|
||||
|
@ -220,6 +227,7 @@ std::vector<uint64_t> UnsignedTransactionImpl::fee() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<uint64_t> UnsignedTransactionImpl::mixin() const
|
||||
{
|
||||
std::vector<uint64_t> result;
|
||||
|
@ -236,11 +244,13 @@ std::vector<uint64_t> UnsignedTransactionImpl::mixin() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t UnsignedTransactionImpl::txCount() const
|
||||
{
|
||||
return m_unsigned_tx_set.txes.size();
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<std::string> UnsignedTransactionImpl::paymentId() const
|
||||
{
|
||||
std::vector<std::string> result;
|
||||
|
@ -270,6 +280,7 @@ std::vector<std::string> UnsignedTransactionImpl::paymentId() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<std::string> UnsignedTransactionImpl::recipientAddress() const
|
||||
{
|
||||
// TODO: return integrated address if short payment ID exists
|
||||
|
@ -284,6 +295,7 @@ std::vector<std::string> UnsignedTransactionImpl::recipientAddress() const
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t UnsignedTransactionImpl::minMixinCount() const
|
||||
{
|
||||
uint64_t min_mixin = ~0;
|
||||
|
|
|
@ -28,12 +28,14 @@
|
|||
//
|
||||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
#include "common_defines.h"
|
||||
#include "epee/misc_log_ex.h"
|
||||
#include "common/util.h"
|
||||
|
||||
namespace Wallet {
|
||||
namespace Utils {
|
||||
|
||||
EXPORT
|
||||
bool isAddressLocal(const std::string &address)
|
||||
{
|
||||
try {
|
||||
|
@ -44,6 +46,7 @@ bool isAddressLocal(const std::string &address)
|
|||
}
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void onStartup()
|
||||
{
|
||||
tools::on_startup();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1185,24 +1185,9 @@ struct WalletManagerBase
|
|||
//! returns current blockchain target height
|
||||
virtual uint64_t blockchainTargetHeight() = 0;
|
||||
|
||||
//! returns current network difficulty
|
||||
virtual uint64_t networkDifficulty() = 0;
|
||||
|
||||
//! returns current mining hash rate (0 if not mining)
|
||||
virtual double miningHashRate() = 0;
|
||||
|
||||
//! returns current block target
|
||||
virtual uint64_t blockTarget() = 0;
|
||||
|
||||
//! returns true iff mining
|
||||
virtual bool isMining() = 0;
|
||||
|
||||
//! starts mining with the set number of threads
|
||||
virtual bool startMining(const std::string& address, uint32_t threads = 1) = 0;
|
||||
|
||||
//! stops mining
|
||||
virtual bool stopMining() = 0;
|
||||
|
||||
//! resolves an OpenAlias address to a monero address
|
||||
virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0;
|
||||
};
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
namespace Wallet {
|
||||
|
||||
EXPORT
|
||||
Wallet* WalletManagerImpl::createWallet(std::string_view path, const std::string &password,
|
||||
const std::string &language, NetworkType nettype, uint64_t kdf_rounds)
|
||||
{
|
||||
|
@ -53,6 +54,7 @@ Wallet* WalletManagerImpl::createWallet(std::string_view path, const std::string
|
|||
return wallet;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
Wallet* WalletManagerImpl::openWallet(std::string_view path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds, WalletListener * listener)
|
||||
{
|
||||
WalletImpl* wallet = new WalletImpl(nettype, kdf_rounds);
|
||||
|
@ -67,6 +69,7 @@ Wallet* WalletManagerImpl::openWallet(std::string_view path, const std::string &
|
|||
return wallet;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
Wallet* WalletManagerImpl::recoveryWallet(std::string_view path,
|
||||
const std::string &password,
|
||||
const std::string &mnemonic,
|
||||
|
@ -83,6 +86,7 @@ Wallet* WalletManagerImpl::recoveryWallet(std::string_view path,
|
|||
return wallet;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
Wallet* WalletManagerImpl::createWalletFromKeys(std::string_view path,
|
||||
const std::string &password,
|
||||
const std::string &language,
|
||||
|
@ -101,6 +105,7 @@ Wallet* WalletManagerImpl::createWalletFromKeys(std::string_view path,
|
|||
return wallet;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
Wallet* WalletManagerImpl::createWalletFromDevice(std::string_view path,
|
||||
const std::string &password,
|
||||
NetworkType nettype,
|
||||
|
@ -130,6 +135,7 @@ Wallet* WalletManagerImpl::createWalletFromDevice(std::string_view path,
|
|||
return wallet;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool WalletManagerImpl::closeWallet(Wallet* wallet, bool store)
|
||||
{
|
||||
WalletImpl* wallet_ = dynamic_cast<WalletImpl*>(wallet);
|
||||
|
@ -144,6 +150,7 @@ bool WalletManagerImpl::closeWallet(Wallet* wallet, bool store)
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool WalletManagerImpl::walletExists(std::string_view path)
|
||||
{
|
||||
bool keys_file_exists;
|
||||
|
@ -155,11 +162,13 @@ bool WalletManagerImpl::walletExists(std::string_view path)
|
|||
return false;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool WalletManagerImpl::verifyWalletPassword(std::string_view keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds) const
|
||||
{
|
||||
return tools::wallet2::verify_password(fs::u8path(keys_file_name), password, no_spend_key, hw::get_device("default"), kdf_rounds);
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool WalletManagerImpl::queryWalletDevice(Wallet::Device& device_type, std::string_view keys_file_name, const std::string &password, uint64_t kdf_rounds) const
|
||||
{
|
||||
hw::device::device_type type;
|
||||
|
@ -168,6 +177,7 @@ bool WalletManagerImpl::queryWalletDevice(Wallet::Device& device_type, std::stri
|
|||
return r;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::vector<std::string> WalletManagerImpl::findWallets(std::string_view path_)
|
||||
{
|
||||
auto path = fs::u8path(path_);
|
||||
|
@ -196,11 +206,13 @@ std::vector<std::string> WalletManagerImpl::findWallets(std::string_view path_)
|
|||
return result;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::string WalletManagerImpl::errorString() const
|
||||
{
|
||||
return m_errorString;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void WalletManagerImpl::setDaemonAddress(std::string address)
|
||||
{
|
||||
if (!tools::starts_with(address, "https://") && !tools::starts_with(address, "http://"))
|
||||
|
@ -208,6 +220,7 @@ void WalletManagerImpl::setDaemonAddress(std::string address)
|
|||
m_http_client.set_base_url(std::move(address));
|
||||
}
|
||||
|
||||
EXPORT
|
||||
bool WalletManagerImpl::connected(uint32_t *version)
|
||||
{
|
||||
using namespace cryptonote::rpc;
|
||||
|
@ -235,12 +248,14 @@ static std::optional<cryptonote::rpc::GET_INFO::response> get_info(cryptonote::r
|
|||
}
|
||||
|
||||
|
||||
EXPORT
|
||||
uint64_t WalletManagerImpl::blockchainHeight()
|
||||
{
|
||||
auto res = get_info(m_http_client);
|
||||
return res ? res->height : 0;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t WalletManagerImpl::blockchainTargetHeight()
|
||||
{
|
||||
auto res = get_info(m_http_client);
|
||||
|
@ -249,46 +264,14 @@ uint64_t WalletManagerImpl::blockchainTargetHeight()
|
|||
return std::max(res->target_height, res->height);
|
||||
}
|
||||
|
||||
uint64_t WalletManagerImpl::networkDifficulty()
|
||||
{
|
||||
auto res = get_info(m_http_client);
|
||||
return res ? res->difficulty : 0;
|
||||
}
|
||||
|
||||
double WalletManagerImpl::miningHashRate()
|
||||
{
|
||||
auto mres = json_rpc<cryptonote::rpc::MINING_STATUS>(m_http_client);
|
||||
return mres && mres->active ? mres->speed : 0.0;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
uint64_t WalletManagerImpl::blockTarget()
|
||||
{
|
||||
auto res = get_info(m_http_client);
|
||||
return res ? res->target : 0;
|
||||
}
|
||||
|
||||
bool WalletManagerImpl::isMining()
|
||||
{
|
||||
auto mres = json_rpc<cryptonote::rpc::MINING_STATUS>(m_http_client);
|
||||
return mres && mres->active;
|
||||
}
|
||||
|
||||
bool WalletManagerImpl::startMining(const std::string &address, uint32_t threads)
|
||||
{
|
||||
cryptonote::rpc::START_MINING::request mreq{};
|
||||
mreq.miner_address = address;
|
||||
mreq.threads_count = threads;
|
||||
|
||||
auto mres = json_rpc<cryptonote::rpc::START_MINING>(m_http_client, mreq);
|
||||
return mres && mres->status == cryptonote::rpc::STATUS_OK;
|
||||
}
|
||||
|
||||
bool WalletManagerImpl::stopMining()
|
||||
{
|
||||
auto mres = json_rpc<cryptonote::rpc::STOP_MINING>(m_http_client);
|
||||
return mres && mres->status == cryptonote::rpc::STATUS_OK;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
std::string WalletManagerImpl::resolveOpenAlias(const std::string &address, bool &dnssec_valid) const
|
||||
{
|
||||
std::vector<std::string> addresses = tools::dns_utils::addresses_from_url(address, dnssec_valid);
|
||||
|
@ -298,6 +281,7 @@ std::string WalletManagerImpl::resolveOpenAlias(const std::string &address, bool
|
|||
}
|
||||
|
||||
///////////////////// WalletManagerFactory implementation //////////////////////
|
||||
EXPORT
|
||||
WalletManagerBase *WalletManagerFactory::getWalletManager()
|
||||
{
|
||||
|
||||
|
@ -310,11 +294,13 @@ WalletManagerBase *WalletManagerFactory::getWalletManager()
|
|||
return g_walletManager;
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void WalletManagerFactory::setLogLevel(int level)
|
||||
{
|
||||
mlog_set_log_level(level);
|
||||
}
|
||||
|
||||
EXPORT
|
||||
void WalletManagerFactory::setLogCategories(const std::string &categories)
|
||||
{
|
||||
mlog_set_log(categories.c_str());
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
|
||||
|
||||
|
||||
#include "wallet/api/wallet2_api.h"
|
||||
#include "wallet2_api.h"
|
||||
#include "rpc/http_client.h"
|
||||
#include <string>
|
||||
|
||||
|
@ -75,12 +75,7 @@ public:
|
|||
bool connected(uint32_t *version = NULL) override;
|
||||
uint64_t blockchainHeight() override;
|
||||
uint64_t blockchainTargetHeight() override;
|
||||
uint64_t networkDifficulty() override;
|
||||
double miningHashRate() override;
|
||||
uint64_t blockTarget() override;
|
||||
bool isMining() override;
|
||||
bool startMining(const std::string &address, uint32_t threads = 1) override;
|
||||
bool stopMining() override;
|
||||
std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -29,6 +29,12 @@ cp src/wallet/api/wallet2_api.h $tmpdir/include
|
|||
|
||||
for android_abi in "$@"; do
|
||||
mkdir -p $tmpdir/lib/${android_abi}
|
||||
strip_arch=$android_abi-linux-android
|
||||
if [ "$android_abi" = "armeabi-v7a" ]; then strip_arch=arm-linux-androideabi
|
||||
elif [ "$android_abi" = "arm64-v8a" ]; then strip_arch=aarch64-linux-android
|
||||
elif [ "$android_abi" = "x86" ]; then strip_arch=i686-linux-android
|
||||
fi
|
||||
/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/$strip_arch/bin/strip --strip-debug build-${android_abi}/src/wallet/api/libwallet_merged.a
|
||||
ln -s ../../../build-${android_abi}/src/wallet/api/libwallet_merged.a $tmpdir/lib/${android_abi}/libwallet_api.a
|
||||
done
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ mkdir -p $tmpdir/lib
|
|||
mkdir -p $tmpdir/include
|
||||
|
||||
# Merge the arm64 and simulator libs into a single multi-arch merged lib:
|
||||
lipo -create build/{arm64,sim64}/src/wallet/api/libwallet_merged.a -o $tmpdir/lib/libwallet_merged.a
|
||||
lipo -create build/{arm64,sim64}/src/wallet/api/libwallet_merged.a -o $tmpdir/lib/libwallet_api.a
|
||||
|
||||
cp src/wallet/api/wallet2_api.h $tmpdir/include
|
||||
|
||||
|
|
Loading…
Reference in a new issue