How can i use "SendCommandAsync"?
Closed this issue · 0 comments
I try to send "sendmany" rpc command, but my response is:
Unhandled exception. NBitcoin.RPC.RPCException: Wrong type passed:
{
"Position 2 (amounts)": "JSON value of type string is not of expected type object"
}
My attempt:
var toAddresses = new Dictionary<string, string>
{
{ "XXX", "0.0001" }
};
List parameters = new List();
parameters.Add("");
parameters.Add(JsonSerializer.Serialize(toAddresses));
parameters.Add(2);
parameters.Add("testing");
var response = await rpcClient.SendCommandAsync(RPCOperations.sendmany, parameters.ToArray());
P.S:
For parameters.Add(toAddresses) (without serialization)
Unhandled exception. Newtonsoft.Json.JsonWriterException: Unsupported type: System.Collections.Generic.Dictionary`2[System.String,System.String]. Use the JsonSerializer class to get the object's JSON representation. Path 'params'.