-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
69 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,30 @@ | ||
import { DATA_CACHE_TIME_SECONDS } from '@/const/meta' | ||
|
||
const CONFIG_PATH = 'https://raw.githubusercontent.com/cowprotocol/cow-fi/configuration/config/' | ||
|
||
export interface CowStats { | ||
totalTrades: number, // https://dune.com/queries/1034337 | ||
surplus: { // https://dune.com/queries/270604 | ||
reasonable: number, | ||
totalTrades: number // https://dune.com/queries/1034337 | ||
surplus: { | ||
// https://dune.com/queries/270604 | ||
reasonable: number | ||
unusual: number | ||
}, | ||
} | ||
lastModified: Date | ||
} | ||
|
||
type CowStatsConfig = Omit<CowStats, 'lastModified'> & { lastModified: string } | ||
|
||
async function getFromConfig<T>(configFilePath: string): Promise<T> { | ||
const response = await fetch(CONFIG_PATH + `${configFilePath}`) | ||
const response = await fetch(CONFIG_PATH + `${configFilePath}`, { | ||
next: { revalidate: DATA_CACHE_TIME_SECONDS }, | ||
}) | ||
return await response.json() | ||
} | ||
|
||
export async function getCowStats(): Promise<CowStats> { | ||
const statsConfig = await getFromConfig<CowStatsConfig>('stats.json') | ||
return { | ||
...statsConfig, | ||
lastModified: new Date(statsConfig.lastModified) | ||
lastModified: new Date(statsConfig.lastModified), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16514,11 +16514,6 @@ executable@^4.1.0, executable@^4.1.1: | |
dependencies: | ||
pify "^2.2.0" | ||
|
||
exenv@^1.2.2: | ||
version "1.2.2" | ||
resolved "https://registry.yarnpkg.com/exenv/-/exenv-1.2.2.tgz#2ae78e85d9894158670b03d47bec1f03bd91bb9d" | ||
integrity sha512-Z+ktTxTwv9ILfgKCk32OX3n/doe+OcLTRtqK9pcL+JsP3J1/VW8Uvl4ZjLlKqeW4rzK4oesDOGMEMRIZqtP4Iw== | ||
|
||
exit@^0.1.2: | ||
version "0.1.2" | ||
resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" | ||
|
@@ -26133,10 +26128,10 @@ [email protected]: | |
use-callback-ref "^1.2.5" | ||
use-sidecar "^1.0.5" | ||
|
||
react-from-dom@^0.6.2: | ||
version "0.6.2" | ||
resolved "https://registry.yarnpkg.com/react-from-dom/-/react-from-dom-0.6.2.tgz#9da903a508c91c013b55afcd59348b8b0a39bdb4" | ||
integrity sha512-qvWWTL/4xw4k/Dywd41RBpLQUSq97csuv15qrxN+izNeLYlD9wn5W8LspbfYe5CWbaSdkZ72BsaYBPQf2x4VbQ== | ||
react-from-dom@^0.7.3: | ||
version "0.7.3" | ||
resolved "https://registry.yarnpkg.com/react-from-dom/-/react-from-dom-0.7.3.tgz#60e75fde2369ceb0a8f87d88f9cfbeb67b730e43" | ||
integrity sha512-9IK6R7+eD1wOAMC2ZCrENev0eK1625cb7vX+cnnOR9LBRNbjKiaJk4ij2zQbcefEXTWjXFhA7CTO1cd8wMONnw== | ||
|
||
react-ga4@^1.4.1: | ||
version "1.4.1" | ||
|
@@ -26158,13 +26153,12 @@ react-icons@^5.2.1: | |
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-5.2.1.tgz#28c2040917b2a2eda639b0f797bff1888e018e4a" | ||
integrity sha512-zdbW5GstTzXaVKvGSyTaBalt7HSfuK5ovrzlpyiWHAFXndXTdd/1hdDHI4xBM1Mn7YriT6aqESucFl9kEXzrdw== | ||
|
||
react-inlinesvg@^3.0.1: | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/react-inlinesvg/-/react-inlinesvg-3.0.2.tgz#5c59799966ae7926057091b2ac230ddcee01bea0" | ||
integrity sha512-BEzkpMGQwEY68fgaouY7ZWvAUPb8jbj7dE9iDbWZxstDhMuz9qfpxNgvGSENKcDMdpq/XHduSk/LAmNKin4nKw== | ||
react-inlinesvg@^4.1.5: | ||
version "4.1.5" | ||
resolved "https://registry.yarnpkg.com/react-inlinesvg/-/react-inlinesvg-4.1.5.tgz#5d6b4f9008d442e4f184ec25e135360d993dc47e" | ||
integrity sha512-DcCnmHhpKAUNp6iLPEEB2HJP3simDlyiy8JPZ1DwGCynrQQGQD04GJTFtai8JK8vRhCmoiBV6hSgj31D42Z3Lg== | ||
dependencies: | ||
exenv "^1.2.2" | ||
react-from-dom "^0.6.2" | ||
react-from-dom "^0.7.3" | ||
|
||
react-inspector@^5.1.0: | ||
version "5.1.1" | ||
|