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.11.tar.gz (10.0 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.11-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.11.tar.gz
  • Upload date:
  • Size: 10.0 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.11.tar.gz
Algorithm Hash digest
SHA256 babde5d49fa24d2a8ceee6fa3ca0d600050aa627ec326b4ea61079dc4c399ce7
MD5 a6dfa88bbd7608ff7523dbdcaef06fbb
BLAKE2b-256 a072ae295f217e90960b62ec54e23f8dec1786a5029e8f0d3b2aaa3d67469e0c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.11-py3-none-any.whl
Algorithm Hash digest
SHA256 5560e4530324b82d41997c0eaaedb76d68d05e5f892c4430852fa0a19092437d
MD5 efa50ea295fc7be2fb3d50b7f9311114
BLAKE2b-256 b6fea2133ca4ca7a1506febfebafdd71e254bdecaf54455b616b6ee618f54e70

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