API¶
Clients¶
Providers¶
Fallback providers¶
Errors¶
- class pons._client.ContractPanicReason(value)[source]¶
Reasons leading to a contract call panicking.
- ASSERTION = 1¶
If you call assert with an argument that evaluates to
false.
- COMPILER = 0¶
Used for generic compiler inserted panics.
- DIVISION_BY_ZERO = 18¶
If you divide or modulo by zero (e.g.
5 / 0or23 % 0).
- EMPTY_ARRAY = 49¶
If you call
.pop()on an empty array.
- INVALID_ENCODING = 34¶
If you access a storage byte array that is incorrectly encoded.
- INVALID_ENUM_VALUE = 33¶
If you convert a value that is too big or negative into an
enumtype.
- OUT_OF_BOUNDS = 50¶
If you access an array,
bytesNor an array slice at an out-of-bounds or negative index (i.e.x[i]wherei >= x.lengthori < 0).
- OUT_OF_MEMORY = 65¶
If you allocate too much memory or create an array that is too large.
- OVERFLOW = 17¶
If an arithmetic operation results in underflow or overflow outside of an
unchecked { ... }block.
- UNKNOWN = -1¶
Unknown panic code.
- ZERO_DEREFERENCE = 81¶
If you call a zero-initialized variable of internal function type.
Signers¶
Contract ABI¶
Testing utilities¶
pons exposes several types useful for testing applications that connect to Ethereum RPC servers. Not intended for the production environment.
Install with the feature local-provider for it to be available.
Compiler¶
Install with the feature compiler for it to be available.
Secondary classes¶
The instances of these classes are not created by the user directly, but rather found as return values, or attributes of other objects.
Utility classes¶
- class pons._contract_abi.Methods[source]¶
Bases:
Generic[MethodType].A holder for named methods which can be accessed as attributes, or iterated over.
- __getattr__(method_name: str) MethodType[source]¶
Returns the method by name.
- __iter__() Iterator[MethodType][source]¶
Returns the iterator over all methods.
- class pons._contract_abi.MethodType¶
Generic method type parameter.
- class pons._contract_abi.Signature[source]¶
Generalized signature of either inputs or outputs of a method.
- class pons._contract_abi.Method(name: str, mutability: Mutability, inputs: Mapping[str, Type] | Sequence[Type], outputs: None | Mapping[str, Type] | Sequence[Type] | Type = None)[source]¶
A contract method.
Note
If the name of a parameter (input or output) given to the constructor matches a Python keyword,
_will be appended to it.
Compiled and deployed contracts¶
Filter objects¶
Solidity types¶
Type aliases are exported from the abi submodule.
Arrays can be obtained from Type objects by indexing them (either with an integer for a fixed-size array, or with ... for a variable-sized array).
Helper aliases are exported from pons.abi submodule:
- pons.abi.bytes(size: None | int = None) Bytes[source]¶
Returns the
bytes<size>type, orbytesifsizeisNone.
- pons.abi.address: AddressType¶
addresstype.
Actual type objects, for reference:
- class pons._abi_types.Bytes(size: None | int = None)[source]¶
Corresponds to the Solidity
bytes<size>type.
- class pons._abi_types.AddressType[source]¶
Corresponds to the Solidity
addresstype. Not to be confused withethereum_rpc.Addresswhich represents an address value.