Commit Graph

10 Commits

Author SHA1 Message Date
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 7a17e54fbd
feat(contract): add helper to query events w/ metadata (block num + tx hash) (#33)
* feat(contract): add helper to query events w/ metadata (block num + tx hash)
2020-06-22 01:08:40 +03:00
Georgios Konstantopoulos 833ca33f60
feat(signers): make Signer on Client optional (#34)
This allows using Contract either in read-only mode (e.g. for fetching data/events)
or for using the accounts on the node as senders
2020-06-21 21:19:59 +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 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 030fc671fe
docs(contract): expand contract docs 2020-06-10 21:20:47 +03:00
Georgios Konstantopoulos b0feff2432
fix: serialize null filters 2020-06-03 00:10:46 +03:00
Georgios Konstantopoulos c18e52f918
contract: simplify lifetimes 2020-06-02 14:39:01 +03:00
Georgios Konstantopoulos e051cffe47
contract: allow connecting to many clients/addresses 2020-06-02 13:36:29 +03:00
Georgios Konstantopoulos 6bd3c41bd0
contract: simplify errors and generics 2020-06-02 02:15:33 +03:00