|
|
@@ -13,18 +13,17 @@ import {
|
|
|
SetDataSources,
|
|
|
SetFee,
|
|
|
SetValidPeriod,
|
|
|
+ SystemProgramMultisigInstruction,
|
|
|
UnrecognizedProgram,
|
|
|
WormholeMultisigInstruction,
|
|
|
} from 'xc_admin_common'
|
|
|
import { AccountMeta, PublicKey } from '@solana/web3.js'
|
|
|
import CopyPubkey from '../common/CopyPubkey'
|
|
|
-import { useContext } from 'react'
|
|
|
-import { ClusterContext } from '../../contexts/ClusterContext'
|
|
|
import { ParsedAccountPubkeyRow, SignerTag, WritableTag } from './AccountUtils'
|
|
|
import { usePythContext } from '../../contexts/PythContext'
|
|
|
-
|
|
|
import { getMappingCluster, isPubkey } from './utils'
|
|
|
import { PythCluster } from '@pythnetwork/client'
|
|
|
+import { lamportsToSol } from '../../utils/lamportsToSol'
|
|
|
|
|
|
const GovernanceInstructionView = ({
|
|
|
instruction,
|
|
|
@@ -93,6 +92,9 @@ export const WormholeInstructionView = ({
|
|
|
: parsedInstruction instanceof
|
|
|
MessageBufferMultisigInstruction
|
|
|
? 'Message Buffer'
|
|
|
+ : parsedInstruction instanceof
|
|
|
+ SystemProgramMultisigInstruction
|
|
|
+ ? 'System Program'
|
|
|
: 'Unknown'}
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -104,7 +106,9 @@ export const WormholeInstructionView = ({
|
|
|
<div>
|
|
|
{parsedInstruction instanceof PythMultisigInstruction ||
|
|
|
parsedInstruction instanceof WormholeMultisigInstruction ||
|
|
|
- parsedInstruction instanceof MessageBufferMultisigInstruction
|
|
|
+ parsedInstruction instanceof
|
|
|
+ MessageBufferMultisigInstruction ||
|
|
|
+ parsedInstruction instanceof SystemProgramMultisigInstruction
|
|
|
? parsedInstruction.name
|
|
|
: 'Unknown'}
|
|
|
</div>
|
|
|
@@ -116,8 +120,9 @@ export const WormholeInstructionView = ({
|
|
|
<div>Arguments</div>
|
|
|
{parsedInstruction instanceof PythMultisigInstruction ||
|
|
|
parsedInstruction instanceof WormholeMultisigInstruction ||
|
|
|
+ parsedInstruction instanceof MessageBufferMultisigInstruction ||
|
|
|
parsedInstruction instanceof
|
|
|
- MessageBufferMultisigInstruction ? (
|
|
|
+ SystemProgramMultisigInstruction ? (
|
|
|
Object.keys(parsedInstruction.args).length > 0 ? (
|
|
|
<div className="col-span-4 mt-2 bg-[#444157] p-4 lg:col-span-3 lg:mt-0">
|
|
|
<div className="base16 flex justify-between pt-2 pb-6 font-semibold opacity-60">
|
|
|
@@ -130,26 +135,48 @@ export const WormholeInstructionView = ({
|
|
|
key={index}
|
|
|
className="flex justify-between border-t border-beige-300 py-3"
|
|
|
>
|
|
|
- <div>{key}</div>
|
|
|
- {parsedInstruction.args[key] instanceof
|
|
|
- PublicKey ? (
|
|
|
- <CopyPubkey
|
|
|
- pubkey={parsedInstruction.args[key].toBase58()}
|
|
|
- />
|
|
|
- ) : typeof instruction.args[key] === 'string' &&
|
|
|
- isPubkey(instruction.args[key]) ? (
|
|
|
- <CopyPubkey
|
|
|
- pubkey={parsedInstruction.args[key]}
|
|
|
- />
|
|
|
+ {key === 'lamports' &&
|
|
|
+ typeof parsedInstruction.args[key] === 'bigint' ? (
|
|
|
+ <>
|
|
|
+ <div>{'◎'}</div>
|
|
|
+ <div>
|
|
|
+ {lamportsToSol(parsedInstruction.args[key])}
|
|
|
+ </div>
|
|
|
+ </>
|
|
|
) : (
|
|
|
- <div className="max-w-sm break-all">
|
|
|
- {typeof parsedInstruction.args[key] === 'string'
|
|
|
- ? parsedInstruction.args[key]
|
|
|
- : parsedInstruction.args[key] instanceof
|
|
|
- Uint8Array
|
|
|
- ? parsedInstruction.args[key].toString('hex')
|
|
|
- : JSON.stringify(parsedInstruction.args[key])}
|
|
|
- </div>
|
|
|
+ <>
|
|
|
+ <div>{key}</div>
|
|
|
+ {parsedInstruction.args[key] instanceof
|
|
|
+ PublicKey ? (
|
|
|
+ <CopyPubkey
|
|
|
+ pubkey={parsedInstruction.args[
|
|
|
+ key
|
|
|
+ ].toBase58()}
|
|
|
+ />
|
|
|
+ ) : typeof instruction.args[key] === 'string' &&
|
|
|
+ isPubkey(instruction.args[key]) ? (
|
|
|
+ <CopyPubkey
|
|
|
+ pubkey={parsedInstruction.args[key]}
|
|
|
+ />
|
|
|
+ ) : (
|
|
|
+ <div className="max-w-sm break-all">
|
|
|
+ {typeof parsedInstruction.args[key] ===
|
|
|
+ 'string'
|
|
|
+ ? parsedInstruction.args[key]
|
|
|
+ : parsedInstruction.args[key] instanceof
|
|
|
+ Uint8Array
|
|
|
+ ? parsedInstruction.args[key].toString(
|
|
|
+ 'hex'
|
|
|
+ )
|
|
|
+ : typeof parsedInstruction.args[key] ===
|
|
|
+ 'bigint'
|
|
|
+ ? parsedInstruction.args[key].toString()
|
|
|
+ : JSON.stringify(
|
|
|
+ parsedInstruction.args[key]
|
|
|
+ )}
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
+ </>
|
|
|
)}
|
|
|
</div>
|
|
|
{key === 'pub' &&
|
|
|
@@ -176,7 +203,8 @@ export const WormholeInstructionView = ({
|
|
|
</div>
|
|
|
{parsedInstruction instanceof PythMultisigInstruction ||
|
|
|
parsedInstruction instanceof WormholeMultisigInstruction ||
|
|
|
- parsedInstruction instanceof MessageBufferMultisigInstruction ? (
|
|
|
+ parsedInstruction instanceof MessageBufferMultisigInstruction ||
|
|
|
+ parsedInstruction instanceof SystemProgramMultisigInstruction ? (
|
|
|
<div
|
|
|
key={`${index}_accounts`}
|
|
|
className="grid grid-cols-4 justify-between"
|