From ab5a44f01e2d9438f990eea4e5e15cdb49af7f02 Mon Sep 17 00:00:00 2001 From: Nilay Saha Date: Sat, 29 Jun 2024 10:39:11 +0200 Subject: [PATCH 1/3] script for circulating supply --- src/tokens/reit.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/tokens/reit.ts diff --git a/src/tokens/reit.ts b/src/tokens/reit.ts new file mode 100644 index 00000000..e47cf9e9 --- /dev/null +++ b/src/tokens/reit.ts @@ -0,0 +1,28 @@ +import { defaultFetcherOptions, SupplyFetcher } from "../types"; +import axios from "axios"; + + +const REIT = "52d4b39c2407ce020ab4abb785d820a3ad5a2fa07600d07a205e509f"; +const REIT_ASSET = `${REIT}52454954` + + +const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => { + const total = 50_000_000; + + //get the currently minted supply + const instance = axios.create({ + baseURL: `https://cardano-mainnet.blockfrost.io/api/v0/`, + timeout: 1000, + headers: { 'project_id': process.env["BLOCKFROST_PROJECT_ID"]} + }) + + const assetInfo = await instance.get(`assets/${REIT_ASSET}`) + const total_mint = assetInfo.data.quantity + + return { + circulating: total_mint, + total: total.toString(), + }; +}; + +export default fetcher; From a41ced29fd354e95de768fe9b1855773586f9222 Mon Sep 17 00:00:00 2001 From: Nilay Saha Date: Sat, 29 Jun 2024 10:49:13 +0200 Subject: [PATCH 2/3] added the reit fetcher in index script --- src/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/index.ts b/src/index.ts index eb0b5f4a..4c842ab0 100644 --- a/src/index.ts +++ b/src/index.ts @@ -115,6 +115,7 @@ import pugchipFetcher from "./tokens/pugchip"; import punksFetcher from "./tokens/punks"; import rakerFetcher from "./tokens/raker"; import rausiFetcher from "./tokens/rausi"; +import reitFetcher from "./tokens/reit"; import revuFetcher from "./tokens/revu"; import rexFetcher from "./tokens/rex"; import rjvFetcher from "./tokens/rjv"; @@ -321,6 +322,8 @@ export const supplyFetchers: Record = { "2d587111358801114f04df83dc0015de0a740b462b75cce5170fc935434749": cgiFetcher, fc11a9ef431f81b837736be5f53e4da29b9469c983d07f321262ce614652454e: frenFetcher, "61fe4feee9d051c75b20d11701c3154ae95d9857bd429ffb85087eae526578": rexFetcher, + "52d4b39c2407ce020ab4abb785d820a3ad5a2fa07600d07a205e509f52454954": + reitFetcher, "20cd68533b47565f3c61efb39c30fdace9963bfa4c0060b613448e3c50524f584945": proxiesFetcher, f6ac48c64aa7af16434d9f84e014d11fba38525b436acc338ff20b0d4d7463: mtcFetcher, From 76fb5dd8f17843377414450667095a89eb5f74f8 Mon Sep 17 00:00:00 2001 From: Nilay Saha Date: Sat, 29 Jun 2024 10:52:50 +0200 Subject: [PATCH 3/3] removed option as it was giving build errors --- src/tokens/reit.ts | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/tokens/reit.ts b/src/tokens/reit.ts index e47cf9e9..3909a6c2 100644 --- a/src/tokens/reit.ts +++ b/src/tokens/reit.ts @@ -1,28 +1,26 @@ -import { defaultFetcherOptions, SupplyFetcher } from "../types"; -import axios from "axios"; +import axios from "axios"; +import { SupplyFetcher } from "../types"; const REIT = "52d4b39c2407ce020ab4abb785d820a3ad5a2fa07600d07a205e509f"; -const REIT_ASSET = `${REIT}52454954` +const REIT_ASSET = `${REIT}52454954`; +const fetcher: SupplyFetcher = async () => { + const total = 50_000_000; -const fetcher: SupplyFetcher = async (options = defaultFetcherOptions) => { - const total = 50_000_000; + const instance = axios.create({ + baseURL: `https://cardano-mainnet.blockfrost.io/api/v0/`, + timeout: 1000, + headers: { project_id: process.env["BLOCKFROST_PROJECT_ID"] }, + }); - //get the currently minted supply - const instance = axios.create({ - baseURL: `https://cardano-mainnet.blockfrost.io/api/v0/`, - timeout: 1000, - headers: { 'project_id': process.env["BLOCKFROST_PROJECT_ID"]} - }) - - const assetInfo = await instance.get(`assets/${REIT_ASSET}`) - const total_mint = assetInfo.data.quantity + const assetInfo = await instance.get(`assets/${REIT_ASSET}`); + const total_mint = assetInfo.data.quantity; - return { - circulating: total_mint, - total: total.toString(), - }; + return { + circulating: total_mint, + total: total.toString(), + }; }; export default fetcher;