@@ -155,7 +155,8 @@ export function createTokenHostRegistryDirectReadAdapter({
155155 readContract ( reads . receiptPayer ) ,
156156 ] ) ;
157157 const object = normalizeRegistryStorageObject ( objectResult ) ;
158- const normalizedObjectId = object . objectId === "0" ? decimalString ( objectId ) : object . objectId ;
158+ if ( isMissingRegistryObject ( object ) ) return null ;
159+ const normalizedObjectId = object . objectId ;
159160
160161 return {
161162 objectId : normalizedObjectId ,
@@ -186,7 +187,9 @@ export function createTokenHostRegistryDirectReadAdapter({
186187 ) ,
187188 } ) ;
188189 const ids = Array . from ( page . values , decimalString ) ;
189- const objects = await mapWithConcurrency ( ids , maxDetailConcurrency , readObjectDetails ) ;
190+ const objects = (
191+ await mapWithConcurrency ( ids , maxDetailConcurrency , readObjectDetails )
192+ ) . filter ( Boolean ) ;
190193
191194 return {
192195 sourceOfTruth : DIRECT_READ_SOURCE ,
@@ -384,6 +387,7 @@ export function createTokenHostRegistryDirectReadAdapter({
384387
385388 async function mergeObjectDetail ( model , objectId ) {
386389 const row = await readObjectDetails ( objectId ) ;
390+ if ( ! row ) return ;
387391 model . objects [ row . objectId ] = row . object ;
388392 model . copyReceipts [ row . objectId ] = row . copyReceipts ;
389393 model . receiptPayers [ row . objectId ] = row . receiptPayer ;
@@ -398,6 +402,7 @@ export function createTokenHostRegistryDirectReadAdapter({
398402 includeTerminal : options . includeTerminal ?? includeTerminal ,
399403 } ) ;
400404 for ( const row of result . objects ) {
405+ if ( ! row ) continue ;
401406 model . objects [ row . objectId ] = row . object ;
402407 model . copyReceipts [ row . objectId ] = row . copyReceipts ;
403408 model . receiptPayers [ row . objectId ] = row . receiptPayer ;
@@ -763,6 +768,10 @@ function currentUnixSeconds() {
763768 return Math . floor ( Date . now ( ) / 1000 ) ;
764769}
765770
771+ function isMissingRegistryObject ( object ) {
772+ return object . objectId === "0" ;
773+ }
774+
766775function decimalString ( value ) {
767776 return BigInt ( value ) . toString ( ) ;
768777}
0 commit comments