mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-05-29 11:29:40 +00:00
* feat: account manager extension * feat(wallet): added unified way of sending public transactions to all facades * fix(wallet): no sign option added * fix(deny): deny fix * fix(wallet): suggestion 1 * fix(wallet): suggestion fix 1 * feat!: Add new path for externally provided seed to the circuit. BREAKING CHANGE: add identity variants to the circuit and change semantics for `Claim::Authorized` for private PDAs * feat(ci): use separate job per each integration tests module * feat(ci): cache rust artifacts * feat(ci): build integration tests binary once and reuse it * fix(wallet): fmt * ci: add bench-regression workflow with criterion-compare for crypto_primitives_bench * fix(wallet): merge postfix * feat!(wallet): SigningGroup merged with AccountManager * fix(ci): deny and artifacts fix * fix(deny): deny fix * fix keycard and lint --------- Co-authored-by: Sergio Chouhy <sergio.chouhy@gmail.com> Co-authored-by: Daniil Polyakov <arjentix@gmail.com> Co-authored-by: Moudy <m.ellaz@hotmail.com> Co-authored-by: Sergio Chouhy <41742639+schouhy@users.noreply.github.com> Co-authored-by: jonesmarvin8 <83104039+jonesmarvin8@users.noreply.github.com>
76 lines
2.6 KiB
Rust
76 lines
2.6 KiB
Rust
use common::HashType;
|
|
use nssa::{AccountId, program::Program};
|
|
use nssa_core::{MembershipProof, SharedSecretKey};
|
|
|
|
use crate::{AccountIdentity, ExecutionFailureKind, WalletCore};
|
|
|
|
pub struct Pinata<'wallet>(pub &'wallet WalletCore);
|
|
|
|
impl Pinata<'_> {
|
|
pub async fn claim(
|
|
&self,
|
|
pinata_account_id: AccountId,
|
|
winner_account_id: AccountId,
|
|
solution: u128,
|
|
) -> Result<HashType, ExecutionFailureKind> {
|
|
let program = Program::pinata();
|
|
let instruction = solution;
|
|
let instruction_data =
|
|
Program::serialize_instruction(instruction).expect("Instruction should serialize");
|
|
|
|
self.0
|
|
.send_pub_tx(
|
|
vec![
|
|
AccountIdentity::PublicNoSign(pinata_account_id),
|
|
AccountIdentity::PublicNoSign(winner_account_id),
|
|
],
|
|
instruction_data,
|
|
&program.into(),
|
|
)
|
|
.await
|
|
}
|
|
|
|
/// Claim a pinata reward using a privacy-preserving transaction for an already-initialized
|
|
/// owned private account.
|
|
///
|
|
/// The `winner_proof` parameter is accepted for API completeness; the wallet currently fetches
|
|
/// the membership proof automatically from the chain.
|
|
pub async fn claim_private_owned_account_already_initialized(
|
|
&self,
|
|
pinata_account_id: AccountId,
|
|
winner_account_id: AccountId,
|
|
solution: u128,
|
|
_winner_proof: MembershipProof,
|
|
) -> Result<(HashType, SharedSecretKey), ExecutionFailureKind> {
|
|
self.claim_private_owned_account(pinata_account_id, winner_account_id, solution)
|
|
.await
|
|
}
|
|
|
|
pub async fn claim_private_owned_account(
|
|
&self,
|
|
pinata_account_id: AccountId,
|
|
winner_account_id: AccountId,
|
|
solution: u128,
|
|
) -> Result<(HashType, SharedSecretKey), ExecutionFailureKind> {
|
|
self.0
|
|
.send_privacy_preserving_tx(
|
|
vec![
|
|
AccountIdentity::Public(pinata_account_id),
|
|
self.0
|
|
.resolve_private_account(winner_account_id)
|
|
.ok_or(ExecutionFailureKind::KeyNotFoundError)?,
|
|
],
|
|
nssa::program::Program::serialize_instruction(solution).unwrap(),
|
|
&nssa::program::Program::pinata().into(),
|
|
)
|
|
.await
|
|
.map(|(resp, secrets)| {
|
|
let first = secrets
|
|
.into_iter()
|
|
.next()
|
|
.expect("expected recipient's secret");
|
|
(resp, first)
|
|
})
|
|
}
|
|
}
|