public override void SetTypeInfo(AbiTypeInfo info)
 {
     _info = info;
     if (_info.Category != SolidityTypeCategory.DynamicArray)
     {
         throw UnsupportedTypeException();
     }
 }
Exemple #2
0
 public override void SetTypeInfo(AbiTypeInfo info)
 {
     _info = info;
     if (info.Category != SolidityTypeCategory.Elementary || info.ElementaryBaseType != SolidityTypeElementaryBase.Bytes)
     {
         throw UnsupportedTypeException();
     }
 }
        public void SetTypeInfo(AbiTypeInfo info)
        {
            if (info.Category != SolidityTypeCategory.FixedArray)
            {
                throw EncoderUtil.CreateUnsupportedTypeEncodingException(info);
            }

            TypeInfo = info;
        }
            public HelloEvent(Meadow.JsonRpc.Types.FilterLogObject log) : base(log)
            {
                // Decode the log topic args.
                Span <byte> topicBytes = MemoryMarshal.AsBytes(new Span <Meadow.Core.EthTypes.Data>(log.Topics).Slice(1));

                AbiTypeInfo[] topicTypes = Array.Empty <AbiTypeInfo>();
                var           topicBuff  = new AbiDecodeBuffer(topicBytes, topicTypes);
                // Decode the log data args.
                Span <byte> dataBytes = log.Data;

                AbiTypeInfo[] dataTypes = new AbiTypeInfo[] { "string", "address" };
                var           dataBuff  = new AbiDecodeBuffer(dataBytes, dataTypes);

                DecoderFactory.Decode(dataTypes[0], ref dataBuff, out _message);
                DecoderFactory.Decode(dataTypes[1], ref dataBuff, out _sender);
                // Add all the log args and their metadata to a collection that can be checked at runtime.
                LogArgs = new(string Name, string Type, bool Indexed, object Value)[] { ("_message", "string", false, _message), ("_sender", "address", false, _sender) };
            public Transfer(Meadow.JsonRpc.Types.FilterLogObject log) : base(log)
            {
                // Decode the log topic args.
                Span <byte> topicBytes = MemoryMarshal.AsBytes(new Span <Meadow.Core.EthTypes.Data>(log.Topics).Slice(1));

                AbiTypeInfo[] topicTypes = new AbiTypeInfo[] { "address", "address" };
                var           topicBuff  = new AbiDecodeBuffer(topicBytes, topicTypes);

                DecoderFactory.Decode(topicTypes[0], ref topicBuff, out from);
                DecoderFactory.Decode(topicTypes[1], ref topicBuff, out to);
                // Decode the log data args.
                Span <byte> dataBytes = log.Data;

                AbiTypeInfo[] dataTypes = new AbiTypeInfo[] { "uint256" };
                var           dataBuff  = new AbiDecodeBuffer(dataBytes, dataTypes);

                DecoderFactory.Decode(dataTypes[0], ref dataBuff, out tokens);
                // Add all the log args and their metadata to a collection that can be checked at runtime.
                LogArgs = new(string Name, string Type, bool Indexed, object Value)[] { ("from", "address", true, from), ("to", "address", true, to), ("tokens", "uint256", false, tokens) };
            public LogAccess(Meadow.JsonRpc.Types.FilterLogObject log) : base(log)
            {
                // Decode the log topic args.
                Span <byte> topicBytes = MemoryMarshal.AsBytes(new Span <Meadow.Core.EthTypes.Data>(log.Topics).Slice(1));

                AbiTypeInfo[] topicTypes = new AbiTypeInfo[] { "address", "uint256" };
                var           topicBuff  = new AbiDecodeBuffer(topicBytes, topicTypes);

                DecoderFactory.Decode(topicTypes[0], ref topicBuff, out by);
                DecoderFactory.Decode(topicTypes[1], ref topicBuff, out accessTime);
                // Decode the log data args.
                Span <byte> dataBytes = log.Data;

                AbiTypeInfo[] dataTypes = new AbiTypeInfo[] { "string", "string" };
                var           dataBuff  = new AbiDecodeBuffer(dataBytes, dataTypes);

                DecoderFactory.Decode(dataTypes[0], ref dataBuff, out method);
                DecoderFactory.Decode(dataTypes[1], ref dataBuff, out desc);
                // Add all the log args and their metadata to a collection that can be checked at runtime.
                LogArgs = new(string Name, string Type, bool Indexed, object Value)[] { ("by", "address", true, by), ("accessTime", "uint256", true, accessTime), ("method", "string", false, method), ("desc", "string", false, desc) };