Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

How can i use "SendCommandAsync"? #1218

Open
wqysz345 opened this issue Jul 5, 2024 · 0 comments
Open

How can i use "SendCommandAsync"? #1218

wqysz345 opened this issue Jul 5, 2024 · 0 comments

Comments

@wqysz345
Copy link

wqysz345 commented Jul 5, 2024

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'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant