Types for Polkadot 28+ (#3119)

* Types for Polkadot 28+

* Linting
This commit is contained in:
Jaco Greeff
2021-01-28 15:57:32 +01:00
committed by GitHub
parent 788c05d86e
commit a9005d86d6
5 changed files with 73 additions and 25 deletions
+27 -8
View File
@@ -6,27 +6,33 @@
import type { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
AccountInfo: 'AccountInfoWithProviders',
Address: 'MultiAddress',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
LookupSource: 'MultiAddress',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'IdentityJudgement']
}
};
const indicesTypes = {
const addrIndicesTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'LookupSource',
LookupSource: 'IndicesLookupSource'
};
const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
LookupSource: 'AccountId'
};
const versioned: OverrideVersionedType[] = [
{
// 1020 is first CC3
minmax: [1019, 1031],
types: {
...indicesTypes,
...addrIndicesTypes,
BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257',
DispatchError: 'DispatchErrorTo198',
@@ -46,7 +52,7 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [1032, 1042],
types: {
...indicesTypes,
...addrIndicesTypes,
BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
@@ -66,7 +72,7 @@ const versioned: OverrideVersionedType[] = [
// actual at 1045 (1043-1044 is dev)
minmax: [1043, 1045],
types: {
...indicesTypes,
...addrIndicesTypes,
BalanceLock: 'BalanceLockTo212',
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
@@ -86,6 +92,7 @@ const versioned: OverrideVersionedType[] = [
types: {
// Indices optional, not in transaction
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Multiplier: 'Fixed64',
@@ -101,6 +108,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [1055, 1056],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
Multiplier: 'Fixed64',
@@ -115,6 +123,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [1057, 1061],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
DispatchInfo: 'DispatchInfoTo244',
OpenTip: 'OpenTipTo225',
@@ -126,6 +135,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [1062, 2012],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
@@ -136,6 +146,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [2013, 2022],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
RefCount: 'RefCountTo259',
RewardDestination: 'RewardDestinationTo257'
@@ -145,11 +156,19 @@ const versioned: OverrideVersionedType[] = [
minmax: [2023, 2024],
types: {
...sharedTypes,
...addrAccountIdTypes,
RefCount: 'RefCountTo259'
}
},
{
minmax: [2025, undefined],
minmax: [2025, 2027],
types: {
...addrAccountIdTypes,
...sharedTypes
}
},
{
minmax: [2028, undefined],
types: {
...sharedTypes
}
@@ -7,14 +7,7 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
const versioned: OverrideVersionedType[] = [
{
minmax: [0, 99],
types: {
Address: 'AccountId',
LookupSource: 'AccountId'
}
},
{
minmax: [100, undefined],
minmax: [0, undefined],
types: {
Address: 'MultiAddress',
LookupSource: 'MultiAddress'
+20 -4
View File
@@ -6,22 +6,29 @@
import type { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
AccountInfo: 'AccountInfoWithProviders',
Address: 'MultiAddress',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
LookupSource: 'MultiAddress',
ProxyType: {
// was: SudoBalances
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'Unused', 'IdentityJudgement']
}
};
const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
LookupSource: 'AccountId'
};
// these are override types for Polkadot
const versioned: OverrideVersionedType[] = [
{
minmax: [0, 12],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
@@ -32,6 +39,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [13, 22],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
RefCount: 'RefCountTo259',
RewardDestination: 'RewardDestinationTo257'
@@ -41,11 +49,19 @@ const versioned: OverrideVersionedType[] = [
minmax: [23, 24],
types: {
...sharedTypes,
...addrAccountIdTypes,
RefCount: 'RefCountTo259'
}
},
{
minmax: [25, undefined],
minmax: [25, 27],
types: {
...sharedTypes,
...addrAccountIdTypes
}
},
{
minmax: [28, undefined],
types: {
...sharedTypes
}
+4 -1
View File
@@ -9,7 +9,7 @@ import type { OverrideVersionedType } from '@polkadot/types/types';
/* eslint-disable sort-keys */
const sharedTypes = {
AccountInfo: 'AccountInfoWithRefCount',
AccountInfo: 'AccountInfoWithProviders',
Address: 'MultiAddress',
FullIdentification: '()', // No staking, only session (as per config)
LookupSource: 'MultiAddress',
@@ -21,6 +21,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [0, 9],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
CompactAssignments: 'CompactAssignmentsTo257',
LookupSource: 'AccountId',
@@ -33,6 +34,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [10, 12],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
@@ -42,6 +44,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [13, 201],
types: {
...sharedTypes,
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
LookupSource: 'AccountId'
}
+21 -4
View File
@@ -6,21 +6,28 @@
import type { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
AccountInfo: 'AccountInfoWithProviders',
Address: 'MultiAddress',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
LookupSource: 'MultiAddress',
ProxyType: {
// was: SudoBalances
_enum: ['Any', 'NonTransfer', 'Staking', 'Unused', 'IdentityJudgement']
}
};
const addrAccountIdTypes = {
AccountInfo: 'AccountInfoWithRefCount',
Address: 'AccountId',
LookupSource: 'AccountId'
};
const versioned: OverrideVersionedType[] = [
{
minmax: [1, 2],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
@@ -33,6 +40,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [3, 22],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
OpenTip: 'OpenTipTo225',
RefCount: 'RefCountTo259',
@@ -43,6 +51,7 @@ const versioned: OverrideVersionedType[] = [
minmax: [23, 42],
types: {
...sharedTypes,
...addrAccountIdTypes,
CompactAssignments: 'CompactAssignmentsTo257',
RefCount: 'RefCountTo259',
RewardDestination: 'RewardDestinationTo257'
@@ -52,11 +61,19 @@ const versioned: OverrideVersionedType[] = [
minmax: [43, 44],
types: {
...sharedTypes,
...addrAccountIdTypes,
RefCount: 'RefCountTo259'
}
},
{
minmax: [45, undefined],
minmax: [45, 47],
types: {
...sharedTypes,
...addrAccountIdTypes
}
},
{
minmax: [48, undefined],
types: {
...sharedTypes
}