@@ -51,6 +51,7 @@ import {
51
51
} from '../InstructionViews/AccountUtils'
52
52
53
53
import { getMappingCluster , isPubkey } from '../InstructionViews/utils'
54
+ import { getPythProgramKeyForCluster , PythCluster } from '@pythnetwork/client'
54
55
const ProposalRow = ( {
55
56
proposal,
56
57
multisig,
@@ -94,15 +95,39 @@ const ProposalRow = ({
94
95
proposal . publicKey . toBase58 ( ) . slice ( - 6 ) }
95
96
</ span > { ' ' }
96
97
</ div >
97
- < div >
98
- < StatusTag proposalStatus = { status } />
98
+ < div className = "flex space-x-2" >
99
+ { proposal . approved . length > 0 && status === 'active' && (
100
+ < div >
101
+ < StatusTag
102
+ proposalStatus = "executed"
103
+ text = { `Approved: ${ proposal . approved . length } ` }
104
+ />
105
+ </ div >
106
+ ) }
107
+ { proposal . rejected . length > 0 && status === 'active' && (
108
+ < div >
109
+ < StatusTag
110
+ proposalStatus = "rejected"
111
+ text = { `Rejected: ${ proposal . rejected . length } ` }
112
+ />
113
+ </ div >
114
+ ) }
115
+ < div >
116
+ < StatusTag proposalStatus = { status } />
117
+ </ div >
99
118
</ div >
100
119
</ div >
101
120
</ div >
102
121
)
103
122
}
104
123
105
- const StatusTag = ( { proposalStatus } : { proposalStatus : string } ) => {
124
+ const StatusTag = ( {
125
+ proposalStatus,
126
+ text,
127
+ } : {
128
+ proposalStatus : string
129
+ text ?: string
130
+ } ) => {
106
131
return (
107
132
< div
108
133
className = { `flex items-center justify-center rounded-full ${
@@ -119,7 +144,7 @@ const StatusTag = ({ proposalStatus }: { proposalStatus: string }) => {
119
144
: 'bg-pythPurple'
120
145
} py-1 px-2 text-xs`}
121
146
>
122
- { proposalStatus }
147
+ { text || proposalStatus }
123
148
</ div >
124
149
)
125
150
}
@@ -230,7 +255,40 @@ const Proposal = ({
230
255
} ) => {
231
256
const [ instructions , setInstructions ] = useState < MultisigInstruction [ ] > ( [ ] )
232
257
const [ isTransactionLoading , setIsTransactionLoading ] = useState ( false )
233
- const { cluster } = useContext ( ClusterContext )
258
+ const { cluster : contextCluster } = useContext ( ClusterContext )
259
+ const multisigCluster = getMultisigCluster ( contextCluster )
260
+ const targetClusters : ( PythCluster | 'unknown' ) [ ] = [ ]
261
+ instructions . map ( ( ix ) => {
262
+ if ( ix instanceof PythMultisigInstruction ) {
263
+ targetClusters . push ( multisigCluster )
264
+ } else if (
265
+ ix instanceof WormholeMultisigInstruction &&
266
+ ix . governanceAction instanceof ExecutePostedVaa
267
+ ) {
268
+ ix . governanceAction . instructions . map ( ( ix ) => {
269
+ const remoteClusters : PythCluster [ ] = [
270
+ 'pythnet' ,
271
+ 'pythtest-conformance' ,
272
+ 'pythtest-crosschain' ,
273
+ ]
274
+ for ( const remoteCluster of remoteClusters ) {
275
+ if (
276
+ multisigCluster === getMultisigCluster ( remoteCluster ) &&
277
+ ix . programId . equals ( getPythProgramKeyForCluster ( remoteCluster ) )
278
+ ) {
279
+ targetClusters . push ( remoteCluster )
280
+ }
281
+ }
282
+ } )
283
+ } else {
284
+ targetClusters . push ( 'unknown' )
285
+ }
286
+ } )
287
+ const uniqueTargetCluster = new Set ( targetClusters ) . size === 1
288
+ const cluster =
289
+ uniqueTargetCluster && targetClusters [ 0 ] !== 'unknown'
290
+ ? targetClusters [ 0 ]
291
+ : contextCluster
234
292
235
293
const {
236
294
voteSquads,
@@ -243,6 +301,7 @@ const Proposal = ({
243
301
productAccountKeyToSymbolMapping,
244
302
publisherKeyToNameMapping,
245
303
} = usePythContext ( )
304
+
246
305
const publisherKeyToNameMappingCluster =
247
306
publisherKeyToNameMapping [ getMappingCluster ( cluster ) ]
248
307
const { publicKey : signerPublicKey } = useWallet ( )
@@ -367,6 +426,17 @@ const Proposal = ({
367
426
multisig !== undefined &&
368
427
! isMultisigLoading ? (
369
428
< div className = "grid grid-cols-3 gap-4" >
429
+ < div className = "col-span-3 my-2 space-y-4 bg-[#1E1B2F] p-4" >
430
+ < h4 className = "h4 font-semibold" >
431
+ { uniqueTargetCluster
432
+ ? `Target Pyth Program: ${ targetClusters [ 0 ] } `
433
+ : targetClusters . length == 0
434
+ ? 'No target Pyth program detected'
435
+ : `Multiple target Pyth programs detected ${ targetClusters . join (
436
+ ' '
437
+ ) } `}
438
+ </ h4 >
439
+ </ div >
370
440
< div className = "col-span-3 my-2 space-y-4 bg-[#1E1B2F] p-4 lg:col-span-2" >
371
441
< div className = "flex justify-between" >
372
442
< h4 className = "h4 font-semibold" > Info</ h4 >
@@ -689,7 +759,10 @@ const Proposal = ({
689
759
</ >
690
760
) : null }
691
761
{ instruction instanceof WormholeMultisigInstruction && (
692
- < WormholeInstructionView instruction = { instruction } />
762
+ < WormholeInstructionView
763
+ cluster = { cluster }
764
+ instruction = { instruction }
765
+ />
693
766
) }
694
767
695
768
{ index !== instructions . length - 1 ? (
0 commit comments