From 87aac01e6b924512e08848fc16ebe50251fac5dc Mon Sep 17 00:00:00 2001 From: matijamarjanovic Date: Fri, 17 Jan 2025 14:22:55 +0100 Subject: [PATCH] update so nft doesn't allow optional slug, but has to include tokenid --- .../gno.land/r/matijamarjanovic/tokenhub/tokenhub.gno | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/examples/gno.land/r/matijamarjanovic/tokenhub/tokenhub.gno b/examples/gno.land/r/matijamarjanovic/tokenhub/tokenhub.gno index dec1f89edd5..223c08666e1 100644 --- a/examples/gno.land/r/matijamarjanovic/tokenhub/tokenhub.gno +++ b/examples/gno.land/r/matijamarjanovic/tokenhub/tokenhub.gno @@ -44,7 +44,8 @@ func RegisterToken(tokenGetter grc20.TokenGetter, slugs ...string) { grc20reg.Register(tokenGetter, slug) } -func RegisterNFT(nftGetter grc721.NFTGetter, slugs ...string) error { +// TokenId is mandatory for NFTs +func RegisterNFT(nftGetter grc721.NFTGetter, tokenId string) error { nft := nftGetter() _, ok := nft.(grc721.IGRC721CollectionMetadata) if !ok { @@ -52,11 +53,7 @@ func RegisterNFT(nftGetter grc721.NFTGetter, slugs ...string) error { } rlmPath := std.PrevRealm().PkgPath() - slug := "" - if len(slugs) > 0 { - slug = slugs[0] - } - key := fqname.Construct(rlmPath, slug) + key := fqname.Construct(rlmPath, tokenId) if registeredNFTs.Has(key) { return ErrNFTAlreadyRegistered