handle bech32 encoding in mcp actions

This commit is contained in:
hzrd149
2025-03-27 19:05:25 +00:00
parent f6d8d1dcfd
commit 0235ae5fcc

View File

@@ -2,11 +2,12 @@ import z from "zod";
import server from "../server.js";
import { ownerActions, ownerPublish } from "../../owner.js";
import { FollowUser, UnfollowUser } from "applesauce-actions/actions";
import { normalizeToHexPubkey } from "../../../helpers/nip19.js";
server.tool(
"Follow user",
"Adds another users pubkey to the owners following list",
{ pubkey: z.string() },
{ pubkey: z.string().transform((hex) => normalizeToHexPubkey(hex, true)) },
async ({ pubkey }) => {
try {
await ownerActions.exec(FollowUser, pubkey).forEach(ownerPublish);
@@ -20,7 +21,7 @@ server.tool(
server.tool(
"Unfollow user",
"Removes another users pubkey from the owners following list",
{ pubkey: z.string() },
{ pubkey: z.string().transform((hex) => normalizeToHexPubkey(hex, true)) },
async ({ pubkey }) => {
try {
await ownerActions.exec(UnfollowUser, pubkey).forEach(ownerPublish);