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