Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update examples and web3.eth with checksummed addresses #1390

Merged
merged 1 commit into from Jul 31, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/contracts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -780,7 +780,7 @@ Event Log Object

.. code-block:: python

>>> transfer_filter = my_token_contract.eventFilter('Transfer', {'filter': {'_from': '0xdc3a9db694bcdd55ebae4a89b22ac6d12b3f0c24'}})
>>> transfer_filter = my_token_contract.eventFilter('Transfer', {'filter': {'_from': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24'}})
>>> transfer_filter.get_new_entries()
[...] # array of Event Log Objects that match the filter.
# wait a while...
Expand All @@ -805,7 +805,7 @@ Utils
'0x612e45a3000000000000000000000000b656b2a9c3b2416437a811e07466ca712f5a5b5a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000093a80000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000116c6f6e656c792c20736f206c6f6e656c7900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
>>> contract.decode_function_input(transaction.input)
(<Function newProposal(address,uint256,string,bytes,uint256,bool)>,
{'_recipient': '0xb656b2a9c3b2416437a811e07466ca712f5a5b5a',
{'_recipient': '0xB656b2a9c3b2416437A811e07466cA712F5a5b5a',
'_amount': 0,
'_description': b'lonely, so lonely',
'_transactionData': b'',
Expand Down
6 changes: 3 additions & 3 deletions docs/examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ representation. Block numbers
# get a block by number
>>> web3.eth.getBlock(12345)
{
'author': '0xad5c1768e5974c231b2148169da064e61910f31a',
'author': '0xad5C1768e5974C231b2148169da064e61910f31a',
'difficulty': 735512610763,
'extraData': '0x476574682f76312e302e302f6c696e75782f676f312e342e32',
'gasLimit': 5000,
Expand Down Expand Up @@ -146,7 +146,7 @@ You can look up transactions using the ``web3.eth.getTransaction`` function.
'blockNumber': 46147,
'condition': None,
'creates': None,
'from': '0xa1e4380a3b1f749673e270229993ee55f35663b4',
'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
'gas': 21000,
'gasPrice': 50000000000000,
'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
Expand All @@ -158,7 +158,7 @@ You can look up transactions using the ``web3.eth.getTransaction`` function.
'raw': '0xf86780862d79883d2000825208945df9b87991262f6ba471f09758cde1c0fc1de734827a69801ca088ff6cf0fefd94db46111149ae4bfc179e9b94721fffd821d38d16464b3f71d0a045e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33a',
's': '0x45e0aff800961cfce805daef7016b9b675c137a6a41a548f7b60a3484c06a33a',
'standardV': '0x1',
'to': '0x5df9b87991262f6ba471f09758cde1c0fc1de734',
'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
'transactionIndex': 0,
'v': '0x1c',
'value': 31337,
Expand Down
6 changes: 3 additions & 3 deletions docs/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ local development this would be something like ``ws://127.0.0.1:8546``.
Base API
--------

The ``Web3`` class exposes the following convenience APIs.
The ``Web3`` class exposes the following convenient APIs.


.. _overview_type_conversions:
Expand Down Expand Up @@ -288,7 +288,7 @@ Cryptographic Hashing
>>> Web3.solidityKeccak(['uint8[]'], [[97, 98, 99]])
HexBytes("0x233002c671295529bcc50b76a2ef2b0de2dac2d93945fca745255de1a9e4017e")

>>> Web3.solidityKeccak(['address'], ["0x49eddd3769c0712032808d86597b84ac5c2f5614"])
>>> Web3.solidityKeccak(['address'], ["0x49EdDD3769c0712032808D86597B84ac5c2F5614"])
HexBytes("0x2ff37b5607484cd4eecf6d13292e22bd6e5401eaffcc07e279583bc742c68882")

>>> Web3.solidityKeccak(['address'], ["ethereumfoundation.eth"])
Expand Down Expand Up @@ -335,7 +335,7 @@ Cryptographic Hashing
>>> Web3.soliditySha3(['uint8[]'], [[97, 98, 99]])
HexBytes("0x233002c671295529bcc50b76a2ef2b0de2dac2d93945fca745255de1a9e4017e")

>>> Web3.soliditySha3(['address'], ["0x49eddd3769c0712032808d86597b84ac5c2f5614"])
>>> Web3.soliditySha3(['address'], ["0x49EdDD3769c0712032808D86597B84ac5c2F5614"])
HexBytes("0x2ff37b5607484cd4eecf6d13292e22bd6e5401eaffcc07e279583bc742c68882")

>>> Web3.soliditySha3(['address'], ["ethereumfoundation.eth"])
Expand Down
68 changes: 34 additions & 34 deletions docs/web3.eth.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ The following properties are available on the ``web3.eth`` namespace.
.. code-block:: python

>>> web3.eth.coinbase
'0xd3cda913deb6f67967b99d67acdfa1712c293601'
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601'


.. py:attribute:: Eth.mining
Expand Down Expand Up @@ -126,7 +126,7 @@ The following properties are available on the ``web3.eth`` namespace.
.. code-block:: python

>>> web3.eth.accounts
['0xd3cda913deb6f67967b99d67acdfa1712c293601']
['0xd3CdA913deB6f67967B99D67aCDFa1712C293601']


.. py:attribute:: Eth.blockNumber
Expand Down Expand Up @@ -182,7 +182,7 @@ The following methods are available on the ``web3.eth`` namespace.

.. code-block:: python

>>> web3.eth.getBalance('0xd3cda913deb6f67967b99d67acdfa1712c293601')
>>> web3.eth.getBalance('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
77320681768999138915


Expand All @@ -197,7 +197,7 @@ The following methods are available on the ``web3.eth`` namespace.

.. code-block:: python

>>> web3.eth.getStorageAt('0x6c8f2a135f6ed072de4503bd7c4999a1a17f824b', 0)
>>> web3.eth.getStorageAt('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', 0)
'0x00000000000000000000000000000000000000000000000000120a0b063499d4'


Expand All @@ -212,7 +212,7 @@ The following methods are available on the ``web3.eth`` namespace.

.. code-block:: python

>>> web3.eth.getProof('0x6c8f2a135f6ed072de4503bd7c4999a1a17f824b', [0], 3391)
>>> web3.eth.getProof('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', [0], 3391)
AttributeDict({
'address': '0x4CB06C43fcdABeA22541fcF1F856A6a296448B6c',
'accountProof': ['0xf90211a03841a7ddd65c70c94b8efa79190d00f0ab134b26f18dcad508f60a7e74559d0ba0464b07429a05039e22931492d6c6251a860c018ea390045d596b1ac11b5c7aa7a011f4b89823a03c9c4b5a8ab079ee1bc0e2a83a508bb7a5dc7d7fb4f2e95d3186a0b5f7c51c3b2d51d97f171d2b38a4df1a7c0acc5eb0de46beeff4d07f5ed20e19a0b591a2ce02367eda31cf2d16eca7c27fd44dbf0864b64ea8259ad36696eb2a04a02b646a7552b8392ae94263757f699a27d6e9176b4c06b9fc0a722f893b964795a02df05d68bceb88eebf68aafde61d10ab942097afc1c58b8435ffd3895358a742a0c2f16143c4d1db03276c433696dddb3e9f3b113bcd854b127962262e98f43147a0828820316cc02bfefd899aba41340659fd06df1e0a0796287ec2a4110239f6d2a050496598670b04df7bbff3718887fa36437d6d8c7afb4eff86f76c5c7097dcc4a0c14e9060c6b3784e35b9e6ae2ad2984142a75910ccc89eb89dc1e2f44b6c58c2a009804db571d0ce07913e1cbacc4f1dc4fb8265c936f5c612e3a47e91c64d8e9fa063d96f38b3cb51b1665c6641e25ffe24803f2941e5df79942f6a53b7169647e4a0899f71abb18c6c956118bf567fac629b75f7e9526873e429d3d8abb6dbb58021a00fd717235298742623c0b3cafb3e4bd86c0b5ab1f71097b4dd19f3d6925d758da0096437146c16097f2ccc1d3e910d65a4132803baee2249e72c8bf0bcaaeb37e580',
Expand Down Expand Up @@ -298,7 +298,7 @@ The following methods are available on the ``web3.eth`` namespace.
return True

block = w3.eth.getBlock(3391)
proof = w3.eth.getProof('0x6c8f2a135f6ed072de4503bd7c4999a1a17f824b', [0, 1], 3391)
proof = w3.eth.getProof('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B', [0, 1], 3391)
assert verify_eth_getProof(proof, block.stateRoot)


Expand All @@ -314,10 +314,10 @@ The following methods are available on the ``web3.eth`` namespace.
.. code-block:: python

# For a contract address.
>>> web3.eth.getCode('0x6c8f2a135f6ed072de4503bd7c4999a1a17f824b')
>>> web3.eth.getCode('0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B')
'0x6060604052361561027c5760e060020a60003504630199.....'
# For a private key address.
>>> web3.eth.getCode('0xd3cda913deb6f67967b99d67acdfa1712c293601')
>>> web3.eth.getCode('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
'0x'


Expand Down Expand Up @@ -443,13 +443,13 @@ The following methods are available on the ``web3.eth`` namespace.
AttributeDict({
'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
'blockNumber': 46147,
'from': '0xa1e4380a3b1f749673e270229993ee55f35663b4',
'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
'gas': 21000,
'gasPrice': 50000000000000,
'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
'input': '0x',
'nonce': 0,
'to': '0x5df9b87991262f6ba471f09758cde1c0fc1de734',
'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
'transactionIndex': 0,
'value': 31337,
})
Expand Down Expand Up @@ -478,27 +478,27 @@ The following methods are available on the ``web3.eth`` namespace.
AttributeDict({
'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
'blockNumber': 46147,
'from': '0xa1e4380a3b1f749673e270229993ee55f35663b4',
'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
'gas': 21000,
'gasPrice': 50000000000000,
'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
'input': '0x',
'nonce': 0,
'to': '0x5df9b87991262f6ba471f09758cde1c0fc1de734',
'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
'transactionIndex': 0,
'value': 31337,
})
>>> web3.eth.getTransactionFromBlock('0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd', 0)
AttributeDict({
'blockHash': '0x4e3a3754410177e6937ef1f84bba68ea139e8d1a2258c5f85db9f1cd715a1bdd',
'blockNumber': 46147,
'from': '0xa1e4380a3b1f749673e270229993ee55f35663b4',
'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
'gas': 21000,
'gasPrice': 50000000000000,
'hash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
'input': '0x',
'nonce': 0,
'to': '0x5df9b87991262f6ba471f09758cde1c0fc1de734',
'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
'transactionIndex': 0,
'value': 31337,
})
Expand All @@ -524,11 +524,11 @@ The following methods are available on the ``web3.eth`` namespace.
'blockNumber': 46147,
'contractAddress': None,
'cumulativeGasUsed': 21000,
'from': '0xa1e4380a3b1f749673e270229993ee55f35663b4',
'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
'gasUsed': 21000,
'logs': [],
'root': '96a8e009d2b88b1483e6941e6812e32263b05683fac202abc622a3e31aed1957',
'to': '0x5df9b87991262f6ba471f09758cde1c0fc1de734',
'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
'transactionHash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
'transactionIndex': 0,
})
Expand All @@ -551,11 +551,11 @@ The following methods are available on the ``web3.eth`` namespace.
'blockNumber': 46147,
'contractAddress': None,
'cumulativeGasUsed': 21000,
'from': '0xa1e4380a3b1f749673e270229993ee55f35663b4',
'from': '0xA1E4380A3B1f749673E270229993eE55F35663b4',
'gasUsed': 21000,
'logs': [],
'root': '96a8e009d2b88b1483e6941e6812e32263b05683fac202abc622a3e31aed1957',
'to': '0x5df9b87991262f6ba471f09758cde1c0fc1de734',
'to': '0x5DF9B87991262F6BA471F09758CDE1c0FC1De734',
'transactionHash': '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060',
'transactionIndex': 0,
})
Expand All @@ -572,7 +572,7 @@ The following methods are available on the ``web3.eth`` namespace.

.. code-block:: python

>>> web3.eth.getTransactionCount('0xd3cda913deb6f67967b99d67acdfa1712c293601')
>>> web3.eth.getTransactionCount('0xd3CdA913deB6f67967B99D67aCDFa1712C293601')
340


Expand Down Expand Up @@ -610,7 +610,7 @@ The following methods are available on the ``web3.eth`` namespace.

.. code-block:: python

>>> web3.eth.sendTransaction({'to': '0xd3cda913deb6f67967b99d67acdfa1712c293601', 'from': web3.eth.coinbase, 'value': 12345})
>>> web3.eth.sendTransaction({'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'from': web3.eth.coinbase, 'value': 12345})
'0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331'


Expand All @@ -627,7 +627,7 @@ The following methods are available on the ``web3.eth`` namespace.
nonce=w3.eth.getTransactionCount(w3.eth.coinbase),
gasPrice=w3.eth.gasPrice,
gas=100000,
to='0xd3cda913deb6f67967b99d67acdfa1712c293601',
to='0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
value=1,
data=b'',
)
Expand All @@ -647,7 +647,7 @@ The following methods are available on the ``web3.eth`` namespace.
nonce=w3.eth.getTransactionCount(w3.eth.coinbase),
gasPrice=w3.eth.gasPrice,
gas=100000,
to='0xd3cda913deb6f67967b99d67acdfa1712c293601',
to='0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
value=12345,
data=b'',
),
Expand Down Expand Up @@ -688,13 +688,13 @@ The following methods are available on the ``web3.eth`` namespace.
.. code-block:: python

>>> tx = web3.eth.sendTransaction({
'to': '0xd3cda913deb6f67967b99d67acdfa1712c293601',
'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
'from': web3.eth.coinbase,
'value': 1000
})
'0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331'
>>> web3.eth.replaceTransaction('0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331', {
'to': '0xd3cda913deb6f67967b99d67acdfa1712c293601',
'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
'from': web3.eth.coinbase,
'value': 2000
})
Expand All @@ -718,7 +718,7 @@ The following methods are available on the ``web3.eth`` namespace.
.. code-block:: python

>>> tx = web3.eth.sendTransaction({
'to': '0xd3cda913deb6f67967b99d67acdfa1712c293601',
'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
'from': web3.eth.coinbase,
'value': 1000
})
Expand All @@ -740,17 +740,17 @@ The following methods are available on the ``web3.eth`` namespace.
.. code-block:: python

>>> web3.eth.sign(
'0xd3cda913deb6f67967b99d67acdfa1712c293601',
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
text='some-text-tö-sign')
'0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401'

>>> web3.eth.sign(
'0xd3cda913deb6f67967b99d67acdfa1712c293601',
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
data=b'some-text-t\xc3\xb6-sign')
'0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401'

>>> web3.eth.sign(
'0xd3cda913deb6f67967b99d67acdfa1712c293601',
'0xd3CdA913deB6f67967B99D67aCDFa1712C293601',
hexstr='0x736f6d652d746578742d74c3b62d7369676e')
'0x1a8bbe6eab8c72a219385681efefe565afd3accee35f516f8edf5ae82208fbd45a58f9f9116d8d88ba40fcd29076d6eada7027a3b412a9db55a0164547810cc401'

Expand Down Expand Up @@ -804,7 +804,7 @@ The following methods are available on the ``web3.eth`` namespace.

.. code-block:: python

>>> web3.eth.estimateGas({'to': '0xd3cda913deb6f67967b99d67acdfa1712c293601', 'from': web3.eth.coinbase, 'value': 12345})
>>> web3.eth.estimateGas({'to': '0xd3CdA913deB6f67967B99D67aCDFa1712C293601', 'from': web3.eth.coinbase, 'value': 12345})
21000

.. note::
Expand Down Expand Up @@ -892,7 +892,7 @@ with the filtering API.
<BlockFilter at 0x10b72dc28>
>>> web3.eth.filter('pending')
<TransactionFilter at 0x10b780340>
>>> web3.eth.filter({'fromBlock': 1000000, 'toBlock': 1000100, 'address': '0x6c8f2a135f6ed072de4503bd7c4999a1a17f824b'})
>>> web3.eth.filter({'fromBlock': 1000000, 'toBlock': 1000100, 'address': '0x6C8f2A135f6ed072DE4503Bd7C4999a1a17F824B'})
<LogFilter at 0x10b7803d8>

.. py:method:: Eth.getFilterChanges(self, filter_id)
Expand All @@ -908,7 +908,7 @@ with the filtering API.
>>> web3.eth.getFilterChanges(filt.filter_id)
[
{
'address': '0xdc3a9db694bcdd55ebae4a89b22ac6d12b3f0c24',
'address': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24',
'blockHash': '0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0',
'blockNumber': 2217196,
'data': '0x0000000000000000000000000000000000000000000000000000000000000001',
Expand All @@ -935,7 +935,7 @@ with the filtering API.
>>> web3.eth.getFilterLogs(filt.filter_id)
[
{
'address': '0xdc3a9db694bcdd55ebae4a89b22ac6d12b3f0c24',
'address': '0xDc3A9Db694BCdd55EBaE4A89B22aC6D12b3F0c24',
'blockHash': '0xb72256286ca528e09022ffd408856a73ef90e7216ac560187c6e43b4c4efd2f0',
'blockNumber': 2217196,
'data': '0x0000000000000000000000000000000000000000000000000000000000000001',
Expand Down Expand Up @@ -1013,7 +1013,7 @@ Contracts

w3 = Web3(...)

contract = w3.eth.contract(address='0x000000000000000000000000000000000000dead', abi=...)
contract = w3.eth.contract(address='0x000000000000000000000000000000000000dEaD', abi=...)

# alternatively:
contract = w3.eth.contract(address='mycontract.eth', abi=...)
Expand All @@ -1037,7 +1037,7 @@ Contracts
Contract = w3.eth.contract(abi=...)

# later, initialize contracts with the same metadata at different addresses:
contract1 = Contract(address='0x000000000000000000000000000000000000dead')
contract1 = Contract(address='0x000000000000000000000000000000000000dEaD')
contract2 = Contract(address='mycontract.eth')

``contract_name`` will be used as the name of the contract class. If it is
Expand Down
Loading