Skip to content

Commit

Permalink
Remove Postgres endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromtcosta committed Nov 23, 2022
1 parent b6eb286 commit 3b2ca5c
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 2,004 deletions.
3 changes: 1 addition & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
} from "./utils";
import * as middleware from "./middleware";

import { askBestBlock } from "./services/bestblock";
import { handleSignedTx } from "./services/signedTransaction";
import { handlePoolInfo } from "./services/poolInfo";
import { handleGetAccountState } from "./services/accountState";
Expand Down Expand Up @@ -62,7 +61,7 @@ createTransactionOutputView(pool);
createUtxoFunctions(pool);
createTransactionUtilityFunctions(pool);

const healthChecker = new HealthChecker(() => askBestBlock(pool));
const healthChecker = new HealthChecker(() => neo.bestblock.getBestBlock());

const router = express();

Expand Down
33 changes: 33 additions & 0 deletions src/neo4j/bestblock/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,40 @@
import { Driver } from "neo4j-driver";
import { Request, Response } from "express";
import { CardanoFrag } from "../../Transactions/types";
import { UtilEither } from "../../utils";

export const bestblock = (driver: Driver) => ({
getBestBlock: async (): Promise<UtilEither<CardanoFrag>> => {
const session = driver.session();

const result = await session.run(`
MATCH (b:Block)
WITH MAX(ID(b)) as max_block_id
MATCH (block:Block)
WHERE ID(block) = max_block_id
RETURN {
epoch: block.epoch,
slot: block.epoch_slot,
globalSlot: block.slot,
hash: block.hash,
height: block.number
} as block`);
const bestBlock = result.records[0].get(0).properties;

session.close();

return {
kind: "ok",
value: {
epoch: bestBlock.epoch.toNumber(),
slot: bestBlock.slot.toNumber(),
globalSlot: bestBlock.globalSlot.toNumber(),
hash: bestBlock.hash,
height: bestBlock.height.toNumber()
} as any
};
},
handler: async (_: Request, res: Response) => {
const cypher = `MATCH (b:Block)
WITH MAX(ID(b)) as max_block_id
Expand Down
48 changes: 0 additions & 48 deletions src/services/assetMintTxs.ts

This file was deleted.

122 changes: 0 additions & 122 deletions src/services/filterUsedAddress.ts

This file was deleted.

59 changes: 0 additions & 59 deletions src/services/multiAssetSupply.ts

This file was deleted.

108 changes: 0 additions & 108 deletions src/services/multiAssetTxMint.ts

This file was deleted.

Loading

0 comments on commit 3b2ca5c

Please sign in to comment.