public static string SendMany(string fromAccount, PayToAddress[] payToAddresses, string minimumNumberOfConfirmations = "1", string comment = null) { string txOutputInfo = ConvertPayToAddressesToString (payToAddresses); if (comment == null || comment.Length == 0) return SimpleStringRequest ("sendmany", qt + fromAccount + qt + ", " + txOutputInfo + ", " + minimumNumberOfConfirmations, false); return SimpleStringRequest ("sendmany", qt + fromAccount + qt + ", " + txOutputInfo + ", " + minimumNumberOfConfirmations + ", " + qt + comment + qt, false); }
private static string ConvertPayToAddressesToString(PayToAddress[] payToAddresses) { string txOutputInfo = "{"; bool firstOne = true; foreach (PayToAddress payToAddress in payToAddresses) { if (firstOne) firstOne = false; else txOutputInfo += ","; if (payToAddress.address == null || payToAddress.address.Length == 0) throw new Exception ("An address to send the payment to must not be blank!"); if (payToAddress.amount == null || payToAddress.amount.Length == 0) throw new Exception ("A payment amount must not be blank!"); txOutputInfo += qt + payToAddress.address + qt + ":" + payToAddress.amount; } txOutputInfo += "}"; return txOutputInfo; }
public static string CreateRawTransaction(RawTxInput[] inputs, PayToAddress[] payToAddresses) { string txInputInfo = ConvertTxsToString (inputs); string txOutputInfo = ConvertPayToAddressesToString (payToAddresses); return SimpleStringRequest ("createrawtransaction", txInputInfo + ", " + txOutputInfo, false); }