neow3j / neow3j-examples-java

neow3j: Java Examples
Apache License 2.0
11 stars 8 forks source link

nep-11 demo #21

Closed jack9684 closed 2 years ago

jack9684 commented 2 years ago

i found there are some nonfungibletoken contracts on neo-n3-examples.

is there any demo ,how to invoke the function according to java neo3j , like invoke the mint function with parameter ,and recieve prpoerties function value from the demo NonFungibleToken.java contract?

gsmachado commented 2 years ago

Hello @jack9684

Thanks for trying neow3j. 🎉

You can find docs in many places! 🎉 Including our website https://neow3j.io.

But, I think it would be nice if you take a look at this specific example -- which is an example to create a single transaction with multiple invokes in it to mint a token.

This file is located in this same repository, in the contractinvoke directory.

Please, close the issue if this solved your problem/question. 👍

gsmachado commented 2 years ago

@jack9684 any news?

jack9684 commented 2 years ago

@gsmachado thank u ,very much . is there any demo about recive public static Map<String, String> properties(ByteString tokenId) result,in java ? and is there some mistake on DivisibleNonFungibleToken.java :

private static void addToOwnersTokens(Hash160 owner, ByteString tokenId) { new StorageMap(ctx, createTokensOfPrefix(owner)).put(tokenId, tokenId); }

private static void removeOwnersToken(Hash160 owner, ByteString tokenId) {
    new StorageMap(ctx, createTokensOfPrefix(owner)).put(tokenId, tokenId);
}

at line 180,and 184. i think removeOwnersToken should me delete it from createTokensOfPrefix(owner)s StorageMap?

mialbu commented 2 years ago

[...] is there some mistake on DivisibleNonFungibleToken.java :

private static void addToOwnersTokens(Hash160 owner, ByteString tokenId) { new StorageMap(ctx, createTokensOfPrefix(owner)).put(tokenId, tokenId); }

private static void removeOwnersToken(Hash160 owner, ByteString tokenId) {
    new StorageMap(ctx, createTokensOfPrefix(owner)).put(tokenId, tokenId);
}

at line 180,and 184. i think removeOwnersToken should me delete it from createTokensOfPrefix(owner)s StorageMap?

@jack9684, yes, you are correct. It's a mistake, it should be delete. I've just pushed a commit that fixes that.

mialbu commented 2 years ago

@gsmachado thank u ,very much . is there any demo about recive public static Map<String, String> properties(ByteString tokenId) result,in java ? [...]

@jack9684 There's currently no example in this repo, but you can check out the code in the NonFungibleToken wrapper in neow3j here.

jack9684 commented 2 years ago

thank u very much ~