|
50 | 50 | from web3._utils.contract_sources.contract_data.string_contract import (
|
51 | 51 | STRING_CONTRACT_DATA,
|
52 | 52 | )
|
| 53 | +from web3._utils.contract_sources.contract_data.tuple_contracts import ( |
| 54 | + NESTED_TUPLE_CONTRACT_DATA, |
| 55 | + TUPLE_CONTRACT_DATA, |
| 56 | +) |
53 | 57 |
|
54 | 58 |
|
55 | 59 | @pytest.fixture(scope="session")
|
@@ -340,6 +344,44 @@ def revert_contract(w3, address_conversion_func):
|
340 | 344 | return deploy(w3, revert_contract_factory, address_conversion_func)
|
341 | 345 |
|
342 | 346 |
|
| 347 | +@pytest.fixture |
| 348 | +def tuple_contract(w3, address_conversion_func): |
| 349 | + tuple_contract_factory = w3.eth.contract(**TUPLE_CONTRACT_DATA) |
| 350 | + return deploy(w3, tuple_contract_factory, address_conversion_func) |
| 351 | + |
| 352 | + |
| 353 | +@pytest.fixture |
| 354 | +def nested_tuple_contract(w3, address_conversion_func): |
| 355 | + nested_tuple_contract_factory = w3.eth.contract(**NESTED_TUPLE_CONTRACT_DATA) |
| 356 | + return deploy(w3, nested_tuple_contract_factory, address_conversion_func) |
| 357 | + |
| 358 | + |
| 359 | +TUPLE_CONTRACT_DATA_DECODE_TUPLES = { |
| 360 | + **TUPLE_CONTRACT_DATA, |
| 361 | + "decode_tuples": True, |
| 362 | +} |
| 363 | + |
| 364 | + |
| 365 | +NESTED_TUPLE_CONTRACT_DATA_DECODE_TUPLES = { |
| 366 | + **NESTED_TUPLE_CONTRACT_DATA, |
| 367 | + "decode_tuples": True, |
| 368 | +} |
| 369 | + |
| 370 | + |
| 371 | +@pytest.fixture |
| 372 | +def tuple_contract_with_decode_tuples(w3, address_conversion_func): |
| 373 | + tuple_contract_factory = w3.eth.contract(**TUPLE_CONTRACT_DATA_DECODE_TUPLES) |
| 374 | + return deploy(w3, tuple_contract_factory, address_conversion_func) |
| 375 | + |
| 376 | + |
| 377 | +@pytest.fixture |
| 378 | +def nested_tuple_contract_with_decode_tuples(w3, address_conversion_func): |
| 379 | + nested_tuple_contract_factory = w3.eth.contract( |
| 380 | + **NESTED_TUPLE_CONTRACT_DATA_DECODE_TUPLES |
| 381 | + ) |
| 382 | + return deploy(w3, nested_tuple_contract_factory, address_conversion_func) |
| 383 | + |
| 384 | + |
343 | 385 | @pytest.fixture
|
344 | 386 | def some_address(address_conversion_func):
|
345 | 387 | return address_conversion_func("0x5B2063246F2191f18F2675ceDB8b28102e957458")
|
@@ -563,6 +605,46 @@ async def async_revert_contract(async_w3, address_conversion_func):
|
563 | 605 | )
|
564 | 606 |
|
565 | 607 |
|
| 608 | +@pytest_asyncio.fixture |
| 609 | +async def async_tuple_contract(async_w3, address_conversion_func): |
| 610 | + async_tuple_contract_factory = async_w3.eth.contract(**TUPLE_CONTRACT_DATA) |
| 611 | + return await async_deploy( |
| 612 | + async_w3, async_tuple_contract_factory, address_conversion_func |
| 613 | + ) |
| 614 | + |
| 615 | + |
| 616 | +@pytest_asyncio.fixture |
| 617 | +async def async_nested_tuple_contract(async_w3, address_conversion_func): |
| 618 | + async_nested_tuple_contract_factory = async_w3.eth.contract( |
| 619 | + **NESTED_TUPLE_CONTRACT_DATA |
| 620 | + ) |
| 621 | + return await async_deploy( |
| 622 | + async_w3, async_nested_tuple_contract_factory, address_conversion_func |
| 623 | + ) |
| 624 | + |
| 625 | + |
| 626 | +@pytest_asyncio.fixture |
| 627 | +async def async_tuple_contract_with_decode_tuples(async_w3, address_conversion_func): |
| 628 | + async_tuple_contract_factory = async_w3.eth.contract( |
| 629 | + **TUPLE_CONTRACT_DATA_DECODE_TUPLES |
| 630 | + ) |
| 631 | + return await async_deploy( |
| 632 | + async_w3, async_tuple_contract_factory, address_conversion_func |
| 633 | + ) |
| 634 | + |
| 635 | + |
| 636 | +@pytest_asyncio.fixture |
| 637 | +async def async_nested_tuple_contract_with_decode_tuples( |
| 638 | + async_w3, address_conversion_func |
| 639 | +): |
| 640 | + async_nested_tuple_contract_factory = async_w3.eth.contract( |
| 641 | + **NESTED_TUPLE_CONTRACT_DATA_DECODE_TUPLES |
| 642 | + ) |
| 643 | + return await async_deploy( |
| 644 | + async_w3, async_nested_tuple_contract_factory, address_conversion_func |
| 645 | + ) |
| 646 | + |
| 647 | + |
566 | 648 | async def async_invoke_contract(
|
567 | 649 | api_call_desig="call",
|
568 | 650 | contract=None,
|
|
0 commit comments