K
Docs
API Reference→Pieces→Bump a Number
➕

Bump a Number

vault.addThe VaultVault

Changes 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.

➕
Bump a Number
vault.add
Vault
tablerequired
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

FieldTypeReqWhat it does
table
Pick a table…
textyesTable 🗄️
key
{{input.user.id}}
textyesWhose row 🔑
column
e.g. coins
textyesWhich number 🔢
changeselect—Add or take away
amount
1
text—How much
floor
Leave empty for no limit
text—Never go below 🧱
onlyExistingboolean—Only change rows that already exist
as
total
textyesSave 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
}