@@ -20,6 +20,9 @@ import {
20
20
proposeInstructions ,
21
21
getMultisigCluster ,
22
22
BPF_UPGRADABLE_LOADER ,
23
+ isRemoteCluster ,
24
+ WORMHOLE_ADDRESS ,
25
+ mapKey ,
23
26
} from 'xc-admin-common'
24
27
import { ClusterContext } from '../../contexts/ClusterContext'
25
28
import { usePythContext } from '../../contexts/PythContext'
@@ -238,34 +241,39 @@ const UpdatePermissions = () => {
238
241
}
239
242
240
243
const handleSendProposalButtonClick = ( ) => {
241
- if ( pythProgramClient && finalPubkeyChanges ) {
244
+ if ( pythProgramClient && finalPubkeyChanges && squads ) {
242
245
const programDataAccount = PublicKey . findProgramAddressSync (
243
246
[ pythProgramClient ?. programId . toBuffer ( ) ] ,
244
247
BPF_UPGRADABLE_LOADER
245
248
) [ 0 ]
249
+ const multisigAuthority = squads . getAuthorityPDA (
250
+ UPGRADE_MULTISIG [ getMultisigCluster ( cluster ) ] ,
251
+ 1
252
+ )
253
+
246
254
pythProgramClient ?. methods
247
255
. updPermissions (
248
256
new PublicKey ( finalPubkeyChanges [ 'Master Authority' ] . new ) ,
249
257
new PublicKey ( finalPubkeyChanges [ 'Data Curation Authority' ] . new ) ,
250
258
new PublicKey ( finalPubkeyChanges [ 'Security Authority' ] . new )
251
259
)
252
260
. accounts ( {
253
- upgradeAuthority : squads ?. getAuthorityPDA (
254
- UPGRADE_MULTISIG [ getMultisigCluster ( cluster ) ] ,
255
- 1
256
- ) ,
261
+ upgradeAuthority : isRemoteCluster ( cluster )
262
+ ? mapKey ( multisigAuthority )
263
+ : multisigAuthority ,
257
264
programDataAccount,
258
265
} )
259
266
. instruction ( )
260
267
. then ( async ( instruction ) => {
261
- if ( ! isMultisigLoading && squads ) {
268
+ if ( ! isMultisigLoading ) {
262
269
setIsSendProposalButtonLoading ( true )
263
270
try {
264
271
const proposalPubkey = await proposeInstructions (
265
272
squads ,
266
273
UPGRADE_MULTISIG [ getMultisigCluster ( cluster ) ] ,
267
274
[ instruction ] ,
268
- false
275
+ isRemoteCluster ( cluster ) ,
276
+ WORMHOLE_ADDRESS [ getMultisigCluster ( cluster ) ]
269
277
)
270
278
toast . success (
271
279
`Proposal sent! 🚀 Proposal Pubkey: ${ proposalPubkey } `
0 commit comments