Allow null values in bundles min/max (#3950)

* Allow null values in bundles min/max

* Adjust bundle type definition

* Backwards compat

* Lenient types
This commit is contained in:
Jaco
2021-09-14 08:43:56 +02:00
committed by GitHub
parent 367efda128
commit febcabe109
4 changed files with 14 additions and 5 deletions
+3 -3
View File
@@ -7,7 +7,7 @@ import type { Hash } from '@polkadot/types/interfaces';
import type { ChainUpgradeVersion, CodecHasher, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '@polkadot/types/types';
import type { BN } from '@polkadot/util';
import { bnToBn, isUndefined } from '@polkadot/util';
import { bnToBn, isNull, isUndefined } from '@polkadot/util';
import typesChain from './chain';
import typesModules from './modules';
@@ -22,8 +22,8 @@ export { packageInfo } from './packageInfo';
function filterVersions (versions: OverrideVersionedType[] = [], specVersion: number): RegistryTypes {
return versions
.filter(({ minmax: [min, max] }) =>
(isUndefined(min) || specVersion >= min) &&
(isUndefined(max) || specVersion <= max)
(isUndefined(min) || isNull(min) || specVersion >= min) &&
(isUndefined(max) || isNull(max) || specVersion <= max)
)
.reduce((result: RegistryTypes, { types }): RegistryTypes => ({
...result,