Sergio Chouhy 50be74580b refactor!: move LEZ related crates to dedicated directory
BREAKING CHANGE: LEZ crates have been moved from top-level directories into
  a dedicated `lez/` subdirectory. The following crates were relocated:

    common          → lez/common
    indexer         → lez/indexer
    explorer_service→ lez/explorer_service
    keycard_wallet  → lez/keycard_wallet
    mempool         → lez/mempool
    sequencer       → lez/sequencer
    storage         → lez/storage
    testnet_initial_state → lez/testnet_initial_state
    wallet          → lez/wallet
    wallet-ffi      → lez/wallet-ffi

  Any external tooling, scripts, or paths referencing these crates at their
  previous top-level locations must be updated.
2026-06-02 14:17:59 -03:00

43 lines
1.1 KiB
Rust

use lee::{Account, program::Program};
use lee_core::program::InstructionData;
use crate::{ExecutionFailureKind, WalletCore};
pub mod deshielded;
pub mod private;
pub mod public;
pub mod shielded;
#[expect(
clippy::multiple_inherent_impl,
reason = "impl blocks split across multiple files for organization"
)]
pub struct NativeTokenTransfer<'wallet>(pub &'wallet WalletCore);
fn auth_transfer_preparation(
balance_to_move: u128,
) -> (
InstructionData,
Program,
impl FnOnce(&[&Account]) -> Result<(), ExecutionFailureKind>,
) {
let instruction_data =
Program::serialize_instruction(authenticated_transfer_core::Instruction::Transfer {
amount: balance_to_move,
})
.unwrap();
let program = Program::authenticated_transfer_program();
// TODO: handle large Err-variant properly
let tx_pre_check = move |accounts: &[&Account]| {
let from = accounts[0];
if from.balance >= balance_to_move {
Ok(())
} else {
Err(ExecutionFailureKind::InsufficientFundsError)
}
};
(instruction_data, program, tx_pre_check)
}