badger-clicks
v0.1.0
Published
Create, deploy and execute Solana Actions (Blinks) in seconds — the Badger Clicks library and CLI.
Maintainers
Readme
badger-clicks
Turn an on-chain action into a link. Post that link anywhere and Blink-enabled wallets unfurl it into signable buttons — and AI agents can execute the same endpoint.
No blockchain code. You declare intent; the Badger Clicks engine builds the transaction. Nobody ever holds your keys — a Click hands the user an unsigned transaction their own wallet signs.
npx badger-clicks new tip --to YOUR_WALLET
npx badger-clicks key # then: export BADGER_CLICKS_KEY=bck_…
npx badger-clicks deploy
# ✓ live https://badger.markets/c/tip-7xkx…CLI
| Command | What it does |
|---|---|
| npx badger-clicks templates | list the template library |
| npx badger-clicks new <template> [--flags] | write a click.json |
| npx badger-clicks ai "<describe it>" | generate one from a sentence |
| npx badger-clicks key | mint an API key (shown once) |
| npx badger-clicks deploy [file] | put it live, print the link |
| npx badger-clicks list | browse the public catalogue |
| npx badger-clicks mine | your Clicks + views/builds/wallets |
| npx badger-clicks show <id> | preview how a Click renders |
Auth via BADGER_CLICKS_KEY (or --key). Point at another host with BADGER_CLICKS_URL
(or --url) — handy for local development.
Template library
| Template | For | Required |
|---|---|---|
| tip | accept SOL tips | to |
| payMe | charge a fixed SOL price | to, amount |
| donateToken | donations in any token | to, token |
| sendToken | send a token to a fixed wallet | to, token |
| buyToken | one-tap buy with SOL (Jupiter) | token |
| swap | any-to-any swap (Jupiter) | inToken, outToken |
| stakeSol | liquid stake SOL into an LST | – (lst, default jitoSOL) |
| chipIn | group contribution to a pot | to |
| proveIt | on-chain memo / attestation | memo |
| contribute | send tokens to a sink address | to, token |
Library
import { BadgerClicks, templates, defineClick } from 'badger-clicks';
const clicks = new BadgerClicks({ apiKey: process.env.BADGER_CLICKS_KEY });
// from a template …
const { blink } = await clicks.create(templates.tip({ to: MY_WALLET }));
// … or hand-rolled
const def = defineClick({
id: 'coffee-fund',
title: 'Buy me a coffee',
description: 'One tap, straight to my wallet.',
icon: '☕', label: 'Tip',
presets: [0.01, 0.05, 0.1],
customLabel: 'SOL amount',
tx: { kind: 'sol-transfer', to: MY_WALLET },
});
await clicks.create(def);Executing a Click (any wallet library)
const clicks = new BadgerClicks();
const meta = await clicks.action('/api/actions/buy'); // buttons + params
const { transaction, links } = await clicks.buildTx('/api/actions/buy?amount=0.5', WALLET);
// …sign + send `transaction` yourself…
if (links?.next) await clicks.confirmNext(links.next.href, WALLET, signature);Wallet intelligence
await clicks.agent(WALLET); // balances + ranked next-action suggestions
await clicks.rank(WALLET); // Badger Rank leaderboard + your rowClick definition
{
"id": "coffee-fund", // → badger.markets/c/coffee-fund (3–32 chars, a–z 0–9 -)
"title": "Buy me a coffee",
"description": "One tap, straight to my wallet.",
"icon": "☕",
"label": "Tip", // verb on the buttons
"presets": [0.01, 0.05, 0.1], // up to 6 one-tap amounts
"customLabel": "SOL amount", // omit to disable free entry
"tx": { "kind": "sol-transfer", "to": "<wallet>" }
}tx.kind is one of:
| kind | needs | does |
|---|---|---|
| sol-transfer | to | sends SOL |
| spl-transfer | to, token | sends any SPL / Token-2022 token (creates the ATA) |
| jup-swap | inToken, outToken | best-route swap via Jupiter |
| memo | memo | an on-chain signature with no transfer |
Add memo to any kind to stamp a note on-chain.
Why this is safe
- Clicks return unsigned transactions — signing happens in the user's wallet.
- Definitions are validated before deploy, and
tx.tomust be a real address. - Every Click is a plain Solana Action, so any Blink-enabled wallet can execute it without this package.
Requirements
Node 18+ (uses built-in fetch). Zero runtime dependencies.
Licence
MIT
