@polkadot/types-create
Advanced tools
Comparing version 10.1.3 to 10.1.4
@@ -51,7 +51,7 @@ "use strict"; | ||
const infoMapping = { | ||
[index_js_1.TypeDefInfo.BTreeMap]: (registry, value) => createHashMap(types_codec_1.BTreeMap, value), | ||
[index_js_1.TypeDefInfo.BTreeSet]: (registry, value) => createWithSub(types_codec_1.BTreeSet, value), | ||
[index_js_1.TypeDefInfo.Compact]: (registry, value) => createWithSub(types_codec_1.Compact, value), | ||
[index_js_1.TypeDefInfo.DoNotConstruct]: (registry, value) => types_codec_1.DoNotConstruct.with(value.displayName || value.type), | ||
[index_js_1.TypeDefInfo.Enum]: (registry, value) => { | ||
[index_js_1.TypeDefInfo.BTreeMap]: (_registry, value) => createHashMap(types_codec_1.BTreeMap, value), | ||
[index_js_1.TypeDefInfo.BTreeSet]: (_registry, value) => createWithSub(types_codec_1.BTreeSet, value), | ||
[index_js_1.TypeDefInfo.Compact]: (_registry, value) => createWithSub(types_codec_1.Compact, value), | ||
[index_js_1.TypeDefInfo.DoNotConstruct]: (_registry, value) => types_codec_1.DoNotConstruct.with(value.displayName || value.type), | ||
[index_js_1.TypeDefInfo.Enum]: (_registry, value) => { | ||
const subs = getSubDefArray(value); | ||
@@ -65,6 +65,6 @@ return types_codec_1.Enum.with(subs.every(({ type }) => type === 'Null') | ||
}, | ||
[index_js_1.TypeDefInfo.HashMap]: (registry, value) => createHashMap(types_codec_1.HashMap, value), | ||
[index_js_1.TypeDefInfo.Int]: (registry, value) => createInt(types_codec_1.Int, value), | ||
[index_js_1.TypeDefInfo.HashMap]: (_registry, value) => createHashMap(types_codec_1.HashMap, value), | ||
[index_js_1.TypeDefInfo.Int]: (_registry, value) => createInt(types_codec_1.Int, value), | ||
// We have circular deps between Linkage & Struct | ||
[index_js_1.TypeDefInfo.Linkage]: (registry, value) => { | ||
[index_js_1.TypeDefInfo.Linkage]: (_registry, value) => { | ||
const type = `Option<${getSubType(value)}>`; | ||
@@ -80,5 +80,4 @@ // eslint-disable-next-line sort-keys | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[index_js_1.TypeDefInfo.Null]: (registry, _) => types_codec_1.Null, | ||
[index_js_1.TypeDefInfo.Option]: (registry, value) => { | ||
[index_js_1.TypeDefInfo.Null]: (_registry, _value) => types_codec_1.Null, | ||
[index_js_1.TypeDefInfo.Option]: (_registry, value) => { | ||
if (!value.sub || Array.isArray(value.sub)) { | ||
@@ -94,5 +93,5 @@ throw new Error('Expected type information for Option'); | ||
[index_js_1.TypeDefInfo.Plain]: (registry, value) => registry.getOrUnknown(value.type), | ||
[index_js_1.TypeDefInfo.Range]: (registry, value) => createWithSub(types_codec_1.Range, value), | ||
[index_js_1.TypeDefInfo.RangeInclusive]: (registry, value) => createWithSub(types_codec_1.RangeInclusive, value), | ||
[index_js_1.TypeDefInfo.Result]: (registry, value) => { | ||
[index_js_1.TypeDefInfo.Range]: (_registry, value) => createWithSub(types_codec_1.Range, value), | ||
[index_js_1.TypeDefInfo.RangeInclusive]: (_registry, value) => createWithSub(types_codec_1.RangeInclusive, value), | ||
[index_js_1.TypeDefInfo.Result]: (_registry, value) => { | ||
const [Ok, Err] = getTypeClassArray(value); | ||
@@ -102,3 +101,3 @@ // eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
}, | ||
[index_js_1.TypeDefInfo.Set]: (registry, value) => types_codec_1.CodecSet.with(getSubDefArray(value).reduce((result, { index, name }) => { | ||
[index_js_1.TypeDefInfo.Set]: (_registry, value) => types_codec_1.CodecSet.with(getSubDefArray(value).reduce((result, { index, name }) => { | ||
result[name] = index; | ||
@@ -108,6 +107,6 @@ return result; | ||
[index_js_1.TypeDefInfo.Si]: (registry, value) => getTypeClass(registry, registry.lookup.getTypeDef(value.type)), | ||
[index_js_1.TypeDefInfo.Struct]: (registry, value) => types_codec_1.Struct.with(getTypeClassMap(value), value.alias), | ||
[index_js_1.TypeDefInfo.Tuple]: (registry, value) => types_codec_1.Tuple.with(getTypeClassArray(value)), | ||
[index_js_1.TypeDefInfo.UInt]: (registry, value) => createInt(types_codec_1.UInt, value), | ||
[index_js_1.TypeDefInfo.Vec]: (registry, { sub }) => { | ||
[index_js_1.TypeDefInfo.Struct]: (_registry, value) => types_codec_1.Struct.with(getTypeClassMap(value), value.alias), | ||
[index_js_1.TypeDefInfo.Tuple]: (_registry, value) => types_codec_1.Tuple.with(getTypeClassArray(value)), | ||
[index_js_1.TypeDefInfo.UInt]: (_registry, value) => createInt(types_codec_1.UInt, value), | ||
[index_js_1.TypeDefInfo.Vec]: (_registry, { sub }) => { | ||
if (!sub || Array.isArray(sub)) { | ||
@@ -120,3 +119,3 @@ throw new Error('Expected type information for vector'); | ||
}, | ||
[index_js_1.TypeDefInfo.VecFixed]: (registry, { displayName, length, sub }) => { | ||
[index_js_1.TypeDefInfo.VecFixed]: (_registry, { displayName, length, sub }) => { | ||
if (!(0, util_1.isNumber)(length) || !sub || Array.isArray(sub)) { | ||
@@ -129,4 +128,4 @@ throw new Error('Expected length & type information for fixed vector'); | ||
}, | ||
[index_js_1.TypeDefInfo.WrapperKeepOpaque]: (registry, value) => createWithSub(types_codec_1.WrapperKeepOpaque, value), | ||
[index_js_1.TypeDefInfo.WrapperOpaque]: (registry, value) => createWithSub(types_codec_1.WrapperOpaque, value) | ||
[index_js_1.TypeDefInfo.WrapperKeepOpaque]: (_registry, value) => createWithSub(types_codec_1.WrapperKeepOpaque, value), | ||
[index_js_1.TypeDefInfo.WrapperOpaque]: (_registry, value) => createWithSub(types_codec_1.WrapperOpaque, value) | ||
}; | ||
@@ -133,0 +132,0 @@ function constructTypeClass(registry, typeDef) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.packageInfo = void 0; | ||
exports.packageInfo = { name: '@polkadot/types-create', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.1.3' }; | ||
exports.packageInfo = { name: '@polkadot/types-create', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '10.1.4' }; |
@@ -63,14 +63,11 @@ "use strict"; | ||
[index_js_1.TypeDefInfo.HashMap]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'HashMap'), | ||
[index_js_1.TypeDefInfo.Int]: (registry, { length = 32 }) => `Int<${length}>`, | ||
[index_js_1.TypeDefInfo.Int]: (_registry, { length = 32 }) => `Int<${length}>`, | ||
[index_js_1.TypeDefInfo.Linkage]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Linkage'), | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[index_js_1.TypeDefInfo.Null]: (registry, typeDef) => 'Null', | ||
[index_js_1.TypeDefInfo.Null]: (_registry, _typeDef) => 'Null', | ||
[index_js_1.TypeDefInfo.Option]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Option'), | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[index_js_1.TypeDefInfo.Plain]: (registry, { displayName, type }) => displayName || type, | ||
[index_js_1.TypeDefInfo.Plain]: (_registry, { displayName, type }) => displayName || type, | ||
[index_js_1.TypeDefInfo.Range]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Range'), | ||
[index_js_1.TypeDefInfo.RangeInclusive]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'RangeInclusive'), | ||
[index_js_1.TypeDefInfo.Result]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Result'), | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[index_js_1.TypeDefInfo.Set]: (registry, { length = 8, sub }) => { | ||
[index_js_1.TypeDefInfo.Set]: (_registry, { length = 8, sub }) => { | ||
if (!Array.isArray(sub)) { | ||
@@ -83,4 +80,3 @@ throw new Error('Unable to encode Set type'); | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[index_js_1.TypeDefInfo.Si]: (registry, { lookupName, type }) => lookupName || type, | ||
[index_js_1.TypeDefInfo.Si]: (_registry, { lookupName, type }) => lookupName || type, | ||
[index_js_1.TypeDefInfo.Struct]: (registry, { alias, sub }) => { | ||
@@ -102,5 +98,5 @@ if (!Array.isArray(sub)) { | ||
}, | ||
[index_js_1.TypeDefInfo.UInt]: (registry, { length = 32 }) => `UInt<${length}>`, | ||
[index_js_1.TypeDefInfo.UInt]: (_registry, { length = 32 }) => `UInt<${length}>`, | ||
[index_js_1.TypeDefInfo.Vec]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Vec'), | ||
[index_js_1.TypeDefInfo.VecFixed]: (registry, { length, sub }) => { | ||
[index_js_1.TypeDefInfo.VecFixed]: (_registry, { length, sub }) => { | ||
if (!(0, util_1.isNumber)(length) || !sub || Array.isArray(sub)) { | ||
@@ -107,0 +103,0 @@ throw new Error('Unable to encode VecFixed type'); |
@@ -48,7 +48,7 @@ import { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, DoNotConstruct, Enum, HashMap, Int, Null, Option, Range, RangeInclusive, Result, Struct, Tuple, U8aFixed, UInt, Vec, VecFixed, WrapperKeepOpaque, WrapperOpaque } from '@polkadot/types-codec'; | ||
const infoMapping = { | ||
[TypeDefInfo.BTreeMap]: (registry, value) => createHashMap(BTreeMap, value), | ||
[TypeDefInfo.BTreeSet]: (registry, value) => createWithSub(BTreeSet, value), | ||
[TypeDefInfo.Compact]: (registry, value) => createWithSub(Compact, value), | ||
[TypeDefInfo.DoNotConstruct]: (registry, value) => DoNotConstruct.with(value.displayName || value.type), | ||
[TypeDefInfo.Enum]: (registry, value) => { | ||
[TypeDefInfo.BTreeMap]: (_registry, value) => createHashMap(BTreeMap, value), | ||
[TypeDefInfo.BTreeSet]: (_registry, value) => createWithSub(BTreeSet, value), | ||
[TypeDefInfo.Compact]: (_registry, value) => createWithSub(Compact, value), | ||
[TypeDefInfo.DoNotConstruct]: (_registry, value) => DoNotConstruct.with(value.displayName || value.type), | ||
[TypeDefInfo.Enum]: (_registry, value) => { | ||
const subs = getSubDefArray(value); | ||
@@ -62,6 +62,6 @@ return Enum.with(subs.every(({ type }) => type === 'Null') | ||
}, | ||
[TypeDefInfo.HashMap]: (registry, value) => createHashMap(HashMap, value), | ||
[TypeDefInfo.Int]: (registry, value) => createInt(Int, value), | ||
[TypeDefInfo.HashMap]: (_registry, value) => createHashMap(HashMap, value), | ||
[TypeDefInfo.Int]: (_registry, value) => createInt(Int, value), | ||
// We have circular deps between Linkage & Struct | ||
[TypeDefInfo.Linkage]: (registry, value) => { | ||
[TypeDefInfo.Linkage]: (_registry, value) => { | ||
const type = `Option<${getSubType(value)}>`; | ||
@@ -77,5 +77,4 @@ // eslint-disable-next-line sort-keys | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[TypeDefInfo.Null]: (registry, _) => Null, | ||
[TypeDefInfo.Option]: (registry, value) => { | ||
[TypeDefInfo.Null]: (_registry, _value) => Null, | ||
[TypeDefInfo.Option]: (_registry, value) => { | ||
if (!value.sub || Array.isArray(value.sub)) { | ||
@@ -91,5 +90,5 @@ throw new Error('Expected type information for Option'); | ||
[TypeDefInfo.Plain]: (registry, value) => registry.getOrUnknown(value.type), | ||
[TypeDefInfo.Range]: (registry, value) => createWithSub(Range, value), | ||
[TypeDefInfo.RangeInclusive]: (registry, value) => createWithSub(RangeInclusive, value), | ||
[TypeDefInfo.Result]: (registry, value) => { | ||
[TypeDefInfo.Range]: (_registry, value) => createWithSub(Range, value), | ||
[TypeDefInfo.RangeInclusive]: (_registry, value) => createWithSub(RangeInclusive, value), | ||
[TypeDefInfo.Result]: (_registry, value) => { | ||
const [Ok, Err] = getTypeClassArray(value); | ||
@@ -99,3 +98,3 @@ // eslint-disable-next-line @typescript-eslint/no-use-before-define | ||
}, | ||
[TypeDefInfo.Set]: (registry, value) => CodecSet.with(getSubDefArray(value).reduce((result, { index, name }) => { | ||
[TypeDefInfo.Set]: (_registry, value) => CodecSet.with(getSubDefArray(value).reduce((result, { index, name }) => { | ||
result[name] = index; | ||
@@ -105,6 +104,6 @@ return result; | ||
[TypeDefInfo.Si]: (registry, value) => getTypeClass(registry, registry.lookup.getTypeDef(value.type)), | ||
[TypeDefInfo.Struct]: (registry, value) => Struct.with(getTypeClassMap(value), value.alias), | ||
[TypeDefInfo.Tuple]: (registry, value) => Tuple.with(getTypeClassArray(value)), | ||
[TypeDefInfo.UInt]: (registry, value) => createInt(UInt, value), | ||
[TypeDefInfo.Vec]: (registry, { sub }) => { | ||
[TypeDefInfo.Struct]: (_registry, value) => Struct.with(getTypeClassMap(value), value.alias), | ||
[TypeDefInfo.Tuple]: (_registry, value) => Tuple.with(getTypeClassArray(value)), | ||
[TypeDefInfo.UInt]: (_registry, value) => createInt(UInt, value), | ||
[TypeDefInfo.Vec]: (_registry, { sub }) => { | ||
if (!sub || Array.isArray(sub)) { | ||
@@ -117,3 +116,3 @@ throw new Error('Expected type information for vector'); | ||
}, | ||
[TypeDefInfo.VecFixed]: (registry, { displayName, length, sub }) => { | ||
[TypeDefInfo.VecFixed]: (_registry, { displayName, length, sub }) => { | ||
if (!isNumber(length) || !sub || Array.isArray(sub)) { | ||
@@ -126,4 +125,4 @@ throw new Error('Expected length & type information for fixed vector'); | ||
}, | ||
[TypeDefInfo.WrapperKeepOpaque]: (registry, value) => createWithSub(WrapperKeepOpaque, value), | ||
[TypeDefInfo.WrapperOpaque]: (registry, value) => createWithSub(WrapperOpaque, value) | ||
[TypeDefInfo.WrapperKeepOpaque]: (_registry, value) => createWithSub(WrapperKeepOpaque, value), | ||
[TypeDefInfo.WrapperOpaque]: (_registry, value) => createWithSub(WrapperOpaque, value) | ||
}; | ||
@@ -130,0 +129,0 @@ export function constructTypeClass(registry, typeDef) { |
@@ -21,3 +21,3 @@ { | ||
"type": "module", | ||
"version": "10.1.3", | ||
"version": "10.1.4", | ||
"main": "./cjs/index.js", | ||
@@ -125,6 +125,6 @@ "module": "./index.js", | ||
"dependencies": { | ||
"@polkadot/types-codec": "10.1.3", | ||
"@polkadot/util": "^11.0.2", | ||
"@polkadot/types-codec": "10.1.4", | ||
"@polkadot/util": "^11.1.1", | ||
"tslib": "^2.5.0" | ||
} | ||
} |
@@ -1,1 +0,1 @@ | ||
export const packageInfo = { name: '@polkadot/types-create', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.1.3' }; | ||
export const packageInfo = { name: '@polkadot/types-create', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '10.1.4' }; |
@@ -59,14 +59,11 @@ import { isNumber, isUndefined, objectSpread, stringify } from '@polkadot/util'; | ||
[TypeDefInfo.HashMap]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'HashMap'), | ||
[TypeDefInfo.Int]: (registry, { length = 32 }) => `Int<${length}>`, | ||
[TypeDefInfo.Int]: (_registry, { length = 32 }) => `Int<${length}>`, | ||
[TypeDefInfo.Linkage]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Linkage'), | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[TypeDefInfo.Null]: (registry, typeDef) => 'Null', | ||
[TypeDefInfo.Null]: (_registry, _typeDef) => 'Null', | ||
[TypeDefInfo.Option]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Option'), | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[TypeDefInfo.Plain]: (registry, { displayName, type }) => displayName || type, | ||
[TypeDefInfo.Plain]: (_registry, { displayName, type }) => displayName || type, | ||
[TypeDefInfo.Range]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Range'), | ||
[TypeDefInfo.RangeInclusive]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'RangeInclusive'), | ||
[TypeDefInfo.Result]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Result'), | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[TypeDefInfo.Set]: (registry, { length = 8, sub }) => { | ||
[TypeDefInfo.Set]: (_registry, { length = 8, sub }) => { | ||
if (!Array.isArray(sub)) { | ||
@@ -79,4 +76,3 @@ throw new Error('Unable to encode Set type'); | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
[TypeDefInfo.Si]: (registry, { lookupName, type }) => lookupName || type, | ||
[TypeDefInfo.Si]: (_registry, { lookupName, type }) => lookupName || type, | ||
[TypeDefInfo.Struct]: (registry, { alias, sub }) => { | ||
@@ -98,5 +94,5 @@ if (!Array.isArray(sub)) { | ||
}, | ||
[TypeDefInfo.UInt]: (registry, { length = 32 }) => `UInt<${length}>`, | ||
[TypeDefInfo.UInt]: (_registry, { length = 32 }) => `UInt<${length}>`, | ||
[TypeDefInfo.Vec]: (registry, typeDef) => encodeWithParams(registry, typeDef, 'Vec'), | ||
[TypeDefInfo.VecFixed]: (registry, { length, sub }) => { | ||
[TypeDefInfo.VecFixed]: (_registry, { length, sub }) => { | ||
if (!isNumber(length) || !sub || Array.isArray(sub)) { | ||
@@ -103,0 +99,0 @@ throw new Error('Unable to encode VecFixed type'); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76243
1462
+ Added@polkadot/types-codec@10.1.4(transitive)
- Removed@polkadot/types-codec@10.1.3(transitive)
Updated@polkadot/types-codec@10.1.4
Updated@polkadot/util@^11.1.1