Skip to content

Add the bank plugin base, card records and spending limits - #24

Merged
IAmJSD merged 2 commits into
mainfrom
bank/1-core
Oct 21, 2026
Merged

IAmJSD merged 2 commits into
mainfrom
bank/1-core

Conversation

@IAmJSD

@IAmJSD IAmJSD commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Part 1 of 7 in the bank stack: virtual cards and crypto wallets for nibblets.

What this adds

  • @nibblet/bank: the BankPlugin contract every bank fulfils (issue, find, reveal, inspect, close, balance), a loader that turns plugins on from the server's environment, and the logic plugins share:
    • budget maths in minor units
    • wallet keys derived from a treasury secret and the card's id, so none is ever stored
    • BankError for messages that are safe to show
  • Protocol:
    • cards, which move through pending → open → closing → closed
    • the card file a nibblet reads its details from
    • per-asset spendingLimits on each nibblet, which only the person sets; none means no cards
  • Database: a cards table and nibblets.spending_limits (migration 0010_bank).

Stack

  1. This PR: plugin base, protocol, database
  2. card_request / card_list / card_kill tools, and the runner writing card files
  3. Slash as the card bank
  4. Bitcoin and Ethereum banks
  5. UI
  6. Setting banks up from Settings, with forms their plugins describe (Set banks up from Settings, with forms their plugins describe #31)
  7. Several banks on one plugin: two Slash accounts, say (Let several banks share a plugin: two Slash accounts, say #32)

Screenshots

From #28's UI, in the mock server (?mock=1): the per-currency limits this adds, which only the person sets.

Spending limits: 150.00 USD a month, 0.002 BTC in total, with what's left of each

Review fixes

  • An open card now counts against a limit in full whenever it was made, so cards left open from an earlier day or week can't pile up past a per-period limit. A closed card still counts what was spent on it in the period it was made in.

Checks

pnpm format:check, pnpm -r typecheck and pnpm test pass on this branch on its own.


Generated by Claude Code

@IAmJSD
IAmJSD added this pull request to stack #29 October 19, 2026 15:34
@IAmJSD
IAmJSD force-pushed the bank/1-core branch 2 times, most recently from 1b562ef to c9f8eca Compare October 19, 2026 21:28
claude and others added 2 commits October 21, 2026 11:11
The groundwork for giving nibblets money to spend. `@nibblet/bank` is the
contract every bank plugin (a card issuer, a crypto treasury) fulfils, with
a loader and the logic they share: budgets, and wallet keys derived from a
treasury secret so none is ever stored. The protocol gains cards, card
files and per-asset spending limits; the database gains a `cards` table and
`nibblets.spending_limits`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KGXXQcj3hZN2jiB6As6kk5
An open card could still all be spent, so it now counts in full whenever
it was made. Before, a daily limit only counted today's cards, so cards
left open from earlier days could pile up past it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@IAmJSD
IAmJSD merged commit 3e20e5b into main Oct 21, 2026
4 checks passed
@IAmJSD
IAmJSD deleted the bank/1-core branch October 21, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants