fly402core


Namefly402core JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryCore implementation of the 402fly payment protocol for autonomous AI agent payments
upload_time2025-11-01 07:15:20
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2025 402fly Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords 402 402fly agents payments solana
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 402fly-core

Core Python implementation of the X402 payment protocol for autonomous AI agent payments.

## Overview

The `402fly-core` package provides the fundamental building blocks for implementing the X402 payment protocol. This package handles payment processing on the Solana blockchain, including transaction creation, verification, and error handling.

## Features

- Payment request and authorization models
- Solana blockchain payment processing
- Comprehensive error handling for payment workflows
- Protocol primitives and data structures
- Transaction verification and validation

## Installation

```bash
pip install 402fly-core
```

## Core Components

### Payment Models

```python
from 402fly_core import PaymentRequest, PaymentAuthorization

# PaymentRequest: Represents a payment requirement
# PaymentAuthorization: Represents completed payment details
```

### Payment Processor

```python
from 402fly_core import SolanaPaymentProcessor
from solders.keypair import Keypair

# Initialize payment processor
keypair = Keypair()  # Your wallet keypair
processor = SolanaPaymentProcessor(
    wallet_keypair=keypair,
    rpc_url="https://api.devnet.solana.com"
)

# Process payments (typically used by higher-level packages)
```

### Error Handling

```python
from 402fly_core import (
    Fly402Error,
    PaymentRequiredError,
    PaymentExpiredError,
    InsufficientFundsError,
    PaymentVerificationError,
    TransactionBroadcastError,
    InvalidPaymentRequestError,
)

try:
    # Payment operations
    pass
except PaymentRequiredError as e:
    print(f"Payment required: {e}")
except InsufficientFundsError as e:
    print(f"Insufficient funds: {e}")
```

## Usage

This package is typically used as a dependency by higher-level packages like:

- **402fly-client**: HTTP client with automatic payment handling
- **402fly-fastapi**: FastAPI middleware for payment-required endpoints
- **402fly-langchain**: LangChain agent integration
- **402fly-langgraph**: LangGraph workflow integration

For most use cases, you'll want to use one of these higher-level packages rather than using `402fly-core` directly.

## Documentation

For complete API reference and guides, see:
- [Documentation](https://402fly.github.io/docs)
- [GitHub Repository](https://github.com/SerPepe/402fly)

## Testing

```bash
pytest tests/
```

## License

MIT License - See [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "fly402core",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "402, 402fly, agents, payments, solana",
    "author": null,
    "author_email": "402fly Contributors <hello@402fly.dev>",
    "download_url": "https://files.pythonhosted.org/packages/14/47/687322a06b853146fb68e700351b4e15ae40ec9a005a00a2aae9523f8069/fly402core-0.1.1.tar.gz",
    "platform": null,
    "description": "# 402fly-core\n\nCore Python implementation of the X402 payment protocol for autonomous AI agent payments.\n\n## Overview\n\nThe `402fly-core` package provides the fundamental building blocks for implementing the X402 payment protocol. This package handles payment processing on the Solana blockchain, including transaction creation, verification, and error handling.\n\n## Features\n\n- Payment request and authorization models\n- Solana blockchain payment processing\n- Comprehensive error handling for payment workflows\n- Protocol primitives and data structures\n- Transaction verification and validation\n\n## Installation\n\n```bash\npip install 402fly-core\n```\n\n## Core Components\n\n### Payment Models\n\n```python\nfrom 402fly_core import PaymentRequest, PaymentAuthorization\n\n# PaymentRequest: Represents a payment requirement\n# PaymentAuthorization: Represents completed payment details\n```\n\n### Payment Processor\n\n```python\nfrom 402fly_core import SolanaPaymentProcessor\nfrom solders.keypair import Keypair\n\n# Initialize payment processor\nkeypair = Keypair()  # Your wallet keypair\nprocessor = SolanaPaymentProcessor(\n    wallet_keypair=keypair,\n    rpc_url=\"https://api.devnet.solana.com\"\n)\n\n# Process payments (typically used by higher-level packages)\n```\n\n### Error Handling\n\n```python\nfrom 402fly_core import (\n    Fly402Error,\n    PaymentRequiredError,\n    PaymentExpiredError,\n    InsufficientFundsError,\n    PaymentVerificationError,\n    TransactionBroadcastError,\n    InvalidPaymentRequestError,\n)\n\ntry:\n    # Payment operations\n    pass\nexcept PaymentRequiredError as e:\n    print(f\"Payment required: {e}\")\nexcept InsufficientFundsError as e:\n    print(f\"Insufficient funds: {e}\")\n```\n\n## Usage\n\nThis package is typically used as a dependency by higher-level packages like:\n\n- **402fly-client**: HTTP client with automatic payment handling\n- **402fly-fastapi**: FastAPI middleware for payment-required endpoints\n- **402fly-langchain**: LangChain agent integration\n- **402fly-langgraph**: LangGraph workflow integration\n\nFor most use cases, you'll want to use one of these higher-level packages rather than using `402fly-core` directly.\n\n## Documentation\n\nFor complete API reference and guides, see:\n- [Documentation](https://402fly.github.io/docs)\n- [GitHub Repository](https://github.com/SerPepe/402fly)\n\n## Testing\n\n```bash\npytest tests/\n```\n\n## License\n\nMIT License - See [LICENSE](LICENSE) file for details.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2025 402fly Contributors\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.",
    "summary": "Core implementation of the 402fly payment protocol for autonomous AI agent payments",
    "version": "0.1.1",
    "project_urls": {
        "Documentation": "https://docs.402fly.dev",
        "Homepage": "https://github.com/SerPepe/402fly",
        "Repository": "https://github.com/SerPepe/402fly"
    },
    "split_keywords": [
        "402",
        " 402fly",
        " agents",
        " payments",
        " solana"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f15959b31b2162b9f1719de354c7e29906b49202dd8344f2b30d44bb127251c9",
                "md5": "c4d0e8e24c8e499a031d31ffda26f146",
                "sha256": "d65a74ef2f592b26dda40d6077e68aba8321624dd5cb421999939ba4cd81ceb2"
            },
            "downloads": -1,
            "filename": "fly402core-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c4d0e8e24c8e499a031d31ffda26f146",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 11725,
            "upload_time": "2025-11-01T07:15:19",
            "upload_time_iso_8601": "2025-11-01T07:15:19.708126Z",
            "url": "https://files.pythonhosted.org/packages/f1/59/59b31b2162b9f1719de354c7e29906b49202dd8344f2b30d44bb127251c9/fly402core-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1447687322a06b853146fb68e700351b4e15ae40ec9a005a00a2aae9523f8069",
                "md5": "da62fd3a8baf174bdfeb21c18a461b30",
                "sha256": "ca85fa1953ad5b371798c50458e294ebec8670e147b3b15a81e38b59d263ec47"
            },
            "downloads": -1,
            "filename": "fly402core-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "da62fd3a8baf174bdfeb21c18a461b30",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9559,
            "upload_time": "2025-11-01T07:15:20",
            "upload_time_iso_8601": "2025-11-01T07:15:20.898962Z",
            "url": "https://files.pythonhosted.org/packages/14/47/687322a06b853146fb68e700351b4e15ae40ec9a005a00a2aae9523f8069/fly402core-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-11-01 07:15:20",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SerPepe",
    "github_project": "402fly",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "fly402core"
}
        
Elapsed time: 2.04617s