diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-04-11 21:46:07 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 21:46:07 +0000 |
| commit | 9bef35ddefb88eb0c811aa93763516455e7bd7b4 (patch) | |
| tree | b57fe75c48e024540073e27e16e9203d493c6d8f | |
| parent | 3c985c58aaaa7782633cb8186473651cbf080cae (diff) | |
automatic import of python-substrate-interface
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-substrate-interface.spec | 296 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 298 insertions, 0 deletions
@@ -0,0 +1 @@ +/substrate-interface-1.6.2.tar.gz diff --git a/python-substrate-interface.spec b/python-substrate-interface.spec new file mode 100644 index 0000000..fb2f949 --- /dev/null +++ b/python-substrate-interface.spec @@ -0,0 +1,296 @@ +%global _empty_manifest_terminate_build 0 +Name: python-substrate-interface +Version: 1.6.2 +Release: 1 +Summary: Library for interfacing with a Substrate node +License: Apache Software License +URL: https://github.com/polkascan/py-substrate-interface +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/be/49/072486931ce373c4f9a619723d4f73244729d9cdd2d0f87e2f4949e85124/substrate-interface-1.6.2.tar.gz +BuildArch: noarch + +Requires: python3-websocket-client +Requires: python3-base58 +Requires: python3-certifi +Requires: python3-idna +Requires: python3-requests +Requires: python3-xxhash +Requires: python3-ecdsa +Requires: python3-eth-keys +Requires: python3-eth-utils +Requires: python3-pycryptodome +Requires: python3-PyNaCl +Requires: python3-scalecodec +Requires: python3-py-sr25519-bindings +Requires: python3-py-ed25519-zebra-bindings +Requires: python3-py-bip39-bindings +Requires: python3-coverage +Requires: python3-pytest + +%description +# Python Substrate Interface + +[](https://github.com/polkascan/py-substrate-interface/actions?query=workflow%3A%22Run+unit+tests%22) +[](https://pypi.org/project/substrate-interface/) +[](https://pypi.org/project/substrate-interface/) +[](https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE) + + +## Description +This library specializes in interfacing with a [Substrate](https://substrate.io/) node; querying storage, composing extrinsics, +SCALE encoding/decoding and providing additional convenience methods to deal with the features and metadata of +the Substrate runtime. + +## Documentation + +* [Library documentation](https://polkascan.github.io/py-substrate-interface/) +* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://polkascan.github.io/py-substrate-metadata-docs/) + +## Installation +```bash +pip install substrate-interface +``` + +## Initialization + +```python +substrate = SubstrateInterface(url="ws://127.0.0.1:9944") +``` + +After connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At +the moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For +older or runtimes under development the `ss58_format` (default 42) and other properties should be set manually. + +## Quick usage + +### Balance information of an account +```python +result = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T']) +print(result.value['data']['free']) # 635278638077956496 +``` +### Create balance transfer extrinsic + +```python +call = substrate.compose_call( + call_module='Balances', + call_function='transfer', + call_params={ + 'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo', + 'value': 1 * 10**12 + } +) + +keypair = Keypair.create_from_uri('//Alice') +extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair) + +receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True) + +print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'") +``` + +## Contact and Support + +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 +reach out to us on our [matrix](http://matrix.org) chat group: [Polkascan Technical](https://matrix.to/#/#polkascan:matrix.org). + +## License +https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE + + + + +%package -n python3-substrate-interface +Summary: Library for interfacing with a Substrate node +Provides: python-substrate-interface +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-substrate-interface +# Python Substrate Interface + +[](https://github.com/polkascan/py-substrate-interface/actions?query=workflow%3A%22Run+unit+tests%22) +[](https://pypi.org/project/substrate-interface/) +[](https://pypi.org/project/substrate-interface/) +[](https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE) + + +## Description +This library specializes in interfacing with a [Substrate](https://substrate.io/) node; querying storage, composing extrinsics, +SCALE encoding/decoding and providing additional convenience methods to deal with the features and metadata of +the Substrate runtime. + +## Documentation + +* [Library documentation](https://polkascan.github.io/py-substrate-interface/) +* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://polkascan.github.io/py-substrate-metadata-docs/) + +## Installation +```bash +pip install substrate-interface +``` + +## Initialization + +```python +substrate = SubstrateInterface(url="ws://127.0.0.1:9944") +``` + +After connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At +the moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For +older or runtimes under development the `ss58_format` (default 42) and other properties should be set manually. + +## Quick usage + +### Balance information of an account +```python +result = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T']) +print(result.value['data']['free']) # 635278638077956496 +``` +### Create balance transfer extrinsic + +```python +call = substrate.compose_call( + call_module='Balances', + call_function='transfer', + call_params={ + 'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo', + 'value': 1 * 10**12 + } +) + +keypair = Keypair.create_from_uri('//Alice') +extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair) + +receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True) + +print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'") +``` + +## Contact and Support + +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 +reach out to us on our [matrix](http://matrix.org) chat group: [Polkascan Technical](https://matrix.to/#/#polkascan:matrix.org). + +## License +https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE + + + + +%package help +Summary: Development documents and examples for substrate-interface +Provides: python3-substrate-interface-doc +%description help +# Python Substrate Interface + +[](https://github.com/polkascan/py-substrate-interface/actions?query=workflow%3A%22Run+unit+tests%22) +[](https://pypi.org/project/substrate-interface/) +[](https://pypi.org/project/substrate-interface/) +[](https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE) + + +## Description +This library specializes in interfacing with a [Substrate](https://substrate.io/) node; querying storage, composing extrinsics, +SCALE encoding/decoding and providing additional convenience methods to deal with the features and metadata of +the Substrate runtime. + +## Documentation + +* [Library documentation](https://polkascan.github.io/py-substrate-interface/) +* [Metadata documentation for Polkadot and Kusama ecosystem runtimes](https://polkascan.github.io/py-substrate-metadata-docs/) + +## Installation +```bash +pip install substrate-interface +``` + +## Initialization + +```python +substrate = SubstrateInterface(url="ws://127.0.0.1:9944") +``` + +After connecting certain properties like `ss58_format` will be determined automatically by querying the RPC node. At +the moment this will work for most `MetadataV14` and above runtimes like Polkadot, Kusama, Acala, Moonbeam. For +older or runtimes under development the `ss58_format` (default 42) and other properties should be set manually. + +## Quick usage + +### Balance information of an account +```python +result = substrate.query('System', 'Account', ['F4xQKRUagnSGjFqafyhajLs94e7Vvzvr8ebwYJceKpr8R7T']) +print(result.value['data']['free']) # 635278638077956496 +``` +### Create balance transfer extrinsic + +```python +call = substrate.compose_call( + call_module='Balances', + call_function='transfer', + call_params={ + 'dest': '5E9oDs9PjpsBbxXxRE9uMaZZhnBAV38n2ouLB28oecBDdeQo', + 'value': 1 * 10**12 + } +) + +keypair = Keypair.create_from_uri('//Alice') +extrinsic = substrate.create_signed_extrinsic(call=call, keypair=keypair) + +receipt = substrate.submit_extrinsic(extrinsic, wait_for_inclusion=True) + +print(f"Extrinsic '{receipt.extrinsic_hash}' sent and included in block '{receipt.block_hash}'") +``` + +## Contact and Support + +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 +reach out to us on our [matrix](http://matrix.org) chat group: [Polkascan Technical](https://matrix.to/#/#polkascan:matrix.org). + +## License +https://github.com/polkascan/py-substrate-interface/blob/master/LICENSE + + + + +%prep +%autosetup -n substrate-interface-1.6.2 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-substrate-interface -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 1.6.2-1 +- Package Spec generated @@ -0,0 +1 @@ +d213b1acda5a4721255d21a685ed0bce substrate-interface-1.6.2.tar.gz |
