|
1 | 1 | // Copyright (c) 2025 IOTA Stiftung |
2 | 2 | // SPDX-License-Identifier: Apache-2.0 |
3 | 3 | 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'; |
9 | 5 | import { IotaParsedData } from '@iota/iota-sdk/client'; |
10 | 6 |
|
11 | 7 | import { useIotaNamesClient } from '@/contexts'; |
@@ -41,13 +37,15 @@ export function useRegistrationNfts(type: RegistrationNftType = 'name') { |
41 | 37 | | Extract<IotaParsedData, { dataType: 'moveObject' }> |
42 | 38 | | undefined |
43 | 39 | | 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); |
49 | 47 | return { |
50 | | - name: data?.name ?? '', |
| 48 | + name: data?.name ?? fields?.name_str ?? '', |
51 | 49 | description: data?.description, |
52 | 50 | imageUrl: data?.image_url, |
53 | 51 | link: data?.link, |
|
0 commit comments