universalsettle-api 0.1.3

X402-inspired settlement program for any token on Solana
Documentation

universalsettle-api

The High-Velocity Settlement Standard for the Solana Agentic Economy.

universalsettle-api is the official Rust SDK for interacting with the UniversalSettle program on Solana. Designed for the machine-to-machine (M2M) economy, it enables autonomous agents to perform instant, trustless settlement for any SPL token or Native SOL.

Crates.io License


🏗️ Architecture

UniversalSettle implements a Commission-First settlement model. It acts as a stateless payment bridge that ensures:

  1. Facilitator Fees: Automatically routed to the protocol treasury on every transaction.
  2. Deterministic Settlement: Using Program Derived Addresses (PDAs) to manage seller vaults.
  3. Institutional Transparency: On-chain configuration of fee basis points (bps) and destinations.

🚀 Quick Start

1. Add Dependency

Add this to your Cargo.toml:

[dependencies]
universalsettle-api = "0.1.2"
solana-sdk = "2.1"

2. Build a Settlement Instruction

As a seller or facilitator, you can easily build instructions for the blockchain:

use universalsettle_api::sdk;
use solana_sdk::pubkey::Pubkey;

let (vault_pda, _) = universalsettle_api::state::split_vault_pda(&seller_pubkey);

// Build a sweep instruction to settle funds from a vault
let ix = sdk::sweep(
    facilitator_authority,
    vault_pda,
    seller_pubkey,
    fee_destination,
    token_mint,
    amount,
    is_sol,
    Some(vault_ata),
    Some(seller_ata),
    Some(fee_dest_ata),
    None // Use default Token Program
);

🛠️ Key Features

  • SplitVault PDAs: Every seller gets a unique vault that partitions revenue from protocol fees.
  • Support for All Assets: Native SOL and all SPL Token/Token-2022 assets.
  • Developer-First SDK: High-level helper functions for Initialize, UpdateConfig, CreateVault, and Sweep.

📜 Standard Alignment

This crate is the reference implementation for the x402 Protocol v2. It works perfectly with the pr402 Facilitator and the spl-token-balance-serverless reference project.

⚖️ License

Licensed under the Apache License, Version 2.0.