summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCzarek Nakamoto <cyjan@mrcyjanek.net>2025-01-05 13:56:28 +0100
committerCzarek Nakamoto <cyjan@mrcyjanek.net>2025-01-05 13:56:36 +0100
commit64d5d9b6f8d8bfc9b6b7781860bd2f7d042e247a (patch)
treeb504fb99017176075294252f0b00fd8d8ab4593f
parent085d74b37b478be77bc873d66876247a751aa957 (diff)
enable logging
fix build
-rw-r--r--impls/monero.dart/lib/src/checksum_monero.dart4
-rw-r--r--impls/monero.rs/build.rs3
-rw-r--r--impls/monero.rs/example/src/main.rs7
-rw-r--r--impls/monero.rs/src/bindings.rs21
-rw-r--r--impls/monero.rs/src/lib.rs20
-rw-r--r--impls/monero.ts/checksum_monero.ts4
-rw-r--r--monero_libwallet2_api_c/src/main/cpp/monero_checksum.h4
7 files changed, 35 insertions, 28 deletions
diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart
index 603eb21..78a8748 100644
--- a/impls/monero.dart/lib/src/checksum_monero.dart
+++ b/impls/monero.dart/lib/src/checksum_monero.dart
@@ -1,4 +1,4 @@
// ignore_for_file: constant_identifier_names
-const String wallet2_api_c_h_sha256 = "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116";
-const String wallet2_api_c_cpp_sha256 = "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
+const String wallet2_api_c_h_sha256 = "6c1ba9b57cb185c6dad030b15bcffe8a4772f33930e7f1d62d23b33514ba6f62";
+const String wallet2_api_c_cpp_sha256 = "1d1deff340408541f5755b4838d06345f63dcdfffe26b14dbdce32a5de839c55-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
const String wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d";
diff --git a/impls/monero.rs/build.rs b/impls/monero.rs/build.rs
index 3fe2f81..2f62780 100644
--- a/impls/monero.rs/build.rs
+++ b/impls/monero.rs/build.rs
@@ -76,8 +76,7 @@ fn main() {
println!("cargo:rustc-link-search=native={}", lib_path.display());
println!("cargo:rustc-link-lib=dylib=monero_libwallet2_api_c");
- println!("cargo:rustc-link-lib=dylib=stdc++");
- println!("cargo:rustc-link-lib=dylib=hidapi-hidraw");
+ // println!("cargo:rustc-link-lib=dylib=libc++");
println!("cargo:rustc-link-arg=-Wl,-rpath,{}", lib_path.display());
// Generate bindings using bindgen.
diff --git a/impls/monero.rs/example/src/main.rs b/impls/monero.rs/example/src/main.rs
index 245013a..dbc309c 100644
--- a/impls/monero.rs/example/src/main.rs
+++ b/impls/monero.rs/example/src/main.rs
@@ -13,7 +13,7 @@ fn main() -> Result<(), WalletError> {
"password".to_string(),
"capital chief route liar question fix clutch water outside pave hamster occur always learn license knife".to_string(),
NetworkType::Mainnet,
- 0, // Restore from the beginning of the blockchain.
+ 3, // Restore from the beginning of the blockchain.
1, // Default KDF rounds.
"".to_string(), // No seed offset.
true, // Create a new wallet.
@@ -26,11 +26,11 @@ fn main() -> Result<(), WalletError> {
// Initialize the wallet.
let config = WalletConfig {
- daemon_address: "https://monero.stackwallet.com:18081".to_string(),
+ daemon_address: "xmr-node.cakewallet.com:18081".to_string(),
upper_transaction_size_limit: 10000, // TODO: use sane value.
daemon_username: "".to_string(),
daemon_password: "".to_string(),
- use_ssl: true,
+ use_ssl: false,
light_wallet: false,
proxy_address: "".to_string(),
};
@@ -41,6 +41,7 @@ fn main() -> Result<(), WalletError> {
// Refresh the wallet.
wallet.refresh()?;
+ // wallet.refresh_async()?;
wallet.throw_if_error()?;
// Wait for the refresh to complete.
diff --git a/impls/monero.rs/src/bindings.rs b/impls/monero.rs/src/bindings.rs
index 30a03cd..ebd0d47 100644
--- a/impls/monero.rs/src/bindings.rs
+++ b/impls/monero.rs/src/bindings.rs
@@ -3,10 +3,10 @@
/* automatically generated by rust-bindgen 0.70.1 */
pub const MONERO_wallet2_api_c_h_sha256: &[u8; 65] =
- b"e8db0ef0324a153f5e3ecca4c0db23c54f4576e84988f04bd4f11c1142f9d7ad\0";
-pub const MONERO_wallet2_api_c_cpp_sha256 : & [u8 ; 106] = b"dca52ac9ee009fda9fb5726543a454885e61d8eb74fb33112288029ed625bec5-b089f9ee69924882c5d14dd1a6991deb05d9d1cd\0" ;
+ b"6c1ba9b57cb185c6dad030b15bcffe8a4772f33930e7f1d62d23b33514ba6f62\0";
+pub const MONERO_wallet2_api_c_cpp_sha256 : & [u8 ; 106] = b"1d1deff340408541f5755b4838d06345f63dcdfffe26b14dbdce32a5de839c55-b089f9ee69924882c5d14dd1a6991deb05d9d1cd\0" ;
pub const MONERO_wallet2_api_c_exp_sha256: &[u8; 65] =
- b"c8913ac41068f67b57c9b0a3c7dd8973e3c1273b66c2ff0aadb0003931da748c\0";
+ b"d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d\0";
pub const NetworkType_MAINNET: ::std::os::raw::c_int = 0;
pub const NetworkType_TESTNET: ::std::os::raw::c_int = 1;
pub const NetworkType_STAGENET: ::std::os::raw::c_int = 2;
@@ -844,17 +844,6 @@ extern "C" {
pub fn MONERO_Wallet_daemonBlockChainHeight(wallet_ptr: *mut ::std::os::raw::c_void) -> u64;
}
extern "C" {
- pub fn MONERO_Wallet_daemonBlockChainHeight_cached(
- wallet_ptr: *mut ::std::os::raw::c_void,
- ) -> u64;
-}
-extern "C" {
- pub fn MONERO_Wallet_daemonBlockChainHeight_runThread(
- wallet_ptr: *mut ::std::os::raw::c_void,
- seconds: ::std::os::raw::c_int,
- );
-}
-extern "C" {
pub fn MONERO_Wallet_daemonBlockChainTargetHeight(
wallet_ptr: *mut ::std::os::raw::c_void,
) -> u64;
@@ -1477,11 +1466,11 @@ extern "C" {
}
extern "C" {
pub fn MONERO_WalletManager_queryWalletDevice(
- device_type: ::std::os::raw::c_int,
+ wm_ptr: *mut ::std::os::raw::c_void,
keys_file_name: *const ::std::os::raw::c_char,
password: *const ::std::os::raw::c_char,
kdf_rounds: u64,
- ) -> bool;
+ ) -> ::std::os::raw::c_int;
}
extern "C" {
pub fn MONERO_WalletManager_findWallets(
diff --git a/impls/monero.rs/src/lib.rs b/impls/monero.rs/src/lib.rs
index 56373da..b40cb94 100644
--- a/impls/monero.rs/src/lib.rs
+++ b/impls/monero.rs/src/lib.rs
@@ -136,6 +136,7 @@ impl WalletManager {
/// ```
pub fn new() -> WalletResult<Arc<Self>> {
unsafe {
+ bindings::MONERO_WalletManagerFactory_setLogLevel(4);
let ptr = bindings::MONERO_WalletManagerFactory_getWalletManager();
let ptr = NonNull::new(ptr).ok_or(WalletError::NullPointer)?;
Ok(Arc::new(WalletManager { ptr }))
@@ -1032,6 +1033,16 @@ impl Wallet {
.map_err(|_| WalletError::FfiError("Invalid proxy address".to_string()))?;
unsafe {
+ let c_empty = CString::new("").unwrap();
+ let c_log_tag = CString::new("moneroc").unwrap();
+ bindings::MONERO_Wallet_init3(
+ self.ptr.as_ptr(),
+ c_empty.as_ptr(),
+ c_log_tag.as_ptr(),
+ c_empty.as_ptr(),
+ true,
+ );
+
let result = bindings::MONERO_Wallet_init(
self.ptr.as_ptr(),
c_daemon_address.as_ptr(),
@@ -1042,7 +1053,7 @@ impl Wallet {
config.light_wallet,
c_proxy_address.as_ptr(),
);
-
+
if result {
Ok(())
} else {
@@ -1117,6 +1128,13 @@ impl Wallet {
}
}
+ pub fn refresh_async(&self) -> WalletResult<Refreshed> {
+ unsafe {
+ bindings::MONERO_Wallet_refreshAsync(self.ptr.as_ptr());
+ return Ok(Refreshed)
+ }
+ }
+
/// Initiates a transfer from the wallet to the specified destinations.
///
/// # Returns
diff --git a/impls/monero.ts/checksum_monero.ts b/impls/monero.ts/checksum_monero.ts
index 03bb061..542a6b9 100644
--- a/impls/monero.ts/checksum_monero.ts
+++ b/impls/monero.ts/checksum_monero.ts
@@ -1,5 +1,5 @@
export const moneroChecksum = {
- wallet2_api_c_h_sha256: "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116",
- wallet2_api_c_cpp_sha256: "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-b089f9ee69924882c5d14dd1a6991deb05d9d1cd",
+ wallet2_api_c_h_sha256: "6c1ba9b57cb185c6dad030b15bcffe8a4772f33930e7f1d62d23b33514ba6f62",
+ wallet2_api_c_cpp_sha256: "1d1deff340408541f5755b4838d06345f63dcdfffe26b14dbdce32a5de839c55-b089f9ee69924882c5d14dd1a6991deb05d9d1cd",
wallet2_api_c_exp_sha256: "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d",
}
diff --git a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h
index 02869fe..d2cd521 100644
--- a/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h
+++ b/monero_libwallet2_api_c/src/main/cpp/monero_checksum.h
@@ -1,6 +1,6 @@
#ifndef MONEROC_CHECKSUMS
#define MONEROC_CHECKSUMS
-const char * MONERO_wallet2_api_c_h_sha256 = "9e80c4b59a0509aa02fbf01e8df2881b89f82225d1765bfa7856cbdbaf7af116";
-const char * MONERO_wallet2_api_c_cpp_sha256 = "d229507db508e574bd2badf4819a38dbead8c16a84311ad32c22c887a6003439-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
+const char * MONERO_wallet2_api_c_h_sha256 = "6c1ba9b57cb185c6dad030b15bcffe8a4772f33930e7f1d62d23b33514ba6f62";
+const char * MONERO_wallet2_api_c_cpp_sha256 = "1d1deff340408541f5755b4838d06345f63dcdfffe26b14dbdce32a5de839c55-b089f9ee69924882c5d14dd1a6991deb05d9d1cd";
const char * MONERO_wallet2_api_c_exp_sha256 = "d0f95f1f3bc49f1f59fe4eb0b61826128d7d3bb75405d5a01a252d02db03097d";
#endif