mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-06-02 07:09:29 +00:00
fix keycard and lint
This commit is contained in:
parent
d2ec64ddef
commit
2e52d36948
@ -274,14 +274,17 @@ impl AccountManager {
|
||||
}
|
||||
|
||||
pub fn public_account_nonces(&self) -> Vec<Nonce> {
|
||||
self.states
|
||||
.iter()
|
||||
.filter_map(|state| match state {
|
||||
State::Public { account, sk } => sk.as_ref().map(|_| account.account.nonce),
|
||||
State::PublicKeycard { account, .. } => Some(account.account.nonce),
|
||||
State::Private(_) => None,
|
||||
})
|
||||
.collect()
|
||||
// Must match the signature order produced by sign_message(): local accounts first,
|
||||
// keycard accounts second.
|
||||
let local = self.states.iter().filter_map(|state| match state {
|
||||
State::Public { account, sk } => sk.as_ref().map(|_| account.account.nonce),
|
||||
State::PublicKeycard { .. } | State::Private(_) => None,
|
||||
});
|
||||
let keycard = self.states.iter().filter_map(|state| match state {
|
||||
State::PublicKeycard { account, .. } => Some(account.account.nonce),
|
||||
State::Public { .. } | State::Private(_) => None,
|
||||
});
|
||||
local.chain(keycard).collect()
|
||||
}
|
||||
|
||||
pub fn private_account_keys(&self) -> Vec<PrivateAccountKeys> {
|
||||
|
||||
@ -259,6 +259,7 @@ impl WalletSubcommand for AmmProgramAgnosticSubcommand {
|
||||
max_amount_b,
|
||||
&user_holding_a,
|
||||
&user_holding_b,
|
||||
&user_holding_lp,
|
||||
)
|
||||
.await?;
|
||||
println!("Transaction hash is {tx_hash}");
|
||||
|
||||
@ -284,6 +284,7 @@ impl Amm<'_> {
|
||||
max_amount_to_add_token_b: u128,
|
||||
user_holding_a_mention: &CliAccountMention,
|
||||
user_holding_b_mention: &CliAccountMention,
|
||||
user_holding_lp_mention: &CliAccountMention,
|
||||
) -> Result<HashType, ExecutionFailureKind> {
|
||||
let user_holding_a_identity = user_holding_a_mention.key_path().map_or(
|
||||
AccountIdentity::Public(user_holding_a),
|
||||
@ -301,6 +302,14 @@ impl Amm<'_> {
|
||||
},
|
||||
);
|
||||
|
||||
let user_holding_lp_identity = user_holding_lp_mention.key_path().map_or(
|
||||
AccountIdentity::Public(user_holding_lp),
|
||||
|key_path| AccountIdentity::PublicKeycard {
|
||||
account_id: user_holding_lp,
|
||||
key_path: key_path.to_owned(),
|
||||
},
|
||||
);
|
||||
|
||||
let program = Program::amm();
|
||||
let amm_program_id = Program::amm().id();
|
||||
let user_a_acc = self
|
||||
@ -343,7 +352,7 @@ impl Amm<'_> {
|
||||
AccountIdentity::PublicNoSign(pool_lp),
|
||||
user_holding_a_identity,
|
||||
user_holding_b_identity,
|
||||
AccountIdentity::PublicNoSign(user_holding_lp),
|
||||
user_holding_lp_identity,
|
||||
],
|
||||
instruction_data,
|
||||
&program.into(),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user