Support for Option<bool> 1-byte encoding (#4852)
* Support for Option<bool> 1-byte encoding * Adjust for linting
This commit is contained in:
@@ -774,9 +774,18 @@ export class PortableRegistry extends Struct implements ILookup {
|
||||
const specialVariant = path[0].toString();
|
||||
|
||||
if (specialVariant === 'Option') {
|
||||
const sub = this.#createSiDef(params[0].type.unwrap());
|
||||
|
||||
if (sub.type === 'bool') {
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Plain,
|
||||
type: 'OptionBool'
|
||||
});
|
||||
}
|
||||
|
||||
return withTypeString(this.registry, {
|
||||
info: TypeDefInfo.Option,
|
||||
sub: this.#createSiDef(params[0].type.unwrap())
|
||||
sub
|
||||
});
|
||||
} else if (specialVariant === 'Result') {
|
||||
return withTypeString(this.registry, {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
/**
|
||||
* @summary Type definitions that are used in the system
|
||||
*/
|
||||
export { BitVec, bool, Bool, Bytes, i8, I8, i16, I16, i32, I32, i64, I64, i128, I128, i256, I256, Null, Text, Type, u8, U8, u16, U16, u32, U32, u64, U64, u128, U128, u256, U256, usize, USize } from '@polkadot/types-codec';
|
||||
export { BitVec, bool, Bool, Bytes, i8, I8, i16, I16, i32, I32, i64, I64, i128, I128, i256, I256, Null, OptionBool, Text, Type, u8, U8, u16, U16, u32, U32, u64, U64, u128, U128, u256, U256, usize, USize } from '@polkadot/types-codec';
|
||||
|
||||
export { Data } from './Data';
|
||||
export { StorageKey } from './StorageKey';
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { InterfaceTypes } from '@polkadot/types/types';
|
||||
import type { BTreeMap, BTreeSet, Bytes, CodecSet, Compact, Enum, HashMap, Linkage, Null, Option, Range, RangeInclusive, Result, Struct, u8, U8aFixed, Vec, VecFixed } from '@polkadot/types-codec';
|
||||
import type { bool, BTreeMap, BTreeSet, Bytes, CodecSet, Compact, Enum, HashMap, Linkage, Null, Option, OptionBool, Range, RangeInclusive, Result, Struct, u8, U8aFixed, Vec, VecFixed } from '@polkadot/types-codec';
|
||||
import type { Codec, ICompact, IEnum, IMap, IMethod, INumber, IOption, IResult, ISet, IStruct, ITuple, IU8a, IVec } from '@polkadot/types-codec/types';
|
||||
|
||||
export type DetectCodec<T extends Codec, K extends string> =
|
||||
@@ -37,7 +37,7 @@ export type __MapWrapOne<C extends Codec> = {
|
||||
'BTreeSet<': BTreeSet<C>;
|
||||
'Compact<': C extends INumber ? Compact<C> : Codec;
|
||||
'Linkage<': Linkage<C>;
|
||||
'Option<': Option<C>;
|
||||
'Option<': C extends bool ? OptionBool : Option<C>;
|
||||
'Range<': C extends INumber ? Range<C> : Codec;
|
||||
'RangeInclusive<': C extends INumber ? RangeInclusive<C> : Codec;
|
||||
'Vec<': C extends u8 ? Bytes : Vec<C>;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import type { Observable } from 'rxjs';
|
||||
import type { BitVec, Bool, bool, Bytes, I8, i8, I16, i16, I32, i32, I64, i64, I128, i128, I256, i256, Json, Null, Raw, Text, Type, U8, u8, U16, u16, U32, u32, U64, u64, U128, u128, U256, u256, USize, usize } from '@polkadot/types-codec';
|
||||
import type { BitVec, Bool, bool, Bytes, I8, i8, I16, i16, I32, i32, I64, i64, I128, i128, I256, i256, Json, Null, OptionBool, Raw, Text, Type, U8, u8, U16, u16, U32, u32, U64, u64, U128, u128, U256, u256, USize, usize } from '@polkadot/types-codec';
|
||||
import type { RegistryTypes } from '@polkadot/types-codec/types';
|
||||
import type { BN } from '@polkadot/util';
|
||||
import type { GenericExtrinsic, GenericExtrinsicEra, GenericExtrinsicPayload, GenericSignerPayload } from '../extrinsic';
|
||||
@@ -18,7 +18,7 @@ export type { Registry, RegistryError, RegistryTypes } from '@polkadot/types-cod
|
||||
|
||||
export interface InterfaceTypes {
|
||||
// base codec
|
||||
BitVec: BitVec, Bool: Bool, Bytes: Bytes, I128: I128, I16: I16, I256: I256, I32: I32, I64: I64, I8: I8, Json: Json, Null: Null, Raw: Raw, Text: Text, Type: Type, U128: U128, U16: U16, U256: U256, U32: U32, U64: U64, U8: U8, USize: USize, bool: bool, i128: i128, i16: i16, i256: i256, i32: i32, i64: i64, i8: i8, u128: u128, u16: u16, u256: u256, u32: u32, u64: u64, u8: u8, usize: usize,
|
||||
BitVec: BitVec, Bool: Bool, Bytes: Bytes, I128: I128, I16: I16, I256: I256, I32: I32, I64: I64, I8: I8, Json: Json, Null: Null, OptionBool: OptionBool, Raw: Raw, Text: Text, Type: Type, U128: U128, U16: U16, U256: U256, U32: U32, U64: U64, U8: U8, USize: USize, bool: bool, i128: i128, i16: i16, i256: i256, i32: i32, i64: i64, i8: i8, u128: u128, u16: u16, u256: u256, u32: u32, u64: u64, u8: u8, usize: usize,
|
||||
// extrinsic
|
||||
Extrinsic: GenericExtrinsic, ExtrinsicEra: GenericExtrinsicEra, ExtrinsicPayload: GenericExtrinsicPayload, SignerPayload: GenericSignerPayload,
|
||||
// generic
|
||||
|
||||
Reference in New Issue
Block a user