Skip to main content

A Python SDK for the Vyper API

Project description

Vyper API Python SDK

Vyper

A Python SDK for interacting with the Vyper API. This library allows developers to integrate Vyper's http and websocket api into their Python applications with ease.

Table of Contents

Installation

To install the Vyper API Python SDK, use pip:

pip install vyper-client-py

Quick Start

Here's a simple example to get you started:

from vyper_client import VyperClient

# Initialize the client with your API key
client = VyperClient(api_key="your_api_key_here")

# Get the list of chain IDs supported by Vyper
chain_ids = client.get_chain_ids()
print("Supported chain IDs:", chain_ids)

Usage

Client Initialization

The VyperClient class provides access to the RESTful API endpoints:

from vyper_client import VyperClient

# Create a client instance
client = VyperClient(api_key="your_api_key_here")

REST API Example

Retrieve the market data for a specific token:

# Fetch the All-Time High (ATH) data for a token
token_ath = client.get_token_ath(chain_id=1, market_id="AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA")

print(f"Market Cap USD: {token_ath.market_cap_usd}")
print(f"Timestamp: {token_ath.timestamp}")

WebSocket API Example

import asyncio
from vyper_client import VyperWebsocketClient, FeedType, SubscriptionType

async def main():
    # Create a websocket client instance
    ws_client = VyperWebsocketClient(api_key="your_api_key_here")

    # Define a message handler
    async def message_handler(message):
        print("Received message:", message)

    ws_client.set_message_handler(message_handler)

    # Connect to the WebSocket and subscribe to token events
    await ws_client.connect(FeedType.TOKEN_EVENTS)
    await ws_client.subscribe(
        FeedType.TOKEN_EVENTS,
        subscription_message={
            "action": "subscribe",
            "types": [SubscriptionType.PUMPFUN_TOKENS.value]
        }
    )

    # Listen for incoming messages
    await ws_client.listen()

# Run the asyncio event loop
asyncio.run(main())

API Documentation

For detailed information on the Vyper API, refer to the official documentation:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vyper_client_py-0.1.3.tar.gz (14.8 kB view details)

Uploaded Source

Built Distribution

vyper_client_py-0.1.3-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file vyper_client_py-0.1.3.tar.gz.

File metadata

  • Download URL: vyper_client_py-0.1.3.tar.gz
  • Upload date:
  • Size: 14.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.1

File hashes

Hashes for vyper_client_py-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d3d7294380a403ceb49ea85a489a105987fa038bac598275ffb1e28f935a5ae7
MD5 712b492bcd9787130850a041aac3b730
BLAKE2b-256 962e38145d9c30cf59d68cc0be92b18d565c72dda33ac3a7c20cd34b733516e5

See more details on using hashes here.

File details

Details for the file vyper_client_py-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for vyper_client_py-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9d27617e92dfef8aed3343f83f247b71662dd2739c2286d50feaa542f460da0f
MD5 701f34bfb74b935378c6600918905850
BLAKE2b-256 2399cdad5c13d385cc77559e419ddbe536e7300c8755068e6d85dba04e021442

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page