private byte[] EncodeTokenUnfreezeMessage(TokenUnfreezeMessage tokenUnfreezeMessage) { proto.TokenUnfreeze tokenUnfreeze = new proto.TokenUnfreeze { From = ByteString.CopyFrom(Wallet.DecodeAddress(tokenUnfreezeMessage.From)), Amount = tokenUnfreezeMessage.Amount, Symbol = tokenUnfreezeMessage.Symbol }; return(EncodeUtils.AminoWrap(tokenUnfreeze.ToByteArray(), MessageType.GetTransactionType(EMessageType.TokenUnfreeze), false)); }
private byte[] EncodeCancelOrderMessage(CancelOrderMessage cancelOrderMessage) { proto.CancelOrder cancelOrder = new proto.CancelOrder { Sender = ByteString.CopyFrom(Wallet.AddressBytes), Symbol = cancelOrderMessage.Symbol, Refid = cancelOrderMessage.RefId }; return(EncodeUtils.AminoWrap(cancelOrder.ToByteArray(), MessageType.GetTransactionType(EMessageType.CancelOrder), false)); }
private byte[] EncodeVoteMessage(VoteMessage voteMessage) { proto.Vote vote = new proto.Vote { Voter = ByteString.CopyFrom(Wallet.AddressBytes), ProposalId = long.Parse(voteMessage.ProposalId), Option = VoteMessage.ToOption(voteMessage.Option) }; return(EncodeUtils.AminoWrap(vote.ToByteArray(), MessageType.GetTransactionType(EMessageType.Vote), false)); }
private byte[] EncodeSignature(byte[] signatureBytes) { proto.StdSignature stdSignature = new proto.StdSignature { PubKey = ByteString.CopyFrom(Wallet.PubKeyForSign), Signature = ByteString.CopyFrom(signatureBytes), AccountNumber = Wallet.AccountNumber.Value, Sequence = Wallet.Sequence.Value }; return(EncodeUtils.AminoWrap(stdSignature.ToByteArray(), MessageType.GetTransactionType(EMessageType.StdSignature), false)); }
private byte[] EncodeStdTx(byte[] msg, byte[] signature) { proto.StdTx stdTx = new proto.StdTx(); stdTx.Msgs.Add(ByteString.CopyFrom(msg)); stdTx.Signatures.Add(ByteString.CopyFrom(signature)); stdTx.Memo = TranscationOption.Memo; stdTx.Source = TranscationOption.Source; if (TranscationOption.Data != null) { stdTx.Data = ByteString.CopyFrom(TranscationOption.Data); } return(EncodeUtils.AminoWrap(stdTx.ToByteArray(), MessageType.GetTransactionType(EMessageType.StdTx), true)); }
private byte[] EncodeTransferMessage(TransferMessage transferMessage) { proto.Send send = new proto.Send(); foreach (InputOutput input in transferMessage.Inputs) { send.Inputs.Add(toProtoInput(input)); } foreach (InputOutput output in transferMessage.Outputs) { send.Outputs.Add(toProtoOutput(output)); } return(EncodeUtils.AminoWrap(send.ToByteArray(), MessageType.GetTransactionType(EMessageType.Send), false)); }
private byte[] EncodeNewOrderMessage(NewOrderMessage newOrderMessage) { proto.NewOrder newOrder = new proto.NewOrder { Sender = ByteString.CopyFrom(Wallet.AddressBytes), Id = newOrderMessage.Id, Symbol = newOrderMessage.Symbol, Ordertype = newOrderMessage.OrderType, Side = newOrderMessage.Side, Price = newOrderMessage.Price, Quantity = newOrderMessage.Quantity, Timeinforce = newOrderMessage.TimeInForce }; return(EncodeUtils.AminoWrap(newOrder.ToByteArray(), MessageType.GetTransactionType(EMessageType.NewOrder), false)); }
public byte[] EncodeMessage <T>(T message, byte[] prefix) where T : class { return(EncodeUtils.AminoWrap(this.ProtoSerialize <T>(message), prefix, false)); }