Provide mapping for LookupSource & LookupTarget (#1823)
* Provide mapping for LookupSource & LookupTarget * Type overrides for Kusama-next * Fix LookupSource for Kusama-next * Fixup tests with lookup
This commit is contained in:
@@ -181,10 +181,10 @@ describe('getTypeDef', (): void => {
|
||||
getTypeDef('Vec<(Box<PropIndex>, Proposal,Lookup::Target)>')
|
||||
).toEqual({
|
||||
info: TypeDefInfo.Vec,
|
||||
type: 'Vec<(PropIndex,Proposal,AccountId)>',
|
||||
type: 'Vec<(PropIndex,Proposal,LookupTarget)>',
|
||||
sub: {
|
||||
info: TypeDefInfo.Tuple,
|
||||
type: '(PropIndex,Proposal,AccountId)',
|
||||
type: '(PropIndex,Proposal,LookupTarget)',
|
||||
sub: [
|
||||
{
|
||||
info: TypeDefInfo.Plain,
|
||||
@@ -196,7 +196,7 @@ describe('getTypeDef', (): void => {
|
||||
},
|
||||
{
|
||||
info: TypeDefInfo.Plain,
|
||||
type: 'AccountId'
|
||||
type: 'LookupTarget'
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -29,10 +29,9 @@ const mappings: Mapper[] = [
|
||||
_alias('&\\[u8\\]', 'Bytes'),
|
||||
// alias RawAddress -> Address
|
||||
_alias('RawAddress', 'Address'),
|
||||
// alias Lookup::Source to Address (_could_ be AccountId on certain chains)
|
||||
_alias('Lookup::Source', 'Address'),
|
||||
// alias Lookup::Target to AccountId (always the case)
|
||||
_alias('Lookup::Target', 'AccountId'),
|
||||
// lookups, mapped to Address/AccountId as appropriate in runtime
|
||||
_alias('Lookup::Source', 'LookupSource'),
|
||||
_alias('Lookup::Target', 'LookupTarget'),
|
||||
// alias for grandpa internal, as used in polkadot
|
||||
_alias('grandpa::', ''),
|
||||
// specific for session internal
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import { Compact, Option, Raw, Vec } from '@polkadot/types/codec';
|
||||
import { Bytes, Data, Fixed64, H160, H256, H512, IdentityFields, Null, StorageData, StorageKey, Text, Type, U256, bool, i128, i16, i256, i32, i64, i8, u128, u16, u256, u32, u64, u8, usize } from '@polkadot/types/primitive';
|
||||
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
|
||||
import { AccountId, AccountIdOf, AccountIndex, Address, AssetId, Balance, BalanceOf, Block, BlockNumber, Call, ChangesTrieConfiguration, Consensus, ConsensusEngineId, Digest, DigestItem, DispatchClass, DispatchInfo, DispatchInfoTo190, EcdsaSignature, Ed25519Signature, Extrinsic, ExtrinsicEra, ExtrinsicPayload, ExtrinsicPayloadUnknown, ExtrinsicPayloadV1, ExtrinsicPayloadV2, ExtrinsicPayloadV3, ExtrinsicPayloadV4, ExtrinsicSignatureV1, ExtrinsicSignatureV2, ExtrinsicSignatureV3, ExtrinsicSignatureV4, ExtrinsicUnknown, ExtrinsicV1, ExtrinsicV2, ExtrinsicV3, ExtrinsicV4, Hash, Header, ImmortalEra, Index, Justification, KeyTypeId, KeyValue, LockIdentifier, LookupSource, LookupTarget, Moment, MortalEra, MultiSignature, Origin, Perbill, Percent, Permill, Perquintill, Phantom, PhantomData, PreRuntime, Seal, SealV0, Signature, SignedBlock, SignerPayload, Sr25519Signature, ValidatorId, Weight, WeightMultiplier } from '@polkadot/types/interfaces/runtime';
|
||||
import { InclusionHeight, Uncle, UncleEntryItem } from '@polkadot/types/interfaces/authorship';
|
||||
import { RawAuraPreDigest } from '@polkadot/types/interfaces/aura';
|
||||
import { BabeAuthorityWeight, BabeBlockWeight, BabeWeight, MaybeVrf, RawBabePreDigest, RawBabePreDigestCompat, RawBabePreDigestPrimary, RawBabePreDigestPrimaryTo159, RawBabePreDigestSecondary, RawBabePreDigestSecondaryTo159, RawBabePreDigestTo159, SlotNumber, VrfData, VrfProof } from '@polkadot/types/interfaces/babe';
|
||||
@@ -258,6 +258,12 @@ export interface InterfaceRegistry {
|
||||
LockIdentifier: LockIdentifier;
|
||||
'Option<LockIdentifier>': Option<LockIdentifier>;
|
||||
'Vec<LockIdentifier>': Vec<LockIdentifier>;
|
||||
LookupSource: LookupSource;
|
||||
'Option<LookupSource>': Option<LookupSource>;
|
||||
'Vec<LookupSource>': Vec<LookupSource>;
|
||||
LookupTarget: LookupTarget;
|
||||
'Option<LookupTarget>': Option<LookupTarget>;
|
||||
'Vec<LookupTarget>': Vec<LookupTarget>;
|
||||
Moment: Moment;
|
||||
'Compact<Moment>': Compact<Moment>;
|
||||
'Option<Moment>': Option<Moment>;
|
||||
|
||||
@@ -68,6 +68,8 @@ export default {
|
||||
KeyValue: '(StorageKey, StorageData)',
|
||||
KeyTypeId: 'u32',
|
||||
LockIdentifier: '[u8; 8]',
|
||||
LookupSource: 'Address',
|
||||
LookupTarget: 'AccountId',
|
||||
Moment: 'u64',
|
||||
Origin: 'GenericOrigin',
|
||||
Perbill: 'u32',
|
||||
|
||||
@@ -159,6 +159,12 @@ export interface KeyValue extends ITuple<[StorageKey, StorageData]> {}
|
||||
/** @name LockIdentifier */
|
||||
export interface LockIdentifier extends Uint8Array, Codec {}
|
||||
|
||||
/** @name LookupSource */
|
||||
export interface LookupSource extends Address {}
|
||||
|
||||
/** @name LookupTarget */
|
||||
export interface LookupTarget extends AccountId {}
|
||||
|
||||
/** @name Moment */
|
||||
export interface Moment extends u64 {}
|
||||
|
||||
|
||||
@@ -12,6 +12,9 @@ const TYPES_MODULES: Record<string, OverrideModuleType> = {
|
||||
identity: {
|
||||
Judgement: 'IdentityJudgement'
|
||||
},
|
||||
parachains: {
|
||||
Id: 'ParaId'
|
||||
},
|
||||
society: {
|
||||
Judgement: 'SocietyJudgement',
|
||||
Vote: 'SocietyVote'
|
||||
@@ -41,6 +44,7 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
DispatchError: 'DispatchErrorTo198',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'Address',
|
||||
SlashingSpans: 'SlashingSpansTo204'
|
||||
}
|
||||
},
|
||||
@@ -49,14 +53,23 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
|
||||
types: {
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'Address',
|
||||
SlashingSpans: 'SlashingSpansTo204'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [1043, undefined],
|
||||
minmax: [1043, 1045],
|
||||
types: {
|
||||
BalanceLock: 'BalanceLockTo212',
|
||||
Keys: 'SessionKeys5'
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'Address'
|
||||
}
|
||||
},
|
||||
{
|
||||
minmax: [1046, undefined],
|
||||
types: {
|
||||
Keys: 'SessionKeys5',
|
||||
LookupSource: 'AccountId'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user