Class: Scale::Types::MetadataV4Module
- Inherits:
-
Object
- Object
- Scale::Types::MetadataV4Module
- Includes:
- Base
- Defined in:
- lib/metadata/metadata_v4.rb
Instance Attribute Summary
Attributes included from Base
Class Method Summary collapse
Methods included from Base
#==, included, #initialize, #to_human
Class Method Details
.decode(scale_bytes) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/metadata/metadata_v4.rb', line 53 def self.decode(scale_bytes) name = String.decode(scale_bytes).value prefix = String.decode(scale_bytes).value result = { name: name, prefix: prefix } has_storage = Bool.decode(scale_bytes).value if has_storage storages = Scale::Types.get("Vec<MetadataV4ModuleStorage>").decode(scale_bytes).value result[:storage] = storages.map(&:value) end has_calls = Bool.decode(scale_bytes).value if has_calls calls = Scale::Types.get("Vec<MetadataModuleCall>").decode(scale_bytes).value result[:calls] = calls.map(&:value) end has_events = Bool.decode(scale_bytes).value if has_events events = Scale::Types.get("Vec<MetadataModuleEvent>").decode(scale_bytes).value result[:events] = events.map(&:value) end MetadataV4Module.new(result) end |