Commit Graph

81 Commits

Author SHA1 Message Date
Matthias Seitz ed83223b93
cargo clippy --fix (#346) 2021-07-24 21:53:40 +03:00
James Prestwich d31d19c3b7
feature: initial delay in PendingTransaction (#339)
* feature: initial delay in PendingTransaction

* bug: missing wake and add tracing::debug

* chore: fmt

* feature: set initial delay from PendingTransaction interval
2021-07-13 22:34:11 +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
Hanyun Xu 2a513f88d3
change types of block number and returned keys (#320) 2021-06-22 14:56:10 +03:00
Hanyun Xu 5715bcd312
feat: extend Middleware trait customized for celo (#314)
* Add CeloMiddleware trait

* change types of block number and returned keys
2021-06-15 15:22:53 +03:00
guanqun 34d38ca40f
make request error to be confined per request, not a global websocket error (#315) 2021-06-12 10:46:19 +03:00
Matthias Seitz f3cddc19f8
fix: remove ethers celo feature and ignore celo test (#313) 2021-06-10 21:27:17 +03:00
Matthias Seitz 73020af0a7
test: enable ignored tests with geth (#306)
* test: enable ignored tests with geth

* chore: enable celo

* test: ignore for celo
2021-06-05 20:09:12 +03:00
Matthias Seitz 57163a4d06
feat: introduce tx stream (#303)
* feat: introduce tx stream

* poll improvements

* refactor: move transaction stream

* feat: fully implement TransactionStream

* test: test transactionstream against transactions

* feat: add adapters for transaction hash streams

* chore(clippy): make clippy happy

* style: simplify error msg

* chore: remove test  artifact

* test: add tx stream test
2021-06-05 20:08:33 +03:00
Matthias Seitz 4036cfb8ef
test: account for offset for first subscription (#302) 2021-05-28 10:45:16 +03:00
Georgios Konstantopoulos 66a503d294
refactor: make IPC generic over AsyncRead/Write (#264)
* refactor: make IPC generic over AsyncRead/Write

* chore(ipc): fix typo
2021-04-08 11:44:48 +03:00
Austin Abell 42b10cca9a
feat: implement IPC transport support (#260)
* Initial IPC setup

* Cleanup

* Oops

* change futures dependency reference

* Document, add prints, cleanup

* Fix logic

* Make result type consistent with crate

* Setup geth ipc config and tests

* Cleanup subscription test

* Switch hash function to siphash

* Update dep usage for ordering

* Use tempfile for better cleanup (and OS support)

* Replace prints with tracing logs

* Ignore test with Celo feat

* chore: remove debug logs and use default geth ipc path

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2021-04-08 09:52:31 +03:00
Austin Abell ba41d19089
Replace println usage in ws provider (#263)
* Replace println usage in ws provider

* fmt
2021-04-07 21:42:10 +03:00
Rohit Narurkar 79862ffda5
feat: mnemonic phrase support for wallet (#256)
* feat: mnemonic phrase support for wallet

* refactor: better error handling and clippy linting

* fix: derive from path and tests

* chore: renamed package coins-bip39

* refactor: convenient builder API to setup mnemonic wallet

* refactor: re-export coins-bip39 for convenience

* clippy: fix warnings for multiple complex types in provider

* feat: randomly generated mnemonic phrase can be written to storage
2021-04-05 10:44:58 +03:00
guanqun bc80b7d327
chore(typo): fix two small typos (#249) 2021-03-31 11:21:20 +03:00
Gabriel Coutinho de Paula 530bfe2b71
feat: add support for EIP-234 and EIP-1898 (#231)
* Add support for EIP-234

* Add support for EIP-1898

* Remove redundant field names

* Remove useless conversion

* Change `unwrap_or` to `unwrap_or_else`
2021-03-16 21:46:07 +02:00
James Prestwich 79e806f6e9
bug: prevent interleaving websocket ID load/store operations (#217) 2021-03-03 00:19:20 +02:00
Georgios Konstantopoulos a43299c838
fix(abigen): correctly parse params in human readable abi (#194)
* fix(abigen): correctly parse params in human readable abi

* chore: make clippy happy

* test: remove unwrap

* chore: make clippy happy again

* chore: fix contract.rs example

* chore: rename to contract using human readable format

* examples: add abigen example with path to abi

* fix: pin funty version to fix bitvec error

* chore: remove unused import

* chore: fix deps
2021-02-16 19:10:26 +02:00
Rohit Narurkar 4c8d3c81e7
Feat/is middleware signer (#182)
* feat: signature from_str can handle 0x-prefixed strings

* feat: add is_signer method to the middleware trait

* fix: eth_sign Signature deserialisation

* chore: refactor for cleaner decoding of Signature
2021-01-28 08:51:53 +02:00
Rohit Narurkar 3105431007
feat: Transformer middleware with DsProxy impl (#165)
* feat: basic structure of proxy wallet middleware with DsProxy

* feat: build DsProxy contract, minor fixes, naming convention changes

* fix: add provider error in contract error

* fix: left pad storage value

* fix: delete gnosis safe for now

* feat(ds_proxy): execute code or target

* test(ds_proxy): transformer middleware tests

* fix: clippy should be happy

* fix(tests): ds proxy execute code

* chore: add documentation

* chore: formatting
2021-01-22 11:25:22 +02:00
Sam Wilson 8eafe81aa9
Handle ping/pong messages for Ws provider (#163) 2021-01-15 11:33:38 +02:00
Georgios Konstantopoulos 5f292670fc
docs: add more docs (#130) 2020-12-31 21:08:12 +02:00
Georgios Konstantopoulos 5c1f8f532a
Upgrade to Tokio 1.0 and remove async-std (#120)
* 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
2020-12-31 19:19:14 +02:00
Georgios Konstantopoulos dc4c2a807e
feat(providers): add tracing (#113)
* feat(provider): add async tracing

* feat(middleware): add tracing to gas escalator

* chore: make clippy happy
2020-12-24 22:23:05 +02:00
Georgios Konstantopoulos 65b50a7668
fix: reschedule waker for >1 confs (#112) 2020-12-24 18:33:22 +02:00
Georgios Konstantopoulos d9db40402b
feat: derives &, Arc and Box for Middleware (#109)
* test: can stack Middlewares with Arcs

* feat: derive &, Box and Arc impls for Middleware

* chore: fix spacing
2020-12-18 13:15:19 +02:00
Georgios Konstantopoulos 3a2fd3e814
Returning a `PendingTransaction` after sending a tx (#107)
* 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
2020-12-17 13:26:01 +02:00
Georgios Konstantopoulos 5b7578296b
fix: reschedule waker even if receipt is not available (#104)
PR #103 did not address the Future hanging when the receipt was not
immediately available, e.g. in non dev environments
2020-12-17 11:23:10 +02:00
Georgios Konstantopoulos b0bfd550fb
fix: reschedule waker if receipt is immediately available (#103)
* fix: reschedule waker if receipt is immediately available

* chore: update minor deps

`cargo update`

* chore: make clippy happy
2020-12-16 14:05:16 +02:00
Georgios Konstantopoulos 1ece5d2020
Contract & Provider eth_subscribe support (#100)
* 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
2020-11-30 11:33:06 +02:00
Georgios Konstantopoulos 09413dca6f
feat: add a mock transport (#99)
* feat: add a mock transport

* ci: fix libusb issue
2020-11-27 14:57:44 +02:00
Georgios Konstantopoulos d2d7a82a80 feat: add method for parity_getBlockReceipts 2020-11-19 19:51:15 +02:00
Georgios Konstantopoulos 84aafbbd1f
Misc Fixes (#97)
* fix: use generic instead of impl Trait

* fix: do not skip first 4 bytes when decoding outputs
2020-11-12 12:08:20 +02:00
Georgios Konstantopoulos c30f45fc72
feat: port over tracing from rust-web3 (#93) 2020-10-31 12:44:08 +02:00
Rohit Narurkar 98c63f9a3d
add Sync trait to middleware error (#94) 2020-10-31 12:39:03 +02:00
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 a22f1f9aa0
Geth TxPool API Support (#86)
* feat: support for txpool API

* feat: add a geth spawner test helper

* fix(txpool): use TxRequest instead of new data struct

The `raw` field is no longer present in latest geth's response.

* fix(txpool): use proper api response format

ref: https://github.com/ethereum/go-ethereum/pull/21720

Also add a Geth test

* ci: install geth 1.9.23

Co-authored-by: Rohit Narurkar <rohit.narurkar@protonmail.com>
2020-10-24 11:13:13 +03: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 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 a3fa77744e
fix(BREAKING): return Option for txs/receipts/blocks (#64)
* fix(BREAKING): return Option for txs/receipts/blocks

Otherwise if a user asks for a transaction hash or block that does not exist yet they'll get an Error

* test: ensure that unmined txs return None receipts

* test: fix remaining tests

* chore: re-enable sparkpool gas oracle

* chore: fix celo tests

* fix: run the non-existing data against infura

* fix: fix etherscan gas oracle tests
2020-09-17 14:06:56 +03:00
Georgios Konstantopoulos fb8f5a8ec9
Nonce manager (#59)
* feat: first stab at a NonceManager

* test: adjust the test

* fix: reset nonce if nonce manager errors

* feat: make nonce manager opt in

* fix: add read-only nonce call

* feat: improve http provider errors

* feat: convert to Atomic datatypes

* refactor: move to own file

* chore: remove tokio dep

* fix: improve nonce retry logic readability

* fix: use other privkey to avoid nonce races with other tests
2020-09-07 13:26:42 +03:00
Georgios Konstantopoulos 6197d8bb12
fix(core): serialize filters properly and always rewake (#61)
* fix: serialize filters properly

* test: add filter log tests

* fix(stream): always re-wake
2020-08-31 23:40:49 +03:00
Rohit Narurkar 237f011259
(feat) gas oracle support (#56)
* (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
2020-08-18 21:47:56 +03:00
James Prestwich ca2ec0aadd
bug #55: prevent request from serializing ZSTs as null (#57)
* bug #55: prevent request from serializing ZSTs as null

* chore: cargo fmt

Co-authored-by: Georgios Konstantopoulos <me@gakonst.com>
2020-08-18 17:12:47 +03:00
Brock Elmore 34550d9211 Add get_storage_at 2020-07-30 22:56:28 -04:00
James Prestwich 6f02bb5436
bug: reschedule rewaking when unpausing pending tx future (#50) 2020-07-13 20:52:33 +03:00
James Prestwich 320ab276de
refactor: pending txns don't wait to poll futures until interval elapses (#49) 2020-07-10 09:59:29 +03:00
Georgios Konstantopoulos da20a042d7
chore(provider): make websockets optional (#45) 2020-07-02 18:33:16 +03:00