Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New nfts driver #11433

Merged
merged 45 commits into from
May 5, 2022
Merged

New nfts driver #11433

merged 45 commits into from
May 5, 2022

Conversation

trepca
Copy link
Contributor

@trepca trepca commented May 4, 2022

No description provided.

@trepca trepca removed the merge_conflict Branch has conflicts that prevent merge to main label May 5, 2022
@trepca trepca requested review from matt-o-how and ytx1991 May 5, 2022 07:07
@lgtm-com
Copy link

lgtm-com bot commented May 5, 2022

This pull request introduces 8 alerts when merging 297767f into 57a2415 - view on LGTM.com

new alerts:

  • 6 for Unused import
  • 1 for Unused local variable
  • 1 for Modification of parameter with default

@trepca trepca requested review from geoffwalmsley and paninaro May 5, 2022 08:49
@lgtm-com
Copy link

lgtm-com bot commented May 5, 2022

This pull request introduces 1 alert when merging c470401 into 57a2415 - view on LGTM.com

new alerts:

  • 1 for Modification of parameter with default

@lgtm-com
Copy link

lgtm-com bot commented May 5, 2022

This pull request introduces 1 alert when merging 150f244 into 57a2415 - view on LGTM.com

new alerts:

  • 1 for Modification of parameter with default

@lgtm-com
Copy link

lgtm-com bot commented May 5, 2022

This pull request introduces 1 alert when merging 8a32eee into 57a2415 - view on LGTM.com

new alerts:

  • 1 for Modification of parameter with default

@lgtm-com
Copy link

lgtm-com bot commented May 5, 2022

This pull request introduces 1 alert when merging b69323e into 57a2415 - view on LGTM.com

new alerts:

  • 1 for Modification of parameter with default

@lgtm-com
Copy link

lgtm-com bot commented May 5, 2022

This pull request introduces 1 alert when merging 4df1f46 into 57a2415 - view on LGTM.com

new alerts:

  • 1 for Modification of parameter with default

@trepca
Copy link
Contributor Author

trepca commented May 5, 2022

when the time comes, this won't work as the -24 won't hit the blockchain as it is an invalid condition - I suggest running the innerpuz and innersolution and scanning for -24 in the results of that instead.

wouldn't full solution still contain those conditions as it won't get run to get them excluded? (I extract the conditions from the inner_solution in the solution)

@trepca
Copy link
Contributor Author

trepca commented May 5, 2022

if this changes to (c CREATE_COIN (c (nft_state_layer_puzzle_hash NFT_STATE_LAYER_MOD_HASH METADATA METADATA_UPDATER_PUZZLE_HASH (f (r (f conditions)))) (c my_amount (r (r (f conditions)))))) then any future appendages to create_coin are supported too

good spot with the missing hint though

good point, fixed

@lgtm-com
Copy link

lgtm-com bot commented May 5, 2022

This pull request introduces 1 alert when merging 61bb87f into 57a2415 - view on LGTM.com

new alerts:

  • 1 for Modification of parameter with default

elif address is None:
puzzle_hash = await nft_wallet.standard_wallet.get_new_puzzlehash()
else:
puzzle_hash = address
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to hit this condition? I would think that the address could only be either a string or None to successfully be marshalled through the RPC interface. I would raise an exception in this case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

previous RPC was sending over bytes to pass puzzle hash and string to pass address, I added the None condition but it doesn't need to be there, it's just the way I was writing unit tests for RPC

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. So it sounds like there are some RPC callers (maybe only in the tests) that don't go through JSON.

for nft in nfts:
nft_info_list.append(get_nft_info_from_puzzle(nft.full_puzzle, nft.coin))
return {"wallet_id": wallet_id, "success": True, "nft_list": nft_info_list}
uri = get_uri_list_from_puzzle(nft.full_puzzle)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break the GUI integration, as the frontend is expecting an array of NFTInfo objects, but we can fix it in a follow-up PR.

# Now we must have unused public keys
unused = await self.puzzle_store.get_unused_derivation_path()
assert unused is not None
self.log.debug("Fetching derivation record for: %s %s %s", unused, wallet_id, hardened)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we don't seem to be entirely consistent with format strings in the codebase, but generally f-strings are preferred.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f-strings are good, but the problem with using f-string formatting in logging is those variables get evaluated even if logging level is above. See this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to know, thanks!

Copy link
Contributor

@paninaro paninaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm with the caveat that nft_get_nfts won't work in the GUI until the RPC has been updated to return NFTInfo objects.

@trepca trepca merged commit ecf7cd8 into main_dids May 5, 2022
@AmineKhaldi AmineKhaldi deleted the new_nfts_driver branch June 18, 2022 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants