Fmt happy in nightly

This commit is contained in:
Daniel 2026-01-26 10:45:51 +01:00
parent 272cbfe400
commit addc65933f
6 changed files with 43 additions and 32 deletions

View File

@ -4,12 +4,14 @@ use std::ptr;
use nssa::AccountId;
use crate::block_on;
use crate::error::{print_error, WalletFfiError};
use crate::types::{
FfiAccount, FfiAccountList, FfiAccountListEntry, FfiBytes32, FfiProgramId, WalletHandle,
use crate::{
block_on,
error::{print_error, WalletFfiError},
types::{
FfiAccount, FfiAccountList, FfiAccountListEntry, FfiBytes32, FfiProgramId, WalletHandle,
},
wallet::get_wallet,
};
use crate::wallet::get_wallet;
/// Create a new public account.
///

View File

@ -4,9 +4,11 @@ use std::ptr;
use nssa::{AccountId, PublicKey};
use crate::error::{print_error, WalletFfiError};
use crate::types::{FfiBytes32, FfiPrivateAccountKeys, FfiPublicAccountKey, WalletHandle};
use crate::wallet::get_wallet;
use crate::{
error::{print_error, WalletFfiError},
types::{FfiBytes32, FfiPrivateAccountKeys, FfiPublicAccountKey, WalletHandle},
wallet::get_wallet,
};
/// Get the public key for a public account.
///

View File

@ -28,14 +28,13 @@ pub mod transfer;
pub mod types;
pub mod wallet;
use tokio::runtime::Handle;
use crate::error::{print_error, WalletFfiError};
// Re-export public types for cbindgen
pub use error::WalletFfiError as FfiError;
use tokio::runtime::Handle;
pub use types::*;
use crate::error::{print_error, WalletFfiError};
/// Get a reference to the global runtime.
pub(crate) fn get_runtime() -> Result<Handle, WalletFfiError> {
Handle::try_current().map_err(|_| WalletFfiError::RuntimeError)

View File

@ -1,9 +1,11 @@
//! Block synchronization functions.
use crate::block_on;
use crate::error::{print_error, WalletFfiError};
use crate::types::WalletHandle;
use crate::wallet::get_wallet;
use crate::{
block_on,
error::{print_error, WalletFfiError},
types::WalletHandle,
wallet::get_wallet,
};
/// Synchronize private accounts to a specific block.
///

View File

@ -1,16 +1,17 @@
//! Token transfer functions.
use std::ffi::CString;
use std::ptr;
use std::{ffi::CString, ptr};
use common::error::ExecutionFailureKind;
use nssa::AccountId;
use wallet::program_facades::native_token_transfer::NativeTokenTransfer;
use crate::block_on;
use crate::error::{print_error, WalletFfiError};
use crate::types::{FfiBytes32, FfiTransferResult, WalletHandle};
use crate::wallet::get_wallet;
use crate::{
block_on,
error::{print_error, WalletFfiError},
types::{FfiBytes32, FfiTransferResult, WalletHandle},
wallet::get_wallet,
};
/// Send a public token transfer.
///

View File

@ -1,15 +1,19 @@
//! Wallet lifecycle management functions.
use std::ffi::{c_char, CStr};
use std::path::PathBuf;
use std::ptr;
use std::sync::Mutex;
use std::{
ffi::{c_char, CStr},
path::PathBuf,
ptr,
sync::Mutex,
};
use wallet::WalletCore;
use crate::block_on;
use crate::error::{print_error, WalletFfiError};
use crate::types::WalletHandle;
use crate::{
block_on,
error::{print_error, WalletFfiError},
types::WalletHandle,
};
/// Internal wrapper around WalletCore with mutex for thread safety.
pub(crate) struct WalletWrapper {
@ -172,8 +176,8 @@ pub unsafe extern "C" fn wallet_ffi_open(
/// After calling this function, the handle is invalid and must not be used.
///
/// # Safety
/// - The handle must be either null or a valid handle from `wallet_ffi_create_new()`
/// or `wallet_ffi_open()`.
/// - The handle must be either null or a valid handle from `wallet_ffi_create_new()` or
/// `wallet_ffi_open()`.
/// - The handle must not be used after this call.
#[no_mangle]
pub unsafe extern "C" fn wallet_ffi_destroy(handle: *mut WalletHandle) {
@ -229,7 +233,8 @@ pub unsafe extern "C" fn wallet_ffi_save(handle: *mut WalletHandle) -> WalletFfi
/// - `handle`: Valid wallet handle
///
/// # Returns
/// - Pointer to null-terminated string on success (caller must free with `wallet_ffi_free_string()`)
/// - Pointer to null-terminated string on success (caller must free with
/// `wallet_ffi_free_string()`)
/// - Null pointer on error
///
/// # Safety