@@ -62,15 +62,34 @@ export const usePyth = (): PythHookData => {
6262 cluster : cluster as PythCluster ,
6363 } )
6464
65- // Verify all accounts were processed
66- const remainingAccounts = allPythAccounts . filter ( ( account ) => {
65+ // Get all account pubkeys from the parsed config
66+ const processedPubkeys = new Set < string > ( [
67+ ...parsedConfig . mappingAccounts . map ( ( acc ) => acc . address . toBase58 ( ) ) ,
68+ ...parsedConfig . mappingAccounts . flatMap ( ( mapping ) =>
69+ mapping . products . flatMap ( ( prod ) => [
70+ prod . address . toBase58 ( ) ,
71+ ...prod . priceAccounts . map ( ( price ) => price . address . toBase58 ( ) ) ,
72+ ] )
73+ ) ,
74+ ] )
75+
76+ // Find accounts that weren't included in the parsed config
77+ const unprocessedAccounts = allPythAccounts . filter ( ( account ) => {
6778 const base = parseBaseData ( account . account . data )
68- return base && base . type !== AccountType . Test
79+ // Skip permission accounts entirely
80+ if ( ! base || base . type === AccountType . Permission ) {
81+ return false
82+ }
83+ return ! processedPubkeys . has ( account . pubkey . toBase58 ( ) )
6984 } )
7085
71- if ( remainingAccounts . length > 0 ) {
86+ if ( unprocessedAccounts . length > 0 ) {
7287 console . warn (
73- `${ remainingAccounts . length } accounts were not processed`
88+ `${ unprocessedAccounts . length } accounts were not processed:` ,
89+ unprocessedAccounts . map ( ( acc ) => ( {
90+ pubkey : acc . pubkey . toBase58 ( ) ,
91+ type : parseBaseData ( acc . account . data ) ?. type ,
92+ } ) )
7493 )
7594 }
7695
0 commit comments