Scalecodec

Latest version: v1.2.8

Safety actively analyzes 623219 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 3 of 39

1.1.3

Added missing `Weight` types to core registry

**Full Changelog**: https://github.com/polkascan/py-scale-codec/compare/v1.1.2...v1.1.3

1.1.2

What's Changed
* Ink type changes by arjanz in https://github.com/polkascan/py-scale-codec/pull/93


**Full Changelog**: https://github.com/polkascan/py-scale-codec/compare/v1.1.1...v1.1.2

1.1.1

What's Changed
* Added max recursion to type decomposition by arjanz in https://github.com/polkascan/py-scale-codec/pull/92


**Full Changelog**: https://github.com/polkascan/py-scale-codec/compare/v1.1.0...v1.1.1

1.1.0

| ⚠️ This release has some data structure changes |
|-----------------------------------------|

Potential breaking changes

* Type registry `default` renamed to `legacy` (for runtimes prior to `MetadataV14`)
* Type registry `metadata_types` renamed to `core` (for runtimes `MetadataV14` and higher)
* Named fields in composite fields are now respected, which means that types can be rendered differently. What used to be a `tuple` of values can now be a `dict` with named fields (for example `EventRecord`).

What's Changed
* New type decomposition by arjanz in https://github.com/polkascan/py-scale-codec/pull/90

This introduces a new function

The function `generate_type_decomposition()` can be
used when more information is needed how to encode a certain SCALE type:

_Example 1_
python
scale_obj = runtime_config.create_scale_object("RawBabePreDigest")

type_info = scale_obj.generate_type_decomposition()

print(type_info)
{
'Phantom': None,
'Primary': {'authority_index': 'u32', 'slot_number': 'u64', 'vrf_output': '[u8; 32]', 'vrf_proof': '[u8; 64]'},
'SecondaryPlain': {'authority_index': 'u32', 'slot_number': 'u64'},
'SecondaryVRF': {'authority_index': 'u32', 'slot_number': 'u64', 'vrf_output': '[u8; 32]', 'vrf_proof': '[u8; 64]'}
}


_Example 2_
python
pallet = metadata.get_metadata_pallet("Tokens")
storage_function = pallet.get_storage_function("TotalIssuance")

param_type_string = storage_function.get_params_type_string()
param_type_obj = runtime_config.create_scale_object(param_type_string[0])

type_info = param_type_obj.generate_type_decomposition()

print(type_info)
[{
'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'),
'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'}),
'Erc20': '[u8; 20]',
'StableAssetPoolToken': 'u32',
'LiquidCrowdloan': 'u32',
'ForeignAsset': 'u16'
}]


* Runtime API call definitions by arjanz in https://github.com/polkascan/py-scale-codec/pull/91



**Full Changelog**: https://github.com/polkascan/py-scale-codec/compare/v1.0.48...v1.1.0

1.1.0a1

| ⚠️ This release has some data structure changes |
|-----------------------------------------|

Potential breaking changes

* Type registry `default` renamed to `legacy` (for runtimes prior to `MetadataV14`)
* Type registry `metadata_types` renamed to `core` (for runtimes `MetadataV14` and higher)
* Named fields in composite fields are now respected, which means that types can be rendered differently. What used to be a `tuple` of values can now be a `dict` with named fields.

What's Changed
* New type decomposition by arjanz in https://github.com/polkascan/py-scale-codec/pull/90

This introduces a new function

The function `generate_type_decomposition` can be
used when more information is needed how to encode a certain SCALE type:

_Example 1_
python
scale_obj = runtime_config.create_scale_object("RawBabePreDigest")

type_info = scale_obj.generate_type_decomposition()

print(type_info)
{
'Phantom': None,
'Primary': {'authority_index': 'u32', 'slot_number': 'u64', 'vrf_output': '[u8; 32]', 'vrf_proof': '[u8; 64]'},
'SecondaryPlain': {'authority_index': 'u32', 'slot_number': 'u64'},
'SecondaryVRF': {'authority_index': 'u32', 'slot_number': 'u64', 'vrf_output': '[u8; 32]', 'vrf_proof': '[u8; 64]'}
}


_Example 2_
python
pallet = metadata.get_metadata_pallet("Tokens")
storage_function = pallet.get_storage_function("TotalIssuance")

param_type_string = storage_function.get_params_type_string()
param_type_obj = runtime_config.create_scale_object(param_type_string[0])

type_info = param_type_obj.generate_type_decomposition()

print(type_info)
[{
'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'),
'DexShare': ({'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'}, {'Token': ('ACA', 'AUSD', 'DOT', 'LDOT', 'RENBTC', 'CASH', 'KAR', 'KUSD', 'KSM', 'LKSM', 'TAI', 'BNC', 'VSKSM', 'PHA', 'KINT', 'KBTC'), 'Erc20': '[u8; 20]', 'LiquidCrowdloan': 'u32', 'ForeignAsset': 'u16'}),
'Erc20': '[u8; 20]',
'StableAssetPoolToken': 'u32',
'LiquidCrowdloan': 'u32',
'ForeignAsset': 'u16'
}]



**Full Changelog**: https://github.com/polkascan/py-scale-codec/compare/v1.0.48...v1.1.0a1

1.0.48

What's Changed
* ScaleInfo path changed for BoundedVec by arjanz in https://github.com/polkascan/py-scale-codec/pull/89


**Full Changelog**: https://github.com/polkascan/py-scale-codec/compare/v1.0.47...v1.0.48

Page 3 of 39

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.