migrate some types

This commit is contained in:
strobie
2022-09-29 19:51:53 +02:00
parent 5a27bf1b18
commit 768ec49bec
13 changed files with 25 additions and 24 deletions

View File

@@ -1,5 +1,5 @@
import { gql, request } from "graphql-request";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
import { getPagedGql } from "../utils/gql";
const query = gql`

View File

@@ -4,7 +4,7 @@ import { ethers } from "ethers";
import { providers } from "../utils/ethers";
import BigNumber from "bignumber.js";
import { getPagedGql } from "../utils/gql";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
const subgraphUrl = "https://api.thegraph.com/subgraphs/name/picodes/borrow";

View File

@@ -1,7 +1,7 @@
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
import {
Account,
borrowBalanceUnderlying,

View File

@@ -1,7 +1,7 @@
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
import {
Account,
borrowBalanceUnderlying,

View File

@@ -1,7 +1,7 @@
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
const subgraphUrl = "https://api.thegraph.com/subgraphs/name/euler-xyz/euler-mainnet";

View File

@@ -1,7 +1,7 @@
import { gql, request } from "graphql-request";
import BigNumber from "bignumber.js";
import { getPagedGql } from "../utils/gql";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
const subgraphUrl = "https://api.thegraph.com/subgraphs/name/liquity/liquity";

View File

@@ -1,7 +1,7 @@
import { ethers } from "ethers";
import { providers } from "../utils/ethers";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
const sdk = require("@defillama/sdk");
// all maker contracts: https://chainlog.makerdao.com/api/mainnet/active.json

View File

@@ -1,7 +1,7 @@
import { PublicKey, Connection } from "@solana/web3.js";
import { SolendMarket, SolendObligation, parseObligation } from "@solendprotocol/solend-sdk";
import { BigNumber } from "bignumber.js";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
const endpoint = process.env.SOLANA_RPC || "https://solana-api.projectserum.com/"; // or "https://api.mainnet-beta.solana.com"
const connection = new Connection(endpoint, "confirmed");

View File

@@ -1,7 +1,7 @@
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
const subgraphUrl = "https://api.thegraph.com/subgraphs/name/traderjoe-xyz/lending";

View File

@@ -1,18 +1,8 @@
import axios from "axios";
import { Liq } from "./types";
export const TOTAL_BINS = 20;
export interface Liq {
owner: string;
liqPrice: number;
collateral: string;
collateralAmount: string;
extra?: {
displayName?: string;
url: string;
};
}
export interface Bins {
[token: string]: {
bins: {

View File

@@ -2,6 +2,7 @@ import axios from "axios";
import BigNumber from "bignumber.js";
import { gql } from "graphql-request";
import { getPagedGql } from "./gql";
import { Prices } from "./types";
export const bignum = (value: string | number) => new BigNumber(value);
@@ -32,9 +33,6 @@ export type Account = {
hasBorrowed: boolean;
};
export type Price = { decimals: number; price: number; symbol: string; timestamp: number; confidence: number };
export type Prices = { [address: string]: Price };
export const getUnderlyingPrices = async (markets: Market[], chainPrefix: string): Promise<Prices> => {
const tokens = markets.map((m) => m.underlyingAddress).map((a) => chainPrefix + a.toLowerCase());
const prices = (await axios.get("https://coins.llama.fi/prices/current/" + tokens.join(","))).data.coins as Prices;

View File

@@ -0,0 +1,13 @@
export type Price = { decimals: number; price: number; symbol: string; timestamp: number; confidence: number };
export type Prices = { [address: string]: Price };
export interface Liq {
owner: string;
liqPrice: number;
collateral: string;
collateralAmount: string;
extra?: {
displayName?: string;
url: string;
};
}

View File

@@ -1,7 +1,7 @@
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/binResults";
import { Liq } from "../utils/types";
import {
Account,
borrowBalanceUnderlying,