Skip to content

Releases: polkascan/py-scale-codec

v1.1.2 release

09 Dec 12:11
76a7f55
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.1.1...v1.1.2

v1.1.1 release

25 Nov 15:01
15818c9
Compare
Choose a tag to compare

What's Changed

  • Added max recursion to type decomposition by @arjanz in #92

Full Changelog: v1.1.0...v1.1.1

v1.1.0 release

24 Nov 16:22
dabd829
Compare
Choose a tag to compare
⚠️ 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

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

14 Nov 15:14
a88e46d
Compare
Choose a tag to compare
v1.1.0a1 release Pre-release
Pre-release
⚠️ 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

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

07 Nov 15:28
1501360
Compare
Choose a tag to compare

What's Changed

  • ScaleInfo path changed for BoundedVec by @arjanz in #89

Full Changelog: v1.0.47...v1.0.48

v1.0.47 release

03 Nov 12:23
8ad5aa3
Compare
Choose a tag to compare

What's Changed

  • GenericVote available for all pallets by @arjanz in #88

Full Changelog: v1.0.46...v1.0.47

v1.0.46 release

20 Oct 12:33
db52093
Compare
Choose a tag to compare

What's Changed

  • Added Acala specific MultiSignature type by @arjanz in #85
  • WeightV2 type

Full Changelog: v1.0.45...v1.0.46

v1.0.45 release

12 Oct 11:49
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.44...v1.0.45

v1.0.44 release

30 Sep 12:30
3c311fc
Compare
Choose a tag to compare

What's Changed

  • Added paths for RuntimeCall and RuntimeEvent by @arjanz in #81

Full Changelog: v1.0.43...v1.0.44

v1.0.43 release

26 Sep 07:50
Compare
Choose a tag to compare

Add RawAuraPreDigest to metadata_types.json - In order to use this type for PortableRegistry runtimes