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.12.tar.gz (10.2 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.12-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.12.tar.gz
  • Upload date:
  • Size: 10.2 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.12.tar.gz
Algorithm Hash digest
SHA256 0070c3eefbab681f20651738d355776a2db2c14b69c3e62e2b8ab3e49dba3f0f
MD5 5c95e72cca823b161bbeed3d78dfb46f
BLAKE2b-256 27fef746a782ecd59822f947cd163e18acfaddc36b55f9020ea6a98445c261fb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 9.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.12-py3-none-any.whl
Algorithm Hash digest
SHA256 152dea7fe1ca02f51dccb69c7a9ba7c0c3d0ba5af6c9000f0a5da088aa1c5be7
MD5 09251d65c70bf37347171599dd23ae2d
BLAKE2b-256 db3e6fcb0aa7f9dec6ff6f805f555ef14e44fc630283482f37a8325497ee32a3

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