Commit Graph

88 Commits

Author SHA1 Message Date
Gio a532eb4d29
Add call builder and eth_call state overrides (#1340)
* Add call builder and eth_call state overrides

* Fix <Caller as Future>::poll impl

* Move call overrides to ethers_provider::call_raw

* Add example for call_raw overrides

* Add support for contract call overrides

* Documentation and convenience impls for call_raw types

* Test for eth_call state overrides

* ci: install geth

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-06-04 14:18:25 -07:00
Matthias Seitz cffcc7bbec
chore(clippy): fix newest nightly lints (#1298) 2022-05-22 15:18:57 -07:00
Meet Mangukiya 5d604edd5c
feat(ContractDeployer): add tx builder methods (#1289) 2022-05-21 17:48:41 -07:00
Matthias Seitz ce3ebaefa0
chore(clippy): make clippy happy (#1230) 2022-05-06 08:15:49 -07:00
oblique 6faceb20d7
feat: Relax `Clone` requirements when `Arc<M>` is used (#1183)
`#[derive(Clone)]` was implementing `Clone` only if `M` was `Clone`,
however because of `Arc<M>` this can be relaxed.
2022-04-27 15:33:22 +03:00
Nicolas Gailly 9d53c73af0
Update event.rs (#1173) 2022-04-24 16:10:21 +02:00
Matthias Seitz 9047f96d95
feat: make stream mod public (#1160) 2022-04-21 19:29:40 +02:00
Matthias Seitz 969d4e01c0
feat: accept different middlewares for contract connect (#1159) 2022-04-21 17:05:23 +02:00
inconspicuous99 5f1f967ec1
ContractDeployer: pub deployer can modify defaults (#1156) 2022-04-19 13:20:59 -07:00
Matthias Seitz 916e9a7334
chore(clippy): add some deny lints (#1064)
* feat: add deny lints

* trim ethers core

* trim ethers eip712

* deny ethers contract derive

* deny ethers contract abigen

* deny ethers contract

* deny ethers providers

* chore: add denies and fix unused deps

* doc: fix links

* fix: wasm build

* doc: fix links

* doc: fix links

* doc: fix inline doc links

* docs: fix intra doc links
2022-03-19 10:05:39 -07:00
Matthias Seitz b6b5b09f4a
feat(abigen): add abi object deserializer and generate deploy function (#1030)
* feat(abigen): add abi object deserializer

* chore: rustfmt

* refactor: use enum type for deser abi

* refactor: use enum types for deser

* chore: rustfmt

* feat: add bytecode field

* feat: generate bytecode static

* feat: generate deployment function

* refactor: deploy function

* feat: add contract deployer type

* feat: make 0x prefix optional

* feat: add deploy function

* feat: add deploy example

* chore: update CHANGELOG

* chore(clippy): make clippy happy
2022-03-18 21:23:33 -07:00
Georgios Konstantopoulos 9626cc1335
feat: add contract interface helpers (#982)
* feat(contract): add helpers for decoding as raw Token

This allows decoding Events and Function data without knowing the return type

* feat(contract): add helpers for decoding function outputs

* chore(contract): remove redundant generic param
2022-03-02 15:58:18 +02:00
georgewhewell ce8c671218
Add Ftm multicall addresses (#927)
* add multicall addresses for fantom

* update changelog

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-02-18 16:05:08 +02:00
Jim e3f0621d43
Expose New `call_raw` API that permits MultiCalls without Detokenization (#915)
* Add `call_raw` method that forgoes detokenization for MultiCall. Have `call` wrap around `call_raw` permitting user to handle detokenization themselves if they wish

* Improve documentation: Add details to the documentation example that informs the user of their responsibility to detokenize results
2022-02-15 22:38:01 +02:00
Mark Tyneway 100f121202
feat(ethers-contract): add `send_with_receipt` to `Deployer` (#865)
* feat(ethers-contract): add `send_with_receipt` to `Deployer`

The `Deployer` is used to deploy contracts and its `send`
function returns an attached instance of a `Contract`.
There is no way to know the transaction hash of the
deployment transaction, so this commit adds another
method `send_with_receipt` that returns an attached
`Contract` as well as a `TransactionReceipt`.

* changelog: update

* tests: call `send_with_receipt` in tests

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2022-02-05 16:37:09 +02:00
Rohit Narurkar af94479d81
fix: derive serde Ser and De for log metadata (#823) 2022-01-21 14:30:57 +02:00
thasarito 183c0d21c4
reexport multiabigen (#731) 2021-12-24 16:34:18 +02:00
Matthias Seitz 11406ee8d4
feat: add EventStream::select to combine multiple event streams (#725)
* feat: add EventStream::select to combine multiple event streams

* chore: update changelog
2021-12-23 21:23:55 +02:00
Matthias Seitz 3c164bc9bf
feat(abigen): add EthAbiCodec proc macro (#704)
* feat(abigen): add EthAbiCodec proc macro

* rustfmt

* fix: tuple codec
2021-12-19 16:40:17 +02:00
Matthias Seitz e24117a1e1
chore(clippy): make clippy happy (#705) 2021-12-19 06:28:38 +02:00
joshieDo cf53924334
add deploy_tokens to ContractFactory (#699) 2021-12-17 00:01:00 +02:00
Matthias Seitz 59cf991828
feat(abigen): use structs for outputs (#664)
* feat(abigen): use structs for outputs

* update CHANGELOG

* make clippy happy

* fix lints
2021-12-09 16:00:59 -07:00
Matthias Seitz 0b1f3b1dcf
feat(solc): add support for library linking (#656)
* feat(solc): add support for library linking

* chore: update changelog

* fixbreaking compactref api

* rm check

* return Bytes instead

* revert changes

* simplify resolve

* test: add lost tests
2021-12-08 02:38:29 +02:00
Matthias Seitz 2c30468b70
fix(codec)!: ambiguity unit8[] and bytes (#613)
* fix: unit8 encoding

* feat: use ethers::types::Bytes for solidity bytes type

* feat: add const generic from impls

* fix: failing tests

* fix: make compatible with bytes

* update changelog

* make compatible with encoding changes

* chore rm write to file
2021-11-24 22:15:17 +02:00
Georgios Konstantopoulos bb3a2fd27c
release: 0.6.0 (#611)
* release(core): 0.6.0

* release(providers): 0.6.0

* release(contract-abigen): 0.6.0

* release(contract-derive): 0.6.0

* release(derive-eip712): 0.2.0

* release(ethers-solc): 0.1.0

* release(contract): 0.6.0

* release(etherscan): 0.2.0

* release(signers): 0.6.0

* release(middleware): 0.6.0

* chore: update dev deps

* refactor(core): move docs to readme

* refactor(contract): move docs to readme

* refactor(providers): move docs to readme

* chore: bump ethers cargo toml

* refactor(signers): move docs to readme

* refactor(middleware): move docs to readme

* fix(ethers): adjust re-exports to allow searching internal packages

* docs: fix broken links

we cannot use relative crate imports because the readmes
are also imported by the parent crate

* alias readmes to be accessible to ethers crate
2021-11-23 21:23:12 +02:00
Ivan Porto Carrero 1d65c9394f
add support for polygon and avalanche (#606)
* add support for polygon and avalanche, include the block explorers

* add multicall addresses for polygon
2021-11-22 11:02:28 +02:00
univerz a68f4ec9a7
perf(contract): remove clone (#602) 2021-11-21 18:12:49 +02:00
Francesco Iannelli bd3a704200
Feat/add call deployer (#554)
* contract: add .call() method to Deployer

It is now possible to dry run a contract deployment.

* add .call() method of Deployer to unreleased

* add PR to changelog
2021-11-04 15:02:05 +02:00
Georgios Konstantopoulos f0dea75219
feat: use ethers_solc::Solc instead of ethers_core::utils::Solc (#546)
* feat(ethers-solc): deserialize bytecode as bytes

* feat(ethers-solc): add method to fetch compact contract

* feat(ethers-solc): use Abi type instead of Vec<serde_json::Value>

* test(contract): use new Solc bindings

* test(middleware): use new Solc bindings

* chore: remove solc from ethers-core

* chore: remove concurrent setup code from ethers-core

* feat(ethers-solc): add ArtifactOutput::Nothing as a no-op artifact logger

* feat: add ethers-solc to top level crate

* examples: use new solc building pattern

* chore(solc): re-use opt str impl for error code decoding

* fix abigen example

* chore: fix doctests

* chore: remove setup feature

* fix: decode string to bytes correctly

* chore: clippy lints
2021-10-31 13:34:51 +02:00
Matthias Seitz dcf20022c6
chore: add rustfmt.toml (#537)
* chore: add rustfmt.toml

* rustfmt

* chore: Update readme with fmt info

* ci: update ci

* chore: rustfmt

* rustfmt

* rustfmt

* ci: install libudev

* chore(clippy): make clippy happy

* chore(clippy): make clippy happy

* revert ci

* ci: install libudev
2021-10-29 14:29:35 +02:00
Matthias Seitz eede86df41
feat: add abi code trait impls (#531)
* 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
2021-10-28 01:07:24 +03:00
Alexey Shekhirin cba1a85483
refactor(core, contract, etherscan): move Chain enum, use HashMap::from (#524)
* refactor(contract, etherscan): make use of HashMap::from

* feat(core): Chain enum

* rename unknown chain error

* reorg imports
2021-10-24 21:41:50 +03:00
Matthias Seitz fb4d9a9ef1
feat: function call enums EthCall macro and more (#517)
* 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>
2021-10-18 13:28:38 +03:00
Matthias Seitz c3528b78db
fix: use syn::Index for tuple access (#515)
* fix: use syn::Index for tuple access

* rustfmt
2021-10-16 19:45:42 +03:00
Matthias Seitz bef7960a2b
feat: add display support for events (#513)
* chore: move proc macro implementation to separate modules

* feat: add display derive macro

* chore: reexport hex

* feat: add EthDisplay

* test: add display test

* fix: use ? op

* feat: derive EthDisplay in abigen

* feat: derive display for event enum

* chore: update changelog
2021-10-16 16:42:17 +03:00
Ryan d7ab229a4c
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 16:22:51 +01:00
Georgios Konstantopoulos a6918aed2b
fix(ethabi): breaking changes and force enable serialize for eth-types (#448)
* fix(ethabi): breaking changes and force enable serialize for eth-types

* chore(ethereum-types) enable rlp
2021-09-13 20:43:54 +03:00
Georgios Konstantopoulos 38c7f5030f
chore: remove cyclical dependencies (#410)
* 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
2021-08-29 00:06:29 +03:00
James Prestwich 42aeeedcce
bug: log streams properly end when internal stream closes (#387) 2021-08-19 10:01:49 +03:00
Georgios Konstantopoulos 60ff4660df
feat: multiple addresses on Filter (#375)
* 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>
2021-08-12 19:19:24 +03:00
Georgios Konstantopoulos 25c2e0e199
feat(ethers-contract): typed txs (part 4) (#362)
* 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
2021-08-09 03:50:38 +03:00
Georgios Konstantopoulos dcbfacf5bc
feat: typed txs provider / middleware changes (part 3) (#357)
* 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
2021-08-09 03:31:11 +03:00
Georgios Konstantopoulos 9fc142ca61
feat: stream_with_meta (#354) 2021-07-30 14:01:38 +03:00
Matthias Seitz ed83223b93
cargo clippy --fix (#346) 2021-07-24 21:53:40 +03:00
Georgios Konstantopoulos 04bbd1b424
fix: make event types thread safe (#341) 2021-07-13 14:13:12 +03:00
James Prestwich d722c1a6af
feature: PendingTransaction returns Option (#327)
* feature: PendingTransaction returns Option

* chore: expand safety reasoning in pending tx expect

* chore: clippy lints

* bug: check readiness of future before taking receipt option
2021-07-06 11:06:18 +03:00
Georgios Konstantopoulos 0453ea84df
chore: fix lints (#329) 2021-07-05 14:03:38 +03:00
Oliver Nordbjerg 7b68c70cd9
Add xDai multicall contract address (#324) 2021-07-05 13:37:12 +03:00
Gabriel Coutinho de Paula 6ec8312b8c
Expose `LogMeta` type and add more fields, and expose FilterBlockOption (#294)
* Expose `LogMeta` and add more fields

* Add tests for `query_with_meta`

* Expose `FilterBlockOption`

* Run rustfmt
2021-05-13 13:51:27 +03:00
Matthias Seitz 816c5fc071
feat(abigen): extend ethevent trait methods and decoding (#239)
* feat: extend EthEvent with decode_log method and support indexed proc
macro attributes

* test: check that ethevent proc macro attributes compile

* docs: document EthEvent proc macro attributes and add example

* refactor: change decode_log to take a reference

* refactor: use ethers as fully qualified path

* feat: add events enum generation

* feat: introduce EthLogDecode trait

* feat: generate EthLogDecode implementations

* refactor: use fully qualified syntax during abigen

* fix: switch to new Event builder

* fix: make test compile again

* test: update failing tests

* refactor: rename event function

* chore(clippy): make clippy happy

* fix: rename the event correctly

* fix: add missing indexed attribute

* Revert "fix: rename the event correctly"

This reverts commit 03eabc3ead.

* fix: make indexed names optional

* fix: dsproxy name

* fix: rename ethers top level module imports
2021-03-19 17:44:59 +02:00