( relayUrl: string, callback: (client: ReadOnlyRelayClient) => Promise<T>, )
| 262 | } |
| 263 | |
| 264 | export async function withReadOnlyRelayClient<T>( |
| 265 | relayUrl: string, |
| 266 | callback: (client: ReadOnlyRelayClient) => Promise<T>, |
| 267 | ): Promise<T> { |
| 268 | const client = new ReadOnlyRelayClient(relayUrl); |
| 269 | try { |
| 270 | return await callback(client); |
| 271 | } finally { |
| 272 | client.disconnect(); |
| 273 | } |
| 274 | } |
no test coverage detected