Skip to main content

Fountain SDK - Python

Official Python client for the Fountain stablecoin API.

Features

  • Email-based authentication with JWT tokens
  • Complete API coverage with 18 methods
  • Full type hints for IDE support
  • Automatic token management
  • Comprehensive error handling
  • Admin dashboard endpoints
  • Real-time operation monitoring

Installation

pip install fountain-sdk

Quick Start

from fountain_sdk import FountainSDK

# Initialize client
fountain = FountainSDK('http://localhost:3000')

# Login
login = fountain.login('user@example.com')
print(f"Welcome, {login.company_name}!")

# Create a new stablecoin operation
operation = fountain.create_stablecoin(
    currency_code='APBRL',
    amount_brl=10000.00,
    deposit_type='XRP',
    webhook_url='https://yourapi.com/webhook'
)
print(f"Operation created: {operation.id}")

# Check operation status
status = fountain.get_operation(operation.id)
print(f"Status: {status.status}")

# Mint more tokens
more = fountain.mint_more(
    stablecoin_id=operation.stablecoin_id,
    amount_brl=5000.00,
    deposit_type='XRP'
)

# Burn tokens
burn = fountain.burn_stablecoin(
    stablecoin_id=operation.stablecoin_id,
    amount_tokens=1000.00,
    return_asset='XRP'
)

Authentication

Login with Email

fountain = FountainSDK('http://localhost:3000')

# Login
login_response = fountain.login('admin@company.com')

# Token is automatically set
print(f"Token expires at: {login_response.expires}")
print(f"Is admin: {login_response.is_admin}")

Manual Token Management

# Set token manually
fountain.set_token('your-jwt-token-here')

# Check if authenticated
if fountain.is_authenticated():
    token = fountain.get_token()
    print(f"Current token: {token}")

# Logout
fountain.logout()

API Methods

Authentication

  • login(email) - Login with email
  • set_token(token) - Set JWT token
  • get_token() - Get current token
  • logout() - Clear token
  • is_authenticated() - Check authentication status

Stablecoin Operations

  • create_stablecoin(currency_code, amount_brl, deposit_type, company_wallet, webhook_url)
  • mint_more(stablecoin_id, amount_brl, deposit_type, webhook_url)
  • burn_stablecoin(stablecoin_id, amount_tokens, return_asset)
  • get_stablecoin(stablecoin_id)

Operation Monitoring

  • get_operations(limit, offset) - Get operations for current company
  • get_operation(operation_id) - Get specific operation
  • get_temp_wallet_status(operation_id) - Monitor temp wallet progress

Admin Methods

  • get_admin_statistics() - Get system statistics
  • get_admin_companies(limit, offset) - List all companies
  • get_admin_stablecoins(limit, offset) - List all stablecoins
  • get_admin_stablecoin_by_code(currency_code) - Get stablecoin by code
  • get_admin_temp_wallets(limit, offset) - Monitor all temp wallets
  • get_admin_operations(limit, offset) - View all operations
  • get_admin_company_stablecoins(company_id, limit, offset) - Get company stablecoins
  • get_admin_company_operations(company_id, limit, offset) - Get company operations

Error Handling

from fountain_sdk import (
    FountainSDK,
    AuthenticationError,
    APIError,
    ValidationError,
)

fountain = FountainSDK('http://localhost:3000')

try:
    login = fountain.login('user@example.com')
except ValidationError as e:
    print(f"Invalid input: {e}")
except AuthenticationError as e:
    print(f"Authentication failed: {e}")
except APIError as e:
    print(f"API error: {e}")
    print(f"Status code: {e.status_code}")

Data Models

All responses are typed with dataclasses:

  • LoginResponse - Login response with JWT
  • OperationDetails - Mint/burn operation details
  • TempWalletStatus - Temporary wallet monitoring
  • AdminStatistics - System statistics
  • Company - Company information
  • Stablecoin - Stablecoin details
  • TempWallet - Temporary wallet details
  • DepositHistory - Deposit transaction record

Development

Install dependencies

pip install -r requirements-dev.txt

Run tests

pytest
pytest --cov=fountain_sdk  # With coverage

Format code

black fountain_sdk/

Type checking

mypy fountain_sdk/

License

MIT License - See LICENSE file for details

Support

For issues and questions, visit: https://github.com/xrpl-fountain/fountain-sdk-python/issues

Metadata

Release files for fountain-sdk 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fountain-sdk 1.0.1
File Size Uploaded
fountain_sdk-1.0.1.tar.gz 9.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fountain-sdk 1.0.1
File Interpreter ABI Platform
fountain_sdk-1.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / fountain_sdk-1.0.1.tar.gz

Download URL fountain_sdk-1.0.1.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
b1e8bf23ac0b3ef0eab8be5bbd3884ce22c2a93dbee7f5c5fcb99e3a213940bb
BLAKE2b-256 checksum
How to use checksums
4f523c8ad476c21ed4d4fcd2f96c27789919b5b54802a897bb96265ac8473acf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / fountain_sdk-1.0.1-py3-none-any.whl

Download URL fountain_sdk-1.0.1-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76028c119403afaa8fbb9f2f2db2dc29b80b08d228b98e03ade2a44d84be3d47
BLAKE2b-256 checksum
How to use checksums
ad9c01b991fac91a28f2cbed54e4b94d2ee601b51bc1ec4c7fa1463382ff4604
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page