Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: alloy-dyn-contract #149

Merged
merged 18 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
docs: touch up docs in Interface
  • Loading branch information
DaniPopes committed Jan 29, 2024
commit 25b0d71883c239434450a89e74df514ba8b131d5
2 changes: 1 addition & 1 deletion crates/dyn-contract/src/instance.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{error::Result, interface::Interface, CallBuilder};
use crate::{CallBuilder, Interface, Result};
use alloy_dyn_abi::{DynSolValue, JsonAbiExt};
use alloy_json_abi::JsonAbi;
use alloy_primitives::{Address, Selector};
Expand Down
17 changes: 6 additions & 11 deletions crates/dyn-contract/src/interface.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use crate::{
error::{Error, Result},
instance::ContractInstance,
};
use crate::{ContractInstance, Error, Result};
use alloy_dyn_abi::{DynSolValue, FunctionExt, JsonAbiExt};
use alloy_json_abi::{Function, JsonAbi};
use alloy_primitives::{Address, Selector};
Expand Down Expand Up @@ -58,8 +55,7 @@ impl Interface {
self.get_from_name(name)?.abi_decode_input(data, validate).map_err(Into::into)
}

/// Decode the provided ABI encoded bytes as the input of the provided
/// function selector
/// Decode the provided ABI encoded bytes as the input of the provided function selector.
pub fn decode_input_with_selector(
&self,
selector: &Selector,
Expand All @@ -70,7 +66,7 @@ impl Interface {
}

/// Decode the provided ABI encoded bytes as the output of the first function with the given
/// name
/// name.
///
/// # Note
///
Expand All @@ -85,8 +81,7 @@ impl Interface {
self.get_from_name(name)?.abi_decode_output(data, validate).map_err(Into::into)
}

/// Decode the provided ABI encoded bytes as the output of the provided
/// function selector
/// Decode the provided ABI encoded bytes as the output of the provided function selector.
pub fn decode_output_with_selector(
&self,
selector: &Selector,
Expand All @@ -96,12 +91,12 @@ impl Interface {
self.get_from_selector(selector)?.abi_decode_output(data, validate).map_err(Into::into)
}

/// Returns a reference to the contract's ABI
/// Returns a reference to the contract's ABI.
pub const fn abi(&self) -> &JsonAbi {
&self.abi
}

/// Consumes the interface, returning the inner ABI
/// Consumes the interface, returning the inner ABI.
pub fn into_abi(self) -> JsonAbi {
self.abi
}
Expand Down