Skip to content

spacebudz/denosync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Denosync

Deno WebSocket Chainsync client on top of Ogmios.

Get started

import {
  Block,
  createClient,
  getBlockEra,
  Point,
  POINT_SHELLEY_START,
  toShelleyCompatibleBlock,
} from "./mod.ts";

function rollForward(block: Block) {
  const { shelleyBlock } = toShelleyCompatibleBlock(block)!;
  const era = getBlockEra(block);
  const point: Point = {
    hash: shelleyBlock.headerHash,
    slot: shelleyBlock.header.slot,
  };
  console.log(era);
  console.log(point);
}

function rollBackward(point: Point) {
  console.log(point);
}

const client = await createClient({
  url: "ws://localhost:1337",
  startPoint: POINT_SHELLEY_START,
}, {
  rollBackward,
  rollForward,
});

client.start();

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published