@@ -433,6 +433,18 @@ export class SPRegistryService {
433433 return null
434434 }
435435
436+ // Fetch capability values using the keys
437+ let capabilities : Record < string , string > = { }
438+ if ( result . capabilityKeys && result . capabilityKeys . length > 0 ) {
439+ // Convert to plain array to avoid ethers.js frozen array issues
440+ const keys = Array . from ( result . capabilityKeys ) as string [ ]
441+ const capResult = await contract . getProductCapabilities ( providerId , 0 , keys ) // 0 = ProductType.PDP
442+ // getProductCapabilities returns tuple: (bool[] exists, string[] values)
443+ // Access as capResult[1] for values array
444+ const values = Array . from ( capResult [ 1 ] || [ ] ) as string [ ]
445+ capabilities = this . _convertCapabilitiesToObject ( keys , values )
446+ }
447+
436448 return {
437449 offering : {
438450 serviceURL : result . pdpOffering . serviceURL ,
@@ -445,7 +457,7 @@ export class SPRegistryService {
445457 location : result . pdpOffering . location ,
446458 paymentTokenAddress : result . pdpOffering . paymentTokenAddress ,
447459 } ,
448- capabilities : this . _convertCapabilitiesToObject ( result . capabilityKeys , result . capabilityValues || [ ] ) ,
460+ capabilities,
449461 isActive : result . isActive ,
450462 }
451463 } catch {
@@ -569,6 +581,8 @@ export class SPRegistryService {
569581
570582 /**
571583 * Extract products from multicall PDP service result
584+ * Note: For multicall batching, capability values are set to empty strings for performance.
585+ * Use getProvider() or getPDPService() for full capability values.
572586 */
573587 private _extractProductsFromMulticallResult ( pdpServiceResult : any , iface : ethers . Interface ) : ServiceProduct [ ] {
574588 const products : ServiceProduct [ ] = [ ]
@@ -588,7 +602,9 @@ export class SPRegistryService {
588602 return products
589603 }
590604
591- // Build capabilities object
605+ // Note: Capability values are not included in multicall for performance
606+ // They would require additional contract calls per provider
607+ // Use getProvider() or getPDPService() for full capability values
592608 const capabilities = this . _buildCapabilitiesFromKeys ( capabilityKeys )
593609
594610 // Build PDP product
@@ -616,15 +632,16 @@ export class SPRegistryService {
616632 }
617633
618634 /**
619- * Build capabilities object from keys array
635+ * Build capabilities object from keys array (values set to empty for multicall performance)
636+ * For full capability values, use getProvider() or getPDPService()
620637 */
621638 private _buildCapabilitiesFromKeys ( capabilityKeys : any ) : Record < string , string > {
622639 const capabilities : Record < string , string > = { }
623640
624641 if ( capabilityKeys && Array . isArray ( capabilityKeys ) ) {
625642 for ( const key of capabilityKeys ) {
626- // For getPDPService, capabilities are returned as keys only
627- // Values would need to be fetched separately if needed
643+ // For multicall batching, we only get keys to avoid N additional contract calls
644+ // Values would need separate getProductCapabilities() calls per provider
628645 capabilities [ key ] = ''
629646 }
630647 }
0 commit comments