Skip to content
This repository has been archived by the owner on Jul 9, 2021. It is now read-only.

Commit

Permalink
abi-gen/Py: doc contract method attributes
Browse files Browse the repository at this point in the history
Without this, generated documentation was not including the class
members that represent the contract methods, rendering the usage
unclear.
  • Loading branch information
feuGeneA committed Aug 8, 2019
1 parent a598a8f commit d81927a
Show file tree
Hide file tree
Showing 3 changed files with 128 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/abi-gen-templates/Python/contract.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ class {{contractName}}:
"""Wrapper class for {{contractName}} Solidity contract.{{docBytesIfNecessary ABIString}}"""
{{#each methods}}
{{toPythonIdentifier this.languageSpecificName}}: {{toPythonClassname this.languageSpecificName}}Method
"""Constructor-initialized instance of
:class:`{{toPythonClassname this.languageSpecificName}}Method`.
"""

{{/each}}

def __init__(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1367,34 +1367,150 @@ class AbiGenDummy:
which can be accomplished via `str.encode("utf_8")`:code:.
"""
simple_require: SimpleRequireMethod
"""Constructor-initialized instance of
:class:`SimpleRequireMethod`.
"""

accepts_an_array_of_bytes: AcceptsAnArrayOfBytesMethod
"""Constructor-initialized instance of
:class:`AcceptsAnArrayOfBytesMethod`.
"""

simple_input_simple_output: SimpleInputSimpleOutputMethod
"""Constructor-initialized instance of
:class:`SimpleInputSimpleOutputMethod`.
"""

withdraw: WithdrawMethod
"""Constructor-initialized instance of
:class:`WithdrawMethod`.
"""

multi_input_multi_output: MultiInputMultiOutputMethod
"""Constructor-initialized instance of
:class:`MultiInputMultiOutputMethod`.
"""

ecrecover_fn: EcrecoverFnMethod
"""Constructor-initialized instance of
:class:`EcrecoverFnMethod`.
"""

accepts_bytes: AcceptsBytesMethod
"""Constructor-initialized instance of
:class:`AcceptsBytesMethod`.
"""

no_input_simple_output: NoInputSimpleOutputMethod
"""Constructor-initialized instance of
:class:`NoInputSimpleOutputMethod`.
"""

revert_with_constant: RevertWithConstantMethod
"""Constructor-initialized instance of
:class:`RevertWithConstantMethod`.
"""

simple_revert: SimpleRevertMethod
"""Constructor-initialized instance of
:class:`SimpleRevertMethod`.
"""

method_using_nested_struct_with_inner_struct_not_used_elsewhere: MethodUsingNestedStructWithInnerStructNotUsedElsewhereMethod
"""Constructor-initialized instance of
:class:`MethodUsingNestedStructWithInnerStructNotUsedElsewhereMethod`.
"""

nested_struct_output: NestedStructOutputMethod
"""Constructor-initialized instance of
:class:`NestedStructOutputMethod`.
"""

require_with_constant: RequireWithConstantMethod
"""Constructor-initialized instance of
:class:`RequireWithConstantMethod`.
"""

with_address_input: WithAddressInputMethod
"""Constructor-initialized instance of
:class:`WithAddressInputMethod`.
"""

struct_input: StructInputMethod
"""Constructor-initialized instance of
:class:`StructInputMethod`.
"""

non_pure_method: NonPureMethodMethod
"""Constructor-initialized instance of
:class:`NonPureMethodMethod`.
"""

complex_input_complex_output: ComplexInputComplexOutputMethod
"""Constructor-initialized instance of
:class:`ComplexInputComplexOutputMethod`.
"""

no_input_no_output: NoInputNoOutputMethod
"""Constructor-initialized instance of
:class:`NoInputNoOutputMethod`.
"""

simple_pure_function_with_input: SimplePureFunctionWithInputMethod
"""Constructor-initialized instance of
:class:`SimplePureFunctionWithInputMethod`.
"""

non_pure_method_that_returns_nothing: NonPureMethodThatReturnsNothingMethod
"""Constructor-initialized instance of
:class:`NonPureMethodThatReturnsNothingMethod`.
"""

simple_pure_function: SimplePureFunctionMethod
"""Constructor-initialized instance of
:class:`SimplePureFunctionMethod`.
"""

nested_struct_input: NestedStructInputMethod
"""Constructor-initialized instance of
:class:`NestedStructInputMethod`.
"""

method_returning_multiple_values: MethodReturningMultipleValuesMethod
"""Constructor-initialized instance of
:class:`MethodReturningMultipleValuesMethod`.
"""

method_returning_array_of_structs: MethodReturningArrayOfStructsMethod
"""Constructor-initialized instance of
:class:`MethodReturningArrayOfStructsMethod`.
"""

struct_output: StructOutputMethod
"""Constructor-initialized instance of
:class:`StructOutputMethod`.
"""

pure_function_with_constant: PureFunctionWithConstantMethod
"""Constructor-initialized instance of
:class:`PureFunctionWithConstantMethod`.
"""

simple_input_no_output: SimpleInputNoOutputMethod
"""Constructor-initialized instance of
:class:`SimpleInputNoOutputMethod`.
"""

overloaded_method2: OverloadedMethod2Method
"""Constructor-initialized instance of
:class:`OverloadedMethod2Method`.
"""

overloaded_method1: OverloadedMethod1Method
"""Constructor-initialized instance of
:class:`OverloadedMethod1Method`.
"""


def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,15 @@ def estimate_gas(self, x: int, tx_params: Optional[TxParams] = None) -> int:
class TestLibDummy:
"""Wrapper class for TestLibDummy Solidity contract."""
public_add_constant: PublicAddConstantMethod
"""Constructor-initialized instance of
:class:`PublicAddConstantMethod`.
"""

public_add_one: PublicAddOneMethod
"""Constructor-initialized instance of
:class:`PublicAddOneMethod`.
"""


def __init__(
self,
Expand Down

0 comments on commit d81927a

Please sign in to comment.