Metadata-Version: 2.1
Name: flare-explorer-python
Version: 0.2.0
Summary: A lightweight library that works as a connector to the Flare explorer api
Home-page: https://github.com/james-ecd/flare-explorer-python
License: MIT
Keywords: flare-explorer,flare,network,api,crypto,blockchain
Author: James Davis
Author-email: jamesecd@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Dist: gql (>=3.4.0,<4.0.0)
Requires-Dist: pydantic (>=1.10.4,<2.0.0)
Requires-Dist: requests (>=2.28.2,<3.0.0)
Requires-Dist: requests-toolbelt (>=1.0.0,<2.0.0)
Project-URL: Repository, https://github.com/james-ecd/flare-explorer-python
Description-Content-Type: text/markdown

# Flare explorer python
<a href="https://pypi.org/project/flare-explorer-python" target="_blank"><img src="https://img.shields.io/pypi/v/flare-explorer-python?color=%2334D058&label=pypi%20package" alt="Package version"></a>
[![Linting and tests](https://github.com/james-ecd/flare-explorer-python/actions/workflows/tests-and-linting.yml/badge.svg?branch=main)](https://github.com/james-ecd/flare-explorer-python/actions/workflows/tests-and-linting.yml)
[![codecov](https://codecov.io/gh/james-ecd/flare-explorer-python/branch/main/graph/badge.svg?token=XOBC0UK00V)](https://codecov.io/gh/james-ecd/flare-explorer-python)
<a href="https://pypi.org/project/flare-explorer-python" target="_blank">
    <img src="https://img.shields.io/pypi/pyversions/flare-explorer-python.svg?color=%2334D058" alt="Supported Python versions">
</a>
[![Code Style](https://img.shields.io/badge/code_style-black-black)](https://black.readthedocs.io/en/stable/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A lightweight library that works as a connector to the [Flare explorer api](https://flare-explorer.flare.network/graphiql)

If you came here looking for the flare network, then go [here](https://flare.network/). If you want to query flares blockchain using python then stick around.

## Installation
flare-explorer-python is available on PYPI. Install with pip or poetry:

```
pip install flare-explorer-python
```
```
poetry add flare-explorer-python
```

## Usage
### Transactions
``` python
from flare_explorer.transaction import (
    get_internal_transactions,
    get_transaction,
    get_transactions_from_address,
)

transaction = get_transaction("transaction_hash")

internal_transactions, page_info = get_internal_transactions(
    "transaction_hash",
    previous_cursor="previous_page_last_cursor"
)

transactions, page_info = get_transactions_from_address(
    "address_hash",
    previous_cursor="previous_page_last_cursor"
)
```

### Addresses
``` python
from flare_explorer.address import get_address, get_addresses

address = get_address(
    "address_hash",
)

addresses = get_addresses(
    [
        "address_hash_1",
        "address_hash_2",
    ]
)
```

### Blocks
``` python
from flare_explorer.block import get_block

block = get_block(4463469)
```

### Token transfers
``` python
from flare_explorer.token_transfers import get_token_transfers

token_transfers, page_info = get_token_transfers(
    "token_contract_address_hash",
    previous_cursor="previous_page_last_cursor"
)
```

## Upcoming features
- asyncio support
- websocket support
- fast mode (no pydantic serialization)

## Testing / Contributing
Any contributions or issue raising is welcomed. If you wish to contribute then:
1. fork/clone this repo
2. make changes on a branch taken from main
3. submit a pull request against main

Pull requests will be blocked from merging automatically if:
- less than 100% coverage
- there are failing tests
- linting rules have been violated.

## Publishing new package version
1. Bump version number in `pyproject.toml`
2. Commit the version bump
3. Create a new release on github
4. `poetry build`
5. `poetry publish`

