Ejemplo n.º 1
0
 public virtual void Deserialize(ref MemoryReader reader)
 {
     UserScriptHash.Deserialize(ref reader);
     TimestampMS = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(reader.ReadUInt64()) : reader.ReadUInt64();
     AssetScriptHash.Deserialize(ref reader);
     BlockXferNotificationIndex = reader.ReadUInt32();
 }
Ejemplo n.º 2
0
        public int CompareTo(Nep17TransferKey other)
        {
            if (other is null)
            {
                return(1);
            }
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            int result = UserScriptHash.CompareTo(other.UserScriptHash);

            if (result != 0)
            {
                return(result);
            }
            int result2 = TimestampMS.CompareTo(other.TimestampMS);

            if (result2 != 0)
            {
                return(result2);
            }
            int result3 = AssetScriptHash.CompareTo(other.AssetScriptHash);

            if (result3 != 0)
            {
                return(result3);
            }
            return(BlockXferNotificationIndex.CompareTo(other.BlockXferNotificationIndex));
        }
Ejemplo n.º 3
0
        public JObject ToJson()
        {
            JObject json = new JObject();

            json["balance"] = Balances.Select(p => p.ToJson()).ToArray();
            json["address"] = UserScriptHash.ToAddress();
            return(json);
        }
Ejemplo n.º 4
0
        public JObject ToJson(ProtocolSettings protocolSettings)
        {
            JObject json = new();

            json["balance"] = Balances.Select(p => p.ToJson()).ToArray();
            json["address"] = UserScriptHash.ToAddress(protocolSettings.AddressVersion);
            return(json);
        }
Ejemplo n.º 5
0
        public JObject ToJson(ProtocolSettings protocolSettings)
        {
            JObject json = new JObject();

            json["sent"]     = Sent.Select(p => p.ToJson(protocolSettings)).ToArray();
            json["received"] = Received.Select(p => p.ToJson(protocolSettings)).ToArray();
            json["address"]  = UserScriptHash.ToAddress(protocolSettings.AddressVersion);
            return(json);
        }
Ejemplo n.º 6
0
        public JObject ToJson()
        {
            JObject json = new JObject();

            json["sent"]     = Sent.Select(p => p.ToJson()).ToArray();
            json["received"] = Received.Select(p => p.ToJson()).ToArray();
            json["address"]  = UserScriptHash.ToAddress();
            return(json);
        }
Ejemplo n.º 7
0
        public JObject ToJson(ProtocolSettings protocolSettings)
        {
            JObject json = new JObject();

            json["timestamp"]           = TimestampMS;
            json["assethash"]           = AssetHash.ToString();
            json["transferaddress"]     = UserScriptHash?.ToAddress(protocolSettings.AddressVersion);
            json["amount"]              = Amount.ToString();
            json["blockindex"]          = BlockIndex;
            json["transfernotifyindex"] = TransferNotifyIndex;
            json["txhash"]              = TxHash.ToString();
            return(json);
        }
Ejemplo n.º 8
0
        public JObject ToJson()
        {
            JObject json = new JObject();

            json["timestamp"]             = TimestampMS;
            json["asset_hash"]            = AssetHash.ToString();
            json["transfer_address"]      = UserScriptHash.ToAddress();
            json["amount"]                = Amount.ToString();
            json["block_index"]           = BlockIndex;
            json["transfer_notify_index"] = TransferNotifyIndex;
            json["tx_hash"]               = TxHash.ToString();
            return(json);
        }
Ejemplo n.º 9
0
 public bool Equals(Nep17TransferKey other)
 {
     if (other is null)
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(UserScriptHash.Equals(other.UserScriptHash) &&
            TimestampMS.Equals(other.TimestampMS) && AssetScriptHash.Equals(other.AssetScriptHash) &&
            BlockXferNotificationIndex.Equals(other.BlockXferNotificationIndex));
 }
Ejemplo n.º 10
0
        public int CompareTo(Nep11TransferKey other)
        {
            if (other is null)
            {
                return(1);
            }
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            int result = UserScriptHash.CompareTo(other.UserScriptHash);

            if (result != 0)
            {
                return(result);
            }
            int result2 = TimestampMS.CompareTo(other.TimestampMS);

            if (result2 != 0)
            {
                return(result2);
            }
            int result3 = AssetScriptHash.CompareTo(other.AssetScriptHash);

            if (result3 != 0)
            {
                return(result3);
            }
            var result4 = BlockXferNotificationIndex.CompareTo(other.BlockXferNotificationIndex);

            if (result4 != 0)
            {
                return(result4);
            }
            return((Token.GetInteger() - other.Token.GetInteger()).Sign);
        }
Ejemplo n.º 11
0
 public override int GetHashCode()
 {
     return(HashCode.Combine(UserScriptHash.GetHashCode(), TimestampMS.GetHashCode(), AssetScriptHash.GetHashCode(), BlockXferNotificationIndex.GetHashCode(), Token.GetHashCode()));
 }