Skip to content

Commit 4d60406

Browse files
committed
[wip] sqds proposal
1 parent 0c02f72 commit 4d60406

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

governance/xc-admin/packages/xc-admin-frontend/components/tabs/UpdatePermissions.tsx

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import {
66
import { PythOracle } from '@pythnetwork/client/lib/anchor'
77
import { useAnchorWallet, useWallet } from '@solana/wallet-adapter-react'
88
import { PublicKey } from '@solana/web3.js'
9-
import Squads from '@sqds/mesh'
109
import {
1110
createColumnHelper,
1211
flexRender,
@@ -15,8 +14,14 @@ import {
1514
} from '@tanstack/react-table'
1615
import copy from 'copy-to-clipboard'
1716
import { useContext, useEffect, useState } from 'react'
17+
import { proposeInstructions } from 'xc-admin-common'
1818
import { ClusterContext } from '../../contexts/ClusterContext'
1919
import { usePythContext } from '../../contexts/PythContext'
20+
import {
21+
getMultisigCluster,
22+
UPGRADE_MUTLTISIG,
23+
useMultisig,
24+
} from '../../hooks/useMultisig'
2025
import CopyIcon from '../../images/icons/copy.inline.svg'
2126
import ClusterSwitch from '../ClusterSwitch'
2227
import EditButton from '../EditButton'
@@ -87,7 +92,12 @@ const UpdatePermissions = () => {
8792
const [pubkeyChanges, setPubkeyChanges] = useState<PubkeyChanges>({})
8893
const [editable, setEditable] = useState(false)
8994
const { cluster, setCluster } = useContext(ClusterContext)
90-
const [sqdsClient, setSqdsClient] = useState<Squads>()
95+
const {
96+
isLoading: isMultisigLoading,
97+
error,
98+
squads,
99+
proposals,
100+
} = useMultisig()
91101
const { rawConfig, dataIsLoading, connection } = usePythContext()
92102
const anchorWallet = useAnchorWallet()
93103
const { publicKey, connected } = useWallet()
@@ -194,11 +204,26 @@ const UpdatePermissions = () => {
194204
})
195205
.instruction()
196206
.then((instruction) => {
197-
// TODO: propose ix
207+
if (!isMultisigLoading && squads) {
208+
proposeInstructions(
209+
squads,
210+
UPGRADE_MUTLTISIG[getMultisigCluster(cluster)],
211+
[instruction],
212+
false
213+
)
214+
}
198215
})
199216
}
200217
}
201-
}, [editable, pubkeyChanges, pythProgramClient, data])
218+
}, [
219+
editable,
220+
pubkeyChanges,
221+
pythProgramClient,
222+
data,
223+
cluster,
224+
isMultisigLoading,
225+
squads,
226+
])
202227

203228
// create anchor wallet when connected
204229
useEffect(() => {

0 commit comments

Comments
 (0)