wallets 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f59353d157eeea702a8a157b16914cba3f9fbb6dcaa8845a3ffdbd911fc51777
4
+ data.tar.gz: e1c1d836b7a8013ad6a84da9aa0ba4924361b0d023797a265d15b8bde262d998
5
+ SHA512:
6
+ metadata.gz: a1a2714ddd409c47b62efad44eafadce0381ce8843ab71bdbbab4c57f2858d03fdb62980e10be00854009f47405805c54cfada0e3f2837b82334128b19b4bd9a
7
+ data.tar.gz: 21f39ed24795f1b78090c5f1b10e1009e0f42edaa48384c86f3812bf6ea9591ded673a0408df070d0909284bdaefb176ce42376677c70f5abc873e8614877d99
data/.gitignore ADDED
@@ -0,0 +1,36 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ test/dummy/db/*.sqlite3*
11
+ test/dummy/log/*.log
12
+ test/dummy/tmp/
13
+ test/dummy/public/packs/
14
+ test/dummy/public/packs-test/
15
+ test/dummy/node_modules/
16
+ test/dummy/Gemfile.lock
17
+ test/dummy/config/master.key
18
+ test/dummy/storage/*.sqlite3*
19
+ test/dummy/log/*
20
+ test/coverage/*
21
+ **/.kamal/
22
+ deploy.yml
23
+ .DS_Store
24
+
25
+ /Gemfile.lock
26
+ /gemfiles/*.gemfile.lock
27
+
28
+ /dist/
29
+ *.gem
30
+
31
+ .cursor/
32
+ .claude/
33
+ .aux/
34
+
35
+ TODO
36
+ pay.md
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.1
3
+
4
+ Style/StringLiterals:
5
+ EnforcedStyle: double_quotes
6
+
7
+ Style/StringLiteralsInInterpolation:
8
+ EnforcedStyle: double_quotes
data/.simplecov ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # SimpleCov configuration file (auto-loaded before test suite)
4
+ # This keeps test_helper.rb clean and follows best practices
5
+
6
+ SimpleCov.start do
7
+ # Use SimpleFormatter for terminal-only output (no HTML generation)
8
+ formatter SimpleCov::Formatter::SimpleFormatter
9
+
10
+ # Track coverage for the lib directory (gem source code)
11
+ add_filter "/test/"
12
+ add_filter "/lib/generators/"
13
+
14
+ # Track Ruby files in lib directory
15
+ track_files "lib/**/*.rb"
16
+
17
+ # Enable branch coverage for more detailed metrics
18
+ enable_coverage :branch
19
+
20
+ # Keep the gate focused on the runtime wallet core, not install scaffolding.
21
+ minimum_coverage line: 80, branch: 50
22
+
23
+ # Disambiguate parallel test runs
24
+ command_name "Job #{ENV['TEST_ENV_NUMBER']}" if ENV['TEST_ENV_NUMBER']
25
+ end
26
+
27
+ # Print coverage summary to terminal after tests complete
28
+ SimpleCov.at_exit do
29
+ SimpleCov.result.format!
30
+ puts "\n" + "=" * 60
31
+ puts "COVERAGE SUMMARY"
32
+ puts "=" * 60
33
+ puts "Line Coverage: #{SimpleCov.result.covered_percent.round(2)}%"
34
+ branch_coverage = SimpleCov.result.coverage_statistics[:branch]&.percent&.round(2) || "N/A"
35
+ puts "Branch Coverage: #{branch_coverage}%"
36
+ puts "=" * 60
37
+ end
data/AGENTS.md ADDED
@@ -0,0 +1,5 @@
1
+ # AGENTS.md
2
+
3
+ This file provides guidance to AI Agents (like OpenAI's Codex, Cursor Agent, Claude Code, etc) when working with code in this repository.
4
+
5
+ Please go ahead and read the full context for this project at `.cursor/rules/0-overview.mdc` and `.cursor/rules/1-quality.mdc` now. Also read the README for a good overview of the project.
data/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ ## [0.1.0] - 2026-03-18
2
+
3
+ Initial release.
4
+
5
+ - Multi-asset wallets per owner via `has_wallets` — `user.wallet(:usd)`, `user.wallet(:gems)`, etc.
6
+ - Append-only transaction ledger with `credit`, `debit`, and `transfer_to` APIs
7
+ - FIFO allocation for expiring balances — oldest credits consumed first
8
+ - Transfer expiration policies: `:preserve` (default), `:none`, `:fixed`
9
+ - Transfers split into multiple inbound legs when consuming buckets with different expirations
10
+ - Embeddability hooks for other gems to reuse the ledger core with custom tables/config/callbacks
11
+ - Idempotent `create_for_owner!` with race condition handling
12
+ - Row-level locking to prevent double-spending
13
+ - Balance snapshots on every transaction for reconciliation
14
+ - Rich metadata support on wallets, transactions, and transfers
15
+ - Lifecycle callbacks: `on_balance_credited`, `on_balance_debited`, `on_transfer_completed`, etc.
16
+ - Install generator with migrations and initializer
17
+ - Rails 6.1+ support (tested through Rails 8.x)
data/CLAUDE.md ADDED
@@ -0,0 +1,5 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ Please go ahead and read the full context for this project at `.cursor/rules/0-overview.mdc` and `.cursor/rules/1-quality.mdc` now. Also read the README for a good overview of the project.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Javi R
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.