add nft id to rpcs (#14588)

* add the nft id to the rpc returns

* fixup mypy issue
This commit is contained in:
Kyle Altendorf 2023-02-22 10:54:32 -08:00 committed by GitHub
parent ed8cee2b4b
commit 8de40f8299
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -21,6 +21,8 @@ DEFAULT_STATUS = "DEFAULT"
class NFTInfo(Streamable):
"""NFT Info for displaying NFT on the UI"""
nft_id: str
launcher_id: bytes32
"""Launcher coin ID"""

View File

@ -9,11 +9,13 @@ from clvm_tools.binutils import disassemble
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.serialized_program import SerializedProgram
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.bech32m import encode_puzzle_hash
from chia.util.ints import uint16, uint64
from chia.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTInfo
from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT
from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import solution_for_conditions
from chia.wallet.util.address_type import AddressType
log = logging.getLogger(__name__)
SINGLETON_TOP_LAYER_MOD = load_clvm_maybe_recompile("singleton_top_layer_v1_1.clvm")
@ -81,7 +83,7 @@ def create_full_puzzle(
async def get_nft_info_from_puzzle(
nft_coin_info: NFTCoinInfo, config: Dict = None, ignore_size_limit: bool = False
nft_coin_info: NFTCoinInfo, config: Dict[str, Any], ignore_size_limit: bool = False
) -> NFTInfo:
"""
Extract NFT info from a full puzzle
@ -104,6 +106,7 @@ async def get_nft_info_from_puzzle(
license_uris.append(str(uri, "utf-8"))
off_chain_metadata: Optional[str] = None
nft_info = NFTInfo(
encode_puzzle_hash(uncurried_nft.singleton_launcher_id, prefix=AddressType.NFT.hrp(config=config)),
uncurried_nft.singleton_launcher_id,
nft_coin_info.coin.name(),
uncurried_nft.owner_did,