public ByteString GetPaymentRequest(string finalAccount, ulong amount) { PaymentDetails paymentDetails = new PaymentDetails(); paymentDetails.Network = isMainNet ? "main" : "test"; paymentDetails.Time = GetTimestamp(DateTime.UtcNow); paymentDetails.Expires = GetTimestamp(DateTime.UtcNow.AddHours(1)); paymentDetails.Memo = $"Funding Openchain account {finalAccount}"; Output paymentOutput = new Output(); paymentOutput.Amount = amount; paymentOutput.Script = Google.Protobuf.ByteString.CopyFrom(NBitcoin.Script.CreateFromDestinationAddress(destinationAddress).ToBytes()); Output dataOutput = new Output(); dataOutput.Amount = dustValue; dataOutput.Script = Google.Protobuf.ByteString.CopyFrom( new[] { (byte)OpcodeType.OP_RETURN }.Concat(Op.GetPushOp(Encoding.UTF8.GetBytes("OG" + finalAccount)).ToBytes()).ToArray()); paymentDetails.Outputs.Add(paymentOutput); paymentDetails.Outputs.Add(dataOutput); PaymentRequest request = new PaymentRequest(); request.SerializedPaymentDetails = paymentDetails.ToByteString(); request.PkiType = "none"; return(new ByteString(request.ToByteArray())); }
public ByteString GetPaymentRequest(string finalAccount, ulong amount) { PaymentDetails paymentDetails = new PaymentDetails(); paymentDetails.Network = isMainNet ? "main" : "test"; paymentDetails.Time = GetTimestamp(DateTime.UtcNow); paymentDetails.Expires = GetTimestamp(DateTime.UtcNow.AddHours(1)); paymentDetails.Memo = $"Funding Openchain account {finalAccount}"; Output paymentOutput = new Output(); paymentOutput.Amount = amount; paymentOutput.Script = Google.Protobuf.ByteString.CopyFrom(NBitcoin.Script.CreateFromDestinationAddress(destinationAddress).ToBytes()); Output dataOutput = new Output(); dataOutput.Amount = dustValue; dataOutput.Script = Google.Protobuf.ByteString.CopyFrom( new[] { (byte)OpcodeType.OP_RETURN }.Concat(Op.GetPushOp(Encoding.UTF8.GetBytes("OG" + finalAccount)).ToBytes()).ToArray()); paymentDetails.Outputs.Add(paymentOutput); paymentDetails.Outputs.Add(dataOutput); PaymentRequest request = new PaymentRequest(); request.SerializedPaymentDetails = paymentDetails.ToByteString(); request.PkiType = "none"; return new ByteString(request.ToByteArray()); }