➕
Bump a Number
vault.addThe VaultVaultChanges one number on one row — coins, XP, lives, streaks — in a single step nobody can sneak between. Set "Never go below" and it simply refuses to go under it: perfect for spending, since two clicks at once can't double-spend. If the row doesn't exist yet it's created for you, starting from the column's default.
When to use this
- →"Never go below 0" makes spending safe — no negative wallets, even with two clicks at once
- →{{total}} is the new number on Done, or the current one on Not enough
- →Bumping a row that doesn't exist yet creates it — turn on "Only change rows that already exist" to stop that
- →Two Bumps inside an 🔐 All-or-Nothing box make a /pay that can never lose coins halfway
On the canvas
This is what Bump a Number looks like when you place it on your flow. Each field below is something you configure in the inspector panel.
➕Vault
Bump a Number
vault.addtablerequired
Pick a table…
keyrequired
{{input.user.id}}
columnrequired
e.g. coins
change
select…
amount
1
floor
Leave empty for no limit
onlyExisting
boolean…
asrequired
total
output
not_enough
Config fields
| Field | Type | Req | What it does |
|---|---|---|---|
tablePick a table… | text | yes | Table 🗄️ |
key{{input.user.id}} | text | yes | Whose row 🔑 |
columne.g. coins | text | yes | Which number 🔢 |
change | select | — | Add or take away |
amount1 | text | — | How much |
floorLeave empty for no limit | text | — | Never go below 🧱 |
onlyExisting | boolean | — | Only change rows that already exist |
astotal | text | yes | Save the new total as ✨ |
Output ports
outputThe number changed — the new total is your spark
not_enoughIt would have gone below your limit, so nothing changed
📐
In TypeScript, this would be…
Not something you need to write — just a look at what Kitcord does for you.
TypeScript
// One atomic statement — never below 0, so spending can't double-spend
const row = await db.get(
`UPDATE wallets SET coins = coins - ? WHERE user_id = ? AND coins - ? >= 0
RETURNING coins`,
[50, userId, 50],
);
if (row) {
const total = row.coins; // {{total}} — Done ✓
} else {
// Not enough ✋ — nothing changed
}Related pieces
More Vault pieces