ethers-rs/ethers-contract/src/lib.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.8 KiB
Rust
Raw Normal View History

#![cfg_attr(docsrs, feature(doc_cfg))]
#![doc = include_str!("../README.md")]
#![deny(unsafe_code)]
2020-05-26 18:57:59 +00:00
mod contract;
pub use contract::{Contract, ContractInstance};
mod base;
pub use base::{decode_function_data, encode_function_data, AbiError, BaseContract};
mod call;
pub use call::{ContractCall, ContractError, EthCall, FunctionCall};
2020-05-26 10:44:35 +00:00
mod error;
pub use error::EthError;
2020-05-30 14:24:50 +00:00
mod factory;
pub use factory::{ContractDeployer, ContractDeploymentTx, ContractFactory, DeploymentTxFactory};
2020-05-30 14:24:50 +00:00
2020-06-10 18:20:47 +00:00
mod event;
pub use event::{EthEvent, Event};
2020-06-10 18:20:47 +00:00
mod log;
2021-07-30 11:01:38 +00:00
pub use log::{decode_logs, EthLogDecode, LogMeta};
2022-04-21 17:29:40 +00:00
pub mod stream;
#[cfg(any(test, feature = "abigen"))]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
mod multicall;
#[cfg(any(test, feature = "abigen"))]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
pub use multicall::{
multicall_contract, Call, Multicall, MulticallContract, MulticallError, MulticallVersion,
MULTICALL_ADDRESS, MULTICALL_SUPPORTED_CHAIN_IDS,
};
2020-06-10 18:20:47 +00:00
/// This module exposes low lever builder structures which are only consumed by the
/// type-safe ABI bindings generators.
#[doc(hidden)]
2020-06-10 18:20:47 +00:00
pub mod builders {
pub use super::{
call::ContractCall,
event::Event,
factory::{ContractDeployer, Deployer},
};
2020-06-10 18:20:47 +00:00
}
#[cfg(any(test, feature = "abigen"))]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
2022-08-04 17:03:25 +00:00
pub use ethers_contract_abigen::{
Abigen, ContractFilter, ExcludeContracts, InternalStructs, MultiAbigen, SelectContracts,
2022-08-04 17:03:25 +00:00
};
2020-05-26 10:44:35 +00:00
#[cfg(any(test, feature = "abigen"))]
#[cfg_attr(docsrs, doc(cfg(feature = "abigen")))]
pub use ethers_contract_derive::{
abigen, EthAbiCodec, EthAbiType, EthCall, EthDisplay, EthError, EthEvent,
};
2020-05-26 10:44:35 +00:00
2020-06-10 18:20:47 +00:00
// Hide the Lazy re-export, it's just for convenience
#[doc(hidden)]
2020-05-26 18:57:59 +00:00
pub use once_cell::sync::Lazy;
derive-eip712: initial implementation of eip712 derive macro (#481) * derive-eip712: initial implementation of eip712 derive macro This commit provides an initial implementation for a derive macro to encode typed data according to EIP-712, https://eips.ethereum.org/EIPS/eip-712 Additionally, this commit introduces a new signer trait method: async fn sign_typed_data<T: Eip712 + Send + Sync>( &self, payload: &T, ) -> Result<Signature, Self::Error>; And implements the new method for each of the signers (wallet, ledger, aws). Additionally, these changes include using `WalletError` for the Wallet signer error type At the moment, derive does not recurse the primary type to find nested Eip712 structs. This is something that is noted in the source and currently responds with an error regarding custom types. A subsequent PR should be opened once this issue becomes needed. For the moment, the current implementation should satisfy non-nested, basic struct types. * rename to ethers-derive-eip712; move to ethers-core * refactor of derive-eip712 macro; use ParamType and EthAbiToken * macro updates; add byte array checker for paramtype; use literal constant for domain type hash * replace std::convert::Infallible with WalletError as Wallet signer error type * update workspace members and dev dependencies for examples folder * add example for eip712 and test against contract * remove extraneous backward slash in '\x19\x01' prefix; example tests pass * update unreleased change log * remove print statements * use parse_macro_input macro; remove dead code; handle nest struct not implemented error * move eip712 example to solidity-contract tests folder; update cargo workspace dependencies * allow optional EIP712Domain parameter when encoding eip712 struct and signing typed data * add documentation for eip712 feature * Update ethers-signers/src/ledger/mod.rs Co-authored-by: Sebastian Martinez <me@sebastinez.dev> * add error enum for Eip712Error; use sign_payload for ledger signer * add EIP712WithDomain type for providing a wrapper around custom setting of the domain * make LedgerWallet sign_payload public * use optional feature gated dependencies for eip712; add default method for encode_eip712 * add default domain_separator method, pre-compute separator hash * move derive-eip712 deps to dev deps * remove invalid sign payload parameter, add await on async method * remove deprecated comment * debugging 'bad key handle' error for ledger signer try using 'sign_message' * await sign digest for aws signer * remove extra space, fix fmt warning * fix test, fmt errors * use gt 0.6.0 pragma compiler version * enable ABIEncoderV2 for solidity test contract * chore: make test constructor public Co-authored-by: Sebastian Martinez <me@sebastinez.dev> Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-10-08 15:22:51 +00:00
#[cfg(feature = "eip712")]
pub use ethers_derive_eip712::*;