Skip to content

Commit

Permalink
Merge pull request #40 from pontem-network/LS-2089-remove-sentrio
Browse files Browse the repository at this point in the history
Ls 2089 remove sentrio
  • Loading branch information
extg5 authored Aug 9, 2024
2 parents f397442 + c616ce5 commit 7b9abdc
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 44 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pontem/liquidswap-widget",
"version": "0.5.3",
"version": "0.5.4",
"homepage": "https://github.com/pontem-network/liquidswap-widget#readme",
"description": "Liquidswap widget as custom web component",
"files": [
Expand Down
2 changes: 0 additions & 2 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Network } from '@/types';

export const STATS_URL = 'https://sentrio-api.pontem.network';

export const DENOMINATOR = 10000;

export const RECALCULATION_TX_TIME = 1000;
Expand Down
42 changes: 1 addition & 41 deletions src/store/usePoolsStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ref, reactive, onBeforeMount, watch, computed, unref } from 'vue';
import { defineStore } from 'pinia';
import { useStorage } from '@vueuse/core';

import { STATS_URL, CORRECT_CHAIN_ID, VALID_VERSIONS } from '@/constants/constants';
import { CORRECT_CHAIN_ID } from '@/constants/constants';
import { is_sorted } from '@/utils/utils';
import { IPoolBase, IPersistedPool, IPoolInfo } from '@/types/pools';
import { IStorageBasic, TVersionType } from '@/types';
Expand Down Expand Up @@ -55,46 +55,6 @@ export const usePoolsStore = defineStore('poolsStore', () => {

registerPools(pools);

fetchAndFillAPRs();
}

async function fetchAndFillAPRs() {
const response = await fetch(`${STATS_URL}/api/apr`);
let json;
try {
json = await response.json();
} catch (e) {
throw new Error('Bad json');
}
for (let index = 0; index < json.data?.length; index++) {
const one = json.data[index] as {
alias: { pair: string; curve: string };
apr: number;
};
const { pair } = one.alias;
let { curve } = one.alias;
curve = curve.toLowerCase();
const coins = pair.split('-');
for (let i = 0; i < 2; i++) {
if (['USDT', 'USDC', 'BTC', 'WETH', 'SOL'].includes(coins[i])) {
coins[i] = `wh${coins[i]}`;
}
if (coins[i].indexOf('z') === 0) {
coins[i] = coins[i].substring(1);
}
}
const directTitle = `${coins[0]}/${coins[1]}-${curve}`;
const reverseTitle = `${coins[1]}/${coins[0]}-${curve}`;
const { apr } = one;
[directTitle, reverseTitle].forEach((start) => {
VALID_VERSIONS.forEach((end) => {
const poolTitleKey = `${start}-${end}`;
if (poolsTitleMap[poolTitleKey] !== undefined) {
poolsMap[poolsTitleMap[poolTitleKey]].apr = apr;
}
});
});
}
}

onBeforeMount(() => loadFromLocalStorage());
Expand Down

0 comments on commit 7b9abdc

Please sign in to comment.