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

Preview review v3.6.40 - Reports #338

Closed
22 tasks done
cschuchardt88 opened this issue Nov 15, 2023 · 18 comments
Closed
22 tasks done

Preview review v3.6.40 - Reports #338

cschuchardt88 opened this issue Nov 15, 2023 · 18 comments

Comments

@cschuchardt88 cschuchardt88 changed the title Preview review v3.6.2 - Reports Preview review v3.6.40 - Reports Nov 15, 2023
@cschuchardt88
Copy link
Member Author

Don't forget to run some contract xunit tests too.

If you need help with template or example

@cschuchardt88
Copy link
Member Author

cschuchardt88 commented Nov 15, 2023

#304 should be reverted until tested and cleaned up more. After evaluating there is some inconsistencies with formats and workings. Im trying to fix it up now...

@Jim8y
Copy link
Contributor

Jim8y commented Nov 15, 2023

#304 should be reverted until tested and cleaned up more. After evaluating there is some inconsistencies with formats and workings. Im trying to fix it up now...

Revert or fix in another pr?

@cschuchardt88
Copy link
Member Author

Let me try to fix 1st.

@cschuchardt88
Copy link
Member Author

It fine for now. Needs some upgrades.

@cschuchardt88
Copy link
Member Author

cschuchardt88 commented Nov 15, 2023

I take that back some of the commands don't work. When you revert reopen #304

  • Add TokenIds as base64 as well
  • Fix error output to show inter error
  • Make wording say [Argument(1, Description = "TokenId of NFT (Format: HEX, BASE64)")]
  • Make wording say [Argument(0, Description = "NFT Contract (Symbol or Script Hash)")]
  • Add transfernft command to batch commands
  • Allow contract names

Try not to use Regex makes it hard to quickly understand; unless it a very lengthy task to validate. Why you use Reverse when you have 0x?

Fix show nft

C:\Users\edged\Code\sott>neoxp batch run.batch
Transfer Transaction 0xa9096bc8e3d24a8bf264bc8801bf3601c6e8040a3bf1a63e21b4e9d498945926 submitted
Deployment of sword (0x8b49d75870e876b610b430e3db108d487d545dd1) Transaction 0x4a67944d49fb6ae9bf7667c5419495188de2bad98f032ead24fca3adb5013c8c submitted
Invocation Transaction 0x6750b0223adc16659fb6436e5755604ad71b27fe8c30664e372e6316fda0a36b submitted
Invocation Transaction 0x7493007e207525bd5e93154c758284ea334eee377436be2485e3933e495aa19a submitted

C:\Users\edged\Code\sott>neoxp show nft -h
Show NFT Tokens for account

Usage: neoxp show nft [options] <Contract> <Account>

Arguments:
  Contract            Contract to show NFT of (symbol or script hash)
  Account             Account to show asset balance for

Options:
  -i|--input <INPUT>  Path to neo-express data file
  -?|-h|--help        Show help information.


C:\Users\edged\Code\sott>
C:\Users\edged\Code\sott>neoxp show nft SOTT bob
System.ArgumentException: Unknown Asset "SOTT" (Parameter 'asset')

C:\Users\edged\Code\sott>neoxp show nft sword bob
System.ArgumentException: Unknown Asset "sword" (Parameter 'asset')

C:\Users\edged\Code\sott>neoxp show nft 0x8b49d75870e876b610b430e3db108d487d545dd1 bob
System.Exception: invalid script results

@cschuchardt88
Copy link
Member Author

@chenzhitong @Liaojinghui

I take that back some of the commands don't work. When you revert reopen #304

  • Add TokenIds as base64 as well
  • Fix error output to show inter error
  • Make wording say [Argument(1, Description = "TokenId of NFT (Format: HEX, BASE64)")]
  • Make wording say [Argument(0, Description = "NFT Contract (Symbol or Script Hash)")]
  • Add transfernft command to batch commands
  • Allow contract names

Try not to use Regex makes it hard to quickly understand; unless it a very lengthy task to validate. Why you use Reverse when you have 0x?

Fix show nft

C:\Users\edged\Code\sott>neoxp batch run.batch
Transfer Transaction 0xa9096bc8e3d24a8bf264bc8801bf3601c6e8040a3bf1a63e21b4e9d498945926 submitted
Deployment of sword (0x8b49d75870e876b610b430e3db108d487d545dd1) Transaction 0x4a67944d49fb6ae9bf7667c5419495188de2bad98f032ead24fca3adb5013c8c submitted
Invocation Transaction 0x6750b0223adc16659fb6436e5755604ad71b27fe8c30664e372e6316fda0a36b submitted
Invocation Transaction 0x7493007e207525bd5e93154c758284ea334eee377436be2485e3933e495aa19a submitted

C:\Users\edged\Code\sott>neoxp show nft -h
Show NFT Tokens for account

Usage: neoxp show nft [options] <Contract> <Account>

Arguments:
  Contract            Contract to show NFT of (symbol or script hash)
  Account             Account to show asset balance for

Options:
  -i|--input <INPUT>  Path to neo-express data file
  -?|-h|--help        Show help information.


C:\Users\edged\Code\sott>
C:\Users\edged\Code\sott>neoxp show nft SOTT bob
System.ArgumentException: Unknown Asset "SOTT" (Parameter 'asset')

C:\Users\edged\Code\sott>neoxp show nft sword bob
System.ArgumentException: Unknown Asset "sword" (Parameter 'asset')

C:\Users\edged\Code\sott>neoxp show nft 0x8b49d75870e876b610b430e3db108d487d545dd1 bob
System.Exception: invalid script results

@cschuchardt88
Copy link
Member Author

@Liaojinghui are we going to revert #304 ? or we leaving it broken? @chenzhitong havent heard anything from him.

@Jim8y
Copy link
Contributor

Jim8y commented Nov 23, 2023

Revert requires another pr now. Maybe try to fix it in another pr.

@chenzhitong
Copy link
Member

OK, I'll fix it in another pr next week

@chenzhitong
Copy link
Member

chenzhitong commented Nov 25, 2023

  • Add TokenIds as base64 as well

It started out as Base64. You asked me to change it to Hex. #304 (comment)

Why you use Reverse when you have 0x?

Supports both big-endian with 0x and small-endian without 0x.

Fix show nft

Can you provide me with your contract code and I'll see what's wrong. It's working on my contract. @cschuchardt88

@cschuchardt88
Copy link
Member Author

cschuchardt88 commented Nov 25, 2023

@chenzhitong

  • Add TokenIds as base64 as well

It started out as Base64. You asked me to change it to Hex. #304 (comment)

Sorry about that, what i meant was to add both. Also if may have been before I wrote this #340

Why you use Reverse when you have 0x?

Supports both big-endian with 0x and small-endian without 0x.

is that necessary? We only use in scripthash format as 0xa4755649ca41a36b78a16065fb7a52088f6341a0 with 0x perfix.

Fix show nft

Can you provide me with your contract code and I'll see what's wrong. It's working on my contract. @cschuchardt88

Waiting on someone to send to it to me

PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe show nft HELLOWORLD bob
System.ArgumentException: Unknown Asset "HELLOWORLD" (Parameter 'asset')
PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe show nft 0xa4755649ca41a36b78a16065fb7a52088f6341a0 bob
PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe show nft a4755649ca41a36b78a16065fb7a52088f6341a0 bob
PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0>

I get no output when it empty as well. When I try to use the asset name it says unknown asset. There would should be a message saying that no nfts where found at least or some other indication.

using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Attributes;
using Neo.SmartContract.Framework.Native;
using Neo.SmartContract.Framework.Services;
using System.ComponentModel;

namespace BasicNFT;

[DisplayName("MyNFT")]
[ManifestExtra("Author", "Christopher R. Schuchardt")]
[ManifestExtra("Description", "A Basic NFT Example")]
[ManifestExtra("Email", "[email protected]")]
[ManifestExtra("Version", "1.0")]
[ContractSourceCode("https://github.com/cschuchardt88/neo-templates")]
[ContractPermission("*", "*")]
public class MyNFT : Nep11Token<MyNep11State> // state is empty with only Nep11TokenState included
{
    [Safe]
    public override string Symbol() => "HELLOWORLD";

    [DisplayName("_deploy")]
    public static void OnDeployment(object data, bool update)
    {
        if (update)
            return;
    }

    public ByteString Make()
    {
        MyNep11State state = new()
        {
            Owner = Runtime.CallingScriptHash,
            Name = "HelloWorld",
        };

        var id = NewTokenId();
        Mint(id, state);
        return id;
    }

    public static bool Update(ByteString nefFile, string manifest)
    {
        ContractManagement.Update(nefFile, manifest);
        return true;
    }

    public static bool Destroy()
    {
        ContractManagement.Destroy();
        return true;
    }
}

@chenzhitong
Copy link
Member

ok

@cschuchardt88
Copy link
Member Author

Download nft.zip

PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe contract deploy .\sc\sword.nef bob
Deployment of sword (0xbfd963d21d2f46ac4fbe78c931c13e53c3b09014) Transaction 0xb6ce38482984b95b0076a3695c7301ef02760dd7cc643148f44bb63abd3faa81 submitted

PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe show nft 0xbfd963d21d2f46ac4fbe78c931c13e53c3b09014 bob

PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe batch .\run.batch
Invocation Transaction 0x8fcda5c16ff84c6331b15a9c706615a19c8c0c2c4ca9076e7d7771ced9ae37bc submitted
Invocation Transaction 0x5946db752a89a00173ecb7ae99965bb5002cdc3cf21450cf1153dbcd99ce98da submitted

PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe show nft 0xbfd963d21d2f46ac4fbe78c931c13e53c3b09014 bob
System.Exception: invalid script results

PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0>

@cschuchardt88
Copy link
Member Author

Oh i forgot here is the output of tokensOf

PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0> .\neoxp.exe contract run sword tokensOf '#0x77e32ca26998b72b50a34e7cd151abc9cc31a6f9' -a bob -r
VM State:     HALT
Gas Consumed: 237480
Result Stack:
  InteropInterface: (StorageIterator)
    Array: (2)
      414343f9a631ccc9ab51d17c4ea3502bb79869a22ce37701
      01()
    Array: (2)
      414343f9a631ccc9ab51d17c4ea3502bb79869a22ce37702
      02()
    Array: (2)
      414343f9a631ccc9ab51d17c4ea3502bb79869a22ce37703
      03()
    Array: (2)
      414343f9a631ccc9ab51d17c4ea3502bb79869a22ce37704
      04()
    Array: (2)
      414343f9a631ccc9ab51d17c4ea3502bb79869a22ce37705
      05()
PS C:\Users\Chris\Projects\cschuchardt88\neo-express\src\neoxp\bin\Debug\net7.0>

@chenzhitong
Copy link
Member

@cschuchardt88 #391

The error in show nft above is because the tokenID generated by NewTokenId(); can't be converted to a UTF8 string, and I show NFT items both Base64 string and Hex string in the output now (previously it was UTF8 string and hex string)

@chenzhitong
Copy link
Member

Update checklist?

@cschuchardt88
Copy link
Member Author

Updated, if i missed anything let me know or post here.

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

No branches or pull requests

3 participants