Skip to content

Commit 4fdc55f

Browse files
pacrobpacrob
authored andcommitted
first draft docs update
1 parent d42e01a commit 4fdc55f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/web3.contract.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,12 +146,29 @@ Each Contract Factory exposes the following properties.
146146
The runtime part of the contract bytecode string. May be ``None`` if not
147147
provided during factory creation.
148148

149+
150+
.. py:attribute:: Contract.decode_tuples
151+
152+
If a Tuple/Struct is returned by a contract function, this flag defines whether
153+
to apply the field names from the ABI to the returned data.
154+
If False, the returned value will be a normal Python `Tuple`. If True, the returned
155+
value will be a Python `NamedTuple` of the name `ABIDecodedNamedTuple`.
156+
157+
NamedTuples have some restrictions regarding field names.
158+
Web3.py sets `NamedTuple`'s `rename=True`, so disallowed field names my be
159+
different than expected. See the [Python docs](https://docs.python.org/3/library/collections.html#collections.namedtuple)
160+
for more information.
161+
162+
May be ``None`` if not provided during factory creation.
163+
164+
149165
.. py:attribute:: Contract.functions
150166
151167
This provides access to contract functions as attributes. For example:
152168
``myContract.functions.MyMethod()``. The exposed contract functions are classes of the
153169
type :py:class:`ContractFunction`.
154170

171+
155172
.. py:attribute:: Contract.events
156173
157174
This provides access to contract events as attributes. For example:

docs/web3.eth.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,6 +1446,7 @@ Contracts
14461446
- ``bytecode_runtime``
14471447
- ``clone_bin``
14481448
- ``dev_doc``
1449+
- ``decode_tuples``
14491450
- ``interface``
14501451
- ``metadata``
14511452
- ``opcodes``

0 commit comments

Comments
 (0)