Skip to content

Commit

Permalink
Add update support to batch command (#278)
Browse files Browse the repository at this point in the history
Co-authored-by: Harry <[email protected]>
  • Loading branch information
devhawk and Harry authored Apr 14, 2023
1 parent 01197b3 commit e75c812
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
23 changes: 23 additions & 0 deletions src/neoxp/Commands/BatchCommand.BatchFileCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,29 @@ internal class Run
[AllowedValues(StringComparison.OrdinalIgnoreCase, "None", "CalledByEntry", "Global")]
internal WitnessScope WitnessScope { get; init; } = WitnessScope.CalledByEntry;
}

[Command("update")]
internal class Update
{
[Argument(0, Description = "Contract name or invocation hash")]
[Required]
internal string Contract { get; init; } = string.Empty;

[Argument(1, Description = "Path to contract .nef file")]
[Required]
internal string NefFile { get; init; } = string.Empty;

[Argument(2, Description = "Account to pay contract deployment GAS fee")]
[Required]
internal string Account { get; init; } = string.Empty;

[Option(Description = "Witness Scope to use for transaction signer (Default: CalledByEntry)")]
[AllowedValues(StringComparison.OrdinalIgnoreCase, "None", "CalledByEntry", "Global")]
internal WitnessScope WitnessScope { get; init; } = WitnessScope.CalledByEntry;

[Option(Description = "Password to use for NEP-2/NEP-6 account")]
internal string Password { get; init; } = string.Empty;
}
}

[Command("fastfwd")]
Expand Down
10 changes: 10 additions & 0 deletions src/neoxp/Commands/BatchCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,16 @@ await txExec.ContractInvokeAsync(
cmd.Model.WitnessScope).ConfigureAwait(false);
break;
}
case CommandLineApplication<BatchFileCommands.Contract.Update> cmd:
{
await txExec.ContractUpdateAsync(
cmd.Model.Contract,
cmd.Model.NefFile,
cmd.Model.Account,
cmd.Model.Password,
cmd.Model.WitnessScope).ConfigureAwait(false);
break;
}
case CommandLineApplication<BatchFileCommands.FastForward> cmd:
{
var timestampDelta = FastForwardCommand.ParseTimestampDelta(cmd.Model.TimestampDelta);
Expand Down
1 change: 0 additions & 1 deletion src/neoxp/Commands/ContractCommand.List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ internal async Task ExecuteAsync(System.IO.TextWriter writer)
await jsonWriter.WriteStartArrayAsync().ConfigureAwait(false);
foreach (var (hash, manifest) in contracts)
{

await jsonWriter.WriteStartObjectAsync().ConfigureAwait(false);
await jsonWriter.WritePropertyNameAsync("name").ConfigureAwait(false);
await jsonWriter.WriteValueAsync(manifest.Name).ConfigureAwait(false);
Expand Down

0 comments on commit e75c812

Please sign in to comment.