mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-06-02 15:20:01 +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>
51 lines
1.5 KiB
Rust
51 lines
1.5 KiB
Rust
use nssa_core::program::{
|
|
AccountPostState, ChainedCall, PdaSeed, ProgramId, ProgramInput, ProgramOutput,
|
|
read_nssa_inputs,
|
|
};
|
|
use risc0_zkvm::serde::to_vec;
|
|
|
|
/// Proxy for spending from a private PDA via `auth_transfer`.
|
|
///
|
|
/// `pre_states = [pda (authorized), recipient]`. Debits the PDA and credits the recipient.
|
|
/// The PDA-to-npk binding is established via `pda_seeds` in the chained call to `auth_transfer`.
|
|
type Instruction = (PdaSeed, u128, ProgramId);
|
|
|
|
fn main() {
|
|
let (
|
|
ProgramInput {
|
|
self_program_id,
|
|
caller_program_id,
|
|
pre_states,
|
|
instruction: (seed, amount, auth_transfer_id),
|
|
},
|
|
instruction_words,
|
|
) = read_nssa_inputs::<Instruction>();
|
|
|
|
let Ok([first, second]) = <[_; 2]>::try_from(pre_states) else {
|
|
return;
|
|
};
|
|
|
|
assert!(first.is_authorized, "first pre_state must be authorized");
|
|
|
|
let first_post = AccountPostState::new(first.account.clone());
|
|
let second_post = AccountPostState::new(second.account.clone());
|
|
|
|
let chained_call = ChainedCall {
|
|
program_id: auth_transfer_id,
|
|
instruction_data: to_vec(&authenticated_transfer_core::Instruction::Transfer { amount })
|
|
.unwrap(),
|
|
pre_states: vec![first.clone(), second.clone()],
|
|
pda_seeds: vec![seed],
|
|
};
|
|
|
|
ProgramOutput::new(
|
|
self_program_id,
|
|
caller_program_id,
|
|
instruction_words,
|
|
vec![first, second],
|
|
vec![first_post, second_post],
|
|
)
|
|
.with_chained_calls(vec![chained_call])
|
|
.write();
|
|
}
|