public void InitTupleComponentsFromTypeAttributes(Type type, ABIType abiType) { if (abiType is TupleType abiTupleType) { var properties = PropertiesExtractor.GetPropertiesWithParameterAttribute(type); var parameters = new List <Parameter>(); var parameterObjects = new List <Parameter>(); foreach (var property in properties) { var parameterAttribute = property.GetCustomAttribute <ParameterAttribute>(true); parameterAttribute.Parameter.DecodedType = property.PropertyType; InitTupleComponentsFromTypeAttributes(property.PropertyType, parameterAttribute.Parameter.ABIType); parameterObjects.Add(parameterAttribute.Parameter); } abiTupleType.SetComponents(parameterObjects.ToArray()); } var abiArrayType = abiType as ArrayType; while (abiArrayType != null) { var arrayListType = ArrayTypeDecoder.GetIListElementType(type); if (arrayListType == null) { throw new Exception("Only types that implement IList<T> are supported for encoding"); } if (abiArrayType.ElementType is TupleType arrayTupleType) { InitTupleComponentsFromTypeAttributes(arrayListType, arrayTupleType); abiArrayType = null; } else { abiArrayType = abiArrayType.ElementType as ArrayType; } } }
public StaticArrayType(string name) : base(name) { IntialiseSize(name); Decoder = new ArrayTypeDecoder(ElementType); Encoder = new StaticArrayTypeEncoder(ElementType, Size); }