diff --git a/Cargo.toml b/Cargo.toml index 4a8350e..83b76e2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,10 @@ repository = "https://github.com/aurora-is-near/aurora-cli-rs" description = "Aurora CLI is a command line interface to bootstrap Aurora engine" readme = "README.md" +[lib] +name = "aurora_cli" +path = "src/lib.rs" + [[bin]] name = "aurora-cli" path = "src/main.rs" diff --git a/src/client/near.rs b/src/client/near.rs index 97a8e8f..339439b 100644 --- a/src/client/near.rs +++ b/src/client/near.rs @@ -213,16 +213,30 @@ impl NearClient { pub async fn contract_call_batch( &self, batch: Vec<(String, Vec)>, + ) -> anyhow::Result { + let batch_with_deposit: Vec<(String, Vec, u128)> = batch + .into_iter() + .map(|(method_name, args)| (method_name, args, 0u128)) + .collect(); + + self.contract_call_batch_with_deposit(batch_with_deposit) + .await + } + + #[allow(dead_code)] + pub async fn contract_call_batch_with_deposit( + &self, + batch: Vec<(String, Vec, u128)>, ) -> anyhow::Result { let gas = NEAR_GAS / u64::try_from(batch.len())?; let actions = batch .into_iter() - .map(|(method_name, args)| { + .map(|(method_name, args, deposit)| { Action::FunctionCall(Box::new(near_primitives::transaction::FunctionCallAction { method_name, args, gas, - deposit: 0, + deposit, })) }) .collect(); diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..5ea9b4c --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,8 @@ +pub mod cli; +pub mod client; +pub mod config; +#[cfg(feature = "advanced")] +pub mod eth_method; +#[cfg(feature = "advanced")] +pub mod transaction_reader; +pub mod utils;