Releases: polkascan/py-scale-codec
Releases · polkascan/py-scale-codec
v1.1.2 release
v1.1.1 release
What's Changed
Full Changelog: v1.1.0...v1.1.1
v1.1.0 release
Potential breaking changes
- Type registry
default
renamed tolegacy
(for runtimes prior toMetadataV14
) - Type registry
metadata_types
renamed tocore
(for runtimesMetadataV14
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 adict
with named fields (for exampleEventRecord
).
What's Changed
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
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
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: v1.0.48...v1.1.0
v1.1.0a1 release
Potential breaking changes
- Type registry
default
renamed tolegacy
(for runtimes prior toMetadataV14
) - Type registry
metadata_types
renamed tocore
(for runtimesMetadataV14
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 adict
with named fields.
What's Changed
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
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
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: v1.0.48...v1.1.0a1
v1.0.48 release
What's Changed
Full Changelog: v1.0.47...v1.0.48
v1.0.47 release
What's Changed
Full Changelog: v1.0.46...v1.0.47
v1.0.46 release
What's Changed
Full Changelog: v1.0.45...v1.0.46
v1.0.45 release
What's Changed
- Extended type path wildcard search (Thanks to @Neopallium)
- Added new ink! path by @arjanz in #83
Full Changelog: v1.0.44...v1.0.45
v1.0.44 release
What's Changed
Full Changelog: v1.0.43...v1.0.44
v1.0.43 release
Add RawAuraPreDigest
to metadata_types.json - In order to use this type for PortableRegistry
runtimes