Skip to content

Commit

Permalink
Change account output from scripthash to address (#459)
Browse files Browse the repository at this point in the history
* update

* update submodule

* fixed bug

* format
  • Loading branch information
chenzhitong committed Aug 6, 2024
1 parent e25f99c commit 2a87023
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/neo
Submodule neo updated 159 files
2 changes: 2 additions & 0 deletions src/neoxp/Commands/BatchCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// modifications are permitted.

using McMaster.Extensions.CommandLineUtils;
using Neo;
using Neo.Wallets;
using System.IO.Abstractions;
using static Neo.BlockchainToolkit.Constants;

Expand Down
1 change: 1 addition & 0 deletions src/neoxp/Commands/ExecuteCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
namespace NeoExpress.Commands
{
using McMaster.Extensions.CommandLineUtils;
using Neo.Extensions;

[Command(Name = "execute", Description = "Invoke a custom script, the input text will be converted to script with a priority: hex, base64, file path.")]
class ExecuteCommand
Expand Down
1 change: 1 addition & 0 deletions src/neoxp/Commands/ExportCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using McMaster.Extensions.CommandLineUtils;
using Neo;
using Neo.BlockchainToolkit.Models;
using Neo.Extensions;
using NeoExpress.Models;
using Newtonsoft.Json;
using System.IO.Abstractions;
Expand Down
2 changes: 2 additions & 0 deletions src/neoxp/Commands/PolicyCommand.IsBlocked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// modifications are permitted.

using McMaster.Extensions.CommandLineUtils;
using Neo;
using Neo.Wallets;
using System.ComponentModel.DataAnnotations;

namespace NeoExpress.Commands
Expand Down
4 changes: 3 additions & 1 deletion src/neoxp/Commands/ShowCommand.NFT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

using McMaster.Extensions.CommandLineUtils;
using Neo;
using Neo.Extensions;
using Neo.Wallets;
using System.ComponentModel.DataAnnotations;

namespace NeoExpress.Commands
Expand Down Expand Up @@ -63,7 +65,7 @@ internal async Task<int> OnExecuteAsync(CommandLineApplication app, IConsole con
: throw new InvalidOperationException($"contract \"{Contract}\" not found");
var list = await expressNode.GetNFTAsync(accountHash, scriptHash).ConfigureAwait(false);
if (list.Count == 0)
await console.Out.WriteLineAsync($"No NFT yet. (Contract:{scriptHash}, Account:{accountHash})");
await console.Out.WriteLineAsync($"No NFT yet. (Contract:{scriptHash}, Account:{accountHash.ToAddress(ProtocolSettings.Default.AddressVersion)})");
else
list.ForEach(p => console.Out.WriteLine($"TokenId(Base64): {p}, TokenId(Hex): 0x{Convert.FromBase64String(p).Reverse().ToArray().ToHexString()}"));
return 0;
Expand Down
4 changes: 4 additions & 0 deletions src/neoxp/Commands/WalletCommand.Create.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
// modifications are permitted.

using McMaster.Extensions.CommandLineUtils;
using Neo;
using Neo.Wallets;
using System.ComponentModel.DataAnnotations;

namespace NeoExpress.Commands
Expand Down Expand Up @@ -50,7 +52,9 @@ internal int OnExecute(CommandLineApplication app, IConsole console)
console.WriteLine($"Created Wallet {Name}");

for (int i = 0; i < wallet.Accounts.Count; i++)
{
console.WriteLine($" Address: {wallet.Accounts[i].ScriptHash}");
}

console.WriteLine("\n\x1b[33mNote: The private keys for the accounts in this wallet are *not* encrypted.\x1b[0m");

Expand Down
1 change: 1 addition & 0 deletions src/neoxp/Models/DevWalletAccount.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

using Neo;
using Neo.BlockchainToolkit.Models;
using Neo.Extensions;
using Neo.SmartContract;
using Neo.Wallets;

Expand Down
1 change: 1 addition & 0 deletions src/neoxp/Node/Modules/ExpressRpcServerPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

using Neo;
using Neo.BlockchainToolkit;
using Neo.Extensions;
using Neo.IO;
using Neo.Json;
using Neo.Network.P2P.Payloads;
Expand Down
7 changes: 4 additions & 3 deletions src/neoxp/TransactionExecutor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Neo;
using Neo.BlockchainToolkit;
using Neo.Cryptography.ECC;
using Neo.Extensions;
using Neo.Network.P2P.Payloads;
using Neo.Network.RPC;
using Neo.SmartContract;
Expand Down Expand Up @@ -297,16 +298,16 @@ static async Task WriteStackItemAsync(System.IO.TextWriter writer, Neo.VM.Types.
await WriteLineAsync(@int.GetInteger().ToString()).ConfigureAwait(false);
break;
case Neo.VM.Types.Buffer buffer:
await WriteLineAsync(Neo.Helper.ToHexString(buffer.GetSpan())).ConfigureAwait(false);
await WriteLineAsync(Neo.Extensions.ByteExtensions.ToHexString(buffer.GetSpan())).ConfigureAwait(false);
break;
case Neo.VM.Types.ByteString byteString:
if (byteString.GetSpan().TryGetUtf8String(out var text))
{
await WriteLineAsync($"{Neo.Helper.ToHexString(byteString.GetSpan())}({text.EscapeString()})").ConfigureAwait(false);
await WriteLineAsync($"{Neo.Extensions.ByteExtensions.ToHexString(byteString.GetSpan())}({text.EscapeString()})").ConfigureAwait(false);
}
else
{
await WriteLineAsync(Neo.Helper.ToHexString(byteString.GetSpan())).ConfigureAwait(false);
await WriteLineAsync(Neo.Extensions.ByteExtensions.ToHexString(byteString.GetSpan())).ConfigureAwait(false);
}
break;
case Neo.VM.Types.Null _:
Expand Down
1 change: 1 addition & 0 deletions test/test.bctklib/ContractParameterParserTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using FluentAssertions;
using Neo;
using Neo.BlockchainToolkit;
using Neo.Extensions;
using Neo.SmartContract;
using Newtonsoft.Json.Linq;
using System;
Expand Down

0 comments on commit 2a87023

Please sign in to comment.