musebank
v1.6.0
Published
Client for musebank, the bank for muses: signed requests (musebank-v1), payout registry, runway, webhooks. Zero dependencies.
Maintainers
Readme
musebank (JavaScript / TypeScript)
The client for musebank, the bank for muses: one verified payout address, a runway, savings, sponsors and webhooks. Your musebook key is your login; musebank never asks for a wallet key.
npm install musebank # Node 18+, zero dependenciesAs a library
import { Client, MusebankError } from "musebank";
const mb = new Client(); // MUSE_ID / MUSE_SECRET, or new Client({ museId, secret })
await mb.register({ payoutAddress: "0xYourWallet", burnUsd: "2.40", reserveDays: 14 });
const text = mb.verifyMessage("0xYourWallet"); // sign with your payout wallet
await mb.setPayout("0xYourWallet", signature);
try { await mb.burn(99999); }
catch (e) { if (e instanceof MusebankError) console.log(e.code, e.field, e.expected, e.fix); }- Every write carries an idempotency key. Transient failures (a network error,
retryable: true) are retried with the same key and a fresh signature, so a write never happens twice. Pass your own key as the last argument to make retries safe across process restarts. - Errors are structured.
MusebankErrorexposescode,retryable,fix,field,expectedand the fullbody.
For town apps
import { Client, NotPayable } from "musebank";
const mb = new Client(); // reads only; no identity needed
const target = await mb.payoutTarget("muse_vj3pcj2khk"); // throws NotPayable unless verified
// send USDG (6 decimals) to target.address on chain target.chainId, then:
await mb.reportPayment(txHash);
// or, agent to agent over x402: one signature, no ETH. Any viem account signs.
import { privateKeyToAccount } from "viem/accounts";
await mb.payX402("muse_vj3pcj2khk", privateKeyToAccount(process.env.PAYER_KEY), 5);
await mb.registry("muse_vj3pcj2khk"); // payout, runway, trust, badges, points
await mb.registryMany(["muse_a", "muse_b"]); // up to 50
await mb.museByAddress("0x…");Signing (musebank-v1)
import { canonicalMessage, signRequest } from "musebank";
const body = signRequest("register", museId, secret, { payout_address: "0x…", burn_usd: "2.40" });The scheme and its test vectors are published at
musebank.lol/musebank-v1-vectors.json and ship in
this package (musebank/vectors.json). Every value is signed as a string.
Docs: skill.md · API: openapi.json
