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.
🏗️ Architecture
UniversalSettle implements a Commission-First settlement model with two-tier fee structure:
- SplitVault PDAs: Every seller gets a unique vault (derived from their wallet address) that partitions revenue from protocol fees.
- Dual-Floor Minimum Fees: Independent minimum fee floors for SPL tokens (6-decimal standard) and Native SOL (9-decimal standard), preventing economic value drift across assets.
- Sovereign Path: Sellers who self-provision their vault pay a discounted fee rate (
discounted_fee_bps). Facilitator-provisioned vaults pay the standard rate (fee_bps) until provisioning costs are recovered. - Provisioning Recovery: When a facilitator creates a vault on behalf of a seller, the protocol automatically diverts a portion of initial sweep payouts to the fee destination until the one-time provisioning cost is recovered.
🚀 Quick Start
1. Add Dependency
[]
= "0.1.7"
= "^2.1"
2. Create a Vault
use sdk;
// Create a vault for a seller (payer covers rent)
let ix = create_vault;
3. Sweep Funds
use sdk;
let = split_vault_pda;
// SOL sweep — settle all available SOL from the vault.
// `fee_destination` must be the *writable lamport recipient* the program expects:
// typically `config.fee_destination` when sharding is off, or the shard SOL storage
// PDA when fee sharding is on (see `fee_shard_sol_storage_pda`).
let ix = sweep;
// SPL sweep — settle USDC from the vault.
// `fee_dest_tokens` is the ATA that receives the fee portion (treasury-owned ATA, or
// shard-owned fee ATA when sharding is enabled). The `fee_destination` argument is
// ignored when `is_sol == false` (the SPL account list uses only the ATAs below).
let ix = sweep;
🛠️ Key Features
- SplitVault PDAs: Deterministic per-seller vaults with independent SOL storage accounts.
- Dual-Floor Architecture: Independent minimum fee floors for SPL (
min_fee_amount) and Native SOL (min_fee_amount_sol). - Sovereign Fee Tier: Self-provisioned sellers automatically receive the discounted fee rate.
- Provisioning Recovery: Facilitator-fronted vault creation costs are transparently recovered from initial sweeps.
- All Asset Support: Native SOL, legacy SPL Token mints, and plain Token-2022 mints.
- Token-2022 mints with extra mint extensions are rejected until their transfer semantics are modeled explicitly.
- Recommendation: We strongly recommend using USDC or USDT (stablecoins) for SPL transactions. While custom tokens are supported, the
min_fee_amountfloor is economically optimized for 6-decimal stable assets.
- Fee sharding (optional):
init_shard,collect_from_shard,update_shard_config, plusConfig.use_fee_shard/shard_countininitialize. - Comprehensive SDK: Helpers for all instructions — including shard ops above and
create_vault,sweep,initialize, authority two-step (update_authority,accept_authority,cancel_authority_proposal), fee tuning, and provisioning fee updates.
📋 Instructions
| Instruction | Access | Description |
|---|---|---|
Sweep (0) |
Public | Settle funds from a vault — splits payout and fee |
CreateVault (1) |
Public | Create a SplitVault PDA for a seller |
Initialize (100) |
Admin | One-time program initialization |
UpdateAuthority (101) |
Admin | Propose config authority transfer (two-step) |
UpdateFeeRate (102) |
Admin | Update standard fee basis points |
UpdateFeeDestination (103) |
Admin | Update fee destination wallet |
UpdateMinFeeAmount (104) |
Admin | Update SPL minimum fee floor |
UpdateMinFeeAmountSol (105) |
Admin | Update SOL minimum fee floor |
UpdateProvisioningFee (106) |
Admin | Update provisioning recovery targets |
UpdateDiscountedFeeRate (107) |
Admin | Update sovereign fee basis points |
AcceptAuthority (108) |
Admin | Proposed new authority accepts a pending transfer |
CancelAuthorityProposal (109) |
Admin | Current authority cancels a pending transfer |
InitShard (110) |
Admin | Create fee-shard PDA + shard SOL storage for an index |
CollectFromShard (111) |
Admin | Move shard fees (SOL or SPL) to treasury |
UpdateShardConfig (112) |
Admin | Enable/disable sharding; set shard count |
📜 Standard Alignment
This crate is the reference implementation for the x402 Protocol. It works with the pr402 Facilitator and the spl-token-balance-serverless reference project.
⚖️ License
Licensed under the Apache License, Version 2.0.