|
|
@@ -12,11 +12,9 @@ import {
|
|
|
MultisigParser,
|
|
|
PythMultisigInstruction,
|
|
|
MessageBufferMultisigInstruction,
|
|
|
- UnrecognizedProgram,
|
|
|
WormholeMultisigInstruction,
|
|
|
getManyProposalsInstructions,
|
|
|
- SystemProgramMultisigInstruction,
|
|
|
- BpfUpgradableLoaderInstruction,
|
|
|
+ getProgramName,
|
|
|
} from 'xc_admin_common'
|
|
|
import { ClusterContext } from '../../contexts/ClusterContext'
|
|
|
import { useMultisigContext } from '../../contexts/MultisigContext'
|
|
|
@@ -249,11 +247,7 @@ const Proposal = ({
|
|
|
const multisigCluster = getMultisigCluster(contextCluster)
|
|
|
const targetClusters: (PythCluster | 'unknown')[] = []
|
|
|
instructions.map((ix) => {
|
|
|
- if (
|
|
|
- ix instanceof PythMultisigInstruction ||
|
|
|
- ix instanceof SystemProgramMultisigInstruction ||
|
|
|
- ix instanceof BpfUpgradableLoaderInstruction
|
|
|
- ) {
|
|
|
+ if (!(ix instanceof WormholeMultisigInstruction)) {
|
|
|
targetClusters.push(multisigCluster)
|
|
|
} else if (
|
|
|
ix instanceof WormholeMultisigInstruction &&
|
|
|
@@ -549,22 +543,9 @@ const Proposal = ({
|
|
|
className="flex justify-between"
|
|
|
>
|
|
|
<div>Program</div>
|
|
|
- <div>
|
|
|
- {instruction instanceof PythMultisigInstruction
|
|
|
- ? 'Pyth Oracle'
|
|
|
- : instruction instanceof WormholeMultisigInstruction
|
|
|
- ? 'Wormhole'
|
|
|
- : instruction instanceof SystemProgramMultisigInstruction
|
|
|
- ? 'System Program'
|
|
|
- : instruction instanceof BpfUpgradableLoaderInstruction
|
|
|
- ? 'BPF Upgradable Loader'
|
|
|
- : 'Unknown'}
|
|
|
- </div>
|
|
|
+ <div>{getProgramName(instruction.program)}</div>
|
|
|
</div>
|
|
|
- {instruction instanceof PythMultisigInstruction ||
|
|
|
- instruction instanceof WormholeMultisigInstruction ||
|
|
|
- instruction instanceof BpfUpgradableLoaderInstruction ||
|
|
|
- instruction instanceof SystemProgramMultisigInstruction ? (
|
|
|
+ {
|
|
|
<div
|
|
|
key={`${index}_instructionName`}
|
|
|
className="flex justify-between"
|
|
|
@@ -572,7 +553,7 @@ const Proposal = ({
|
|
|
<div>Instruction Name</div>
|
|
|
<div>{instruction.name}</div>
|
|
|
</div>
|
|
|
- ) : null}
|
|
|
+ }
|
|
|
{instruction instanceof WormholeMultisigInstruction &&
|
|
|
instruction.governanceAction ? (
|
|
|
<>
|
|
|
@@ -585,69 +566,64 @@ const Proposal = ({
|
|
|
</div>
|
|
|
</>
|
|
|
) : null}
|
|
|
- {instruction instanceof WormholeMultisigInstruction ||
|
|
|
- instruction instanceof UnrecognizedProgram ? null : (
|
|
|
+ {instruction instanceof WormholeMultisigInstruction ? null : (
|
|
|
<div
|
|
|
key={`${index}_arguments`}
|
|
|
className="grid grid-cols-4 justify-between"
|
|
|
>
|
|
|
<div>Arguments</div>
|
|
|
- {instruction instanceof PythMultisigInstruction ||
|
|
|
- instruction instanceof SystemProgramMultisigInstruction ||
|
|
|
- instruction instanceof BpfUpgradableLoaderInstruction ? (
|
|
|
- Object.keys(instruction.args).length > 0 ? (
|
|
|
- <div className="col-span-4 mt-2 bg-darkGray2 p-4 lg:col-span-3 lg:mt-0">
|
|
|
- <div className="base16 flex justify-between pt-2 pb-6 font-semibold opacity-60">
|
|
|
- <div>Key</div>
|
|
|
- <div>Value</div>
|
|
|
- </div>
|
|
|
- {Object.keys(instruction.args).map((key, index) => (
|
|
|
- <Fragment key={index}>
|
|
|
- <div className="flex justify-between border-t border-beige-300 py-3">
|
|
|
- <div>{key}</div>
|
|
|
- {instruction.args[key] instanceof PublicKey ? (
|
|
|
- <CopyPubkey
|
|
|
- pubkey={instruction.args[key].toBase58()}
|
|
|
- />
|
|
|
- ) : typeof instruction.args[key] === 'string' &&
|
|
|
- isPubkey(instruction.args[key]) ? (
|
|
|
- <CopyPubkey pubkey={instruction.args[key]} />
|
|
|
- ) : (
|
|
|
- <div className="max-w-sm break-all">
|
|
|
- {typeof instruction.args[key] === 'string'
|
|
|
- ? instruction.args[key]
|
|
|
- : instruction.args[key] instanceof Uint8Array
|
|
|
- ? instruction.args[key].toString('hex')
|
|
|
- : JSON.stringify(instruction.args[key])}
|
|
|
- </div>
|
|
|
- )}
|
|
|
- </div>
|
|
|
- {key === 'pub' &&
|
|
|
- instruction.args[key].toBase58() in
|
|
|
- publisherKeyToNameMappingCluster ? (
|
|
|
- <ParsedAccountPubkeyRow
|
|
|
- key={`${index}_${instruction.args[
|
|
|
- key
|
|
|
- ].toBase58()}`}
|
|
|
- mapping={publisherKeyToNameMappingCluster}
|
|
|
- title="publisher"
|
|
|
+ {Object.keys(instruction.args).length > 0 ? (
|
|
|
+ <div className="col-span-4 mt-2 bg-darkGray2 p-4 lg:col-span-3 lg:mt-0">
|
|
|
+ <div className="base16 flex justify-between pt-2 pb-6 font-semibold opacity-60">
|
|
|
+ <div>Key</div>
|
|
|
+ <div>Value</div>
|
|
|
+ </div>
|
|
|
+ {Object.keys(instruction.args).map((key, index) => (
|
|
|
+ <Fragment key={index}>
|
|
|
+ <div className="flex justify-between border-t border-beige-300 py-3">
|
|
|
+ <div>{key}</div>
|
|
|
+ {instruction.args[key] instanceof PublicKey ? (
|
|
|
+ <CopyPubkey
|
|
|
pubkey={instruction.args[key].toBase58()}
|
|
|
/>
|
|
|
- ) : null}
|
|
|
- </Fragment>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- ) : (
|
|
|
- <div className="col-span-3 text-right">No arguments</div>
|
|
|
- )
|
|
|
+ ) : typeof instruction.args[key] === 'string' &&
|
|
|
+ isPubkey(instruction.args[key]) ? (
|
|
|
+ <CopyPubkey pubkey={instruction.args[key]} />
|
|
|
+ ) : (
|
|
|
+ <div className="max-w-sm break-all">
|
|
|
+ {typeof instruction.args[key] === 'string'
|
|
|
+ ? instruction.args[key]
|
|
|
+ : instruction.args[key] instanceof Uint8Array
|
|
|
+ ? instruction.args[key].toString('hex')
|
|
|
+ : JSON.stringify(instruction.args[key])}
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ {key === 'pub' &&
|
|
|
+ instruction.args[key].toBase58() in
|
|
|
+ publisherKeyToNameMappingCluster ? (
|
|
|
+ <ParsedAccountPubkeyRow
|
|
|
+ key={`${index}_${instruction.args[key].toBase58()}`}
|
|
|
+ mapping={publisherKeyToNameMappingCluster}
|
|
|
+ title="publisher"
|
|
|
+ pubkey={instruction.args[key].toBase58()}
|
|
|
+ />
|
|
|
+ ) : null}
|
|
|
+ </Fragment>
|
|
|
+ ))}
|
|
|
+ </div>
|
|
|
) : (
|
|
|
- <div className="col-span-3 text-right">Unknown</div>
|
|
|
+ <div className="col-span-3 text-right">No arguments</div>
|
|
|
)}
|
|
|
</div>
|
|
|
)}
|
|
|
- {instruction instanceof PythMultisigInstruction ||
|
|
|
- instruction instanceof SystemProgramMultisigInstruction ||
|
|
|
- instruction instanceof BpfUpgradableLoaderInstruction ? (
|
|
|
+ {instruction instanceof WormholeMultisigInstruction && (
|
|
|
+ <WormholeInstructionView
|
|
|
+ cluster={cluster}
|
|
|
+ instruction={instruction}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ {!(instruction instanceof WormholeMultisigInstruction) ? (
|
|
|
<div
|
|
|
key={`${index}_accounts`}
|
|
|
className="grid grid-cols-4 justify-between"
|
|
|
@@ -716,61 +692,7 @@ const Proposal = ({
|
|
|
<div>No arguments</div>
|
|
|
)}
|
|
|
</div>
|
|
|
- ) : instruction instanceof UnrecognizedProgram ? (
|
|
|
- <>
|
|
|
- <div
|
|
|
- key={`${index}_programId`}
|
|
|
- className="flex justify-between"
|
|
|
- >
|
|
|
- <div>Program ID</div>
|
|
|
- <CopyPubkey
|
|
|
- pubkey={instruction.instruction.programId.toBase58()}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div key={`${index}_data`} className="flex justify-between">
|
|
|
- <div>Data</div>
|
|
|
- <div className="max-w-sm break-all">
|
|
|
- {instruction.instruction.data.length > 0
|
|
|
- ? instruction.instruction.data.toString('hex')
|
|
|
- : 'No data'}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div
|
|
|
- key={`${index}_keys`}
|
|
|
- className="grid grid-cols-4 justify-between"
|
|
|
- >
|
|
|
- <div>Keys</div>
|
|
|
- <div className="col-span-4 mt-2 bg-darkGray2 p-4 lg:col-span-3 lg:mt-0">
|
|
|
- <div className="base16 flex justify-between pt-2 pb-6 font-semibold opacity-60">
|
|
|
- <div>Key #</div>
|
|
|
- <div>Pubkey</div>
|
|
|
- </div>
|
|
|
- {instruction.instruction.keys.map((key, index) => (
|
|
|
- <>
|
|
|
- <div
|
|
|
- key={index}
|
|
|
- className="flex justify-between border-t border-beige-300 py-3"
|
|
|
- >
|
|
|
- <div>Key {index + 1}</div>
|
|
|
- <div className="flex space-x-2">
|
|
|
- {key.isSigner ? <SignerTag /> : null}
|
|
|
- {key.isWritable ? <WritableTag /> : null}
|
|
|
- <CopyPubkey pubkey={key.pubkey.toBase58()} />
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </>
|
|
|
- ))}
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </>
|
|
|
) : null}
|
|
|
- {instruction instanceof WormholeMultisigInstruction && (
|
|
|
- <WormholeInstructionView
|
|
|
- cluster={cluster}
|
|
|
- instruction={instruction}
|
|
|
- />
|
|
|
- )}
|
|
|
-
|
|
|
{index !== instructions.length - 1 ? (
|
|
|
<hr className="border-gray-700" />
|
|
|
) : null}
|