genlayer-test 0.1.0b5__py3-none-any.whl → 0.1.0b6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: genlayer-test
3
- Version: 0.1.0b5
3
+ Version: 0.1.0b6
4
4
  Summary: GenLayer Testing Suite
5
5
  Author: GenLayer
6
6
  License-Expression: MIT
@@ -1,4 +1,4 @@
1
- genlayer_test-0.1.0b5.dist-info/licenses/LICENSE,sha256=che_H4vE0QUx3HvWrAa1_jDEVInift0U6VO15-QqEls,1064
1
+ genlayer_test-0.1.0b6.dist-info/licenses/LICENSE,sha256=che_H4vE0QUx3HvWrAa1_jDEVInift0U6VO15-QqEls,1064
2
2
  gltest/__init__.py,sha256=AK_YfRvwlhrOheOelUG8qIRG17on0-nFCF747dopg2w,332
3
3
  gltest/assertions.py,sha256=wrT5R8yLAxm0B1EzmdZjOK5gBriugIrdtOIt9Qi0G-k,591
4
4
  gltest/exceptions.py,sha256=V3OJlvW5iiv7lYmwV6h_EtAi2vqy63b7RcLB6ohDZ20,502
@@ -10,15 +10,15 @@ gltest/artifacts/contract.py,sha256=2wmfQF6FAiNuMlr9pePK7ZJjQj5Tl7-3SefeH3OnSRQ,
10
10
  gltest/glchain/__init__.py,sha256=X-mEbREoAOe9K4n74C55gCiXH4wItzY5HTJcg3_F3mI,412
11
11
  gltest/glchain/account.py,sha256=vOXxcR09NkT6iFw_m49DW1nVC7kP8wf23555iPPXRkw,402
12
12
  gltest/glchain/client.py,sha256=q04LIQy5SCIrYZflZiTapfeQ-AaSTa0w369ehnVbJLM,532
13
- gltest/glchain/contract.py,sha256=bma3aepoZkVOsGdbNbUKAMvbgW6kzmnWnTs9PrgVdas,7719
13
+ gltest/glchain/contract.py,sha256=1pd4eAQlHXjnRF7hBvnoR-9f-HORUaYKVyV5P42io4o,8747
14
14
  gltest/helpers/__init__.py,sha256=a9uBXWj44P-Gu0vKKgVBPOSuZ5yumVFLYAzywrGZ36Y,179
15
15
  gltest/helpers/fixture_snapshot.py,sha256=r7olLq8Aq0h0mMydlvmr3sNxWZeUns_wx1WK3HFAVaY,1774
16
16
  gltest/helpers/take_snapshot.py,sha256=eXqEKXM2hcox3pLGIcNddobU8zXPQvD-Iwf87eHqW2s,1276
17
17
  gltest_cli/main.py,sha256=Ti2-0Ev1x5_cM0D1UKqdgaDt80CDHEQGtdRne2qLm4M,53
18
18
  tests/conftest.py,sha256=vY6XQ9K2kZ8Qo-h9-PmkhmEIRyR_ILjbM7R0dPPjU_g,28
19
19
  tests/test_plugin_hooks.py,sha256=FQOrkhoXLinq0sjvoYjr63Oqg-ZVPcNFeUrK4bqrn4E,2020
20
- genlayer_test-0.1.0b5.dist-info/METADATA,sha256=Ox0jwGv_RkvZL5baRbQjpBENdJPmhl5DjHC58zCdl-s,12925
21
- genlayer_test-0.1.0b5.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
22
- genlayer_test-0.1.0b5.dist-info/entry_points.txt,sha256=rXhrPVq2IhVsd4uWzxzwCTx7jA1KcQIVNxDCUuxq4f8,89
23
- genlayer_test-0.1.0b5.dist-info/top_level.txt,sha256=-qiGZxTRBytujzgVcKpxjvQ-WNeUDjXa59ceGMwMpko,24
24
- genlayer_test-0.1.0b5.dist-info/RECORD,,
20
+ genlayer_test-0.1.0b6.dist-info/METADATA,sha256=jgrseqjqUTnRcPEH_Z7KqEaIpSE0raE9OEcNoqAyshs,12925
21
+ genlayer_test-0.1.0b6.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
22
+ genlayer_test-0.1.0b6.dist-info/entry_points.txt,sha256=rXhrPVq2IhVsd4uWzxzwCTx7jA1KcQIVNxDCUuxq4f8,89
23
+ genlayer_test-0.1.0b6.dist-info/top_level.txt,sha256=-qiGZxTRBytujzgVcKpxjvQ-WNeUDjXa59ceGMwMpko,24
24
+ genlayer_test-0.1.0b6.dist-info/RECORD,,
@@ -1,10 +1,15 @@
1
+ from eth_typing import (
2
+ Address,
3
+ ChecksumAddress,
4
+ )
5
+ from eth_account.signers.local import LocalAccount
6
+ from typing import Union
1
7
  from dataclasses import dataclass
2
8
  from gltest.artifacts import find_contract_definition
3
9
  from gltest.assertions import tx_execution_failed
4
10
  from gltest.exceptions import DeploymentError
5
11
  from .client import get_gl_client
6
12
  from gltest.types import CalldataEncodable, GenLayerTransaction, TransactionStatus
7
- from eth_account.signers.local import LocalAccount
8
13
  from typing import List, Any, Type, Optional, Dict, Callable
9
14
  import types
10
15
  from gltest.plugin_config import get_default_wait_interval, get_default_wait_retries
@@ -89,14 +94,18 @@ class Contract:
89
94
  consensus_max_rotations: Optional[int] = None,
90
95
  leader_only: bool = False,
91
96
  wait_transaction_status: TransactionStatus = TransactionStatus.FINALIZED,
92
- wait_interval: int = get_default_wait_interval(),
93
- wait_retries: int = get_default_wait_retries(),
97
+ wait_interval: Optional[int] = None,
98
+ wait_retries: Optional[int] = None,
94
99
  wait_triggered_transactions: bool = True,
95
100
  wait_triggered_transactions_status: TransactionStatus = TransactionStatus.ACCEPTED,
96
101
  ) -> GenLayerTransaction:
97
102
  """
98
103
  Wrapper to the contract write method.
99
104
  """
105
+ if wait_interval is None:
106
+ wait_interval = get_default_wait_interval()
107
+ if wait_retries is None:
108
+ wait_retries = get_default_wait_retries()
100
109
  client = get_gl_client()
101
110
  tx_hash = client.write_contract(
102
111
  address=self.address,
@@ -152,19 +161,42 @@ class ContractFactory:
152
161
  contract_name=contract_name, contract_code=contract_info.contract_code
153
162
  )
154
163
 
164
+ def build_contract(
165
+ self,
166
+ contract_address: Union[Address, ChecksumAddress],
167
+ account: Optional[LocalAccount] = None,
168
+ ) -> Contract:
169
+ """
170
+ Build contract from address
171
+ """
172
+ client = get_gl_client()
173
+ try:
174
+ schema = client.get_contract_schema(address=contract_address)
175
+ return Contract.new(
176
+ address=contract_address, schema=schema, account=account
177
+ )
178
+ except Exception as e:
179
+ raise ValueError(
180
+ f"Failed to build contract {self.contract_name}: {str(e)}"
181
+ ) from e
182
+
155
183
  def deploy(
156
184
  self,
157
185
  args: List[Any] = [],
158
186
  account: Optional[LocalAccount] = None,
159
187
  consensus_max_rotations: Optional[int] = None,
160
188
  leader_only: bool = False,
161
- wait_interval: int = get_default_wait_interval(),
162
- wait_retries: int = get_default_wait_retries(),
189
+ wait_interval: Optional[int] = None,
190
+ wait_retries: Optional[int] = None,
163
191
  wait_transaction_status: TransactionStatus = TransactionStatus.FINALIZED,
164
192
  ) -> Contract:
165
193
  """
166
194
  Deploy the contract
167
195
  """
196
+ if wait_interval is None:
197
+ wait_interval = get_default_wait_interval()
198
+ if wait_retries is None:
199
+ wait_retries = get_default_wait_retries()
168
200
  client = get_gl_client()
169
201
  try:
170
202
  tx_hash = client.deploy_contract(