@@ -43,6 +43,7 @@ interface StampListSectionProps {
4343 setShowStampList : ( show : boolean ) => void ;
4444 address : string | undefined ;
4545 beeApiUrl : string ;
46+ nodeAddress : string ; // The node address to filter stamps by
4647 setPostageBatchId : ( id : string ) => void ;
4748 setShowOverlay : ( show : boolean ) => void ;
4849 setUploadStep : ( step : UploadStep ) => void ;
@@ -78,6 +79,7 @@ const StampListSection: React.FC<StampListSectionProps> = ({
7879 setShowStampList,
7980 address,
8081 beeApiUrl,
82+ nodeAddress,
8183 setPostageBatchId,
8284 setShowOverlay,
8385 setUploadStep,
@@ -304,8 +306,25 @@ const StampListSection: React.FC<StampListSectionProps> = ({
304306 // Process the batches data with optimized batching
305307 console . log ( `📊 Processing ${ ( batchesData as any [ ] ) . length } stamps from contract...` ) ;
306308
309+ // Filter batches to only include those for the current node
310+ const batchesForCurrentNode = ( batchesData as any [ ] ) . filter ( batch => {
311+ const batchNodeAddress = batch . nodeAddress ?. toLowerCase ( ) ;
312+ const currentNodeAddress = nodeAddress ?. toLowerCase ( ) ;
313+ const isForCurrentNode = batchNodeAddress === currentNodeAddress ;
314+ if ( ! isForCurrentNode ) {
315+ console . log (
316+ `🔀 Skipping stamp ${ batch . batchId . toString ( ) . slice ( 0 , 10 ) } ... (node: ${ batchNodeAddress ?. slice ( 0 , 10 ) } ... != current: ${ currentNodeAddress ?. slice ( 0 , 10 ) } ...)`
317+ ) ;
318+ }
319+ return isForCurrentNode ;
320+ } ) ;
321+
322+ console . log (
323+ `🎯 Found ${ batchesForCurrentNode . length } stamps for current node (${ ( batchesData as any [ ] ) . length - batchesForCurrentNode . length } for other nodes)`
324+ ) ;
325+
307326 // Filter out known expired stamps before making API calls
308- const batchesToCheck = ( batchesData as any [ ] ) . filter ( batch => {
327+ const batchesToCheck = batchesForCurrentNode . filter ( batch => {
309328 const batchId = batch . batchId . toString ( ) ;
310329 const isExpired = isStampKnownExpired ( batchId ) ;
311330 if ( isExpired ) {
@@ -315,7 +334,7 @@ const StampListSection: React.FC<StampListSectionProps> = ({
315334 } ) ;
316335
317336 console . log (
318- `🔍 Making API calls for ${ batchesToCheck . length } stamps (${ ( batchesData as any [ ] ) . length - batchesToCheck . length } skipped from cache)`
337+ `🔍 Making API calls for ${ batchesToCheck . length } stamps (${ batchesForCurrentNode . length - batchesToCheck . length } skipped from cache)`
319338 ) ;
320339
321340 // Process stamps in smaller batches to avoid overwhelming the API
@@ -392,7 +411,7 @@ const StampListSection: React.FC<StampListSectionProps> = ({
392411 } ;
393412
394413 fetchStamps ( ) ;
395- } , [ address , beeApiUrl ] ) ; // Only dependencies that actually need to trigger re-fetching
414+ } , [ address , beeApiUrl , nodeAddress ] ) ; // Re-fetch when address, API URL, or node changes
396415
397416 // Function to refresh a specific stamp
398417 const refreshSingleStamp = async ( stampToRefresh : BatchEvent ) => {
0 commit comments