diff --git a/explorer/client/src/utils/api/searchUtil.ts b/explorer/client/src/utils/api/searchUtil.ts index 11c9c2458bd55..75743b1881e1a 100644 --- a/explorer/client/src/utils/api/searchUtil.ts +++ b/explorer/client/src/utils/api/searchUtil.ts @@ -1,6 +1,8 @@ // Copyright (c) 2022, Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 +import { isObjectNotExistsInfo, isObjectRef } from 'sui.js'; + import { DefaultRpcClient as rpc } from './DefaultRpcClient'; export const navigateWithUnknown = async ( @@ -15,10 +17,17 @@ export const navigateWithUnknown = async ( data: data, }; }); - const objInfoPromise = rpc.getObjectInfo(input).then((data) => ({ - category: 'objects', - data: data, - })); + const objInfoPromise = rpc.getObjectInfo(input).then((data) => { + const deets = data.details; + if (isObjectNotExistsInfo(deets) && !isObjectRef(deets)) { + throw new Error('no object found'); + } + + return { + category: 'objects', + data: data, + }; + }); const txDetailsPromise = rpc.getTransaction(input).then((data) => ({ category: 'transactions', diff --git a/sdk/typescript/src/index.ts b/sdk/typescript/src/index.ts index e988599025514..151b0655cd6a6 100644 --- a/sdk/typescript/src/index.ts +++ b/sdk/typescript/src/index.ts @@ -18,5 +18,6 @@ export * from './signers/raw-signer'; export * from './signers/signer-with-provider'; export * from './types'; +export * from './index.guard'; export * as BCS from './bcs';