File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed
governance/xc_admin/packages/xc_admin_frontend/hooks Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -112,14 +112,7 @@ export const usePyth = (): PythHookData => {
112
112
switch ( base ?. type ) {
113
113
case AccountType . Product :
114
114
const parsed = parseProductData ( allPythAccounts [ i ] . account . data )
115
-
116
- if ( ! parsed . priceAccountKey ) {
117
- productRawConfigs [ allPythAccounts [ i ] . pubkey . toBase58 ( ) ] = {
118
- priceAccounts : [ ] ,
119
- metadata : parsed . product ,
120
- address : allPythAccounts [ i ] . pubkey ,
121
- }
122
- } else {
115
+ if ( parsed . priceAccountKey ) {
123
116
let priceAccountKey : string | undefined =
124
117
parsed . priceAccountKey . toBase58 ( )
125
118
const priceAccounts = [ ]
@@ -157,11 +150,13 @@ export const usePyth = (): PythHookData => {
157
150
rawConfig . mappingAccounts . push ( {
158
151
next : parsed . nextMappingAccount ,
159
152
address : allPythAccounts [ i ] . pubkey ,
160
- products : parsed . productAccountKeys . map ( ( key ) => {
161
- const toAdd = productRawConfigs [ key . toBase58 ( ) ]
162
- delete productRawConfigs [ key . toBase58 ( ) ]
163
- return toAdd
164
- } ) ,
153
+ products : parsed . productAccountKeys
154
+ . filter ( ( key ) => productRawConfigs [ key . toBase58 ( ) ] )
155
+ . map ( ( key ) => {
156
+ const toAdd = productRawConfigs [ key . toBase58 ( ) ]
157
+ delete productRawConfigs [ key . toBase58 ( ) ]
158
+ return toAdd
159
+ } ) ,
165
160
} )
166
161
allPythAccounts [ i ] = allPythAccounts [ allPythAccounts . length - 1 ]
167
162
allPythAccounts . pop ( )
You can’t perform that action at this time.
0 commit comments