Alias Address -> AccountId for polkadot/kusama (#1825)

* Swap Address -> LookupSource (correct aliasses)

* Adjust overrides with explicit LookupSource

* Map Lookup{Source,Target}

* Adjust overrides

* Comment Address -> AccountId (for now)

* Fix typo in comments

* Map Address -> AccountId

* CHANGELOG
This commit is contained in:
Jaco Greeff
2020-02-10 18:44:12 +01:00
committed by GitHub
parent cab5b8bff7
commit 6581d779c7
4 changed files with 36 additions and 27 deletions
+10 -6
View File
@@ -32,6 +32,8 @@ const TYPES_POLKADOT_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1000, undefined], // from launch
types: {
// Indices optional, not in transaction
Address: 'AccountId',
Keys: 'SessionKeys5'
}
}
@@ -41,35 +43,36 @@ const TYPES_KUSAMA_VERSIONED: OverrideVersionedType[] = [
{
minmax: [1019, 1031],
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
DispatchError: 'DispatchErrorTo198',
Keys: 'SessionKeys5',
LookupSource: 'Address',
SlashingSpans: 'SlashingSpansTo204'
}
},
{
minmax: [1032, 1042],
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
Keys: 'SessionKeys5',
LookupSource: 'Address',
SlashingSpans: 'SlashingSpansTo204'
}
},
{
minmax: [1043, 1045],
types: {
Address: 'GenericAddress',
BalanceLock: 'BalanceLockTo212',
Keys: 'SessionKeys5',
LookupSource: 'Address'
Keys: 'SessionKeys5'
}
},
{
minmax: [1046, undefined],
types: {
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
// Indices optional, not in transaction
Address: 'AccountId',
Keys: 'SessionKeys5'
}
}
];
@@ -86,6 +89,7 @@ const TYPES_META: OverrideVersionedType[] = [
// v4 = v1.0 branch
minmax: [0, 4],
types: {
Address: 'GenericAddress',
BlockNumber: 'u64',
Index: 'u64',
EventRecord: 'EventRecordTo76',
+7 -3
View File
@@ -14,8 +14,10 @@ import Enum from '../../codec/Enum';
import Option from '../../codec/Option';
import Struct from '../../codec/Struct';
import Vec from '../../codec/Vec';
import Null from '../../primitive/Null';
import GenericAccountId from '../../primitive/Generic/AccountId';
import GenericAddress from '../../primitive/Generic/Address';
import Vote, { convictionNames as _voteConvictions } from '../../primitive/Generic/Vote';
import Null from '../../primitive/Null';
import * as primitiveClasses from '../../primitive';
import { formatType } from './formatting';
import { setImports, TypeImports } from './imports';
@@ -105,8 +107,10 @@ export function getSimilarTypes (definitions: object, registry: Registry, type:
possibleTypes.push('Uint8Array');
} else if (isChildClass(AbstractInt as unknown as Constructor<any>, Clazz) || isChildClass(Compact, Clazz)) {
possibleTypes.push('AnyNumber', 'Uint8Array');
} else if (isChildClass(ClassOf(registry, 'Address'), Clazz)) {
possibleTypes.push('string', 'AccountId', 'AccountIndex', 'Uint8Array');
} else if (isChildClass(GenericAddress, Clazz)) {
possibleTypes.push('Address', 'AccountId', 'AccountIndex', 'string', 'Uint8Array');
} else if (isChildClass(GenericAccountId, Clazz)) {
possibleTypes.push('string', 'Uint8Array');
} else if (isChildClass(ClassOf(registry, 'bool'), Clazz)) {
possibleTypes.push('boolean', 'Uint8Array');
} else if (isChildClass(Null, Clazz)) {