New OpenTip structure (#2394)

* New OpenTip structure

* Kusama update
This commit is contained in:
Jaco Greeff
2020-06-29 16:20:43 +02:00
committed by GitHub
parent 8643b5da87
commit 7dfc8625cc
6 changed files with 87 additions and 47 deletions
+24 -13
View File
@@ -4,6 +4,12 @@
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
};
const versioned: OverrideVersionedType[] = [
{
// 1020 is first CC3
@@ -16,6 +22,7 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
@@ -32,6 +39,7 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
@@ -49,6 +57,7 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230',
@@ -59,11 +68,10 @@ const versioned: OverrideVersionedType[] = [
minmax: [1046, 1054],
types: {
// Indices optional, not in transaction
Address: 'AccountId',
...sharedTypes,
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
@@ -72,11 +80,10 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [1055, 1056],
types: {
Address: 'AccountId',
...sharedTypes,
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
@@ -84,18 +91,22 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [1057, 1061],
types: {
Address: 'AccountId',
...sharedTypes,
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
OpenTip: 'OpenTipTo225'
}
},
{
minmax: [1062, undefined],
minmax: [1062, 2012],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
...sharedTypes,
OpenTip: 'OpenTipTo225'
}
},
{
minmax: [2013, undefined],
types: {
...sharedTypes
}
}
];
+14 -11
View File
@@ -4,25 +4,28 @@
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'SudoBalances']
}
};
// these are override types for Polkadot
const versioned: OverrideVersionedType[] = [
{
minmax: [0, 3],
minmax: [0, 12],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
...sharedTypes,
OpenTip: 'OpenTipTo225'
}
},
{
minmax: [4, undefined],
minmax: [13, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'SudoBalances']
}
...sharedTypes
}
}
];
+16 -14
View File
@@ -4,34 +4,36 @@
import { OverrideVersionedType } from '@polkadot/types/types';
const sharedTypes = {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances']
}
};
const versioned: OverrideVersionedType[] = [
{
minmax: [1, 2],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
...sharedTypes,
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
Weight: 'u32'
}
},
{
minmax: [3, 19],
minmax: [3, 22],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId'
...sharedTypes,
OpenTip: 'OpenTipTo225'
}
},
{
minmax: [20, undefined],
minmax: [23, undefined],
types: {
Address: 'AccountId',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
ProxyType: {
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances']
}
...sharedTypes
}
}
];
+7 -4
View File
@@ -39,7 +39,7 @@ import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, Elect
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
import { AccountInfo, ApplyExtrinsicResult, ChainProperties, ChainType, DigestOf, DispatchClass, DispatchError, DispatchErrorModule, DispatchErrorTo198, DispatchInfo, DispatchInfoTo190, DispatchInfoTo244, DispatchOutcome, DispatchResult, DispatchResultOf, DispatchResultTo198, Event, EventId, EventIndex, EventRecord, EventRecordTo76, Health, InvalidTransaction, Key, LastRuntimeUpgradeInfo, NetworkState, NetworkStatePeerset, NetworkStatePeersetInfo, NodeRole, NotConnectedPeer, Peer, PeerEndpoint, PeerEndpointAddr, PeerInfo, PeerPing, Phase, RefCount, TransactionValidityError, UnknownTransaction } from '@polkadot/types/interfaces/system';
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
import { CallHash, Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
@@ -1112,9 +1112,12 @@ declare module '@polkadot/types/types/registry' {
OpenTip: OpenTip;
'Option<OpenTip>': Option<OpenTip>;
'Vec<OpenTip>': Vec<OpenTip>;
OpenTipFinder: OpenTipFinder;
'Option<OpenTipFinder>': Option<OpenTipFinder>;
'Vec<OpenTipFinder>': Vec<OpenTipFinder>;
OpenTipTo225: OpenTipTo225;
'Option<OpenTipTo225>': Option<OpenTipTo225>;
'Vec<OpenTipTo225>': Vec<OpenTipTo225>;
OpenTipFinderTo225: OpenTipFinderTo225;
'Option<OpenTipFinderTo225>': Option<OpenTipFinderTo225>;
'Vec<OpenTipFinderTo225>': Vec<OpenTipFinderTo225>;
OpenTipTip: OpenTipTip;
'Option<OpenTipTip>': Option<OpenTipTip>;
'Vec<OpenTipTip>': Vec<OpenTipTip>;
@@ -13,11 +13,20 @@ export default {
OpenTip: {
reason: 'Hash',
who: 'AccountId',
finder: 'Option<OpenTipFinder>',
finder: 'AccountId',
deposit: 'Balance',
closes: 'Option<BlockNumber>',
tips: 'Vec<OpenTipTip>',
findersFee: 'bool'
},
OpenTipTo225: {
reason: 'Hash',
who: 'AccountId',
finder: 'Option<OpenTipFinderTo225>',
closes: 'Option<BlockNumber>',
tips: 'Vec<OpenTipTip>'
},
OpenTipFinder: '(AccountId, Balance)',
OpenTipFinderTo225: '(AccountId, Balance)',
OpenTipTip: '(AccountId, Balance)',
TreasuryProposal: {
proposer: 'AccountId',
@@ -3,23 +3,35 @@
import { ITuple } from '@polkadot/types/types';
import { Option, Struct, Vec } from '@polkadot/types/codec';
import { bool } from '@polkadot/types/primitive';
import { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
/** @name OpenTip */
export interface OpenTip extends Struct {
readonly reason: Hash;
readonly who: AccountId;
readonly finder: Option<OpenTipFinder>;
readonly finder: AccountId;
readonly deposit: Balance;
readonly closes: Option<BlockNumber>;
readonly tips: Vec<OpenTipTip>;
readonly findersFee: bool;
}
/** @name OpenTipFinder */
export interface OpenTipFinder extends ITuple<[AccountId, Balance]> {}
/** @name OpenTipFinderTo225 */
export interface OpenTipFinderTo225 extends ITuple<[AccountId, Balance]> {}
/** @name OpenTipTip */
export interface OpenTipTip extends ITuple<[AccountId, Balance]> {}
/** @name OpenTipTo225 */
export interface OpenTipTo225 extends Struct {
readonly reason: Hash;
readonly who: AccountId;
readonly finder: Option<OpenTipFinderTo225>;
readonly closes: Option<BlockNumber>;
readonly tips: Vec<OpenTipTip>;
}
/** @name TreasuryProposal */
export interface TreasuryProposal extends Struct {
readonly proposer: AccountId;