mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-07-10 07:50:11 +00:00
fix(lez/wallet): drop signing with recipient keys
This commit is contained in:
parent
571f35b384
commit
bc9306cfb6
@ -191,7 +191,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded(
|
||||
let transfer = NativeTokenTransfer(&wallet);
|
||||
|
||||
match block_on(transfer.send_shielded_transfer_to_outer_account(
|
||||
from_mention.into_public_identity(from_id),
|
||||
from_mention.into_public_identity(from_id, true),
|
||||
to_npk,
|
||||
to_vpk,
|
||||
to_identifier,
|
||||
@ -464,7 +464,7 @@ pub unsafe extern "C" fn wallet_ffi_transfer_shielded_owned(
|
||||
let transfer = NativeTokenTransfer(&wallet);
|
||||
|
||||
match block_on(transfer.send_shielded_transfer(
|
||||
from_mention.into_public_identity(from_id),
|
||||
from_mention.into_public_identity(from_id, true),
|
||||
to_id,
|
||||
amount,
|
||||
)) {
|
||||
|
||||
@ -162,14 +162,22 @@ impl CliAccountMention {
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert to an [`crate::AccountIdentity`] for use in a public transaction.
|
||||
///
|
||||
/// The `sign` flag indicates whether to sign or not with the account keys.
|
||||
#[must_use]
|
||||
pub fn into_public_identity(self, account_id: lee::AccountId) -> crate::AccountIdentity {
|
||||
pub fn into_public_identity(
|
||||
self,
|
||||
account_id: lee::AccountId,
|
||||
sign: bool,
|
||||
) -> crate::AccountIdentity {
|
||||
match self {
|
||||
Self::KeyPath(key_path) => crate::AccountIdentity::PublicKeycard {
|
||||
account_id,
|
||||
key_path,
|
||||
},
|
||||
Self::Id(_) | Self::Label(_) => crate::AccountIdentity::Public(account_id),
|
||||
Self::Id(_) | Self::Label(_) if sign => crate::AccountIdentity::Public(account_id),
|
||||
Self::Id(_) | Self::Label(_) => crate::AccountIdentity::PublicNoSign(account_id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -138,9 +138,9 @@ impl AmmProgramAgnosticSubcommand {
|
||||
) => {
|
||||
let tx_hash = Amm(wallet_core)
|
||||
.send_new_definition(
|
||||
user_holding_a.into_public_identity(a),
|
||||
user_holding_b.into_public_identity(b),
|
||||
user_holding_lp.into_public_identity(lp),
|
||||
user_holding_a.into_public_identity(a, true),
|
||||
user_holding_b.into_public_identity(b, true),
|
||||
user_holding_lp.into_public_identity(lp, true),
|
||||
balance_a,
|
||||
balance_b,
|
||||
)
|
||||
@ -170,8 +170,8 @@ impl AmmProgramAgnosticSubcommand {
|
||||
(AccountIdWithPrivacy::Public(a), AccountIdWithPrivacy::Public(b)) => {
|
||||
let tx_hash = Amm(wallet_core)
|
||||
.send_swap_exact_input(
|
||||
user_holding_a.into_public_identity(a),
|
||||
user_holding_b.into_public_identity(b),
|
||||
user_holding_a.into_public_identity(a, true),
|
||||
user_holding_b.into_public_identity(b, true),
|
||||
amount_in,
|
||||
min_amount_out,
|
||||
token_definition,
|
||||
@ -202,8 +202,8 @@ impl AmmProgramAgnosticSubcommand {
|
||||
(AccountIdWithPrivacy::Public(a), AccountIdWithPrivacy::Public(b)) => {
|
||||
let tx_hash = Amm(wallet_core)
|
||||
.send_swap_exact_output(
|
||||
user_holding_a.into_public_identity(a),
|
||||
user_holding_b.into_public_identity(b),
|
||||
user_holding_a.into_public_identity(a, true),
|
||||
user_holding_b.into_public_identity(b, true),
|
||||
exact_amount_out,
|
||||
max_amount_in,
|
||||
token_definition,
|
||||
@ -240,9 +240,9 @@ impl AmmProgramAgnosticSubcommand {
|
||||
) => {
|
||||
let tx_hash = Amm(wallet_core)
|
||||
.send_add_liquidity(
|
||||
user_holding_a.into_public_identity(a),
|
||||
user_holding_b.into_public_identity(b),
|
||||
user_holding_lp.into_public_identity(lp),
|
||||
user_holding_a.into_public_identity(a, true),
|
||||
user_holding_b.into_public_identity(b, true),
|
||||
user_holding_lp.into_public_identity(lp, true),
|
||||
min_amount_lp,
|
||||
max_amount_a,
|
||||
max_amount_b,
|
||||
@ -281,7 +281,7 @@ impl AmmProgramAgnosticSubcommand {
|
||||
.send_remove_liquidity(
|
||||
a,
|
||||
b,
|
||||
user_holding_lp.into_public_identity(lp),
|
||||
user_holding_lp.into_public_identity(lp, true),
|
||||
balance_lp,
|
||||
min_amount_a,
|
||||
min_amount_b,
|
||||
|
||||
@ -94,7 +94,7 @@ impl AtaSubcommand {
|
||||
match owner_resolved {
|
||||
AccountIdWithPrivacy::Public(owner_id) => {
|
||||
let tx_hash = Ata(wallet_core)
|
||||
.send_create(owner.into_public_identity(owner_id), definition_id)
|
||||
.send_create(owner.into_public_identity(owner_id, true), definition_id)
|
||||
.await?;
|
||||
wallet_core
|
||||
.poll_and_finalize_public_transaction(tx_hash)
|
||||
@ -127,7 +127,7 @@ impl AtaSubcommand {
|
||||
AccountIdWithPrivacy::Public(from_id) => {
|
||||
let tx_hash = Ata(wallet_core)
|
||||
.send_transfer(
|
||||
from.into_public_identity(from_id),
|
||||
from.into_public_identity(from_id, true),
|
||||
definition_id,
|
||||
to_id,
|
||||
amount,
|
||||
@ -162,7 +162,7 @@ impl AtaSubcommand {
|
||||
AccountIdWithPrivacy::Public(holder_id) => {
|
||||
let tx_hash = Ata(wallet_core)
|
||||
.send_burn(
|
||||
holder.into_public_identity(holder_id),
|
||||
holder.into_public_identity(holder_id, true),
|
||||
definition_id,
|
||||
amount,
|
||||
)
|
||||
|
||||
@ -61,7 +61,7 @@ impl AuthTransferSubcommand {
|
||||
match resolved {
|
||||
AccountIdWithPrivacy::Public(pub_account_id) => {
|
||||
let tx_hash = NativeTokenTransfer(wallet_core)
|
||||
.register_account(account_id.into_public_identity(pub_account_id))
|
||||
.register_account(account_id.into_public_identity(pub_account_id, true))
|
||||
.await?;
|
||||
|
||||
wallet_core
|
||||
@ -123,8 +123,8 @@ impl AuthTransferSubcommand {
|
||||
(AccountIdWithPrivacy::Public(from), AccountIdWithPrivacy::Public(to)) => {
|
||||
let to_mention = to_account.expect("matched Some branch");
|
||||
NativeTokenTransferProgramSubcommand::Public {
|
||||
from: Some(from_account.into_public_identity(from)),
|
||||
to: Some(to_mention.into_public_identity(to)),
|
||||
from: Some(from_account.into_public_identity(from, true)),
|
||||
to: Some(to_mention.into_public_identity(to, false)),
|
||||
amount,
|
||||
}
|
||||
}
|
||||
@ -143,7 +143,7 @@ impl AuthTransferSubcommand {
|
||||
(AccountIdWithPrivacy::Public(from), AccountIdWithPrivacy::Private(to)) => {
|
||||
NativeTokenTransferProgramSubcommand::Shielded(
|
||||
NativeTokenTransferProgramSubcommandShielded::ShieldedOwned {
|
||||
from: Some(from_account.into_public_identity(from)),
|
||||
from: Some(from_account.into_public_identity(from, true)),
|
||||
to,
|
||||
amount,
|
||||
},
|
||||
@ -165,7 +165,7 @@ impl AuthTransferSubcommand {
|
||||
AccountIdWithPrivacy::Public(from) => {
|
||||
NativeTokenTransferProgramSubcommand::Shielded(
|
||||
NativeTokenTransferProgramSubcommandShielded::ShieldedForeign {
|
||||
from: Some(from_account.into_public_identity(from)),
|
||||
from: Some(from_account.into_public_identity(from, true)),
|
||||
to_npk,
|
||||
to_vpk,
|
||||
to_identifier,
|
||||
|
||||
@ -208,7 +208,7 @@ impl TokenProgramAgnosticSubcommand {
|
||||
(AccountIdWithPrivacy::Public(from), AccountIdWithPrivacy::Private(to)) => {
|
||||
TokenProgramSubcommand::Shielded(
|
||||
TokenProgramSubcommandShielded::TransferTokenShieldedOwned {
|
||||
sender: Some(from_mention.into_public_identity(from)),
|
||||
sender: Some(from_mention.into_public_identity(from, true)),
|
||||
recipient_account_id: to,
|
||||
balance_to_move: amount,
|
||||
},
|
||||
@ -237,7 +237,7 @@ impl TokenProgramAgnosticSubcommand {
|
||||
),
|
||||
AccountIdWithPrivacy::Public(from) => TokenProgramSubcommand::Shielded(
|
||||
TokenProgramSubcommandShielded::TransferTokenShieldedForeign {
|
||||
sender: Some(from_mention.into_public_identity(from)),
|
||||
sender: Some(from_mention.into_public_identity(from, true)),
|
||||
recipient_npk: to_npk,
|
||||
recipient_vpk: to_vpk,
|
||||
recipient_identifier: to_identifier,
|
||||
@ -830,8 +830,8 @@ impl TokenProgramSubcommandPublic {
|
||||
};
|
||||
let tx_hash = Token(wallet_core)
|
||||
.send_transfer_transaction(
|
||||
sender_account_id.into_public_identity(sender_id),
|
||||
recipient_account_id.into_public_identity(recipient_id),
|
||||
sender_account_id.into_public_identity(sender_id, true),
|
||||
recipient_account_id.into_public_identity(recipient_id, false),
|
||||
balance_to_move,
|
||||
)
|
||||
.await?;
|
||||
@ -855,7 +855,7 @@ impl TokenProgramSubcommandPublic {
|
||||
let tx_hash = Token(wallet_core)
|
||||
.send_burn_transaction(
|
||||
definition_account_id,
|
||||
holder_account_id.into_public_identity(holder_id),
|
||||
holder_account_id.into_public_identity(holder_id, true),
|
||||
amount,
|
||||
)
|
||||
.await?;
|
||||
@ -881,8 +881,8 @@ impl TokenProgramSubcommandPublic {
|
||||
};
|
||||
let tx_hash = Token(wallet_core)
|
||||
.send_mint_transaction(
|
||||
definition_account_id.into_public_identity(def_id),
|
||||
holder_account_id.into_public_identity(holder_id),
|
||||
definition_account_id.into_public_identity(def_id, true),
|
||||
holder_account_id.into_public_identity(holder_id, false),
|
||||
amount,
|
||||
)
|
||||
.await?;
|
||||
@ -1546,8 +1546,8 @@ impl CreateNewTokenProgramSubcommand {
|
||||
};
|
||||
let tx_hash = Token(wallet_core)
|
||||
.send_new_definition(
|
||||
definition_account_id.into_public_identity(def_id),
|
||||
supply_account_id.into_public_identity(sup_id),
|
||||
definition_account_id.into_public_identity(def_id, true),
|
||||
supply_account_id.into_public_identity(sup_id, true),
|
||||
name,
|
||||
total_supply,
|
||||
)
|
||||
|
||||
@ -19,7 +19,7 @@ impl NativeTokenTransfer<'_> {
|
||||
self.0
|
||||
.resolve_private_account(from)
|
||||
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
||||
AccountIdentity::Public(to),
|
||||
AccountIdentity::PublicNoSign(to),
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user