58 lines
1.9 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 {
2025-10-15 15:44:52 +03:00
pub async fn send_shielded_native_token_transfer_already_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-15 15:44:52 +03:00
to_proof: MembershipProof,
) -> Result<(SendTxResponse, [SharedSecretKey; 1]), ExecutionFailureKind> {
let (instruction_data, program, tx_pre_check) =
WalletCore::auth_transfer_preparation(balance_to_move);
2025-10-15 15:44:52 +03:00
self.shielded_two_accs_all_init(from, to, instruction_data, tx_pre_check, program, to_proof)
.await
2025-10-15 15:44:52 +03:00
}
pub async fn send_shielded_native_token_transfer_not_initialized(
&self,
from: AccountId,
to: AccountId,
2025-10-15 15:44:52 +03:00
balance_to_move: u128,
) -> Result<(SendTxResponse, [SharedSecretKey; 1]), ExecutionFailureKind> {
let (instruction_data, program, tx_pre_check) =
WalletCore::auth_transfer_preparation(balance_to_move);
2025-10-15 15:44:52 +03:00
self.shielded_two_accs_receiver_uninit(from, to, instruction_data, tx_pre_check, program)
.await
2025-09-22 16:38:25 +03:00
}
2025-09-30 14:44:43 -03:00
pub async fn send_shielded_native_token_transfer_outer_account(
2025-09-22 16:38:25 +03:00
&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,
) -> Result<SendTxResponse, ExecutionFailureKind> {
let (instruction_data, program, tx_pre_check) =
WalletCore::auth_transfer_preparation(balance_to_move);
self.shielded_two_accs_receiver_outer(
from,
to_npk,
to_ipk,
instruction_data,
tx_pre_check,
program,
)
.await
2025-09-22 16:38:25 +03:00
}
}