Skip to content

Commit c44248d

Browse files
authored
fix(dapp): Better display fallback parsing (#1123)
* fix(dapp): Better display fallback parsing * fmt
1 parent e38f7f1 commit c44248d

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

dapp/src/hooks/useRegistrationNfts.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
// Copyright (c) 2025 IOTA Stiftung
22
// SPDX-License-Identifier: Apache-2.0
33
import { useCurrentAccount } from '@iota/dapp-kit';
4-
import {
5-
getNameRegistrationType,
6-
getSubnameRegistrationType,
7-
isSubname,
8-
} from '@iota/iota-names-sdk';
4+
import { getNameRegistrationType, getSubnameRegistrationType } from '@iota/iota-names-sdk';
95
import { IotaParsedData } from '@iota/iota-sdk/client';
106

117
import { useIotaNamesClient } from '@/contexts';
@@ -41,13 +37,15 @@ export function useRegistrationNfts(type: RegistrationNftType = 'name') {
4137
| Extract<IotaParsedData, { dataType: 'moveObject' }>
4238
| undefined
4339
| null;
44-
const isNameSubname = isSubname(data?.name || '');
45-
type NameFields = undefined | { expiration_timestamp_ms?: string };
46-
const fields = isNameSubname
47-
? (content?.fields as { nft: { fields: NameFields } }).nft.fields
48-
: (content?.fields as NameFields);
40+
type NameFields =
41+
| undefined
42+
| { expiration_timestamp_ms?: string; name_str?: string };
43+
const fields =
44+
type === 'subname'
45+
? (content?.fields as { nft: { fields: NameFields } }).nft.fields
46+
: (content?.fields as NameFields);
4947
return {
50-
name: data?.name ?? '',
48+
name: data?.name ?? fields?.name_str ?? '',
5149
description: data?.description,
5250
imageUrl: data?.image_url,
5351
link: data?.link,

0 commit comments

Comments
 (0)