Commit Graph

32 Commits

Author SHA1 Message Date
Pawan Dhananjay 35e24ed412
refactor: extract minimal features of Contract into BaseContract (#88)
* 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>
2020-10-27 12:57:01 +02:00
Georgios Konstantopoulos 62b7ce4366
feat: Transaction Gas Price Escalator middleware (#81)
* fix(signers): make Signer send by blocking on Ledger calls

* fix(providers): use Arc in WS impl to allow cloning

* feat(middleware): add geometric gas price escalator

* test(middleware): ensure that we can still stack everything up

* fix(middleware): default to tokio/async-std

* chore: fix clippy

* docs(middleware): add docs and rename middlewares

* chore: fix doctests

* feat: add linear gas escalator

https://github.com/makerdao/pymaker/blob/master/tests/test_gas.py\#L107
https://github.com/makerdao/pymaker/blob/master/pymaker/gas.py\#L129

* feat: add constructors to gas escalators
2020-10-08 18:56:36 +03:00
Georgios Konstantopoulos aa37f74c4b
feat: generalize wallet/private key + yubihsm2 (#75)
* feat: generalize wallet/private key

* fix: adjust celo tests

* YubiHSM2 Support (#76)

* feat: support YubiHSM2
2020-10-02 11:41:16 +03:00
Georgios Konstantopoulos 2d51c523ba
feature: Middleware Architecture (#65)
* feat: convert Provider to Middleware trait

* feat: move gas oracle to middleware crate

* feat: move signer to middleware crate

* feat: add nonce manager middleware and test stacking

* refactor: convert generic middleware jsonrpc type to associated type

* feat: move ethers-contract to middleware arch

* test(provider): make tests pass

* test(middleware): move middleware tests from signer

* test: fix ethers examples

* fix(contract): make tests compile

* chore: fix clippy

* feat: deduplicate trait delegation

* refactor(signer): deduplicate tx signing logic across signers

* fix doctests

* fix: examples, celo tests and ci
2020-09-25 00:33:09 +03:00
Georgios Konstantopoulos bf1d1e098f
fix: replace FilterStream with concrete type (#69)
* fix: replace FilterStream with concrete type

* fix: use PinBoxFut type alias

* ci: fix CI error with ledger
2020-09-23 11:04:54 +03:00
Georgios Konstantopoulos 8ff9a894c0 chore: add example for ledger 2020-09-20 21:27:00 +03:00
Georgios Konstantopoulos 95fcbe5240
feat: ledger support (#66)
* 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
2020-09-20 18:17:02 +03:00
Georgios Konstantopoulos da20a042d7
chore(provider): make websockets optional (#45) 2020-07-02 18:33:16 +03:00
Rohit Narurkar f88f0129f9
feat(tokens): tokenize tuples
* tuples impl Tokenizable instead of impl Tokenize/Detokenize

* uncomment the abigen for DyDxLimitOrders contract (nested tuples)
2020-06-29 11:03:01 +03:00
Georgios Konstantopoulos bb1ac9c666
Improve Ganache Flexibility (#37)
* feat(core): add more features to ganache

* test(provider): choose endpoint dynamically

* test(signer): choose endpoint and accounts dynamically

* test(contract): choose endpoint and accounts dynamically

* fix: dynamic port / accounts in examples

* core(chore): fix doctest
2020-06-22 16:42:34 +03:00
Georgios Konstantopoulos 1cfbc7b3c3
Replace contract client references with Arc (#35)
* 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.
2020-06-22 11:44:08 +03:00
Georgios Konstantopoulos 0cfeadadf4
Websockets + TLS for Async-Std / Tokio (#30)
* 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
2020-06-21 10:17:11 +03:00
Georgios Konstantopoulos 4ff466a593
fix intradoc links and add missing cargo metadata (#29) 2020-06-20 16:55:07 +03:00
Georgios Konstantopoulos 7ff8b8222c
Dual license under MIT/Apache 2 (#28)
* fix: dual license MIT / Apache 2

* provider: add missing license
2020-06-18 08:20:20 +03:00
Georgios Konstantopoulos a9d1be4def
Improve Stream performance (#25)
* perf(provider): remove infinite loop and rely on the runtime to poll the stream

* chore: cargo fmt
2020-06-17 21:01:20 +03:00
Georgios Konstantopoulos ba5ae5a894
Add Celo support (#8)
* 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
2020-06-17 12:22:01 +03:00
Georgios Konstantopoulos 2c734f0d61
fix(core): make Signature.v a u64 instead of a u8 and expose `verify` (#21)
u8 would not work if a large chain_id was used
2020-06-17 09:45:15 +03:00
Georgios Konstantopoulos 1a47e933ae
feat(signers): implement Serde and make Wallet API smaller (#20)
* feat(signers): implement Serde and make API smaller

* fix: add abigen as a dev-dependency feature
2020-06-17 09:38:04 +03:00
Georgios Konstantopoulos 570b45eb10
ABI Encoder v2 + ABI Spec v6.6 (#17)
* feat(core): update ethabi and enable more Toeknize impls

* feat(contract/abigen): implement simple AbiEncoderV2

* tests(ethers): add abigen example

* fix(core): fix abi tests

* chore: make clippy happy
2020-06-16 15:08:42 +03:00
Rohit Narurkar 5d92e72882
add json rpc bindings for eth_getCode (#15) 2020-06-15 23:10:27 +03:00
Georgios Konstantopoulos 79b21b9ea0
add pending tx type to wait for tx confirmations (#11)
* feat: add pending tx type

* feat(pending-txs): implement the full state machine

* tests(ethers): fix transfer eth example

* feat: use the pending transaction struct when deploying a contract

* ci: skip the pending tx test

* chore: fix doctests
2020-06-15 15:40:06 +03:00
Sebastian Bolaños 20da946aa2
Update docs path (#12)
* Change docs url from local modules to docs.rs
2020-06-15 14:29:50 +03:00
Georgios Konstantopoulos d90b03da06
Add streamed logs to the provider (#9)
* feat(provider): implement Streamed logs

This utilizes eth_getFilterChanges. The stream struct must be instantiated with a factory that yields logs/hashes.
Consumers are expected to use the `FilterStream` trait in order to simplify their type definitions

* feat(provider): expose streaming methods

* test(provider): add new blocks/pending txs test

* feat(contract): allow events to be streamed

* test(contract): add integration test for streaming event logs

* perf(contract-factory): take abi and bytecode by value instead of reference

The abi, bytecode and the factory's deploy method now consume the structs instead of being passed by reference. While this means that
consumers might need to clone before using them, this gives us some more flexiblity around factories inside helper functions

* refactor(contract): use test helpers to reduce code dup

* chore: make clippy happy
2020-06-15 11:46:07 +03:00
Georgios Konstantopoulos 7020dc18fb
docs(crate): further expand the docs 2020-06-11 11:41:41 +03:00
Georgios Konstantopoulos 9cad87a879
chore: fix examples 2020-06-11 09:45:14 +03:00
Georgios Konstantopoulos 980e7fca8c
docs: add some more docs 2020-06-10 09:24:36 +03:00
Georgios Konstantopoulos 73b502ed5f
macro: re-enable paths/etherscan and enable more complex tokens 2020-06-04 00:05:05 +03:00
Georgios Konstantopoulos b47c89455c
ci: skip tests with external deps 2020-06-03 00:16:08 +03:00
Georgios Konstantopoulos 701e442f94
fix(proc-macro): adjust to rest of contract fixes 2020-06-02 14:56:09 +03:00
Georgios Konstantopoulos 56d22c0360
fix examples 2020-06-02 13:58:48 +03:00
Georgios Konstantopoulos 6bd3c41bd0
contract: simplify errors and generics 2020-06-02 02:15:33 +03:00
Georgios Konstantopoulos cd4914d37f
refactor: pull crates to root dir 2020-06-01 21:24:22 +03:00