Skip to content

Commit

Permalink
Merge pull request #1199 from njgheorghita/drop-web3-providers-tester
Browse files Browse the repository at this point in the history
Drop web3.providers.tester.py (V5 beta)
  • Loading branch information
njgheorghita committed Jan 11, 2019
2 parents 7a58eda + 5be53c3 commit a21145d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 263 deletions.
58 changes: 0 additions & 58 deletions README.md
Expand Up @@ -11,64 +11,6 @@ A Python implementation of [web3.js](https://github.com/ethereum/web3.js)

Read more in the [documentation on ReadTheDocs](http://web3py.readthedocs.io/). [View the change log on Github](docs/releases.rst).

## Quickstart

```python
import json
import web3

from web3 import Web3, HTTPProvider, TestRPCProvider
from solc import compile_source
from web3.contract import ConciseContract

# Solidity source code
contract_source_code = '''
pragma solidity ^0.4.0;
contract Greeter {
string public greeting;
function Greeter() {
greeting = 'Hello';
}
function setGreeting(string _greeting) public {
greeting = _greeting;
}
function greet() constant returns (string) {
return greeting;
}
}
'''

compiled_sol = compile_source(contract_source_code) # Compiled source code
contract_interface = compiled_sol['<stdin>:Greeter']

# web3.py instance
w3 = Web3(TestRPCProvider())

# Instantiate and deploy contract
contract = w3.eth.contract(abi=contract_interface['abi'], bytecode=contract_interface['bin'])

# Get transaction hash from deployed contract
tx_hash = contract.deploy(transaction={'from': w3.eth.accounts[0], 'gas': 410000})

# Get tx receipt to get contract address
tx_receipt = w3.eth.getTransactionReceipt(tx_hash)
contract_address = tx_receipt['contractAddress']

# Contract instance in concise mode
abi = contract_interface['abi']
contract_instance = w3.eth.contract(address=contract_address, abi=abi,ContractFactoryClass=ConciseContract)

# Getters + Setters for web3.eth.contract object
print('Contract value: {}'.format(contract_instance.greet()))
contract_instance.setGreeting('Nihao', transact={'from': w3.eth.accounts[0]})
print('Setting value to: Nihao')
print('Contract value: {}'.format(contract_instance.greet()))
```

## Developer Setup

```sh
Expand Down
36 changes: 1 addition & 35 deletions docs/providers.rst
Expand Up @@ -294,9 +294,7 @@ EthereumTesterProvider
~~~~~~~~~~~~~~~~~~~~~~

.. warning:: Experimental: This provider is experimental. There are still significant gaps in
functionality. However, it is the default replacement for
:class:`web3.providers.tester.EthereumTesterProvider`
and is being actively developed and supported.
functionality. However it is being actively developed and supported.

.. py:class:: EthereumTesterProvider(eth_tester=None)
Expand All @@ -312,38 +310,6 @@ EthereumTesterProvider
>>> w3 = Web3(EthereumTesterProvider())
EthereumTesterProvider (legacy)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. warning:: Deprecated: This provider is deprecated in favor of
:class:`~web3.providers.eth_tester.EthereumTesterProvider` and the newly created eth-tester.

.. py:class:: web3.providers.tester.EthereumTesterProvider()
This provider can be used for testing. It uses an ephemeral blockchain
backed by the ``ethereum.tester`` module.

.. code-block:: python
>>> from web3 import Web3
>>> from web3.providers.tester import EthereumTesterProvider
>>> w3 = Web3(EthereumTesterProvider())
TestRPCProvider
~~~~~~~~~~~~~~~

.. warning:: Deprecated: This provider is deprecated in favor of
:class:`~web3.providers.eth_tester.EthereumTesterProvider` and the newly created eth-tester.

.. py:class:: TestRPCProvider()
This provider can be used for testing. It uses an ephemeral blockchain
backed by the ``ethereum.tester`` module. This provider will be slower
than the ``EthereumTesterProvider`` since it uses an HTTP server for RPC
interactions with.


AutoProvider
~~~~~~~~~~~~

Expand Down
3 changes: 0 additions & 3 deletions web3/__init__.py
Expand Up @@ -21,9 +21,6 @@
from web3.providers.eth_tester import ( # noqa: E402
EthereumTesterProvider,
)
from web3.providers.tester import ( # noqa: E402
TestRPCProvider,
)
from web3.providers.ipc import ( # noqa: E402
IPCProvider,
)
Expand Down
4 changes: 0 additions & 4 deletions web3/main.py
Expand Up @@ -67,9 +67,6 @@
from web3.providers.rpc import (
HTTPProvider,
)
from web3.providers.tester import (
TestRPCProvider,
)
from web3.providers.websocket import (
WebsocketProvider,
)
Expand Down Expand Up @@ -102,7 +99,6 @@ class Web3:
# Providers
HTTPProvider = HTTPProvider
IPCProvider = IPCProvider
TestRPCProvider = TestRPCProvider
EthereumTesterProvider = EthereumTesterProvider
WebsocketProvider = WebsocketProvider

Expand Down
163 changes: 0 additions & 163 deletions web3/providers/tester.py

This file was deleted.

0 comments on commit a21145d

Please sign in to comment.