Metadata-Version: 2.4
Name: gigadex-sdk
Version: 0.1.1
Summary: Reusable Python SDK for GigaDex GraphQL, ABIs, contracts, and CL math.
Project-URL: Homepage, https://github.com/1220moritz/gigadex-sdk
Project-URL: Repository, https://github.com/1220moritz/gigadex-sdk
Project-URL: Issues, https://github.com/1220moritz/gigadex-sdk/issues
Author: GigaDex SDK Contributors
License: MIT
Keywords: defi,gigadex,robinhood-chain,sdk,web3
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27.0
Requires-Dist: pydantic>=2.8.0
Requires-Dist: web3>=7.16.0
Provides-Extra: dev
Requires-Dist: pytest>=8.2.0; extra == 'dev'
Requires-Dist: ruff>=0.5.0; extra == 'dev'
Description-Content-Type: text/markdown

# gigadex-sdk

The community Python SDK for building on [GigaDex](https://www.gigadex.fi/) on Robinhood Chain.

`gigadex-sdk` gives Python developers a small, typed foundation for reading GigaDex data, working with concentrated-liquidity prices and ticks, loading verified contract ABIs, and preparing Web3 integrations.

It is useful for:

- liquidity keepers and range-management bots
- portfolio dashboards
- analytics and reporting scripts
- research notebooks
- trading and automation tools

> This SDK is community maintained. Review all transactions yourself before sending funds on-chain.

## Features

- **GigaDex GraphQL client** for tokens, pools, positions, and portfolio state.
- **Typed Pydantic models** for safer application code.
- **Concentrated-liquidity math** for ticks, prices, ranges, and tick-spacing alignment.
- **Packaged ABI loading** for common GigaDex/Web3 contract interactions.
- **Web3 helpers** for contracts, chain validation, gas checks, signing, and sending transactions.
- **Modern Python packaging** with `uv`, `pyproject.toml`, and Python 3.11+ support.

## Installation

With `uv`:

```bash
uv add gigadex-sdk
```

With `pip`:

```bash
pip install gigadex-sdk
```

## Quick start

### Fetch portfolio data

```python
from gigadex_sdk.graphql_client import GigaDexGraphQLClient

GRAPHQL_URL = "https://edge.gigadex.fi/v1/graphql"
CHAIN_ID = 4663
ACCOUNT = "0x0000000000000000000000000000000000000000"

client = GigaDexGraphQLClient(GRAPHQL_URL)
portfolio = client.fetch_portfolio(chain_id=CHAIN_ID, account=ACCOUNT)

for position in portfolio.positions:
    print(position.token_id, position.pool, position.tick_lower, position.tick_upper)
```

### Work with concentrated-liquidity ticks

```python
from decimal import Decimal

from gigadex_sdk.math import percentage_range_ticks, range_width_percent

current_tick = -200_000
tick_spacing = 10

tick_lower, tick_upper = percentage_range_ticks(
    current_tick=current_tick,
    percent_each_side=Decimal("5"),
    tick_spacing=tick_spacing,
)

lower_pct, upper_pct = range_width_percent(tick_lower, tick_upper, current_tick)

print(tick_lower, tick_upper)
print(f"range: -{lower_pct:.2f}% / +{upper_pct:.2f}%")
```

### Load packaged ABIs

```python
from gigadex_sdk.abis import ERC20_ABI, POSITION_MANAGER_ABI

print(len(ERC20_ABI))
print(len(POSITION_MANAGER_ABI))
```

### Create a Web3 contract

```python
from gigadex_sdk.abis import ERC20_ABI
from gigadex_sdk.chain import ChainClient

# ChainClient expects a small settings object with rpc_url, chain_id,
# account/private-key settings, and gas controls. See README-DEV.md for
# development details and examples.
token = chain_client.contract("0xTokenAddress", ERC20_ABI)
```

## Common constants

```python
GIGADEX_GRAPHQL_URL = "https://edge.gigadex.fi/v1/graphql"
ROBINHOOD_CHAIN_ID = 4663
```

## Project status

`gigadex-sdk` is early software. The current focus is reliable read access, reusable data models, concentrated-liquidity math, and safe building blocks for bot authors.

On-chain write helpers are intentionally low-level. Applications should add their own policy layer for slippage, gas limits, simulation, private-key handling, retries, alerts, and human review.

## Contributing

Contributions are welcome. For development setup, test commands, release steps, and PyPI publishing notes, see [`README-DEV.md`](README-DEV.md).

## License

MIT

