Comments (10)
Thanks for the prompt solution Juan!
from nethereum.
Thanks for the clarification... can you post your Event DTO?
from nethereum.
Also please raise another issue if it is changed :) (obviously not now)
from nethereum.
Hi Juan,
Here is the DTO for them. Thanks.
public class EventMultipliedSenderLog
{
[Nethereum.ABI.FunctionEncoding.Attributes.Parameter("uint", "a", 1, true)]
public int A { get; set; }
[Nethereum.ABI.FunctionEncoding.Attributes.Parameter("address", "sender", 2, true)]
public string Sender { get; set; }
[Nethereum.ABI.FunctionEncoding.Attributes.Parameter("string", "hello", 3, true)]
public string Hello { get; set; }
}
public class EventMultiplied
{
[Nethereum.ABI.FunctionEncoding.Attributes.Parameter("uint", "a", 1, true)]
public int A { get; set; }
[Nethereum.ABI.FunctionEncoding.Attributes.Parameter("uint", "result", 2, true)]
public int Result { get; set; }
[Nethereum.ABI.FunctionEncoding.Attributes.Parameter("string", "hello", 3, false)]
public string Hello { get; set; }
}
from nethereum.
The C# code to get the events:
var multipliedEvent = contract.GetEvent("MultipliedLog");
var filterAll = await multipliedEvent.CreateFilterAsync(new Nethereum.RPC.Eth.DTOs.BlockParameter(0));
var eventLogsAll = await multipliedEvent.GetAllChanges<EventMultiplied2>(filterAll);
Event Multiplied (with DTO EventMultiplied) works well. The only difference I can find is the "indexed" string.
from nethereum.
Short story, retrieving the indexed values for dynamic types (strings, arrays) is not supported.
Long story:
The topics for indexed types if dynamics are stored as the SHA3 Keccak value (so they can be indexed and searched by matching the value).
Work around:
Use a bytes32, or don't index strings if you just want the data
from nethereum.
So for example if you look at the index topic for "Hello world" it retrieves ed6c11b0b5b808960df26f5bfc471d04c1995b0ffd2055925ad1be28d6baadfd
from nethereum.
Keeping it open as I need to validate the data part
from nethereum.
I see. Thanks.
from nethereum.
I have just pushed a fix which will allow to have indexed dynamic types as part of the Event DTO, mainly they will store the sha3 keccak string. This will prevent an error to be thrown, when decoding.
A further solution for your problem if you want to have the index and value of the string will be to have 2 event parameters, 1 for the index and another for the value.
from nethereum.
Related Issues (20)
- How to call the smart contract write function? HOT 2
- Hi
- TransactionFactory.CreateTransaction(string) throws Signature not initiated or calculated
- SendBatchRequestAsync returns List<> with null-items HOT 3
- Nethereum is using http connection lifespan and idle timeout of 1 hour - too long HOT 1
- Missing signTypedData v3 HOT 3
- Missing EncodeTypedDataV4 HOT 2
- Calling getReservesData function is throwing System.OverflowException: 'Value was either too large or too small for an Int32.' HOT 1
- Send Tron transaction with Ethereum compatible address HOT 1
- Required property 'message' not found in JSON
- BSC Block 30501963 is NULL??? HOT 3
- how to use http proxy?
- Error occurred when trying to send rpc requests(s)
- Serializing `bytes32`, then encoding from JSON does not work HOT 14
- EstimateGasAsync fails when function is onlyOwner HOT 2
- How to use struct parameters HOT 1
- Everything i post to contract throws 'System.ArgumentOutOfRangeException' with Number was less than the array's lower bound in the first dimension. (Parameter 'destinationIndex') HOT 2
- StreamingWebSocketClient.SendRequestAsync handled but not processed HOT 4
- StreamingWebSocketClient never close HOT 2
- Get a HIGH CPU usage HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nethereum.