@@ -9,7 +9,7 @@ import React, { useEffect, useMemo, useState } from 'react';
9
9
import { SubmittableExtrinsic } from '@polkadot/api/types' ;
10
10
import { getTreasuryProposalThreshold } from '@polkadot/apps-config' ;
11
11
import { InputAddress , Modal , TxButton } from '@polkadot/react-components' ;
12
- import { useAccounts , useApi , useMembers } from '@polkadot/react-hooks' ;
12
+ import { useAccounts , useApi , useCollectiveInstance , useCollectiveMembers } from '@polkadot/react-hooks' ;
13
13
14
14
import { truncateTitle } from '../helpers' ;
15
15
import { useBounties } from '../hooks' ;
@@ -32,13 +32,14 @@ interface ActionProperties {
32
32
proposingAccountTip : string ;
33
33
tip : string ;
34
34
title : string ;
35
- tx : ( ( ...args : any [ ] ) => SubmittableExtrinsic < 'promise' > ) ;
35
+ tx : null | ( ( ...args : any [ ] ) => SubmittableExtrinsic < 'promise' > ) ;
36
36
}
37
37
38
38
function SlashCurator ( { action, curatorId, description, index, toggleOpen } : Props ) : React . ReactElement < Props > | null {
39
39
const { t } = useTranslation ( ) ;
40
40
const { api } = useApi ( ) ;
41
- const { members } = useMembers ( 'council' ) ;
41
+ const { members } = useCollectiveMembers ( 'council' ) ;
42
+ const councilMod = useCollectiveInstance ( 'council' ) ;
42
43
const { unassignCurator } = useBounties ( ) ;
43
44
const [ accountId , setAccountId ] = useState < string | null > ( null ) ;
44
45
const [ threshold , setThreshold ] = useState < BN > ( ) ;
@@ -71,7 +72,7 @@ function SlashCurator ({ action, curatorId, description, index, toggleOpen }: Pr
71
72
proposingAccountTip : t ( 'The council member that will create the motion, submission equates to an "aye" vote.' ) ,
72
73
tip : t ( "If the motion is approved, Curator's deposit will be slashed and Curator will be unassigned. Bounty will return to the Funded state." ) ,
73
74
title : t ( 'Slash curator' ) ,
74
- tx : api . tx . council . propose
75
+ tx : councilMod && api . tx [ councilMod ] . propose
75
76
} ,
76
77
UnassignCurator : {
77
78
filter : members ,
@@ -81,12 +82,16 @@ function SlashCurator ({ action, curatorId, description, index, toggleOpen }: Pr
81
82
proposingAccountTip : t ( 'The council member that will create the motion, submission equates to an "aye" vote.' ) ,
82
83
tip : t ( 'If the motion is approved, the current Curator will be unassigned and the Bounty will return to the Funded state.' ) ,
83
84
title : t ( 'Unassign curator' ) ,
84
- tx : api . tx . council . propose
85
+ tx : councilMod && api . tx [ councilMod ] . propose
85
86
}
86
- } ) , [ t , index , unassignCurator , api . tx . council . propose , allAccounts , members , threshold , unassignCuratorProposal ] ) ;
87
+ } ) , [ t , index , unassignCurator , api , allAccounts , councilMod , members , threshold , unassignCuratorProposal ] ) ;
87
88
88
89
const { filter, helpMessage, params, proposingAccountTip, tip, title, tx } = actionProperties [ action ] ;
89
90
91
+ if ( ! tx ) {
92
+ return null ;
93
+ }
94
+
90
95
return (
91
96
< Modal
92
97
header = { `${ title } - "${ truncateTitle ( description , 30 ) } "` }
0 commit comments