diff --git a/.env b/.env index edd2c958b..40c5aa9db 100644 --- a/.env +++ b/.env @@ -1 +1 @@ -VITE_SUBSQUID_URL="https://squid.subsquid.io/origin-squid/v/v5/graphql" +VITE_SUBSQUID_URL="https://squid.subsquid.io/origin-squid/v/v6/graphql" diff --git a/.graphqlconfig b/.graphqlconfig deleted file mode 100644 index 37ef6aa86..000000000 --- a/.graphqlconfig +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "Subsquid GraphQL Schema", - "schemaPath": "https://squid.subsquid.io/origin-squid/v/v5/graphql" -} diff --git a/graphql.config.yml b/graphql.config.yml new file mode 100644 index 000000000..415bc2860 --- /dev/null +++ b/graphql.config.yml @@ -0,0 +1 @@ +schema: https://squid.subsquid.io/origin-squid/v/v6/graphql diff --git a/libs/analytics/.babelrc b/libs/analytics/.babelrc new file mode 100644 index 000000000..1ea870ead --- /dev/null +++ b/libs/analytics/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nx/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/libs/analytics/.eslintrc.json b/libs/analytics/.eslintrc.json new file mode 100644 index 000000000..a39ac5d05 --- /dev/null +++ b/libs/analytics/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["plugin:@nx/react", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/libs/analytics/README.md b/libs/analytics/README.md new file mode 100644 index 000000000..87e988a75 --- /dev/null +++ b/libs/analytics/README.md @@ -0,0 +1,7 @@ +# analytics + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test analytics` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/libs/analytics/project.json b/libs/analytics/project.json new file mode 100644 index 000000000..5247073ae --- /dev/null +++ b/libs/analytics/project.json @@ -0,0 +1,16 @@ +{ + "name": "analytics", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/analytics/src", + "projectType": "library", + "tags": [], + "targets": { + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["libs/analytics/**/*.{ts,tsx,js,jsx}"] + } + } + } +} diff --git a/libs/analytics/src/TimeLineChart.stories.tsx b/libs/analytics/src/TimeLineChart.stories.tsx new file mode 100644 index 000000000..7bb596621 --- /dev/null +++ b/libs/analytics/src/TimeLineChart.stories.tsx @@ -0,0 +1,68 @@ +import { faker } from '@faker-js/faker'; +import { Container } from '@mui/material'; +import { addDays } from 'date-fns'; + +import { TimeLineChart } from './TimeLineChart'; + +import type { Meta, StoryObj } from '@storybook/react'; + +faker.seed(4548); + +function array(n: number, initial: T, fn: (last: T) => T) { + let last: T = initial; + return new Array(n).fill(0).map((_, index) => { + if (index === 0) return last; + return (last = fn(last)); + }); +} + +const ema = (p: number) => { + let last: number; + return (val: number) => { + return (last = (val + (last ?? val) * (p - 1)) / p); + }; +}; + +const smooth = ema(7); + +const meta: Meta = { + component: TimeLineChart, + title: 'Analytics/TimeLineChart', + args: { + title: 'APY', + filter: { + options: ['1W', '1M', '6M', '1Y', 'All'], + value: '1W', + onChange: (value) => console.log(value), + }, + data: { + datasets: [ + { + type: 'line', + data: array(180, { x: new Date('2023-01-01'), y: 0.05 }, (last) => ({ + x: addDays(last.x, 1), + y: faker.number.float({ + min: last.y * 0.9, + max: last.y * 1.1, + }), + })).map((d) => ({ + x: d.x, + y: smooth(d.y), + })), + }, + ], + }, + formatValues: (val) => { + return `${Math.floor(Number(val) * 10000) / 100}%`; + }, + }, + render: (args) => ( + + + + ), +}; + +export default meta; + +export const Default: StoryObj = {}; diff --git a/libs/analytics/src/TimeLineChart.tsx b/libs/analytics/src/TimeLineChart.tsx new file mode 100644 index 000000000..fdf84b8d5 --- /dev/null +++ b/libs/analytics/src/TimeLineChart.tsx @@ -0,0 +1,351 @@ +import { useState } from 'react'; + +import { Box, MenuItem, Paper, Select, Stack, useTheme } from '@mui/material'; +import { registerChart } from '@origin/shared/providers'; +import { intlFormat } from 'date-fns'; +import { mergeDeepRight } from 'ramda'; +import { Line } from 'react-chartjs-2'; + +import type { Theme } from '@origin/shared/theme'; +import type { ChartData, ChartOptions, Plugin } from 'chart.js'; +import type { ComponentProps } from 'react'; + +registerChart(); + +/** + * TODO: Figure out a proper home for these? + */ +const chartTheme = { + primary1: '#CF75D5', + primary2: '#FEDBA8', + position: '#0074F0', + grid: '#2e2f3d', + positive: '#4EBE96', + negative: '#D44E66', +}; + +const full = { xs: 1, sm: 2, md: 3 }; +const half = { xs: 0.5, sm: 1, md: 1.5 }; +const quarter = { xs: 0.25, sm: 0.5, md: 0.75 }; + +export function TimeLineChart(props: { + title: string; + titleProps: ComponentProps; + data: ChartData<'line', { x: Date; y: number }[]>; + formatValues?: (value: number | string) => string | number; + filter?: { + options: FilterOption[]; + value: FilterOption; + onChange?: (value: FilterOption) => void; + }; +}) { + if (!props.formatValues) { + props.formatValues = (value: number | string) => value; + } + const firstData = props.data.datasets.map((d) => d.data[0]); + const lastData = props.data.datasets.map((d) => d.data[d.data.length - 1]); + const [currentData, setCurrentData] = useState(lastData); + const [hovering, setHovering] = useState(false); + const change = currentData[0].y / firstData[0].y - 1; + return ( + + + + + + + {props.title} + + + + {props.formatValues(currentData[0].y)} + + {change ? ( + 0 + ? chartTheme.positive + : change < 0 + ? chartTheme.negative + : undefined + } + > + {change > 0 ? '+' : null} + {props.formatValues(change)} + + ) : null} + + + {intlFormat(currentData[0].x)} + + + + {props.filter && ( + + )} + + + + + { + const elements = chart.getActiveElements(); + if (elements.length) { + setCurrentData( + elements.map( + (element) => + props.data.datasets[element.datasetIndex].data[ + element.index + ], + ), + ); + setHovering(true); + } else { + setCurrentData(lastData); + setHovering(false); + } + }, + }, + ]} + options={{ + scales: { + y: { + ticks: { + callback: props.formatValues, + }, + }, + }, + }} + /> + + + + + ); +} + +export const DateFilterPicker = ({ + options, + value, + onChange, +}: { + options: T[]; + value: T; + onChange?: (val: T) => void; +}) => { + const selectedBackground = + 'linear-gradient(90deg, rgba(140, 102, 252, 0.30) -28.99%, rgba(2, 116, 241, 0.30) 144.97%);'; + const hoverBackground = + 'linear-gradient(90deg, rgba(140, 102, 252, 0.10) -28.99%, rgba(2, 116, 241, 0.10) 144.97%);'; + return ( + theme.palette.grey['700'], + }} + > + {options.map((option) => { + const isSelected = value === option; + return ( + + isSelected + ? theme.palette.text.secondary + : theme.palette.text.primary, + py: { xs: 0.5, sm: 1 }, + px: { xs: 0.75, sm: 1.5 }, + borderRadius: '5px', + cursor: 'pointer', + transition: 'background 2s ease-out 1000ms', + background: isSelected ? selectedBackground : undefined, + '&:hover': { + color: (theme) => theme.palette.text.secondary, + background: isSelected ? selectedBackground : hoverBackground, + }, + }} + onClick={() => onChange?.(option)} + > + {option} + + ); + })} + + ); +}; + +export const DatedLineChart = (props: ComponentProps) => { + const theme = useTheme(); + let options: ChartOptions<'line'> = { + responsive: true, + interaction: { + mode: 'nearest', + axis: 'x', + intersect: false, + }, + animation: { + easing: 'easeInOutQuad', + }, + scales: { + x: { + grid: { + display: false, + }, + border: { + display: true, + color: chartTheme.grid, + }, + type: 'time', + ticks: { + autoSkip: true, + autoSkipPadding: 50, + maxRotation: 0, + align: 'start', + }, + time: { + unit: 'day', + }, + }, + y: { + grid: { + color: chartTheme.grid, + drawTicks: false, + }, + border: { + display: false, + color: chartTheme.grid, + dash: [3, 3], + }, + position: 'right', + ticks: { + crossAlign: 'far', + }, + }, + }, + elements: { + line: { + borderWidth: 1, + }, + point: { + radius: 0, + }, + }, + layout: { + padding: { + top: 30, // Depended on by `verticalLinePlugin` + }, + }, + borderColor: (ctx) => { + const gradient = ctx.chart.ctx.createLinearGradient( + 0, + 0, + ctx.chart.width, + ctx.chart.height, + ); + gradient.addColorStop(0, chartTheme.primary2); + gradient.addColorStop(1, chartTheme.primary1); + return gradient; + }, + }; + if (props.options) { + options = mergeDeepRight(props.options, options) as ChartOptions<'line'>; + } + return ( + + ); +}; + +const verticalLinePlugin = (theme: Theme) => { + const plugin: Plugin<'line'> = { + id: 'verticalLineAtIndex', + afterDraw: (chart) => { + const active = chart.getActiveElements(); + if (active[0]) { + const ctx = chart.ctx; + const x = active[0].element.x; + const data = chart.data.datasets[0].data[ + active[0].index + ] as unknown as { + x: Date; + y: number; + }; + + const heightAboveChart = 30; + ctx.save(); + ctx.beginPath(); + ctx.moveTo(x, chart.chartArea.top - heightAboveChart); + ctx.lineTo(x, chart.chartArea.bottom); + ctx.setLineDash([2, 2]); + ctx.strokeStyle = chartTheme.position; + ctx.lineWidth = 0.5; + ctx.stroke(); + ctx.font = '0.875rem Inter'; + ctx.fillStyle = theme.palette.text.primary; + const text = intlFormat(data.x); + const textSize = ctx.measureText(text); + const fromLeft = + x + textSize.actualBoundingBoxRight <= chart.chartArea.right; + ctx.textAlign = fromLeft ? 'start' : 'end'; + ctx.fillText( + intlFormat(data.x, { + year: 'numeric', + month: 'numeric', + day: 'numeric', + hour: 'numeric', + minute: 'numeric', + }), + x + (fromLeft ? heightAboveChart : -heightAboveChart) / 2, + chart.chartArea.top - + heightAboveChart + + textSize.actualBoundingBoxAscent, + ); + ctx.restore(); + } + }, + }; + return plugin; +}; diff --git a/libs/analytics/src/index.ts b/libs/analytics/src/index.ts new file mode 100644 index 000000000..dd238161b --- /dev/null +++ b/libs/analytics/src/index.ts @@ -0,0 +1 @@ +export * from './TimeLineChart'; diff --git a/libs/analytics/tsconfig.json b/libs/analytics/tsconfig.json new file mode 100644 index 000000000..95cfeb243 --- /dev/null +++ b/libs/analytics/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": false, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "extends": "../../tsconfig.base.json" +} diff --git a/libs/analytics/tsconfig.lib.json b/libs/analytics/tsconfig.lib.json new file mode 100644 index 000000000..0964e4725 --- /dev/null +++ b/libs/analytics/tsconfig.lib.json @@ -0,0 +1,30 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [ + "node", + "@nx/react/typings/cssmodule.d.ts", + "@nx/react/typings/image.d.ts", + "../shared/theme/src/theme.d.ts", + "../../apps/oeth/src/env.d.ts" + ] + }, + "exclude": [ + "jest.config.ts", + "src/**/*.spec.ts", + "src/**/*.test.ts", + "src/**/*.spec.tsx", + "src/**/*.test.tsx", + "src/**/*.spec.js", + "src/**/*.test.js", + "src/**/*.spec.jsx", + "src/**/*.test.jsx" + ], + "include": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.ts", + "src/**/*.tsx" + ] +} diff --git a/libs/financial-statement/.babelrc b/libs/financial-statement/.babelrc new file mode 100644 index 000000000..1ea870ead --- /dev/null +++ b/libs/financial-statement/.babelrc @@ -0,0 +1,12 @@ +{ + "presets": [ + [ + "@nx/react/babel", + { + "runtime": "automatic", + "useBuiltIns": "usage" + } + ] + ], + "plugins": [] +} diff --git a/libs/financial-statement/.eslintrc.json b/libs/financial-statement/.eslintrc.json new file mode 100644 index 000000000..78d5588fd --- /dev/null +++ b/libs/financial-statement/.eslintrc.json @@ -0,0 +1,34 @@ +{ + "extends": [ + "plugin:@nx/react", + "../../.eslintrc.json" + ], + "ignorePatterns": [ + "!**/*" + ], + "overrides": [ + { + "files": [ + "*.ts", + "*.tsx", + "*.js", + "*.jsx" + ], + "rules": {} + }, + { + "files": [ + "*.ts", + "*.tsx" + ], + "rules": {} + }, + { + "files": [ + "*.js", + "*.jsx" + ], + "rules": {} + } + ] +} diff --git a/libs/financial-statement/README.md b/libs/financial-statement/README.md new file mode 100644 index 000000000..896f5172c --- /dev/null +++ b/libs/financial-statement/README.md @@ -0,0 +1,7 @@ +# financial-statement + +This library was generated with [Nx](https://nx.dev). + +## Running unit tests + +Run `nx test financial-statement` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/libs/financial-statement/package.json b/libs/financial-statement/package.json new file mode 100644 index 000000000..dc344a9db --- /dev/null +++ b/libs/financial-statement/package.json @@ -0,0 +1,12 @@ +{ + "name": "@origin/financial-statement", + "version": "0.0.5", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/libs/financial-statement/project.json b/libs/financial-statement/project.json new file mode 100644 index 000000000..9fd87d021 --- /dev/null +++ b/libs/financial-statement/project.json @@ -0,0 +1,38 @@ +{ + "name": "financial-statement", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "libs/financial-statement/src", + "projectType": "library", + "tags": [], + "targets": { + "lint": { + "executor": "@nx/linter:eslint", + "outputs": [ + "{options.outputFile}" + ], + "options": { + "lintFilePatterns": [ + "libs/financial-statement/**/*.{ts,tsx,js,jsx}" + ] + } + }, + "build": { + "executor": "@nx/vite:build", + "outputs": [ + "{options.outputPath}" + ], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/libs/financial-statement" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } + } + } +} diff --git a/libs/financial-statement/src/FinancialStatement.generated.ts b/libs/financial-statement/src/FinancialStatement.generated.ts new file mode 100644 index 000000000..66d546009 --- /dev/null +++ b/libs/financial-statement/src/FinancialStatement.generated.ts @@ -0,0 +1,132 @@ +import { graphqlClient } from '@origin/oeth/shared'; +import { useQuery } from '@tanstack/react-query'; + +import type * as Types from '@origin/oeth/shared'; +import type { UseQueryOptions } from '@tanstack/react-query'; +export type FinancialStatementQueryVariables = Types.Exact<{ + compareDate?: Types.InputMaybe; +}>; + +export type FinancialStatementQuery = { + __typename?: 'Query'; + oeths: Array<{ + __typename?: 'OETH'; + blockNumber: number; + timestamp: string; + totalSupply: string; + }>; + curveLps: Array<{ + __typename?: 'CurveLP'; + blockNumber: number; + timestamp: string; + eth: string; + ethOwned: string; + oeth: string; + oethOwned: string; + totalSupply: string; + totalSupplyOwned: string; + }>; + morphoAaves: Array<{ + __typename?: 'MorphoAave'; + blockNumber: number; + timestamp: string; + weth: string; + }>; + fraxStakings: Array<{ + __typename?: 'FraxStaking'; + blockNumber: number; + timestamp: string; + frxETH: string; + }>; + drippers: Array<{ + __typename?: 'Dripper'; + blockNumber: number; + timestamp: string; + weth: string; + }>; + vaults: Array<{ + __typename?: 'Vault'; + blockNumber: number; + timestamp: string; + weth: string; + rETH: string; + stETH: string; + frxETH: string; + }>; +}; + +export const FinancialStatementDocument = ` + query FinancialStatement($compareDate: DateTime) { + oeths(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + totalSupply + } + curveLps(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + eth + ethOwned + oeth + oethOwned + totalSupply + totalSupplyOwned + } + morphoAaves(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + weth + } + fraxStakings(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + frxETH + } + drippers(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + weth + } + vaults(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + weth + rETH + stETH + frxETH + } +} + `; +export const useFinancialStatementQuery = < + TData = FinancialStatementQuery, + TError = unknown, +>( + variables?: FinancialStatementQueryVariables, + options?: UseQueryOptions, +) => + useQuery( + variables === undefined + ? ['FinancialStatement'] + : ['FinancialStatement', variables], + graphqlClient( + FinancialStatementDocument, + variables, + ), + options, + ); + +useFinancialStatementQuery.getKey = ( + variables?: FinancialStatementQueryVariables, +) => + variables === undefined + ? ['FinancialStatement'] + : ['FinancialStatement', variables]; +useFinancialStatementQuery.fetcher = ( + variables?: FinancialStatementQueryVariables, + options?: RequestInit['headers'], +) => + graphqlClient( + FinancialStatementDocument, + variables, + options, + ); diff --git a/libs/financial-statement/src/FinancialStatement.graphql b/libs/financial-statement/src/FinancialStatement.graphql new file mode 100644 index 000000000..a7d29425a --- /dev/null +++ b/libs/financial-statement/src/FinancialStatement.graphql @@ -0,0 +1,40 @@ +query FinancialStatement($compareDate: DateTime) { + oeths(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + totalSupply + } + curveLps(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + eth + ethOwned + oeth + oethOwned + totalSupply + totalSupplyOwned + } + morphoAaves(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + weth + } + fraxStakings(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + frxETH + } + drippers(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + weth + } + vaults(limit: 1, orderBy: id_DESC, where: {timestamp_lt: $compareDate}) { + blockNumber + timestamp + weth + rETH + stETH + frxETH + } +} diff --git a/libs/financial-statement/src/FinancialStatement.stories.tsx b/libs/financial-statement/src/FinancialStatement.stories.tsx new file mode 100644 index 000000000..73f0fd27c --- /dev/null +++ b/libs/financial-statement/src/FinancialStatement.stories.tsx @@ -0,0 +1,82 @@ +import { faker } from '@faker-js/faker'; +import { queryClient } from '@origin/oeth/shared'; +import { QueryClientProvider } from '@tanstack/react-query'; + +import { + FinancialStatement, + LiveFinancialStatement, +} from './FinancialStatement'; + +import type { Meta, StoryObj } from '@storybook/react'; + +faker.seed(4548); + +function array(n: number, initial: T, fn: (last: T) => T) { + let last: T = initial; + return new Array(n).fill(0).map((_, index) => { + if (index === 0) return last; + return (last = fn(last)); + }); +} + +function randomValues(min = 100000, max = 30000000) { + return array(2, faker.number.int({ min, max }), (last) => + faker.number.int({ min: last * 0.75, max: last * 1.25 }), + ); +} + +const meta: Meta = { + component: FinancialStatement, + title: 'Analytics/FinancialStatement', + args: { + ethPrice: 1659.47, + lastUpdated: { + blockNumber: 18036316, + timestamp: Date.parse('2023-09-03T21:42:03Z'), + }, + columns: ['1 week ago', '31 August 2023'], + data: { + assets: { + Vault: { + ETH: [125000, 0], + WETH: [125000, 1], + stETH: [0, 125000], + rETH: [1, 125000], + frxETH: [0, 0], + }, + Curve: { + ETH: randomValues(), + OETH: randomValues(), + }, + 'Frax Staking': { + ETH: randomValues(), + OETH: randomValues(), + }, + 'Morpho Aave': { + WETH: randomValues(), + }, + Dripper: { + WETH: randomValues(20000, 50000), + }, + }, + liabilities: { + 'Token supply': { + OETH: randomValues(2000000, 40000000), + }, + }, + }, + }, + render: (args) => , +}; + +export default meta; + +export const Default: StoryObj = {}; + +export const Live = () => { + return ( + + + + ); +}; diff --git a/libs/financial-statement/src/FinancialStatement.tsx b/libs/financial-statement/src/FinancialStatement.tsx new file mode 100644 index 000000000..8a140e26f --- /dev/null +++ b/libs/financial-statement/src/FinancialStatement.tsx @@ -0,0 +1,520 @@ +import { createContext, useContext, useState } from 'react'; + +import { + alpha, + Box, + Button, + Experimental_CssVarsProvider as CssVarsProvider, + Paper, + Stack, + Typography, + useMediaQuery, + useTheme, +} from '@mui/material'; +import { queryClient } from '@origin/oeth/shared'; +import { useChainlinkEthUsd } from '@origin/shared/providers'; +import { theme } from '@origin/shared/theme'; +import { QueryClientProvider } from '@tanstack/react-query'; +import { + endOfToday, + intlFormat, + intlFormatDistance, + startOfDay, + subDays, +} from 'date-fns'; +import { IntlProvider, useIntl } from 'react-intl'; +import { formatEther } from 'viem'; + +import * as colors from './colors'; +import { useFinancialStatementQuery } from './FinancialStatement.generated'; + +const calculateChange = (from: number, to: number) => { + if (from === 0 && to === 0) return 0; + const change = -(1 - to / from); + const mod = to < 0 ? -1 : 1; + const result = + (Math[change > 0 ? 'floor' : 'ceil'](change * 10000) / 100) * mod; + if (result.toFixed(2) === '0.00') return 0; // Weed out tiny rounding issues + return result; +}; + +const getTotals = (data: Record>) => { + return Object.values(data).reduce((totals, section) => { + for (const asset of Object.values(section)) { + for (let i = 0; i < asset.length; i++) { + totals[i] = (totals[i] ?? 0) + asset[i]; + } + } + return totals; + }, [] as number[]); +}; + +export default function SelfContainedFinancialStatement() { + return ( + + + + + + + + ); +} + +export const LiveFinancialStatement = () => { + const todayEnd = endOfToday(); + const sevenDaysAgo = startOfDay(subDays(todayEnd, 7)); + + const { isLoading: fsIsLoading, data: fs } = useFinancialStatementQuery({ + compareDate: endOfToday, + }); + const { isLoading: fsCIsLoading, data: fsC } = useFinancialStatementQuery({ + compareDate: sevenDaysAgo, + }); + const { isLoading: ethPriceIsLoading, data: ethPrice } = useChainlinkEthUsd(); + + if (fsIsLoading || !fs) return null; + if (fsCIsLoading || !fsC) return null; + if (ethPriceIsLoading || !ethPrice) return null; + + const c = (n?: string) => Number(formatEther(BigInt(n ?? 0))); + + const blockNumber = Math.max( + fs.vaults[0]?.blockNumber, + fs.curveLps[0]?.blockNumber, + fs.morphoAaves[0]?.blockNumber, + fs.drippers[0]?.blockNumber, + fs.oeths[0]?.blockNumber, + fs.fraxStakings[0]?.blockNumber, + ); + const timestamp = Math.max( + Date.parse(fs.vaults[0]?.timestamp), + Date.parse(fs.curveLps[0]?.timestamp), + Date.parse(fs.morphoAaves[0]?.timestamp), + Date.parse(fs.drippers[0]?.timestamp), + Date.parse(fs.oeths[0]?.timestamp), + Date.parse(fs.fraxStakings[0]?.timestamp), + ); + + return ( + + ); +}; + +const FinancialStatementContext = createContext({ + ethPrice: undefined as number | undefined, + showUsdPrice: false, +}); + +export const FinancialStatement = (props: { + ethPrice?: number; + lastUpdated: { + blockNumber: number; + timestamp: number; + }; + columns: string[]; + data: Record< + 'assets' | 'liabilities', + Record> + >; +}) => { + const intl = useIntl(); + const assetTotals = getTotals(props.data['assets']); + const liabilityTotals = getTotals(props.data['liabilities']); + const [showUsdPrice, setShowUsdPrice] = useState(!!props.ethPrice); + + return ( + + theme.palette.text.primary} + fontFamily={'Inter'} + fontSize={{ xs: '.7rem', sm: '.875rem' }} + > + + theme.palette.background.paper, + }} + > + + + + +
+ +
+ + + val - liabilityTotals[index], + )} + /> + + theme.palette.primary.contrastText} + > + + {`Last updated ${intlFormat(props.lastUpdated.timestamp)}, `} + {`block #${props.lastUpdated.blockNumber}`} + + + {props.ethPrice && + `Using ETH price of $${intl.formatNumber(props.ethPrice, { + maximumFractionDigits: 2, + })} from Chainlink`} + + + + + ); +}; + +const Header = (props: { columns: string[] }) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); + const columnWeight = props.columns.length + 2; + return ( + + theme.palette.primary.contrastText} + sx={{ + backgroundColor: (theme) => theme.palette.background.paperHeader, + }} + fontSize={{ xs: '.75rem', sm: '.875rem', md: '1rem' }} + px={{ xs: 1, sm: 2, md: 4 }} + py={{ xs: 2, sm: 3, md: 4 }} + > + + {props.columns.map((column) => ( + + {column} + + ))} + + {isMobile ? 'Diff' : 'Difference'} + + + + ); +}; + +const Table = (props: { + title: string; + data: Record>; + totals: number[]; +}) => { + return ( + + + {/* Header */} + theme.palette.primary.contrastText} + fontSize={{ xs: '.875rem', sm: '1rem' }} + sx={{ + borderBottomStyle: 'solid', + borderBottomWidth: 1, + borderBottomColor: (theme) => theme.palette.grey['700'], + }} + > + {props.title} + + + {/* Body */} + + {Object.entries(props.data).map(([title, data]) => ( +
+ ))} + + + {/* Total */} + + + + ); +}; + +const Total = (props: { title: string; totals: number[] }) => { + const columnWeight = props.totals.length + 2; + return ( + theme.palette.primary.contrastText} + sx={{ backgroundColor: (theme) => theme.palette.background.paperFooter }} + > + + {props.title.toUpperCase()} + + {props.totals.map((value, index) => ( + + ))} + + + ); +}; + +const Section = (props: { title: string; data: Record }) => { + return ( + theme.palette.grey['700'], + }} + px={{ xs: 1, sm: 2, md: 4 }} + gap={{ xs: 1, sm: 2, md: 4 }} + pt={{ xs: 1, sm: 2, md: 4 }} + > + theme.palette.primary.contrastText} + > + {props.title} + + + {Object.entries(props.data).map(([title, data]) => ( + + ))} + + + ); +}; + +const Asset = (props: { title: string; data: number[] }) => { + const columnWeight = props.data.length + 2; + return ( + + + + {props.title} + + {props.data.map((value, index) => ( + + ))} + + + + ); +}; + +export const DataColumn = ({ + value, + columnWeight, +}: { + value: number; + columnWeight: number; +}) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); + const intl = useIntl(); + const { showUsdPrice, ethPrice } = useContext(FinancialStatementContext); + return ( + theme.palette.primary.contrastText} + ml={1} + > + theme.palette.text.primary} + pr={{ xs: 0.1, sm: 0.15, md: 0.2 }} + > + {showUsdPrice && ethPrice ? '$' : 'Ξ'} + + {intl.formatNumber(showUsdPrice && ethPrice ? value * ethPrice : value, { + notation: isMobile ? 'compact' : 'standard', + maximumFractionDigits: isMobile ? 1 : 2, + })} + + ); +}; + +export const ChangeColumn = ({ + values, + columnWeight, +}: { + values: number[]; + columnWeight: number; +}) => { + const theme = useTheme(); + const isMobile = useMediaQuery(theme.breakpoints.down('sm')); + const intl = useIntl(); + const change = calculateChange( + values[values.length - 2], + values[values.length - 1], + ); + return ( + + change > 0 + ? colors.positive + : change < 0 + ? colors.negative + : theme.palette.text.primary + } + > + {isFinite(change) && change > 0 && '+'} + {!isNaN(change) && + isFinite(change) && + `${intl.formatNumber(change, { + notation: isMobile ? 'compact' : 'standard', + maximumFractionDigits: isMobile ? 1 : 2, + })}%`} + + ); +}; diff --git a/libs/financial-statement/src/colors.ts b/libs/financial-statement/src/colors.ts new file mode 100644 index 000000000..7724db78d --- /dev/null +++ b/libs/financial-statement/src/colors.ts @@ -0,0 +1,2 @@ +export const positive = '#6af18f'; +export const negative = '#D44E66'; diff --git a/libs/financial-statement/src/index.ts b/libs/financial-statement/src/index.ts new file mode 100644 index 000000000..06500c227 --- /dev/null +++ b/libs/financial-statement/src/index.ts @@ -0,0 +1,2 @@ +export * from './FinancialStatement'; +export { default } from './FinancialStatement'; diff --git a/libs/financial-statement/tsconfig.json b/libs/financial-statement/tsconfig.json new file mode 100644 index 000000000..29f9136bb --- /dev/null +++ b/libs/financial-statement/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": false, + "esModuleInterop": false, + "allowSyntheticDefaultImports": true, + "strict": false, + "types": [ + "vite/client" + ] + }, + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "extends": "../../tsconfig.base.json" +} diff --git a/libs/financial-statement/tsconfig.lib.json b/libs/financial-statement/tsconfig.lib.json new file mode 100644 index 000000000..380fb00a1 --- /dev/null +++ b/libs/financial-statement/tsconfig.lib.json @@ -0,0 +1,32 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": [ + "node", + "vite/client" + ] + }, + "files": [ + "../../node_modules/@nx/react/typings/cssmodule.d.ts", + "../../node_modules/@nx/react/typings/image.d.ts", + "../../libs/shared/theme/src/theme.d.ts", + "../../apps/oeth/src/env.d.ts" + ], + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.ts", + "src/**/*.tsx" + ] +} diff --git a/libs/financial-statement/vite.config.ts b/libs/financial-statement/vite.config.ts new file mode 100644 index 000000000..d0e3b91da --- /dev/null +++ b/libs/financial-statement/vite.config.ts @@ -0,0 +1,42 @@ +/// +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import react from '@vitejs/plugin-react'; +import * as path from 'path'; +import { defineConfig } from 'vite'; +import dts from 'vite-plugin-dts'; + +export default defineConfig({ + cacheDir: '../../node_modules/.vite/financial-statement', + + plugins: [ + dts({ + entryRoot: 'src', + tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'), + }), + react(), + nxViteTsPaths(), + ], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'financial-statement', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, +}); diff --git a/libs/oeth/history/src/components/HistoryCard.tsx b/libs/oeth/history/src/components/HistoryCard.tsx index 81b8b189b..e75c08abe 100644 --- a/libs/oeth/history/src/components/HistoryCard.tsx +++ b/libs/oeth/history/src/components/HistoryCard.tsx @@ -10,12 +10,14 @@ import { ExportData } from './ExportData'; import { HistoryFilters } from './HistoryFilters'; import { HistoryTable } from './HistoryTable'; +import type { HistoryType } from '@origin/oeth/shared'; + const PAGE_SIZE = 20; export function HistoryCard() { const intl = useIntl(); const [page, setPage] = useState(0); - const [filters, setFilters] = useState([]); + const [filters, setFilters] = useState([]); const { address, isConnected } = useAccount(); const { data, isFetching } = useHistoryTableWithFiltersQuery( diff --git a/libs/oeth/history/src/components/HistoryFilters.tsx b/libs/oeth/history/src/components/HistoryFilters.tsx index a0efc550a..b55763624 100644 --- a/libs/oeth/history/src/components/HistoryFilters.tsx +++ b/libs/oeth/history/src/components/HistoryFilters.tsx @@ -11,6 +11,7 @@ import { Typography, useTheme, } from '@mui/material'; +import { HistoryType } from '@origin/oeth/shared'; import { isNilOrEmpty } from '@origin/shared/utils'; import { defineMessage, useIntl } from 'react-intl'; @@ -23,26 +24,38 @@ const styles = { }; const filterOptions = [ - { label: defineMessage({ defaultMessage: 'Yield' }), value: 'Yield' }, - { label: defineMessage({ defaultMessage: 'Swap' }), value: 'Swap' }, - { label: defineMessage({ defaultMessage: 'Sent' }), value: 'Sent' }, - { label: defineMessage({ defaultMessage: 'Received' }), value: 'Received' }, + { + label: defineMessage({ defaultMessage: 'Yield' }), + value: HistoryType.Yield, + }, + { + label: defineMessage({ defaultMessage: 'Swap' }), + value: HistoryType.Swap, + }, + { + label: defineMessage({ defaultMessage: 'Sent' }), + value: HistoryType.Sent, + }, + { + label: defineMessage({ defaultMessage: 'Received' }), + value: HistoryType.Received, + }, ]; export type HistoryFiltersProps = { - filters: string[]; - onChange: (values: string[]) => void; + filters: HistoryType[]; + onChange: (values: HistoryType[]) => void; }; export function HistoryFilters({ filters, onChange }: HistoryFiltersProps) { - const [selected, setSelectedTypes] = useState(filters); + const [selected, setSelectedTypes] = useState(filters); const intl = useIntl(); const theme = useTheme(); const [anchorEl, setAnchorEl] = useState(null); const handleSelect = ( e: React.ChangeEvent, - label: string, + label: HistoryType, ) => { setSelectedTypes((prev) => { if (e.target.checked) { diff --git a/libs/oeth/history/src/queries.generated.ts b/libs/oeth/history/src/queries.generated.ts index e6913fc17..c351550b9 100644 --- a/libs/oeth/history/src/queries.generated.ts +++ b/libs/oeth/history/src/queries.generated.ts @@ -12,19 +12,19 @@ export type HistoryTableQuery = { __typename?: 'Query'; addressById?: { __typename?: 'Address'; - balance: number; - earned: number; + balance: string; + earned: string; isContract: boolean; - rebasingOption: string; - credits: any; - lastUpdated: any; + rebasingOption: Types.RebasingOption; + credits: string; + lastUpdated: string; history: Array<{ __typename?: 'History'; - type: string; - value: number; + type: Types.HistoryType; + value: string; txHash: string; - timestamp: any; - balance: number; + timestamp: string; + balance: string; }>; } | null; }; @@ -32,27 +32,25 @@ export type HistoryTableQuery = { export type HistoryTableWithFiltersQueryVariables = Types.Exact<{ address: Types.Scalars['String']['input']; offset: Types.Scalars['Int']['input']; - filters?: Types.InputMaybe< - Array | Types.Scalars['String']['input'] - >; + filters?: Types.InputMaybe | Types.HistoryType>; }>; export type HistoryTableWithFiltersQuery = { __typename?: 'Query'; addressById?: { __typename?: 'Address'; - balance: number; - earned: number; + balance: string; + earned: string; isContract: boolean; - rebasingOption: string; - lastUpdated: any; + rebasingOption: Types.RebasingOption; + lastUpdated: string; history: Array<{ __typename?: 'History'; - type: string; - value: number; + type: Types.HistoryType; + value: string; txHash: string; - timestamp: any; - balance: number; + timestamp: string; + balance: string; }>; } | null; }; @@ -113,7 +111,7 @@ useHistoryTableQuery.fetcher = ( options, ); export const HistoryTableWithFiltersDocument = ` - query HistoryTableWithFilters($address: String!, $offset: Int!, $filters: [String!]) { + query HistoryTableWithFilters($address: String!, $offset: Int!, $filters: [HistoryType!]) { addressById(id: $address) { balance earned diff --git a/libs/oeth/history/src/queries.graphql b/libs/oeth/history/src/queries.graphql index 856707099..dd2da7be0 100644 --- a/libs/oeth/history/src/queries.graphql +++ b/libs/oeth/history/src/queries.graphql @@ -19,7 +19,7 @@ query HistoryTable($address: String!, $offset: Int!) { query HistoryTableWithFilters( $address: String! $offset: Int! - $filters: [String!] + $filters: [HistoryType!] ) { addressById(id: $address) { balance diff --git a/libs/oeth/shared/.babelrc b/libs/oeth/shared/.babelrc index 9f606b4ff..1ea870ead 100644 --- a/libs/oeth/shared/.babelrc +++ b/libs/oeth/shared/.babelrc @@ -4,12 +4,9 @@ "@nx/react/babel", { "runtime": "automatic", - "useBuiltIns": "usage", - "importSource": "@emotion/react" + "useBuiltIns": "usage" } ] ], - "plugins": [ - "@emotion/babel-plugin" - ] + "plugins": [] } diff --git a/libs/oeth/shared/README.md b/libs/oeth/shared/README.md index 06209ca3c..4363b6d83 100644 --- a/libs/oeth/shared/README.md +++ b/libs/oeth/shared/README.md @@ -4,4 +4,4 @@ This library was generated with [Nx](https://nx.dev). ## Running unit tests -Run `nx test oeth-shared` to execute the unit tests via [Jest](https://jestjs.io). +Run `nx test oeth-shared` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/libs/oeth/shared/codegen.ts b/libs/oeth/shared/codegen.ts index d6642c245..144a7e360 100644 --- a/libs/oeth/shared/codegen.ts +++ b/libs/oeth/shared/codegen.ts @@ -7,6 +7,12 @@ const config: CodegenConfig = { documents: ['**/src/**/*.graphql'], plugins: ['typescript'], hooks: { afterOneFileWrite: ['prettier --write', 'eslint --fix'] }, + config: { + scalars: { + BigInt: 'string', + DateTime: 'string', + }, + }, }, 'libs/oeth/': { schema: process.env.VITE_SUBSQUID_URL, @@ -24,6 +30,10 @@ const config: CodegenConfig = { fetcher: { func: '@origin/oeth/shared#graphqlClient', }, + scalars: { + BigInt: 'string', + DateTime: 'string', + }, }, }, }, diff --git a/libs/oeth/shared/package.json b/libs/oeth/shared/package.json new file mode 100644 index 000000000..fb09ea1b7 --- /dev/null +++ b/libs/oeth/shared/package.json @@ -0,0 +1,12 @@ +{ + "name": "@origin/oeth/shared", + "version": "0.0.1", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/libs/oeth/shared/project.json b/libs/oeth/shared/project.json index 1bd971a92..8cbcef75e 100644 --- a/libs/oeth/shared/project.json +++ b/libs/oeth/shared/project.json @@ -23,6 +23,24 @@ "libs/oeth/shared/**/*.{ts,tsx,js,jsx}" ] } + }, + "build": { + "executor": "@nx/vite:build", + "outputs": [ + "{options.outputPath}" + ], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/libs/oeth/shared" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } } } } diff --git a/libs/oeth/shared/src/clients/graphql.ts b/libs/oeth/shared/src/clients/graphql.ts index 69069cc09..e19fac5a7 100644 --- a/libs/oeth/shared/src/clients/graphql.ts +++ b/libs/oeth/shared/src/clients/graphql.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-unused-vars */ import axios from 'axios'; export const axiosInstance = axios.create({ diff --git a/libs/oeth/shared/src/generated/graphql.ts b/libs/oeth/shared/src/generated/graphql.ts index 6dfa0d6a2..fb04510f3 100644 --- a/libs/oeth/shared/src/generated/graphql.ts +++ b/libs/oeth/shared/src/generated/graphql.ts @@ -1,19 +1,32 @@ export type Maybe = T | null; export type InputMaybe = Maybe; -export type Exact = { [K in keyof T]: T[K] }; -export type MakeOptional = Omit & { [SubKey in K]?: Maybe }; -export type MakeMaybe = Omit & { [SubKey in K]: Maybe }; -export type MakeEmpty = { [_ in K]?: never }; -export type Incremental = T | { [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never }; +export type Exact = { + [K in keyof T]: T[K]; +}; +export type MakeOptional = Omit & { + [SubKey in K]?: Maybe; +}; +export type MakeMaybe = Omit & { + [SubKey in K]: Maybe; +}; +export type MakeEmpty< + T extends { [key: string]: unknown }, + K extends keyof T, +> = { [_ in K]?: never }; +export type Incremental = + | T + | { + [P in keyof T]?: P extends ' $fragmentName' | '__typename' ? T[P] : never; + }; /** All built-in and custom scalars, mapped to their actual values */ export type Scalars = { - ID: { input: string; output: string; } - String: { input: string; output: string; } - Boolean: { input: boolean; output: boolean; } - Int: { input: number; output: number; } - Float: { input: number; output: number; } - BigInt: { input: any; output: any; } - DateTime: { input: any; output: any; } + ID: { input: string; output: string }; + String: { input: string; output: string }; + Boolean: { input: boolean; output: boolean }; + Int: { input: number; output: number }; + Float: { input: number; output: number }; + BigInt: { input: string; output: string }; + DateTime: { input: string; output: string }; }; export type Apy = { @@ -76,7 +89,7 @@ export enum ApyOrderByInput { TxHashAsc = 'txHash_ASC', TxHashAscNullsFirst = 'txHash_ASC_NULLS_FIRST', TxHashDesc = 'txHash_DESC', - TxHashDescNullsLast = 'txHash_DESC_NULLS_LAST' + TxHashDescNullsLast = 'txHash_DESC_NULLS_LAST', } export type ApyWhereInput = { @@ -161,7 +174,9 @@ export type ApyWhereInput = { rebasingCreditsPerToken_lt?: InputMaybe; rebasingCreditsPerToken_lte?: InputMaybe; rebasingCreditsPerToken_not_eq?: InputMaybe; - rebasingCreditsPerToken_not_in?: InputMaybe>; + rebasingCreditsPerToken_not_in?: InputMaybe< + Array + >; timestamp_eq?: InputMaybe; timestamp_gt?: InputMaybe; timestamp_gte?: InputMaybe; @@ -199,17 +214,16 @@ export type APiesConnection = { export type Address = { __typename?: 'Address'; - balance: Scalars['Float']['output']; + balance: Scalars['BigInt']['output']; credits: Scalars['BigInt']['output']; - earned: Scalars['Float']['output']; + earned: Scalars['BigInt']['output']; history: Array; id: Scalars['String']['output']; isContract: Scalars['Boolean']['output']; lastUpdated: Scalars['DateTime']['output']; - rebasingOption: Scalars['String']['output']; + rebasingOption: RebasingOption; }; - export type AddressHistoryArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -251,21 +265,21 @@ export enum AddressOrderByInput { RebasingOptionAsc = 'rebasingOption_ASC', RebasingOptionAscNullsFirst = 'rebasingOption_ASC_NULLS_FIRST', RebasingOptionDesc = 'rebasingOption_DESC', - RebasingOptionDescNullsLast = 'rebasingOption_DESC_NULLS_LAST' + RebasingOptionDescNullsLast = 'rebasingOption_DESC_NULLS_LAST', } export type AddressWhereInput = { AND?: InputMaybe>; OR?: InputMaybe>; - balance_eq?: InputMaybe; - balance_gt?: InputMaybe; - balance_gte?: InputMaybe; - balance_in?: InputMaybe>; + balance_eq?: InputMaybe; + balance_gt?: InputMaybe; + balance_gte?: InputMaybe; + balance_in?: InputMaybe>; balance_isNull?: InputMaybe; - balance_lt?: InputMaybe; - balance_lte?: InputMaybe; - balance_not_eq?: InputMaybe; - balance_not_in?: InputMaybe>; + balance_lt?: InputMaybe; + balance_lte?: InputMaybe; + balance_not_eq?: InputMaybe; + balance_not_in?: InputMaybe>; credits_eq?: InputMaybe; credits_gt?: InputMaybe; credits_gte?: InputMaybe; @@ -275,15 +289,15 @@ export type AddressWhereInput = { credits_lte?: InputMaybe; credits_not_eq?: InputMaybe; credits_not_in?: InputMaybe>; - earned_eq?: InputMaybe; - earned_gt?: InputMaybe; - earned_gte?: InputMaybe; - earned_in?: InputMaybe>; + earned_eq?: InputMaybe; + earned_gt?: InputMaybe; + earned_gte?: InputMaybe; + earned_in?: InputMaybe>; earned_isNull?: InputMaybe; - earned_lt?: InputMaybe; - earned_lte?: InputMaybe; - earned_not_eq?: InputMaybe; - earned_not_in?: InputMaybe>; + earned_lt?: InputMaybe; + earned_lte?: InputMaybe; + earned_not_eq?: InputMaybe; + earned_not_in?: InputMaybe>; history_every?: InputMaybe; history_none?: InputMaybe; history_some?: InputMaybe; @@ -316,23 +330,11 @@ export type AddressWhereInput = { lastUpdated_lte?: InputMaybe; lastUpdated_not_eq?: InputMaybe; lastUpdated_not_in?: InputMaybe>; - rebasingOption_contains?: InputMaybe; - rebasingOption_containsInsensitive?: InputMaybe; - rebasingOption_endsWith?: InputMaybe; - rebasingOption_eq?: InputMaybe; - rebasingOption_gt?: InputMaybe; - rebasingOption_gte?: InputMaybe; - rebasingOption_in?: InputMaybe>; + rebasingOption_eq?: InputMaybe; + rebasingOption_in?: InputMaybe>; rebasingOption_isNull?: InputMaybe; - rebasingOption_lt?: InputMaybe; - rebasingOption_lte?: InputMaybe; - rebasingOption_not_contains?: InputMaybe; - rebasingOption_not_containsInsensitive?: InputMaybe; - rebasingOption_not_endsWith?: InputMaybe; - rebasingOption_not_eq?: InputMaybe; - rebasingOption_not_in?: InputMaybe>; - rebasingOption_not_startsWith?: InputMaybe; - rebasingOption_startsWith?: InputMaybe; + rebasingOption_not_eq?: InputMaybe; + rebasingOption_not_in?: InputMaybe>; }; export type AddressesConnection = { @@ -342,6 +344,343 @@ export type AddressesConnection = { totalCount: Scalars['Int']['output']; }; +export type CurveLp = { + __typename?: 'CurveLP'; + blockNumber: Scalars['Int']['output']; + eth: Scalars['BigInt']['output']; + ethOwned: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + oeth: Scalars['BigInt']['output']; + oethOwned: Scalars['BigInt']['output']; + timestamp: Scalars['DateTime']['output']; + totalSupply: Scalars['BigInt']['output']; + totalSupplyOwned: Scalars['BigInt']['output']; +}; + +export type CurveLpEdge = { + __typename?: 'CurveLPEdge'; + cursor: Scalars['String']['output']; + node: CurveLp; +}; + +export enum CurveLpOrderByInput { + BlockNumberAsc = 'blockNumber_ASC', + BlockNumberAscNullsFirst = 'blockNumber_ASC_NULLS_FIRST', + BlockNumberDesc = 'blockNumber_DESC', + BlockNumberDescNullsLast = 'blockNumber_DESC_NULLS_LAST', + EthOwnedAsc = 'ethOwned_ASC', + EthOwnedAscNullsFirst = 'ethOwned_ASC_NULLS_FIRST', + EthOwnedDesc = 'ethOwned_DESC', + EthOwnedDescNullsLast = 'ethOwned_DESC_NULLS_LAST', + EthAsc = 'eth_ASC', + EthAscNullsFirst = 'eth_ASC_NULLS_FIRST', + EthDesc = 'eth_DESC', + EthDescNullsLast = 'eth_DESC_NULLS_LAST', + IdAsc = 'id_ASC', + IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdDesc = 'id_DESC', + IdDescNullsLast = 'id_DESC_NULLS_LAST', + OethOwnedAsc = 'oethOwned_ASC', + OethOwnedAscNullsFirst = 'oethOwned_ASC_NULLS_FIRST', + OethOwnedDesc = 'oethOwned_DESC', + OethOwnedDescNullsLast = 'oethOwned_DESC_NULLS_LAST', + OethAsc = 'oeth_ASC', + OethAscNullsFirst = 'oeth_ASC_NULLS_FIRST', + OethDesc = 'oeth_DESC', + OethDescNullsLast = 'oeth_DESC_NULLS_LAST', + TimestampAsc = 'timestamp_ASC', + TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampDesc = 'timestamp_DESC', + TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST', + TotalSupplyOwnedAsc = 'totalSupplyOwned_ASC', + TotalSupplyOwnedAscNullsFirst = 'totalSupplyOwned_ASC_NULLS_FIRST', + TotalSupplyOwnedDesc = 'totalSupplyOwned_DESC', + TotalSupplyOwnedDescNullsLast = 'totalSupplyOwned_DESC_NULLS_LAST', + TotalSupplyAsc = 'totalSupply_ASC', + TotalSupplyAscNullsFirst = 'totalSupply_ASC_NULLS_FIRST', + TotalSupplyDesc = 'totalSupply_DESC', + TotalSupplyDescNullsLast = 'totalSupply_DESC_NULLS_LAST', +} + +export type CurveLpWhereInput = { + AND?: InputMaybe>; + OR?: InputMaybe>; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + ethOwned_eq?: InputMaybe; + ethOwned_gt?: InputMaybe; + ethOwned_gte?: InputMaybe; + ethOwned_in?: InputMaybe>; + ethOwned_isNull?: InputMaybe; + ethOwned_lt?: InputMaybe; + ethOwned_lte?: InputMaybe; + ethOwned_not_eq?: InputMaybe; + ethOwned_not_in?: InputMaybe>; + eth_eq?: InputMaybe; + eth_gt?: InputMaybe; + eth_gte?: InputMaybe; + eth_in?: InputMaybe>; + eth_isNull?: InputMaybe; + eth_lt?: InputMaybe; + eth_lte?: InputMaybe; + eth_not_eq?: InputMaybe; + eth_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + oethOwned_eq?: InputMaybe; + oethOwned_gt?: InputMaybe; + oethOwned_gte?: InputMaybe; + oethOwned_in?: InputMaybe>; + oethOwned_isNull?: InputMaybe; + oethOwned_lt?: InputMaybe; + oethOwned_lte?: InputMaybe; + oethOwned_not_eq?: InputMaybe; + oethOwned_not_in?: InputMaybe>; + oeth_eq?: InputMaybe; + oeth_gt?: InputMaybe; + oeth_gte?: InputMaybe; + oeth_in?: InputMaybe>; + oeth_isNull?: InputMaybe; + oeth_lt?: InputMaybe; + oeth_lte?: InputMaybe; + oeth_not_eq?: InputMaybe; + oeth_not_in?: InputMaybe>; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + totalSupplyOwned_eq?: InputMaybe; + totalSupplyOwned_gt?: InputMaybe; + totalSupplyOwned_gte?: InputMaybe; + totalSupplyOwned_in?: InputMaybe>; + totalSupplyOwned_isNull?: InputMaybe; + totalSupplyOwned_lt?: InputMaybe; + totalSupplyOwned_lte?: InputMaybe; + totalSupplyOwned_not_eq?: InputMaybe; + totalSupplyOwned_not_in?: InputMaybe>; + totalSupply_eq?: InputMaybe; + totalSupply_gt?: InputMaybe; + totalSupply_gte?: InputMaybe; + totalSupply_in?: InputMaybe>; + totalSupply_isNull?: InputMaybe; + totalSupply_lt?: InputMaybe; + totalSupply_lte?: InputMaybe; + totalSupply_not_eq?: InputMaybe; + totalSupply_not_in?: InputMaybe>; +}; + +export type CurveLPsConnection = { + __typename?: 'CurveLPsConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + +export type Dripper = { + __typename?: 'Dripper'; + blockNumber: Scalars['Int']['output']; + id: Scalars['String']['output']; + timestamp: Scalars['DateTime']['output']; + weth: Scalars['BigInt']['output']; +}; + +export type DripperEdge = { + __typename?: 'DripperEdge'; + cursor: Scalars['String']['output']; + node: Dripper; +}; + +export enum DripperOrderByInput { + BlockNumberAsc = 'blockNumber_ASC', + BlockNumberAscNullsFirst = 'blockNumber_ASC_NULLS_FIRST', + BlockNumberDesc = 'blockNumber_DESC', + BlockNumberDescNullsLast = 'blockNumber_DESC_NULLS_LAST', + IdAsc = 'id_ASC', + IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdDesc = 'id_DESC', + IdDescNullsLast = 'id_DESC_NULLS_LAST', + TimestampAsc = 'timestamp_ASC', + TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampDesc = 'timestamp_DESC', + TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST', + WethAsc = 'weth_ASC', + WethAscNullsFirst = 'weth_ASC_NULLS_FIRST', + WethDesc = 'weth_DESC', + WethDescNullsLast = 'weth_DESC_NULLS_LAST', +} + +export type DripperWhereInput = { + AND?: InputMaybe>; + OR?: InputMaybe>; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + weth_eq?: InputMaybe; + weth_gt?: InputMaybe; + weth_gte?: InputMaybe; + weth_in?: InputMaybe>; + weth_isNull?: InputMaybe; + weth_lt?: InputMaybe; + weth_lte?: InputMaybe; + weth_not_eq?: InputMaybe; + weth_not_in?: InputMaybe>; +}; + +export type DrippersConnection = { + __typename?: 'DrippersConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + +export type FraxStaking = { + __typename?: 'FraxStaking'; + blockNumber: Scalars['Int']['output']; + frxETH: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + timestamp: Scalars['DateTime']['output']; +}; + +export type FraxStakingEdge = { + __typename?: 'FraxStakingEdge'; + cursor: Scalars['String']['output']; + node: FraxStaking; +}; + +export enum FraxStakingOrderByInput { + BlockNumberAsc = 'blockNumber_ASC', + BlockNumberAscNullsFirst = 'blockNumber_ASC_NULLS_FIRST', + BlockNumberDesc = 'blockNumber_DESC', + BlockNumberDescNullsLast = 'blockNumber_DESC_NULLS_LAST', + FrxEthAsc = 'frxETH_ASC', + FrxEthAscNullsFirst = 'frxETH_ASC_NULLS_FIRST', + FrxEthDesc = 'frxETH_DESC', + FrxEthDescNullsLast = 'frxETH_DESC_NULLS_LAST', + IdAsc = 'id_ASC', + IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdDesc = 'id_DESC', + IdDescNullsLast = 'id_DESC_NULLS_LAST', + TimestampAsc = 'timestamp_ASC', + TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampDesc = 'timestamp_DESC', + TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST', +} + +export type FraxStakingWhereInput = { + AND?: InputMaybe>; + OR?: InputMaybe>; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + frxETH_eq?: InputMaybe; + frxETH_gt?: InputMaybe; + frxETH_gte?: InputMaybe; + frxETH_in?: InputMaybe>; + frxETH_isNull?: InputMaybe; + frxETH_lt?: InputMaybe; + frxETH_lte?: InputMaybe; + frxETH_not_eq?: InputMaybe; + frxETH_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; +}; + +export type FraxStakingsConnection = { + __typename?: 'FraxStakingsConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + export type HistoriesConnection = { __typename?: 'HistoriesConnection'; edges: Array; @@ -352,13 +691,13 @@ export type HistoriesConnection = { export type History = { __typename?: 'History'; address: Address; - balance: Scalars['Float']['output']; + balance: Scalars['BigInt']['output']; blockNumber: Scalars['Int']['output']; id: Scalars['String']['output']; timestamp: Scalars['DateTime']['output']; txHash: Scalars['String']['output']; - type: Scalars['String']['output']; - value: Scalars['Float']['output']; + type: HistoryType; + value: Scalars['BigInt']['output']; }; export type HistoryEdge = { @@ -423,7 +762,14 @@ export enum HistoryOrderByInput { ValueAsc = 'value_ASC', ValueAscNullsFirst = 'value_ASC_NULLS_FIRST', ValueDesc = 'value_DESC', - ValueDescNullsLast = 'value_DESC_NULLS_LAST' + ValueDescNullsLast = 'value_DESC_NULLS_LAST', +} + +export enum HistoryType { + Received = 'Received', + Sent = 'Sent', + Swap = 'Swap', + Yield = 'Yield', } export type HistoryWhereInput = { @@ -431,15 +777,15 @@ export type HistoryWhereInput = { OR?: InputMaybe>; address?: InputMaybe; address_isNull?: InputMaybe; - balance_eq?: InputMaybe; - balance_gt?: InputMaybe; - balance_gte?: InputMaybe; - balance_in?: InputMaybe>; + balance_eq?: InputMaybe; + balance_gt?: InputMaybe; + balance_gte?: InputMaybe; + balance_in?: InputMaybe>; balance_isNull?: InputMaybe; - balance_lt?: InputMaybe; - balance_lte?: InputMaybe; - balance_not_eq?: InputMaybe; - balance_not_in?: InputMaybe>; + balance_lt?: InputMaybe; + balance_lte?: InputMaybe; + balance_not_eq?: InputMaybe; + balance_not_in?: InputMaybe>; blockNumber_eq?: InputMaybe; blockNumber_gt?: InputMaybe; blockNumber_gte?: InputMaybe; @@ -492,78 +838,276 @@ export type HistoryWhereInput = { txHash_not_in?: InputMaybe>; txHash_not_startsWith?: InputMaybe; txHash_startsWith?: InputMaybe; - type_contains?: InputMaybe; - type_containsInsensitive?: InputMaybe; - type_endsWith?: InputMaybe; - type_eq?: InputMaybe; - type_gt?: InputMaybe; - type_gte?: InputMaybe; - type_in?: InputMaybe>; + type_eq?: InputMaybe; + type_in?: InputMaybe>; type_isNull?: InputMaybe; - type_lt?: InputMaybe; - type_lte?: InputMaybe; - type_not_contains?: InputMaybe; - type_not_containsInsensitive?: InputMaybe; - type_not_endsWith?: InputMaybe; - type_not_eq?: InputMaybe; - type_not_in?: InputMaybe>; - type_not_startsWith?: InputMaybe; - type_startsWith?: InputMaybe; - value_eq?: InputMaybe; - value_gt?: InputMaybe; - value_gte?: InputMaybe; - value_in?: InputMaybe>; + type_not_eq?: InputMaybe; + type_not_in?: InputMaybe>; + value_eq?: InputMaybe; + value_gt?: InputMaybe; + value_gte?: InputMaybe; + value_in?: InputMaybe>; value_isNull?: InputMaybe; - value_lt?: InputMaybe; - value_lte?: InputMaybe; - value_not_eq?: InputMaybe; - value_not_in?: InputMaybe>; + value_lt?: InputMaybe; + value_lte?: InputMaybe; + value_not_eq?: InputMaybe; + value_not_in?: InputMaybe>; }; -export type PageInfo = { - __typename?: 'PageInfo'; - endCursor: Scalars['String']['output']; - hasNextPage: Scalars['Boolean']['output']; - hasPreviousPage: Scalars['Boolean']['output']; - startCursor: Scalars['String']['output']; +export type MorphoAave = { + __typename?: 'MorphoAave'; + blockNumber: Scalars['Int']['output']; + id: Scalars['String']['output']; + timestamp: Scalars['DateTime']['output']; + weth: Scalars['BigInt']['output']; }; -export type Query = { - __typename?: 'Query'; - addressById?: Maybe
; - /** @deprecated Use addressById */ - addressByUniqueInput?: Maybe
; - addresses: Array
; - addressesConnection: AddressesConnection; - apies: Array; - apiesConnection: APiesConnection; - apyById?: Maybe; - /** @deprecated Use apyById */ - apyByUniqueInput?: Maybe; - histories: Array; - historiesConnection: HistoriesConnection; - historyById?: Maybe; - /** @deprecated Use historyById */ - historyByUniqueInput?: Maybe; - rebaseById?: Maybe; - /** @deprecated Use rebaseById */ - rebaseByUniqueInput?: Maybe; - rebases: Array; - rebasesConnection: RebasesConnection; - squidStatus?: Maybe; +export type MorphoAaveEdge = { + __typename?: 'MorphoAaveEdge'; + cursor: Scalars['String']['output']; + node: MorphoAave; }; +export enum MorphoAaveOrderByInput { + BlockNumberAsc = 'blockNumber_ASC', + BlockNumberAscNullsFirst = 'blockNumber_ASC_NULLS_FIRST', + BlockNumberDesc = 'blockNumber_DESC', + BlockNumberDescNullsLast = 'blockNumber_DESC_NULLS_LAST', + IdAsc = 'id_ASC', + IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdDesc = 'id_DESC', + IdDescNullsLast = 'id_DESC_NULLS_LAST', + TimestampAsc = 'timestamp_ASC', + TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampDesc = 'timestamp_DESC', + TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST', + WethAsc = 'weth_ASC', + WethAscNullsFirst = 'weth_ASC_NULLS_FIRST', + WethDesc = 'weth_DESC', + WethDescNullsLast = 'weth_DESC_NULLS_LAST', +} + +export type MorphoAaveWhereInput = { + AND?: InputMaybe>; + OR?: InputMaybe>; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + weth_eq?: InputMaybe; + weth_gt?: InputMaybe; + weth_gte?: InputMaybe; + weth_in?: InputMaybe>; + weth_isNull?: InputMaybe; + weth_lt?: InputMaybe; + weth_lte?: InputMaybe; + weth_not_eq?: InputMaybe; + weth_not_in?: InputMaybe>; +}; + +export type MorphoAavesConnection = { + __typename?: 'MorphoAavesConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + +export type Oeth = { + __typename?: 'OETH'; + blockNumber: Scalars['Int']['output']; + id: Scalars['String']['output']; + timestamp: Scalars['DateTime']['output']; + totalSupply: Scalars['BigInt']['output']; +}; + +export type OethEdge = { + __typename?: 'OETHEdge'; + cursor: Scalars['String']['output']; + node: Oeth; +}; + +export enum OethOrderByInput { + BlockNumberAsc = 'blockNumber_ASC', + BlockNumberAscNullsFirst = 'blockNumber_ASC_NULLS_FIRST', + BlockNumberDesc = 'blockNumber_DESC', + BlockNumberDescNullsLast = 'blockNumber_DESC_NULLS_LAST', + IdAsc = 'id_ASC', + IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdDesc = 'id_DESC', + IdDescNullsLast = 'id_DESC_NULLS_LAST', + TimestampAsc = 'timestamp_ASC', + TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampDesc = 'timestamp_DESC', + TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST', + TotalSupplyAsc = 'totalSupply_ASC', + TotalSupplyAscNullsFirst = 'totalSupply_ASC_NULLS_FIRST', + TotalSupplyDesc = 'totalSupply_DESC', + TotalSupplyDescNullsLast = 'totalSupply_DESC_NULLS_LAST', +} + +export type OethWhereInput = { + AND?: InputMaybe>; + OR?: InputMaybe>; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + totalSupply_eq?: InputMaybe; + totalSupply_gt?: InputMaybe; + totalSupply_gte?: InputMaybe; + totalSupply_in?: InputMaybe>; + totalSupply_isNull?: InputMaybe; + totalSupply_lt?: InputMaybe; + totalSupply_lte?: InputMaybe; + totalSupply_not_eq?: InputMaybe; + totalSupply_not_in?: InputMaybe>; +}; + +export type OetHsConnection = { + __typename?: 'OETHsConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + +export type PageInfo = { + __typename?: 'PageInfo'; + endCursor: Scalars['String']['output']; + hasNextPage: Scalars['Boolean']['output']; + hasPreviousPage: Scalars['Boolean']['output']; + startCursor: Scalars['String']['output']; +}; + +export type Query = { + __typename?: 'Query'; + addressById?: Maybe
; + /** @deprecated Use addressById */ + addressByUniqueInput?: Maybe
; + addresses: Array
; + addressesConnection: AddressesConnection; + apies: Array; + apiesConnection: APiesConnection; + apyById?: Maybe; + /** @deprecated Use apyById */ + apyByUniqueInput?: Maybe; + curveLpById?: Maybe; + /** @deprecated Use curveLpById */ + curveLpByUniqueInput?: Maybe; + curveLps: Array; + curveLpsConnection: CurveLPsConnection; + dripperById?: Maybe; + /** @deprecated Use dripperById */ + dripperByUniqueInput?: Maybe; + drippers: Array; + drippersConnection: DrippersConnection; + fraxStakingById?: Maybe; + /** @deprecated Use fraxStakingById */ + fraxStakingByUniqueInput?: Maybe; + fraxStakings: Array; + fraxStakingsConnection: FraxStakingsConnection; + histories: Array; + historiesConnection: HistoriesConnection; + historyById?: Maybe; + /** @deprecated Use historyById */ + historyByUniqueInput?: Maybe; + morphoAaveById?: Maybe; + /** @deprecated Use morphoAaveById */ + morphoAaveByUniqueInput?: Maybe; + morphoAaves: Array; + morphoAavesConnection: MorphoAavesConnection; + oethById?: Maybe; + /** @deprecated Use oethById */ + oethByUniqueInput?: Maybe; + oeths: Array; + oethsConnection: OetHsConnection; + rebaseById?: Maybe; + /** @deprecated Use rebaseById */ + rebaseByUniqueInput?: Maybe; + rebaseOptionById?: Maybe; + /** @deprecated Use rebaseOptionById */ + rebaseOptionByUniqueInput?: Maybe; + rebaseOptions: Array; + rebaseOptionsConnection: RebaseOptionsConnection; + rebases: Array; + rebasesConnection: RebasesConnection; + squidStatus?: Maybe; + vaultById?: Maybe; + /** @deprecated Use vaultById */ + vaultByUniqueInput?: Maybe; + vaults: Array; + vaultsConnection: VaultsConnection; +}; export type QueryAddressByIdArgs = { id: Scalars['String']['input']; }; - export type QueryAddressByUniqueInputArgs = { where: WhereIdInput; }; - export type QueryAddressesArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -571,7 +1115,6 @@ export type QueryAddressesArgs = { where?: InputMaybe; }; - export type QueryAddressesConnectionArgs = { after?: InputMaybe; first?: InputMaybe; @@ -579,7 +1122,6 @@ export type QueryAddressesConnectionArgs = { where?: InputMaybe; }; - export type QueryApiesArgs = { limit?: InputMaybe; offset?: InputMaybe; @@ -587,7 +1129,6 @@ export type QueryApiesArgs = { where?: InputMaybe; }; - export type QueryApiesConnectionArgs = { after?: InputMaybe; first?: InputMaybe; @@ -595,16 +1136,79 @@ export type QueryApiesConnectionArgs = { where?: InputMaybe; }; - export type QueryApyByIdArgs = { id: Scalars['String']['input']; }; - export type QueryApyByUniqueInputArgs = { where: WhereIdInput; }; +export type QueryCurveLpByIdArgs = { + id: Scalars['String']['input']; +}; + +export type QueryCurveLpByUniqueInputArgs = { + where: WhereIdInput; +}; + +export type QueryCurveLpsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +}; + +export type QueryCurveLpsConnectionArgs = { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +}; + +export type QueryDripperByIdArgs = { + id: Scalars['String']['input']; +}; + +export type QueryDripperByUniqueInputArgs = { + where: WhereIdInput; +}; + +export type QueryDrippersArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +}; + +export type QueryDrippersConnectionArgs = { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +}; + +export type QueryFraxStakingByIdArgs = { + id: Scalars['String']['input']; +}; + +export type QueryFraxStakingByUniqueInputArgs = { + where: WhereIdInput; +}; + +export type QueryFraxStakingsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +}; + +export type QueryFraxStakingsConnectionArgs = { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +}; export type QueryHistoriesArgs = { limit?: InputMaybe; @@ -613,7 +1217,6 @@ export type QueryHistoriesArgs = { where?: InputMaybe; }; - export type QueryHistoriesConnectionArgs = { after?: InputMaybe; first?: InputMaybe; @@ -621,26 +1224,87 @@ export type QueryHistoriesConnectionArgs = { where?: InputMaybe; }; - export type QueryHistoryByIdArgs = { id: Scalars['String']['input']; }; - export type QueryHistoryByUniqueInputArgs = { where: WhereIdInput; }; +export type QueryMorphoAaveByIdArgs = { + id: Scalars['String']['input']; +}; -export type QueryRebaseByIdArgs = { +export type QueryMorphoAaveByUniqueInputArgs = { + where: WhereIdInput; +}; + +export type QueryMorphoAavesArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +}; + +export type QueryMorphoAavesConnectionArgs = { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +}; + +export type QueryOethByIdArgs = { id: Scalars['String']['input']; }; +export type QueryOethByUniqueInputArgs = { + where: WhereIdInput; +}; + +export type QueryOethsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +}; + +export type QueryOethsConnectionArgs = { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +}; + +export type QueryRebaseByIdArgs = { + id: Scalars['String']['input']; +}; export type QueryRebaseByUniqueInputArgs = { where: WhereIdInput; }; +export type QueryRebaseOptionByIdArgs = { + id: Scalars['String']['input']; +}; + +export type QueryRebaseOptionByUniqueInputArgs = { + where: WhereIdInput; +}; + +export type QueryRebaseOptionsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +}; + +export type QueryRebaseOptionsConnectionArgs = { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +}; export type QueryRebasesArgs = { limit?: InputMaybe; @@ -649,7 +1313,6 @@ export type QueryRebasesArgs = { where?: InputMaybe; }; - export type QueryRebasesConnectionArgs = { after?: InputMaybe; first?: InputMaybe; @@ -657,6 +1320,28 @@ export type QueryRebasesConnectionArgs = { where?: InputMaybe; }; +export type QueryVaultByIdArgs = { + id: Scalars['String']['input']; +}; + +export type QueryVaultByUniqueInputArgs = { + where: WhereIdInput; +}; + +export type QueryVaultsArgs = { + limit?: InputMaybe; + offset?: InputMaybe; + orderBy?: InputMaybe>; + where?: InputMaybe; +}; + +export type QueryVaultsConnectionArgs = { + after?: InputMaybe; + first?: InputMaybe; + orderBy: Array; + where?: InputMaybe; +}; + export type Rebase = { __typename?: 'Rebase'; apy: Apy; @@ -675,6 +1360,144 @@ export type RebaseEdge = { node: Rebase; }; +export type RebaseOption = { + __typename?: 'RebaseOption'; + address: Address; + blockNumber: Scalars['Int']['output']; + id: Scalars['String']['output']; + status: RebasingOption; + timestamp: Scalars['DateTime']['output']; + txHash: Scalars['String']['output']; +}; + +export type RebaseOptionEdge = { + __typename?: 'RebaseOptionEdge'; + cursor: Scalars['String']['output']; + node: RebaseOption; +}; + +export enum RebaseOptionOrderByInput { + AddressBalanceAsc = 'address_balance_ASC', + AddressBalanceAscNullsFirst = 'address_balance_ASC_NULLS_FIRST', + AddressBalanceDesc = 'address_balance_DESC', + AddressBalanceDescNullsLast = 'address_balance_DESC_NULLS_LAST', + AddressCreditsAsc = 'address_credits_ASC', + AddressCreditsAscNullsFirst = 'address_credits_ASC_NULLS_FIRST', + AddressCreditsDesc = 'address_credits_DESC', + AddressCreditsDescNullsLast = 'address_credits_DESC_NULLS_LAST', + AddressEarnedAsc = 'address_earned_ASC', + AddressEarnedAscNullsFirst = 'address_earned_ASC_NULLS_FIRST', + AddressEarnedDesc = 'address_earned_DESC', + AddressEarnedDescNullsLast = 'address_earned_DESC_NULLS_LAST', + AddressIdAsc = 'address_id_ASC', + AddressIdAscNullsFirst = 'address_id_ASC_NULLS_FIRST', + AddressIdDesc = 'address_id_DESC', + AddressIdDescNullsLast = 'address_id_DESC_NULLS_LAST', + AddressIsContractAsc = 'address_isContract_ASC', + AddressIsContractAscNullsFirst = 'address_isContract_ASC_NULLS_FIRST', + AddressIsContractDesc = 'address_isContract_DESC', + AddressIsContractDescNullsLast = 'address_isContract_DESC_NULLS_LAST', + AddressLastUpdatedAsc = 'address_lastUpdated_ASC', + AddressLastUpdatedAscNullsFirst = 'address_lastUpdated_ASC_NULLS_FIRST', + AddressLastUpdatedDesc = 'address_lastUpdated_DESC', + AddressLastUpdatedDescNullsLast = 'address_lastUpdated_DESC_NULLS_LAST', + AddressRebasingOptionAsc = 'address_rebasingOption_ASC', + AddressRebasingOptionAscNullsFirst = 'address_rebasingOption_ASC_NULLS_FIRST', + AddressRebasingOptionDesc = 'address_rebasingOption_DESC', + AddressRebasingOptionDescNullsLast = 'address_rebasingOption_DESC_NULLS_LAST', + BlockNumberAsc = 'blockNumber_ASC', + BlockNumberAscNullsFirst = 'blockNumber_ASC_NULLS_FIRST', + BlockNumberDesc = 'blockNumber_DESC', + BlockNumberDescNullsLast = 'blockNumber_DESC_NULLS_LAST', + IdAsc = 'id_ASC', + IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdDesc = 'id_DESC', + IdDescNullsLast = 'id_DESC_NULLS_LAST', + StatusAsc = 'status_ASC', + StatusAscNullsFirst = 'status_ASC_NULLS_FIRST', + StatusDesc = 'status_DESC', + StatusDescNullsLast = 'status_DESC_NULLS_LAST', + TimestampAsc = 'timestamp_ASC', + TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampDesc = 'timestamp_DESC', + TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST', + TxHashAsc = 'txHash_ASC', + TxHashAscNullsFirst = 'txHash_ASC_NULLS_FIRST', + TxHashDesc = 'txHash_DESC', + TxHashDescNullsLast = 'txHash_DESC_NULLS_LAST', +} + +export type RebaseOptionWhereInput = { + AND?: InputMaybe>; + OR?: InputMaybe>; + address?: InputMaybe; + address_isNull?: InputMaybe; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + status_eq?: InputMaybe; + status_in?: InputMaybe>; + status_isNull?: InputMaybe; + status_not_eq?: InputMaybe; + status_not_in?: InputMaybe>; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + txHash_contains?: InputMaybe; + txHash_containsInsensitive?: InputMaybe; + txHash_endsWith?: InputMaybe; + txHash_eq?: InputMaybe; + txHash_gt?: InputMaybe; + txHash_gte?: InputMaybe; + txHash_in?: InputMaybe>; + txHash_isNull?: InputMaybe; + txHash_lt?: InputMaybe; + txHash_lte?: InputMaybe; + txHash_not_contains?: InputMaybe; + txHash_not_containsInsensitive?: InputMaybe; + txHash_not_endsWith?: InputMaybe; + txHash_not_eq?: InputMaybe; + txHash_not_in?: InputMaybe>; + txHash_not_startsWith?: InputMaybe; + txHash_startsWith?: InputMaybe; +}; + +export type RebaseOptionsConnection = { + __typename?: 'RebaseOptionsConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + export enum RebaseOrderByInput { ApyAprAsc = 'apy_apr_ASC', ApyAprAscNullsFirst = 'apy_apr_ASC_NULLS_FIRST', @@ -743,7 +1566,7 @@ export enum RebaseOrderByInput { TxHashAsc = 'txHash_ASC', TxHashAscNullsFirst = 'txHash_ASC_NULLS_FIRST', TxHashDesc = 'txHash_DESC', - TxHashDescNullsLast = 'txHash_DESC_NULLS_LAST' + TxHashDescNullsLast = 'txHash_DESC_NULLS_LAST', } export type RebaseWhereInput = { @@ -785,7 +1608,9 @@ export type RebaseWhereInput = { rebasingCreditsPerToken_lt?: InputMaybe; rebasingCreditsPerToken_lte?: InputMaybe; rebasingCreditsPerToken_not_eq?: InputMaybe; - rebasingCreditsPerToken_not_in?: InputMaybe>; + rebasingCreditsPerToken_not_in?: InputMaybe< + Array + >; rebasingCredits_eq?: InputMaybe; rebasingCredits_gt?: InputMaybe; rebasingCredits_gte?: InputMaybe; @@ -839,12 +1664,148 @@ export type RebasesConnection = { totalCount: Scalars['Int']['output']; }; +export enum RebasingOption { + OptIn = 'OptIn', + OptOut = 'OptOut', +} + export type SquidStatus = { __typename?: 'SquidStatus'; /** The height of the processed part of the chain */ height?: Maybe; }; +export type Vault = { + __typename?: 'Vault'; + blockNumber: Scalars['Int']['output']; + frxETH: Scalars['BigInt']['output']; + id: Scalars['String']['output']; + rETH: Scalars['BigInt']['output']; + stETH: Scalars['BigInt']['output']; + timestamp: Scalars['DateTime']['output']; + weth: Scalars['BigInt']['output']; +}; + +export type VaultEdge = { + __typename?: 'VaultEdge'; + cursor: Scalars['String']['output']; + node: Vault; +}; + +export enum VaultOrderByInput { + BlockNumberAsc = 'blockNumber_ASC', + BlockNumberAscNullsFirst = 'blockNumber_ASC_NULLS_FIRST', + BlockNumberDesc = 'blockNumber_DESC', + BlockNumberDescNullsLast = 'blockNumber_DESC_NULLS_LAST', + FrxEthAsc = 'frxETH_ASC', + FrxEthAscNullsFirst = 'frxETH_ASC_NULLS_FIRST', + FrxEthDesc = 'frxETH_DESC', + FrxEthDescNullsLast = 'frxETH_DESC_NULLS_LAST', + IdAsc = 'id_ASC', + IdAscNullsFirst = 'id_ASC_NULLS_FIRST', + IdDesc = 'id_DESC', + IdDescNullsLast = 'id_DESC_NULLS_LAST', + REthAsc = 'rETH_ASC', + REthAscNullsFirst = 'rETH_ASC_NULLS_FIRST', + REthDesc = 'rETH_DESC', + REthDescNullsLast = 'rETH_DESC_NULLS_LAST', + StEthAsc = 'stETH_ASC', + StEthAscNullsFirst = 'stETH_ASC_NULLS_FIRST', + StEthDesc = 'stETH_DESC', + StEthDescNullsLast = 'stETH_DESC_NULLS_LAST', + TimestampAsc = 'timestamp_ASC', + TimestampAscNullsFirst = 'timestamp_ASC_NULLS_FIRST', + TimestampDesc = 'timestamp_DESC', + TimestampDescNullsLast = 'timestamp_DESC_NULLS_LAST', + WethAsc = 'weth_ASC', + WethAscNullsFirst = 'weth_ASC_NULLS_FIRST', + WethDesc = 'weth_DESC', + WethDescNullsLast = 'weth_DESC_NULLS_LAST', +} + +export type VaultWhereInput = { + AND?: InputMaybe>; + OR?: InputMaybe>; + blockNumber_eq?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_isNull?: InputMaybe; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not_eq?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + frxETH_eq?: InputMaybe; + frxETH_gt?: InputMaybe; + frxETH_gte?: InputMaybe; + frxETH_in?: InputMaybe>; + frxETH_isNull?: InputMaybe; + frxETH_lt?: InputMaybe; + frxETH_lte?: InputMaybe; + frxETH_not_eq?: InputMaybe; + frxETH_not_in?: InputMaybe>; + id_contains?: InputMaybe; + id_containsInsensitive?: InputMaybe; + id_endsWith?: InputMaybe; + id_eq?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_isNull?: InputMaybe; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not_contains?: InputMaybe; + id_not_containsInsensitive?: InputMaybe; + id_not_endsWith?: InputMaybe; + id_not_eq?: InputMaybe; + id_not_in?: InputMaybe>; + id_not_startsWith?: InputMaybe; + id_startsWith?: InputMaybe; + rETH_eq?: InputMaybe; + rETH_gt?: InputMaybe; + rETH_gte?: InputMaybe; + rETH_in?: InputMaybe>; + rETH_isNull?: InputMaybe; + rETH_lt?: InputMaybe; + rETH_lte?: InputMaybe; + rETH_not_eq?: InputMaybe; + rETH_not_in?: InputMaybe>; + stETH_eq?: InputMaybe; + stETH_gt?: InputMaybe; + stETH_gte?: InputMaybe; + stETH_in?: InputMaybe>; + stETH_isNull?: InputMaybe; + stETH_lt?: InputMaybe; + stETH_lte?: InputMaybe; + stETH_not_eq?: InputMaybe; + stETH_not_in?: InputMaybe>; + timestamp_eq?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_isNull?: InputMaybe; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not_eq?: InputMaybe; + timestamp_not_in?: InputMaybe>; + weth_eq?: InputMaybe; + weth_gt?: InputMaybe; + weth_gte?: InputMaybe; + weth_in?: InputMaybe>; + weth_isNull?: InputMaybe; + weth_lt?: InputMaybe; + weth_lte?: InputMaybe; + weth_not_eq?: InputMaybe; + weth_not_in?: InputMaybe>; +}; + +export type VaultsConnection = { + __typename?: 'VaultsConnection'; + edges: Array; + pageInfo: PageInfo; + totalCount: Scalars['Int']['output']; +}; + export type WhereIdInput = { id: Scalars['String']['input']; }; diff --git a/libs/oeth/shared/tsconfig.json b/libs/oeth/shared/tsconfig.json index dd78c9fd2..33b686fe4 100644 --- a/libs/oeth/shared/tsconfig.json +++ b/libs/oeth/shared/tsconfig.json @@ -4,8 +4,9 @@ "allowJs": false, "esModuleInterop": false, "allowSyntheticDefaultImports": true, - "strict": false, - "jsxImportSource": "@emotion/react" + "types": [ + "vite/client" + ] }, "files": [], "include": [], diff --git a/libs/oeth/shared/tsconfig.lib.json b/libs/oeth/shared/tsconfig.lib.json index 49c6d19e5..d69c6c235 100644 --- a/libs/oeth/shared/tsconfig.lib.json +++ b/libs/oeth/shared/tsconfig.lib.json @@ -2,14 +2,31 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../../dist/out-tsc", - "types": ["node"] + "types": [ + "node", + "vite/client" + ] }, "files": [ "../../../node_modules/@nx/react/typings/cssmodule.d.ts", "../../../node_modules/@nx/react/typings/image.d.ts", "../../../libs/shared/theme/src/theme.d.ts", - "../../../apps/oeth/src/env.d.ts", + "../../../apps/oeth/src/env.d.ts" ], - "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.ts", + "src/**/*.tsx" + ] } diff --git a/libs/oeth/shared/vite.config.ts b/libs/oeth/shared/vite.config.ts new file mode 100644 index 000000000..e94106db1 --- /dev/null +++ b/libs/oeth/shared/vite.config.ts @@ -0,0 +1,43 @@ +/// +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import react from '@vitejs/plugin-react'; +import * as path from 'path'; +import { defineConfig } from 'vite'; +import dts from 'vite-plugin-dts'; + +export default defineConfig({ + cacheDir: '../../../node_modules/.vite/oeth-shared', + + plugins: [ + dts({ + entryRoot: 'src', + tsConfigFilePath: path.join(__dirname, 'tsconfig.lib.json'), + skipDiagnostics: true, + }), + react(), + nxViteTsPaths(), + ], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'oeth-shared', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, +}); diff --git a/libs/oeth/swap/src/queries.generated.ts b/libs/oeth/swap/src/queries.generated.ts index c94d68aeb..148c79d8f 100644 --- a/libs/oeth/swap/src/queries.generated.ts +++ b/libs/oeth/swap/src/queries.generated.ts @@ -12,7 +12,7 @@ export type ApiesQuery = { apies: Array<{ __typename?: 'APY'; id: string; - timestamp: any; + timestamp: string; apy7DayAvg: number; apy30DayAvg: number; }>; diff --git a/libs/shared/components/package.json b/libs/shared/components/package.json new file mode 100644 index 000000000..ef4a022ad --- /dev/null +++ b/libs/shared/components/package.json @@ -0,0 +1,12 @@ +{ + "name": "@origin/shared/components", + "version": "0.0.1", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/libs/shared/components/project.json b/libs/shared/components/project.json index 54bede57b..4ba21e8bf 100644 --- a/libs/shared/components/project.json +++ b/libs/shared/components/project.json @@ -7,19 +7,43 @@ "targets": { "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["libs/shared/components/**/*.{ts,tsx,js,jsx}"] + "lintFilePatterns": [ + "libs/shared/components/**/*.{ts,tsx,js,jsx}" + ] } }, "test": { "executor": "@nx/vite:test", - "outputs": ["coverage/libs/shared/components"], + "outputs": [ + "coverage/libs/shared/components" + ], "options": { "passWithNoTests": true, "reportsDirectory": "../../../coverage/libs/shared/components" } }, + "build": { + "executor": "@nx/vite:build", + "outputs": [ + "{options.outputPath}" + ], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/libs/shared/components" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } + }, "storybook": { "executor": "@nx/storybook:storybook", "options": { @@ -34,7 +58,9 @@ }, "build-storybook": { "executor": "@nx/storybook:build", - "outputs": ["{options.outputDir}"], + "outputs": [ + "{options.outputDir}" + ], "options": { "outputDir": "dist/storybook/shared-components", "configDir": "libs/shared/components/.storybook" diff --git a/libs/shared/components/vite.config.ts b/libs/shared/components/vite.config.ts index 98ff22e76..35320e202 100644 --- a/libs/shared/components/vite.config.ts +++ b/libs/shared/components/vite.config.ts @@ -33,4 +33,19 @@ export default defineConfig({ environment: 'jsdom', include: ['src/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], }, + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'shared-components', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, }); diff --git a/libs/shared/contracts/package.json b/libs/shared/contracts/package.json new file mode 100644 index 000000000..aecd26f68 --- /dev/null +++ b/libs/shared/contracts/package.json @@ -0,0 +1,12 @@ +{ + "name": "@origin/shared/contracts", + "version": "0.0.1", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/libs/shared/contracts/project.json b/libs/shared/contracts/project.json index 057d5ab0b..2d9b166b1 100644 --- a/libs/shared/contracts/project.json +++ b/libs/shared/contracts/project.json @@ -7,9 +7,13 @@ "targets": { "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["libs/shared/contracts/**/*.{ts,tsx,js,jsx}"] + "lintFilePatterns": [ + "libs/shared/contracts/**/*.{ts,tsx,js,jsx}" + ] } }, "generate-abis-json": { @@ -32,6 +36,24 @@ "command": "ts-node --esm libs/shared/contracts/scripts/generateContracts.mts", "parallel": false } + }, + "build": { + "executor": "@nx/vite:build", + "outputs": [ + "{options.outputPath}" + ], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/libs/shared/contracts" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } } } } diff --git a/libs/shared/contracts/vite.config.ts b/libs/shared/contracts/vite.config.ts new file mode 100644 index 000000000..7379dd6f5 --- /dev/null +++ b/libs/shared/contracts/vite.config.ts @@ -0,0 +1,33 @@ +/// +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + cacheDir: '../../../node_modules/.vite/shared-contracts', + + plugins: [react(), nxViteTsPaths()], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'shared-contracts', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, +}); diff --git a/libs/shared/providers/README.md b/libs/shared/providers/README.md index 41bd7cbc3..c22bffd93 100644 --- a/libs/shared/providers/README.md +++ b/libs/shared/providers/README.md @@ -4,4 +4,4 @@ This library was generated with [Nx](https://nx.dev). ## Running unit tests -Run `nx test shared-providers` to execute the unit tests via [Jest](https://jestjs.io). +Run `nx test shared-providers` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/libs/shared/providers/package.json b/libs/shared/providers/package.json new file mode 100644 index 000000000..1f65153a1 --- /dev/null +++ b/libs/shared/providers/package.json @@ -0,0 +1,12 @@ +{ + "name": "@origin/shared/providers", + "version": "0.0.1", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/libs/shared/providers/project.json b/libs/shared/providers/project.json index 9b4551d2b..b5ecff67e 100644 --- a/libs/shared/providers/project.json +++ b/libs/shared/providers/project.json @@ -15,6 +15,24 @@ "libs/shared/providers/**/*.{ts,tsx,js,jsx}" ] } + }, + "build": { + "executor": "@nx/vite:build", + "outputs": [ + "{options.outputPath}" + ], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/libs/shared/providers" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } } } } diff --git a/libs/shared/providers/src/chart/registerChart.ts b/libs/shared/providers/src/chart/registerChart.ts index 4f21a6436..0b89bb252 100644 --- a/libs/shared/providers/src/chart/registerChart.ts +++ b/libs/shared/providers/src/chart/registerChart.ts @@ -7,6 +7,7 @@ import { LineElement, PointElement, registerables, + TimeScale, } from 'chart.js'; export function registerChart() { @@ -14,6 +15,7 @@ export function registerChart() { ...registerables, CategoryScale, LinearScale, + TimeScale, LineElement, PointElement, ); diff --git a/libs/shared/providers/src/prices/hooks.ts b/libs/shared/providers/src/prices/hooks.ts index 41a09ab0f..c37e21d92 100644 --- a/libs/shared/providers/src/prices/hooks.ts +++ b/libs/shared/providers/src/prices/hooks.ts @@ -64,3 +64,21 @@ export const usePrices = ( ...options, }); }; + +export const useChainlinkEthUsd = () => { + return useQuery({ + queryKey: ['useChainlinkUsd'], + queryFn: async () => { + const usd = await readContract({ + address: contracts.mainnet.ChainlinkOracle.address, + abi: contracts.mainnet.ChainlinkOracle.abi, + functionName: 'ethUsdPrice', + }); + + const floatUsd = +formatUnits(usd, 6); + const gweiUsd = floatUsd * 1e-9; + + return { usd, floatUsd, gweiUsd }; + }, + }); +}; diff --git a/libs/shared/providers/tsconfig.json b/libs/shared/providers/tsconfig.json index 90fcf85c5..33b686fe4 100644 --- a/libs/shared/providers/tsconfig.json +++ b/libs/shared/providers/tsconfig.json @@ -4,7 +4,9 @@ "allowJs": false, "esModuleInterop": false, "allowSyntheticDefaultImports": true, - "strict": false + "types": [ + "vite/client" + ] }, "files": [], "include": [], diff --git a/libs/shared/providers/tsconfig.lib.json b/libs/shared/providers/tsconfig.lib.json index 56427f111..04eb567cf 100644 --- a/libs/shared/providers/tsconfig.lib.json +++ b/libs/shared/providers/tsconfig.lib.json @@ -2,13 +2,32 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../../dist/out-tsc", - "types": ["node"] + "types": [ + "node", + "@nx/react/typings/cssmodule.d.ts", + "@nx/react/typings/image.d.ts", + "vite/client" + ] }, "files": [ "../../../node_modules/@nx/react/typings/cssmodule.d.ts", "../../../node_modules/@nx/react/typings/image.d.ts", "../../../libs/shared/theme/src/theme.d.ts" ], - "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] + "exclude": [ + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.ts", + "src/**/*.tsx" + ] } diff --git a/libs/shared/providers/vite.config.ts b/libs/shared/providers/vite.config.ts new file mode 100644 index 000000000..d7daf9404 --- /dev/null +++ b/libs/shared/providers/vite.config.ts @@ -0,0 +1,33 @@ +/// +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + cacheDir: '../../../node_modules/.vite/shared-providers', + + plugins: [react(), nxViteTsPaths()], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'shared-providers', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, +}); diff --git a/libs/shared/theme/.eslintrc.json b/libs/shared/theme/.eslintrc.json index 75b85077d..a786f2cf3 100644 --- a/libs/shared/theme/.eslintrc.json +++ b/libs/shared/theme/.eslintrc.json @@ -1,17 +1,33 @@ { - "extends": ["plugin:@nx/react", "../../../.eslintrc.json"], - "ignorePatterns": ["!**/*"], + "extends": [ + "plugin:@nx/react", + "../../../.eslintrc.json" + ], + "ignorePatterns": [ + "!**/*" + ], "overrides": [ { - "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "files": [ + "*.ts", + "*.tsx", + "*.js", + "*.jsx" + ], "rules": {} }, { - "files": ["*.ts", "*.tsx"], + "files": [ + "*.ts", + "*.tsx" + ], "rules": {} }, { - "files": ["*.js", "*.jsx"], + "files": [ + "*.js", + "*.jsx" + ], "rules": {} } ] diff --git a/libs/shared/theme/README.md b/libs/shared/theme/README.md index ede11943e..68d6d5700 100644 --- a/libs/shared/theme/README.md +++ b/libs/shared/theme/README.md @@ -4,4 +4,4 @@ This library was generated with [Nx](https://nx.dev). ## Running unit tests -Run `nx test shared-theme` to execute the unit tests via [Jest](https://jestjs.io). +Run `nx test shared-theme` to execute the unit tests via [Vitest](https://vitest.dev/). diff --git a/libs/shared/theme/package.json b/libs/shared/theme/package.json new file mode 100644 index 000000000..8cdbeab7f --- /dev/null +++ b/libs/shared/theme/package.json @@ -0,0 +1,12 @@ +{ + "name": "@origin/shared/theme", + "version": "0.0.1", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/libs/shared/theme/project.json b/libs/shared/theme/project.json index cdf7bda72..2f00efdc5 100644 --- a/libs/shared/theme/project.json +++ b/libs/shared/theme/project.json @@ -7,9 +7,31 @@ "targets": { "lint": { "executor": "@nx/linter:eslint", - "outputs": ["{options.outputFile}"], + "outputs": [ + "{options.outputFile}" + ], "options": { - "lintFilePatterns": ["libs/shared/theme/**/*.{ts,tsx,js,jsx}"] + "lintFilePatterns": [ + "libs/shared/theme/**/*.{ts,tsx,js,jsx}" + ] + } + }, + "build": { + "executor": "@nx/vite:build", + "outputs": [ + "{options.outputPath}" + ], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/libs/shared/theme" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } } } } diff --git a/libs/shared/theme/src/Palette.stories.tsx b/libs/shared/theme/src/Palette.stories.tsx index cc65d81dc..e1f77d789 100644 --- a/libs/shared/theme/src/Palette.stories.tsx +++ b/libs/shared/theme/src/Palette.stories.tsx @@ -162,20 +162,27 @@ const PaletteView = ({ palette, ...rest }: PaletteViewProps) => ( > {capitalize(key)} + {/* eslint-disable @typescript-eslint/ban-ts-comment */} + {/* @ts-ignore */} {typeof palette[key] === 'object' ? ( + // @ts-ignore Object.keys(palette[key]).map((k) => ( )) ) : ( + // @ts-ignore )} + {/* eslint-enable @typescript-eslint/ban-ts-comment */} ))} diff --git a/libs/shared/theme/src/theme.d.ts b/libs/shared/theme/src/theme.d.ts index 2b51d0a65..d1837648c 100644 --- a/libs/shared/theme/src/theme.d.ts +++ b/libs/shared/theme/src/theme.d.ts @@ -3,6 +3,9 @@ import '@mui/material/Button'; declare module '@mui/material/styles' { interface TypeBackground { + paper: string; + paperHeader: string; + paperFooter: string; gradient1: string; gradient2: string; gradient3: string; diff --git a/libs/shared/theme/src/theme.tsx b/libs/shared/theme/src/theme.tsx index 773463223..c5ff7e035 100644 --- a/libs/shared/theme/src/theme.tsx +++ b/libs/shared/theme/src/theme.tsx @@ -22,6 +22,8 @@ export const theme = extendTheme({ divider: '#101113', background: { paper: '#1E1F25', + paperHeader: '#23242A', + paperFooter: '#23242A', default: '#101113', gradient1: 'linear-gradient(90deg,#8c66fc -28.99%,#0274f1 144.97%)', gradient2: 'linear-gradient(90deg, #8C66FC 0%, #0274F1 100%)', diff --git a/libs/shared/theme/tsconfig.json b/libs/shared/theme/tsconfig.json index 89f8ac085..33b686fe4 100644 --- a/libs/shared/theme/tsconfig.json +++ b/libs/shared/theme/tsconfig.json @@ -4,7 +4,9 @@ "allowJs": false, "esModuleInterop": false, "allowSyntheticDefaultImports": true, - "strict": true + "types": [ + "vite/client" + ] }, "files": [], "include": [], diff --git a/libs/shared/theme/tsconfig.lib.json b/libs/shared/theme/tsconfig.lib.json index 79e57218a..e86a631d1 100644 --- a/libs/shared/theme/tsconfig.lib.json +++ b/libs/shared/theme/tsconfig.lib.json @@ -2,7 +2,10 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "../../../dist/out-tsc", - "types": ["node"] + "types": [ + "node", + "vite/client" + ] }, "files": [ "../../../node_modules/@nx/react/typings/cssmodule.d.ts", @@ -10,15 +13,19 @@ "./src/theme.d.ts" ], "exclude": [ - "jest.config.ts", - "src/**/*.spec.ts", - "src/**/*.test.ts", - "src/**/*.spec.tsx", - "src/**/*.test.tsx", - "src/**/*.spec.js", - "src/**/*.test.js", - "src/**/*.spec.jsx", - "src/**/*.test.jsx" + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" ], - "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"] + "include": [ + "src/**/*.js", + "src/**/*.jsx", + "src/**/*.ts", + "src/**/*.tsx" + ] } diff --git a/libs/shared/theme/vite.config.ts b/libs/shared/theme/vite.config.ts new file mode 100644 index 000000000..35b25237b --- /dev/null +++ b/libs/shared/theme/vite.config.ts @@ -0,0 +1,42 @@ +/// +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import react from '@vitejs/plugin-react'; +import * as path from 'path'; +import { defineConfig } from 'vite'; +import dts from 'vite-plugin-dts'; + +export default defineConfig({ + cacheDir: '../../../node_modules/.vite/shared-theme', + + plugins: [ + dts({ + entryRoot: 'src', + tsconfigPath: path.join(__dirname, 'tsconfig.lib.json'), + }), + react(), + nxViteTsPaths(), + ], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'shared-theme', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, +}); diff --git a/libs/shared/utils/package.json b/libs/shared/utils/package.json new file mode 100644 index 000000000..053dd6c83 --- /dev/null +++ b/libs/shared/utils/package.json @@ -0,0 +1,12 @@ +{ + "name": "@origin/shared/utils", + "version": "0.0.1", + "main": "./index.js", + "types": "./index.d.ts", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js" + } + } +} diff --git a/libs/shared/utils/project.json b/libs/shared/utils/project.json index f2d296b69..75ae1c446 100644 --- a/libs/shared/utils/project.json +++ b/libs/shared/utils/project.json @@ -15,6 +15,24 @@ "libs/shared/utils/**/*.{ts,tsx,js,jsx}" ] } + }, + "build": { + "executor": "@nx/vite:build", + "outputs": [ + "{options.outputPath}" + ], + "defaultConfiguration": "production", + "options": { + "outputPath": "dist/libs/shared/utils" + }, + "configurations": { + "development": { + "mode": "development" + }, + "production": { + "mode": "production" + } + } } } } diff --git a/libs/shared/utils/src/BigInt.ts b/libs/shared/utils/src/BigInt.ts index d96a687fb..ad952a512 100644 --- a/libs/shared/utils/src/BigInt.ts +++ b/libs/shared/utils/src/BigInt.ts @@ -1,2 +1,2 @@ -export const jsonStringifyReplacer = (key, value) => +export const jsonStringifyReplacer = (key: string, value: unknown) => typeof value === 'bigint' ? value.toString() : value; diff --git a/libs/shared/utils/vite.config.ts b/libs/shared/utils/vite.config.ts new file mode 100644 index 000000000..741dc2d63 --- /dev/null +++ b/libs/shared/utils/vite.config.ts @@ -0,0 +1,33 @@ +/// +import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; +import react from '@vitejs/plugin-react'; +import { defineConfig } from 'vite'; + +export default defineConfig({ + cacheDir: '../../../node_modules/.vite/shared-utils', + + plugins: [react(), nxViteTsPaths()], + + // Uncomment this if you are using workers. + // worker: { + // plugins: [ nxViteTsPaths() ], + // }, + + // Configuration for building your library. + // See: https://vitejs.dev/guide/build.html#library-mode + build: { + lib: { + // Could also be a dictionary or array of multiple entry points. + entry: 'src/index.ts', + name: 'shared-utils', + fileName: 'index', + // Change this to the formats you want to support. + // Don't forget to update your package.json as well. + formats: ['es', 'cjs'], + }, + rollupOptions: { + // External packages that should not be bundled into your library. + external: ['react', 'react-dom', 'react/jsx-runtime'], + }, + }, +}); diff --git a/package.json b/package.json index 5bfd3eb8a..3586a83cd 100644 --- a/package.json +++ b/package.json @@ -102,7 +102,7 @@ "ts-node": "10.9.1", "typescript": "~5.2.2", "vite": "~4.4.9", - "vite-plugin-dts": "~3.5.3", + "vite-plugin-dts": "~3.6.0", "vite-plugin-static-copy": "^0.17.0", "vite-plugin-svgr": "^3.2.0", "vite-tsconfig-paths": "~4.2.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 54e8e07a5..885d570a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -263,8 +263,8 @@ devDependencies: specifier: ~4.4.9 version: 4.4.9(@types/node@20.6.0) vite-plugin-dts: - specifier: ~3.5.3 - version: 3.5.3(@types/node@20.6.0)(typescript@5.2.2)(vite@4.4.9) + specifier: ~3.6.0 + version: 3.6.0(@types/node@20.6.0)(typescript@5.2.2)(vite@4.4.9) vite-plugin-static-copy: specifier: ^0.17.0 version: 0.17.0(vite@4.4.9) @@ -15441,8 +15441,8 @@ packages: - terser dev: true - /vite-plugin-dts@3.5.3(@types/node@20.6.0)(typescript@5.2.2)(vite@4.4.9): - resolution: {integrity: sha512-h94j/+SR1PhLR9jnEtcjZILagE2QZBAV8V1y3T2Ujcet1VI0Et4dZSU1W8fbnp6obB7B3/b8hArqdi2/9HuH+w==} + /vite-plugin-dts@3.6.0(@types/node@20.6.0)(typescript@5.2.2)(vite@4.4.9): + resolution: {integrity: sha512-doxhDRFJCZD2sGjIp4V800nm8Y19GvmwckjG5vYPuiqJ7OBjc9NlW1Vp9Gkyh2aXlUs1jTDRH/lxWfcsPLOQHg==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: typescript: '*' diff --git a/tsconfig.base.json b/tsconfig.base.json index 4d831345c..7c07e697e 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -20,6 +20,12 @@ "strict": false, "baseUrl": ".", "paths": { + "@origin/analytics": [ + "libs/analytics/src/index.ts" + ], + "@origin/financial-statement": [ + "libs/financial-statement/src/index.ts" + ], "@origin/oeth/history": [ "libs/oeth/history/src/index.ts" ],