public static byte[] Encode(object item) { var encoder = new RlpEncoder(false); encoder.Add(item); return(encoder.Encode()); }
public static byte[] EncodeList(params object[] items) { var encoder = new RlpEncoder(true); foreach (var item in items) { encoder.Add(item); } return(encoder.Encode()); }
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); }