Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Bisonai/orakl into i-1456/feat/in…
Browse files Browse the repository at this point in the history
…tegration-vault-to-delegator
  • Loading branch information
jo-bisonai committed May 7, 2024
2 parents ab3db19 + 2268213 commit f2c0444
Show file tree
Hide file tree
Showing 18 changed files with 2,555 additions and 1,998 deletions.
3 changes: 3 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"recommendations": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"]
}
21 changes: 19 additions & 2 deletions cli/.eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,32 @@
],
"plugins": [
"prettier",
"@typescript-eslint"
"@typescript-eslint",
"import"
],
"rules": {
"no-throw-literal": "error",
"prettier/prettier": [
"error"
],
"@typescript-eslint/ban-ts-comment": "off"
"@typescript-eslint/ban-ts-comment": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"js": "always",
"ts": "always"
}
]
},
"overrides": [
{
"files": ["test/**"],
"rules": {
"import/extensions": "off"
}
}
],
"ignorePatterns": [
"src/cli/orakl-cli/dist/**"
],
Expand Down
7 changes: 4 additions & 3 deletions cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,17 @@
"devDependencies": {
"@jest/globals": "^29.3.1",
"@types/node": "^18.11.9",
"ts-node": "^10.9.1",
"typescript": "^4.9.3",
"@typescript-eslint/eslint-plugin": "^5.47.0",
"@typescript-eslint/parser": "^5.47.0",
"eslint": "^8.30.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.3.1",
"prettier": "^2.8.1",
"prettier-plugin-organize-imports": "^3.2.3",
"ts-jest": "^29.0.3"
"ts-jest": "^29.0.3",
"ts-node": "^10.9.1",
"typescript": "^4.9.3"
}
}
6 changes: 3 additions & 3 deletions cli/src/adapter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import axios from 'axios'
import { boolean as cmdboolean, command, flag, option, subcommands } from 'cmd-ts'
import { IAdapter, ReadFile } from './cli-types'
import { ORAKL_NETWORK_API_URL } from './settings'
import { buildUrl, idOption, isOraklNetworkApiHealthy } from './utils'
import { IAdapter, ReadFile } from './cli-types.js'
import { ORAKL_NETWORK_API_URL } from './settings.js'
import { buildUrl, idOption, isOraklNetworkApiHealthy } from './utils.js'

const ADAPTER_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'adapter')

Expand Down
6 changes: 3 additions & 3 deletions cli/src/aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ import {
string as cmdstring,
subcommands
} from 'cmd-ts'
import { IAggregator, ReadFile } from './cli-types'
import { ORAKL_NETWORK_API_URL, WORKER_SERVICE_HOST, WORKER_SERVICE_PORT } from './settings'
import { IAggregator, ReadFile } from './cli-types.js'
import { ORAKL_NETWORK_API_URL, WORKER_SERVICE_HOST, WORKER_SERVICE_PORT } from './settings.js'
import {
buildUrl,
chainOptionalOption,
fetcherTypeOptionalOption,
idOption,
isOraklNetworkApiHealthy,
isServiceHealthy
} from './utils'
} from './utils.js'

const AGGREGATOR_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'aggregator')

Expand Down
4 changes: 2 additions & 2 deletions cli/src/chain.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import { command, option, string as cmdstring, subcommands } from 'cmd-ts'
import { ORAKL_NETWORK_API_URL } from './settings'
import { buildUrl, idOption, isOraklNetworkApiHealthy } from './utils'
import { ORAKL_NETWORK_API_URL } from './settings.js'
import { buildUrl, idOption, isOraklNetworkApiHealthy } from './utils.js'

const CHAIN_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'chain')

Expand Down
4 changes: 2 additions & 2 deletions cli/src/cli-types.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Type } from 'cmd-ts'
import { existsSync } from 'node:fs'
import { CliError, CliErrorCode } from './errors'
import { isValidUrl, loadFile, loadJsonFromUrl } from './utils'
import { CliError, CliErrorCode } from './errors.js'
import { isValidUrl, loadFile, loadJsonFromUrl } from './utils.js'

export async function readFileFromSource(source: string) {
if (await isValidUrl(source)) {
Expand Down
21 changes: 12 additions & 9 deletions cli/src/datafeed.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { command, option, subcommands } from 'cmd-ts'
import { insertHandler as adapterInsertHandler } from './adapter'
import { insertHandler as adapterInsertHandler } from './adapter.js'
import {
activateHandler as aggregatorActivateHandler,
deactivateHandler as aggregatorDeactivateHandler,
insertHandler as aggregatorInsertHandler
} from './aggregator'
} from './aggregator.js'
import {
IAdapter,
IAggregator,
IDatafeedBulk,
IDatafeedBulkInsertElement,
ReadFile,
readFileFromSource
} from './cli-types'
} from './cli-types.js'
import {
contractConnectHandler,
contractInsertHandler,
Expand All @@ -25,22 +25,25 @@ import {
reporterInsertHandler as delegatorReporterInsertHandler,
reporterListHandler as delegatorReporterListHandler,
reporterRemoveHandler as delegatorReporterRemoveHandler
} from './delegator'
import { startHandler as fetcherStartHandler, stopHandler as fetcherStopHandler } from './fetcher'
} from './delegator.js'
import {
startHandler as fetcherStartHandler,
stopHandler as fetcherStopHandler
} from './fetcher.js'
import {
activateHandler as listenerActivateHandler,
deactivateHandler as listenerDeactivateHandler,
insertHandler as listenerInsertHandler,
listHandler as listenerListHandler,
removeHandler as listenerRemoveHandler
} from './listener'
} from './listener.js'
import {
activateHandler as reporterActivateHandler,
deactivateHandler as reporterDeactivateHandler,
insertHandler as reporterInsertHandler,
listHandler as reporterListHandler,
removeHandler as reporterRemoveHandler
} from './reporter'
} from './reporter.js'
import {
FETCHER_HOST,
FETCHER_PORT,
Expand All @@ -50,8 +53,8 @@ import {
REPORTER_SERVICE_PORT,
WORKER_SERVICE_HOST,
WORKER_SERVICE_PORT
} from './settings'
import { isValidUrl } from './utils'
} from './settings.js'
import { isValidUrl } from './utils.js'

export function datafeedSub() {
// datafeed bulk-insert --source ${source}
Expand Down
4 changes: 2 additions & 2 deletions cli/src/delegator.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import { command, number as cmdnumber, option, string as cmdstring, subcommands } from 'cmd-ts'
import { ORAKL_NETWORK_API_URL, ORAKL_NETWORK_DELEGATOR_URL } from './settings'
import { buildUrl, idOption, isOraklDelegatorHealthy } from './utils'
import { ORAKL_NETWORK_API_URL, ORAKL_NETWORK_DELEGATOR_URL } from './settings.js'
import { buildUrl, idOption, isOraklDelegatorHealthy } from './utils.js'

const AGGREGATOR_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'aggregator')

Expand Down
4 changes: 2 additions & 2 deletions cli/src/fetcher.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import { command, option, string as cmdstring, subcommands } from 'cmd-ts'
import { FETCHER_API_VERSION, FETCHER_HOST, FETCHER_PORT } from './settings'
import { buildFetcherUrl, buildUrl, isOraklFetcherHealthy } from './utils'
import { FETCHER_API_VERSION, FETCHER_HOST, FETCHER_PORT } from './settings.js'
import { buildFetcherUrl, buildUrl, isOraklFetcherHealthy } from './utils.js'

export function fetcherSub() {
// fetcher active --host ${host} --port ${port}
Expand Down
22 changes: 11 additions & 11 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/usr/bin/env node --no-warnings

import { binary, command, run, subcommands } from 'cmd-ts'
import { adapterSub } from './adapter'
import { aggregatorSub } from './aggregator'
import { chainSub } from './chain'
import { datafeedSub } from './datafeed'
import { delegatorSub } from './delegator'
import { fetcherSub } from './fetcher'
import { listenerSub } from './listener'
import { proxySub } from './proxy'
import { reporterSub } from './reporter'
import { serviceSub } from './service'
import { vrfSub } from './vrf'
import { adapterSub } from './adapter.js'
import { aggregatorSub } from './aggregator.js'
import { chainSub } from './chain.js'
import { datafeedSub } from './datafeed.js'
import { delegatorSub } from './delegator.js'
import { fetcherSub } from './fetcher.js'
import { listenerSub } from './listener.js'
import { proxySub } from './proxy.js'
import { reporterSub } from './reporter.js'
import { serviceSub } from './service.js'
import { vrfSub } from './vrf.js'

async function main() {
const chain = chainSub()
Expand Down
4 changes: 2 additions & 2 deletions cli/src/listener.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import axios from 'axios'
import { command, option, string as cmdstring, subcommands } from 'cmd-ts'
import { LISTENER_SERVICE_HOST, LISTENER_SERVICE_PORT, ORAKL_NETWORK_API_URL } from './settings'
import { LISTENER_SERVICE_HOST, LISTENER_SERVICE_PORT, ORAKL_NETWORK_API_URL } from './settings.js'
import {
buildUrl,
chainOptionalOption,
idOption,
isOraklNetworkApiHealthy,
isServiceHealthy,
serviceOptionalOption
} from './utils'
} from './utils.js'

const LISTENER_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'listener')
const AGGREGATOR_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'aggregator')
Expand Down
4 changes: 2 additions & 2 deletions cli/src/proxy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import { command, number, option, string as cmdstring, subcommands } from 'cmd-ts'
import { ORAKL_NETWORK_API_URL } from './settings'
import { buildUrl, idOption, isOraklNetworkApiHealthy, proxyOptionalOption } from './utils'
import { ORAKL_NETWORK_API_URL } from './settings.js'
import { buildUrl, idOption, isOraklNetworkApiHealthy, proxyOptionalOption } from './utils.js'

const PROXY_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'proxy')

Expand Down
4 changes: 2 additions & 2 deletions cli/src/reporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
isOraklNetworkApiHealthy,
isServiceHealthy,
serviceOptionalOption
} from './utils'
} from './utils.js'

import { ORAKL_NETWORK_API_URL, REPORTER_SERVICE_HOST, REPORTER_SERVICE_PORT } from './settings'
import { ORAKL_NETWORK_API_URL, REPORTER_SERVICE_HOST, REPORTER_SERVICE_PORT } from './settings.js'

const REPORTER_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'reporter')
const AGGREGATOR_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'aggregator')
Expand Down
4 changes: 2 additions & 2 deletions cli/src/service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import { command, option, string as cmdstring, subcommands } from 'cmd-ts'
import { ORAKL_NETWORK_API_URL } from './settings'
import { buildUrl, idOption, isOraklNetworkApiHealthy } from './utils'
import { ORAKL_NETWORK_API_URL } from './settings.js'
import { buildUrl, idOption, isOraklNetworkApiHealthy } from './utils.js'

const SERVICE_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'service')

Expand Down
2 changes: 1 addition & 1 deletion cli/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios'
import { number as cmdnumber, option, optional, string as cmdstring } from 'cmd-ts'
import { open as openFile, readFile } from 'node:fs/promises'
import { ORAKL_NETWORK_API_URL, ORAKL_NETWORK_DELEGATOR_URL } from './settings'
import { ORAKL_NETWORK_API_URL, ORAKL_NETWORK_DELEGATOR_URL } from './settings.js'

export const chainOptionalOption = option({
type: optional(cmdstring),
Expand Down
4 changes: 2 additions & 2 deletions cli/src/vrf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { keygen } from '@bisonai/orakl-vrf'
import axios from 'axios'
import { command, option, string as cmdstring, subcommands } from 'cmd-ts'
import ethers from 'ethers'
import { ORAKL_NETWORK_API_URL } from './settings'
import { buildUrl, chainOptionalOption, idOption, isOraklNetworkApiHealthy } from './utils'
import { ORAKL_NETWORK_API_URL } from './settings.js'
import { buildUrl, chainOptionalOption, idOption, isOraklNetworkApiHealthy } from './utils.js'

const VRF_ENDPOINT = buildUrl(ORAKL_NETWORK_API_URL, 'vrf')

Expand Down
Loading

0 comments on commit f2c0444

Please sign in to comment.