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

Uploaded Python 3

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.14.tar.gz
  • Upload date:
  • Size: 10.3 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.14.tar.gz
Algorithm Hash digest
SHA256 6c2e41f7697ed9450102dd1536b67a4f0f740ac291c83053b7f0b446836b7223
MD5 42472cb597155efde01ef2d3dbc544ae
BLAKE2b-256 4d80722e3b078ab53f6e24a63549c4dac3953a67a906c0f1c33414b8ceffb2a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: masumi_crewai-0.1.14-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.14-py3-none-any.whl
Algorithm Hash digest
SHA256 96b1a8800319f577db2ce0fa535e576e147903cfe7069415068fe3a4e37df313
MD5 c007a58800e399c07f17b11cb11e618d
BLAKE2b-256 f898df7fbf399c5a08140dc794038493f2a31eac200c9130490abf5518d63cd1

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