diff --git a/explorer/src/components/account/UpgradeableLoaderAccountSection.tsx b/explorer/src/components/account/UpgradeableLoaderAccountSection.tsx index e41066f12..456be5f08 100644 --- a/explorer/src/components/account/UpgradeableLoaderAccountSection.tsx +++ b/explorer/src/components/account/UpgradeableLoaderAccountSection.tsx @@ -13,6 +13,7 @@ import { Slot } from "components/common/Slot"; import { addressLabel } from "utils/tx"; import { useCluster } from "providers/cluster"; import { ErrorCard } from "components/common/ErrorCard"; +import { UnknownAccountCard } from "components/account/UnknownAccountCard"; export function UpgradeableLoaderAccountSection({ account, @@ -52,6 +53,9 @@ export function UpgradeableLoaderAccountSection({ /> ); } + case "uninitialized": { + return ; + } } } diff --git a/explorer/src/validators/accounts/upgradeable-program.ts b/explorer/src/validators/accounts/upgradeable-program.ts index 07aa6416f..e00183ed5 100644 --- a/explorer/src/validators/accounts/upgradeable-program.ts +++ b/explorer/src/validators/accounts/upgradeable-program.ts @@ -9,6 +9,7 @@ import { union, coerce, create, + any, } from "superstruct"; import { ParsedInfo } from "validators"; import { PublicKeyFromString } from "validators/pubkey"; @@ -49,9 +50,27 @@ export const ProgramBufferAccount = type({ info: ProgramBufferAccountInfo, }); +export type ProgramUninitializedAccountInfo = Infer< + typeof ProgramUninitializedAccountInfo +>; +export const ProgramUninitializedAccountInfo = any(); + +export type ProgramUninitializedAccount = Infer< + typeof ProgramUninitializedAccount +>; +export const ProgramUninitializedAccount = type({ + type: literal("uninitialized"), + info: ProgramUninitializedAccountInfo, +}); + export type UpgradeableLoaderAccount = Infer; export const UpgradeableLoaderAccount = coerce( - union([ProgramAccount, ProgramDataAccount, ProgramBufferAccount]), + union([ + ProgramAccount, + ProgramDataAccount, + ProgramBufferAccount, + ProgramUninitializedAccount, + ]), ParsedInfo, (value) => { // Coercions like `PublicKeyFromString` are not applied within @@ -75,6 +94,12 @@ export const UpgradeableLoaderAccount = coerce( info: create(value.info, ProgramBufferAccountInfo), }; } + case "uninitialized": { + return { + type: value.type, + info: create(value.info, ProgramUninitializedAccountInfo), + }; + } default: { throw new Error(`Unknown program account type: ${value.type}`); }