Skip to main content

Shared XRPL x402 wire models and helpers

Project description

xrpl-x402-core

Shared XRPL/x402 wire models, codecs, validation helpers, and exact-payment utilities for the Open XRPL x402 Stack.

Install

pip install xrpl-x402-core

Quick Start

from xrpl_x402_core import (
    PaymentRequired,
    XRPLAmount,
    XRPLAsset,
    XRPLPaymentOption,
    decode_model_from_base64,
    encode_model_to_base64,
)

challenge = PaymentRequired(
    error="Payment required",
    accepts=[
        XRPLPaymentOption(
            network="xrpl:1",
            payTo="rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe",
            maxAmountRequired="1000",
            asset=XRPLAsset(code="XRP"),
            amount=XRPLAmount(value="1000", unit="drops", drops=1000),
        )
    ],
)

header_value = encode_model_to_base64(challenge)
parsed = decode_model_from_base64(header_value, PaymentRequired)
assert parsed.accepts[0].network == "xrpl:1"

Public API

  • Shared x402 wire models: PaymentRequired, PaymentPayload, PaymentResponse
  • XRPL payment models: XRPLAsset, XRPLAmount, XRPLPaymentOption, XRPLPaymentPayload
  • Facilitator contract models: PaymentRequest, FacilitatorSupportedResponse, FacilitatorVerifyResponse, FacilitatorSettleResponse
  • Header and matching helpers: encode_model_to_base64, decode_model_from_base64, payment_option_matches, canonical_asset_identifier
  • Asset helpers and constants: parse_asset_identifier, supported_asset_keys, XRP_CODE, RLUSD_*, USDC_*

Compatibility

  • Python 3.12
  • Wire-level validation accepts CAIP-2 xrpl:* network identifiers
  • Built-in asset helpers and examples cover xrpl:0 and xrpl:1
  • No x402 dependency is required for this package

Provenance

The implementation is independently developed for the open x402 protocol and does not copy x402-xrpl.

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

xrpl_x402_core-0.1.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xrpl_x402_core-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file xrpl_x402_core-0.1.1.tar.gz.

File metadata

  • Download URL: xrpl_x402_core-0.1.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xrpl_x402_core-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c334ad3029abe3298c083ba95e0ba5cec240a2efee08ecd6775191b4631a764d
MD5 b65ed6fbb413b8bdc6c872e615387115
BLAKE2b-256 0ffb025463828cfa7525ca66001273b219fc24b926fe3f47bee75b5da19f4c4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for xrpl_x402_core-0.1.1.tar.gz:

Publisher: publish-package.yml on lgcarrier/xrpl-x402-stack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file xrpl_x402_core-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: xrpl_x402_core-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for xrpl_x402_core-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 aa9d4483618ec15dc9654782cf57dcf237aeda69a239f928e2d4963943ba3405
MD5 9797d2bd7c672639f47cde343527e821
BLAKE2b-256 e23c1451dbc0cb15978dfd26ce869bbc010ddb75e4a6cc779f68bf95359efcdf

See more details on using hashes here.

Provenance

The following attestation bundles were made for xrpl_x402_core-0.1.1-py3-none-any.whl:

Publisher: publish-package.yml on lgcarrier/xrpl-x402-stack

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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