Skip to content

Commit 7dfc862

Browse files
authored
New OpenTip structure (#2394)
* New OpenTip structure * Kusama update
1 parent 8643b5d commit 7dfc862

File tree

6 files changed

+87
-47
lines changed

6 files changed

+87
-47
lines changed

packages/types-known/src/spec/kusama.ts

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44

55
import { OverrideVersionedType } from '@polkadot/types/types';
66

7+
const sharedTypes = {
8+
Address: 'AccountId',
9+
Keys: 'SessionKeys5',
10+
LookupSource: 'AccountId'
11+
};
12+
713
const versioned: OverrideVersionedType[] = [
814
{
915
// 1020 is first CC3
@@ -16,6 +22,7 @@ const versioned: OverrideVersionedType[] = [
1622
Keys: 'SessionKeys5',
1723
LookupSource: 'Address',
1824
Multiplier: 'Fixed64',
25+
OpenTip: 'OpenTipTo225',
1926
ReferendumInfo: 'ReferendumInfoTo239',
2027
SlashingSpans: 'SlashingSpansTo204',
2128
StakingLedger: 'StakingLedgerTo223',
@@ -32,6 +39,7 @@ const versioned: OverrideVersionedType[] = [
3239
Keys: 'SessionKeys5',
3340
LookupSource: 'Address',
3441
Multiplier: 'Fixed64',
42+
OpenTip: 'OpenTipTo225',
3543
ReferendumInfo: 'ReferendumInfoTo239',
3644
SlashingSpans: 'SlashingSpansTo204',
3745
StakingLedger: 'StakingLedgerTo223',
@@ -49,6 +57,7 @@ const versioned: OverrideVersionedType[] = [
4957
Keys: 'SessionKeys5',
5058
LookupSource: 'Address',
5159
Multiplier: 'Fixed64',
60+
OpenTip: 'OpenTipTo225',
5261
ReferendumInfo: 'ReferendumInfoTo239',
5362
StakingLedger: 'StakingLedgerTo223',
5463
Votes: 'VotesTo230',
@@ -59,11 +68,10 @@ const versioned: OverrideVersionedType[] = [
5968
minmax: [1046, 1054],
6069
types: {
6170
// Indices optional, not in transaction
62-
Address: 'AccountId',
71+
...sharedTypes,
6372
DispatchInfo: 'DispatchInfoTo244',
64-
Keys: 'SessionKeys5',
65-
LookupSource: 'AccountId',
6673
Multiplier: 'Fixed64',
74+
OpenTip: 'OpenTipTo225',
6775
ReferendumInfo: 'ReferendumInfoTo239',
6876
StakingLedger: 'StakingLedgerTo240',
6977
Weight: 'u32'
@@ -72,30 +80,33 @@ const versioned: OverrideVersionedType[] = [
7280
{
7381
minmax: [1055, 1056],
7482
types: {
75-
Address: 'AccountId',
83+
...sharedTypes,
7684
DispatchInfo: 'DispatchInfoTo244',
77-
Keys: 'SessionKeys5',
78-
LookupSource: 'AccountId',
7985
Multiplier: 'Fixed64',
86+
OpenTip: 'OpenTipTo225',
8087
StakingLedger: 'StakingLedgerTo240',
8188
Weight: 'u32'
8289
}
8390
},
8491
{
8592
minmax: [1057, 1061],
8693
types: {
87-
Address: 'AccountId',
94+
...sharedTypes,
8895
DispatchInfo: 'DispatchInfoTo244',
89-
Keys: 'SessionKeys5',
90-
LookupSource: 'AccountId'
96+
OpenTip: 'OpenTipTo225'
9197
}
9298
},
9399
{
94-
minmax: [1062, undefined],
100+
minmax: [1062, 2012],
95101
types: {
96-
Address: 'AccountId',
97-
Keys: 'SessionKeys5',
98-
LookupSource: 'AccountId'
102+
...sharedTypes,
103+
OpenTip: 'OpenTipTo225'
104+
}
105+
},
106+
{
107+
minmax: [2013, undefined],
108+
types: {
109+
...sharedTypes
99110
}
100111
}
101112
];

packages/types-known/src/spec/polkadot.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,28 @@
44

55
import { OverrideVersionedType } from '@polkadot/types/types';
66

7+
const sharedTypes = {
8+
Address: 'AccountId',
9+
Keys: 'SessionKeys5',
10+
LookupSource: 'AccountId',
11+
ProxyType: {
12+
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'SudoBalances']
13+
}
14+
};
15+
716
// these are override types for Polkadot
817
const versioned: OverrideVersionedType[] = [
918
{
10-
minmax: [0, 3],
19+
minmax: [0, 12],
1120
types: {
12-
Address: 'AccountId',
13-
Keys: 'SessionKeys5',
14-
LookupSource: 'AccountId'
21+
...sharedTypes,
22+
OpenTip: 'OpenTipTo225'
1523
}
1624
},
1725
{
18-
minmax: [4, undefined],
26+
minmax: [13, undefined],
1927
types: {
20-
Address: 'AccountId',
21-
Keys: 'SessionKeys5',
22-
LookupSource: 'AccountId',
23-
ProxyType: {
24-
_enum: ['Any', 'NonTransfer', 'Governance', 'Staking', 'SudoBalances']
25-
}
28+
...sharedTypes
2629
}
2730
}
2831
];

packages/types-known/src/spec/westend.ts

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,36 @@
44

55
import { OverrideVersionedType } from '@polkadot/types/types';
66

7+
const sharedTypes = {
8+
Address: 'AccountId',
9+
Keys: 'SessionKeys5',
10+
LookupSource: 'AccountId',
11+
ProxyType: {
12+
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances']
13+
}
14+
};
15+
716
const versioned: OverrideVersionedType[] = [
817
{
918
minmax: [1, 2],
1019
types: {
11-
Address: 'AccountId',
12-
Keys: 'SessionKeys5',
13-
LookupSource: 'AccountId',
20+
...sharedTypes,
1421
Multiplier: 'Fixed64',
22+
OpenTip: 'OpenTipTo225',
1523
Weight: 'u32'
1624
}
1725
},
1826
{
19-
minmax: [3, 19],
27+
minmax: [3, 22],
2028
types: {
21-
Address: 'AccountId',
22-
Keys: 'SessionKeys5',
23-
LookupSource: 'AccountId'
29+
...sharedTypes,
30+
OpenTip: 'OpenTipTo225'
2431
}
2532
},
2633
{
27-
minmax: [20, undefined],
34+
minmax: [23, undefined],
2835
types: {
29-
Address: 'AccountId',
30-
Keys: 'SessionKeys5',
31-
LookupSource: 'AccountId',
32-
ProxyType: {
33-
_enum: ['Any', 'NonTransfer', 'Staking', 'SudoBalances']
34-
}
36+
...sharedTypes
3537
}
3638
}
3739
];

packages/types/src/augment/registry.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import { ActiveEraInfo, CompactAssignments, CompactScore, ElectionCompute, Elect
3939
import { ApiId, KeyValueOption, ReadProof, RuntimeVersion, RuntimeVersionApi, StorageChangeSet } from '@polkadot/types/interfaces/state';
4040
import { WeightToFeeCoefficient } from '@polkadot/types/interfaces/support';
4141
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';
42-
import { OpenTip, OpenTipFinder, OpenTipTip, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
42+
import { OpenTip, OpenTipFinderTo225, OpenTipTip, OpenTipTo225, TreasuryProposal } from '@polkadot/types/interfaces/treasury';
4343
import { Multiplier } from '@polkadot/types/interfaces/txpayment';
4444
import { CallHash, Multisig, Timepoint } from '@polkadot/types/interfaces/utility';
4545
import { VestingInfo } from '@polkadot/types/interfaces/vesting';
@@ -1112,9 +1112,12 @@ declare module '@polkadot/types/types/registry' {
11121112
OpenTip: OpenTip;
11131113
'Option<OpenTip>': Option<OpenTip>;
11141114
'Vec<OpenTip>': Vec<OpenTip>;
1115-
OpenTipFinder: OpenTipFinder;
1116-
'Option<OpenTipFinder>': Option<OpenTipFinder>;
1117-
'Vec<OpenTipFinder>': Vec<OpenTipFinder>;
1115+
OpenTipTo225: OpenTipTo225;
1116+
'Option<OpenTipTo225>': Option<OpenTipTo225>;
1117+
'Vec<OpenTipTo225>': Vec<OpenTipTo225>;
1118+
OpenTipFinderTo225: OpenTipFinderTo225;
1119+
'Option<OpenTipFinderTo225>': Option<OpenTipFinderTo225>;
1120+
'Vec<OpenTipFinderTo225>': Vec<OpenTipFinderTo225>;
11181121
OpenTipTip: OpenTipTip;
11191122
'Option<OpenTipTip>': Option<OpenTipTip>;
11201123
'Vec<OpenTipTip>': Vec<OpenTipTip>;

packages/types/src/interfaces/treasury/definitions.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,20 @@ export default {
1313
OpenTip: {
1414
reason: 'Hash',
1515
who: 'AccountId',
16-
finder: 'Option<OpenTipFinder>',
16+
finder: 'AccountId',
17+
deposit: 'Balance',
18+
closes: 'Option<BlockNumber>',
19+
tips: 'Vec<OpenTipTip>',
20+
findersFee: 'bool'
21+
},
22+
OpenTipTo225: {
23+
reason: 'Hash',
24+
who: 'AccountId',
25+
finder: 'Option<OpenTipFinderTo225>',
1726
closes: 'Option<BlockNumber>',
1827
tips: 'Vec<OpenTipTip>'
1928
},
20-
OpenTipFinder: '(AccountId, Balance)',
29+
OpenTipFinderTo225: '(AccountId, Balance)',
2130
OpenTipTip: '(AccountId, Balance)',
2231
TreasuryProposal: {
2332
proposer: 'AccountId',

packages/types/src/interfaces/treasury/types.ts

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,35 @@
33

44
import { ITuple } from '@polkadot/types/types';
55
import { Option, Struct, Vec } from '@polkadot/types/codec';
6+
import { bool } from '@polkadot/types/primitive';
67
import { AccountId, Balance, BlockNumber, Hash } from '@polkadot/types/interfaces/runtime';
78

89
/** @name OpenTip */
910
export interface OpenTip extends Struct {
1011
readonly reason: Hash;
1112
readonly who: AccountId;
12-
readonly finder: Option<OpenTipFinder>;
13+
readonly finder: AccountId;
14+
readonly deposit: Balance;
1315
readonly closes: Option<BlockNumber>;
1416
readonly tips: Vec<OpenTipTip>;
17+
readonly findersFee: bool;
1518
}
1619

17-
/** @name OpenTipFinder */
18-
export interface OpenTipFinder extends ITuple<[AccountId, Balance]> {}
20+
/** @name OpenTipFinderTo225 */
21+
export interface OpenTipFinderTo225 extends ITuple<[AccountId, Balance]> {}
1922

2023
/** @name OpenTipTip */
2124
export interface OpenTipTip extends ITuple<[AccountId, Balance]> {}
2225

26+
/** @name OpenTipTo225 */
27+
export interface OpenTipTo225 extends Struct {
28+
readonly reason: Hash;
29+
readonly who: AccountId;
30+
readonly finder: Option<OpenTipFinderTo225>;
31+
readonly closes: Option<BlockNumber>;
32+
readonly tips: Vec<OpenTipTip>;
33+
}
34+
2335
/** @name TreasuryProposal */
2436
export interface TreasuryProposal extends Struct {
2537
readonly proposer: AccountId;

0 commit comments

Comments
 (0)