substrate-interface 1.8.0a0__tar.gz → 1.8.1__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/PKG-INFO +125 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/README.md +13 -7
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/setup.py +7 -3
- substrate_interface-1.8.1/substrate_interface.egg-info/PKG-INFO +125 -0
- substrate_interface-1.8.1/substrate_interface.egg-info/SOURCES.txt +71 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrate_interface.egg-info/requires.txt +3 -2
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/base.py +108 -161
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/contracts.py +52 -7
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/ksmcc3.json +62 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/ksmcc3_asset_hub.json +44 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/ksmcc3_bridge_hub.json +46 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/ksmcc3_coretime.json +26 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/ksmcc3_encointer.json +43 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/ksmcc3_people.json +46 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/kusama.json +3494 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/paseo.json +42 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/paseo_asset_hub.json +24 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/paseo_coretime.json +22 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/paseo_people.json +32 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/polkadot.json +60 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/polkadot_asset_hub.json +42 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/polkadot_bridge_hub.json +44 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/polkadot_collectives.json +43 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/polkadot_coretime.json +29 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/polkadot_people.json +26 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/rococo_v2_2.json +30 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/rococo_v2_2_asset_hub.json +25 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/rococo_v2_2_bridge_hub.json +24 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/rococo_v2_2_people.json +26 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/westend2.json +54 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/westend2_asset_hub.json +42 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/westend2_bridge_hub.json +42 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/westend2_collectives.json +42 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/westend2_coretime.json +47 -0
- substrate_interface-1.8.1/substrateinterface/data/chainspecs/westend2_people.json +45 -0
- substrate_interface-1.8.1/substrateinterface/transport/__init__.py +11 -0
- substrate_interface-1.8.1/substrateinterface/transport/base.py +34 -0
- substrate_interface-1.8.1/substrateinterface/transport/http.py +34 -0
- substrate_interface-1.8.1/substrateinterface/transport/smoldot.py +121 -0
- substrate_interface-1.8.1/substrateinterface/transport/websocket.py +85 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/utils/ecdsa_helpers.py +5 -5
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_contracts.py +54 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_create_extrinsics.py +9 -9
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_helper_functions.py +3 -4
- substrate_interface-1.8.1/test/test_light_client.py +46 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_query.py +7 -8
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_query_map.py +9 -13
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_runtime_call.py +8 -9
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_subscriptions.py +0 -2
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_type_registry.py +2 -2
- substrate-interface-1.8.0a0/PKG-INFO +0 -90
- substrate-interface-1.8.0a0/substrate_interface.egg-info/PKG-INFO +0 -90
- substrate-interface-1.8.0a0/substrate_interface.egg-info/SOURCES.txt +0 -38
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/LICENSE +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/setup.cfg +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrate_interface.egg-info/dependency_links.txt +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrate_interface.egg-info/top_level.txt +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/__init__.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/constants.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/exceptions.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/extensions.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/interfaces.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/key.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/keypair.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/storage.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/utils/__init__.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/utils/caching.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/utils/encrypted_json.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/utils/hasher.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrateinterface/utils/ss58.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_block.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_extension_interface.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_init.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_keypair.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_rpc_compatibility.py +0 -0
- {substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/test/test_ss58.py +0 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: substrate-interface
|
|
3
|
+
Version: 1.8.1
|
|
4
|
+
Summary: Library for interfacing with a Substrate node
|
|
5
|
+
Home-page: https://github.com/polkascan/py-substrate-interface
|
|
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.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Requires-Python: >=3.7, <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<4,>=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<6,>=1.3.0
|
|
30
|
+
Requires-Dist: pycryptodome<4,>=3.11.0
|
|
31
|
+
Requires-Dist: PyNaCl<2,>=1.0.1
|
|
32
|
+
Requires-Dist: scalecodec<1.3,>=1.2.10
|
|
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
|
+
[](https://github.com/JAMdotTech/py-polkadot-sdk/actions?query=workflow%3A%22Run+unit+tests%22)
|
|
56
|
+
[](https://pypi.org/project/substrate-interface/)
|
|
57
|
+
[](https://pypi.org/project/substrate-interface/)
|
|
58
|
+
[](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
|
+
```bash
|
|
73
|
+
pip install substrate-interface
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Initialization
|
|
77
|
+
|
|
78
|
+
Using embedded light client
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
substrate = SubstrateInterface(chainspec="polkadot_asset_hub", relay_chainspecs=["polkadot"])
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Using node RPC endpoint
|
|
85
|
+
```python
|
|
86
|
+
substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
After connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At
|
|
90
|
+
the moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For
|
|
91
|
+
older or runtimes under development the `ss58_format` (default 42) and other properties should be set manually.
|
|
92
|
+
|
|
93
|
+
## Quick usage
|
|
94
|
+
|
|
95
|
+
### Balance information of an account
|
|
96
|
+
```python
|
|
97
|
+
result = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'])
|
|
98
|
+
print(result.value['data']['free']) # 635278638077956496
|
|
99
|
+
```
|
|
100
|
+
### Create balance transfer extrinsic
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
call = substrate.compose_call(
|
|
104
|
+
call_module='Balances',
|
|
105
|
+
call_function='transfer',
|
|
106
|
+
call_params={
|
|
107
|
+
'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
|
|
108
|
+
'value': 1 * 10**12
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
keypair = Keypair.create_from_uri('//Alice')
|
|
113
|
+
extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)
|
|
114
|
+
|
|
115
|
+
receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
|
|
116
|
+
|
|
117
|
+
print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contact and Support
|
|
121
|
+
|
|
122
|
+
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).
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Python Substrate Interface
|
|
2
2
|
|
|
3
|
-
[](https://github.com/
|
|
3
|
+
[](https://github.com/JAMdotTech/py-polkadot-sdk/actions?query=workflow%3A%22Run+unit+tests%22)
|
|
4
4
|
[](https://pypi.org/project/substrate-interface/)
|
|
5
5
|
[](https://pypi.org/project/substrate-interface/)
|
|
6
|
-
[](https://github.com/
|
|
6
|
+
[](https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE)
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
## Description
|
|
@@ -13,8 +13,8 @@ the Substrate runtime.
|
|
|
13
13
|
|
|
14
14
|
## Documentation
|
|
15
15
|
|
|
16
|
-
* [Library documentation](https://
|
|
17
|
-
* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://
|
|
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
20
|
```bash
|
|
@@ -23,6 +23,13 @@ pip install substrate-interface
|
|
|
23
23
|
|
|
24
24
|
## Initialization
|
|
25
25
|
|
|
26
|
+
Using embedded light client
|
|
27
|
+
|
|
28
|
+
```python
|
|
29
|
+
substrate = SubstrateInterface(chainspec="polkadot_asset_hub", relay_chainspecs=["polkadot"])
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Using node RPC endpoint
|
|
26
33
|
```python
|
|
27
34
|
substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
|
|
28
35
|
```
|
|
@@ -60,8 +67,7 @@ print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receip
|
|
|
60
67
|
|
|
61
68
|
## Contact and Support
|
|
62
69
|
|
|
63
|
-
For questions, please see the [Substrate StackExchange](https://substrate.stackexchange.com/questions/tagged/python)
|
|
64
|
-
reach out to us on our [matrix](http://matrix.org) chat group: [Polkascan Technical](https://matrix.to/#/#polkascan:matrix.org).
|
|
70
|
+
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
71
|
|
|
66
72
|
## License
|
|
67
|
-
https://github.com/
|
|
73
|
+
https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE
|
|
@@ -185,13 +185,14 @@ setup(
|
|
|
185
185
|
'xxhash>=1.3.0,<4',
|
|
186
186
|
'ecdsa>=0.17.0,<1',
|
|
187
187
|
'eth-keys>=0.2.1,<1',
|
|
188
|
-
'eth_utils>=1.3.0,<
|
|
188
|
+
'eth_utils>=1.3.0,<6',
|
|
189
189
|
'pycryptodome>=3.11.0,<4',
|
|
190
190
|
'PyNaCl>=1.0.1,<2',
|
|
191
|
-
'scalecodec
|
|
191
|
+
'scalecodec>=1.2.10,<1.3',
|
|
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,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: substrate-interface
|
|
3
|
+
Version: 1.8.1
|
|
4
|
+
Summary: Library for interfacing with a Substrate node
|
|
5
|
+
Home-page: https://github.com/polkascan/py-substrate-interface
|
|
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.7
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Requires-Python: >=3.7, <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<4,>=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<6,>=1.3.0
|
|
30
|
+
Requires-Dist: pycryptodome<4,>=3.11.0
|
|
31
|
+
Requires-Dist: PyNaCl<2,>=1.0.1
|
|
32
|
+
Requires-Dist: scalecodec<1.3,>=1.2.10
|
|
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
|
+
[](https://github.com/JAMdotTech/py-polkadot-sdk/actions?query=workflow%3A%22Run+unit+tests%22)
|
|
56
|
+
[](https://pypi.org/project/substrate-interface/)
|
|
57
|
+
[](https://pypi.org/project/substrate-interface/)
|
|
58
|
+
[](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
|
+
```bash
|
|
73
|
+
pip install substrate-interface
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Initialization
|
|
77
|
+
|
|
78
|
+
Using embedded light client
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
substrate = SubstrateInterface(chainspec="polkadot_asset_hub", relay_chainspecs=["polkadot"])
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Using node RPC endpoint
|
|
85
|
+
```python
|
|
86
|
+
substrate = SubstrateInterface(url="ws://127.0.0.1:9944")
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
After connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At
|
|
90
|
+
the moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For
|
|
91
|
+
older or runtimes under development the `ss58_format` (default 42) and other properties should be set manually.
|
|
92
|
+
|
|
93
|
+
## Quick usage
|
|
94
|
+
|
|
95
|
+
### Balance information of an account
|
|
96
|
+
```python
|
|
97
|
+
result = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T'])
|
|
98
|
+
print(result.value['data']['free']) # 635278638077956496
|
|
99
|
+
```
|
|
100
|
+
### Create balance transfer extrinsic
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
call = substrate.compose_call(
|
|
104
|
+
call_module='Balances',
|
|
105
|
+
call_function='transfer',
|
|
106
|
+
call_params={
|
|
107
|
+
'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo',
|
|
108
|
+
'value': 1 * 10**12
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
keypair = Keypair.create_from_uri('//Alice')
|
|
113
|
+
extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair)
|
|
114
|
+
|
|
115
|
+
receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True)
|
|
116
|
+
|
|
117
|
+
print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'")
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Contact and Support
|
|
121
|
+
|
|
122
|
+
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).
|
|
123
|
+
|
|
124
|
+
## License
|
|
125
|
+
https://github.com/JAMdotTech/py-polkadot-sdk/blob/master/LICENSE
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
setup.py
|
|
4
|
+
substrate_interface.egg-info/PKG-INFO
|
|
5
|
+
substrate_interface.egg-info/SOURCES.txt
|
|
6
|
+
substrate_interface.egg-info/dependency_links.txt
|
|
7
|
+
substrate_interface.egg-info/requires.txt
|
|
8
|
+
substrate_interface.egg-info/top_level.txt
|
|
9
|
+
substrateinterface/__init__.py
|
|
10
|
+
substrateinterface/base.py
|
|
11
|
+
substrateinterface/constants.py
|
|
12
|
+
substrateinterface/contracts.py
|
|
13
|
+
substrateinterface/exceptions.py
|
|
14
|
+
substrateinterface/extensions.py
|
|
15
|
+
substrateinterface/interfaces.py
|
|
16
|
+
substrateinterface/key.py
|
|
17
|
+
substrateinterface/keypair.py
|
|
18
|
+
substrateinterface/storage.py
|
|
19
|
+
substrateinterface/data/chainspecs/ksmcc3.json
|
|
20
|
+
substrateinterface/data/chainspecs/ksmcc3_asset_hub.json
|
|
21
|
+
substrateinterface/data/chainspecs/ksmcc3_bridge_hub.json
|
|
22
|
+
substrateinterface/data/chainspecs/ksmcc3_coretime.json
|
|
23
|
+
substrateinterface/data/chainspecs/ksmcc3_encointer.json
|
|
24
|
+
substrateinterface/data/chainspecs/ksmcc3_people.json
|
|
25
|
+
substrateinterface/data/chainspecs/kusama.json
|
|
26
|
+
substrateinterface/data/chainspecs/paseo.json
|
|
27
|
+
substrateinterface/data/chainspecs/paseo_asset_hub.json
|
|
28
|
+
substrateinterface/data/chainspecs/paseo_coretime.json
|
|
29
|
+
substrateinterface/data/chainspecs/paseo_people.json
|
|
30
|
+
substrateinterface/data/chainspecs/polkadot.json
|
|
31
|
+
substrateinterface/data/chainspecs/polkadot_asset_hub.json
|
|
32
|
+
substrateinterface/data/chainspecs/polkadot_bridge_hub.json
|
|
33
|
+
substrateinterface/data/chainspecs/polkadot_collectives.json
|
|
34
|
+
substrateinterface/data/chainspecs/polkadot_coretime.json
|
|
35
|
+
substrateinterface/data/chainspecs/polkadot_people.json
|
|
36
|
+
substrateinterface/data/chainspecs/rococo_v2_2.json
|
|
37
|
+
substrateinterface/data/chainspecs/rococo_v2_2_asset_hub.json
|
|
38
|
+
substrateinterface/data/chainspecs/rococo_v2_2_bridge_hub.json
|
|
39
|
+
substrateinterface/data/chainspecs/rococo_v2_2_people.json
|
|
40
|
+
substrateinterface/data/chainspecs/westend2.json
|
|
41
|
+
substrateinterface/data/chainspecs/westend2_asset_hub.json
|
|
42
|
+
substrateinterface/data/chainspecs/westend2_bridge_hub.json
|
|
43
|
+
substrateinterface/data/chainspecs/westend2_collectives.json
|
|
44
|
+
substrateinterface/data/chainspecs/westend2_coretime.json
|
|
45
|
+
substrateinterface/data/chainspecs/westend2_people.json
|
|
46
|
+
substrateinterface/transport/__init__.py
|
|
47
|
+
substrateinterface/transport/base.py
|
|
48
|
+
substrateinterface/transport/http.py
|
|
49
|
+
substrateinterface/transport/smoldot.py
|
|
50
|
+
substrateinterface/transport/websocket.py
|
|
51
|
+
substrateinterface/utils/__init__.py
|
|
52
|
+
substrateinterface/utils/caching.py
|
|
53
|
+
substrateinterface/utils/ecdsa_helpers.py
|
|
54
|
+
substrateinterface/utils/encrypted_json.py
|
|
55
|
+
substrateinterface/utils/hasher.py
|
|
56
|
+
substrateinterface/utils/ss58.py
|
|
57
|
+
test/test_block.py
|
|
58
|
+
test/test_contracts.py
|
|
59
|
+
test/test_create_extrinsics.py
|
|
60
|
+
test/test_extension_interface.py
|
|
61
|
+
test/test_helper_functions.py
|
|
62
|
+
test/test_init.py
|
|
63
|
+
test/test_keypair.py
|
|
64
|
+
test/test_light_client.py
|
|
65
|
+
test/test_query.py
|
|
66
|
+
test/test_query_map.py
|
|
67
|
+
test/test_rpc_compatibility.py
|
|
68
|
+
test/test_runtime_call.py
|
|
69
|
+
test/test_ss58.py
|
|
70
|
+
test/test_subscriptions.py
|
|
71
|
+
test/test_type_registry.py
|
{substrate-interface-1.8.0a0 → substrate_interface-1.8.1}/substrate_interface.egg-info/requires.txt
RENAMED
|
@@ -6,13 +6,14 @@ requests<3,>=2.21.0
|
|
|
6
6
|
xxhash<4,>=1.3.0
|
|
7
7
|
ecdsa<1,>=0.17.0
|
|
8
8
|
eth-keys<1,>=0.2.1
|
|
9
|
-
eth_utils<
|
|
9
|
+
eth_utils<6,>=1.3.0
|
|
10
10
|
pycryptodome<4,>=3.11.0
|
|
11
11
|
PyNaCl<2,>=1.0.1
|
|
12
|
-
scalecodec
|
|
12
|
+
scalecodec<1.3,>=1.2.10
|
|
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
|