Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Deploy custom params #201

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/adapter3/LaunchConfigParser.Invocations.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Neo.Network.P2P.Payloads;
using Newtonsoft.Json.Linq;
using System;

namespace NeoDebug.Neo3
{
Expand Down Expand Up @@ -30,13 +30,24 @@ public static bool TryFromJson(JToken token, out InvokeFileInvocation invocation

public struct ContractDeployInvocation
{
public readonly JToken? DeployData;
public ContractDeployInvocation(JToken? deployData)
{
DeployData = deployData;
}

public static bool TryFromJson(JToken token, out ContractDeployInvocation invocation)
{
if (token.Type == JTokenType.String && token.Value<string>() == "deploy")
{
invocation = new ContractDeployInvocation();
return true;
}
else if (token.Type == JTokenType.Object)
{
invocation = new ContractDeployInvocation(token["deploy"]);
return true;
}

invocation = default;
return false;
Expand Down
5 changes: 3 additions & 2 deletions src/adapter3/LaunchConfigParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ static async Task<IApplicationEngine> CreateDebugEngineAsync(ConfigProps config,
{
signers = new[] { deploySigner };
}

var deployDataToken = invocation.AsT3.DeployData;
var deployData = paramParser.ParseParameter(deployDataToken);
using var builder = new ScriptBuilder();
builder.EmitDynamicCall(NativeContract.ContractManagement.Hash, "deploy", launchNefFile.ToArray(), launchManifest.ToJson().ToString());
builder.EmitDynamicCall(NativeContract.ContractManagement.Hash, "deploy", launchNefFile.ToArray(), launchManifest.ToJson().ToString(), deployData);
invokeScript = builder.ToArray();
}
else
Expand Down
12 changes: 10 additions & 2 deletions src/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
"default": null,
"description": "GitHub release tag. Defaults to extension version"
}

}
},
"debuggers": [
Expand All @@ -105,6 +104,15 @@
"deploy"
]
},
{
"type": "object",
"required": [
"deploy"
],
"properties": {
"deploy": {}
}
},
{
"type": "object",
"required": [
Expand Down Expand Up @@ -556,4 +564,4 @@
"tslint": "^6.1.3",
"typescript": "^4.9.4"
}
}
}