near-fastapi
Production-ready FastAPI service for NEAR Protocol.
This package exposes a clean REST API for common NEAR operations:
- Network status (mainnet/testnet)
- Account details and access keys
- Contract code hash
- Contract view function calls with JSON decoding
Install
pip install near-fastapi
Run
near-fastapi --host 0.0.0.0 --port 8080
Open docs:
- Swagger UI:
http://localhost:8080/docs - ReDoc:
http://localhost:8080/redoc
API Endpoints
GET /healthGET /v1/networksGET /v1/status?network=mainnetGET /v1/accounts/{account_id}?network=mainnetGET /v1/accounts/{account_id}/keys?network=mainnetGET /v1/contracts/{account_id}/code-hash?network=mainnetPOST /v1/contracts/{account_id}/view
Contract View Example
curl -X POST http://localhost:8080/v1/contracts/social.near/view \
-H 'Content-Type: application/json' \
-d '{
"method": "get",
"args": {"keys": ["near.social/root"]},
"network": "mainnet"
}'
Python Integration Example
from fastapi import FastAPI
from near_fastapi.app import create_app
app: FastAPI = create_app()
NEAR Integration Notes
- Uses official NEAR RPC endpoints:
https://rpc.mainnet.near.orghttps://rpc.testnet.near.org
- Returns RPC errors as clear HTTP errors.
- Validates account IDs to reduce bad requests early.
Development
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest -q
License
MIT
Metadata
Release files for near-fastapi 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| near_fastapi-0.1.0.tar.gz | 6.0 kB | Without provenance | Details for near_fastapi-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| near_fastapi-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for near_fastapi-0.1.0-py3-none-any.whl |
Total release size: 13.3 kB
Release files / near_fastapi-0.1.0.tar.gz
| Download URL | near_fastapi-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ff036bf81ca57f23b09457adc8b444fdc718f8dcfb801596bee3bb201de1c15a
|
|
BLAKE2b-256 checksum How to use checksums |
82ae24e0b2344fa2599cad5855729fe1719b07aeef47d0288d5e4bfe3e20999e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / near_fastapi-0.1.0-py3-none-any.whl
| Download URL | near_fastapi-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cb8ef1a61a5f7e3196c13788b701c3523b0781d94601f0d6b5b45e3eccb53944
|
|
BLAKE2b-256 checksum How to use checksums |
2461d8202b48bbf6cce6fe74f0c1a31d5308c798e03fbbaf4f86cc68d91f80c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Security for near-fastapi 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.