예제 #1
0
        public byte[] Encode(params dynamic[] values)
        {
            MemoryStream stream = new MemoryStream();

            if (values.Length == this._definition.inputs.Length)
            {
                try
                {
                    AbiInputParameter[] parameters = new AbiInputParameter[values.Length];
                    for (int index = 0; index < values.Length; index++)
                    {
                        parameters[index] = new AbiInputParameter(this._definition.inputs[index], values[index]);
                    }
                    stream.Append(this._definition.Sha3Signature);
                    stream.Append(AbiParameterCoder.EncodeParames(parameters));
                }
                catch
                {
                    throw new ArgumentException("input values invalid");
                }
            }
            else
            {
                throw new ArgumentException("values number not match");
            }
            return(stream.ToArray());
        }
예제 #2
0
 public static byte[] EncodeParame(AbiInputParameter parameter)
 {
     return(Encode(new[] { parameter }));
 }