MCPcopy Create free account
hub / github.com/block/buzz / handleSetChannelPurpose

Function handleSetChannelPurpose

desktop/src/testing/e2eBridge.ts:5331–5358  ·  view source on GitHub ↗
(
  args: {
    channelId: string;
    purpose: string;
  },
  config: E2eConfig | undefined,
)

Source from the content-addressed store, hash-verified

5329}
5330
5331async function handleSetChannelPurpose(
5332 args: {
5333 channelId: string;
5334 purpose: string;
5335 },
5336 config: E2eConfig | undefined,
5337) {
5338 const identity = getIdentity(config);
5339 if (!identity) {
5340 const channel = getMockChannel(args.channelId);
5341 const nextPurpose = args.purpose.trim();
5342
5343 channel.purpose = nextPurpose.length > 0 ? nextPurpose : null;
5344 channel.purpose_set_by = getMockMemberPubkey(config);
5345 channel.purpose_set_at = new Date().toISOString();
5346 touchMockChannel(channel);
5347 return;
5348 }
5349
5350 await submitSignedEvent(config, {
5351 kind: 9002,
5352 content: "",
5353 tags: [
5354 ["h", args.channelId],
5355 ["purpose", args.purpose],
5356 ],
5357 });
5358}
5359
5360type MockUpdaterChannel = {
5361 onmessage?: (event: { event: "Finished" }) => void;

Callers 1

handleMockCommandFunction · 0.85

Calls 5

getMockChannelFunction · 0.85
getMockMemberPubkeyFunction · 0.85
touchMockChannelFunction · 0.85
submitSignedEventFunction · 0.85
getIdentityFunction · 0.70

Tested by

no test coverage detected