Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Commit

Permalink
Update cosigners (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
shargon authored May 8, 2020
1 parent 38d404a commit 6da43d2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 15 deletions.
5 changes: 2 additions & 3 deletions neo-cli/CLI/MainService.Contracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,17 +128,16 @@ private void OnInvokeCommand(UInt160 scriptHash, string operation, JArray contra
Transaction tx = new Transaction
{
Sender = UInt160.Zero,
Attributes = Array.Empty<TransactionAttribute>(),
Attributes = signCollection.ToArray(),
Witnesses = Array.Empty<Witness>(),
Cosigners = signCollection.ToArray()
};

_ = OnInvokeWithResult(scriptHash, operation, tx, contractParameters);

if (NoWallet()) return;
try
{
tx = CurrentWallet.MakeTransaction(tx.Script, null, tx.Attributes, tx.Cosigners);
tx = CurrentWallet.MakeTransaction(tx.Script, null, tx.Attributes);
}
catch (InvalidOperationException)
{
Expand Down
2 changes: 1 addition & 1 deletion neo-cli/CLI/MainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ private void SendTransaction(byte[] script, UInt160 account = null)

try
{
Transaction tx = CurrentWallet.MakeTransaction(script, account, null, signCollection?.ToArray());
Transaction tx = CurrentWallet.MakeTransaction(script, account, signCollection?.ToArray());
Console.WriteLine($"Invoking script with: '{tx.Script.ToHexString()}'");

using (ApplicationEngine engine = ApplicationEngine.Run(tx.Script, tx, null, testMode: true))
Expand Down
2 changes: 1 addition & 1 deletion neo-cli/neo-cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Neo" Version="3.0.0-CI00907" />
<PackageReference Include="Neo" Version="3.0.0-CI00909" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion neo-gui/GUI/InvokeContractDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ private void button5_Click(object sender, EventArgs e)
{
Sender = UInt160.Zero,
Attributes = new TransactionAttribute[0],
Cosigners = new Cosigner[0],
Script = script,
Witnesses = new Witness[0]
};
Expand Down
12 changes: 6 additions & 6 deletions neo-gui/GUI/Wrappers/TransactionAttributeWrapper.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
using Neo.Network.P2P.Payloads;
using System.ComponentModel;
using System.IO;
using System.Text;

namespace Neo.GUI.Wrappers
{
internal class TransactionAttributeWrapper
{
public TransactionAttributeUsage Usage { get; set; }
public TransactionAttributeType Usage { get; set; }
[TypeConverter(typeof(HexConverter))]
public byte[] Data { get; set; }

public TransactionAttribute Unwrap()
{
return new TransactionAttribute
{
Usage = Usage,
Data = Data
};
using var reader = new BinaryReader(new MemoryStream(Data), Encoding.UTF8, false);

return TransactionAttribute.DeserializeFrom(reader);
}
}
}
3 changes: 0 additions & 3 deletions neo-gui/GUI/Wrappers/TransactionWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ internal class TransactionWrapper
[Category("Basic")]
public List<TransactionAttributeWrapper> Attributes { get; set; } = new List<TransactionAttributeWrapper>();
[Category("Basic")]
public List<CosignerWrapper> Cosigners { get; set; } = new List<CosignerWrapper>();
[Category("Basic")]
[Editor(typeof(ScriptEditor), typeof(UITypeEditor))]
[TypeConverter(typeof(HexConverter))]
public byte[] Script { get; set; }
Expand All @@ -43,7 +41,6 @@ public Transaction Unwrap()
NetworkFee = NetworkFee,
ValidUntilBlock = ValidUntilBlock,
Attributes = Attributes.Select(p => p.Unwrap()).ToArray(),
Cosigners = Cosigners.Select(p => p.Unwrap()).ToArray(),
Script = Script,
Witnesses = Witnesses.Select(p => p.Unwrap()).ToArray()
};
Expand Down

0 comments on commit 6da43d2

Please sign in to comment.