|
| 1 | +from dataclasses import dataclass |
1 | 2 | """ |
2 | 3 | hiero_sdk_python.tokens.token_nft_info.py |
3 | 4 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|
10 | 11 | from hiero_sdk_python.tokens.nft_id import NftId |
11 | 12 | from hiero_sdk_python.hapi.services import timestamp_pb2, token_get_nft_info_pb2 |
12 | 13 |
|
| 14 | +@dataclass |
13 | 15 | class TokenNftInfo: |
14 | 16 | """ |
15 | 17 | Represents information about a Non-Fungible Token (NFT) on the Hedera network. |
16 | 18 | |
17 | | - This class encapsulates details about an NFT including its unique identifier, |
| 19 | + This dataclass encapsulates details about an NFT including its unique identifier, |
18 | 20 | owner account, creation time, associated metadata, and any account with spending privileges. |
19 | | - """ |
20 | 21 |
|
21 | | - def __init__( |
22 | | - self, |
23 | | - nft_id: Optional[NftId] = None, |
24 | | - account_id: Optional[AccountId] = None, |
25 | | - creation_time: Optional[int] = None, |
26 | | - metadata: Optional[bytes] = None, |
27 | | - spender_id: Optional[AccountId] = None |
28 | | - ) -> None: |
29 | | - """ |
30 | | - Initialize a TokenNftInfo instance. |
31 | | - |
32 | | - Args: |
33 | | - nft_id (NftId, optional): The unique identifier of the NFT. |
34 | | - account_id (AccountId, optional): The account ID of the NFT owner. |
35 | | - creation_time (int, optional): The timestamp when the NFT was created (in seconds). |
36 | | - metadata (bytes, optional): The metadata associated with the NFT. |
37 | | - spender_id (AccountId, optional): The account ID with spending privileges for this NFT. |
38 | | - """ |
39 | | - self.nft_id: Optional[NftId] = nft_id |
40 | | - self.account_id: Optional[AccountId] = account_id |
41 | | - self.creation_time: Optional[int] = creation_time |
42 | | - self.metadata: Optional[bytes] = metadata |
43 | | - self.spender_id: Optional[AccountId] = spender_id |
| 22 | + Args: |
| 23 | + nft_id (NftId, optional): The unique identifier of the NFT. |
| 24 | + account_id (AccountId, optional): The account ID of the NFT owner. |
| 25 | + creation_time (int, optional): The timestamp when the NFT was created (in seconds). |
| 26 | + metadata (bytes, optional): The metadata associated with the NFT. |
| 27 | + spender_id (AccountId, optional): The account ID with spending privileges for this NFT |
| 28 | + """ |
| 29 | + nft_id: Optional[NftId] = None |
| 30 | + account_id: Optional[AccountId] = None |
| 31 | + creation_time: Optional[int] = None |
| 32 | + metadata: Optional[bytes] = None |
| 33 | + spender_id: Optional[AccountId] = None |
44 | 34 |
|
45 | 35 | @classmethod |
46 | 36 | def _from_proto(cls, proto: token_get_nft_info_pb2.TokenNftInfo) -> "TokenNftInfo": |
@@ -90,3 +80,4 @@ def __str__(self) -> str: |
90 | 80 | f"creation_time={self.creation_time}, " |
91 | 81 | f"metadata={self.metadata!r}, " |
92 | 82 | f"spender_id={self.spender_id})") |
| 83 | + |
0 commit comments