SetNet.Wallet
1.2.0
dotnet add package SetNet.Wallet --version 1.2.0
NuGet\Install-Package SetNet.Wallet -Version 1.2.0
<PackageReference Include="SetNet.Wallet" Version="1.2.0" />
<PackageVersion Include="SetNet.Wallet" Version="1.2.0" />
<PackageReference Include="SetNet.Wallet" />
paket add SetNet.Wallet --version 1.2.0
#r "nuget: SetNet.Wallet, 1.2.0"
#:package SetNet.Wallet@1.2.0
#addin nuget:?package=SetNet.Wallet&version=1.2.0
#tool nuget:?package=SetNet.Wallet&version=1.2.0
<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>
SetNet.Wallet
Server-authoritative player currencies for SetNet.
The server owns every coin. Game logic deposits, withdraws, and transfers named currencies by player key with atomic anti-overdraft guarantees; clients read their balances and subscribe to changes but never mutate them. It's the money side of the economy — SetNet.Vendor and SetNet.Auction move currency through this same hub. Added by composition — no base class.
Install
dotnet add package SetNet
dotnet add package SetNet.Wallet
Usage
Call WalletRuntime.Enable() once at startup on both ends.
// server
WalletRuntime.Enable();
var wallet = server.UseWallet();
await wallet.DepositAsync(playerKey, "gold", 500);
bool paid = await wallet.TryWithdrawAsync(playerKey, "gold", 100); // false if broke
bool sent = await wallet.TryTransferAsync(fromKey, toKey, "gold", 50); // atomic
// client
WalletRuntime.Enable();
var wallet = client.UseWallet();
wallet.Changed += balances => Redraw(balances);
foreach (var b in await wallet.GetAsync()) Console.WriteLine($"{b.Amount} {b.Currency}");
API
Server: server.UseWallet(IWalletStore?, WalletOptions?) → WalletServer — DepositAsync, TryWithdrawAsync, TryTransferAsync, GetAsync, KeyOf(peer), PushAsync.
Client: client.UseWallet() → WalletClient — GetAsync(), event Changed.
Store: IWalletStore (MemoryWalletStore default). Options: WalletOptions.PlayerKey.
WalletRuntime.Enable() — one-time bootstrap.
Notes
- Rides the unified SetNet.Protocol messaging layer on the
Channels.Walletchannel (all modules share one envelope wire type,65447) — no per-module wire ids to reserve. Serializer-agnostic: the control protocol is hand-framedbyte[], your payloads use yourSetNetSerializer. - Atomic by contract.
TryWithdrawAsync/TryTransferAsyncnever overdraw and never dupe. Back the store with a transactional store (Redis/SQL) for a multi-node cluster. - Stable player key. Default is the connection id; with
SetNet.AuthsetWalletOptions.PlayerKeyto the account id so wallets persist. - Mirrors
SetNet.Inventory: items there, money here.
Documentation & source
- 🐙 https://github.com/Povstalez/SetNet — full catalog in docs/MODULES.md
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 is compatible. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- SetNet (>= 1.2.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on SetNet.Wallet:
| Package | Downloads |
|---|---|
|
SetNet.Marketplace
Continuous double-sided order-book marketplace for SetNet: post limit buy/sell orders (items/currency escrowed), crossing orders match instantly at the resting price with price-time priority and the rest rests on the book. Settled through SetNet.Inventory + SetNet.Wallet (no dupes; buyer refunded price improvement). server.UseMarketplace(inventory, wallet) + client.UseMarketplace(). Depends on SetNet + SetNet.Inventory + SetNet.Wallet. |
|
|
SetNet.Vendor
NPC shops for SetNet: define vendor catalogs (buy/sell prices, currency, stock); clients buy and sell and the server settles atomically through SetNet.Wallet + SetNet.Inventory (money before goods, stock reserved before charge). server.UseVendor(inventory, wallet).Define(...) + client.UseVendor(). Depends on SetNet + SetNet.Inventory + SetNet.Wallet. |
|
|
SetNet.Auction
Auction house for SetNet: list items (escrowed from inventory), bid or buy out (currency escrowed, prior bidder refunded), and a background timer settles expired listings — winner gets the item, seller gets the bid, or the item is returned. All moves go through SetNet.Inventory + SetNet.Wallet (no dupes). server.UseAuction(inventory, wallet) + client.UseAuction(). Depends on SetNet + SetNet.Inventory + SetNet.Wallet. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.2.0 | 177 | 8/5/2026 |