mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-03-23 18:53:13 +00:00
58 lines
1.9 KiB
Rust
58 lines
1.9 KiB
Rust
use common::{error::ExecutionFailureKind, sequencer_client::json::SendTxResponse};
|
|
use nssa::AccountId;
|
|
use nssa_core::{
|
|
MembershipProof, NullifierPublicKey, SharedSecretKey, encryption::IncomingViewingPublicKey,
|
|
};
|
|
|
|
use crate::WalletCore;
|
|
|
|
impl WalletCore {
|
|
pub async fn send_shielded_native_token_transfer_already_initialized(
|
|
&self,
|
|
from: AccountId,
|
|
to: AccountId,
|
|
balance_to_move: u128,
|
|
to_proof: MembershipProof,
|
|
) -> Result<(SendTxResponse, [SharedSecretKey; 1]), ExecutionFailureKind> {
|
|
let (instruction_data, program, tx_pre_check) =
|
|
WalletCore::auth_transfer_preparation(balance_to_move);
|
|
|
|
self.shielded_two_accs_all_init(from, to, instruction_data, tx_pre_check, program, to_proof)
|
|
.await
|
|
}
|
|
|
|
pub async fn send_shielded_native_token_transfer_not_initialized(
|
|
&self,
|
|
from: AccountId,
|
|
to: AccountId,
|
|
balance_to_move: u128,
|
|
) -> Result<(SendTxResponse, [SharedSecretKey; 1]), ExecutionFailureKind> {
|
|
let (instruction_data, program, tx_pre_check) =
|
|
WalletCore::auth_transfer_preparation(balance_to_move);
|
|
|
|
self.shielded_two_accs_receiver_uninit(from, to, instruction_data, tx_pre_check, program)
|
|
.await
|
|
}
|
|
|
|
pub async fn send_shielded_native_token_transfer_outer_account(
|
|
&self,
|
|
from: AccountId,
|
|
to_npk: NullifierPublicKey,
|
|
to_ipk: IncomingViewingPublicKey,
|
|
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
|
|
}
|
|
}
|