Commit Graph

14 Commits

Author SHA1 Message Date
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
Mark Spanbroek e8d0fdf1a9 version 0.2.1 2022-08-08 15:14:11 +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 a626070532 version 0.1.9 2022-06-15 10:54:45 +02:00
Mark Spanbroek 78115cdd4b version 0.1.8 2022-06-08 11:24:38 +02:00
Eric Mastro 270d358b86
version 0.1.7 2022-05-23 11:31:16 +10:00
Mark Spanbroek 0549800af6 version 0.1.6 2022-05-17 19:28:52 +02:00
Mark Spanbroek 8c45babcdf version 0.1.5 2022-04-19 17:57:16 +02:00
Mark Spanbroek a0dca2674d version 0.1.4 2022-04-13 10:10:53 +02:00
Mark Spanbroek ac74b91f11 version 0.1.3 2022-03-29 10:48:00 +02:00
Mark Spanbroek fc8af1117c version 0.1.2 2022-03-17 10:30:42 +01:00
Mark Spanbroek acc4fc25e6 version 0.1.1 2022-03-16 14:20:56 +01:00
Mark Spanbroek 5cc1f4b71d Add documentation about events 2022-02-09 14:50:51 +01:00
Mark Spanbroek 3940233bc9 Add Readme 2022-01-26 17:58:51 +01:00