substrate-interface 1.8.0a0__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.
Files changed (78) hide show
  1. substrate_interface-1.9.0/PKG-INFO +138 -0
  2. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/README.md +27 -8
  3. substrate_interface-1.9.0/pyproject.toml +3 -0
  4. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/setup.py +32 -28
  5. substrate_interface-1.9.0/substrate_interface.egg-info/PKG-INFO +138 -0
  6. substrate_interface-1.9.0/substrate_interface.egg-info/SOURCES.txt +72 -0
  7. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrate_interface.egg-info/requires.txt +5 -4
  8. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/base.py +108 -161
  9. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/contracts.py +52 -7
  10. substrate_interface-1.9.0/substrateinterface/data/chainspecs/ksmcc3.json +62 -0
  11. substrate_interface-1.9.0/substrateinterface/data/chainspecs/ksmcc3_asset_hub.json +44 -0
  12. substrate_interface-1.9.0/substrateinterface/data/chainspecs/ksmcc3_bridge_hub.json +46 -0
  13. substrate_interface-1.9.0/substrateinterface/data/chainspecs/ksmcc3_coretime.json +26 -0
  14. substrate_interface-1.9.0/substrateinterface/data/chainspecs/ksmcc3_encointer.json +43 -0
  15. substrate_interface-1.9.0/substrateinterface/data/chainspecs/ksmcc3_people.json +46 -0
  16. substrate_interface-1.9.0/substrateinterface/data/chainspecs/kusama.json +3494 -0
  17. substrate_interface-1.9.0/substrateinterface/data/chainspecs/paseo.json +42 -0
  18. substrate_interface-1.9.0/substrateinterface/data/chainspecs/paseo_asset_hub.json +24 -0
  19. substrate_interface-1.9.0/substrateinterface/data/chainspecs/paseo_coretime.json +22 -0
  20. substrate_interface-1.9.0/substrateinterface/data/chainspecs/paseo_people.json +32 -0
  21. substrate_interface-1.9.0/substrateinterface/data/chainspecs/polkadot.json +60 -0
  22. substrate_interface-1.9.0/substrateinterface/data/chainspecs/polkadot_asset_hub.json +42 -0
  23. substrate_interface-1.9.0/substrateinterface/data/chainspecs/polkadot_bridge_hub.json +44 -0
  24. substrate_interface-1.9.0/substrateinterface/data/chainspecs/polkadot_collectives.json +43 -0
  25. substrate_interface-1.9.0/substrateinterface/data/chainspecs/polkadot_coretime.json +29 -0
  26. substrate_interface-1.9.0/substrateinterface/data/chainspecs/polkadot_people.json +26 -0
  27. substrate_interface-1.9.0/substrateinterface/data/chainspecs/rococo_v2_2.json +30 -0
  28. substrate_interface-1.9.0/substrateinterface/data/chainspecs/rococo_v2_2_asset_hub.json +25 -0
  29. substrate_interface-1.9.0/substrateinterface/data/chainspecs/rococo_v2_2_bridge_hub.json +24 -0
  30. substrate_interface-1.9.0/substrateinterface/data/chainspecs/rococo_v2_2_people.json +26 -0
  31. substrate_interface-1.9.0/substrateinterface/data/chainspecs/westend2.json +54 -0
  32. substrate_interface-1.9.0/substrateinterface/data/chainspecs/westend2_asset_hub.json +42 -0
  33. substrate_interface-1.9.0/substrateinterface/data/chainspecs/westend2_bridge_hub.json +42 -0
  34. substrate_interface-1.9.0/substrateinterface/data/chainspecs/westend2_collectives.json +42 -0
  35. substrate_interface-1.9.0/substrateinterface/data/chainspecs/westend2_coretime.json +47 -0
  36. substrate_interface-1.9.0/substrateinterface/data/chainspecs/westend2_people.json +45 -0
  37. substrate_interface-1.9.0/substrateinterface/transport/__init__.py +11 -0
  38. substrate_interface-1.9.0/substrateinterface/transport/base.py +34 -0
  39. substrate_interface-1.9.0/substrateinterface/transport/http.py +34 -0
  40. substrate_interface-1.9.0/substrateinterface/transport/smoldot.py +121 -0
  41. substrate_interface-1.9.0/substrateinterface/transport/websocket.py +85 -0
  42. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/utils/ecdsa_helpers.py +5 -5
  43. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_block.py +6 -10
  44. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_contracts.py +38 -31
  45. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_create_extrinsics.py +101 -101
  46. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_extension_interface.py +9 -4
  47. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_helper_functions.py +35 -37
  48. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_init.py +20 -9
  49. substrate_interface-1.9.0/test/test_light_client.py +46 -0
  50. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_query.py +29 -21
  51. substrate_interface-1.9.0/test/test_query_map.py +250 -0
  52. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_runtime_call.py +35 -26
  53. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_subscriptions.py +1 -2
  54. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_type_registry.py +54 -105
  55. substrate-interface-1.8.0a0/PKG-INFO +0 -90
  56. substrate-interface-1.8.0a0/substrate_interface.egg-info/PKG-INFO +0 -90
  57. substrate-interface-1.8.0a0/substrate_interface.egg-info/SOURCES.txt +0 -38
  58. substrate-interface-1.8.0a0/test/test_query_map.py +0 -246
  59. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/LICENSE +0 -0
  60. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/setup.cfg +0 -0
  61. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrate_interface.egg-info/dependency_links.txt +0 -0
  62. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrate_interface.egg-info/top_level.txt +0 -0
  63. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/__init__.py +0 -0
  64. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/constants.py +0 -0
  65. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/exceptions.py +0 -0
  66. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/extensions.py +0 -0
  67. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/interfaces.py +0 -0
  68. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/key.py +0 -0
  69. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/keypair.py +0 -0
  70. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/storage.py +0 -0
  71. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/utils/__init__.py +0 -0
  72. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/utils/caching.py +0 -0
  73. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/utils/encrypted_json.py +0 -0
  74. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/utils/hasher.py +0 -0
  75. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/substrateinterface/utils/ss58.py +0 -0
  76. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_keypair.py +0 -0
  77. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_rpc_compatibility.py +0 -0
  78. {substrate-interface-1.8.0a0 → substrate_interface-1.9.0}/test/test_ss58.py +0 -0
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: substrate-interface
3
+ Version: 1.9.0
4
+ Summary: Library for interfacing with a Substrate node
5
+ Home-page: https://github.com/JAMdotTech/py-polkadot-sdk
6
+ Author: Stichting Polkascan (Polkascan Foundation)
7
+ Author-email: info@polkascan.org
8
+ Keywords: interface polkascan polkadot substrate blockchain rpc kusama
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
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
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: websocket-client<2,>=0.57.0
22
+ Requires-Dist: base58<3,>=1.0.3
23
+ Requires-Dist: certifi>=2019.3.9
24
+ Requires-Dist: idna<4,>=2.1.0
25
+ Requires-Dist: requests<3,>=2.21.0
26
+ Requires-Dist: xxhash<5,>=1.3.0
27
+ Requires-Dist: ecdsa<1,>=0.17.0
28
+ Requires-Dist: eth-keys<1,>=0.2.1
29
+ Requires-Dist: eth_utils<7,>=1.3.0
30
+ Requires-Dist: pycryptodome<5,>=3.11.0
31
+ Requires-Dist: PyNaCl<2,>=1.0.1
32
+ Requires-Dist: scalecodec<1.4,>=1.3.0
33
+ Requires-Dist: py-sr25519-bindings<1,>=0.2.0
34
+ Requires-Dist: py-ed25519-zebra-bindings<2,>=1.0
35
+ Requires-Dist: py-bip39-bindings<1,>=0.1.9
36
+ Requires-Dist: smoldot-light<1,>=0.1.0
37
+ Provides-Extra: test
38
+ Requires-Dist: coverage; extra == "test"
39
+ Requires-Dist: pytest; extra == "test"
40
+ Dynamic: author
41
+ Dynamic: author-email
42
+ Dynamic: classifier
43
+ Dynamic: description
44
+ Dynamic: description-content-type
45
+ Dynamic: home-page
46
+ Dynamic: keywords
47
+ Dynamic: license-file
48
+ Dynamic: provides-extra
49
+ Dynamic: requires-dist
50
+ Dynamic: requires-python
51
+ Dynamic: summary
52
+
53
+ # Python Substrate Interface
54
+
55
+ [![Build Status](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml/badge.svg?branch=master)](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml)
56
+ [![Latest Version](https://img.shields.io/pypi/v/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)
57
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)
58
+ [![License](https://img.shields.io/pypi/l/substrate-interface.svg)](https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE)
59
+
60
+
61
+ ## Description
62
+ This library specializes in interfacing with a [Substrate](https://substrate.io/) node; querying storage, composing extrinsics,
63
+ SCALE encoding/decoding and providing additional convenience methods to deal with the features and metadata of
64
+ the Substrate runtime.
65
+
66
+ ## Documentation
67
+
68
+ * [Library documentation](https://jamdottech.github.io/py-polkadot-sdk/)
69
+ * [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://jamdottech.github.io/py-polkadot-metadata-docs/)
70
+
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
+
81
+ ```bash
82
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python -m pip install substrate-interface
83
+ ```
84
+
85
+ ## Initialization
86
+
87
+ Using embedded light client
88
+
89
+ ```python
90
+ substrate = SubstrateInterface(chainspec="polkadot_asset_hub", relay_chainspecs=["polkadot"])
91
+ ```
92
+
93
+ Using node RPC endpoint
94
+ ```python
95
+ substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
96
+ ```
97
+
98
+ After connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At
99
+ the moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For
100
+ older or runtimes under development the `ss58_format` (default 42) and other properties should be set manually.
101
+
102
+ ## Quick usage
103
+
104
+ ### Balance information of an account
105
+ ```python
106
+ result = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'])
107
+ print(result.value['data']['free']) # 635278638077956496
108
+ ```
109
+ ### Create balance transfer extrinsic
110
+
111
+ ```python
112
+ call = substrate.compose_call(
113
+ call_module='Balances',
114
+ call_function='transfer',
115
+ call_params={
116
+ 'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
117
+ 'value': 1 * 10**12
118
+ }
119
+ )
120
+
121
+ keypair = Keypair.create_from_uri('//Alice')
122
+ extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)
123
+
124
+ receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
125
+
126
+ print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
127
+ ```
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
+
133
+ ## Contact and Support
134
+
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).
136
+
137
+ ## License
138
+ https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE
@@ -1,9 +1,9 @@
1
1
  # Python Substrate Interface
2
2
 
3
- [![Build Status](https://img.shields.io/github/actions/workflow/status/polkascan/py-substrate-interface/unittests.yml?branch=master)](https://github.com/polkascan/py-substrate-interface/actions?query=workflow%3A%22Run+unit+tests%22)
3
+ [![Build Status](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml/badge.svg?branch=master)](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml)
4
4
  [![Latest Version](https://img.shields.io/pypi/v/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)
5
5
  [![Supported Python versions](https://img.shields.io/pypi/pyversions/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)
6
- [![License](https://img.shields.io/pypi/l/substrate-interface.svg)](https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE)
6
+ [![License](https://img.shields.io/pypi/l/substrate-interface.svg)](https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE)
7
7
 
8
8
 
9
9
  ## Description
@@ -13,16 +13,32 @@ the Substrate runtime.
13
13
 
14
14
  ## Documentation
15
15
 
16
- * [Library documentation](https://polkascan.github.io/py-substrate-interface/)
17
- * [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://polkascan.github.io/py-substrate-metadata-docs/)
16
+ * [Library documentation](https://jamdottech.github.io/py-polkadot-sdk/)
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
25
34
 
35
+ Using embedded light client
36
+
37
+ ```python
38
+ substrate = SubstrateInterface(chainspec="polkadot_asset_hub", relay_chainspecs=["polkadot"])
39
+ ```
40
+
41
+ Using node RPC endpoint
26
42
  ```python
27
43
  substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
28
44
  ```
@@ -58,10 +74,13 @@ receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
58
74
  print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
59
75
  ```
60
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
+
61
81
  ## Contact and Support
62
82
 
63
- For questions, please see the [Substrate StackExchange](https://substrate.stackexchange.com/questions/tagged/python), [Github Discussions](https://github.com/polkascan/py-substrate-interface/discussions) or
64
- reach out to us on our [matrix](http://matrix.org) chat group: [Polkascan Technical](https://matrix.to/#/#polkascan:matrix.org).
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).
65
84
 
66
85
  ## License
67
- https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE
86
+ https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE
@@ -0,0 +1,3 @@
1
+ [build-system]
2
+ requires = ["setuptools>=64"]
3
+ build-backend = "setuptools.build_meta"
@@ -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
- # Always prefer setuptools over distutils
25
- from setuptools import setup, find_packages
26
- from os import path, environ
27
- # io.open is needed for projects that support Python 2.7
28
- # It ensures open() defaults to text mode with universal newlines,
29
- # and accepts an argument to specify the text encoding
30
- # Python 3 only projects can skip this import
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 environ['GITHUB_REF'].startswith('refs/tags/v'):
40
- raise ValueError('Incorrect tag format {}'.format(environ['GITHUB_REF']))
41
-
42
- version = environ['GITHUB_REF'].replace('refs/tags/v', '')
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
- raise ValueError('Missing commit tag, can\'t set version')
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/polkascan/py-substrate-interface', # Optional
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.7, <4',
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,16 +182,17 @@ 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,<4',
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,<3',
189
- 'pycryptodome>=3.11.0,<4',
188
+ 'eth_utils>=1.3.0,<7',
189
+ 'pycryptodome>=3.11.0,<5',
190
190
  'PyNaCl>=1.0.1,<2',
191
- 'scalecodec==1.3.0a5',
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
- 'py-bip39-bindings>=0.1.9,<1'
194
+ 'py-bip39-bindings>=0.1.9,<1',
195
+ 'smoldot-light>=0.1.0,<1'
195
196
  ],
196
197
 
197
198
  # List additional groups of dependencies here (e.g. development
@@ -216,6 +217,9 @@ setup(
216
217
  # package_data={ # Optional
217
218
  # 'sample': ['package_data.dat'],
218
219
  # },
220
+ package_data={
221
+ 'substrateinterface': ['data/chainspecs/*.json'],
222
+ },
219
223
 
220
224
  # Although 'package_data' is the preferred approach, in some case you may
221
225
  # need to place data files outside of your packages. See:
@@ -0,0 +1,138 @@
1
+ Metadata-Version: 2.4
2
+ Name: substrate-interface
3
+ Version: 1.9.0
4
+ Summary: Library for interfacing with a Substrate node
5
+ Home-page: https://github.com/JAMdotTech/py-polkadot-sdk
6
+ Author: Stichting Polkascan (Polkascan Foundation)
7
+ Author-email: info@polkascan.org
8
+ Keywords: interface polkascan polkadot substrate blockchain rpc kusama
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3.11
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
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: websocket-client<2,>=0.57.0
22
+ Requires-Dist: base58<3,>=1.0.3
23
+ Requires-Dist: certifi>=2019.3.9
24
+ Requires-Dist: idna<4,>=2.1.0
25
+ Requires-Dist: requests<3,>=2.21.0
26
+ Requires-Dist: xxhash<5,>=1.3.0
27
+ Requires-Dist: ecdsa<1,>=0.17.0
28
+ Requires-Dist: eth-keys<1,>=0.2.1
29
+ Requires-Dist: eth_utils<7,>=1.3.0
30
+ Requires-Dist: pycryptodome<5,>=3.11.0
31
+ Requires-Dist: PyNaCl<2,>=1.0.1
32
+ Requires-Dist: scalecodec<1.4,>=1.3.0
33
+ Requires-Dist: py-sr25519-bindings<1,>=0.2.0
34
+ Requires-Dist: py-ed25519-zebra-bindings<2,>=1.0
35
+ Requires-Dist: py-bip39-bindings<1,>=0.1.9
36
+ Requires-Dist: smoldot-light<1,>=0.1.0
37
+ Provides-Extra: test
38
+ Requires-Dist: coverage; extra == "test"
39
+ Requires-Dist: pytest; extra == "test"
40
+ Dynamic: author
41
+ Dynamic: author-email
42
+ Dynamic: classifier
43
+ Dynamic: description
44
+ Dynamic: description-content-type
45
+ Dynamic: home-page
46
+ Dynamic: keywords
47
+ Dynamic: license-file
48
+ Dynamic: provides-extra
49
+ Dynamic: requires-dist
50
+ Dynamic: requires-python
51
+ Dynamic: summary
52
+
53
+ # Python Substrate Interface
54
+
55
+ [![Build Status](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml/badge.svg?branch=master)](https://github.com/JAMdotTech/py-polkadot-sdk/actions/workflows/unittests.yml)
56
+ [![Latest Version](https://img.shields.io/pypi/v/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)
57
+ [![Supported Python versions](https://img.shields.io/pypi/pyversions/substrate-interface.svg)](https://pypi.org/project/substrate-interface/)
58
+ [![License](https://img.shields.io/pypi/l/substrate-interface.svg)](https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE)
59
+
60
+
61
+ ## Description
62
+ This library specializes in interfacing with a [Substrate](https://substrate.io/) node; querying storage, composing extrinsics,
63
+ SCALE encoding/decoding and providing additional convenience methods to deal with the features and metadata of
64
+ the Substrate runtime.
65
+
66
+ ## Documentation
67
+
68
+ * [Library documentation](https://jamdottech.github.io/py-polkadot-sdk/)
69
+ * [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://jamdottech.github.io/py-polkadot-metadata-docs/)
70
+
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
+
81
+ ```bash
82
+ PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 python -m pip install substrate-interface
83
+ ```
84
+
85
+ ## Initialization
86
+
87
+ Using embedded light client
88
+
89
+ ```python
90
+ substrate = SubstrateInterface(chainspec="polkadot_asset_hub", relay_chainspecs=["polkadot"])
91
+ ```
92
+
93
+ Using node RPC endpoint
94
+ ```python
95
+ substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
96
+ ```
97
+
98
+ After connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At
99
+ the moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For
100
+ older or runtimes under development the `ss58_format` (default 42) and other properties should be set manually.
101
+
102
+ ## Quick usage
103
+
104
+ ### Balance information of an account
105
+ ```python
106
+ result = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'])
107
+ print(result.value['data']['free']) # 635278638077956496
108
+ ```
109
+ ### Create balance transfer extrinsic
110
+
111
+ ```python
112
+ call = substrate.compose_call(
113
+ call_module='Balances',
114
+ call_function='transfer',
115
+ call_params={
116
+ 'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
117
+ 'value': 1 * 10**12
118
+ }
119
+ )
120
+
121
+ keypair = Keypair.create_from_uri('//Alice')
122
+ extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)
123
+
124
+ receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
125
+
126
+ print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
127
+ ```
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
+
133
+ ## Contact and Support
134
+
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).
136
+
137
+ ## License
138
+ https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE
@@ -0,0 +1,72 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ setup.py
5
+ substrate_interface.egg-info/PKG-INFO
6
+ substrate_interface.egg-info/SOURCES.txt
7
+ substrate_interface.egg-info/dependency_links.txt
8
+ substrate_interface.egg-info/requires.txt
9
+ substrate_interface.egg-info/top_level.txt
10
+ substrateinterface/__init__.py
11
+ substrateinterface/base.py
12
+ substrateinterface/constants.py
13
+ substrateinterface/contracts.py
14
+ substrateinterface/exceptions.py
15
+ substrateinterface/extensions.py
16
+ substrateinterface/interfaces.py
17
+ substrateinterface/key.py
18
+ substrateinterface/keypair.py
19
+ substrateinterface/storage.py
20
+ substrateinterface/data/chainspecs/ksmcc3.json
21
+ substrateinterface/data/chainspecs/ksmcc3_asset_hub.json
22
+ substrateinterface/data/chainspecs/ksmcc3_bridge_hub.json
23
+ substrateinterface/data/chainspecs/ksmcc3_coretime.json
24
+ substrateinterface/data/chainspecs/ksmcc3_encointer.json
25
+ substrateinterface/data/chainspecs/ksmcc3_people.json
26
+ substrateinterface/data/chainspecs/kusama.json
27
+ substrateinterface/data/chainspecs/paseo.json
28
+ substrateinterface/data/chainspecs/paseo_asset_hub.json
29
+ substrateinterface/data/chainspecs/paseo_coretime.json
30
+ substrateinterface/data/chainspecs/paseo_people.json
31
+ substrateinterface/data/chainspecs/polkadot.json
32
+ substrateinterface/data/chainspecs/polkadot_asset_hub.json
33
+ substrateinterface/data/chainspecs/polkadot_bridge_hub.json
34
+ substrateinterface/data/chainspecs/polkadot_collectives.json
35
+ substrateinterface/data/chainspecs/polkadot_coretime.json
36
+ substrateinterface/data/chainspecs/polkadot_people.json
37
+ substrateinterface/data/chainspecs/rococo_v2_2.json
38
+ substrateinterface/data/chainspecs/rococo_v2_2_asset_hub.json
39
+ substrateinterface/data/chainspecs/rococo_v2_2_bridge_hub.json
40
+ substrateinterface/data/chainspecs/rococo_v2_2_people.json
41
+ substrateinterface/data/chainspecs/westend2.json
42
+ substrateinterface/data/chainspecs/westend2_asset_hub.json
43
+ substrateinterface/data/chainspecs/westend2_bridge_hub.json
44
+ substrateinterface/data/chainspecs/westend2_collectives.json
45
+ substrateinterface/data/chainspecs/westend2_coretime.json
46
+ substrateinterface/data/chainspecs/westend2_people.json
47
+ substrateinterface/transport/__init__.py
48
+ substrateinterface/transport/base.py
49
+ substrateinterface/transport/http.py
50
+ substrateinterface/transport/smoldot.py
51
+ substrateinterface/transport/websocket.py
52
+ substrateinterface/utils/__init__.py
53
+ substrateinterface/utils/caching.py
54
+ substrateinterface/utils/ecdsa_helpers.py
55
+ substrateinterface/utils/encrypted_json.py
56
+ substrateinterface/utils/hasher.py
57
+ substrateinterface/utils/ss58.py
58
+ test/test_block.py
59
+ test/test_contracts.py
60
+ test/test_create_extrinsics.py
61
+ test/test_extension_interface.py
62
+ test/test_helper_functions.py
63
+ test/test_init.py
64
+ test/test_keypair.py
65
+ test/test_light_client.py
66
+ test/test_query.py
67
+ test/test_query_map.py
68
+ test/test_rpc_compatibility.py
69
+ test/test_runtime_call.py
70
+ test/test_ss58.py
71
+ test/test_subscriptions.py
72
+ test/test_type_registry.py
@@ -3,16 +3,17 @@ 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<4,>=1.3.0
6
+ xxhash<5,>=1.3.0
7
7
  ecdsa<1,>=0.17.0
8
8
  eth-keys<1,>=0.2.1
9
- eth_utils<3,>=1.3.0
10
- pycryptodome<4,>=3.11.0
9
+ eth_utils<7,>=1.3.0
10
+ pycryptodome<5,>=3.11.0
11
11
  PyNaCl<2,>=1.0.1
12
- scalecodec==1.3.0a5
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
16
+ smoldot-light<1,>=0.1.0
16
17
 
17
18
  [test]
18
19
  coverage