Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New OpenTip structure #2394

Merged
merged 3 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions packages/types-known/src/spec/kusama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,6 +22,7 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
Expand All @@ -32,6 +39,7 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
ReferendumInfo: 'ReferendumInfoTo239',
SlashingSpans: 'SlashingSpansTo204',
StakingLedger: 'StakingLedgerTo223',
Expand All @@ -49,6 +57,7 @@ const versioned: OverrideVersionedType[] = [
Keys: 'SessionKeys5',
LookupSource: 'Address',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
ReferendumInfo: 'ReferendumInfoTo239',
StakingLedger: 'StakingLedgerTo223',
Votes: 'VotesTo230',
Expand All @@ -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'
Expand All @@ -72,30 +80,33 @@ const versioned: OverrideVersionedType[] = [
{
minmax: [1055, 1056],
types: {
Address: 'AccountId',
...sharedTypes,
DispatchInfo: 'DispatchInfoTo244',
Keys: 'SessionKeys5',
LookupSource: 'AccountId',
Multiplier: 'Fixed64',
OpenTip: 'OpenTipTo225',
StakingLedger: 'StakingLedgerTo240',
Weight: 'u32'
}
},
{
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
}
}
];
Expand Down
25 changes: 14 additions & 11 deletions packages/types-known/src/spec/polkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
];
Expand Down
30 changes: 16 additions & 14 deletions packages/types-known/src/spec/westend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
];
Expand Down
11 changes: 7 additions & 4 deletions packages/types/src/augment/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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>;
Expand Down
13 changes: 11 additions & 2 deletions packages/types/src/interfaces/treasury/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
18 changes: 15 additions & 3 deletions packages/types/src/interfaces/treasury/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down