docker now has current repo and also added xcashu refunds to the cli

This commit is contained in:
redshift
2026-05-19 01:25:00 +08:00
parent 3f14ae8084
commit 8ae0288d95
4 changed files with 76 additions and 8 deletions

View File

@@ -1,3 +1,11 @@
FROM oven/bun:1-slim
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun run build && bun install -g . && bun add -g @earendil-works/pi-coding-agent
EXPOSE 8008
CMD ["/bin/bash"]

View File

@@ -1,14 +1,15 @@
services:
bun:
routstrd:
build: .
container_name: routstrd-bun
working_dir: /app
volumes:
- .:/app
- bun_home:/root/.bun
container_name: routstrd
stdin_open: true
tty: true
volumes:
- routstrd_data:/data
ports:
- "8008:8008"
restart: unless-stopped
command: /bin/bash
volumes:
bun_home:
routstrd_data:

View File

@@ -231,7 +231,8 @@ program
"Mint URL to refund to (defaults to first mint in wallet)",
)
.option("-y, --yes", "Skip confirmation prompt", false)
.action(async (options: { mintUrl?: string; yes: boolean }) => {
.option("--xcashu", "Refund xcashu tokens only (uses refundXcashuTokens)", false)
.action(async (options: { mintUrl?: string; yes: boolean; xcashu: boolean }) => {
await ensureDaemonRunning();
let mintUrl = options.mintUrl;
@@ -257,6 +258,36 @@ program
}
try {
if (options.xcashu) {
// xcashu path: only refund xcashu tokens
const result = await callDaemon("/refund/xcashu", {
method: "POST",
body: { mintUrl },
});
if (result.error) {
console.log(result.error);
process.exit(1);
}
const output = result.output as
| {
message: string;
results: Array<{ baseUrl: string; token: string; success: boolean; error?: string }>;
}
| undefined;
if (output) {
console.log(output.message);
console.log("\nResults:");
for (const r of output.results) {
const status = r.success ? "success" : `failed: ${r.error || "unknown"}`;
console.log(` - ${r.baseUrl}: ${status}`);
}
}
return;
}
const result = await callDaemon("/refund", {
method: "POST",
body: { mintUrl },

View File

@@ -537,6 +537,34 @@ export function createDaemonRequestHandler(deps: {
return;
}
if (req.method === "POST" && url.pathname === "/refund/xcashu") {
try {
const body = await readJsonBody(req);
const mintUrl = getRequiredStringField(body, "mintUrl");
const spender = deps.refundClient.getCashuSpender();
const results = await spender.refundXcashuTokens(mintUrl);
sendJson(res, 200, {
output: {
message: `Refunded xcashu tokens to ${mintUrl}`,
results: results.map(
(r: { baseUrl: string; token: string; success: boolean; error?: string }) => ({
baseUrl: r.baseUrl,
token: r.token,
success: r.success,
error: r.error,
}),
),
},
});
} catch (error) {
logger.error(`xcashu refund error: ${toErrorMessage(error)}`);
respondWithError(res, error);
}
return;
}
if (req.method === "GET" && url.pathname === "/balance") {
try {
const balances = await deps.walletAdapter.getBalances();