Skip to main content

A package for easily interacting with remote crews via the Masumi protocol.

This project has been archived.

The maintainers of this project have marked this project as archived. No new releases are expected.

Project description

Masumi Crewai Python Package

This package provides an interface for handling payments via the Masumi Node using asynchronous API requests. It simplifies the process of creating payment requests, checking payment statuses, and completing payments on the Cardano blockchain.

Features

  • Asynchronous Payment Handling: Supports creating, checking, and completing payments.
  • Configurable Network Selection: Works on different Cardano networks (default: PREPROD).
  • Automated Payment Monitoring: Built-in function for tracking payment status.
  • Secure API Authentication: Uses API keys for authorization.

Installation

To install the package, use:

pip install masumi-crewai

Or install from source:

git clone https://github.com/masumi-network/pip-masumi-crewai.git
cd pip-masumi-crewai
pip install .

Usage

1. Importing and Configuring the Payment Client

from masumi_crewai import Payment, Amount
from masumi_crewai.config import Config
import asyncio

# Initialize configuration
config = Config(payment_api_key="your_api_key", payment_service_url="https://api.masumi.network")

# Define the payment amount
amounts = [Amount(amount=1000000, unit="lovelace")]

# Create a Payment instance
payment = Payment(agent_identifier="agent_123", amounts=amounts, config=config)

2. Creating a Payment Request

async def create_payment():
    submit_time = "2025-02-05T12:00:00Z"  # Example timestamp
    response = await payment.create_payment_request(submit_result_time=submit_time)
    print(response)

asyncio.run(create_payment())

3. Checking Payment Status

async def check_status():
    status = await payment.check_payment_status()
    print(status)

asyncio.run(check_status())

4. Completing the Payment

async def complete():
    tx_hash = "your_transaction_hash_here"
    result = await payment.complete_payment(hash=tx_hash)
    print(result)

asyncio.run(complete())

5. Monitoring Payment Status

async def monitor_status():
    async def callback(status):
        print("Payment status update:", status)

    await payment.start_status_monitoring(callback)

asyncio.run(monitor_status())

To stop monitoring:

payment.stop_status_monitoring()

Configuration

The package requires an API key and service URL for the Masumi Payment Service. These should be stored in a Config object:

from masumi_crewai.config import Config

config = Config(
    payment_api_key="your_api_key_here",
    payment_service_url="https://api.masumi.network"
)

Requirements

  • Python 3.7+
  • aiohttp for async HTTP requests

Current Smart Contract Addresses

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Make your changes.
  3. Submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or issues, please open an issue on the GitHub repository.

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

masumi_crewai-0.1.18.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

masumi_crewai-0.1.18-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file masumi_crewai-0.1.18.tar.gz.

File metadata

  • Download URL: masumi_crewai-0.1.18.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for masumi_crewai-0.1.18.tar.gz
Algorithm Hash digest
SHA256 ea2527acf2d14b0a88bd85369b9f4e9a062078fadce5272b476809f10555b60e
MD5 04a834b4ffd59c2ca42da3e332fa0eb5
BLAKE2b-256 831f438b4931e5373b1ec6edb79fcd3d0601c4a9afa346bf140625a515315522

See more details on using hashes here.

File details

Details for the file masumi_crewai-0.1.18-py3-none-any.whl.

File metadata

  • Download URL: masumi_crewai-0.1.18-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for masumi_crewai-0.1.18-py3-none-any.whl
Algorithm Hash digest
SHA256 18568d8bbbc82dec3e62111fee2873ecdf6f5000ccc2d91e330180d17cadd9b3
MD5 82a7c64a7f1a9b40359db98b5674c4a8
BLAKE2b-256 9038abb904bfbba65fe6b153d50f29e9ce4d2c4aefffe09fde870dbde11bf7fb

See more details on using hashes here.

Supported by

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