Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7efcfc9
fix: get all request pages
gabaldon Jun 29, 2023
36194c9
feat: filter by witnet network and pair
gabaldon Jan 28, 2025
7ab8899
feat: update fonts
gabaldon Jan 31, 2025
66e8a3c
feat: update color palette and tailwind dark mode
gabaldon Feb 27, 2025
e36b131
chore: update eslint, i18n and ES6
gabaldon Feb 27, 2025
f148fef
fix: lint changes
gabaldon Mar 28, 2025
27e345c
fix: prettier warnings
gabaldon Mar 28, 2025
05b683f
feat: add missing dep
gabaldon Mar 28, 2025
9c67bc8
fix(ui): avoid @intlify error
gabaldon Mar 28, 2025
5e286ed
fix(ui): lint incompatibility
gabaldon Mar 28, 2025
07b7dc0
feat: implement landing page using new components
gabaldon May 14, 2025
dc321af
feat: implement landing layout
gabaldon May 21, 2025
e2ae72c
fix(api): get feed by pair and network
gabaldon May 30, 2025
0682bb7
refactor: implement new layout
gabaldon May 30, 2025
2c0d724
feat: style network options list
gabaldon May 30, 2025
92c692c
feat: get sources witnet sdk
gabaldon Jun 3, 2025
7f25faf
feat: finish redesign
gabaldon Jun 4, 2025
51c9ec9
feat(api): implement sources repository
Tommytrg Jun 13, 2025
3987e3a
feat: add correct source and network count for each feed
gabaldon Jun 17, 2025
7b6a77d
feat: adjust responsive
gabaldon Jun 17, 2025
35872e8
feat: delete unused code
gabaldon Jun 18, 2025
d08b371
feat: implement component to show correct available network icons
gabaldon Jun 18, 2025
aac8591
fix: adjust emtpy state
gabaldon Jun 18, 2025
a186686
feat: implement empty state
gabaldon Jun 19, 2025
1030465
fix: update scroll behaviour
gabaldon Jun 19, 2025
73b49ee
feat: add localized copies
gabaldon Jun 19, 2025
17691e9
fix: adjust style and meta
gabaldon Jun 20, 2025
0cd8202
chore: update to 0.4.2
gabaldon Jun 23, 2025
22843d0
fix: justify pagination
gabaldon Jun 23, 2025
804ada7
fix: adjust details empty state and footer color
gabaldon Jun 25, 2025
25a7cbc
fix: remove i18n warning
gabaldon Jun 25, 2025
efcb6d9
refactor: remove unused files
gabaldon Jun 25, 2025
afb9149
fix: adjust style in integration details
gabaldon Jun 25, 2025
a9fbe1e
fix: adjust loading state
gabaldon Jun 25, 2025
7bfa35c
refactor: remove unused type
gabaldon Jun 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
"docker:build": "pnpm m run docker:build"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^7.16.1",
"@typescript-eslint/parser": "^7.16.1",
"eslint": "^8.57.0",
"eslint": "^9.17.0",
"@eslint/js": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"typescript-eslint": "^8.18.1",
"eslint-plugin-prettier": "^5.1.2",
"eslint-plugin-vue": "^9.27.0",
"prettier": "^3.3.3",
Expand Down
23 changes: 0 additions & 23 deletions packages/api/.eslintrc.json

This file was deleted.

26 changes: 26 additions & 0 deletions packages/api/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import tseslint from 'typescript-eslint'
import pluginJs from '@eslint/js'
import eslintConfigPrettier from 'eslint-config-prettier'

export default [
pluginJs.configs.recommended,
...tseslint.configs.recommended,
eslintConfigPrettier,
{ files: ['**/*.ts'] },
{
ignores: ['node_modules', 'dist', 'src/generated'],
},
{
languageOptions: {
ecmaVersion: 6,
sourceType: 'module',
},
},
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': 'off',
'no-async-promise-executor': 'off',
},
},
]
10 changes: 6 additions & 4 deletions packages/api/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('dotenv').config({ path: './test/.test.env' })
import dotenv from 'dotenv'
dotenv.config({ path: '.test.env' })

module.exports = {
import { v4 as uuid } from 'uuid'

export default {
preset: 'ts-jest',
testEnvironment: 'node',
moduleNameMapper: {
// See https://stackoverflow.com/a/73203803
// Force module uuid to resolve with the CJS entry point, because Jest does not support package.json.exports. See https://github.com/uuidjs/uuid/issues/451
uuid: require.resolve('uuid'),
uuid: uuid,
},
}
11 changes: 5 additions & 6 deletions packages/api/migrate-mongo-config.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
require('dotenv/config')
import dotenv from 'dotenv'
dotenv.config()

const config = {
export const config = {
mongodb: {
url: process.env.MONGO_URI,
databaseName: process.env.MONGO_INITDB_DATABASE,
url: dotenv.env.MONGO_URI,
databaseName: dotenv.env.MONGO_INITDB_DATABASE,
},
migrationsDir: 'migrations',
changelogCollectionName: 'changelog',
migrationFileExtension: '.js',
useFileHash: false,
}

module.exports = config
2 changes: 1 addition & 1 deletion packages/api/migrations/1_rename-boba-networks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
async up(db) {
const resultRequestCollection = db.collection('result_request')
await Promise.all(
Expand Down
2 changes: 1 addition & 1 deletion packages/api/migrations/2_rename-conflux-networks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module.exports = {
export default {
async up(db) {
const resultRequestCollection = db.collection('result_request')
const updateConfluxTethysPromises = (
Expand Down
4 changes: 3 additions & 1 deletion packages/api/nodemon.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@
"watch": ["src"],
"ext": "ts",
"ignore": [".git", "node_modules"],
"exec": "./node_modules/.bin/ts-node --require dotenv/config ./src/index.ts"
"execMap": {
"ts": "pnpm node-ts -r dotenv/config ./src/index.ts"
}
}
15 changes: 10 additions & 5 deletions packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
{
"name": "api",
"description": "",
"main": "index.js",
"exports": "./index.js",
"type": "module",
"scripts": {
"build": "tsc -p tsconfig.build.json",
"codegen": "graphql-codegen --config ./codegen.yml",
"lint:js": "eslint --ext \".ts\" --ignore-path .gitignore .",
"lint:prettier": "prettier --check --ignore-path .gitignore .",
"lint:js": "eslint -c eslint.config.js --ignore-pattern .gitignore .",
"lint:prettier": "prettier --check .",
"lint": "pnpm lint:js && pnpm lint:prettier",
"lintfix": "prettier --write --list-different . && pnpm lint:js --fix",
"dev": "nodemon",
"start": "node dist/index.js",
"start": "node dist/src/index.js",
"test": "jest --runInBand",
"prepare": "pnpm run codegen",
"docker:build": "docker build . -t witnet/data-feeds-explorer-api --no-cache"
Expand All @@ -27,10 +28,13 @@
"nodemon": "^3.1.4",
"ts-jest": "29.2.2",
"ts-node": "10.9.2",
"typescript": "^5.0.4"
"typescript": "^5.0.4",
"typescript-eslint": "^8.18.1",
"uuid": "^11.1.0"
},
"dependencies": {
"@apollo/server": "^4.10.4",
"@witnet/sdk": "1.0.0-beta.0",
"axios": "^1.7.2",
"dataloader": "2.2.2",
"dotenv": "^16.0.3",
Expand All @@ -41,6 +45,7 @@
"node-cache": "^5.1.2",
"web3": "^4.11.0",
"web3-eth-contract": "^4.6.0",
"web3-providers-http": "^4.2.0",
"web3-utils": "^4.3.1"
}
}
2 changes: 1 addition & 1 deletion packages/api/src/database.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MongoClient } from 'mongodb'
import { Db } from '../types'
import { Db } from '../types.js'

export class MongoManager {
db: Db
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/fetchSvgs.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import axios from 'axios'
import { removeRepeatedElements } from './utils'
import { removeRepeatedElements } from './utils/index.js'

export const DEFAULT_SVG =
'<svg class="icon-size" width="34" height="34" viewBox="0 0 34 34" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="17" cy="17" r="17" fill="#C4C4C4"/><path d="M18.066 20.785h-2.988a9.951 9.951 0 0 1 .164-1.816c.11-.516.293-.98.551-1.395a6.466 6.466 0 0 1 1.055-1.23c.367-.328.687-.64.96-.938.274-.297.489-.601.645-.914.156-.32.235-.676.235-1.066 0-.453-.07-.828-.211-1.125a1.428 1.428 0 0 0-.61-.692c-.265-.156-.601-.234-1.008-.234-.336 0-.648.074-.937.223-.29.14-.527.359-.715.656-.18.297-.273.687-.281 1.172h-3.399c.024-1.07.27-1.953.739-2.649a4.252 4.252 0 0 1 1.91-1.558c.797-.344 1.691-.516 2.683-.516 1.094 0 2.032.18 2.813.54.781.35 1.379.87 1.793 1.558.414.68.62 1.508.62 2.484 0 .68-.132 1.285-.398 1.817a6.21 6.21 0 0 1-1.043 1.464c-.43.454-.902.922-1.417 1.407-.446.398-.75.816-.915 1.254-.156.437-.238.957-.246 1.558Zm-3.34 3.621c0-.5.172-.914.516-1.242.344-.336.805-.504 1.383-.504.57 0 1.027.168 1.371.504.352.328.527.742.527 1.242 0 .485-.175.895-.527 1.23-.344.337-.8.505-1.371.505-.578 0-1.04-.168-1.383-.504a1.655 1.655 0 0 1-.515-1.23Z" fill="#fff"/></svg>'
Expand Down
39 changes: 23 additions & 16 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
require('dotenv/config')

import Web3 from 'web3'
import { MongoManager } from './database'
import { FeedRepository } from './repository/Feed'
import { ResultRequestRepository } from './repository/ResultRequest'
import { createServer } from './server'
import dotenv from 'dotenv'
dotenv.config()

import { Web3 } from 'web3'
import { MongoManager } from './database.js'
import { FeedRepository } from './repository/Feed.js'
import { ResultRequestRepository } from './repository/ResultRequest.js'
import { createServer } from './server.js'
import {
RouterDataFeedsConfig,
Repositories,
FeedInfo,
NetworksConfig,
} from '../types'
import { Web3Middleware } from './web3Middleware/index'
import { normalizeNetworkConfig } from './utils/index'
import { fetchFeedsLegacy, fetchDataFeedsRouterConfig } from './readDataFeeds'
import { SvgCache } from './svgCache'
import { NetworkRouter } from './web3Middleware/NetworkRouter'
import { Configuration } from './web3Middleware/Configuration'
import { FeedsState } from './repository/feedState'
} from '../types.js'
import { Web3Middleware } from './web3Middleware/index.js'
import { normalizeNetworkConfig } from './utils/index.js'
import {
fetchFeedsLegacy,
fetchDataFeedsRouterConfig,
} from './readDataFeeds.js'
import { SvgCache } from './svgCache.js'
import { NetworkRouter } from './web3Middleware/NetworkRouter.js'
import { Configuration } from './web3Middleware/Configuration.js'
import { FeedsState } from './repository/feedState.js'
import { SourcesRepository } from './repository/Sources.js'

class DataFeedsExplorer {
routers: Array<NetworkRouter>
Expand Down Expand Up @@ -79,13 +84,15 @@ class DataFeedsExplorer {
this.repositories = {
feedRepository: new FeedRepository(this.feedsState),
resultRequestRepository: new ResultRequestRepository(db),
sourcesRepository: new SourcesRepository(db),
}
this.repositories.feedRepository.setLegacyFeeds(legacyFeeds)
this.repositories.feedRepository.setV2Feeds(v2Feeds)
this.repositories.feedRepository.setConfiguration(this.configuration)

const web3Middleware = new Web3Middleware(
this.configuration,
{ repositories: this.repositories, Web3: Web3 },
{ repositories: this.repositories, Web3 },
legacyFeeds,
)

Expand Down
9 changes: 6 additions & 3 deletions packages/api/src/loaders/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import DataLoader from 'dataloader'
import { SvgCache } from '../svgCache'
import { SvgCache } from '../svgCache.js'
import {
Loaders,
Repositories,
ResultRequestDbObjectNormalized,
} from '../../types'
} from '../../types.js'

export class LoadersFactory {
repositories: Repositories
Expand Down Expand Up @@ -42,7 +42,10 @@ export class LoadersFactory {
feedFullName,
),
),

sources: this.genericLoader<Promise<Array<string>>>(
async (feedFullName: string) =>
await this.repositories.sourcesRepository.getSources(feedFullName),
),
requests: this.genericLoader<
Promise<Array<ResultRequestDbObjectNormalized>>
>(async (filter: { feedFullName: string; timestamp: number }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/readDataFeeds.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios from 'axios'
import path from 'path'
import fs from 'fs'
import { RouterDataFeedsConfig, FeedInfo, FeedInfoConfig } from '../types'
import { normalizeConfig } from './utils'
import { RouterDataFeedsConfig, FeedInfo, FeedInfoConfig } from '../types.js'
import { normalizeConfig } from './utils/index.js'

const CONFIG_URL = process.env.TEST_BRANCH
? `https://raw.github.com/witnet/data-feeds-explorer/${process.env.TEST_BRANCH}/packages/api/src/dataFeedsRouter.json`
Expand Down
Loading