Renames (#581)
This commit is contained in:
parent
f3925b4447
commit
13e48bdd51
|
@ -12,7 +12,7 @@ import toast from 'react-hot-toast'
|
|||
import { getMultisigCluster, proposeInstructions } from 'xc_admin_common'
|
||||
import { ClusterContext } from '../../contexts/ClusterContext'
|
||||
import { usePythContext } from '../../contexts/PythContext'
|
||||
import { SECURITY_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { PRICE_FEED_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { capitalizeFirstLetter } from '../../utils/capitalizeFirstLetter'
|
||||
import ClusterSwitch from '../ClusterSwitch'
|
||||
import Modal from '../common/Modal'
|
||||
|
@ -189,7 +189,7 @@ const AddRemovePublishers = () => {
|
|||
.addPublisher(new PublicKey(publisherKey))
|
||||
.accounts({
|
||||
fundingAccount: squads?.getAuthorityPDA(
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
1
|
||||
),
|
||||
priceAccount: new PublicKey(
|
||||
|
@ -205,7 +205,7 @@ const AddRemovePublishers = () => {
|
|||
.delPublisher(new PublicKey(publisherKey))
|
||||
.accounts({
|
||||
fundingAccount: squads?.getAuthorityPDA(
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
1
|
||||
),
|
||||
priceAccount: new PublicKey(
|
||||
|
@ -221,7 +221,7 @@ const AddRemovePublishers = () => {
|
|||
try {
|
||||
const proposalPubkey = await proposeInstructions(
|
||||
squads,
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
instructions,
|
||||
false
|
||||
)
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
} from 'xc_admin_common'
|
||||
import { ClusterContext } from '../../contexts/ClusterContext'
|
||||
import { usePythContext } from '../../contexts/PythContext'
|
||||
import { SECURITY_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { PRICE_FEED_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { capitalizeFirstLetter } from '../../utils/capitalizeFirstLetter'
|
||||
import ClusterSwitch from '../ClusterSwitch'
|
||||
import Modal from '../common/Modal'
|
||||
|
@ -248,7 +248,7 @@ const General = () => {
|
|||
const instructions: TransactionInstruction[] = []
|
||||
Object.keys(dataChanges).forEach(async (symbol) => {
|
||||
const multisigAuthority = squads.getAuthorityPDA(
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
1
|
||||
)
|
||||
const fundingAccount = isRemote
|
||||
|
@ -404,7 +404,7 @@ const General = () => {
|
|||
try {
|
||||
const proposalPubkey = await proposeInstructions(
|
||||
squads,
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
instructions,
|
||||
isRemote,
|
||||
wormholeAddress
|
||||
|
|
|
@ -18,7 +18,7 @@ import toast from 'react-hot-toast'
|
|||
import { getMultisigCluster, proposeInstructions } from 'xc_admin_common'
|
||||
import { ClusterContext } from '../../contexts/ClusterContext'
|
||||
import { usePythContext } from '../../contexts/PythContext'
|
||||
import { SECURITY_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { PRICE_FEED_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { capitalizeFirstLetter } from '../../utils/capitalizeFirstLetter'
|
||||
import ClusterSwitch from '../ClusterSwitch'
|
||||
import Modal from '../common/Modal'
|
||||
|
@ -178,7 +178,7 @@ const MinPublishers = () => {
|
|||
.accounts({
|
||||
priceAccount: priceAccountPubkey,
|
||||
fundingAccount: squads?.getAuthorityPDA(
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
1
|
||||
),
|
||||
})
|
||||
|
@ -190,7 +190,7 @@ const MinPublishers = () => {
|
|||
try {
|
||||
const proposalPubkey = await proposeInstructions(
|
||||
squads,
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
instructions,
|
||||
false
|
||||
)
|
||||
|
|
|
@ -152,6 +152,7 @@ const Proposal = ({
|
|||
const handleClickApprove = async () => {
|
||||
if (proposal && squads) {
|
||||
try {
|
||||
console.log(squads.wallet.publicKey.toBase58())
|
||||
await squads.approveTransaction(proposal.publicKey)
|
||||
toast.success(`Approved proposal ${proposal.publicKey.toBase58()}`)
|
||||
} catch (e: any) {
|
||||
|
@ -769,8 +770,8 @@ const Proposals = () => {
|
|||
const [currentProposal, setCurrentProposal] = useState<TransactionAccount>()
|
||||
const [currentProposalPubkey, setCurrentProposalPubkey] = useState<string>()
|
||||
const {
|
||||
securityMultisigAccount,
|
||||
securityMultisigProposals,
|
||||
priceFeedMultisigAccount,
|
||||
priceFeedMultisigProposals,
|
||||
isLoading: isMultisigLoading,
|
||||
} = useMultisigContext()
|
||||
const { connected } = useWallet()
|
||||
|
@ -795,12 +796,12 @@ const Proposals = () => {
|
|||
|
||||
useEffect(() => {
|
||||
if (currentProposalPubkey) {
|
||||
const currentProposal = securityMultisigProposals.find(
|
||||
const currentProposal = priceFeedMultisigProposals.find(
|
||||
(proposal) => proposal.publicKey.toBase58() === currentProposalPubkey
|
||||
)
|
||||
setCurrentProposal(currentProposal)
|
||||
}
|
||||
}, [currentProposalPubkey, securityMultisigProposals])
|
||||
}, [currentProposalPubkey, priceFeedMultisigProposals])
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
|
@ -824,9 +825,9 @@ const Proposals = () => {
|
|||
<div className="mt-3">
|
||||
<Loadbar theme="light" />
|
||||
</div>
|
||||
) : securityMultisigProposals.length > 0 ? (
|
||||
) : priceFeedMultisigProposals.length > 0 ? (
|
||||
<div className="flex flex-col">
|
||||
{securityMultisigProposals.map((proposal, idx) => (
|
||||
{priceFeedMultisigProposals.map((proposal, idx) => (
|
||||
<ProposalRow
|
||||
key={idx}
|
||||
proposal={proposal}
|
||||
|
@ -835,7 +836,7 @@ const Proposals = () => {
|
|||
))}
|
||||
</div>
|
||||
) : (
|
||||
"No proposals found. If you're a member of the security multisig, you can create a proposal."
|
||||
"No proposals found. If you're a member of the price feed multisig, you can create a proposal."
|
||||
)}
|
||||
</div>
|
||||
</>
|
||||
|
@ -850,7 +851,7 @@ const Proposals = () => {
|
|||
<div className="relative mt-6">
|
||||
<Proposal
|
||||
proposal={currentProposal}
|
||||
multisig={securityMultisigAccount}
|
||||
multisig={priceFeedMultisigAccount}
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
@ -13,7 +13,7 @@ import toast from 'react-hot-toast'
|
|||
import { getMultisigCluster, proposeInstructions } from 'xc_admin_common'
|
||||
import { ClusterContext } from '../../contexts/ClusterContext'
|
||||
import { usePythContext } from '../../contexts/PythContext'
|
||||
import { SECURITY_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { PRICE_FEED_MULTISIG, useMultisig } from '../../hooks/useMultisig'
|
||||
import { capitalizeFirstLetter } from '../../utils/capitalizeFirstLetter'
|
||||
import ClusterSwitch from '../ClusterSwitch'
|
||||
import Modal from '../common/Modal'
|
||||
|
@ -197,7 +197,7 @@ const UpdateProductMetadata = () => {
|
|||
.updProduct(newProductMetadata)
|
||||
.accounts({
|
||||
fundingAccount: squads?.getAuthorityPDA(
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
1
|
||||
),
|
||||
productAccount: symbolToProductAccountKeyMapping[symbol],
|
||||
|
@ -212,7 +212,7 @@ const UpdateProductMetadata = () => {
|
|||
try {
|
||||
const proposalPubkey = await proposeInstructions(
|
||||
squads,
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)],
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)],
|
||||
instructions,
|
||||
false
|
||||
)
|
||||
|
|
|
@ -11,16 +11,16 @@ interface MultisigContextProps {
|
|||
error: any // TODO: fix any
|
||||
squads: SquadsMesh | undefined
|
||||
upgradeMultisigAccount: MultisigAccount | undefined
|
||||
securityMultisigAccount: MultisigAccount | undefined
|
||||
priceFeedMultisigAccount: MultisigAccount | undefined
|
||||
upgradeMultisigProposals: TransactionAccount[]
|
||||
securityMultisigProposals: TransactionAccount[]
|
||||
priceFeedMultisigProposals: TransactionAccount[]
|
||||
}
|
||||
|
||||
const MultisigContext = createContext<MultisigContextProps>({
|
||||
upgradeMultisigAccount: undefined,
|
||||
securityMultisigAccount: undefined,
|
||||
priceFeedMultisigAccount: undefined,
|
||||
upgradeMultisigProposals: [],
|
||||
securityMultisigProposals: [],
|
||||
priceFeedMultisigProposals: [],
|
||||
isLoading: true,
|
||||
error: null,
|
||||
squads: undefined,
|
||||
|
@ -41,17 +41,17 @@ export const MultisigContextProvider: React.FC<
|
|||
error,
|
||||
squads,
|
||||
upgradeMultisigAccount,
|
||||
securityMultisigAccount,
|
||||
priceFeedMultisigAccount,
|
||||
upgradeMultisigProposals,
|
||||
securityMultisigProposals,
|
||||
priceFeedMultisigProposals,
|
||||
} = useMultisig(anchorWallet as Wallet)
|
||||
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
upgradeMultisigAccount,
|
||||
securityMultisigAccount,
|
||||
priceFeedMultisigAccount,
|
||||
upgradeMultisigProposals,
|
||||
securityMultisigProposals,
|
||||
priceFeedMultisigProposals,
|
||||
isLoading,
|
||||
error,
|
||||
squads,
|
||||
|
@ -61,9 +61,9 @@ export const MultisigContextProvider: React.FC<
|
|||
isLoading,
|
||||
error,
|
||||
upgradeMultisigAccount,
|
||||
securityMultisigAccount,
|
||||
priceFeedMultisigAccount,
|
||||
upgradeMultisigProposals,
|
||||
securityMultisigProposals,
|
||||
priceFeedMultisigProposals,
|
||||
]
|
||||
)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ export const UPGRADE_MULTISIG: Record<Cluster | 'localnet', PublicKey> = {
|
|||
localnet: new PublicKey('FVQyHcooAtThJ83XFrNnv74BcinbRH3bRmfFamAHBfuj'),
|
||||
}
|
||||
|
||||
export const SECURITY_MULTISIG: Record<Cluster | 'localnet', PublicKey> = {
|
||||
export const PRICE_FEED_MULTISIG: Record<Cluster | 'localnet', PublicKey> = {
|
||||
'mainnet-beta': new PublicKey('92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8'), // TODO: placeholder value for now, fix when vault is created
|
||||
testnet: new PublicKey('92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8'), // TODO: placeholder value for now, fix when vault is created
|
||||
devnet: new PublicKey('92hQkq8kBgCUcF9yWN8URZB9RTmA4mZpDGtbiAWA74Z8'),
|
||||
|
@ -26,9 +26,9 @@ interface MultisigHookData {
|
|||
error: any // TODO: fix any
|
||||
squads: SquadsMesh | undefined
|
||||
upgradeMultisigAccount: MultisigAccount | undefined
|
||||
securityMultisigAccount: MultisigAccount | undefined
|
||||
priceFeedMultisigAccount: MultisigAccount | undefined
|
||||
upgradeMultisigProposals: TransactionAccount[]
|
||||
securityMultisigProposals: TransactionAccount[]
|
||||
priceFeedMultisigProposals: TransactionAccount[]
|
||||
}
|
||||
|
||||
const getSortedProposals = async (
|
||||
|
@ -46,12 +46,12 @@ export const useMultisig = (wallet: Wallet): MultisigHookData => {
|
|||
const [error, setError] = useState(null)
|
||||
const [upgradeMultisigAccount, setUpgradeMultisigAccount] =
|
||||
useState<MultisigAccount>()
|
||||
const [securityMultisigAccount, setSecurityMultisigAccount] =
|
||||
const [priceFeedMultisigAccount, setpriceFeedMultisigAccount] =
|
||||
useState<MultisigAccount>()
|
||||
const [upgradeMultisigProposals, setUpgradeMultisigProposals] = useState<
|
||||
TransactionAccount[]
|
||||
>([])
|
||||
const [securityMultisigProposals, setSecurityMultisigProposals] = useState<
|
||||
const [priceFeedMultisigProposals, setpriceFeedMultisigProposals] = useState<
|
||||
TransactionAccount[]
|
||||
>([])
|
||||
const [squads, setSquads] = useState<SquadsMesh>()
|
||||
|
@ -102,13 +102,13 @@ export const useMultisig = (wallet: Wallet): MultisigHookData => {
|
|||
)
|
||||
)
|
||||
if (cluster === 'devnet') {
|
||||
setSecurityMultisigAccount(
|
||||
setpriceFeedMultisigAccount(
|
||||
await squads.getMultisig(
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)]
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)]
|
||||
)
|
||||
)
|
||||
} else {
|
||||
setSecurityMultisigAccount(undefined)
|
||||
setpriceFeedMultisigAccount(undefined)
|
||||
}
|
||||
if (cancelled) return
|
||||
setUpgradeMultisigProposals(
|
||||
|
@ -118,14 +118,14 @@ export const useMultisig = (wallet: Wallet): MultisigHookData => {
|
|||
)
|
||||
)
|
||||
if (cluster === 'devnet') {
|
||||
setSecurityMultisigProposals(
|
||||
setpriceFeedMultisigProposals(
|
||||
await getSortedProposals(
|
||||
squads,
|
||||
SECURITY_MULTISIG[getMultisigCluster(cluster)]
|
||||
PRICE_FEED_MULTISIG[getMultisigCluster(cluster)]
|
||||
)
|
||||
)
|
||||
} else {
|
||||
setSecurityMultisigProposals([])
|
||||
setpriceFeedMultisigProposals([])
|
||||
}
|
||||
setSquads(squads)
|
||||
setIsLoading(false)
|
||||
|
@ -156,8 +156,8 @@ export const useMultisig = (wallet: Wallet): MultisigHookData => {
|
|||
error,
|
||||
squads,
|
||||
upgradeMultisigAccount,
|
||||
securityMultisigAccount,
|
||||
priceFeedMultisigAccount,
|
||||
upgradeMultisigProposals,
|
||||
securityMultisigProposals,
|
||||
priceFeedMultisigProposals,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue