diff --git a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.lock b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.lock index f94b75c8..430e8fe3 100644 --- a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.lock +++ b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.lock @@ -713,20 +713,18 @@ dependencies = [ [[package]] name = "stellar-strkey" -version = "0.0.9" +version = "0.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" +checksum = "ee1832fb50c651ad10f734aaf5d31ca5acdfb197a6ecda64d93fcdb8885af913" dependencies = [ "crate-git-revision", "data-encoding", - "thiserror", ] [[package]] name = "stellar-xdr" -version = "22.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e09ea07e51f4123d8142f9b9f6924691413abfcba4ab642b333e795782c0141" +version = "22.1.0" +source = "git+https://github.com/stellar/rs-stellar-xdr?branch=authsiter#5c46dd1655c70a11634b6c8bbdd7f5cd788ff9e7" dependencies = [ "base64 0.13.1", "crate-git-revision", @@ -760,26 +758,6 @@ dependencies = [ "unicode-ident", ] -[[package]] -name = "thiserror" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "time" version = "0.3.39" diff --git a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml index 2f6030c3..ddefa185 100644 --- a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml +++ b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" publish = false [dependencies] -stellar-xdr = { version = "22.2.0", features = ["base64", "serde"] } +stellar-xdr = { version = "*", features = ["base64", "serde"], git = "https://github.com/stellar/rs-stellar-xdr", branch = "authsiter" } serde_json = "1.0.140" ed25519-dalek = { version = "1.0.1" } hex = "0.4.3" diff --git a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/src/main.rs b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/src/main.rs index 39229790..50e41a98 100644 --- a/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/src/main.rs +++ b/multisig_1_of_n_account/stellar-cli-sign-auth-ed25519/src/main.rs @@ -15,8 +15,8 @@ use clap::Parser; use ed25519_dalek::{Keypair, Signer}; use sha2::{Digest, Sha256}; use stellar_xdr::curr::{ - Hash, HashIdPreimage, HashIdPreimageSorobanAuthorization, Limited, Limits, OperationBody, - ReadXdr, ScBytes, ScMap, ScSymbol, ScVal, SorobanCredentials, TransactionEnvelope, WriteXdr, + Hash, HashIdPreimage, HashIdPreimageSorobanAuthorization, Limited, Limits, ReadXdr, ScBytes, + ScMap, ScSymbol, ScVal, SorobanCredentials, TransactionEnvelope, WriteXdr, }; #[derive(Parser, Debug, Clone)] @@ -52,31 +52,14 @@ fn main() -> Result<(), Box> { Limits::none(), ))?; - // Extract mutable references to the parts of the auths that are needed for signing. - let auths = match &mut txe { - TransactionEnvelope::Tx(e) => { - e.tx.operations - .iter_mut() - .filter_map(|op| match &mut op.body { - OperationBody::InvokeHostFunction(op) => Some(op.auth.iter_mut().filter_map( - |auth| match &mut auth.credentials { - SorobanCredentials::Address(creds) => { - Some((&mut auth.root_invocation, creds)) - } - _ => None, - }, - )), - _ => None, - }) - .flatten() - } - _ => Err("Unsupported transaction envelope")?, - }; - // Sign each auth. // TODO:It would be wise to only sign auths matching the contract address that are intended to // sign for, or to ask the user to confirm each auth. - for (invocation, creds) in auths { + for auth in txe.auths_mut() { + let (invocation, creds) = match &mut auth.credentials { + SorobanCredentials::Address(creds) => (&mut auth.root_invocation, creds), + _ => continue, + }; eprintln!( "Authorizing:\n{}\n{}", serde_json::to_string_pretty(invocation)?,