Skip to content

Commit

Permalink
Merge pull request #33 from decentldotland/prep
Browse files Browse the repository at this point in the history
chore: additional API endpoints
  • Loading branch information
charmful0x authored Feb 11, 2023
2 parents c7fa5b4 + 5ed9174 commit 540b496
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "molecule",
"version": "0.2.3",
"version": "0.2.4",
"type": "module",
"description": "reusable EXM components and helper functions for a faster development",
"main": "./src/api.js",
Expand Down
44 changes: 43 additions & 1 deletion src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ app.get("/tx-gql/:txid", async (req, res) => {
}
});

app.get("/ar/tx-gql/:txid", async (req, res) => {
try {
res.setHeader("Content-Type", "application/json");

const response = await getArTxObject(req.params?.txid);
res.send(response);
return;
} catch (error) {
console.log(error);
res.send({});
return;
}
});

app.get("/ota/:pubkey", async (req, res) => {
try {
res.setHeader("Content-Type", "application/json");
Expand Down Expand Up @@ -280,10 +294,38 @@ app.get("/everpay/tx/:txid", async (req, res) => {
}
});

app.get("/redstone/price/:ticker", async (req, res) => {
app.get("/ever/everpay/tx/:txid", async (req, res) => {
try {
res.setHeader("Content-Type", "application/json");

const { txid } = req.params;
const response = await getEverTxObject(txid);
res.send(response);
return;
} catch (error) {
res.send({ molecule_error: "invalid_txid" });
return;
}
});

app.get("/redstone-oracle/price/:ticker", async (req, res) => {
try {
res.setHeader("Content-Type", "application/json");

const { ticker } = req.params;
const response = await getTokenPrice(ticker);
res.send(response);
return;
} catch (error) {
console.log(error)
res.send({ molecule_error: "redstone_error" });
return;
}
});

app.get("/redstone/price/:ticker", async (req, res) => {
try {
res.setHeader("Content-Type", "application/json");
assert.equal(checkSubdomain(req, "redstone"), true);
const { ticker } = req.params;
const response = await getTokenPrice(ticker);
Expand Down

0 comments on commit 540b496

Please sign in to comment.