コード例 #1
0
 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));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
 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));
 }
コード例 #4
0
        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));
        }
コード例 #5
0
 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));
 }
コード例 #6
0
 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));
 }
コード例 #7
0
 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));
 }
コード例 #8
0
 public byte[] EncodeMessage <T>(T message, byte[] prefix) where T : class
 {
     return(EncodeUtils.AminoWrap(this.ProtoSerialize <T>(message), prefix, false));
 }