0

I'm trying to encode some parameters and I've noticed all the encoders in the ABI project. Essentially, I want the equivalent to abi.encodeParameter(type, value) in Nethereum? Is there an easy solution to obtaining this with the parameter attributes on the model?

2 Answers 2

2

You can encode them like this, ParameterEncoder is in the namespace Nethereum.ABI.FunctionEncoding

 public byte[] GetABIParamsEncoded<T>(T functionInput) { var type = typeof(T); return new ParametersEncoder().EncodeParametersFromTypeAttributes(type, functionInput); } 

This simpler function will be available in 3.1 in the ABIEncode class

0

I think this is what I was looking for will update if so

 var encoder = new ConstructorCallEncoder(); var result = encoder.EncodeRequest<datamodel>(datamodel, ""); 
1
  • 1
    Yes that achieves it as the ConstructorCallEncoder, does not have any signature :) Commented Dec 13, 2018 at 9:35

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.