65 lines
2.0 KiB
Rust
Raw Normal View History

use common::{error::ExecutionFailureKind, sequencer_client::json::SendTxResponse};
use nssa::AccountId;
2025-10-03 15:59:27 -03:00
use nssa_core::{
MembershipProof, NullifierPublicKey, SharedSecretKey, encryption::IncomingViewingPublicKey,
2025-10-03 15:59:27 -03:00
};
2025-09-22 16:38:25 +03:00
use crate::WalletCore;
2025-09-22 16:38:25 +03:00
impl WalletCore {
pub async fn send_private_native_token_transfer_outer_account(
&self,
from: AccountId,
2025-10-03 15:59:27 -03:00
to_npk: NullifierPublicKey,
to_ipk: IncomingViewingPublicKey,
2025-09-22 16:38:25 +03:00
balance_to_move: u128,
2025-10-03 15:59:27 -03:00
) -> Result<(SendTxResponse, [SharedSecretKey; 2]), ExecutionFailureKind> {
let (instruction_data, program, tx_pre_check) =
WalletCore::auth_transfer_preparation(balance_to_move);
self.private_tx_two_accs_receiver_outer(
from,
to_npk,
to_ipk,
instruction_data,
tx_pre_check,
program,
)
.await
2025-09-22 16:38:25 +03:00
}
pub async fn send_private_native_token_transfer_owned_account_not_initialized(
2025-09-22 16:38:25 +03:00
&self,
from: AccountId,
to: AccountId,
2025-09-22 16:38:25 +03:00
balance_to_move: u128,
2025-10-03 15:59:27 -03:00
) -> Result<(SendTxResponse, [SharedSecretKey; 2]), ExecutionFailureKind> {
let (instruction_data, program, tx_pre_check) =
WalletCore::auth_transfer_preparation(balance_to_move);
2025-10-02 22:30:33 -03:00
self.private_tx_two_accs_receiver_uninit(from, to, instruction_data, tx_pre_check, program)
.await
2025-10-15 15:44:52 +03:00
}
pub async fn send_private_native_token_transfer_owned_account_already_initialized(
2025-10-15 15:44:52 +03:00
&self,
from: AccountId,
to: AccountId,
2025-10-15 15:44:52 +03:00
balance_to_move: u128,
to_proof: MembershipProof,
2025-10-15 15:44:52 +03:00
) -> Result<(SendTxResponse, [SharedSecretKey; 2]), ExecutionFailureKind> {
let (instruction_data, program, tx_pre_check) =
WalletCore::auth_transfer_preparation(balance_to_move);
self.private_tx_two_accs_all_init(
from,
to,
instruction_data,
tx_pre_check,
program,
to_proof,
)
.await
2025-09-22 16:38:25 +03:00
}
}