diff --git a/docs/design/additional-endpoints.md b/docs/design/additional-endpoints.md index 9be13d40d..183c286b8 100644 --- a/docs/design/additional-endpoints.md +++ b/docs/design/additional-endpoints.md @@ -23,12 +23,12 @@ Currently MN doesn't support EVM centric queries, like token transfer  *  Support ERC20, ERC721, and ERC1155 token standards *  Match Etherscan's response format for easy integration *  Maintain performance with large datasets -*  Provide endpoints to fetch tokens owned by an address +*  Provide endpoints to fetch tokens owned by an address (TBD) ## Non-Goals *  Support all Blockscout and Etherscan API endpoints * Support other events except for Transfer events -* No API key for authorization +* Support API key for authorization ## Proposed Solution @@ -38,13 +38,12 @@ Introduce a new package `rest-server` with the following REST endpoints: | Endpoint | Description | |----------|-------------| -| `GET /api?module=account&action=tokentx&address={address}&contractaddress={contractaddress}&startblock={startblock}&endblock={endblock}&page={page}&offset={offset}&sort={asc\|desc}` | Get ERC20 token transfer events | -| `GET /api?module=account&action=tokennfttx&address={address}&contractaddress={contractaddress}&startblock={startblock}&endblock={endblock}&page={page}&offset={offset}&sort={asc\|desc}` | Get ERC721 (NFT) token transfer events | -| `GET /api?module=account&action=token1155tx&address={address}&contractaddress={contractaddress}&startblock={startblock}&endblock={endblock}&page={page}&offset={offset}&sort={asc\|desc}` | Get ERC1155 token transfer events | -| `GET /api/account/{address}/tokens?page={page}&offset={offset}` | Fetch tokens owned by an address | +| `GET /api/v1/etherscan?module=account&action=tokentx&address={address}&contractaddress={contractaddress}&startblock={startblock}&endblock={endblock}&page={page}&offset={offset}&sort={asc\|desc}` | Get ERC20 token transfer events | +| `GET /api/v1/etherscan?module=account&action=tokennfttx&address={address}&contractaddress={contractaddress}&startblock={startblock}&endblock={endblock}&page={page}&offset={offset}&sort={asc\|desc}` | Get ERC721 (NFT) token transfer events | +| `GET /api/v1/etherscan?module=account&action=token1155tx&address={address}&contractaddress={contractaddress}&startblock={startblock}&endblock={endblock}&page={page}&offset={offset}&sort={asc\|desc}` | Get ERC1155 token transfer events | +| `GET /api/v1/etherscan/account/{address}/tokens?page={page}&offset={offset}` | Fetch tokens owned by an address | -The package will be a standalone package with no relay dependencies, its own mirror node client implementation and its own cache service conncting to redis. -This allows for a more modular and scalable solution, with the ability to easily add more endpoints in the future. +The package will be a standalone package, but will be using the existing relay package for service implementations. ### Package Structure ``` @@ -173,14 +172,12 @@ GET /api | contractaddress | The token contract address to filter by | No | - | | startblock | The starting block number | No | 0 | | endblock | The ending block number | No | latest | -| contractAddress | The address of the token contract to filter by | No | - | -| standard | The token standard to filter by (ERC20/721/1155) | Yes | - | | page | The page number if pagination is enabled | No | 1 | | offset | The number of transfers per page | No | 100 | | sort | The sort order (asc/desc) | No | desc | There are three possible cases: -1. Only `contractAddress` is provided +1. Only `contractaddress` is provided 2. Only `address` is provided 3. Both `address` and `contractAddress` are provided