Files
xo-cash-utils/sandbox/sandbox-price-oracle.ts

18 lines
478 B
TypeScript

import { SSESession, type SSEvent } from '../source/sse-session/index.ts';
// Command: npx tsx ./sandbox/sandbox-price-oracle.ts
// Use the GP Price Oracle API
const url = 'https://oracles.generalprotocols.com/sse/v1/messages';
// Create our sse session
const sseSession = await SSESession.create(url);
// Create a message event handler
sseSession.on('message', (message: SSEvent) => {
console.log(message);
});
// Connect to the SSESession
await sseSession.connect();