Skip to content

Commit

Permalink
add support for eos 1.5.0 get_table_rows and get_table_by_scope
Browse files Browse the repository at this point in the history
fix bug on reading abi rows
  • Loading branch information
mmcs85 committed Dec 10, 2018
1 parent 38fabc3 commit e5b09f4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
16 changes: 9 additions & 7 deletions EosSharp/EosSharp/Api/v1/Definitions/EosApiMethodDef.t4
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,12 @@
new Field() { Name = "table_key", Type = "string" },
new Field() { Name = "lower_bound", Type = "string", Default = "0" },
new Field() { Name = "upper_bound", Type = "string", Default = "-1" },
new Field() { Name = "limit", Type = "UInt32?", Default = "10" },
new Field() { Name = "limit", Type = "Int32?", Default = "10" },
new Field() { Name = "key_type", Type = "string" },
new Field() { Name = "index_position", Type = "string" }

new Field() { Name = "index_position", Type = "string" },
new Field() { Name = "encode_type", Type = "string", Default = "dec" },
new Field() { Name = "reverse", Type = "bool?" },
new Field() { Name = "show_payer", Type = "bool?" }
},
Response = new Field[]
{
Expand All @@ -253,8 +255,8 @@
new Field() { Name = "table", Type = "string", Default = "" },
new Field() { Name = "lower_bound", Type = "string" },
new Field() { Name = "upper_bound", Type = "string" },
new Field() { Name = "limit", Type = "UInt32?", Default = "10" }

new Field() { Name = "limit", Type = "Int32?", Default = "10" },
new Field() { Name = "reverse", Type = "bool?" }
},
Response = new Field[]
{
Expand Down Expand Up @@ -306,7 +308,7 @@
{
new Field() { Name = "json", Type = "bool?", Default = "false" },
new Field() { Name = "lower_bound", Type = "string" },
new Field() { Name = "limit", Type = "UInt32?", Default = "50" }
new Field() { Name = "limit", Type = "Int32?", Default = "50" }

},
Response = new Field[]
Expand Down Expand Up @@ -337,7 +339,7 @@
{
new Field() { Name = "json", Type = "bool?", Default = "false" },
new Field() { Name = "lower_bound", Type = "string" },
new Field() { Name = "limit", Type = "UInt32?", Default = "50" }
new Field() { Name = "limit", Type = "Int32?", Default = "50" }

},
Response = new Field[]
Expand Down
16 changes: 12 additions & 4 deletions EosSharp/EosSharp/Api/v1/EosTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -722,11 +722,17 @@ public class GetTableRowsRequest
[JsonProperty("upper_bound")]
public string UpperBound { get; set; } = "-1";
[JsonProperty("limit")]
public UInt32? Limit { get; set; } = 10;
public Int32? Limit { get; set; } = 10;
[JsonProperty("key_type")]
public string KeyType { get; set; }
[JsonProperty("index_position")]
public string IndexPosition { get; set; }
[JsonProperty("encode_type")]
public string EncodeType { get; set; } = "dec";
[JsonProperty("reverse")]
public bool? Reverse { get; set; }
[JsonProperty("show_payer")]
public bool? ShowPayer { get; set; }
}
[Serializable]
public class GetTableRowsResponse
Expand Down Expand Up @@ -756,7 +762,9 @@ public class GetTableByScopeRequest
[JsonProperty("upper_bound")]
public string UpperBound { get; set; }
[JsonProperty("limit")]
public UInt32? Limit { get; set; } = 10;
public Int32? Limit { get; set; } = 10;
[JsonProperty("reverse")]
public bool? Reverse { get; set; }
}
[Serializable]
public class GetTableByScopeResponse
Expand Down Expand Up @@ -804,7 +812,7 @@ public class GetProducersRequest
[JsonProperty("lower_bound")]
public string LowerBound { get; set; }
[JsonProperty("limit")]
public UInt32? Limit { get; set; } = 50;
public Int32? Limit { get; set; } = 50;
}
[Serializable]
public class GetProducersResponse
Expand Down Expand Up @@ -834,7 +842,7 @@ public class GetScheduledTransactionsRequest
[JsonProperty("lower_bound")]
public string LowerBound { get; set; }
[JsonProperty("limit")]
public UInt32? Limit { get; set; } = 50;
public Int32? Limit { get; set; } = 50;
}
[Serializable]
public class GetScheduledTransactionsResponse
Expand Down
7 changes: 6 additions & 1 deletion EosSharp/EosSharp/Providers/AbiSerializationProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1165,8 +1165,13 @@ private T ReadAbiStruct<T>(byte[] data, ref Int32 readIndex, AbiStruct abiStruct

if(string.IsNullOrWhiteSpace(fieldName))
{
if (typeof(T) == typeof(object))
if (valueType == typeof(ExpandoObject))
{
(value as IDictionary<string, Object>).Add(field.Name, abiValue);
}
else if (typeof(T) == typeof(object))
valueType.GetProperty(field.Name).SetValue(value, abiValue);

continue;
}

Expand Down

0 comments on commit e5b09f4

Please sign in to comment.