Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ Clients
.. autoclass:: ClientSession()
:members:

.. autoclass:: ClientSessionRPC()
:members:


Providers
---------
Expand Down Expand Up @@ -46,14 +49,22 @@ Errors
------

.. autoclass:: pons.ABIDecodingError

.. autoclass:: pons.RemoteError
:show-inheritance:

.. autoclass:: pons.Unreachable
:show-inheritance:

.. autoclass:: pons.ProtocolError
:show-inheritance:

.. autoclass:: pons.HTTPError
:show-inheritance:

.. autoclass:: pons.TransactionFailed
:show-inheritance:

.. autoclass:: pons.BadResponseFormat
:show-inheritance:

.. autoclass:: pons.ProviderError()
:show-inheritance:
Expand Down Expand Up @@ -252,11 +263,11 @@ Compiled and deployed contracts
Filter objects
--------------

.. autoclass:: pons._client.BlockFilter()
.. autoclass:: pons._client_rpc.BlockFilter()

.. autoclass:: pons._client.PendingTransactionFilter()
.. autoclass:: pons._client_rpc.PendingTransactionFilter()

.. autoclass:: pons._client.LogFilter()
.. autoclass:: pons._client_rpc.LogFilter()


Solidity types
Expand Down
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Changed
- ``JSON`` removed from the public API, instead we have a more specific ``ABI_JSON``. (PR_82_)
- Renamed ``id_`` fields of ``BlockFilter``, ``PendingTransactionFilter``, and ``LogFilter`` to just ``id``. (PR_82_)
- Split out ``http-provider-server`` feature from ``local-provider``. (PR_82_)
- ``RemoteError`` removed. (PR_82_)


Added
Expand All @@ -19,6 +20,7 @@ Added
- Hash methods for ABI types. (PR_81_)
- A base class for bound calls (``BaseBoundMethodCall``). (PR_84_)
- A helper class for interacting with the Multicall contract (``Multicall``). (PR_84_)
- Exporting ``HTTPError`` and ``BadResponseFormat``. (PR_82_)


.. _PR_81: https://github.com/fjarri-eth/pons/pull/81
Expand Down
4 changes: 2 additions & 2 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,13 @@ A quick usage example:
signer = AccountSigner(acc)

async with client.session() as session:
my_balance = await session.eth_get_balance(signer.address)
my_balance = await session.get_balance(signer.address)
print("My balance:", my_balance.as_ether(), "ETH")

another_address = Address.from_hex("0x<another_address>")
await session.transfer(signer, another_address, Amount.ether(1.5))

another_balance = await session.eth_get_balance(another_address)
another_balance = await session.get_balance(another_address)
print("Another balance:", another_balance.as_ether(), "ETH")

trio.run(main)
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial.rst
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,12 @@ Interacting with deployed contracts
A :py:class:`~pons.DeployedContract` object wraps all ABI method objects into "bound" state, similarly to how Python methods are bound to class instances.
It means that all the method calls created from this object have the contract address inside them, so that it does not need to be provided every time.

For example, to call a non-mutating contract method via :py:meth:`~pons.ClientSession.eth_call`:
For example, to call a non-mutating contract method via :py:meth:`~pons.ClientSession.call`:

::

call = deployed_contract.method.getState(1)
result = await session.eth_call(call)
result = await session.call(call)

Note that when the :py:class:`~pons.ContractABI` object is created from the JSON ABI, even if the method returns a single value, it is still represented as a list of one element in the JSON, so the ``result`` will be a list too.
If the ABI is declared programmatically, one can provide a single output value instead of the list, and then ``pons`` will unpack that list.
Expand Down
9 changes: 5 additions & 4 deletions pons/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
ContractError,
ContractLegacyError,
ContractPanic,
ProviderError,
RemoteError,
TransactionFailed,
)
from ._client_rpc import BadResponseFormat, ClientSessionRPC, ProviderError
from ._compiler import EVMVersion, compile_contract_file
from ._contract import (
BaseBoundMethodCall,
Expand Down Expand Up @@ -49,14 +48,15 @@
from ._http_provider_server import HTTPProviderServer
from ._local_provider import LocalProvider, SnapshotID
from ._multicall import BoundMultiMethodCall, BoundMultiMethodValueCall, Multicall
from ._provider import HTTPProvider, ProtocolError, Provider, Unreachable
from ._provider import HTTPError, HTTPProvider, ProtocolError, Provider, Unreachable
from ._signer import AccountSigner, Signer
from ._utils import get_create2_address, get_create_address

__all__ = [
"ABI_JSON",
"ABIDecodingError",
"AccountSigner",
"BadResponseFormat",
"BaseBoundMethodCall",
"BoundConstructor",
"BoundConstructorCall",
Expand All @@ -68,6 +68,7 @@
"BoundMultiMethodValueCall",
"Client",
"ClientSession",
"ClientSessionRPC",
"CompiledContract",
"Constructor",
"ConstructorCall",
Expand All @@ -86,6 +87,7 @@
"FallbackProvider",
"FallbackStrategy",
"FallbackStrategyFactory",
"HTTPError",
"HTTPProvider",
"HTTPProviderServer",
"LocalProvider",
Expand All @@ -99,7 +101,6 @@
"Provider",
"ProviderError",
"Receive",
"RemoteError",
"Signer",
"SnapshotID",
"TransactionFailed",
Expand Down
Loading