langchain-dexpaprika 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- langchain_dexpaprika-0.1.0/.github/workflows/ci.yml +67 -0
- langchain_dexpaprika-0.1.0/.github/workflows/release.yml +62 -0
- langchain_dexpaprika-0.1.0/.gitignore +23 -0
- langchain_dexpaprika-0.1.0/LICENSE +21 -0
- langchain_dexpaprika-0.1.0/Makefile +18 -0
- langchain_dexpaprika-0.1.0/PKG-INFO +157 -0
- langchain_dexpaprika-0.1.0/README.md +123 -0
- langchain_dexpaprika-0.1.0/llms.txt +25 -0
- langchain_dexpaprika-0.1.0/pyproject.toml +75 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/__init__.py +32 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/_client.py +248 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/networks.py +50 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/pool_ohlcv.py +145 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/py.typed +0 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/search.py +113 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/token_details.py +117 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/token_pools.py +144 -0
- langchain_dexpaprika-0.1.0/src/langchain_dexpaprika/toolkit.py +38 -0
- langchain_dexpaprika-0.1.0/tests/__init__.py +0 -0
- langchain_dexpaprika-0.1.0/tests/integration_tests/__init__.py +0 -0
- langchain_dexpaprika-0.1.0/tests/integration_tests/test_smoke.py +44 -0
- langchain_dexpaprika-0.1.0/tests/integration_tests/test_tools_standard.py +97 -0
- langchain_dexpaprika-0.1.0/tests/unit_tests/__init__.py +0 -0
- langchain_dexpaprika-0.1.0/tests/unit_tests/conftest.py +15 -0
- langchain_dexpaprika-0.1.0/tests/unit_tests/test_client.py +256 -0
- langchain_dexpaprika-0.1.0/tests/unit_tests/test_hardening.py +151 -0
- langchain_dexpaprika-0.1.0/tests/unit_tests/test_tools_standard.py +96 -0
- langchain_dexpaprika-0.1.0/uv.lock +1962 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: ci
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
|
|
11
|
+
concurrency:
|
|
12
|
+
group: ci-${{ github.ref }}
|
|
13
|
+
cancel-in-progress: true
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
lint:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
20
|
+
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: "3.12"
|
|
23
|
+
enable-cache: true
|
|
24
|
+
- name: Install
|
|
25
|
+
run: uv sync --extra test
|
|
26
|
+
- name: Ruff lint
|
|
27
|
+
run: uv run ruff check .
|
|
28
|
+
- name: Ruff format
|
|
29
|
+
run: uv run ruff format --check .
|
|
30
|
+
- name: Mypy
|
|
31
|
+
run: uv run mypy src/
|
|
32
|
+
|
|
33
|
+
unit:
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
strategy:
|
|
36
|
+
fail-fast: false
|
|
37
|
+
matrix:
|
|
38
|
+
python-version: ["3.10", "3.12", "3.14"]
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
41
|
+
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
|
|
42
|
+
with:
|
|
43
|
+
python-version: ${{ matrix.python-version }}
|
|
44
|
+
enable-cache: true
|
|
45
|
+
- name: Install
|
|
46
|
+
run: uv sync --extra test
|
|
47
|
+
- name: Unit tests (sockets blocked)
|
|
48
|
+
run: uv run pytest --disable-socket --allow-unix-socket tests/unit_tests/
|
|
49
|
+
|
|
50
|
+
integration:
|
|
51
|
+
# Live keyless API, roughly 20 requests per run. One serial job so we stay
|
|
52
|
+
# inside the API's burst limit of about 30 requests per 20 seconds. Skipped
|
|
53
|
+
# for fork pull requests so untrusted code cannot rewrite the tests to hammer
|
|
54
|
+
# the live API from our runners.
|
|
55
|
+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
|
|
56
|
+
runs-on: ubuntu-latest
|
|
57
|
+
needs: [lint, unit]
|
|
58
|
+
steps:
|
|
59
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
60
|
+
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
|
|
61
|
+
with:
|
|
62
|
+
python-version: "3.12"
|
|
63
|
+
enable-cache: true
|
|
64
|
+
- name: Install
|
|
65
|
+
run: uv sync --extra test
|
|
66
|
+
- name: Integration tests (live API)
|
|
67
|
+
run: uv run pytest tests/integration_tests/
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Publishes to PyPI via trusted publishing (OIDC, no tokens).
|
|
2
|
+
#
|
|
3
|
+
# The PyPI pending publisher for langchain-dexpaprika is bound to exactly:
|
|
4
|
+
# repository: coinpaprika/langchain-dexpaprika
|
|
5
|
+
# workflow: release.yml
|
|
6
|
+
# environment: pypi
|
|
7
|
+
# Do not rename this file or the environment; either change breaks the binding.
|
|
8
|
+
#
|
|
9
|
+
# The `pypi` environment must carry required-reviewer protection in the repo
|
|
10
|
+
# settings so a workflow_dispatch cannot publish without a second approval.
|
|
11
|
+
#
|
|
12
|
+
# Release flow: merge to main, create a GitHub release with tag vX.Y.Z,
|
|
13
|
+
# this workflow runs checks, builds with uv, and publishes dist/ to PyPI.
|
|
14
|
+
# Actions are pinned to full commit SHAs (mutable tags are a supply-chain risk
|
|
15
|
+
# for a job that holds id-token: write).
|
|
16
|
+
|
|
17
|
+
name: release
|
|
18
|
+
|
|
19
|
+
on:
|
|
20
|
+
release:
|
|
21
|
+
types: [published]
|
|
22
|
+
workflow_dispatch:
|
|
23
|
+
|
|
24
|
+
permissions:
|
|
25
|
+
contents: read
|
|
26
|
+
|
|
27
|
+
jobs:
|
|
28
|
+
checks:
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
32
|
+
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
|
|
33
|
+
with:
|
|
34
|
+
python-version: "3.12"
|
|
35
|
+
enable-cache: true
|
|
36
|
+
- name: Install
|
|
37
|
+
run: uv sync --extra test
|
|
38
|
+
- name: Ruff lint
|
|
39
|
+
run: uv run ruff check .
|
|
40
|
+
- name: Ruff format
|
|
41
|
+
run: uv run ruff format --check .
|
|
42
|
+
- name: Mypy
|
|
43
|
+
run: uv run mypy src/
|
|
44
|
+
- name: Unit tests (sockets blocked)
|
|
45
|
+
run: uv run pytest --disable-socket --allow-unix-socket tests/unit_tests/
|
|
46
|
+
|
|
47
|
+
publish:
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
needs: [checks]
|
|
50
|
+
environment: pypi
|
|
51
|
+
permissions:
|
|
52
|
+
contents: read
|
|
53
|
+
id-token: write
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
56
|
+
- uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
|
|
57
|
+
with:
|
|
58
|
+
python-version: "3.12"
|
|
59
|
+
- name: Build sdist and wheel
|
|
60
|
+
run: uv build
|
|
61
|
+
- name: Publish to PyPI (trusted publishing)
|
|
62
|
+
uses: pypa/gh-action-pypi-publish@ba38be9e461d3875417946c167d0b5f3d385a247 # v1.14.1
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
build/
|
|
7
|
+
dist/
|
|
8
|
+
|
|
9
|
+
# Environments
|
|
10
|
+
.venv*/
|
|
11
|
+
venv/
|
|
12
|
+
|
|
13
|
+
# Tooling caches
|
|
14
|
+
.pytest_cache/
|
|
15
|
+
.mypy_cache/
|
|
16
|
+
.ruff_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
|
|
20
|
+
# Editors
|
|
21
|
+
.idea/
|
|
22
|
+
.vscode/
|
|
23
|
+
.DS_Store
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CoinPaprika
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.PHONY: all lint format test integration_tests
|
|
2
|
+
|
|
3
|
+
all: lint test
|
|
4
|
+
|
|
5
|
+
lint:
|
|
6
|
+
uv run ruff check .
|
|
7
|
+
uv run ruff format --check .
|
|
8
|
+
uv run mypy src/
|
|
9
|
+
|
|
10
|
+
format:
|
|
11
|
+
uv run ruff format .
|
|
12
|
+
uv run ruff check --fix .
|
|
13
|
+
|
|
14
|
+
test:
|
|
15
|
+
uv run pytest --disable-socket --allow-unix-socket tests/unit_tests/
|
|
16
|
+
|
|
17
|
+
integration_tests:
|
|
18
|
+
uv run pytest tests/integration_tests/
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: langchain-dexpaprika
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: LangChain tools for the DexPaprika API: keyless DEX market data across every supported blockchain
|
|
5
|
+
Project-URL: Homepage, https://github.com/coinpaprika/langchain-dexpaprika
|
|
6
|
+
Project-URL: Repository, https://github.com/coinpaprika/langchain-dexpaprika
|
|
7
|
+
Project-URL: Documentation, https://docs.dexpaprika.com
|
|
8
|
+
Project-URL: Changelog, https://github.com/coinpaprika/langchain-dexpaprika/releases
|
|
9
|
+
Author: CoinPaprika
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: agents,blockchain,coinpaprika,crypto,defi,dex,dexpaprika,langchain,tools
|
|
13
|
+
Classifier: Development Status :: 4 - Beta
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Requires-Python: <4.0,>=3.10
|
|
23
|
+
Requires-Dist: httpx>=0.27
|
|
24
|
+
Requires-Dist: langchain-core<2.0.0,>=1.0.0
|
|
25
|
+
Provides-Extra: test
|
|
26
|
+
Requires-Dist: langchain-tests~=1.1; extra == 'test'
|
|
27
|
+
Requires-Dist: mypy>=1.15; extra == 'test'
|
|
28
|
+
Requires-Dist: pytest-asyncio>=0.26; extra == 'test'
|
|
29
|
+
Requires-Dist: pytest-mock>=3.14; extra == 'test'
|
|
30
|
+
Requires-Dist: pytest-socket>=0.7; extra == 'test'
|
|
31
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
32
|
+
Requires-Dist: ruff>=0.11; extra == 'test'
|
|
33
|
+
Description-Content-Type: text/markdown
|
|
34
|
+
|
|
35
|
+
# langchain-dexpaprika
|
|
36
|
+
|
|
37
|
+
[](https://pypi.org/project/langchain-dexpaprika/)
|
|
38
|
+
[](https://opensource.org/licenses/MIT)
|
|
39
|
+
|
|
40
|
+
DexPaprika tools for LangChain agents. No API key, no signup: the
|
|
41
|
+
[DexPaprika API](https://docs.dexpaprika.com) is keyless, so your agent gets
|
|
42
|
+
DEX market data across every supported blockchain (33M+ tokens, 36M+ pools)
|
|
43
|
+
as soon as you install the package.
|
|
44
|
+
|
|
45
|
+
We built these tools for LLM consumption: descriptions tell the model exactly
|
|
46
|
+
which parameters exist and where to get their values, error messages quote the
|
|
47
|
+
API's own allowed-value lists so the model can self-correct, and outputs are
|
|
48
|
+
compact JSON with multi-kilobyte token descriptions trimmed.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install -U langchain-dexpaprika
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
No credentials to configure. There is no environment variable to set because
|
|
57
|
+
there is no API key.
|
|
58
|
+
|
|
59
|
+
## Quickstart
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from langchain_dexpaprika import DexPaprikaSearch
|
|
63
|
+
|
|
64
|
+
search = DexPaprikaSearch()
|
|
65
|
+
print(search.invoke({"query": "WETH"}))
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
This returns compact JSON with matching tokens (contract address, chain, USD
|
|
69
|
+
price, liquidity), pools, and DEXes.
|
|
70
|
+
|
|
71
|
+
## Tools
|
|
72
|
+
|
|
73
|
+
| Tool name | Class | What it returns |
|
|
74
|
+
| --- | --- | --- |
|
|
75
|
+
| `dexpaprika_search` | `DexPaprikaSearch` | Tokens, pools, and DEXes matching a name, symbol, or address. The entry point when you only have a ticker. |
|
|
76
|
+
| `dexpaprika_token_details` | `DexPaprikaTokenDetails` | Price, FDV, liquidity, pool count, and 24h/6h/1h volume with buy/sell breakdown for one token on one network. |
|
|
77
|
+
| `dexpaprika_token_pools` | `DexPaprikaTokenPools` | Pools where a token trades, sortable by volume, liquidity, transactions, age, price, or 24h price change. |
|
|
78
|
+
| `dexpaprika_pool_ohlcv` | `DexPaprikaPoolOHLCV` | Historical OHLCV candles for one pool, intervals from 1m to 24h, up to 366 candles per call. |
|
|
79
|
+
| `dexpaprika_networks` | `DexPaprikaNetworks` | Every supported network with its exact id, 24h volume, transactions, and pool counts. |
|
|
80
|
+
|
|
81
|
+
## Use the toolkit in an agent
|
|
82
|
+
|
|
83
|
+
`DexPaprikaToolkit` bundles all five tools over one shared HTTP client. The
|
|
84
|
+
example below drives them with an Anthropic model, so install the provider and
|
|
85
|
+
set its key first (swap in any chat model you prefer):
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install -U "langchain[anthropic]"
|
|
89
|
+
export ANTHROPIC_API_KEY=...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
```python
|
|
93
|
+
from langchain.agents import create_agent
|
|
94
|
+
from langchain_dexpaprika import DexPaprikaToolkit
|
|
95
|
+
|
|
96
|
+
toolkit = DexPaprikaToolkit()
|
|
97
|
+
agent = create_agent("claude-sonnet-4-5", toolkit.get_tools())
|
|
98
|
+
result = agent.invoke(
|
|
99
|
+
{"messages": [("user", "Find the most liquid WETH pool on ethereum")]}
|
|
100
|
+
)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The tool descriptions chain naturally: an agent starts with
|
|
104
|
+
`dexpaprika_search` to resolve a ticker into a contract address and network
|
|
105
|
+
id, then feeds those into the other tools.
|
|
106
|
+
|
|
107
|
+
## Individual tools
|
|
108
|
+
|
|
109
|
+
Every tool works standalone, sync and async:
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from langchain_dexpaprika import DexPaprikaPoolOHLCV
|
|
113
|
+
|
|
114
|
+
ohlcv = DexPaprikaPoolOHLCV()
|
|
115
|
+
candles = ohlcv.invoke(
|
|
116
|
+
{
|
|
117
|
+
"network": "ethereum",
|
|
118
|
+
"pool_address": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
|
|
119
|
+
"start": "2026-07-10",
|
|
120
|
+
"interval": "24h",
|
|
121
|
+
"limit": 7,
|
|
122
|
+
}
|
|
123
|
+
)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Error handling
|
|
127
|
+
|
|
128
|
+
We surface API errors as messages the agent can act on:
|
|
129
|
+
|
|
130
|
+
- 400 responses quote the API's message verbatim, including the exact list of
|
|
131
|
+
allowed values for the offending parameter.
|
|
132
|
+
- 404 responses arrive with an empty body, so we synthesize a message that
|
|
133
|
+
names the missing identifier and points at the tool that lists valid values.
|
|
134
|
+
- 429 responses are retried automatically, honoring the `Retry-After` header,
|
|
135
|
+
before we tell the agent to slow down.
|
|
136
|
+
- 410 responses (removed endpoints) surface the replacement endpoint the API
|
|
137
|
+
reports, with a hint to upgrade the package.
|
|
138
|
+
|
|
139
|
+
## Development
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
uv venv
|
|
143
|
+
uv pip install -e '.[test]'
|
|
144
|
+
make lint # ruff + mypy
|
|
145
|
+
make test # unit tests, sockets blocked
|
|
146
|
+
make integration_tests # live API, keyless, run serially
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Links
|
|
150
|
+
|
|
151
|
+
- [DexPaprika API documentation](https://docs.dexpaprika.com)
|
|
152
|
+
- [DexPaprika agent integration guide](https://agents.dexpaprika.com)
|
|
153
|
+
- [API reference](https://docs.dexpaprika.com/api-reference/introduction)
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# langchain-dexpaprika
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/langchain-dexpaprika/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
DexPaprika tools for LangChain agents. No API key, no signup: the
|
|
7
|
+
[DexPaprika API](https://docs.dexpaprika.com) is keyless, so your agent gets
|
|
8
|
+
DEX market data across every supported blockchain (33M+ tokens, 36M+ pools)
|
|
9
|
+
as soon as you install the package.
|
|
10
|
+
|
|
11
|
+
We built these tools for LLM consumption: descriptions tell the model exactly
|
|
12
|
+
which parameters exist and where to get their values, error messages quote the
|
|
13
|
+
API's own allowed-value lists so the model can self-correct, and outputs are
|
|
14
|
+
compact JSON with multi-kilobyte token descriptions trimmed.
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
pip install -U langchain-dexpaprika
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
No credentials to configure. There is no environment variable to set because
|
|
23
|
+
there is no API key.
|
|
24
|
+
|
|
25
|
+
## Quickstart
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from langchain_dexpaprika import DexPaprikaSearch
|
|
29
|
+
|
|
30
|
+
search = DexPaprikaSearch()
|
|
31
|
+
print(search.invoke({"query": "WETH"}))
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
This returns compact JSON with matching tokens (contract address, chain, USD
|
|
35
|
+
price, liquidity), pools, and DEXes.
|
|
36
|
+
|
|
37
|
+
## Tools
|
|
38
|
+
|
|
39
|
+
| Tool name | Class | What it returns |
|
|
40
|
+
| --- | --- | --- |
|
|
41
|
+
| `dexpaprika_search` | `DexPaprikaSearch` | Tokens, pools, and DEXes matching a name, symbol, or address. The entry point when you only have a ticker. |
|
|
42
|
+
| `dexpaprika_token_details` | `DexPaprikaTokenDetails` | Price, FDV, liquidity, pool count, and 24h/6h/1h volume with buy/sell breakdown for one token on one network. |
|
|
43
|
+
| `dexpaprika_token_pools` | `DexPaprikaTokenPools` | Pools where a token trades, sortable by volume, liquidity, transactions, age, price, or 24h price change. |
|
|
44
|
+
| `dexpaprika_pool_ohlcv` | `DexPaprikaPoolOHLCV` | Historical OHLCV candles for one pool, intervals from 1m to 24h, up to 366 candles per call. |
|
|
45
|
+
| `dexpaprika_networks` | `DexPaprikaNetworks` | Every supported network with its exact id, 24h volume, transactions, and pool counts. |
|
|
46
|
+
|
|
47
|
+
## Use the toolkit in an agent
|
|
48
|
+
|
|
49
|
+
`DexPaprikaToolkit` bundles all five tools over one shared HTTP client. The
|
|
50
|
+
example below drives them with an Anthropic model, so install the provider and
|
|
51
|
+
set its key first (swap in any chat model you prefer):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install -U "langchain[anthropic]"
|
|
55
|
+
export ANTHROPIC_API_KEY=...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from langchain.agents import create_agent
|
|
60
|
+
from langchain_dexpaprika import DexPaprikaToolkit
|
|
61
|
+
|
|
62
|
+
toolkit = DexPaprikaToolkit()
|
|
63
|
+
agent = create_agent("claude-sonnet-4-5", toolkit.get_tools())
|
|
64
|
+
result = agent.invoke(
|
|
65
|
+
{"messages": [("user", "Find the most liquid WETH pool on ethereum")]}
|
|
66
|
+
)
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The tool descriptions chain naturally: an agent starts with
|
|
70
|
+
`dexpaprika_search` to resolve a ticker into a contract address and network
|
|
71
|
+
id, then feeds those into the other tools.
|
|
72
|
+
|
|
73
|
+
## Individual tools
|
|
74
|
+
|
|
75
|
+
Every tool works standalone, sync and async:
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
from langchain_dexpaprika import DexPaprikaPoolOHLCV
|
|
79
|
+
|
|
80
|
+
ohlcv = DexPaprikaPoolOHLCV()
|
|
81
|
+
candles = ohlcv.invoke(
|
|
82
|
+
{
|
|
83
|
+
"network": "ethereum",
|
|
84
|
+
"pool_address": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
|
|
85
|
+
"start": "2026-07-10",
|
|
86
|
+
"interval": "24h",
|
|
87
|
+
"limit": 7,
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Error handling
|
|
93
|
+
|
|
94
|
+
We surface API errors as messages the agent can act on:
|
|
95
|
+
|
|
96
|
+
- 400 responses quote the API's message verbatim, including the exact list of
|
|
97
|
+
allowed values for the offending parameter.
|
|
98
|
+
- 404 responses arrive with an empty body, so we synthesize a message that
|
|
99
|
+
names the missing identifier and points at the tool that lists valid values.
|
|
100
|
+
- 429 responses are retried automatically, honoring the `Retry-After` header,
|
|
101
|
+
before we tell the agent to slow down.
|
|
102
|
+
- 410 responses (removed endpoints) surface the replacement endpoint the API
|
|
103
|
+
reports, with a hint to upgrade the package.
|
|
104
|
+
|
|
105
|
+
## Development
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
uv venv
|
|
109
|
+
uv pip install -e '.[test]'
|
|
110
|
+
make lint # ruff + mypy
|
|
111
|
+
make test # unit tests, sockets blocked
|
|
112
|
+
make integration_tests # live API, keyless, run serially
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Links
|
|
116
|
+
|
|
117
|
+
- [DexPaprika API documentation](https://docs.dexpaprika.com)
|
|
118
|
+
- [DexPaprika agent integration guide](https://agents.dexpaprika.com)
|
|
119
|
+
- [API reference](https://docs.dexpaprika.com/api-reference/introduction)
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# langchain-dexpaprika
|
|
2
|
+
|
|
3
|
+
> LangChain tools for the DexPaprika API: keyless DEX market data across every supported blockchain (33M+ tokens, 36M+ pools). No API key, no signup, no credential handling.
|
|
4
|
+
|
|
5
|
+
## Package
|
|
6
|
+
|
|
7
|
+
- PyPI: langchain-dexpaprika
|
|
8
|
+
- Import: langchain_dexpaprika
|
|
9
|
+
- Install: pip install -U langchain-dexpaprika
|
|
10
|
+
- Requires: Python >=3.10, langchain-core >=1.0
|
|
11
|
+
|
|
12
|
+
## Tools
|
|
13
|
+
|
|
14
|
+
- dexpaprika_search (DexPaprikaSearch): free-text search for tokens, pools, and DEXes; returns contract addresses and network ids for the other tools
|
|
15
|
+
- dexpaprika_token_details (DexPaprikaTokenDetails): price, FDV, liquidity, pool count, and 24h/6h/1h volume for one token on one network
|
|
16
|
+
- dexpaprika_token_pools (DexPaprikaTokenPools): pools where a token trades, sortable by volume, liquidity, transactions, age, or price change
|
|
17
|
+
- dexpaprika_pool_ohlcv (DexPaprikaPoolOHLCV): historical OHLCV candles for one pool, intervals 1m to 24h, up to 366 candles
|
|
18
|
+
- dexpaprika_networks (DexPaprikaNetworks): all supported networks with their exact ids and activity stats
|
|
19
|
+
- DexPaprikaToolkit: all five tools over one shared HTTP client
|
|
20
|
+
|
|
21
|
+
## Links
|
|
22
|
+
|
|
23
|
+
- API docs: https://docs.dexpaprika.com
|
|
24
|
+
- Agent integration guide: https://agents.dexpaprika.com
|
|
25
|
+
- Repository: https://github.com/coinpaprika/langchain-dexpaprika
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "langchain-dexpaprika"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "LangChain tools for the DexPaprika API: keyless DEX market data across every supported blockchain"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
requires-python = ">=3.10,<4.0"
|
|
13
|
+
authors = [{ name = "CoinPaprika" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"langchain",
|
|
16
|
+
"dexpaprika",
|
|
17
|
+
"coinpaprika",
|
|
18
|
+
"dex",
|
|
19
|
+
"defi",
|
|
20
|
+
"crypto",
|
|
21
|
+
"blockchain",
|
|
22
|
+
"agents",
|
|
23
|
+
"tools",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"Programming Language :: Python :: 3",
|
|
29
|
+
"Programming Language :: Python :: 3.10",
|
|
30
|
+
"Programming Language :: Python :: 3.11",
|
|
31
|
+
"Programming Language :: Python :: 3.12",
|
|
32
|
+
"Programming Language :: Python :: 3.13",
|
|
33
|
+
"Programming Language :: Python :: 3.14",
|
|
34
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
35
|
+
]
|
|
36
|
+
dependencies = [
|
|
37
|
+
"langchain-core>=1.0.0,<2.0.0",
|
|
38
|
+
"httpx>=0.27",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/coinpaprika/langchain-dexpaprika"
|
|
43
|
+
Repository = "https://github.com/coinpaprika/langchain-dexpaprika"
|
|
44
|
+
Documentation = "https://docs.dexpaprika.com"
|
|
45
|
+
Changelog = "https://github.com/coinpaprika/langchain-dexpaprika/releases"
|
|
46
|
+
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
test = [
|
|
49
|
+
"langchain-tests~=1.1",
|
|
50
|
+
"pytest>=8",
|
|
51
|
+
"pytest-asyncio>=0.26",
|
|
52
|
+
"pytest-socket>=0.7",
|
|
53
|
+
"pytest-mock>=3.14",
|
|
54
|
+
"mypy>=1.15",
|
|
55
|
+
"ruff>=0.11",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[tool.hatch.build.targets.wheel]
|
|
59
|
+
packages = ["src/langchain_dexpaprika"]
|
|
60
|
+
|
|
61
|
+
[tool.pytest.ini_options]
|
|
62
|
+
addopts = "--strict-markers --strict-config --durations=5"
|
|
63
|
+
# asyncio_mode = "auto" is required: langchain-tests async cases get skipped without it.
|
|
64
|
+
asyncio_mode = "auto"
|
|
65
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
66
|
+
|
|
67
|
+
[tool.ruff]
|
|
68
|
+
line-length = 100
|
|
69
|
+
target-version = "py310"
|
|
70
|
+
|
|
71
|
+
[tool.ruff.lint]
|
|
72
|
+
select = ["E", "F", "I", "UP", "B", "SIM"]
|
|
73
|
+
|
|
74
|
+
[tool.mypy]
|
|
75
|
+
strict = true
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""LangChain tools for the DexPaprika API.
|
|
2
|
+
|
|
3
|
+
Keyless DEX market data across every network DexPaprika covers: 33M+ tokens,
|
|
4
|
+
36M+ pools. No API key, no signup. See https://docs.dexpaprika.com for API
|
|
5
|
+
documentation and https://agents.dexpaprika.com for the agent integration guide.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from importlib import metadata
|
|
9
|
+
|
|
10
|
+
from langchain_dexpaprika._client import DexPaprikaAPIWrapper
|
|
11
|
+
from langchain_dexpaprika.networks import DexPaprikaNetworks
|
|
12
|
+
from langchain_dexpaprika.pool_ohlcv import DexPaprikaPoolOHLCV
|
|
13
|
+
from langchain_dexpaprika.search import DexPaprikaSearch
|
|
14
|
+
from langchain_dexpaprika.token_details import DexPaprikaTokenDetails
|
|
15
|
+
from langchain_dexpaprika.token_pools import DexPaprikaTokenPools
|
|
16
|
+
from langchain_dexpaprika.toolkit import DexPaprikaToolkit
|
|
17
|
+
|
|
18
|
+
try:
|
|
19
|
+
__version__ = metadata.version("langchain-dexpaprika")
|
|
20
|
+
except metadata.PackageNotFoundError: # pragma: no cover - only during development
|
|
21
|
+
__version__ = "0.0.0"
|
|
22
|
+
|
|
23
|
+
__all__ = [
|
|
24
|
+
"DexPaprikaAPIWrapper",
|
|
25
|
+
"DexPaprikaNetworks",
|
|
26
|
+
"DexPaprikaPoolOHLCV",
|
|
27
|
+
"DexPaprikaSearch",
|
|
28
|
+
"DexPaprikaTokenDetails",
|
|
29
|
+
"DexPaprikaTokenPools",
|
|
30
|
+
"DexPaprikaToolkit",
|
|
31
|
+
"__version__",
|
|
32
|
+
]
|