Allow extensions on typesBundle (#3142)
* Allow extensions on typesBundle * User extension take precedence
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
import type BN from 'bn.js';
|
||||
import type { Text } from '@polkadot/types';
|
||||
import type { ExtDef } from '@polkadot/types/extrinsic/signedExtensions/types';
|
||||
import type { Hash } from '@polkadot/types/interfaces';
|
||||
import type { ChainUpgradeVersion, DefinitionRpc, DefinitionRpcSub, OverrideModuleType, OverrideVersionedType, Registry, RegistryTypes } from '@polkadot/types/types';
|
||||
|
||||
@@ -37,6 +38,19 @@ export function getModuleTypes ({ knownTypes }: Registry, section: string): Over
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable signed extensions (ready for registration)
|
||||
*/
|
||||
export function getSpecExtensions ({ knownTypes }: Registry, chainName: Text | string, specName: Text | string): ExtDef {
|
||||
const _chainName = chainName.toString();
|
||||
const _specName = specName.toString();
|
||||
|
||||
return {
|
||||
...(knownTypes.typesBundle?.spec?.[_specName]?.signedExtensions || {}),
|
||||
...(knownTypes.typesBundle?.chain?.[_chainName]?.signedExtensions || {})
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Based on the chain and runtimeVersion, get the applicable types (ready for registration)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user