Metadata-Version: 2.4
Name: near-collection-py
Version: 1.0.0
Summary: PyPI Package - near-collection-py
License: MIT
Project-URL: Homepage, https://github.com/worksOnMyFridge/near-collection-py
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: aiohttp>=3.9
Requires-Dist: requests>=2.31

# near-collection-py

Python client for managing collections on the NEAR Protocol blockchain.

## Requirements

- Python 3.9+

## Installation

pip install near-collection-py

## Quick Start

from near_collection_py import NearCollectionPyClient

client = NearCollectionPyClient()

Custom RPC endpoint:

client = NearCollectionPyClient(rpc_url="https://rpc.testnet.near.org", timeout=60)

## API Reference

### `NearCollectionPyClient(rpc_url, timeout)`

| Parameter | Default | Description |
|-----------|---------|-------------|
| `rpc_url` | mainnet RPC | NEAR RPC endpoint URL |
| `timeout` | `30` | Request timeout in seconds |

### Methods

| Method | Description |
|--------|-------------|
| `get_account(account_id)` | Fetch account details |
| `get_block(block_id)` | Retrieve block by ID or hash |
| `get_transaction(tx_hash, sender_id)` | Look up a transaction |
| `get_collection(collection_id)` | Get a single collection |
| `list_collections(account_id)` | List all collections for an account |
| `get_collection_items(collection_id)` | Retrieve items in a collection |
| `get_item(collection_id, item_id)` | Fetch a specific item |
| `send_transaction(signed_tx)` | Broadcast a signed transaction |
| `send_transaction_async(signed_tx)` | Broadcast without waiting for result |
| `create_collection(account_id, metadata)` | Create a new collection |

## Example

client = NearCollectionPyClient()

account = client.get_account("alice.near")
collections = client.list_collections("alice.near")
items = client.get_collection_items(collections[0]["id"])

## License

MIT
