https://github.com/slne-development/surf-transaction
A lightweight and efficient transaction system for managing multiple currencies. Supports seamless transfers, real-time balance tracking, and secure transactions.
https://github.com/slne-development/surf-transaction
Last synced: 14 days ago
JSON representation
A lightweight and efficient transaction system for managing multiple currencies. Supports seamless transfers, real-time balance tracking, and secure transactions.
- Host: GitHub
- URL: https://github.com/slne-development/surf-transaction
- Owner: SLNE-Development
- Created: 2025-02-12T20:37:37.000Z (over 1 year ago)
- Default Branch: version/26.1
- Last Pushed: 2026-05-03T21:55:55.000Z (about 2 months ago)
- Last Synced: 2026-05-03T23:33:24.086Z (about 2 months ago)
- Language: Kotlin
- Homepage:
- Size: 683 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# surf-transaction
**surf-transaction** is a modular transaction system for the Surf ecosystem.
It provides a structured API for managing accounts, currencies, and transactions and is designed for
asynchronous use in plugins and modules.
## Features
* Account-based transaction system
* Support for multiple currencies with configurable scaling
* Deposits, withdrawals, and transfers
* User- and account-centric API design
* Extensible transaction metadata
* Clear separation between public API and internal implementation
## Installation
### Gradle (Kotlin DSL)
```kotlin
dependencies {
compileOnly("dev.slne.surf.transaction:surf-transaction-api:")
}
```
## Core Concepts
The API is built around a small set of core abstractions:
* **TransactionUser**
Entry point for user-scoped transactions and account access.
* **Account**
Accounts that hold balances in one or more currencies.
* **Currency**
Defines currencies including symbol, scale, and minimum amount.
* **Transaction**
Immutable representation of a completed transaction.
## Example
```kotlin
val user = TransactionUser.byUuid(userUuid)
user.deposit(
amount = BigDecimal("100"),
currency = Currency.default()
)
val balance = user.balance(Currency.default())
```
All transaction operations return a `TransactionResult`, which can be used to evaluate success or
failure.
## Internal APIs
APIs annotated with `@InternalTransactionApi` are **not part of the public API** and must not be
used.
They may change or be removed at any time without notice.