This release is a pre-release and may not be stable for production use.
This project is forked from https://github.com/polkascan/py-scale-codec
Python Polymath SCALE Codec
Python Polymath SCALE Codec Library
Description
Most of the data that the Substrate RPCs output is encoded with the SCALE Codec. This codec is used by the Substrate nodes' internal runtime. In order to get to meaningful data this data will need to be decoded. The Python SCALE Codec Library will specialize in this task.
Documentation
https://polkascan.github.io/py-scale-codec/
Installation
pip install polymath-scalecodec
Examples
Decode a SCALE-encoded Compact<Balance>
RuntimeConfiguration().update_type_registry(load_type_registry_preset("default"))
RuntimeConfiguration().update_type_registry(load_type_registry_preset("kusama"))
obj = ScaleDecoder.get_decoder_class('Compact<Balance>', ScaleBytes("0x130080cd103d71bc22"))
obj.decode()
print(obj.value)
Add custom types to type registry
RuntimeConfiguration().update_type_registry(load_type_registry_preset("default"))
custom_types = {
"types": {
"MyCustomType": "u32",
"CustomNextAuthority": {
"type": "struct",
"type_mapping": [
["AuthorityId", "AuthorityId"],
["weight", "AuthorityWeight"]
]
}
}
}
RuntimeConfiguration().update_type_registry(custom_types)
Or from a custom JSON file
RuntimeConfiguration().update_type_registry(load_type_registry_preset("default"))
RuntimeConfiguration().update_type_registry(load_type_registry_file("/path/to/type_registry.json"))
License
https://github.com/PolymathNetwork/py-scale-codec/blob/master/LICENSE
Metadata
Release files for polymath-scalecodec 0.3.17b1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| polymath-scalecodec-0.3.17b1.tar.gz | 213.5 kB | Without provenance | Details for polymath-scalecodec-0.3.17b1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| polymath_scalecodec-0.3.17b1-py3-none-any.whl | Python 3 | none | any | Details for polymath_scalecodec-0.3.17b1-py3-none-any.whl |
Total release size: 266.1 kB
Release files / polymath-scalecodec-0.3.17b1.tar.gz
| Download URL | polymath-scalecodec-0.3.17b1.tar.gz |
|---|---|
| Size | 213.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
76e667204d532f45e661e176be91bbad6d9f57b92c249d6de7524b5dcbec55f5
|
|
BLAKE2b-256 checksum How to use checksums |
66712c33cc9704e22e6eac74fcfa9b0a9ecb885052791c922c278a23ed801f2c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Release files / polymath_scalecodec-0.3.17b1-py3-none-any.whl
| Download URL | polymath_scalecodec-0.3.17b1-py3-none-any.whl |
|---|---|
| Size | 52.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c004d2c5307c87eaf035de948763b5829094d1cf3a50c4cd9d7d76d3cab04ee
|
|
BLAKE2b-256 checksum How to use checksums |
49841b32fc36044c2632d675375eb5bb1f76f6da56e4baec41818f918e6adafb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.3
|
Security for polymath-scalecodec 0.3.17b1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.