mirror of
https://github.com/aljazceru/bakery.git
synced 2025-12-17 12:45:20 +01:00
handle bech32 encoding in mcp actions
This commit is contained in:
@@ -2,11 +2,12 @@ import z from "zod";
|
|||||||
import server from "../server.js";
|
import server from "../server.js";
|
||||||
import { ownerActions, ownerPublish } from "../../owner.js";
|
import { ownerActions, ownerPublish } from "../../owner.js";
|
||||||
import { FollowUser, UnfollowUser } from "applesauce-actions/actions";
|
import { FollowUser, UnfollowUser } from "applesauce-actions/actions";
|
||||||
|
import { normalizeToHexPubkey } from "../../../helpers/nip19.js";
|
||||||
|
|
||||||
server.tool(
|
server.tool(
|
||||||
"Follow user",
|
"Follow user",
|
||||||
"Adds another users pubkey to the owners following list",
|
"Adds another users pubkey to the owners following list",
|
||||||
{ pubkey: z.string() },
|
{ pubkey: z.string().transform((hex) => normalizeToHexPubkey(hex, true)) },
|
||||||
async ({ pubkey }) => {
|
async ({ pubkey }) => {
|
||||||
try {
|
try {
|
||||||
await ownerActions.exec(FollowUser, pubkey).forEach(ownerPublish);
|
await ownerActions.exec(FollowUser, pubkey).forEach(ownerPublish);
|
||||||
@@ -20,7 +21,7 @@ server.tool(
|
|||||||
server.tool(
|
server.tool(
|
||||||
"Unfollow user",
|
"Unfollow user",
|
||||||
"Removes another users pubkey from the owners following list",
|
"Removes another users pubkey from the owners following list",
|
||||||
{ pubkey: z.string() },
|
{ pubkey: z.string().transform((hex) => normalizeToHexPubkey(hex, true)) },
|
||||||
async ({ pubkey }) => {
|
async ({ pubkey }) => {
|
||||||
try {
|
try {
|
||||||
await ownerActions.exec(UnfollowUser, pubkey).forEach(ownerPublish);
|
await ownerActions.exec(UnfollowUser, pubkey).forEach(ownerPublish);
|
||||||
|
|||||||
Reference in New Issue
Block a user