diff --git a/.changeset/cuddly-hotels-tell.md b/.changeset/cuddly-hotels-tell.md new file mode 100644 index 0000000000000..f70fd44eea03c --- /dev/null +++ b/.changeset/cuddly-hotels-tell.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/data-transport-layer': patch +--- + +Removes the unused L1DataTransportClient and its dependencies diff --git a/packages/data-transport-layer/package.json b/packages/data-transport-layer/package.json index 2a3c7b98305d1..389271f8b2677 100644 --- a/packages/data-transport-layer/package.json +++ b/packages/data-transport-layer/package.json @@ -47,24 +47,20 @@ "axios": "^0.21.1", "bcfg": "^0.1.6", "bfj": "^7.0.2", - "browser-or-node": "^1.3.0", "cors": "^2.8.5", "dotenv": "^10.0.0", "ethers": "^5.5.4", "express": "^4.17.1", "express-prom-bundle": "^6.3.6", "level": "^6.0.1", - "levelup": "^4.4.0", - "node-fetch": "^2.6.1" + "levelup": "^4.4.0" }, "devDependencies": { - "@types/browser-or-node": "^1.3.0", "@types/chai": "^4.2.18", "@types/chai-as-promised": "^7.1.4", "@types/cors": "^2.8.9", "@types/levelup": "^4.3.0", "@types/mocha": "^8.2.2", - "@types/node-fetch": "^2.5.10", "@typescript-eslint/eslint-plugin": "^4.26.0", "@typescript-eslint/parser": "^4.26.0", "babel-eslint": "^10.1.0", diff --git a/packages/data-transport-layer/src/client/client.ts b/packages/data-transport-layer/src/client/client.ts deleted file mode 100644 index 724c72c30295a..0000000000000 --- a/packages/data-transport-layer/src/client/client.ts +++ /dev/null @@ -1,74 +0,0 @@ -// Only load if not in browser. -import { isNode } from 'browser-or-node' - -// eslint-disable-next-line no-var -declare var window: any - -const fetch = isNode ? require('node-fetch') : window.fetch - -import { - EnqueueResponse, - StateRootBatchResponse, - StateRootResponse, - SyncingResponse, - TransactionBatchResponse, - TransactionResponse, -} from '../types' - -export class L1DataTransportClient { - constructor(private url: string) {} - - public async syncing(): Promise { - return this._get(`/eth/syncing`) - } - - public async getEnqueueByIndex(index: number): Promise { - return this._get(`/enqueue/index/${index}`) - } - - public async getLatestEnqueue(): Promise { - return this._get(`/enqueue/latest`) - } - - public async getTransactionByIndex( - index: number - ): Promise { - return this._get(`/transaction/index/${index}`) - } - - public async getLatestTransacton(): Promise { - return this._get(`/transaction/latest`) - } - - public async getTransactionBatchByIndex( - index: number - ): Promise { - return this._get(`/batch/transaction/index/${index}`) - } - - public async getLatestTransactionBatch(): Promise { - return this._get(`/batch/transaction/latest`) - } - - public async getStateRootByIndex(index: number): Promise { - return this._get(`/stateroot/index/${index}`) - } - - public async getLatestStateRoot(): Promise { - return this._get(`/stateroot/latest`) - } - - public async getStateRootBatchByIndex( - index: number - ): Promise { - return this._get(`/batch/stateroot/index/${index}`) - } - - public async getLatestStateRootBatch(): Promise { - return this._get(`/batch/stateroot/latest`) - } - - private async _get(endpoint: string): Promise { - return (await fetch(`${this.url}${endpoint}`)).json() - } -} diff --git a/packages/data-transport-layer/src/index.ts b/packages/data-transport-layer/src/index.ts index 4dfc5895941fb..c9f6f047dc007 100644 --- a/packages/data-transport-layer/src/index.ts +++ b/packages/data-transport-layer/src/index.ts @@ -1,2 +1 @@ -export * from './client/client' export * from './types' diff --git a/yarn.lock b/yarn.lock index bbbb207a7d7f1..d181bb2d06c74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3035,11 +3035,6 @@ "@types/connect" "*" "@types/node" "*" -"@types/browser-or-node@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@types/browser-or-node/-/browser-or-node-1.3.0.tgz#896ec59bcb8109fc858d8e68d3c056c176a19622" - integrity sha512-MVetr65IR7RdJbUxVHsaPFaXAO8fi89zv1g8L/mHygh1Q7xnnK02XZLwfMh57FOpTO6gtnagoPMQ/UOFfctXRQ== - "@types/chai-as-promised@^7.1.4": version "7.1.4" resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.4.tgz#caf64e76fb056b8c8ced4b761ed499272b737601" @@ -3168,14 +3163,6 @@ resolved "https://registry.yarnpkg.com/@types/mocha/-/mocha-8.2.3.tgz#bbeb55fbc73f28ea6de601fbfa4613f58d785323" integrity sha512-ekGvFhFgrc2zYQoX4JeZPmVzZxw6Dtllga7iGHzfbYIYkAMUx/sAFP2GdFpLff+vdHXu5fl7WX9AT+TtqYcsyw== -"@types/node-fetch@^2.5.10": - version "2.5.12" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66" - integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw== - dependencies: - "@types/node" "*" - form-data "^3.0.0" - "@types/node-fetch@^2.5.5": version "2.5.10" resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.10.tgz#9b4d4a0425562f9fcea70b12cb3fcdd946ca8132" @@ -4825,11 +4812,6 @@ brorand@^1.0.1, brorand@^1.1.0: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8= -browser-or-node@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/browser-or-node/-/browser-or-node-1.3.0.tgz#f2a4e8568f60263050a6714b2cc236bb976647a7" - integrity sha512-0F2z/VSnLbmEeBcUrSuDH5l0HxTXdQQzLjkmBR4cYfvg1zJrKSlmIZFqyFR8oX0NrwPhy3c3HQ6i3OxMbew4Tg== - browser-stdout@1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/browser-stdout/-/browser-stdout-1.3.1.tgz#baa559ee14ced73452229bad7326467c61fabd60"