Exemple #1
0
        public static byte[] Encode(object item)
        {
            var encoder = new RlpEncoder(false);

            encoder.Add(item);
            return(encoder.Encode());
        }
Exemple #2
0
        public static byte[] EncodeList(params object[] items)
        {
            var encoder = new RlpEncoder(true);

            foreach (var item in items)
            {
                encoder.Add(item);
            }

            return(encoder.Encode());
        }
Exemple #3
0
        public static RlpEncoder New(int capacity, byte[] value = null)
        {
            Guard.Assert(capacity > 0);

            var encoder = new RlpEncoder(true);

            for (int i = 0; i < capacity; i++)
            {
                encoder.Add(ReferenceEquals(value, null) ? Null : value);
            }

            return(encoder);
        }