mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-25 09:29:33 +00:00
fix(wallet): suggestion 1
This commit is contained in:
parent
dc4adfa1a2
commit
97d9188c38
@ -16,7 +16,6 @@ ignore = [
|
||||
{ id = "RUSTSEC-2026-0097", reason = "`rand` v0.8.5 is present transitively from logos crates, modification may break integration" },
|
||||
{ id = "RUSTSEC-2026-0118", reason = "`hickory-proto` v0.25.0-alpha.5 is present transitively from logos crates, modification may break integration" },
|
||||
{ id = "RUSTSEC-2026-0119", reason = "`hickory-proto` v0.25.0-alpha.5 is present transitively from logos crates, modification may break integration" },
|
||||
{ id = "RUSTSEC-2026-0145", reason = "`astral-tokio-tar` v0.6.1 is pulled transitively via testcontainers (integration_tests dev/test path); waiting on upstream fix" },
|
||||
]
|
||||
yanked = "deny"
|
||||
unused-ignored-advisory = "deny"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
use nssa::{AccountId, program::Program};
|
||||
use wallet::{AccountManagerAccountIdentity, WalletCore};
|
||||
use wallet::{AccountIdentity, WalletCore};
|
||||
|
||||
// Before running this example, compile the `hello_world.rs` guest program with:
|
||||
//
|
||||
@ -44,7 +44,7 @@ async fn main() {
|
||||
// Define the desired greeting in ASCII
|
||||
let greeting: Vec<u8> = vec![72, 111, 108, 97, 32, 109, 117, 110, 100, 111, 33];
|
||||
|
||||
let accounts = vec![AccountManagerAccountIdentity::PrivateOwned(account_id)];
|
||||
let accounts = vec![AccountIdentity::PrivateOwned(account_id)];
|
||||
|
||||
// Construct and submit the privacy-preserving transaction
|
||||
wallet_core
|
||||
|
||||
@ -4,7 +4,7 @@ use nssa::{
|
||||
AccountId, ProgramId, privacy_preserving_transaction::circuit::ProgramWithDependencies,
|
||||
program::Program,
|
||||
};
|
||||
use wallet::{AccountManagerAccountIdentity, WalletCore};
|
||||
use wallet::{AccountIdentity, WalletCore};
|
||||
|
||||
// Before running this example, compile the `simple_tail_call.rs` guest program with:
|
||||
//
|
||||
@ -51,7 +51,7 @@ async fn main() {
|
||||
std::iter::once((hello_world.id(), hello_world)).collect();
|
||||
let program_with_dependencies = ProgramWithDependencies::new(simple_tail_call, dependencies);
|
||||
|
||||
let accounts = vec![AccountManagerAccountIdentity::PrivateOwned(account_id)];
|
||||
let accounts = vec![AccountIdentity::PrivateOwned(account_id)];
|
||||
|
||||
// Construct and submit the privacy-preserving transaction
|
||||
let instruction = ();
|
||||
|
||||
@ -2,7 +2,7 @@ use clap::{Parser, Subcommand};
|
||||
use common::transaction::NSSATransaction;
|
||||
use nssa::{PublicTransaction, program::Program, public_transaction};
|
||||
use sequencer_service_rpc::RpcClient as _;
|
||||
use wallet::{AccountManagerAccountIdentity, WalletCore};
|
||||
use wallet::{AccountIdentity, WalletCore};
|
||||
|
||||
// Before running this example, compile the `hello_world_with_move_function.rs` guest program with:
|
||||
//
|
||||
@ -99,7 +99,7 @@ async fn main() {
|
||||
} => {
|
||||
let instruction: Instruction = (WRITE_FUNCTION_ID, greeting.into_bytes());
|
||||
let account_id = account_id.parse().unwrap();
|
||||
let accounts = vec![AccountManagerAccountIdentity::PrivateOwned(account_id)];
|
||||
let accounts = vec![AccountIdentity::PrivateOwned(account_id)];
|
||||
|
||||
wallet_core
|
||||
.send_privacy_preserving_tx(
|
||||
@ -138,8 +138,8 @@ async fn main() {
|
||||
let to = to.parse().unwrap();
|
||||
|
||||
let accounts = vec![
|
||||
AccountManagerAccountIdentity::Public(from),
|
||||
AccountManagerAccountIdentity::PrivateOwned(to),
|
||||
AccountIdentity::Public(from),
|
||||
AccountIdentity::PrivateOwned(to),
|
||||
];
|
||||
|
||||
wallet_core
|
||||
|
||||
@ -18,7 +18,7 @@ use nssa::{
|
||||
use nssa_core::{NullifierPublicKey, encryption::ViewingPublicKey, program::PdaSeed};
|
||||
use tokio::test;
|
||||
use wallet::{
|
||||
AccountManagerAccountIdentity, WalletCore,
|
||||
AccountIdentity, WalletCore,
|
||||
cli::{Command, account::AccountSubcommand},
|
||||
};
|
||||
|
||||
@ -46,8 +46,8 @@ async fn fund_private_pda(
|
||||
wallet
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(sender),
|
||||
AccountManagerAccountIdentity::PrivatePdaForeign {
|
||||
AccountIdentity::Public(sender),
|
||||
AccountIdentity::PrivatePdaForeign {
|
||||
account_id: pda_account_id,
|
||||
npk,
|
||||
vpk,
|
||||
@ -83,8 +83,8 @@ async fn spend_private_pda(
|
||||
wallet
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PrivatePdaOwned(pda_account_id),
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::PrivatePdaOwned(pda_account_id),
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk: recipient_npk,
|
||||
vpk: recipient_vpk,
|
||||
identifier: 0,
|
||||
|
||||
@ -9,9 +9,7 @@ use sequencer_service::{GenesisAction, SequencerHandle};
|
||||
use sequencer_service_rpc::RpcClient as _;
|
||||
use tempfile::TempDir;
|
||||
use testcontainers::compose::DockerCompose;
|
||||
use wallet::{
|
||||
AccDecodeData::Decode, AccountManagerAccountIdentity, WalletCore, config::WalletConfigOverrides,
|
||||
};
|
||||
use wallet::{AccDecodeData::Decode, AccountIdentity, WalletCore, config::WalletConfigOverrides};
|
||||
|
||||
use crate::{
|
||||
BEDROCK_SERVICE_PORT, BEDROCK_SERVICE_WITH_OPEN_PORT,
|
||||
@ -293,8 +291,8 @@ async fn claim_funds_from_vault_to_private(
|
||||
let (tx_hash, mut secrets) = wallet
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PrivateOwned(owner_id),
|
||||
AccountManagerAccountIdentity::Public(owner_vault_id),
|
||||
AccountIdentity::PrivateOwned(owner_id),
|
||||
AccountIdentity::Public(owner_vault_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program_with_dependencies,
|
||||
|
||||
@ -11,7 +11,7 @@ use nssa_core::{
|
||||
use crate::{ExecutionFailureKind, WalletCore};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum AccountManagerAccountIdentity {
|
||||
pub enum AccountIdentity {
|
||||
Public(AccountId),
|
||||
/// A public account without signing. Would not try to sign, even if account is owned.
|
||||
PublicNoSign(AccountId),
|
||||
@ -52,7 +52,7 @@ pub enum AccountManagerAccountIdentity {
|
||||
},
|
||||
}
|
||||
|
||||
impl AccountManagerAccountIdentity {
|
||||
impl AccountIdentity {
|
||||
#[must_use]
|
||||
pub const fn is_public(&self) -> bool {
|
||||
matches!(&self, Self::Public(_) | Self::PublicNoSign(_))
|
||||
@ -94,13 +94,13 @@ pub struct AccountManager {
|
||||
impl AccountManager {
|
||||
pub async fn new(
|
||||
wallet: &WalletCore,
|
||||
accounts: Vec<AccountManagerAccountIdentity>,
|
||||
accounts: Vec<AccountIdentity>,
|
||||
) -> Result<Self, ExecutionFailureKind> {
|
||||
let mut states = Vec::with_capacity(accounts.len());
|
||||
|
||||
for account in accounts {
|
||||
let state = match account {
|
||||
AccountManagerAccountIdentity::Public(account_id) => {
|
||||
AccountIdentity::Public(account_id) => {
|
||||
let acc = wallet
|
||||
.get_account_public(account_id)
|
||||
.await
|
||||
@ -111,7 +111,7 @@ impl AccountManager {
|
||||
|
||||
State::Public { account, sk }
|
||||
}
|
||||
AccountManagerAccountIdentity::PublicNoSign(account_id) => {
|
||||
AccountIdentity::PublicNoSign(account_id) => {
|
||||
let acc = wallet
|
||||
.get_account_public(account_id)
|
||||
.await
|
||||
@ -122,12 +122,12 @@ impl AccountManager {
|
||||
|
||||
State::Public { account, sk }
|
||||
}
|
||||
AccountManagerAccountIdentity::PrivateOwned(account_id) => {
|
||||
AccountIdentity::PrivateOwned(account_id) => {
|
||||
let pre = private_key_tree_acc_preparation(wallet, account_id, false).await?;
|
||||
|
||||
State::Private(pre)
|
||||
}
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk,
|
||||
vpk,
|
||||
identifier,
|
||||
@ -151,11 +151,11 @@ impl AccountManager {
|
||||
|
||||
State::Private(pre)
|
||||
}
|
||||
AccountManagerAccountIdentity::PrivatePdaOwned(account_id) => {
|
||||
AccountIdentity::PrivatePdaOwned(account_id) => {
|
||||
let pre = private_key_tree_acc_preparation(wallet, account_id, true).await?;
|
||||
State::Private(pre)
|
||||
}
|
||||
AccountManagerAccountIdentity::PrivatePdaForeign {
|
||||
AccountIdentity::PrivatePdaForeign {
|
||||
account_id,
|
||||
npk,
|
||||
vpk,
|
||||
@ -179,7 +179,7 @@ impl AccountManager {
|
||||
};
|
||||
State::Private(pre)
|
||||
}
|
||||
AccountManagerAccountIdentity::PrivateShared {
|
||||
AccountIdentity::PrivateShared {
|
||||
nsk,
|
||||
npk,
|
||||
vpk,
|
||||
@ -193,7 +193,7 @@ impl AccountManager {
|
||||
|
||||
State::Private(pre)
|
||||
}
|
||||
AccountManagerAccountIdentity::PrivatePdaShared {
|
||||
AccountIdentity::PrivatePdaShared {
|
||||
account_id,
|
||||
nsk,
|
||||
npk,
|
||||
@ -423,7 +423,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn private_shared_is_private() {
|
||||
let acc = AccountManagerAccountIdentity::PrivateShared {
|
||||
let acc = AccountIdentity::PrivateShared {
|
||||
nsk: [0; 32],
|
||||
npk: NullifierPublicKey([1; 32]),
|
||||
vpk: ViewingPublicKey::from_scalar([2; 32]),
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub use account_manager::AccountManagerAccountIdentity;
|
||||
pub use account_manager::AccountIdentity;
|
||||
use anyhow::{Context as _, Result};
|
||||
use bip39::Mnemonic;
|
||||
use common::{HashType, transaction::NSSATransaction};
|
||||
@ -273,10 +273,7 @@ impl WalletCore {
|
||||
/// Resolve an `AccountId` to the appropriate `PrivacyPreservingAccount` variant.
|
||||
/// Checks the key tree first, then shared private accounts.
|
||||
#[must_use]
|
||||
pub fn resolve_private_account(
|
||||
&self,
|
||||
account_id: nssa::AccountId,
|
||||
) -> Option<AccountManagerAccountIdentity> {
|
||||
pub fn resolve_private_account(&self, account_id: nssa::AccountId) -> Option<AccountIdentity> {
|
||||
// Check key tree first
|
||||
if self
|
||||
.storage
|
||||
@ -284,7 +281,7 @@ impl WalletCore {
|
||||
.private_account(account_id)
|
||||
.is_some()
|
||||
{
|
||||
return Some(AccountManagerAccountIdentity::PrivateOwned(account_id));
|
||||
return Some(AccountIdentity::PrivateOwned(account_id));
|
||||
}
|
||||
|
||||
// Check shared private accounts
|
||||
@ -299,7 +296,7 @@ impl WalletCore {
|
||||
|
||||
if let (Some(pda_seed), Some(program_id)) = (entry.pda_seed, entry.pda_program_id) {
|
||||
let keys = holder.derive_keys_for_pda(&program_id, &pda_seed);
|
||||
Some(AccountManagerAccountIdentity::PrivatePdaShared {
|
||||
Some(AccountIdentity::PrivatePdaShared {
|
||||
account_id,
|
||||
nsk: keys.nullifier_secret_key,
|
||||
npk: keys.generate_nullifier_public_key(),
|
||||
@ -316,7 +313,7 @@ impl WalletCore {
|
||||
result
|
||||
};
|
||||
let keys = holder.derive_keys_for_shared_account(&derivation_seed);
|
||||
Some(AccountManagerAccountIdentity::PrivateShared {
|
||||
Some(AccountIdentity::PrivateShared {
|
||||
nsk: keys.nullifier_secret_key,
|
||||
npk: keys.generate_nullifier_public_key(),
|
||||
vpk: keys.generate_viewing_public_key(),
|
||||
@ -541,7 +538,7 @@ impl WalletCore {
|
||||
|
||||
pub async fn send_privacy_preserving_tx(
|
||||
&self,
|
||||
accounts: Vec<AccountManagerAccountIdentity>,
|
||||
accounts: Vec<AccountIdentity>,
|
||||
instruction_data: InstructionData,
|
||||
program: &ProgramWithDependencies,
|
||||
) -> Result<(HashType, Vec<SharedSecretKey>), ExecutionFailureKind> {
|
||||
@ -553,7 +550,7 @@ impl WalletCore {
|
||||
|
||||
pub async fn send_privacy_preserving_tx_with_pre_check(
|
||||
&self,
|
||||
accounts: Vec<AccountManagerAccountIdentity>,
|
||||
accounts: Vec<AccountIdentity>,
|
||||
instruction_data: InstructionData,
|
||||
program: &ProgramWithDependencies,
|
||||
tx_pre_check: impl FnOnce(&[&Account]) -> Result<(), ExecutionFailureKind>,
|
||||
@ -612,7 +609,7 @@ impl WalletCore {
|
||||
|
||||
pub async fn send_pub_tx(
|
||||
&self,
|
||||
accounts: Vec<AccountManagerAccountIdentity>,
|
||||
accounts: Vec<AccountIdentity>,
|
||||
instruction_data: InstructionData,
|
||||
program: &ProgramWithDependencies,
|
||||
) -> Result<HashType, ExecutionFailureKind> {
|
||||
@ -622,16 +619,13 @@ impl WalletCore {
|
||||
|
||||
pub async fn send_pub_tx_with_pre_check(
|
||||
&self,
|
||||
accounts: Vec<AccountManagerAccountIdentity>,
|
||||
accounts: Vec<AccountIdentity>,
|
||||
instruction_data: InstructionData,
|
||||
program: &ProgramWithDependencies,
|
||||
tx_pre_check: impl FnOnce(&[&Account]) -> Result<(), ExecutionFailureKind>,
|
||||
) -> Result<HashType, ExecutionFailureKind> {
|
||||
// Public transaction, all accounts must be public
|
||||
if accounts
|
||||
.iter()
|
||||
.any(AccountManagerAccountIdentity::is_private)
|
||||
{
|
||||
if accounts.iter().any(AccountIdentity::is_private) {
|
||||
return Err(ExecutionFailureKind::TransactionBuildError(
|
||||
nssa::error::NssaError::InvalidInput(
|
||||
"Private accounts are not allowed in public transactions".to_owned(),
|
||||
|
||||
@ -3,7 +3,7 @@ use common::HashType;
|
||||
use nssa::{AccountId, program::Program};
|
||||
use token_core::TokenHolding;
|
||||
|
||||
use crate::{AccountManagerAccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
use crate::{AccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
pub struct Amm<'wallet>(pub &'wallet WalletCore);
|
||||
|
||||
impl Amm<'_> {
|
||||
@ -51,13 +51,13 @@ impl Amm<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_b),
|
||||
AccountManagerAccountIdentity::PublicNoSign(pool_lp),
|
||||
AccountManagerAccountIdentity::Public(user_holding_a),
|
||||
AccountManagerAccountIdentity::Public(user_holding_b),
|
||||
AccountManagerAccountIdentity::Public(user_holding_lp),
|
||||
AccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountIdentity::PublicNoSign(vault_holding_b),
|
||||
AccountIdentity::PublicNoSign(pool_lp),
|
||||
AccountIdentity::Public(user_holding_a),
|
||||
AccountIdentity::Public(user_holding_b),
|
||||
AccountIdentity::Public(user_holding_lp),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -114,23 +114,23 @@ impl Amm<'_> {
|
||||
}
|
||||
|
||||
let user_a_signing_indentity = if token_definition_id_in == definition_token_a_id {
|
||||
AccountManagerAccountIdentity::Public(user_holding_a)
|
||||
AccountIdentity::Public(user_holding_a)
|
||||
} else {
|
||||
AccountManagerAccountIdentity::PublicNoSign(user_holding_a)
|
||||
AccountIdentity::PublicNoSign(user_holding_a)
|
||||
};
|
||||
|
||||
let user_b_signing_indentity = if token_definition_id_in == definition_token_b_id {
|
||||
AccountManagerAccountIdentity::Public(user_holding_b)
|
||||
AccountIdentity::Public(user_holding_b)
|
||||
} else {
|
||||
AccountManagerAccountIdentity::PublicNoSign(user_holding_b)
|
||||
AccountIdentity::PublicNoSign(user_holding_b)
|
||||
};
|
||||
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_b),
|
||||
AccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountIdentity::PublicNoSign(vault_holding_b),
|
||||
user_a_signing_indentity,
|
||||
user_b_signing_indentity,
|
||||
],
|
||||
@ -189,23 +189,23 @@ impl Amm<'_> {
|
||||
}
|
||||
|
||||
let user_a_signing_indentity = if token_definition_id_in == definition_token_a_id {
|
||||
AccountManagerAccountIdentity::Public(user_holding_a)
|
||||
AccountIdentity::Public(user_holding_a)
|
||||
} else {
|
||||
AccountManagerAccountIdentity::PublicNoSign(user_holding_a)
|
||||
AccountIdentity::PublicNoSign(user_holding_a)
|
||||
};
|
||||
|
||||
let user_b_signing_indentity = if token_definition_id_in == definition_token_b_id {
|
||||
AccountManagerAccountIdentity::Public(user_holding_b)
|
||||
AccountIdentity::Public(user_holding_b)
|
||||
} else {
|
||||
AccountManagerAccountIdentity::PublicNoSign(user_holding_b)
|
||||
AccountIdentity::PublicNoSign(user_holding_b)
|
||||
};
|
||||
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(amm_pool),
|
||||
AccountManagerAccountIdentity::Public(vault_holding_a),
|
||||
AccountManagerAccountIdentity::Public(vault_holding_b),
|
||||
AccountIdentity::Public(amm_pool),
|
||||
AccountIdentity::Public(vault_holding_a),
|
||||
AccountIdentity::Public(vault_holding_b),
|
||||
user_a_signing_indentity,
|
||||
user_b_signing_indentity,
|
||||
],
|
||||
@ -260,13 +260,13 @@ impl Amm<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_b),
|
||||
AccountManagerAccountIdentity::PublicNoSign(pool_lp),
|
||||
AccountManagerAccountIdentity::Public(user_holding_a),
|
||||
AccountManagerAccountIdentity::Public(user_holding_b),
|
||||
AccountManagerAccountIdentity::PublicNoSign(user_holding_lp),
|
||||
AccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountIdentity::PublicNoSign(vault_holding_b),
|
||||
AccountIdentity::PublicNoSign(pool_lp),
|
||||
AccountIdentity::Public(user_holding_a),
|
||||
AccountIdentity::Public(user_holding_b),
|
||||
AccountIdentity::PublicNoSign(user_holding_lp),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -319,13 +319,13 @@ impl Amm<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountManagerAccountIdentity::PublicNoSign(vault_holding_b),
|
||||
AccountManagerAccountIdentity::PublicNoSign(pool_lp),
|
||||
AccountManagerAccountIdentity::PublicNoSign(user_holding_a),
|
||||
AccountManagerAccountIdentity::PublicNoSign(user_holding_b),
|
||||
AccountManagerAccountIdentity::Public(user_holding_lp),
|
||||
AccountIdentity::PublicNoSign(amm_pool),
|
||||
AccountIdentity::PublicNoSign(vault_holding_a),
|
||||
AccountIdentity::PublicNoSign(vault_holding_b),
|
||||
AccountIdentity::PublicNoSign(pool_lp),
|
||||
AccountIdentity::PublicNoSign(user_holding_a),
|
||||
AccountIdentity::PublicNoSign(user_holding_b),
|
||||
AccountIdentity::Public(user_holding_lp),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
|
||||
@ -7,7 +7,7 @@ use nssa::{
|
||||
};
|
||||
use nssa_core::SharedSecretKey;
|
||||
|
||||
use crate::{AccountManagerAccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
use crate::{AccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
|
||||
pub struct Ata<'wallet>(pub &'wallet WalletCore);
|
||||
|
||||
@ -30,9 +30,9 @@ impl Ata<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(owner_id),
|
||||
AccountManagerAccountIdentity::PublicNoSign(definition_id),
|
||||
AccountManagerAccountIdentity::PublicNoSign(ata_id),
|
||||
AccountIdentity::Public(owner_id),
|
||||
AccountIdentity::PublicNoSign(definition_id),
|
||||
AccountIdentity::PublicNoSign(ata_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -63,9 +63,9 @@ impl Ata<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(owner_id),
|
||||
AccountManagerAccountIdentity::PublicNoSign(sender_ata_id),
|
||||
AccountManagerAccountIdentity::PublicNoSign(recipient_id),
|
||||
AccountIdentity::Public(owner_id),
|
||||
AccountIdentity::PublicNoSign(sender_ata_id),
|
||||
AccountIdentity::PublicNoSign(recipient_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -95,9 +95,9 @@ impl Ata<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(owner_id),
|
||||
AccountManagerAccountIdentity::PublicNoSign(holder_ata_id),
|
||||
AccountManagerAccountIdentity::PublicNoSign(definition_id),
|
||||
AccountIdentity::Public(owner_id),
|
||||
AccountIdentity::PublicNoSign(holder_ata_id),
|
||||
AccountIdentity::PublicNoSign(definition_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -124,8 +124,8 @@ impl Ata<'_> {
|
||||
self.0
|
||||
.resolve_private_account(owner_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(definition_id),
|
||||
AccountManagerAccountIdentity::Public(ata_id),
|
||||
AccountIdentity::Public(definition_id),
|
||||
AccountIdentity::Public(ata_id),
|
||||
];
|
||||
|
||||
self.0
|
||||
@ -161,8 +161,8 @@ impl Ata<'_> {
|
||||
self.0
|
||||
.resolve_private_account(owner_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(sender_ata_id),
|
||||
AccountManagerAccountIdentity::Public(recipient_id),
|
||||
AccountIdentity::Public(sender_ata_id),
|
||||
AccountIdentity::Public(recipient_id),
|
||||
];
|
||||
|
||||
self.0
|
||||
@ -197,8 +197,8 @@ impl Ata<'_> {
|
||||
self.0
|
||||
.resolve_private_account(owner_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(holder_ata_id),
|
||||
AccountManagerAccountIdentity::Public(definition_id),
|
||||
AccountIdentity::Public(holder_ata_id),
|
||||
AccountIdentity::Public(definition_id),
|
||||
];
|
||||
|
||||
self.0
|
||||
|
||||
@ -2,7 +2,7 @@ use common::HashType;
|
||||
use nssa::AccountId;
|
||||
|
||||
use super::{NativeTokenTransfer, auth_transfer_preparation};
|
||||
use crate::{AccountManagerAccountIdentity, ExecutionFailureKind};
|
||||
use crate::{AccountIdentity, ExecutionFailureKind};
|
||||
|
||||
impl NativeTokenTransfer<'_> {
|
||||
pub async fn send_deshielded_transfer(
|
||||
@ -19,7 +19,7 @@ impl NativeTokenTransfer<'_> {
|
||||
self.0
|
||||
.resolve_private_account(from)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(to),
|
||||
AccountIdentity::Public(to),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
|
||||
@ -5,7 +5,7 @@ use nssa::{AccountId, program::Program};
|
||||
use nssa_core::{Identifier, NullifierPublicKey, SharedSecretKey, encryption::ViewingPublicKey};
|
||||
|
||||
use super::{NativeTokenTransfer, auth_transfer_preparation};
|
||||
use crate::{AccountManagerAccountIdentity, ExecutionFailureKind};
|
||||
use crate::{AccountIdentity, ExecutionFailureKind};
|
||||
|
||||
impl NativeTokenTransfer<'_> {
|
||||
pub async fn register_account_private(
|
||||
@ -49,7 +49,7 @@ impl NativeTokenTransfer<'_> {
|
||||
self.0
|
||||
.resolve_private_account(from)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk: to_npk,
|
||||
vpk: to_vpk,
|
||||
identifier: to_identifier,
|
||||
|
||||
@ -4,7 +4,7 @@ use nssa::{AccountId, program::Program};
|
||||
|
||||
use super::NativeTokenTransfer;
|
||||
use crate::{
|
||||
AccountManagerAccountIdentity, ExecutionFailureKind,
|
||||
AccountIdentity, ExecutionFailureKind,
|
||||
program_facades::native_token_transfer::auth_transfer_preparation,
|
||||
};
|
||||
|
||||
@ -19,10 +19,7 @@ impl NativeTokenTransfer<'_> {
|
||||
|
||||
self.0
|
||||
.send_pub_tx_with_pre_check(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(from),
|
||||
AccountManagerAccountIdentity::Public(to),
|
||||
],
|
||||
vec![AccountIdentity::Public(from), AccountIdentity::Public(to)],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
tx_pre_check,
|
||||
@ -39,7 +36,7 @@ impl NativeTokenTransfer<'_> {
|
||||
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![AccountManagerAccountIdentity::Public(from)],
|
||||
vec![AccountIdentity::Public(from)],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
)
|
||||
|
||||
@ -3,7 +3,7 @@ use nssa::AccountId;
|
||||
use nssa_core::{Identifier, NullifierPublicKey, SharedSecretKey, encryption::ViewingPublicKey};
|
||||
|
||||
use super::{NativeTokenTransfer, auth_transfer_preparation};
|
||||
use crate::{AccountManagerAccountIdentity, ExecutionFailureKind};
|
||||
use crate::{AccountIdentity, ExecutionFailureKind};
|
||||
|
||||
impl NativeTokenTransfer<'_> {
|
||||
pub async fn send_shielded_transfer(
|
||||
@ -17,7 +17,7 @@ impl NativeTokenTransfer<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx_with_pre_check(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(from),
|
||||
AccountIdentity::Public(from),
|
||||
self.0
|
||||
.resolve_private_account(to)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
@ -49,8 +49,8 @@ impl NativeTokenTransfer<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx_with_pre_check(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(from),
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::Public(from),
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk: to_npk,
|
||||
vpk: to_vpk,
|
||||
identifier: to_identifier,
|
||||
|
||||
@ -2,7 +2,7 @@ use common::HashType;
|
||||
use nssa::{AccountId, program::Program};
|
||||
use nssa_core::{MembershipProof, SharedSecretKey};
|
||||
|
||||
use crate::{AccountManagerAccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
use crate::{AccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
|
||||
pub struct Pinata<'wallet>(pub &'wallet WalletCore);
|
||||
|
||||
@ -21,8 +21,8 @@ impl Pinata<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PublicNoSign(pinata_account_id),
|
||||
AccountManagerAccountIdentity::PublicNoSign(winner_account_id),
|
||||
AccountIdentity::PublicNoSign(pinata_account_id),
|
||||
AccountIdentity::PublicNoSign(winner_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -55,7 +55,7 @@ impl Pinata<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(pinata_account_id),
|
||||
AccountIdentity::Public(pinata_account_id),
|
||||
self.0
|
||||
.resolve_private_account(winner_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
|
||||
@ -3,7 +3,7 @@ use nssa::{AccountId, program::Program};
|
||||
use nssa_core::{Identifier, NullifierPublicKey, SharedSecretKey, encryption::ViewingPublicKey};
|
||||
use token_core::Instruction;
|
||||
|
||||
use crate::{AccountManagerAccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
use crate::{AccountIdentity, ExecutionFailureKind, WalletCore};
|
||||
|
||||
pub struct Token<'wallet>(pub &'wallet WalletCore);
|
||||
|
||||
@ -23,8 +23,8 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(definition_account_id),
|
||||
AccountManagerAccountIdentity::Public(supply_account_id),
|
||||
AccountIdentity::Public(definition_account_id),
|
||||
AccountIdentity::Public(supply_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -46,7 +46,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(definition_account_id),
|
||||
AccountIdentity::Public(definition_account_id),
|
||||
self.0
|
||||
.resolve_private_account(supply_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
@ -81,7 +81,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.resolve_private_account(definition_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(supply_account_id),
|
||||
AccountIdentity::Public(supply_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&Program::token().into(),
|
||||
@ -145,8 +145,8 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(sender_account_id),
|
||||
AccountManagerAccountIdentity::Public(recipient_account_id),
|
||||
AccountIdentity::Public(sender_account_id),
|
||||
AccountIdentity::Public(recipient_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -208,7 +208,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.resolve_private_account(sender_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk: recipient_npk,
|
||||
vpk: recipient_vpk,
|
||||
identifier: recipient_identifier,
|
||||
@ -244,7 +244,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.resolve_private_account(sender_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(recipient_account_id),
|
||||
AccountIdentity::Public(recipient_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&Program::token().into(),
|
||||
@ -274,7 +274,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(sender_account_id),
|
||||
AccountIdentity::Public(sender_account_id),
|
||||
self.0
|
||||
.resolve_private_account(recipient_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
@ -309,8 +309,8 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(sender_account_id),
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::Public(sender_account_id),
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk: recipient_npk,
|
||||
vpk: recipient_vpk,
|
||||
identifier: recipient_identifier,
|
||||
@ -345,8 +345,8 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::PublicNoSign(definition_account_id),
|
||||
AccountManagerAccountIdentity::Public(holder_account_id),
|
||||
AccountIdentity::PublicNoSign(definition_account_id),
|
||||
AccountIdentity::Public(holder_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -406,7 +406,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.resolve_private_account(definition_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(holder_account_id),
|
||||
AccountIdentity::Public(holder_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&Program::token().into(),
|
||||
@ -436,7 +436,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(definition_account_id),
|
||||
AccountIdentity::Public(definition_account_id),
|
||||
self.0
|
||||
.resolve_private_account(holder_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
@ -470,8 +470,8 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_pub_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(definition_account_id),
|
||||
AccountManagerAccountIdentity::Public(holder_account_id),
|
||||
AccountIdentity::Public(definition_account_id),
|
||||
AccountIdentity::Public(holder_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
@ -533,7 +533,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.resolve_private_account(definition_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk: holder_npk,
|
||||
vpk: holder_vpk,
|
||||
identifier: holder_identifier,
|
||||
@ -569,7 +569,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.resolve_private_account(definition_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountManagerAccountIdentity::Public(holder_account_id),
|
||||
AccountIdentity::Public(holder_account_id),
|
||||
],
|
||||
instruction_data,
|
||||
&Program::token().into(),
|
||||
@ -599,7 +599,7 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(definition_account_id),
|
||||
AccountIdentity::Public(definition_account_id),
|
||||
self.0
|
||||
.resolve_private_account(holder_account_id)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
@ -634,8 +634,8 @@ impl Token<'_> {
|
||||
self.0
|
||||
.send_privacy_preserving_tx(
|
||||
vec![
|
||||
AccountManagerAccountIdentity::Public(definition_account_id),
|
||||
AccountManagerAccountIdentity::PrivateForeign {
|
||||
AccountIdentity::Public(definition_account_id),
|
||||
AccountIdentity::PrivateForeign {
|
||||
npk: holder_npk,
|
||||
vpk: holder_vpk,
|
||||
identifier: holder_identifier,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user