Skip to content

sui_v1.16.0_1704426950_ci

@tharbert tharbert tagged this 05 Jan 01:09
## Description 

Adding `/json-rpc` route to the `sui-indexer` service and `/graphql`
route to the `sui-graphql` service. These mirror the behaviors of their
respective `/` routes.

## Test Plan 

Test new routes:

```
curl -s -i http://localhost:8001/graphql | egrep '(200 OK|GraphiQL)'
HTTP/1.1 200 OK
        React.createElement(GraphiQL, {
          fetcher: GraphiQL.createFetcher({
```

```
curl -s -X POST -H "Content-Type: application/json" --data '{ "query": "query { chainIdentifier }", "variables": { "userId": "123" } }' http://localhost:8001/graphql | jq
{
  "data": {
    "chainIdentifier": "4c78adac"
  }
}
```

```
% curl -w "%{http_code}" http://localhost:9000/json-rpc -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "method":"sui_getObject", "params":["0x2"], "id":1}'
{"jsonrpc":"2.0","result":{"data":{"objectId":"0x0000000000000000000000000000000000000000000000000000000000000002","version":"1","digest":"7WbYdh6bcvniPfyZjUnjoLziM1KYuqEreRv5CFBYxXBS"}},"id":1}200
```

Test existing routes:

```
% curl -s -i http://localhost:8001 | egrep '(200 OK|GraphiQL)'
HTTP/1.1 200 OK
        React.createElement(GraphiQL, {
          fetcher: GraphiQL.createFetcher({
```

```
% curl -s -X POST -H "Content-Type: application/json" --data '{ "query": "query { chainIdentifier }", "variables": { "userId": "123" } }' http://localhost:8001 | jq

{
  "data": {
    "chainIdentifier": "4c78adac"
  }
}
```

```
% curl -w "%{http_code}" http://localhost:9000 -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "method":"sui_getObject", "params":["0x2"], "id":1}'
{"jsonrpc":"2.0","result":{"data":{"objectId":"0x0000000000000000000000000000000000000000000000000000000000000002","version":"1","digest":"7WbYdh6bcvniPfyZjUnjoLziM1KYuqEreRv5CFBYxXBS"}},"id":1}200
```


also test `sui-node` service `/` route which touches the same code
paths:

```
curl -w "%{http_code}" http://localhost:9000 -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0", "method":"sui_getObject", "params":["0x2"], "id":1}'
{"jsonrpc":"2.0","result":{"data":{"objectId":"0x0000000000000000000000000000000000000000000000000000000000000002","version":"1","digest":"7WbYdh6bcvniPfyZjUnjoLziM1KYuqEreRv5CFBYxXBS"}},"id":1}200
```
Assets 2
Loading