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.19.tar.gz (13.5 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.19-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.19.tar.gz
  • Upload date:
  • Size: 13.5 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.19.tar.gz
Algorithm Hash digest
SHA256 20bff499bb878d1012b9833468d9263ee006d911d2bb749ab7685aac430068d8
MD5 106daa63191dec3bee32502c6a9e31a3
BLAKE2b-256 6d20b88bb2d5d7f86d37bcec1444f66a591aa972b292d21f47e6f5a56eee9ef2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 9.9 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.19-py3-none-any.whl
Algorithm Hash digest
SHA256 46e6897e6a3701c535fb5e813579342374316960f987c0b59384745f772661bf
MD5 4e6ca8862d5dcb47c038f4b80cab2cce
BLAKE2b-256 03e58a1721e7a551a0148b97daced99005644051af3897d5de62220dd1bc67a3

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