def contract(self, address) -> ContractInterface: """ Get a high-level interface for a given smart contract id. :param address: KT address of a smart contract :rtype: ContractInterface """ return ContractInterface.from_context(self._spawn_context(address=address))
def test_view_return_type_regression_251(self) -> None: # Need to mock the shell for unit testing. Configuring it to always return a simple # value for the contract's current storage state mock_shell = MagicMock() mock_shell.blocks.__getitem__.return_value.context.contracts.__getitem__.return_value.storage.return_value = ( UnitType().to_micheline_value()) contract = ContractInterface.from_michelson( TEST_VIEW_CONTRACT_MICHELSON) contract.context.shell = mock_shell meta = ContractMetadata.from_json(json.loads(TEST_VIEW_JSON), contract.context) expected_view_result = { "my_first_number": 1, "my_first_nat": 42, "my_second_number": 2, "a_plain_tuple": (3, 42) } actual_view_result = meta.viewRecordLike().storage_view() assert expected_view_result == actual_view_result, f"Expected: {expected_view_result} but got: {actual_view_result}"
def test_attic(self, path): ci = ContractInterface.from_file(path) ci.script()
def test_entrypoints(self, path): ci = ContractInterface.from_file(path) ci.script()
def test_mini_scenarios(self, path): ci = ContractInterface.from_file(path) ci.script()