Skip to content
This repository has been archived by the owner on Mar 22, 2023. It is now read-only.

Commit

Permalink
liquidityagainstuserandpair endpoint updated and tested
Browse files Browse the repository at this point in the history
  • Loading branch information
Hammad-Mubeen committed Apr 14, 2022
1 parent 25b2584 commit f42ffb6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions routes/pairroutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var express = require("express");
const { createFalse } = require("typescript");
var router = express.Router();
var pair = require("../JsClients/PAIR/test/installed.ts");
var AllcontractsData = require("../models/allcontractsData");

router
.route("/liquidityagainstuserandpair")
Expand All @@ -21,8 +22,16 @@ router
message: "pairid not found in request body",
});
}

let liquidity = await pair.balanceOf(req.body.pairid, req.body.to);
let data = await AllcontractsData.findOne({
packageHash: req.body.pairid,
});
if (data == null) {
return res.status(400).json({
success: false,
message: "pair not found against this package hash ",
});
}
let liquidity = await pair.balanceOf(data.contractHash, req.body.to);
return res.status(200).json({
success: true,
message:
Expand Down

0 comments on commit f42ffb6

Please sign in to comment.