Skip to content

Commit e40623b

Browse files
committed
✨ feat: endpoint support & docs
1 parent 813c7ac commit e40623b

File tree

4 files changed

+94
-9
lines changed

4 files changed

+94
-9
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ python3 -m pip install -U transpose-data
2525
## Documentation
2626
You can find specific documentation on a per-product basis below.
2727

28-
| Product | Description | Documentation |
29-
| :-----------------------------------------------------------------------------------------------------------------------------------------------------------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
30-
| <img src="https://assets.website-files.com/624cc12cbb8535a77bafc47d/628ebc9704701b4d5610ac1a_Blockchain_Logo_Solid.png" width="50" height="50"><br> Block API | The Block API provides endpoints for accessing low-level blockchain data at scale, including accounts, blocks, transactions, internal transactions, and logs. | [Block API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/block.md) |
31-
| <img src="https://assets.website-files.com/624cc12cbb8535a77bafc47d/628d465b6551e284a9ae73e4_Wallet_Logo_ENS.png" width="50" height="50"><br> ENS API | The ENS API provides endpoints for looking up ENS names (both historical and primary), resolving ENS names and records, and monitoring ENS transfers and sales. | [ENS API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/ens.md) |
32-
| <img src="https://assets.website-files.com/624cc12cbb8535a77bafc47d/6286795ef57a1412d6d767fc_NFT_Logo_Solid.png" width="50" height="50"><br> NFT API | The NFT API provides endpoints for retrieving any collection and NFT in existence, as well as NFT images, operators, owners, transfers, approvals, and much more (fully supports both ERC-721 and ERC-1155 NFTs). | [NFT API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/nft.md) |
33-
| <img src="https://assets.website-files.com/624cc12cbb8535a77bafc47d/628fb0f77f6279a920577119_Token_Logo2_Solid.png" width="50" height="50"><br>Token API | The Token API provides endpoints for retrieving any token, token balance, transfer, and symbol in existence, including full support for native token transfers and balances (fully supports both ERC-20 and ERC-777 tokens). | [Token API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/token.md) |
28+
| Product | Description | Documentation |
29+
| :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
30+
| Block API | The Block API provides endpoints for accessing low-level blockchain data at scale, including accounts, blocks, transactions, internal transactions, and logs. | [Block API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/block.md) |
31+
| ENS API | The ENS API provides endpoints for looking up ENS names (both historical and primary), resolving ENS names and records, and monitoring ENS transfers and sales. | [ENS API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/ens.md) |
32+
| NFT API | The NFT API provides endpoints for retrieving any collection and NFT in existence, as well as NFT images, operators, owners, transfers, approvals, and much more (fully supports both ERC-721 and ERC-1155 NFTs). | [NFT API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/nft.md) |
33+
| Token API | The Token API provides endpoints for retrieving any token, token balance, transfer, and symbol in existence, including full support for native token transfers and balances (fully supports both ERC-20 and ERC-777 tokens). | [Token API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/token.md) |
34+
| SQL API | The SQL API provides direct SQL access to our entire ecosystem of indexed blockchain data. Paired with our robust indexing pipeline, SQL access gives unlimited flexibility in how you mix, aggregate, and query activity across the blockchain. | [SQL API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/sql.md) |
35+
| Endpoint API | The Endpoint API provides customized REST endpoints that you ca n create, version, and use directly in your production applications. | [Endpoint API Docs](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/endpoint.md) |
3436

3537
## SDK Documentation
3638
You can learn more about the Transpose SDK and how it works below.
@@ -174,7 +176,7 @@ api.bulk_request(endpoint_response, requests_per_second, results_to_fetch)
174176
| Code | Title | Model |
175177
| ---- | --------------------- | ------------------------------------------------------------------------------------------------------------ |
176178
| 200 | Success | Data Model |
177-
| 400 | Bad Request | [Error](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/documentation.md#Error-Classes)
179+
| 400 | Bad Request | [Error](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/documentation.md#Error-Classes) |
178180
| 401 | Unauthorized | [Error](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/documentation.md#Error-Classes) |
179181
| 403 | Forbidden | [Error](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/documentation.md#Error-Classes) |
180182
| 404 | Not Found | [Error](https://github.com/TransposeData/transpose-python-sdk/blob/main/docs/documentation.md#Error-Classes) |

docs/endpoint.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Welcome to the Endpoint API
2+
3+
The **Endpoint API** provides customized REST endpoints that you ca n create, version, and use directly in your production applications
4+
5+
## Usage
6+
7+
You may use the Endpoint API within your python project as follows:
8+
9+
```python
10+
api.endpoint.query(endpoint_url: str, paramters: dict) -> dict
11+
```
12+
13+
For example:
14+
15+
```python
16+
api = Transpose(api_key)
17+
18+
parameters = {
19+
'start_date': datetime.now().isoformat().split("T")[0],
20+
'time_interval': '1 day',
21+
'token_address': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
22+
}
23+
24+
response = api.endpoint.query('ohlc', parameters)
25+
```
26+
27+
## Parameters
28+
29+
| Parameter | Type | Description |
30+
| - | - | - |
31+
| `endpoint_url` | `string` | The custom endpoint URL to query. Your team must be the creators of this query. |
32+
| `parameters` | `dict` | The optional parameters for this call. |
33+
34+
## More Information
35+
36+
You can find more information about the Custom Endpoint API in our [documentation](https://docs.transpose.io/custom-endpoints/overview/).

docs/sql.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Welcome to the SQL API
2+
3+
The **SQL API** provides direct SQL access to our entire ecosystem of indexed blockchain data. Paired with our robust indexing pipeline, SQL access gives unlimited flexibility in how you mix, aggregate, and query activity across the blockchain.
4+
5+
## Usage
6+
7+
You may use the SQL API within your python project as follows:
8+
9+
```python
10+
api.sql.query(endpoint_url: str, paramters: dict) -> dict
11+
```
12+
13+
For example:
14+
15+
```python
16+
api = Transpose(api_key)
17+
18+
parameters = {
19+
'limit': 10,
20+
}
21+
22+
response = api.endpoint.query("SELECT * FROM ethereum.logs LIMIT {{limit}}", parameters)
23+
```
24+
25+
## Parameters
26+
27+
| Parameter | Type | Description |
28+
| - | - | - |
29+
| `endpoint_url` | `string` | The custom endpoint URL to query. Your team must be the creators of this query. |
30+
| `parameters` | `dict` | The optional parameters for this call. |
31+
32+
## More Information
33+
34+
You can find more information about the Custom Endpoint API in our [documentation](https://docs.transpose.io/custom-endpoints/overview/).

tests/test_endpoints.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from datetime import datetime
22
from transpose import Transpose, api_key
3-
from transpose.src.base import TransposeBadRequest
3+
from transpose.src.base import TransposeInvalidAPIKey
44

55
def test_basic():
66
try:
@@ -127,4 +127,17 @@ def test_normalize_6():
127127

128128
except Exception:
129129
assert False
130-
130+
131+
def test_invalid():
132+
try:
133+
api = Transpose(api_key)
134+
response = api.endpoint.query('https://api.transpose.io/endpoint/invalid-nafsndklfasnfkln', {})
135+
136+
# assert throws
137+
assert False
138+
139+
except TransposeInvalidAPIKey:
140+
assert True
141+
142+
except Exception:
143+
assert False

0 commit comments

Comments
 (0)