* Build the single kind-39006 bounds event a channel window response must carry. * The `d` tag key must match `expectedBoundsKey` in channelWindowResponse.ts: * ` :head` at the frontier, else ` : : ` of * the request cursor (lower-cased). `has_more`/`next_curso
(
args: {
channelId: string;
cursor?: { created_at: number; event_id: string } | null;
},
hasMore: boolean,
nextCursor: { created_at: number; id: string } | null,
)
| 3820 | * parser rejects a bounds event where they disagree. |
| 3821 | */ |
| 3822 | function buildMockChannelWindowBounds( |
| 3823 | args: { |
| 3824 | channelId: string; |
| 3825 | cursor?: { created_at: number; event_id: string } | null; |
| 3826 | }, |
| 3827 | hasMore: boolean, |
| 3828 | nextCursor: { created_at: number; id: string } | null, |
| 3829 | ): RelayEvent { |
| 3830 | const suffix = args.cursor |
| 3831 | ? `${args.cursor.created_at}:${args.cursor.event_id.toLowerCase()}` |
| 3832 | : "head"; |
| 3833 | const boundsKey = `${args.channelId.toLowerCase()}:${suffix}`; |
| 3834 | return { |
| 3835 | id: `mock-window-bounds-${boundsKey}`, |
| 3836 | pubkey: DEFAULT_MOCK_IDENTITY.pubkey, |
| 3837 | created_at: Math.floor(Date.now() / 1000), |
| 3838 | kind: KIND_CHANNEL_WINDOW_BOUNDS, |
| 3839 | tags: [["d", boundsKey]], |
| 3840 | content: JSON.stringify({ has_more: hasMore, next_cursor: nextCursor }), |
| 3841 | sig: "mocksig".repeat(20).slice(0, 128), |
| 3842 | }; |
| 3843 | } |
| 3844 | |
| 3845 | /** |
| 3846 | * one server-assembled channel window over the `/query` bridge. Emits the flat |