diff --git a/impls/monero.dart/lib/src/checksum_monero.dart b/impls/monero.dart/lib/src/checksum_monero.dart index 603eb219..78a87485 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 3fe2f813..2f62780d 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 245013a9..dbc309ce 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 30a03cdb..ebd0d47a 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; @@ -843,17 +843,6 @@ extern "C" { 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, @@ -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 56373da8..b40cb94b 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> { 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 { + 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 03bb061d..542a6b96 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 02869fe4..d2cd521a 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