@@ -62,15 +62,36 @@ export const usePyth = (): PythHookData => {
62
62
cluster : cluster as PythCluster ,
63
63
} )
64
64
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 . map ( ( prod ) => prod . address . toBase58 ( ) )
70
+ ) ,
71
+ ...parsedConfig . mappingAccounts . flatMap ( ( mapping ) =>
72
+ mapping . products . flatMap ( ( prod ) =>
73
+ prod . priceAccounts . map ( ( price ) => price . address . toBase58 ( ) )
74
+ )
75
+ ) ,
76
+ ] )
77
+
78
+ // Find accounts that weren't included in the parsed config
79
+ const unprocessedAccounts = allPythAccounts . filter ( ( account ) => {
67
80
const base = parseBaseData ( account . account . data )
68
- return base && base . type !== AccountType . Test
81
+ // Skip permission accounts entirely
82
+ if ( ! base || base . type === AccountType . Permission ) {
83
+ return false
84
+ }
85
+ return ! processedPubkeys . has ( account . pubkey . toBase58 ( ) )
69
86
} )
70
87
71
- if ( remainingAccounts . length > 0 ) {
88
+ if ( unprocessedAccounts . length > 0 ) {
72
89
console . warn (
73
- `${ remainingAccounts . length } accounts were not processed`
90
+ `${ unprocessedAccounts . length } accounts were not processed:` ,
91
+ unprocessedAccounts . map ( ( acc ) => ( {
92
+ pubkey : acc . pubkey . toBase58 ( ) ,
93
+ type : parseBaseData ( acc . account . data ) ?. type ,
94
+ } ) )
74
95
)
75
96
}
76
97
0 commit comments