Skip to content

Commit

Permalink
Added ability to create PartialTezosTransactionOperation with string …
Browse files Browse the repository at this point in the history
…params;
  • Loading branch information
k-karuna committed Apr 18, 2023
1 parent fae59cc commit ba47f57
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 11 deletions.
5 changes: 1 addition & 4 deletions Beacon.Sdk.Sample.Dapp/Sample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ public async Task Run()

var operationDetails = new List<PartialTezosTransactionOperation>
{
new(
Amount: "0",
Destination: "KT1WguzxyLmuKbJhz3jNuoRzzaUCncfp6PFE",
Parameters: JObject.Parse(stringParams))
new("0", "KT1WguzxyLmuKbJhz3jNuoRzzaUCncfp6PFE", stringParams)
};

await BeaconDappClient.RequestOperation(operationDetails);
Expand Down
2 changes: 1 addition & 1 deletion Beacon.Sdk/Beacon.Sdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Authors>Mikhail Tatarenko</Authors>
<Product>Beacon.Sdk</Product>
<Description>Beacon .NET SDK for Tezos wallet / dApps developers.</Description>
<Version>1.0.20</Version>
<Version>1.0.21</Version>
<Copyright>Copyright © Baking Bad 2019-2022</Copyright>
<Nullable>enable</Nullable>
<TargetFramework>netstandard2.1</TargetFramework>
Expand Down
27 changes: 22 additions & 5 deletions Beacon.Sdk/Beacon/Operation/TezosTransactionOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,26 @@

namespace Beacon.Sdk.Beacon.Operation
{
public record PartialTezosTransactionOperation(
string Amount,
string Destination,
JObject? Parameters)
: TezosBaseOperation(TezosOperationType.transaction), IPartialTezosOperation;
public record PartialTezosTransactionOperation : TezosBaseOperation, IPartialTezosOperation
{
public string Amount { get; }
public string Destination { get; }
public JObject? Parameters { get; }

public PartialTezosTransactionOperation(string amount, string destination, JObject? parameters) : base(
TezosOperationType.transaction)
{
Amount = amount;
Destination = destination;
Parameters = parameters;
}

public PartialTezosTransactionOperation(string amount, string destination, string parameters) : base(
TezosOperationType.transaction)
{
Amount = amount;
Destination = destination;
Parameters = string.IsNullOrEmpty(parameters) ? null : JObject.Parse(parameters);
}
}
}
2 changes: 1 addition & 1 deletion Beacon.Sdk/Core/Domain/DeserializeMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ private BaseBeaconMessage HandleOperationRequest(string message)
operationRequest.OperationDetails[i] = new PartialTezosTransactionOperation(
transactionOperation.Amount,
transactionOperation.Destination,
null);
string.Empty);
}

return operationRequest;
Expand Down

0 comments on commit ba47f57

Please sign in to comment.