* feat: use const generics for array tokenize
* feat: add abi encode decode impls
* test: add some tests
* chore: move abi codec to core
* update changelog
* fix: do not sort event variants
* style: use deref over clone
* style: refactor some stuff
* feat: add ethcall trait
* feat: include in abigen
* feat: add bare bones eth call derive
* feat: impl EthCall derive
* feat: support enums
* feat: use abigen enum derive
* fix: concrete abi and map errors
* test: first call test
* rustfmt
* chore: use correct trait name on error
* feat: derive display for call structs
* feat: add from conversion
* test: add convert test
* chore: docs and test
* chore: update changelog
* cargo fix
* feat: add unit type derive support and more test
* chore: patch ethabi
* chore: rm ethabi patch
* feat: add encode/decode trait impls
* style: use AsRef<[u8]>
* Update ethers-contract/ethers-contract-abigen/src/contract/methods.rs
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* style: reindent macro body
* test: add tuple event test
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* 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>
* chore(core): remove ethers dep
* chore(providers): remove ethers dep
tests using higher-rank crates are temporarily disabled
* chore(middleware): remove ethers dep and move tests over from providers
* chore(signers): remove ethers dep
* fix(contracts): correctly determine ethers sub-crates & remove ethers
* fix: re-enable tests for all members
* fix: make contract compile without middleware dep
move over the test using middleware to ethers-middleware
* chore: cargo fmt
* chore(contract): add missing import
* WIP
* WIP
* fix(middleware): use rustls as dev dep
* chore: cargo fmt
* fix: use different key for nonce manager to avoid nonce conflicts
* chore: fix celo test ported over to middlewares
the test had the same private key with an existing middleware test,
causing potential nonce reuses
it now also uses a different storage contract, so we had to change
it to use u256 instead of string
* fix(middleware): enable contracts/celo feature
* chore: ignore non-eip2718 txs to rinkeby
* feat: support multiple addresses in filters
To support filtering of 1..n addresses we had to add the ValueOrArray
enum to the log types and refactor some ethers-contract code
Fixes: #240
Signed-off-by: Sebastian Martinez <sebastinez@me.com>
* chore: fmt
* fix: use legacy tx in unit test due to Ganache
Co-authored-by: Sebastian Martinez <sebastinez@me.com>
* feat(contract): use eip-1559 txs by default
This may break any tests which use Ganache, since it only supports legacy transactions.
We should replace Ganache with hardhat where possible
* fix(providers): always try setting default_sender
* chore: make all test transactions legacy
* feat(multicall): allow submitting legacy txs
* chore: default to legacy txs via feature flag
This is useful for chains like Celo that do not support the Typed Envelope
* fix: use legacy txs in ds proxy deployment / tests
* chore: fix review comments
* feat(providers): add eth_feeHistory api
* add access list
* feat: fill transactions with access list / default sender info
* feat: add helpers for operating on the txs enum
* feat: send_transaction takes TypedTransaction now
* fix(contract): temp wrap all contract txs as Legacy txs
* feat(middleware): use TypedTransaction in Transformer
* feat(signers): use TypedTransaction in Wallet/Ledger
* feat(core): add helpers for setting typed tx fields
* feat(signer): use typed transactions
* fix(middleware): adjust nonce/gas/escalators for TypedTxs
The GPO and the Escalators will throw an error if they are provided an EIP1559 transaction
* fix(providers): ensure the correct account's nonce is filled
* fix: add .into() to txs until we make the fn call more generic
* Revert "fix: add .into() to txs until we make the fn call more generic"
This reverts commit 04dc34b26d0e3f418ed3fc69ea35ad538b83dd50.
* feat: generalize send_transaction interface
* fix: only set the nonce manually in the Signer middleware
* fix(transformer): fill the transaction after transformation
* chore: fix compilation errors & lints
* fix(signer): set the correct account's nonce
* feat: make trace_call / call take TypedTransaction
* fix: set sender to transaction in signer
* chore: ethgasstation broke
* chore: cargo fmt / lints
* Fix(signer): pass the chain id
* fix: final tx encoding fixes
1. Normalize v values for eip1559/2730
2. Make access lists mandatory for 1559
3. do not double-rlp on rlp_signed
* fix: set access list only if available
* test: check 1559 / 2930 txs
* fix: do not prepend a 0 for Legacy txs & test
* chore: code review comments
* chore: fix aws signer signature
* Add support for EIP-234
* Add support for EIP-1898
* Remove redundant field names
* Remove useless conversion
* Change `unwrap_or` to `unwrap_or_else`
* fix: make EthEvent name method a trait method
* refactor: make expand methods members of Context
* fix: make AbiParser parsing non consumeable
* feat: add struct expanding
* feat: use derive(EthEvent) in abigen workflow
* test: check EthEvent in abigen macro
* test: make test compile again
* refactor: simplify and optimize abi parsing from single str
* test: add human readable abigen tests
* feat(providers): tokio 1.0
BREAKING: This removes async-std as a compatibility option
* feat: tokio 1.0 in rest of crates
* fix: patch Cargo.toml until deps are released
* fix(contract): load ws deps
* feat: bytes 1.0 (#121)
* feat(core): move to bytes::Bytes
* feat: adjust rest of crates to Bytes
* chore: bump deps
CI fails due to:
https://github.com/snapview/tokio-tungstenite/pull/142#discussion_r550445144
* chore: use latest tokio-tungstenite
* ci: split tests into jobs (#129)
* Switch to `hex` (#128)
* fix(core): replace rustc_hex with hex
* fix(providers): replace rustc_hex with hex
* chore: replace rustc-hex with hex
* chore: cargo fmt
* fix(ledger): copy address from string correctly
* chore: fix flaky tests
Fixes#105
* feat(providers): return a PendingTransaction from send_tx calls
* feat(providers): expose the internal provider to all middlewares
* fix(middleware): use the returned PendingTx instead of using a hash
* fix(contract): use the pending tx returned value
Note1: To support that, we need to clone the tx when sending in order to make lifetimes work out
Note2: Multicall does not support that feature
* fix(ethers): adjust examples
* chore: fix provider test
* chore: fix celo test
BREAKING CHANGE
* fix(block): fix block decoding from ws
* feat(pubsub): add pubsub traits and sub stream
Also use DeserializeOwned alias
* feat(transports): add notification type
* feat(ws): rewrite Ws for subscription support
* feat(provider): add eth_subscribe
* fix(celo): disable some celo tests due to ganache incompatibilities
* test(rinkeby): fix flaky test
* feat(contract): WS subscription bindings (#101)
* feat(middleware): add subscriptions to middleware methods
* feat(contract): add subscribe method to contracts
* feat: allow encoding/decoding function data
* feat: allow decoding event data
* feat: human readable abi
inspired from https://blog.ricmoo.com/human-readable-contract-abis-in-ethers-js-141902f4d917
* test: add event / fn decoding tests
* chore: fix clippy
* feat(abigen): allow providing args in human readable format
* refactor: extract minimal features of Contract into BaseContract
* refactor: move BaseContract to own file
* chore: ensure celo test passes
* chore: fix clippy
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* feat: ledger support
Adds support for Ledger Nano S Eth app (v1.3.7)
- sign message
- sign transaction
- get addresses
- get app version
* fix: fix eth docstring
* fix: take into account EIP155
* feat: convert Signer to async
* feat: implement Signer for Ledger
* ci: run celo-only tests explicitly
This is done to avoid using --all-features
* fix: remove async from with_signer
* chore: fix doctests
* fix: add Send/Sync to SignerError
* ci: update etherscan key
* test: disable etherscan abigen tests temporarily
* (feat) gas oracle support
* (refactor) make a separate module | fix clippy warning
* add gas oracle to client using dynamic dispatch
* fix doc build in multicall module
* gas oracle returns U256
* support gas price fetching from client
* avoid querying for unsupported gas categories
* changes based on PR review
* add support for gasnow API, refactor gwei to wei
* Implement Multicall functionality for batched calls
* Documentation, some modifications as suggested in the review
* (Abigen) handle single input arg and set output irrespective of mutability
* implement send functionality and allow clearing calls
* Fix detokenization, dont require pre-processing anymore
* panic when more than supported number of calls are pushed
* add doc for panics in case of add_call
* (multicall) eth_balance support, update bindings
* refactor: move multicall to its own directory
* fix: add infura api key
* ci: ensure CI runs on PRs from forks
* test(multicall): re-use aggregate call
* contract: make multicall docs compile and remove redundant clones
* ci: add public etherscan API key so that forks don't get rate limited
* chore: adjust test contract naming
Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
* test(tokens): ensure nested tuples tokenize properly
* test(contract): add failing test with 2 args
This happens because the args are serialized as Token::Tuple, while instead they should be just a vector
* fix(tokens): add token flattening method to fix non-nested tuples
* fix: do not export the flatten function
* feat(provider): allow specifying a default polling interval param
This parameter is going to be used for all subsequent client calls by default. It can still be overriden with the internal
`interval` calls
* feat(contract): replace reference to Client with Arc
* feat(abigen): adjusts codegen to use Arcs
* fix(ethers): adjust examples to new apis
* fix(provider): return TxHash instead of PendingTransaction on tx submission
Returning a PendingTransaction allowed us to have nice ethers.js-like syntax where you submit
a transaction and then can immediately await it. Unfortunately, now that we use Arcs and not lifetimes
this meant that we would need to bind the function call in a variable, and then await on it, which is pretty
bad UX.
To fix this, we revert back to returning a TxHash and introduce a convenience method on the provider and the
contract which takes a tx_hash and returns a PendingTransaction object. The syntax ends up being slightly
more verbose (although more explicit), but the issue is fixed.
* fix: relax trait bounds on JsonRpcClient
* refactor(provider): move http client to separate dir
* feat(provider): add initial Websocket support over Stream/Sink + Tungstenite
* test(provider): add websocket test
* feat(provider): add convenience method using tokio/async-std behind a feature flag
* test(provider): add websocket ssl test
* feat(provider): add TLS websockets for tokio/async-std
* docs(provider): add websocket docs / examples
* fix(provider): make tokio an optional dep
* feat(types): add optional Celo support
* feat: add Celo feature flags to all crates
* test(provider): add get_transaction celo test
* test(signer): add send_transaction celo test
* test(contract): add deploy and call contract function celo test