fix silent publickey error

This commit is contained in:
Adrian Brzeziński 2024-06-10 00:08:19 +02:00
parent 76785dfeca
commit 6a46912221
2 changed files with 3 additions and 2 deletions

View File

@ -30,6 +30,7 @@ import { notify } from 'utils/notifications'
import { usePlausible } from 'next-plausible'
import { TelemetryEvents } from 'utils/telemetry'
import { groupBy, mapValues, maxBy, sampleSize } from 'lodash'
import { tryGetPubKey } from 'utils/governance/tools'
const set = mangoStore.getState().set
const actions = mangoStore.getState().actions
@ -228,7 +229,7 @@ const ReadOnlyMangoAccount = () => {
async function loadUnownedMangoAccount() {
try {
if (!ma || !group) return
if (!ma || !group || !tryGetPubKey(ma)) return
const client = mangoStore.getState().client
const pk = new PublicKey(ma)

View File

@ -92,7 +92,7 @@ export function parseMintAccountData(data: Buffer): RawMint {
export const fmtTokenAmount = (c: BN, decimals?: number) =>
c?.div(new BN(10).pow(new BN(decimals ?? 0))).toNumber() || 0
export const tryGetPubKey = (pubkey: string) => {
export const tryGetPubKey = (pubkey: string | string[]) => {
try {
return new PublicKey(pubkey)
} catch (e) {