Skip to main content

near-langchain-event-listener

LangChain tools for monitoring NEAR blockchain events with account subscriptions, event-type filtering, parsed event payloads, callback triggering, and reliable RPC reconnection.

Features

  • Subscribe to account-level events
  • Filter by event type (transfer, function_call, event_json, receipt_log)
  • Advanced EVENT_JSON filtering (event_json:ft_transfer, event_json:nep141:ft_transfer)
  • Parse event data from transactions and EVENT_JSON logs
  • Trigger HTTP callbacks for matched events
  • Retry and endpoint failover for resilient RPC access

Installation

pip install near-langchain-event-listener

Quick Start (LangChain)

import json
from near_langchain_event_listener import get_near_event_listener_tools

tools = {tool.name: tool for tool in get_near_event_listener_tools()}

sub = json.loads(tools["near_event_subscribe_account"].invoke({
    "account_id": "example.near",
    "event_types": ["transfer", "function_call"],
    "callback_url": "https://example.com/callback"
}))

print(sub["subscription_id"])

poll = json.loads(tools["near_event_poll"].invoke({
    "network": "mainnet",
    "max_blocks": 10,
    "max_events": 100
}))

print(poll["matched_events"])

Tool Names

  • near_event_subscribe_account
  • near_event_unsubscribe
  • near_event_list_subscriptions
  • near_event_listener_status
  • near_event_poll

API Notes

  • Subscriptions are in-memory state by default.
  • First poll starts at current head block to avoid large historical backfill.
  • Callback delivery uses HTTP POST and retries on failure.
  • RPC reconnection uses multiple endpoints and retry backoff.
  • Callback URLs are validated (http:// or https://).

Development

python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest -q

License

MIT

Metadata

Release files for near-langchain-event-listener 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for near-langchain-event-listener 0.1.1
File Size Uploaded
near_langchain_event_listener-0.1.1.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for near-langchain-event-listener 0.1.1
File Interpreter ABI Platform
near_langchain_event_listener-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 18.6 kB

Release files / near_langchain_event_listener-0.1.1.tar.gz

Download URL near_langchain_event_listener-0.1.1.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
226253fccde0e723b7a68b2ea58ec186540795ca7f73f02aea36b9caad2232c7
BLAKE2b-256 checksum
How to use checksums
884a970920593ca05568cfefe091fe28a6dd366f1c9aee83f4f89ca17a711d3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / near_langchain_event_listener-0.1.1-py3-none-any.whl

Download URL near_langchain_event_listener-0.1.1-py3-none-any.whl
Size 10.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
719b8b94fbea2618c1cbf48570b007d73612bb302486548a4b9789032a9c8b86
BLAKE2b-256 checksum
How to use checksums
df6031994fe675e69f9e3b6583a2b117b86a7d04dfaa2864f2502436960dcd40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page