Sha256: d7f378b2c156d08d18664207dba68076090803350c25cf37ad5600a0fdb5f09a

Contents?: true

Size: 1.58 KB

Versions: 9

Compression:

Stored size: 1.58 KB

Contents

# frozen_string_literal: true

module Metadata
  module MetadataV12
    class << self
      def get_module(module_name, metadata)
        metadata._get(:metadata)._get(:v12)._get(:modules).find do |m|
          m._get(:name) == module_name
        end
      end

      def get_storage_item(module_name, item_name, metadata)
        modula = get_module(module_name, metadata)
        raise "Module `#{module_name}` not found" if modula.nil?
        modula._get(:storage)._get(:items).find do |item|
          item._get(:name) == item_name
        end
      end
    end

    TYPES = {
      ErrorMetadataV12: 'ErrorMetadataV11',
      EventMetadataV12: 'EventMetadataV11',
      ExtrinsicMetadataV12: 'ExtrinsicMetadataV11',
      FunctionArgumentMetadataV12: 'FunctionArgumentMetadataV11',
      FunctionMetadataV12: 'FunctionMetadataV11',
      MetadataV12: {
        modules: 'Vec<ModuleMetadataV12>',
        extrinsic: 'ExtrinsicMetadataV12'
      },
      ModuleConstantMetadataV12: 'ModuleConstantMetadataV11',
      ModuleMetadataV12: {
        name: 'Text',
        storage: 'Option<StorageMetadataV12>',
        calls: 'Option<Vec<FunctionMetadataV12>>',
        events: 'Option<Vec<EventMetadataV12>>',
        constants: 'Vec<ModuleConstantMetadataV12>',
        errors: 'Vec<ErrorMetadataV12>',
        index: 'u8'
      },
      StorageEntryModifierV12: 'StorageEntryModifierV11',
      StorageEntryMetadataV12: 'StorageEntryMetadataV11',
      StorageEntryTypeV12: 'StorageEntryTypeV11',
      StorageMetadataV12: 'StorageMetadataV11',
      StorageHasherV12: 'StorageHasherV11'
    }.freeze
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
scale_rb-0.1.15 lib/metadata/metadata_v12.rb
scale_rb-0.1.14 lib/metadata/metadata_v12.rb
scale_rb-0.1.13 lib/metadata/metadata_v12.rb
scale_rb-0.1.11 lib/metadata/metadata_v12.rb
scale_rb-0.1.10 lib/metadata/metadata_v12.rb
scale_rb-0.1.9 lib/metadata/metadata_v12.rb
scale_rb-0.1.8 lib/metadata/metadata_v12.rb
scale_rb-0.1.7 lib/metadata/metadata_v12.rb
scale_rb-0.1.6 lib/metadata/metadata_v12.rb