Commit Graph

119 Commits

Author SHA1 Message Date
Eric Mastro a87b1b23a8
support async subscription event handlers 2023-02-07 16:09:51 +11:00
Mark Spanbroek e462649aec version 0.2.4 2022-11-10 10:22:24 +01:00
Mark Spanbroek e8592bb922 Remove unnecessary error check 2022-09-21 10:29:31 +02:00
Mark Spanbroek 7d2acd65e8 Fix imports 2022-09-21 10:29:31 +02:00
Mark Spanbroek a62ea4fb8f Ensure that `reverts` works with functions with a return type 2022-09-21 10:29:31 +02:00
Mark Spanbroek c5a40e5f9d Remove dependency on json-rpc provider for `reverts` 2022-09-21 10:29:31 +02:00
Mark Spanbroek f545169331 Remove JSON wrapper from error in JSON RPC provider 2022-09-21 10:29:31 +02:00
Mark Spanbroek cac6026b34 Change `reverts` API
- Enables postfix syntax: `call().reverts(reason)`
- Removes doesNotRevert etc; uses `check not` instead
- Removes waitFor(); return Future instead
2022-09-21 10:29:31 +02:00
Mark Spanbroek d001ee8e01 Use `solidityType()` to check indexed event parameter 2022-09-21 10:27:45 +10:00
Eric Mastro fc3cc9c577 version 0.2.3, bump contractabi 2022-09-21 10:27:45 +10:00
Eric Mastro bbabee3727 update contractabi dependency to support distinct 2022-09-21 10:27:45 +10:00
Eric Mastro 8a484299e6 Remove en/decoding advice from readme 2022-09-21 10:27:45 +10:00
Eric Mastro 4d7e40eb0e remove en/decoding for distinct types
The changes to `nim-contract-abi` in https://github.com/status-im/nim-contract-abi/pull/5 have allowed for distinct type en/decoding procs to not need to be defined.
2022-09-21 10:27:45 +10:00
Eric Mastro 01d277f801 version 0.2.2 2022-09-21 10:27:45 +10:00
Eric Mastro 31ffc8992f Update compile time check to use when 2022-09-21 10:27:45 +10:00
Eric Mastro ae2d33aacd Support 1.2.16 distinctBase compilation error 2022-09-21 10:27:45 +10:00
Eric Mastro 0adf56c65b Support distinct types for Event fields
Add support for indexed (and non-indexed) Event fields types that are distinct `ValueType` or `SmallByteArray`. For example,
```nim
type
  DistinctAlias = distinct array[32, byte]
  MyEvent = object of Event
    a {.indexed.}: DistinctAlias
    b: DistinctAlias # also allowed for non-indexed fields

## The below funcs generally need to be included for ABI
## encoding/decoding purposes when implementing distinct types.

func toArray(value: DistinctAlias): array[32, byte] =
  array[32, byte](value)

func encode*(encoder: var AbiEncoder, value: DistinctAlias) =
  encoder.write(value.toArray)

func decode*(decoder: var AbiDecoder,
             T: type DistinctAlias): ?!T =
  let d = ?decoder.read(type array[32, byte])
  success DistinctAlias(d)
```
2022-09-21 10:27:45 +10:00
Eric Mastro e1a1a3805b remove extra spaces 2022-09-20 13:15:15 +10:00
Eric Mastro 5fe41a76ab PR comments
1. rename helpers to testing and expose externally via `import pkg/ethers/testing`
2. Change detection of revert from `EthersError` to `JsonRpcProviderError`
3, Remove catch of `CatchableError` from revert detection as this would swallow errors. Update tests accordingly.
2022-09-20 13:15:15 +10:00
Eric Mastro f8ba91a297 Catch ValueError from nim-json-rpc 2022-09-20 13:15:15 +10:00
Eric Mastro e0ac15b3ba add revert helpers for testing
Add the following helpers to help detect transaction reverts:
1. `reverts`
2. `revertsWith`
3. `doesNotRevert`
4. `doesNotRevertWith`
2022-09-20 13:15:15 +10:00
Mark Spanbroek e8d0fdf1a9 version 0.2.1 2022-08-08 15:14:11 +02:00
Mark Spanbroek c72cdc5573 [wallet] cleanup 2022-08-08 15:07:41 +02:00
Mark Spanbroek a2d688e34e [wallet] Avoid Option.get() which can raise UnpackDefect 2022-08-08 15:07:41 +02:00
Mark Spanbroek 1a8ca0bcad [wallet] Use questionable to deal with optionals 2022-08-08 15:07:41 +02:00
Mark Spanbroek 0483e1676a [provider] Rename sendRawTransaction -> sendTransaction
To be consistent with ethers.js
2022-08-08 15:07:41 +02:00
Jackie cd5165efd0 Fix issues with teardown in wallet tests 2022-08-08 12:40:36 +02:00
Jackie 1af3ab1a0a Make wallet use Provider not JsonRpcProvider 2022-08-08 12:40:36 +02:00
Jackie b72fbb0ed9 small fixes 2022-08-08 12:40:36 +02:00
Jackie 39005a09be Add TODOs 2022-08-08 12:40:36 +02:00
Jackie d6c9151103 Add new test for wallet 2022-08-08 12:40:36 +02:00
Jackie 456d454f2f Fix bug in wallet 2022-08-08 12:40:36 +02:00
Jackie ac7785dd04 Add new method to wallet 2022-08-08 12:40:36 +02:00
Jackie 4c047fd997 Changes to TransactionOverrides to support EIP1559 2022-08-08 12:40:36 +02:00
Jackie 1d89be9d42 Add first tests for wallet 2022-08-08 12:40:36 +02:00
Jackie b5888a53a6 Include wallet in library 2022-08-08 12:40:36 +02:00
Jackie 2c9eb595d2 Add sendRawTransaction 2022-08-08 12:40:36 +02:00
Jackie 671d42889a Add Wallet functionality 2022-08-08 12:40:36 +02:00
Jackie abda8493b0 Change Transaction type to support EIP1559 2022-08-08 12:40:36 +02:00
Jackie e01ef1daf8 Add new requirement 2022-08-08 12:40:36 +02:00
Mark Spanbroek 16a3d25419 Remove duplication 2022-08-08 12:26:09 +02:00
Jackie 52f57894f5 Fix block subscription 2022-08-08 12:26:09 +02:00
Ivan Yonchovski abb23d5220 Add setup files 2022-07-13 09:09:27 +02:00
Mark Spanbroek e9aaea4a5a Fix intermittent test failure
Test would fail with an error when transaction hash
happens to start with 0b; it would then try to to parse
the hash as a binary number.
2022-07-13 09:04:48 +02:00
Mark Spanbroek 083af80dcc Introduce separate type for transaction overrides 2022-07-13 09:04:48 +02:00
Mark Spanbroek a7d1944406 Allow for custom transaction properties 2022-07-13 09:04:48 +02:00
Mark Spanbroek 440ca6360b Version 0.2.0
Backwards incompatible because:
- Raises EthersError instead of JsonRpcError
- Nim 1.4.x no longer supported
2022-06-30 10:52:12 +02:00
Mark Spanbroek 94f5f35a10 Drop support for Nim 1.4.x
Only support stable Nim versions 1.2.x and 1.6.x.
2022-06-30 10:52:12 +02:00
Mark Spanbroek 95c5282b8a Raise EthersError when JSON-RPC fails 2022-06-30 10:52:12 +02:00
Mark Spanbroek 1a6cff211d Fix: use websock instead of news
The default was changed to news in the json_rpc
library, and broke communication with hardhat.
2022-06-30 09:35:30 +02:00