substrate-interface 1.8.1__tar.gz → 1.9.0__tar.gz
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.
- {substrate_interface-1.8.1/substrate_interface.egg-info → substrate_interface-1.9.0}/PKG-INFO +26 -13
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/README.md +15 -2
- substrate_interface-1.9.0/pyproject.toml +3 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/setup.py +27 -27
- {substrate_interface-1.8.1 → substrate_interface-1.9.0/substrate_interface.egg-info}/PKG-INFO +26 -13
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrate_interface.egg-info/SOURCES.txt +1 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrate_interface.egg-info/requires.txt +4 -4
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/base.py +1 -1
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_block.py +6 -10
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_contracts.py +16 -63
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_create_extrinsics.py +97 -97
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_extension_interface.py +9 -4
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_helper_functions.py +34 -35
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_init.py +20 -9
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_query.py +23 -14
- substrate_interface-1.9.0/test/test_query_map.py +250 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_runtime_call.py +27 -17
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_subscriptions.py +1 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_type_registry.py +52 -103
- substrate_interface-1.8.1/test/test_query_map.py +0 -242
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/LICENSE +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/setup.cfg +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrate_interface.egg-info/dependency_links.txt +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrate_interface.egg-info/top_level.txt +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/__init__.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/constants.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/contracts.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/ksmcc3.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/ksmcc3_asset_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/ksmcc3_bridge_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/ksmcc3_coretime.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/ksmcc3_encointer.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/ksmcc3_people.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/kusama.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/paseo.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/paseo_asset_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/paseo_coretime.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/paseo_people.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/polkadot.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/polkadot_asset_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/polkadot_bridge_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/polkadot_collectives.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/polkadot_coretime.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/polkadot_people.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/rococo_v2_2.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/rococo_v2_2_asset_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/rococo_v2_2_bridge_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/rococo_v2_2_people.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/westend2.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/westend2_asset_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/westend2_bridge_hub.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/westend2_collectives.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/westend2_coretime.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/data/chainspecs/westend2_people.json +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/exceptions.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/extensions.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/interfaces.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/key.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/keypair.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/storage.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/transport/__init__.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/transport/base.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/transport/http.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/transport/smoldot.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/transport/websocket.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/utils/__init__.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/utils/caching.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/utils/ecdsa_helpers.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/utils/encrypted_json.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/utils/hasher.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrateinterface/utils/ss58.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_keypair.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_light_client.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_rpc_compatibility.py +0 -0
- {substrate_interface-1.8.1 → substrate_interface-1.9.0}/test/test_ss58.py +0 -0
{substrate_interface-1.8.1/substrate_interface.egg-info → substrate_interface-1.9.0}/PKG-INFO
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: substrate-interface
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Library for interfacing with a Substrate node
|
|
5
|
-
Home-page: https://github.com/
|
|
5
|
+
Home-page: https://github.com/JAMdotTech/py-polkadot-sdk
|
|
6
6
|
Author: Stichting Polkascan (Polkascan Foundation)
|
|
7
7
|
Author-email: info@polkascan.org
|
|
8
8
|
Keywords: interface polkascan polkadot substrate blockchain rpc kusama
|
|
@@ -10,12 +10,12 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Requires-Python: >=3.11, <4
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: websocket-client<2,>=0.57.0
|
|
@@ -23,13 +23,13 @@ Requires-Dist: base58<3,>=1.0.3
|
|
|
23
23
|
Requires-Dist: certifi>=2019.3.9
|
|
24
24
|
Requires-Dist: idna<4,>=2.1.0
|
|
25
25
|
Requires-Dist: requests<3,>=2.21.0
|
|
26
|
-
Requires-Dist: xxhash<
|
|
26
|
+
Requires-Dist: xxhash<5,>=1.3.0
|
|
27
27
|
Requires-Dist: ecdsa<1,>=0.17.0
|
|
28
28
|
Requires-Dist: eth-keys<1,>=0.2.1
|
|
29
|
-
Requires-Dist: eth_utils<
|
|
30
|
-
Requires-Dist: pycryptodome<
|
|
29
|
+
Requires-Dist: eth_utils<7,>=1.3.0
|
|
30
|
+
Requires-Dist: pycryptodome<5,>=3.11.0
|
|
31
31
|
Requires-Dist: PyNaCl<2,>=1.0.1
|
|
32
|
-
Requires-Dist: scalecodec<1.
|
|
32
|
+
Requires-Dist: scalecodec<1.4,>=1.3.0
|
|
33
33
|
Requires-Dist: py-sr25519-bindings<1,>=0.2.0
|
|
34
34
|
Requires-Dist: py-ed25519-zebra-bindings<2,>=1.0
|
|
35
35
|
Requires-Dist: py-bip39-bindings<1,>=0.1.9
|
|
@@ -52,7 +52,7 @@ Dynamic: summary
|
|
|
52
52
|
|
|
53
53
|
# Python Substrate Interface
|
|
54
54
|
|
|
55
|
-
[](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml)
|
|
56
56
|
[](https://pypi.org/project/substrate-interface/)
|
|
57
57
|
[](https://pypi.org/project/substrate-interface/)
|
|
58
58
|
[](https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE)
|
|
@@ -69,8 +69,17 @@ the Substrate runtime.
|
|
|
69
69
|
* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://jamdottech.github.io/py-polkadot-metadata-docs/)
|
|
70
70
|
|
|
71
71
|
## Installation
|
|
72
|
+
|
|
73
|
+
Requires CPython 3.11 or newer. The test matrix covers 3.11 through 3.15.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m pip install substrate-interface
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Python 3.15 may need to build native dependencies from source. Install the Rust toolchain and enable PyO3's stable ABI when no compatible wheels are available.
|
|
80
|
+
|
|
72
81
|
```bash
|
|
73
|
-
pip install substrate-interface
|
|
82
|
+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python -m pip install substrate-interface
|
|
74
83
|
```
|
|
75
84
|
|
|
76
85
|
## Initialization
|
|
@@ -117,6 +126,10 @@ receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
|
|
|
117
126
|
print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
|
|
118
127
|
```
|
|
119
128
|
|
|
129
|
+
## Running tests
|
|
130
|
+
|
|
131
|
+
Install the test dependencies with `python -m pip install -e '.[test]'` and run `python -m pytest`. To include tests that need live RPC endpoints, run `RUN_LIVE_TESTS=1 python -m pytest`. The endpoint overrides are listed in `test/settings.py`.
|
|
132
|
+
|
|
120
133
|
## Contact and Support
|
|
121
134
|
|
|
122
135
|
For questions, please see the [Substrate StackExchange](https://substrate.stackexchange.com/questions/tagged/python) or [Github Discussions](https://github.com/JAMdotTech/py-polkadot-sdk/discussions).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Python Substrate Interface
|
|
2
2
|
|
|
3
|
-
[](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml)
|
|
4
4
|
[](https://pypi.org/project/substrate-interface/)
|
|
5
5
|
[](https://pypi.org/project/substrate-interface/)
|
|
6
6
|
[](https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE)
|
|
@@ -17,8 +17,17 @@ the Substrate runtime.
|
|
|
17
17
|
* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://jamdottech.github.io/py-polkadot-metadata-docs/)
|
|
18
18
|
|
|
19
19
|
## Installation
|
|
20
|
+
|
|
21
|
+
Requires CPython 3.11 or newer. The test matrix covers 3.11 through 3.15.
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
python -m pip install substrate-interface
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Python 3.15 may need to build native dependencies from source. Install the Rust toolchain and enable PyO3's stable ABI when no compatible wheels are available.
|
|
28
|
+
|
|
20
29
|
```bash
|
|
21
|
-
pip install substrate-interface
|
|
30
|
+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python -m pip install substrate-interface
|
|
22
31
|
```
|
|
23
32
|
|
|
24
33
|
## Initialization
|
|
@@ -65,6 +74,10 @@ receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
|
|
|
65
74
|
print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
|
|
66
75
|
```
|
|
67
76
|
|
|
77
|
+
## Running tests
|
|
78
|
+
|
|
79
|
+
Install the test dependencies with `python -m pip install -e '.[test]'` and run `python -m pytest`. To include tests that need live RPC endpoints, run `RUN_LIVE_TESTS=1 python -m pytest`. The endpoint overrides are listed in `test/settings.py`.
|
|
80
|
+
|
|
68
81
|
## Contact and Support
|
|
69
82
|
|
|
70
83
|
For questions, please see the [Substrate StackExchange](https://substrate.stackexchange.com/questions/tagged/python) or [Github Discussions](https://github.com/JAMdotTech/py-polkadot-sdk/discussions).
|
|
@@ -21,29 +21,29 @@ https://packaging.python.org/guides/distributing-packages-using-setuptools/
|
|
|
21
21
|
https://github.com/pypa/sampleproject
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
from
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
from io import open
|
|
24
|
+
from email.parser import Parser
|
|
25
|
+
from os import environ, path
|
|
26
|
+
|
|
27
|
+
from setuptools import find_packages, setup
|
|
28
|
+
|
|
29
|
+
here = path.abspath(path.dirname(__file__))
|
|
30
|
+
sdist_metadata = path.join(here, 'PKG-INFO')
|
|
32
31
|
|
|
33
32
|
if environ.get('TRAVIS_TAG'):
|
|
34
33
|
version = environ['TRAVIS_TAG'].replace('v', '')
|
|
35
34
|
elif environ.get('CI_COMMIT_TAG'):
|
|
36
35
|
version = environ['CI_COMMIT_TAG'].replace('v', '')
|
|
37
|
-
elif environ.get('GITHUB_REF'):
|
|
38
|
-
|
|
39
|
-
if not
|
|
40
|
-
raise ValueError('Incorrect tag format {}'.format(
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
elif environ.get('GITHUB_REF', '').startswith('refs/tags/'):
|
|
37
|
+
tag_ref = environ['GITHUB_REF']
|
|
38
|
+
if not tag_ref.startswith('refs/tags/v'):
|
|
39
|
+
raise ValueError('Incorrect tag format {}'.format(tag_ref))
|
|
40
|
+
version = tag_ref[len('refs/tags/v'):]
|
|
41
|
+
elif path.isfile(sdist_metadata):
|
|
42
|
+
# Preserve the release version when rebuilding from a source distribution.
|
|
43
|
+
with open(sdist_metadata, encoding='utf-8') as f:
|
|
44
|
+
version = Parser().parse(f, headersonly=True)['Version']
|
|
43
45
|
else:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
here = path.abspath(path.dirname(__file__))
|
|
46
|
+
version = '0.0.0.dev0'
|
|
47
47
|
|
|
48
48
|
# Get the long description from the README file
|
|
49
49
|
with open(path.join(here, 'README.md'), encoding='utf-8') as f:
|
|
@@ -105,7 +105,7 @@ setup(
|
|
|
105
105
|
#
|
|
106
106
|
# This field corresponds to the "Home-Page" metadata field:
|
|
107
107
|
# https://packaging.python.org/specifications/core-metadata/#home-page-optional
|
|
108
|
-
url='https://github.com/
|
|
108
|
+
url='https://github.com/JAMdotTech/py-polkadot-sdk', # Optional
|
|
109
109
|
|
|
110
110
|
# This should be your name or the name of the organization which owns the
|
|
111
111
|
# project.
|
|
@@ -136,11 +136,11 @@ setup(
|
|
|
136
136
|
# These classifiers are *not* checked by 'pip install'. See instead
|
|
137
137
|
# 'python_requires' below.
|
|
138
138
|
'Programming Language :: Python :: 3',
|
|
139
|
-
'Programming Language :: Python :: 3.7',
|
|
140
|
-
'Programming Language :: Python :: 3.8',
|
|
141
|
-
'Programming Language :: Python :: 3.9',
|
|
142
|
-
'Programming Language :: Python :: 3.10',
|
|
143
139
|
'Programming Language :: Python :: 3.11',
|
|
140
|
+
'Programming Language :: Python :: 3.12',
|
|
141
|
+
'Programming Language :: Python :: 3.13',
|
|
142
|
+
'Programming Language :: Python :: 3.14',
|
|
143
|
+
'Programming Language :: Python :: 3.15',
|
|
144
144
|
],
|
|
145
145
|
|
|
146
146
|
# This field adds keywords for your project which will appear on the
|
|
@@ -168,7 +168,7 @@ setup(
|
|
|
168
168
|
# https://packaging.python.org/guides/distributing-packages-using-setuptools/#python-requires
|
|
169
169
|
|
|
170
170
|
#python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4',
|
|
171
|
-
python_requires='>=3.
|
|
171
|
+
python_requires='>=3.11, <4',
|
|
172
172
|
|
|
173
173
|
# This field lists other packages that your project depends on to run.
|
|
174
174
|
# Any package you put here will be installed by pip when your project is
|
|
@@ -182,13 +182,13 @@ setup(
|
|
|
182
182
|
'certifi>=2019.3.9',
|
|
183
183
|
'idna>=2.1.0,<4',
|
|
184
184
|
'requests>=2.21.0,<3',
|
|
185
|
-
'xxhash>=1.3.0,<
|
|
185
|
+
'xxhash>=1.3.0,<5',
|
|
186
186
|
'ecdsa>=0.17.0,<1',
|
|
187
187
|
'eth-keys>=0.2.1,<1',
|
|
188
|
-
'eth_utils>=1.3.0,<
|
|
189
|
-
'pycryptodome>=3.11.0,<
|
|
188
|
+
'eth_utils>=1.3.0,<7',
|
|
189
|
+
'pycryptodome>=3.11.0,<5',
|
|
190
190
|
'PyNaCl>=1.0.1,<2',
|
|
191
|
-
'scalecodec>=1.
|
|
191
|
+
'scalecodec>=1.3.0,<1.4',
|
|
192
192
|
'py-sr25519-bindings>=0.2.0,<1',
|
|
193
193
|
'py-ed25519-zebra-bindings>=1.0,<2',
|
|
194
194
|
'py-bip39-bindings>=0.1.9,<1',
|
{substrate_interface-1.8.1 → substrate_interface-1.9.0/substrate_interface.egg-info}/PKG-INFO
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: substrate-interface
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.9.0
|
|
4
4
|
Summary: Library for interfacing with a Substrate node
|
|
5
|
-
Home-page: https://github.com/
|
|
5
|
+
Home-page: https://github.com/JAMdotTech/py-polkadot-sdk
|
|
6
6
|
Author: Stichting Polkascan (Polkascan Foundation)
|
|
7
7
|
Author-email: info@polkascan.org
|
|
8
8
|
Keywords: interface polkascan polkadot substrate blockchain rpc kusama
|
|
@@ -10,12 +10,12 @@ Classifier: Development Status :: 5 - Production/Stable
|
|
|
10
10
|
Classifier: Intended Audience :: Developers
|
|
11
11
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
12
|
Classifier: Programming Language :: Python :: 3
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.7
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
17
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
-
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
18
|
+
Requires-Python: >=3.11, <4
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: websocket-client<2,>=0.57.0
|
|
@@ -23,13 +23,13 @@ Requires-Dist: base58<3,>=1.0.3
|
|
|
23
23
|
Requires-Dist: certifi>=2019.3.9
|
|
24
24
|
Requires-Dist: idna<4,>=2.1.0
|
|
25
25
|
Requires-Dist: requests<3,>=2.21.0
|
|
26
|
-
Requires-Dist: xxhash<
|
|
26
|
+
Requires-Dist: xxhash<5,>=1.3.0
|
|
27
27
|
Requires-Dist: ecdsa<1,>=0.17.0
|
|
28
28
|
Requires-Dist: eth-keys<1,>=0.2.1
|
|
29
|
-
Requires-Dist: eth_utils<
|
|
30
|
-
Requires-Dist: pycryptodome<
|
|
29
|
+
Requires-Dist: eth_utils<7,>=1.3.0
|
|
30
|
+
Requires-Dist: pycryptodome<5,>=3.11.0
|
|
31
31
|
Requires-Dist: PyNaCl<2,>=1.0.1
|
|
32
|
-
Requires-Dist: scalecodec<1.
|
|
32
|
+
Requires-Dist: scalecodec<1.4,>=1.3.0
|
|
33
33
|
Requires-Dist: py-sr25519-bindings<1,>=0.2.0
|
|
34
34
|
Requires-Dist: py-ed25519-zebra-bindings<2,>=1.0
|
|
35
35
|
Requires-Dist: py-bip39-bindings<1,>=0.1.9
|
|
@@ -52,7 +52,7 @@ Dynamic: summary
|
|
|
52
52
|
|
|
53
53
|
# Python Substrate Interface
|
|
54
54
|
|
|
55
|
-
[](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml)
|
|
56
56
|
[](https://pypi.org/project/substrate-interface/)
|
|
57
57
|
[](https://pypi.org/project/substrate-interface/)
|
|
58
58
|
[](https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE)
|
|
@@ -69,8 +69,17 @@ the Substrate runtime.
|
|
|
69
69
|
* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://jamdottech.github.io/py-polkadot-metadata-docs/)
|
|
70
70
|
|
|
71
71
|
## Installation
|
|
72
|
+
|
|
73
|
+
Requires CPython 3.11 or newer. The test matrix covers 3.11 through 3.15.
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m pip install substrate-interface
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Python 3.15 may need to build native dependencies from source. Install the Rust toolchain and enable PyO3's stable ABI when no compatible wheels are available.
|
|
80
|
+
|
|
72
81
|
```bash
|
|
73
|
-
pip install substrate-interface
|
|
82
|
+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python -m pip install substrate-interface
|
|
74
83
|
```
|
|
75
84
|
|
|
76
85
|
## Initialization
|
|
@@ -117,6 +126,10 @@ receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
|
|
|
117
126
|
print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
|
|
118
127
|
```
|
|
119
128
|
|
|
129
|
+
## Running tests
|
|
130
|
+
|
|
131
|
+
Install the test dependencies with `python -m pip install -e '.[test]'` and run `python -m pytest`. To include tests that need live RPC endpoints, run `RUN_LIVE_TESTS=1 python -m pytest`. The endpoint overrides are listed in `test/settings.py`.
|
|
132
|
+
|
|
120
133
|
## Contact and Support
|
|
121
134
|
|
|
122
135
|
For questions, please see the [Substrate StackExchange](https://substrate.stackexchange.com/questions/tagged/python) or [Github Discussions](https://github.com/JAMdotTech/py-polkadot-sdk/discussions).
|
{substrate_interface-1.8.1 → substrate_interface-1.9.0}/substrate_interface.egg-info/requires.txt
RENAMED
|
@@ -3,13 +3,13 @@ base58<3,>=1.0.3
|
|
|
3
3
|
certifi>=2019.3.9
|
|
4
4
|
idna<4,>=2.1.0
|
|
5
5
|
requests<3,>=2.21.0
|
|
6
|
-
xxhash<
|
|
6
|
+
xxhash<5,>=1.3.0
|
|
7
7
|
ecdsa<1,>=0.17.0
|
|
8
8
|
eth-keys<1,>=0.2.1
|
|
9
|
-
eth_utils<
|
|
10
|
-
pycryptodome<
|
|
9
|
+
eth_utils<7,>=1.3.0
|
|
10
|
+
pycryptodome<5,>=3.11.0
|
|
11
11
|
PyNaCl<2,>=1.0.1
|
|
12
|
-
scalecodec<1.
|
|
12
|
+
scalecodec<1.4,>=1.3.0
|
|
13
13
|
py-sr25519-bindings<1,>=0.2.0
|
|
14
14
|
py-ed25519-zebra-bindings<2,>=1.0
|
|
15
15
|
py-bip39-bindings<1,>=0.1.9
|
|
@@ -274,7 +274,7 @@ class SubstrateInterface:
|
|
|
274
274
|
}
|
|
275
275
|
|
|
276
276
|
self.debug_message('RPC request #{}: "{}"'.format(request_id, method))
|
|
277
|
-
|
|
277
|
+
self.debug_message(payload)
|
|
278
278
|
return self.transport.rpc_request(payload, result_handler=result_handler)
|
|
279
279
|
|
|
280
280
|
@property
|
|
@@ -168,14 +168,6 @@ class BlockTestCase(unittest.TestCase):
|
|
|
168
168
|
cls.substrate.rpc_request = MagicMock(side_effect=mocked_request)
|
|
169
169
|
cls.substrate.query = MagicMock(side_effect=mocked_query)
|
|
170
170
|
|
|
171
|
-
cls.babe_substrate = SubstrateInterface(
|
|
172
|
-
url=settings.BABE_NODE_URL
|
|
173
|
-
)
|
|
174
|
-
|
|
175
|
-
cls.aura_substrate = SubstrateInterface(
|
|
176
|
-
url=settings.AURA_NODE_URL
|
|
177
|
-
)
|
|
178
|
-
|
|
179
171
|
def test_get_valid_extrinsics(self):
|
|
180
172
|
|
|
181
173
|
block = self.substrate.get_block(
|
|
@@ -288,14 +280,18 @@ class BlockTestCase(unittest.TestCase):
|
|
|
288
280
|
finalized_only=True
|
|
289
281
|
)
|
|
290
282
|
|
|
283
|
+
@settings.requires_live_node
|
|
291
284
|
def test_block_author_babe(self):
|
|
292
|
-
|
|
285
|
+
with SubstrateInterface(url=settings.BABE_NODE_URL) as substrate:
|
|
286
|
+
block = substrate.get_block(include_author=True)
|
|
293
287
|
|
|
294
288
|
self.assertIn('author', block)
|
|
295
289
|
self.assertIsNotNone(block['author'])
|
|
296
290
|
|
|
291
|
+
@settings.requires_live_node
|
|
297
292
|
def test_block_author_aura(self):
|
|
298
|
-
|
|
293
|
+
with SubstrateInterface(url=settings.AURA_NODE_URL) as substrate:
|
|
294
|
+
block = substrate.get_block(include_author=True)
|
|
299
295
|
|
|
300
296
|
self.assertIn('author', block)
|
|
301
297
|
self.assertIsNotNone(block['author'])
|
|
@@ -18,16 +18,17 @@ import os
|
|
|
18
18
|
import unittest
|
|
19
19
|
|
|
20
20
|
from scalecodec import ScaleBytes
|
|
21
|
-
from
|
|
21
|
+
from scalecodec.type_registry import load_type_registry_preset
|
|
22
|
+
from substrateinterface import ContractMetadata, ContractInstance, Keypair, ContractEvent
|
|
22
23
|
from substrateinterface.exceptions import ContractMetadataParseException
|
|
23
|
-
from test import
|
|
24
|
+
from test.fixtures import RuntimeFixture
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
class ContractMetadataTestCase(unittest.TestCase):
|
|
27
28
|
|
|
28
29
|
@classmethod
|
|
29
30
|
def setUpClass(cls):
|
|
30
|
-
cls.substrate =
|
|
31
|
+
cls.substrate = RuntimeFixture(metadata_version='kusama_test', ss58_format=2)
|
|
31
32
|
|
|
32
33
|
def setUp(self) -> None:
|
|
33
34
|
self.contract_metadata = ContractMetadata.create_from_file(
|
|
@@ -288,7 +289,7 @@ class FlipperMetadataV3TestCase(unittest.TestCase):
|
|
|
288
289
|
|
|
289
290
|
@classmethod
|
|
290
291
|
def setUpClass(cls):
|
|
291
|
-
cls.substrate =
|
|
292
|
+
cls.substrate = RuntimeFixture()
|
|
292
293
|
|
|
293
294
|
def setUp(self) -> None:
|
|
294
295
|
self.contract_metadata = ContractMetadata.create_from_file(
|
|
@@ -348,36 +349,18 @@ class FlipperMetadataV3TestCase(unittest.TestCase):
|
|
|
348
349
|
|
|
349
350
|
|
|
350
351
|
class FlipperInstanceTestCase(unittest.TestCase):
|
|
352
|
+
call_result = '0x7ee58accd6100100070000c0ce020200100001000000000000000000000000000000000000000000000400'
|
|
353
|
+
pallet_version = '0x0900'
|
|
351
354
|
|
|
352
355
|
@classmethod
|
|
353
356
|
def setUpClass(cls):
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
'result': '0x7ee58accd6100100070000c0ce020200100001000000000000000000000000000000000000000000000400',
|
|
362
|
-
'id': 10
|
|
363
|
-
}
|
|
364
|
-
if method == 'contracts_call':
|
|
365
|
-
return {
|
|
366
|
-
'jsonrpc': '2.0',
|
|
367
|
-
'result': {
|
|
368
|
-
'gasConsumed': 7419127834,
|
|
369
|
-
'gasRequired': 74999922688,
|
|
370
|
-
'storageDeposit': {'charge': '0x0'},
|
|
371
|
-
'debugMessage': '',
|
|
372
|
-
'result': {'Ok': {'flags': 0, 'data': '0x00'}}
|
|
373
|
-
},
|
|
374
|
-
'id': self.request_id}
|
|
375
|
-
|
|
376
|
-
return super().rpc_request(method, params, result_handler)
|
|
377
|
-
|
|
378
|
-
cls.substrate = MockedSubstrateInterface(url=settings.KUSAMA_NODE_URL, type_registry_preset='canvas')
|
|
379
|
-
# cls.substrate = SubstrateInterface(url='ws://127.0.0.1:9944')
|
|
380
|
-
|
|
357
|
+
# The recorded ContractsApi results use Weight V2, introduced after the metadata fixture.
|
|
358
|
+
weight_type = load_type_registry_preset('legacy')['types']['WeightV2']
|
|
359
|
+
cls.substrate = RuntimeFixture(
|
|
360
|
+
type_registry_preset='canvas',
|
|
361
|
+
type_registry={'types': {'sp_weights::weight_v2::Weight': weight_type}},
|
|
362
|
+
rpc_results={'state_call': cls.call_result, 'state_getStorage': cls.pallet_version},
|
|
363
|
+
)
|
|
381
364
|
cls.keypair = Keypair.create_from_uri('//Alice')
|
|
382
365
|
|
|
383
366
|
def setUp(self) -> None:
|
|
@@ -410,38 +393,8 @@ class FlipperInstanceV4TestCase(FlipperInstanceTestCase):
|
|
|
410
393
|
|
|
411
394
|
|
|
412
395
|
class FlipperInstanceV5TestCase(FlipperInstanceTestCase):
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
def setUpClass(cls):
|
|
416
|
-
|
|
417
|
-
class MockedSubstrateInterface(SubstrateInterface):
|
|
418
|
-
|
|
419
|
-
def rpc_request(self, method, params, result_handler=None):
|
|
420
|
-
if method == 'state_call':
|
|
421
|
-
return {
|
|
422
|
-
'jsonrpc': '2.0',
|
|
423
|
-
'result': '0x1a987a663dbd8e5cf16786bc0100010000000000000000000000000000000000000000000008000000',
|
|
424
|
-
'id': 16
|
|
425
|
-
}
|
|
426
|
-
if method == 'contracts_call':
|
|
427
|
-
return {
|
|
428
|
-
'jsonrpc': '2.0',
|
|
429
|
-
'result': {
|
|
430
|
-
'gasConsumed': 7419127834,
|
|
431
|
-
'gasRequired': 74999922688,
|
|
432
|
-
'storageDeposit': {'charge': '0x0'},
|
|
433
|
-
'debugMessage': '',
|
|
434
|
-
'result': {'Ok': {'flags': 0, 'data': '0x0000'}}
|
|
435
|
-
},
|
|
436
|
-
'id': self.request_id}
|
|
437
|
-
|
|
438
|
-
return super().rpc_request(method, params, result_handler)
|
|
439
|
-
|
|
440
|
-
cls.substrate = MockedSubstrateInterface(
|
|
441
|
-
url=settings.KUSAMA_NODE_URL, type_registry_preset='canvas', type_registry={'types': {"ContractExecResult": "ContractExecResultTo269"}}
|
|
442
|
-
)
|
|
443
|
-
|
|
444
|
-
cls.keypair = Keypair.create_from_uri('//Alice')
|
|
396
|
+
call_result = '0x1a987a663dbd8e5cf16786bc0100010000000000000000000000000000000000000000000008000000'
|
|
397
|
+
pallet_version = '0x0a00'
|
|
445
398
|
|
|
446
399
|
def setUp(self) -> None:
|
|
447
400
|
self.contract = ContractInstance.create_from_address(
|