Skip to content

Commit

Permalink
Merge pull request #138 from davesque/doc-updates
Browse files Browse the repository at this point in the history
Update docs for release and new custom stream class feature
  • Loading branch information
davesque committed Dec 10, 2019
2 parents 2f8a0b3 + e9258f5 commit 678d499
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
25 changes: 25 additions & 0 deletions docs/codecs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,28 @@ capability coupled with the use of a custom codec:
default_codec.encode_single('address', '0x' + 'ff' * 20) ==
b'\x00' * 12 + b'\xff' * 20
)

.. _custom_stream_class:

Using a Custom Stream Class
---------------------------

If a user wishes to customize the behavior of the internal stream class used
for decoding, they can do the following:

.. testcode:: custom-stream-class

from eth_abi.codec import ABIEncoder, ABIDecoder
from eth_abi.registry import registry

class MyStream:
# Custom behavior...
pass

class MyDecoder(ABIDecoder):
stream_class = MyStream

class MyCodec(ABIEncoder, MyDecoder):
pass

codec = MyCodec(registry)
12 changes: 12 additions & 0 deletions docs/releases.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
Release Notes
=============

v2.1.0
------

- Added support for "byte" alias for "bytes1" type.
- Added support for custom stream class in :class:`~eth_abi.codec.ABIDecoder`.
See :ref:`custom_stream_class`.

v2.0.0
------

- Includes all changes from v2.0.0 beta and alpha versions.

v2.0.0-beta.9
-------------

Expand Down

0 comments on commit 678d499

Please sign in to comment.