Skip to content
Open
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
25 changes: 24 additions & 1 deletion packages/apps-config/src/api/spec/peerplays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,30 @@ const definitions: OverrideBundleDefinition = {
parent: 'Option<AccountId>',
children: 'Vec<AccountId>'
},
WildcardThresholdType: 'u32'
WildcardThresholdType: 'u32',
Conviction: {
_enum: [
'None',
'Locked1x',
'Locked2x',
'Locked3x',
'Locked4x',
'Locked5x',
'Locked6x'
]
},
Vote: '(u8, u8)',
AccountVote: {
_enum: {
Standard: '(Vote, Balance)',
Split: '(Balance, Balance)',
SplitAbstain: '(Balance, Balance, Balance)'
}
},
PalletReputationVotingVote: 'Vote',
PalletReputationVotingVoteConviction: 'Conviction',
PalletReputationVotingVoteVote: 'Vote',
PalletReputationVotingVoteAccountVote: 'AccountVote'
}
}
]
Expand Down
25 changes: 24 additions & 1 deletion packages/apps-config/src/api/typesBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63439,7 +63439,30 @@ export const typesBundle = {
"parent": "Option<AccountId>",
"children": "Vec<AccountId>"
},
"WildcardThresholdType": "u32"
"WildcardThresholdType": "u32",
"Conviction": {
"_enum": [
"None",
"Locked1x",
"Locked2x",
"Locked3x",
"Locked4x",
"Locked5x",
"Locked6x"
]
},
"Vote": "(u8, u8)",
"AccountVote": {
"_enum": {
"Standard": "(Vote, Balance)",
"Split": "(Balance, Balance)",
"SplitAbstain": "(Balance, Balance, Balance)"
}
},
"PalletReputationVotingVote": "Vote",
"PalletReputationVotingVoteConviction": "Conviction",
"PalletReputationVotingVoteVote": "Vote",
"PalletReputationVotingVoteAccountVote": "AccountVote"
}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ function Delegate ({ className, palletReferenda, palletVote, tracks }: Props): R
label={t('conviction')}
onChange={setConviction}
value={conviction}
voteLockingPeriod={api.consts[palletVote as 'reputationVoting'].voteLockingPeriod}
voteLockingPeriod={api.consts[palletVote as 'reputationVoting'].voteLockingPeriod as unknown as BN}
/>
</Modal.Columns>
</Modal.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@ function VoteStandard ({ accountId, id, isAye, onChange, voteLockingPeriod }: Pr
onChange([id, {
Standard: {
balance,
vote: {
aye: isAye,
conviction
}
vote: [isAye ? 1 : 0, conviction]
}
}]);
}, [balance, conviction, id, isAye, onChange]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function Voting ({ className, id, isConvictionVote, isMember, members, palletVot
id={id}
isAye
onChange={setParams}
voteLockingPeriod={api.consts[palletVote as 'reputationVoting'].voteLockingPeriod}
voteLockingPeriod={api.consts[palletVote as 'reputationVoting'].voteLockingPeriod as unknown as BN}
/>
)
: voteTypeIndex === 1
Expand All @@ -154,7 +154,7 @@ function Voting ({ className, id, isConvictionVote, isMember, members, palletVot
accountId={accountId}
id={id}
onChange={setParams}
voteLockingPeriod={api.consts[palletVote as 'reputationVoting'].voteLockingPeriod}
voteLockingPeriod={api.consts[palletVote as 'reputationVoting'].voteLockingPeriod as unknown as BN}
/>
)
: voteTypeIndex === 2
Expand Down
2 changes: 1 addition & 1 deletion packages/page-reputation-referenda/src/useAccountLocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function getRefParams (votes?: [classId: BN, refIds: BN[], casting: PalletConvic
}

function getLocks (api: ApiPromise, palletVote: PalletVote, votes: [classId: BN, refIds: BN[], casting: PalletConvictionVotingVoteCasting][], referenda: [BN, PalletReferendaReferendumInfoConvictionVotingTally][]): Lock[] {
const lockPeriod = api.consts[palletVote].voteLockingPeriod as BN;
const lockPeriod = api.consts[palletVote].voteLockingPeriod as unknown as BN;
const locks: Lock[] = [];

for (let i = 0, voteCount = votes.length; i < voteCount; i++) {
Expand Down