Commit db405c1c authored by Igor Stuev's avatar Igor Stuev Committed by GitHub

fix xstar responce format (#2392)

parent ba1a213f
...@@ -17,7 +17,7 @@ export default function useFetchXStarScore({ hash }: Params) { ...@@ -17,7 +17,7 @@ export default function useFetchXStarScore({ hash }: Params) {
pathParams: { hash }, pathParams: { hash },
queryOptions: { queryOptions: {
select: (response) => { select: (response) => {
const parsedResponse = v.safeParse(v.object({ data: v.string() }), response); const parsedResponse = v.safeParse(v.object({ data: v.object({ level: v.nullable(v.string()) }) }), response);
if (!parsedResponse.success) { if (!parsedResponse.success) {
throw Error(ERROR_NAME); throw Error(ERROR_NAME);
...@@ -27,7 +27,7 @@ export default function useFetchXStarScore({ hash }: Params) { ...@@ -27,7 +27,7 @@ export default function useFetchXStarScore({ hash }: Params) {
}, },
enabled: Boolean(hash) && config.features.xStarScore.isEnabled, enabled: Boolean(hash) && config.features.xStarScore.isEnabled,
placeholderData: { placeholderData: {
data: 'Base' as const, data: { level: 'Base' },
}, },
retry: 0, retry: 0,
}, },
......
...@@ -273,5 +273,7 @@ export type AddressEpochRewardsItem = { ...@@ -273,5 +273,7 @@ export type AddressEpochRewardsItem = {
}; };
export type AddressXStarResponse = { export type AddressXStarResponse = {
data: string | null; data: {
level: string | null;
};
}; };
...@@ -302,10 +302,10 @@ const AddressPageContent = () => { ...@@ -302,10 +302,10 @@ const AddressPageContent = () => {
undefined, undefined,
...formatUserTags(addressQuery.data), ...formatUserTags(addressQuery.data),
...(addressMetadataQuery.data?.addresses?.[hash.toLowerCase()]?.tags.filter(tag => tag.tagType !== 'note') || []), ...(addressMetadataQuery.data?.addresses?.[hash.toLowerCase()]?.tags.filter(tag => tag.tagType !== 'note') || []),
!addressQuery.data?.is_contract && xScoreFeature.isEnabled && xStarQuery.data?.data ? !addressQuery.data?.is_contract && xScoreFeature.isEnabled && xStarQuery.data?.data.level ?
{ {
slug: 'xstar', slug: 'xstar',
name: `XHS ${ xStarQuery.data.data } level`, name: `XHS ${ xStarQuery.data.data.level } level`,
tagType: 'custom' as const, tagType: 'custom' as const,
ordinal: 12, ordinal: 12,
meta: { meta: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment