Skip to content

Commit

Permalink
fix: warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Jun 11, 2024
1 parent 2e5ee4c commit 6e70ebb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 31 deletions.
4 changes: 2 additions & 2 deletions cmd/soroban-cli/src/commands/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use clap::{arg, command};
use serde::{Deserialize, Serialize};

use soroban_rpc::Client;
use stellar_strkey::Strkey;


use crate::{
signer,
xdr::{MuxedAccount, SequenceNumber, Transaction, TransactionEnvelope, Uint256},
xdr::{Transaction, TransactionEnvelope},
Pwd,
};

Expand Down
57 changes: 28 additions & 29 deletions cmd/soroban-cli/src/commands/contract/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use soroban_env_host::{
self, AccountEntry, AccountEntryExt, AccountId, Hash, HostFunction, InvokeContractArgs,
InvokeHostFunctionOp, LedgerEntryData, Limits, Memo, MuxedAccount, Operation,
OperationBody, Preconditions, PublicKey, ScAddress, ScSpecEntry, ScSpecFunctionV0,
ScSpecTypeDef, ScVal, ScVec, SequenceNumber, SorobanAuthorizationEntry,
SorobanAuthorizedFunction, SorobanResources, SorobanTransactionData, String32, StringM,
ScSpecTypeDef, ScVal, ScVec, SequenceNumber, String32, StringM,
Thresholds, Transaction, TransactionExt, Uint256, VecM, WriteXdr,
},
HostError,
Expand Down Expand Up @@ -441,33 +440,33 @@ impl NetworkRunnable for Cmd {

const DEFAULT_ACCOUNT_ID: AccountId = AccountId(PublicKey::PublicKeyTypeEd25519(Uint256([0; 32])));

fn log_auth_cost_and_footprint(resources: Option<&SorobanResources>) {
if let Some(resources) = resources {
crate::log::footprint(&resources.footprint);
crate::log::cost(resources);
}
}

fn resources(tx: &Transaction) -> Option<&SorobanResources> {
let TransactionExt::V1(SorobanTransactionData { resources, .. }) = &tx.ext else {
return None;
};
Some(resources)
}

fn auth_entries(tx: &Transaction) -> VecM<SorobanAuthorizationEntry> {
tx.operations
.first()
.and_then(|op| match op.body {
OperationBody::InvokeHostFunction(ref body) => (matches!(
body.auth.first().map(|x| &x.root_invocation.function),
Some(&SorobanAuthorizedFunction::ContractFn(_))
))
.then_some(body.auth.clone()),
_ => None,
})
.unwrap_or_default()
}
// fn log_auth_cost_and_footprint(resources: Option<&SorobanResources>) {
// if let Some(resources) = resources {
// crate::log::footprint(&resources.footprint);
// crate::log::cost(resources);
// }
// }

// fn resources(tx: &Transaction) -> Option<&SorobanResources> {
// let TransactionExt::V1(SorobanTransactionData { resources, .. }) = &tx.ext else {
// return None;
// };
// Some(resources)
// }

// fn auth_entries(tx: &Transaction) -> VecM<SorobanAuthorizationEntry> {
// tx.operations
// .first()
// .and_then(|op| match op.body {
// OperationBody::InvokeHostFunction(ref body) => (matches!(
// body.auth.first().map(|x| &x.root_invocation.function),
// Some(&SorobanAuthorizedFunction::ContractFn(_))
// ))
// .then_some(body.auth.clone()),
// _ => None,
// })
// .unwrap_or_default()
// }

fn default_account_entry() -> AccountEntry {
AccountEntry {
Expand Down

0 comments on commit 6e70ebb

Please sign in to comment.