diff --git a/Circles.Index.Rpc/CirclesRpcModule.cs b/Circles.Index.Rpc/CirclesRpcModule.cs index e1cf207..7f451bc 100644 --- a/Circles.Index.Rpc/CirclesRpcModule.cs +++ b/Circles.Index.Rpc/CirclesRpcModule.cs @@ -383,6 +383,31 @@ public Task> circles_health() return Task.FromResult(ResultWrapper.Success("Healthy")); } + public Task>> circles_tables() + { + var namespaces = new List(); + foreach (var namepsace in _indexerContext.Database.Schema.Tables.GroupBy(o => o.Key.Namespace)) + { + var namespaceDto = new Namespace(namepsace.Key); + namespaces.Add(namespaceDto); + + foreach (var table in namepsace) + { + var topic = table.Value.Topic.ToHexString(true); + var tableDto = new Table(table.Key.Table, topic); + namespaceDto.Tables = namespaceDto.Tables.Append(tableDto).ToArray(); + + foreach (var column in table.Value.Columns) + { + var columnDto = new Column(column.Column, column.Type.ToString()); + tableDto.Columns = tableDto.Columns.Append(columnDto).ToArray(); + } + } + } + + return Task.FromResult(ResultWrapper>.Success(namespaces)); + } + private string[] GetTokenExposureIds(Address address) { var selectTokenExposure = new Select( diff --git a/Circles.Index.Rpc/ICirclesRpcModule.cs b/Circles.Index.Rpc/ICirclesRpcModule.cs index 31b6940..e975801 100644 --- a/Circles.Index.Rpc/ICirclesRpcModule.cs +++ b/Circles.Index.Rpc/ICirclesRpcModule.cs @@ -33,6 +33,18 @@ public record CirclesTrustRelations(Address User, CirclesTrustRelation[] Trusts, public record CirclesEvent(string Event, IDictionary Values); +public record Column(string Name, string Type); + +public class Table(string Name, string Topic) +{ + public Column[] Columns { get; set; } = []; +} + +public class Namespace(string Name) +{ + public Table[] Tables { get; set; } = []; +} + #endregion [RpcModule("Circles")] @@ -70,4 +82,9 @@ ResultWrapper circles_events(Address? address, long? fromBlock, Description = "Checks if the database is available and indexing progresses as expected", IsImplemented = true)] Task> circles_health(); + + [JsonRpcMethod( + Description = "Returns all indexed tables and columns grouped by namespace", + IsImplemented = true)] + Task>> circles_tables(); } \ No newline at end of file diff --git a/Circles.Index/Circles.Index.csproj b/Circles.Index/Circles.Index.csproj index 785be86..d4c92fb 100644 --- a/Circles.Index/Circles.Index.csproj +++ b/Circles.Index/Circles.Index.csproj @@ -8,8 +8,8 @@ Daniel Janz (Gnosis Service GmbH) Gnosis Service GmbH Circles - 1.11.14 - 1.11.14 + 1.11.15 + 1.11.15 diff --git a/v2-example-requests.md b/v2-example-requests.md index 266f88a..2533b1a 100644 --- a/v2-example-requests.md +++ b/v2-example-requests.md @@ -372,4 +372,19 @@ curl -X POST --data '{ }, "id": 1 } +``` + +#### Get the max flow between two nodes +```shell +curl 'https://rpc.aboutcircles.com/' \ + -H 'Content-Type: application/json' \ + --data-raw '{"jsonrpc":"2.0","id":0,"method":"circlesV2_findPath","params":[{"Source":"0x749c930256b47049cb65adcd7c25e72d5de44b3b","Sink":"0xde374ece6fa50e781e81aac78e811b33d16912c7","TargetFlow":"99999999999999999999999999999999999"}]}' +``` + + +#### Show all tables available for queries +```shell +curl 'https://rpc.aboutcircles.com/' \ + -H 'Content-Type: application/json' \ + --data-raw '{"jsonrpc":"2.0","id":0,"method":"circles_tables","params":[]}' ``` \ No newline at end of file