From 4810474f2db192496bc61a06044e605247e55494 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sobieraj-Jakubiec?= Date: Tue, 22 Aug 2023 18:14:34 +0200 Subject: [PATCH 1/7] Create types package --- packages/types/.eslintrc.js | 3 + packages/types/.mocharc.json | 7 + packages/types/.prettierignore | 2 + packages/types/.prettierrc | 7 + packages/types/LICENSE | 7 + packages/types/README.md | 3 + packages/types/package.json | 37 +++++ packages/types/src/EthereumAddress.test.ts | 67 +++++++++ packages/types/src/EthereumAddress.ts | 46 +++++++ packages/types/src/index.ts | 2 + packages/types/src/proxyDetails.ts | 148 ++++++++++++++++++++ packages/types/tsconfig.json | 8 ++ yarn.lock | 152 +++++++++++++++++++++ 13 files changed, 489 insertions(+) create mode 100644 packages/types/.eslintrc.js create mode 100644 packages/types/.mocharc.json create mode 100644 packages/types/.prettierignore create mode 100644 packages/types/.prettierrc create mode 100644 packages/types/LICENSE create mode 100644 packages/types/README.md create mode 100644 packages/types/package.json create mode 100644 packages/types/src/EthereumAddress.test.ts create mode 100644 packages/types/src/EthereumAddress.ts create mode 100644 packages/types/src/index.ts create mode 100644 packages/types/src/proxyDetails.ts create mode 100644 packages/types/tsconfig.json diff --git a/packages/types/.eslintrc.js b/packages/types/.eslintrc.js new file mode 100644 index 00000000..ac965337 --- /dev/null +++ b/packages/types/.eslintrc.js @@ -0,0 +1,3 @@ +module.exports = { + extends: '../../.eslintrc.json', +} diff --git a/packages/types/.mocharc.json b/packages/types/.mocharc.json new file mode 100644 index 00000000..862b85f9 --- /dev/null +++ b/packages/types/.mocharc.json @@ -0,0 +1,7 @@ +{ + "spec": "src/**/*.test.ts", + "require": ["esbuild-register"], + "watchExtensions": "ts", + "extension": "ts", + "reporterOption": "maxDiffSize=0" +} diff --git a/packages/types/.prettierignore b/packages/types/.prettierignore new file mode 100644 index 00000000..f06235c4 --- /dev/null +++ b/packages/types/.prettierignore @@ -0,0 +1,2 @@ +node_modules +dist diff --git a/packages/types/.prettierrc b/packages/types/.prettierrc new file mode 100644 index 00000000..468f86ea --- /dev/null +++ b/packages/types/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": false, + "singleQuote": true, + "printWidth": 80, + "bracketSpacing": true, + "trailingComma": "all" +} diff --git a/packages/types/LICENSE b/packages/types/LICENSE new file mode 100644 index 00000000..65666e0a --- /dev/null +++ b/packages/types/LICENSE @@ -0,0 +1,7 @@ +Copyright © 2023 L2BEAT + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/packages/types/README.md b/packages/types/README.md new file mode 100644 index 00000000..a68290d7 --- /dev/null +++ b/packages/types/README.md @@ -0,0 +1,3 @@ +# L2BEAT Backend Tools + +A set of backend utilities common for L2BEAT applications. diff --git a/packages/types/package.json b/packages/types/package.json new file mode 100644 index 00000000..cfb4ecf4 --- /dev/null +++ b/packages/types/package.json @@ -0,0 +1,37 @@ +{ + "name": "@l2beat/types", + "description": "Common types for L2BEAT projects.", + "version": "0.1.0", + "license": "MIT", + "repository": "https://github.com/l2beat/tools", + "bugs": { + "url": "https://github.com/l2beat/tools/issues" + }, + "author": "Michał Sobieraj-Jakubiec ", + "main": "dist/index.js", + "types": "dist/index.d.ts", + "files": [ + "dist", + "src", + "!**/*.test.*", + "!**/*.snapshot", + "!src/test", + "!dist/test" + ], + "scripts": { + "test": "mocha", + "clean": "rm -rf dist", + "build": "tsc", + "start": "node -r esbuild-register src/", + "format:fix": "prettier --write .", + "format": "prettier --check .", + "lint:fix": "yarn lint --fix", + "lint": "eslint --ext .ts,.tsx --max-warnings 0 src", + "typecheck": "tsc --noEmit" + }, + "dependencies": { + "viem": "^1.6.7", + "zod": "^3.22.2" + }, + "devDependencies": {} +} diff --git a/packages/types/src/EthereumAddress.test.ts b/packages/types/src/EthereumAddress.test.ts new file mode 100644 index 00000000..6c8e7031 --- /dev/null +++ b/packages/types/src/EthereumAddress.test.ts @@ -0,0 +1,67 @@ +import { expect } from 'earl' + +import { EthereumAddress } from './EthereumAddress' + +describe(EthereumAddress.name, () => { + it('accepts lowercase addresses', () => { + const address = EthereumAddress( + '0xabcdabcd12345678abcdabcd12345678abcdabcd', + ) + expect(address).toBeA(String) + }) + + it('accepts addresses with checksum', () => { + const address = EthereumAddress( + '0xAbCdABCd12345678abcDabCd12345678ABcdaBcd', + ) + expect(address).toBeA(String) + }) + + it('accepts addresses with mixed case that is not a checksum', () => { + const address = '0xAbCdABCd12345678abcDabCd12345678ABcdaBcD' + expect( + EthereumAddress('0xAbCdABCd12345678abcDabCd12345678ABcdaBcD'), + ).toEqual( + '0xAbCdABCd12345678abcDabCd12345678ABcdaBcd' as unknown as EthereumAddress, + ) + }) + + it('does not accept invalid strings', () => { + expect(() => EthereumAddress('foo')).toThrow( + TypeError, + 'Invalid EthereumAddress', + ) + }) + + it('converts to a representation with a checksum', () => { + const address = EthereumAddress( + '0xabcdabcd12345678abcdabcd12345678abcdabcd', + ) + expect(address).toEqual( + '0xAbCdABCd12345678abcDabCd12345678ABcdaBcd' as unknown as EthereumAddress, + ) + }) + + describe(EthereumAddress.isBefore.name, () => { + it('checks ordering', () => { + const a = EthereumAddress('0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') + const b = EthereumAddress('0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb') + expect(EthereumAddress.isBefore(a, b)).toEqual(true) + expect(EthereumAddress.isBefore(b, a)).toEqual(false) + expect(EthereumAddress.isBefore(a, a)).toEqual(false) + }) + + it('works for WETH & USDT', () => { + const weth = EthereumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2') + const usdt = EthereumAddress('0xdAC17F958D2ee523a2206206994597C13D831ec7') + expect(EthereumAddress.isBefore(weth, usdt)).toEqual(true) + expect(EthereumAddress.isBefore(usdt, weth)).toEqual(false) + }) + }) + + it('ZERO is the zero address', () => { + expect(EthereumAddress.ZERO).toEqual( + ('0x' + '0'.repeat(40)) as unknown as EthereumAddress, + ) + }) +}) diff --git a/packages/types/src/EthereumAddress.ts b/packages/types/src/EthereumAddress.ts new file mode 100644 index 00000000..c67dd175 --- /dev/null +++ b/packages/types/src/EthereumAddress.ts @@ -0,0 +1,46 @@ +import { getAddress } from 'viem' + +export interface EthereumAddress extends String { + _EthereumAddressBrand: string +} + +export function EthereumAddress(value: string) { + try { + return getAddress(value) as unknown as EthereumAddress + } catch { + throw new TypeError('Invalid EthereumAddress') + } +} + +EthereumAddress.ZERO = EthereumAddress('0x' + '0'.repeat(40)) + +EthereumAddress.check = function check(value: string) { + try { + return EthereumAddress(value).toString() === value + } catch { + return false + } +} + +EthereumAddress.isBefore = function isBefore( + a: EthereumAddress, + b: EthereumAddress, +) { + return a.toLowerCase() < b.toLowerCase() +} + +EthereumAddress.inOrder = function inOrder( + a: EthereumAddress, + b: EthereumAddress, +): [EthereumAddress, EthereumAddress] { + return EthereumAddress.isBefore(a, b) ? [a, b] : [b, a] +} + +EthereumAddress.random = function random() { + const digit = () => '0123456789abcdef'[Math.floor(Math.random() * 16)] + return EthereumAddress('0x' + Array.from({ length: 40 }).map(digit).join('')) +} + +EthereumAddress.unsafe = function unsafe(address: string) { + return address as unknown as EthereumAddress +} diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts new file mode 100644 index 00000000..88d24a49 --- /dev/null +++ b/packages/types/src/index.ts @@ -0,0 +1,2 @@ +export * from './EthereumAddress' +export * from './proxyDetails' diff --git a/packages/types/src/proxyDetails.ts b/packages/types/src/proxyDetails.ts new file mode 100644 index 00000000..d5282a65 --- /dev/null +++ b/packages/types/src/proxyDetails.ts @@ -0,0 +1,148 @@ +import { z } from 'zod' +import { EthereumAddress } from './EthereumAddress' + +export interface ProxyDetails { + upgradeability: UpgradeabilityParameters + implementations: EthereumAddress[] + relatives: EthereumAddress[] +} + +export type ManualProxyType = z.infer +export const ManualProxyType = z.enum([ + 'new Arbitrum proxy', + 'call implementation proxy', + 'zkSync Lite proxy', + 'zkSpace proxy', + 'Eternal Storage proxy', + 'Polygon Extension proxy', +]) + +export type UpgradeabilityParameters = + | ImmutableUpgradeability + | GnosisSafeUpgradeability + | EIP1967ProxyUpgradeability + | PolygonProxyUpgradeability + | ZeppelinOSProxyUpgradeability + | StarkWareProxyUpgradeability + | StarkWareDiamondUpgradeability + | ArbitrumProxyUpgradeability + | NewArbitrumProxyUpgradeability + | ResolvedDelegateProxyUpgradeability + | EIP897ProxyUpgradeability + | CallImplementationProxyUpgradeability + | EIP2535ProxyUpgradeability + | ZkSyncLiteProxyUpgradeability + | EternalStorageProxyUpgradeability + | PolygonExtensionProxyUpgradeability + | ZkSpaceProxyUpgradeability + +export interface ImmutableUpgradeability { + type: 'immutable' +} + +export interface GnosisSafeUpgradeability { + type: 'gnosis safe' + masterCopy: EthereumAddress +} + +export interface EIP1967ProxyUpgradeability { + type: 'EIP1967 proxy' + admin: EthereumAddress + implementation: EthereumAddress +} + +export interface PolygonProxyUpgradeability { + type: 'Polygon proxy' + admin: EthereumAddress + implementation: EthereumAddress +} + +export interface ZeppelinOSProxyUpgradeability { + type: 'ZeppelinOS proxy' + admin?: EthereumAddress + owner?: EthereumAddress + implementation: EthereumAddress +} + +export interface StarkWareProxyUpgradeability { + type: 'StarkWare proxy' + implementation: EthereumAddress + callImplementation?: EthereumAddress + upgradeDelay: number + isFinal: boolean + useConstantDelay?: boolean + proxyGovernance?: EthereumAddress[] +} + +export interface StarkWareDiamondUpgradeability { + type: 'StarkWare diamond' + implementation: EthereumAddress + upgradeDelay: number + isFinal: boolean + facets: Record + proxyGovernance?: EthereumAddress[] +} + +export interface ArbitrumProxyUpgradeability { + type: 'Arbitrum proxy' + admin: EthereumAddress + adminImplementation: EthereumAddress + userImplementation: EthereumAddress +} + +export interface NewArbitrumProxyUpgradeability { + type: 'new Arbitrum proxy' + admin: EthereumAddress + implementation: EthereumAddress + adminImplementation: EthereumAddress + userImplementation: EthereumAddress +} + +export interface ResolvedDelegateProxyUpgradeability { + type: 'resolved delegate proxy' + addressManager: EthereumAddress + implementationName: string + implementation: EthereumAddress +} + +export interface EIP897ProxyUpgradeability { + type: 'EIP897 proxy' + isUpgradable: boolean + implementation: EthereumAddress +} + +export interface CallImplementationProxyUpgradeability { + type: 'call implementation proxy' + implementation: EthereumAddress +} + +export interface EIP2535ProxyUpgradeability { + type: 'EIP2535 diamond proxy' + facets: EthereumAddress[] +} + +export interface ZkSyncLiteProxyUpgradeability { + type: 'zkSync Lite proxy' + admin: EthereumAddress + implementation: EthereumAddress + additional: EthereumAddress +} + +export interface EternalStorageProxyUpgradeability { + type: 'Eternal Storage proxy' + admin: EthereumAddress + implementation: EthereumAddress +} + +export interface PolygonExtensionProxyUpgradeability { + type: 'Polygon Extension proxy' + admin: EthereumAddress + implementation: EthereumAddress + extension: EthereumAddress +} +export interface ZkSpaceProxyUpgradeability { + type: 'zkSpace proxy' + admin: EthereumAddress + implementation: EthereumAddress + additional: EthereumAddress[] +} diff --git a/packages/types/tsconfig.json b/packages/types/tsconfig.json new file mode 100644 index 00000000..ea383eb8 --- /dev/null +++ b/packages/types/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "incremental": true + }, + "include": ["src"] +} diff --git a/yarn.lock b/yarn.lock index e996e6aa..8322e98f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,16 @@ # yarn lockfile v1 +"@adraffy/ens-normalize@1.9.0": + version "1.9.0" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz#223572538f6bea336750039bb43a4016dcc8182d" + integrity sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ== + +"@adraffy/ens-normalize@1.9.2": + version "1.9.2" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz#60111a5d9db45b2e5cbb6231b0bb8d97e8659316" + integrity sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg== + "@babel/code-frame@^7.0.0": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.5.tgz#234d98e1551960604f1246e6475891a570ad5658" @@ -447,6 +457,40 @@ globby "^11.0.0" read-yaml-file "^1.1.0" +"@noble/curves@1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" + integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== + dependencies: + "@noble/hashes" "1.3.1" + +"@noble/curves@~1.0.0": + version "1.0.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932" + integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw== + dependencies: + "@noble/hashes" "1.3.0" + +"@noble/hashes@1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" + integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== + +"@noble/hashes@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" + integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== + +"@noble/hashes@1.3.1", "@noble/hashes@~1.3.0": + version "1.3.1" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" + integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== + +"@noble/secp256k1@1.7.1": + version "1.7.1" + resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" + integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw== + "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" @@ -468,6 +512,28 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" +"@scure/base@~1.1.0": + version "1.1.1" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938" + integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA== + +"@scure/bip32@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.0.tgz#6c8d980ef3f290987736acd0ee2e0f0d50068d87" + integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q== + dependencies: + "@noble/curves" "~1.0.0" + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + +"@scure/bip39@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b" + integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg== + dependencies: + "@noble/hashes" "~1.3.0" + "@scure/base" "~1.1.0" + "@sinonjs/commons@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.0.tgz#beb434fe875d965265e04722ccfc21df7f755d72" @@ -549,6 +615,16 @@ resolved "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz" integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q== +"@types/node@*": + version "20.5.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.2.tgz#02850ed821c8113fd6ed9ae5c744b7f7cd6d6f51" + integrity sha512-5j/lXt7unfPOUlrKC34HIaedONleyLtwkKggiD/0uuMfT8gg2EOpg0dz4lCD15Ga7muC+1WzJZAjIB9simWd6Q== + +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + "@types/node@^12.7.1": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" @@ -574,6 +650,13 @@ resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz#bf2e02a3dbd4aecaf95942ecd99b7402e03fad5e" integrity sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA== +"@types/ws@^8.5.4": + version "8.5.5" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.5.tgz#af587964aa06682702ee6dcbc7be41a80e4b28eb" + integrity sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" @@ -670,6 +753,16 @@ "@typescript-eslint/types" "5.59.5" eslint-visitor-keys "^3.3.0" +"@wagmi/chains@1.7.0": + version "1.7.0" + resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-1.7.0.tgz#8f6ad81cf867e1788417f7c978ca92bc083ecaf6" + integrity sha512-TKVeHv0GqP5sV1yQ8BDGYToAFezPnCexbbBpeH14x7ywi5a1dDStPffpt9x+ytE6LJWkZ6pAMs/HNWXBQ5Nqmw== + +abitype@0.9.3: + version "0.9.3" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.3.tgz#294d25288ee683d72baf4e1fed757034e3c8c277" + integrity sha512-dz4qCQLurx97FQhnb/EIYTk/ldQ+oafEDUqC0VVIeQS1Q48/YWt/9YNfMmp9SLFqN41ktxny3c8aYxHjmFIB/w== + acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" @@ -685,6 +778,11 @@ acorn@^8.4.1, acorn@^8.8.0: resolved "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz" integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== + ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" @@ -1520,6 +1618,19 @@ esutils@^2.0.2: resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== +ethers@^6.7.1: + version "6.7.1" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.7.1.tgz#9c65e8b5d8e9ad77b7e8cf1c46099892cfafad49" + integrity sha512-qX5kxIFMfg1i+epfgb0xF4WM7IqapIIu50pOJ17aebkxxa4BacW5jFrQRmCJpDEg2ZK2oNtR5QjrQ1WDBF29dA== + dependencies: + "@adraffy/ens-normalize" "1.9.2" + "@noble/hashes" "1.1.2" + "@noble/secp256k1" "1.7.1" + "@types/node" "18.15.13" + aes-js "4.0.0-beta.5" + tslib "2.4.0" + ws "8.5.0" + execa@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz" @@ -2121,6 +2232,11 @@ isexe@^2.0.0: resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== +isomorphic-ws@5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" + integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== + jest-changed-files@^24.9.0: version "24.9.0" resolved "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz" @@ -3210,6 +3326,11 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^1.8.1: version "1.14.1" resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" @@ -3316,6 +3437,22 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" +viem@^1.6.7: + version "1.6.7" + resolved "https://registry.yarnpkg.com/viem/-/viem-1.6.7.tgz#2445ea47aae96f5bfc3b79ed08df20ce9530ca7a" + integrity sha512-w2OMJqKcQrzPQnmMFxe4ex+md8wSwfle6L3LvEi25CBvDKhkuljVrsWY19UzG05ssQhiZ+cdxU3YMBrX817Qiw== + dependencies: + "@adraffy/ens-normalize" "1.9.0" + "@noble/curves" "1.1.0" + "@noble/hashes" "1.3.0" + "@scure/bip32" "1.3.0" + "@scure/bip39" "1.2.0" + "@types/ws" "^8.5.4" + "@wagmi/chains" "1.7.0" + abitype "0.9.3" + isomorphic-ws "5.0.0" + ws "8.12.0" + wait-for-expect@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-3.0.2.tgz#d2f14b2f7b778c9b82144109c8fa89ceaadaa463" @@ -3420,6 +3557,16 @@ wrappy@1: resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== +ws@8.12.0: + version "8.12.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" + integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== + +ws@8.5.0: + version "8.5.0" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" + integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== + wsrun@^5.2.4: version "5.2.4" resolved "https://registry.npmjs.org/wsrun/-/wsrun-5.2.4.tgz" @@ -3564,3 +3711,8 @@ yocto-queue@^0.1.0: version "0.1.0" resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== + +zod@^3.22.2: + version "3.22.2" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.2.tgz#3add8c682b7077c05ac6f979fea6998b573e157b" + integrity sha512-wvWkphh5WQsJbVk1tbx1l1Ly4yg+XecD+Mq280uBGt9wa5BKSWf4Mhp6GmrkPixhMxmabYY7RbzlwVP32pbGCg== From 1c9d7427e8de145172c2b3cba8bec27fd66f3be7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sobieraj-Jakubiec?= Date: Tue, 22 Aug 2023 18:27:23 +0200 Subject: [PATCH 2/7] Move Discovery types --- packages/types/src/Discovery.ts | 31 ++++++++++++++++++++++++++++++ packages/types/src/Hash256.test.ts | 24 +++++++++++++++++++++++ packages/types/src/Hash256.ts | 15 +++++++++++++++ packages/types/src/index.ts | 2 ++ 4 files changed, 72 insertions(+) create mode 100644 packages/types/src/Discovery.ts create mode 100644 packages/types/src/Hash256.test.ts create mode 100644 packages/types/src/Hash256.ts diff --git a/packages/types/src/Discovery.ts b/packages/types/src/Discovery.ts new file mode 100644 index 00000000..d29e63e4 --- /dev/null +++ b/packages/types/src/Discovery.ts @@ -0,0 +1,31 @@ +import { EthereumAddress } from './EthereumAddress' +import { Hash256 } from './Hash256' +import { UpgradeabilityParameters } from './proxyDetails' + +export interface DiscoveryOutput { + name: string + chain: string + blockNumber: number + contracts: ContractParameters[] + eoas: EthereumAddress[] + abis: Record + configHash: Hash256 + version: number +} + +export interface ContractParameters { + name: string + derivedName?: string + unverified?: true + address: EthereumAddress + upgradeability: UpgradeabilityParameters + values?: Record + errors?: Record +} + +export type ContractValue = + | string + | number + | boolean + | ContractValue[] + | { [key: string]: ContractValue | undefined } diff --git a/packages/types/src/Hash256.test.ts b/packages/types/src/Hash256.test.ts new file mode 100644 index 00000000..bf95f9ab --- /dev/null +++ b/packages/types/src/Hash256.test.ts @@ -0,0 +1,24 @@ +import { expect } from 'earl' + +import { Hash256 } from './Hash256' + +describe(Hash256.name, () => { + it('accepts lowercase hashes', () => { + const hash = Hash256( + '0xabcdabcd12345678abcdabcd12345678abcdabcd12345678abcdabcd12345678', + ) + expect(hash).toBeA(String) + }) + + it('does not accept mixed case hashes', () => { + expect(() => + Hash256( + '0xabcdabcd12345678ABCDABCD12345678ABCDABCD12345678abcdabcd12345678', + ), + ).toThrow(TypeError, 'Invalid Hash256') + }) + + it('does not accept invalid strings', () => { + expect(() => Hash256('foo')).toThrow(TypeError, 'Invalid Hash256') + }) +}) diff --git a/packages/types/src/Hash256.ts b/packages/types/src/Hash256.ts new file mode 100644 index 00000000..d3454e9c --- /dev/null +++ b/packages/types/src/Hash256.ts @@ -0,0 +1,15 @@ +export interface Hash256 extends String { + _Hash256Brand: string +} + +export function Hash256(value: string) { + if (!/^0x[\da-f]{64}$/.test(value)) { + throw new TypeError('Invalid Hash256') + } + return value as unknown as Hash256 +} + +Hash256.random = function random() { + const digit = () => '0123456789abcdef'[Math.floor(Math.random() * 16)] + return Hash256('0x' + Array.from({ length: 64 }).map(digit).join('')) +} diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts index 88d24a49..b602e4d6 100644 --- a/packages/types/src/index.ts +++ b/packages/types/src/index.ts @@ -1,2 +1,4 @@ +export * from './Discovery' export * from './EthereumAddress' +export * from './Hash256' export * from './proxyDetails' From 00dd6c8ce5fdc688abe996a6c6613a7f944dbfdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sobieraj-Jakubiec?= Date: Tue, 22 Aug 2023 18:32:54 +0200 Subject: [PATCH 3/7] Remove ethers from yarn.lock --- yarn.lock | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8322e98f..4afb105a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,11 +7,6 @@ resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz#223572538f6bea336750039bb43a4016dcc8182d" integrity sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ== -"@adraffy/ens-normalize@1.9.2": - version "1.9.2" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz#60111a5d9db45b2e5cbb6231b0bb8d97e8659316" - integrity sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg== - "@babel/code-frame@^7.0.0": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.5.tgz#234d98e1551960604f1246e6475891a570ad5658" @@ -471,11 +466,6 @@ dependencies: "@noble/hashes" "1.3.0" -"@noble/hashes@1.1.2": - version "1.1.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" - integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== - "@noble/hashes@1.3.0": version "1.3.0" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" @@ -486,11 +476,6 @@ resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== -"@noble/secp256k1@1.7.1": - version "1.7.1" - resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.7.1.tgz#b251c70f824ce3ca7f8dc3df08d58f005cc0507c" - integrity sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" @@ -620,11 +605,6 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.2.tgz#02850ed821c8113fd6ed9ae5c744b7f7cd6d6f51" integrity sha512-5j/lXt7unfPOUlrKC34HIaedONleyLtwkKggiD/0uuMfT8gg2EOpg0dz4lCD15Ga7muC+1WzJZAjIB9simWd6Q== -"@types/node@18.15.13": - version "18.15.13" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" - integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== - "@types/node@^12.7.1": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" @@ -778,11 +758,6 @@ acorn@^8.4.1, acorn@^8.8.0: resolved "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz" integrity sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw== -aes-js@4.0.0-beta.5: - version "4.0.0-beta.5" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" - integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== - ajv@^6.10.0, ajv@^6.12.4: version "6.12.6" resolved "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz" @@ -1618,19 +1593,6 @@ esutils@^2.0.2: resolved "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -ethers@^6.7.1: - version "6.7.1" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.7.1.tgz#9c65e8b5d8e9ad77b7e8cf1c46099892cfafad49" - integrity sha512-qX5kxIFMfg1i+epfgb0xF4WM7IqapIIu50pOJ17aebkxxa4BacW5jFrQRmCJpDEg2ZK2oNtR5QjrQ1WDBF29dA== - dependencies: - "@adraffy/ens-normalize" "1.9.2" - "@noble/hashes" "1.1.2" - "@noble/secp256k1" "1.7.1" - "@types/node" "18.15.13" - aes-js "4.0.0-beta.5" - tslib "2.4.0" - ws "8.5.0" - execa@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/execa/-/execa-1.0.0.tgz" @@ -3326,11 +3288,6 @@ tsconfig-paths@^3.14.1: minimist "^1.2.6" strip-bom "^3.0.0" -tslib@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" - integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== - tslib@^1.8.1: version "1.14.1" resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz" @@ -3562,11 +3519,6 @@ ws@8.12.0: resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== -ws@8.5.0: - version "8.5.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.5.0.tgz#bfb4be96600757fe5382de12c670dab984a1ed4f" - integrity sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg== - wsrun@^5.2.4: version "5.2.4" resolved "https://registry.npmjs.org/wsrun/-/wsrun-5.2.4.tgz" From 9905870876d8a3b5f6a8d76b4637bf9d0fc4d5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sobieraj-Jakubiec?= Date: Tue, 22 Aug 2023 18:59:14 +0200 Subject: [PATCH 4/7] Fix lint --- packages/types/src/EthereumAddress.test.ts | 1 - packages/types/src/EthereumAddress.ts | 17 ++++++++++------- packages/types/src/Hash256.ts | 9 +++++---- packages/types/src/proxyDetails.ts | 1 + packages/types/src/utils/randomHexDigit.ts | 3 +++ 5 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 packages/types/src/utils/randomHexDigit.ts diff --git a/packages/types/src/EthereumAddress.test.ts b/packages/types/src/EthereumAddress.test.ts index 6c8e7031..6c503788 100644 --- a/packages/types/src/EthereumAddress.test.ts +++ b/packages/types/src/EthereumAddress.test.ts @@ -18,7 +18,6 @@ describe(EthereumAddress.name, () => { }) it('accepts addresses with mixed case that is not a checksum', () => { - const address = '0xAbCdABCd12345678abcDabCd12345678ABcdaBcD' expect( EthereumAddress('0xAbCdABCd12345678abcDabCd12345678ABcdaBcD'), ).toEqual( diff --git a/packages/types/src/EthereumAddress.ts b/packages/types/src/EthereumAddress.ts index c67dd175..b173e53e 100644 --- a/packages/types/src/EthereumAddress.ts +++ b/packages/types/src/EthereumAddress.ts @@ -1,10 +1,12 @@ import { getAddress } from 'viem' +import { randomHexDigit } from './utils/randomHexDigit' + export interface EthereumAddress extends String { _EthereumAddressBrand: string } -export function EthereumAddress(value: string) { +export function EthereumAddress(value: string): EthereumAddress { try { return getAddress(value) as unknown as EthereumAddress } catch { @@ -14,7 +16,7 @@ export function EthereumAddress(value: string) { EthereumAddress.ZERO = EthereumAddress('0x' + '0'.repeat(40)) -EthereumAddress.check = function check(value: string) { +EthereumAddress.check = function check(value: string): boolean { try { return EthereumAddress(value).toString() === value } catch { @@ -25,7 +27,7 @@ EthereumAddress.check = function check(value: string) { EthereumAddress.isBefore = function isBefore( a: EthereumAddress, b: EthereumAddress, -) { +): boolean { return a.toLowerCase() < b.toLowerCase() } @@ -36,11 +38,12 @@ EthereumAddress.inOrder = function inOrder( return EthereumAddress.isBefore(a, b) ? [a, b] : [b, a] } -EthereumAddress.random = function random() { - const digit = () => '0123456789abcdef'[Math.floor(Math.random() * 16)] - return EthereumAddress('0x' + Array.from({ length: 40 }).map(digit).join('')) +EthereumAddress.random = function random(): EthereumAddress { + return EthereumAddress( + '0x' + Array.from({ length: 40 }).map(randomHexDigit).join(''), + ) } -EthereumAddress.unsafe = function unsafe(address: string) { +EthereumAddress.unsafe = function unsafe(address: string): EthereumAddress { return address as unknown as EthereumAddress } diff --git a/packages/types/src/Hash256.ts b/packages/types/src/Hash256.ts index d3454e9c..17a91297 100644 --- a/packages/types/src/Hash256.ts +++ b/packages/types/src/Hash256.ts @@ -1,15 +1,16 @@ +import { randomHexDigit } from './utils/randomHexDigit' + export interface Hash256 extends String { _Hash256Brand: string } -export function Hash256(value: string) { +export function Hash256(value: string): Hash256 { if (!/^0x[\da-f]{64}$/.test(value)) { throw new TypeError('Invalid Hash256') } return value as unknown as Hash256 } -Hash256.random = function random() { - const digit = () => '0123456789abcdef'[Math.floor(Math.random() * 16)] - return Hash256('0x' + Array.from({ length: 64 }).map(digit).join('')) +Hash256.random = function random(): Hash256 { + return Hash256('0x' + Array.from({ length: 64 }).map(randomHexDigit).join('')) } diff --git a/packages/types/src/proxyDetails.ts b/packages/types/src/proxyDetails.ts index d5282a65..bb54911b 100644 --- a/packages/types/src/proxyDetails.ts +++ b/packages/types/src/proxyDetails.ts @@ -1,4 +1,5 @@ import { z } from 'zod' + import { EthereumAddress } from './EthereumAddress' export interface ProxyDetails { diff --git a/packages/types/src/utils/randomHexDigit.ts b/packages/types/src/utils/randomHexDigit.ts new file mode 100644 index 00000000..93220da6 --- /dev/null +++ b/packages/types/src/utils/randomHexDigit.ts @@ -0,0 +1,3 @@ +export function randomHexDigit(): string { + return '0123456789abcdef'[Math.floor(Math.random() * 16)] ?? '0' +} From 0adcb16d0a9c0922eeb908ea752161b8d9965650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sobieraj-Jakubiec?= Date: Wed, 23 Aug 2023 11:30:45 +0200 Subject: [PATCH 5/7] Rename types package to discovery-types and remove unneeded functions. --- .../{types => discovery-types}/.eslintrc.js | 0 .../.prettierignore | 0 .../{types => discovery-types}/.prettierrc | 0 packages/{types => discovery-types}/LICENSE | 0 packages/discovery-types/README.md | 3 + .../{types => discovery-types}/package.json | 6 +- .../src/Discovery.ts | 0 .../discovery-types/src/EthereumAddress.ts | 3 + packages/discovery-types/src/Hash256.ts | 3 + packages/discovery-types/src/index.ts | 2 + .../src/proxyDetails.ts | 0 .../{types => discovery-types}/tsconfig.json | 0 packages/types/.mocharc.json | 7 -- packages/types/README.md | 3 - packages/types/src/EthereumAddress.test.ts | 66 ------------------- packages/types/src/EthereumAddress.ts | 49 -------------- packages/types/src/Hash256.test.ts | 24 ------- packages/types/src/Hash256.ts | 16 ----- packages/types/src/index.ts | 4 -- packages/types/src/utils/randomHexDigit.ts | 3 - 20 files changed, 13 insertions(+), 176 deletions(-) rename packages/{types => discovery-types}/.eslintrc.js (100%) rename packages/{types => discovery-types}/.prettierignore (100%) rename packages/{types => discovery-types}/.prettierrc (100%) rename packages/{types => discovery-types}/LICENSE (100%) create mode 100644 packages/discovery-types/README.md rename packages/{types => discovery-types}/package.json (86%) rename packages/{types => discovery-types}/src/Discovery.ts (100%) create mode 100644 packages/discovery-types/src/EthereumAddress.ts create mode 100644 packages/discovery-types/src/Hash256.ts create mode 100644 packages/discovery-types/src/index.ts rename packages/{types => discovery-types}/src/proxyDetails.ts (100%) rename packages/{types => discovery-types}/tsconfig.json (100%) delete mode 100644 packages/types/.mocharc.json delete mode 100644 packages/types/README.md delete mode 100644 packages/types/src/EthereumAddress.test.ts delete mode 100644 packages/types/src/EthereumAddress.ts delete mode 100644 packages/types/src/Hash256.test.ts delete mode 100644 packages/types/src/Hash256.ts delete mode 100644 packages/types/src/index.ts delete mode 100644 packages/types/src/utils/randomHexDigit.ts diff --git a/packages/types/.eslintrc.js b/packages/discovery-types/.eslintrc.js similarity index 100% rename from packages/types/.eslintrc.js rename to packages/discovery-types/.eslintrc.js diff --git a/packages/types/.prettierignore b/packages/discovery-types/.prettierignore similarity index 100% rename from packages/types/.prettierignore rename to packages/discovery-types/.prettierignore diff --git a/packages/types/.prettierrc b/packages/discovery-types/.prettierrc similarity index 100% rename from packages/types/.prettierrc rename to packages/discovery-types/.prettierrc diff --git a/packages/types/LICENSE b/packages/discovery-types/LICENSE similarity index 100% rename from packages/types/LICENSE rename to packages/discovery-types/LICENSE diff --git a/packages/discovery-types/README.md b/packages/discovery-types/README.md new file mode 100644 index 00000000..503d5f97 --- /dev/null +++ b/packages/discovery-types/README.md @@ -0,0 +1,3 @@ +# L2BEAT Discovery types + +A set of Discovery types to be used together with @l2beat/discovery package. diff --git a/packages/types/package.json b/packages/discovery-types/package.json similarity index 86% rename from packages/types/package.json rename to packages/discovery-types/package.json index cfb4ecf4..73b87341 100644 --- a/packages/types/package.json +++ b/packages/discovery-types/package.json @@ -1,6 +1,6 @@ { - "name": "@l2beat/types", - "description": "Common types for L2BEAT projects.", + "name": "@l2beat/discovery-types", + "description": "Common types for @l2beat/discovery.", "version": "0.1.0", "license": "MIT", "repository": "https://github.com/l2beat/tools", @@ -19,7 +19,6 @@ "!dist/test" ], "scripts": { - "test": "mocha", "clean": "rm -rf dist", "build": "tsc", "start": "node -r esbuild-register src/", @@ -30,7 +29,6 @@ "typecheck": "tsc --noEmit" }, "dependencies": { - "viem": "^1.6.7", "zod": "^3.22.2" }, "devDependencies": {} diff --git a/packages/types/src/Discovery.ts b/packages/discovery-types/src/Discovery.ts similarity index 100% rename from packages/types/src/Discovery.ts rename to packages/discovery-types/src/Discovery.ts diff --git a/packages/discovery-types/src/EthereumAddress.ts b/packages/discovery-types/src/EthereumAddress.ts new file mode 100644 index 00000000..fbab69c1 --- /dev/null +++ b/packages/discovery-types/src/EthereumAddress.ts @@ -0,0 +1,3 @@ +export interface EthereumAddress extends String { + _EthereumAddressBrand: string +} diff --git a/packages/discovery-types/src/Hash256.ts b/packages/discovery-types/src/Hash256.ts new file mode 100644 index 00000000..f9da81e5 --- /dev/null +++ b/packages/discovery-types/src/Hash256.ts @@ -0,0 +1,3 @@ +export interface Hash256 extends String { + _Hash256Brand: string +} diff --git a/packages/discovery-types/src/index.ts b/packages/discovery-types/src/index.ts new file mode 100644 index 00000000..d1ee9dce --- /dev/null +++ b/packages/discovery-types/src/index.ts @@ -0,0 +1,2 @@ +export * from './Discovery' +export * from './proxyDetails' diff --git a/packages/types/src/proxyDetails.ts b/packages/discovery-types/src/proxyDetails.ts similarity index 100% rename from packages/types/src/proxyDetails.ts rename to packages/discovery-types/src/proxyDetails.ts diff --git a/packages/types/tsconfig.json b/packages/discovery-types/tsconfig.json similarity index 100% rename from packages/types/tsconfig.json rename to packages/discovery-types/tsconfig.json diff --git a/packages/types/.mocharc.json b/packages/types/.mocharc.json deleted file mode 100644 index 862b85f9..00000000 --- a/packages/types/.mocharc.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "spec": "src/**/*.test.ts", - "require": ["esbuild-register"], - "watchExtensions": "ts", - "extension": "ts", - "reporterOption": "maxDiffSize=0" -} diff --git a/packages/types/README.md b/packages/types/README.md deleted file mode 100644 index a68290d7..00000000 --- a/packages/types/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# L2BEAT Backend Tools - -A set of backend utilities common for L2BEAT applications. diff --git a/packages/types/src/EthereumAddress.test.ts b/packages/types/src/EthereumAddress.test.ts deleted file mode 100644 index 6c503788..00000000 --- a/packages/types/src/EthereumAddress.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { expect } from 'earl' - -import { EthereumAddress } from './EthereumAddress' - -describe(EthereumAddress.name, () => { - it('accepts lowercase addresses', () => { - const address = EthereumAddress( - '0xabcdabcd12345678abcdabcd12345678abcdabcd', - ) - expect(address).toBeA(String) - }) - - it('accepts addresses with checksum', () => { - const address = EthereumAddress( - '0xAbCdABCd12345678abcDabCd12345678ABcdaBcd', - ) - expect(address).toBeA(String) - }) - - it('accepts addresses with mixed case that is not a checksum', () => { - expect( - EthereumAddress('0xAbCdABCd12345678abcDabCd12345678ABcdaBcD'), - ).toEqual( - '0xAbCdABCd12345678abcDabCd12345678ABcdaBcd' as unknown as EthereumAddress, - ) - }) - - it('does not accept invalid strings', () => { - expect(() => EthereumAddress('foo')).toThrow( - TypeError, - 'Invalid EthereumAddress', - ) - }) - - it('converts to a representation with a checksum', () => { - const address = EthereumAddress( - '0xabcdabcd12345678abcdabcd12345678abcdabcd', - ) - expect(address).toEqual( - '0xAbCdABCd12345678abcDabCd12345678ABcdaBcd' as unknown as EthereumAddress, - ) - }) - - describe(EthereumAddress.isBefore.name, () => { - it('checks ordering', () => { - const a = EthereumAddress('0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa') - const b = EthereumAddress('0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb') - expect(EthereumAddress.isBefore(a, b)).toEqual(true) - expect(EthereumAddress.isBefore(b, a)).toEqual(false) - expect(EthereumAddress.isBefore(a, a)).toEqual(false) - }) - - it('works for WETH & USDT', () => { - const weth = EthereumAddress('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2') - const usdt = EthereumAddress('0xdAC17F958D2ee523a2206206994597C13D831ec7') - expect(EthereumAddress.isBefore(weth, usdt)).toEqual(true) - expect(EthereumAddress.isBefore(usdt, weth)).toEqual(false) - }) - }) - - it('ZERO is the zero address', () => { - expect(EthereumAddress.ZERO).toEqual( - ('0x' + '0'.repeat(40)) as unknown as EthereumAddress, - ) - }) -}) diff --git a/packages/types/src/EthereumAddress.ts b/packages/types/src/EthereumAddress.ts deleted file mode 100644 index b173e53e..00000000 --- a/packages/types/src/EthereumAddress.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { getAddress } from 'viem' - -import { randomHexDigit } from './utils/randomHexDigit' - -export interface EthereumAddress extends String { - _EthereumAddressBrand: string -} - -export function EthereumAddress(value: string): EthereumAddress { - try { - return getAddress(value) as unknown as EthereumAddress - } catch { - throw new TypeError('Invalid EthereumAddress') - } -} - -EthereumAddress.ZERO = EthereumAddress('0x' + '0'.repeat(40)) - -EthereumAddress.check = function check(value: string): boolean { - try { - return EthereumAddress(value).toString() === value - } catch { - return false - } -} - -EthereumAddress.isBefore = function isBefore( - a: EthereumAddress, - b: EthereumAddress, -): boolean { - return a.toLowerCase() < b.toLowerCase() -} - -EthereumAddress.inOrder = function inOrder( - a: EthereumAddress, - b: EthereumAddress, -): [EthereumAddress, EthereumAddress] { - return EthereumAddress.isBefore(a, b) ? [a, b] : [b, a] -} - -EthereumAddress.random = function random(): EthereumAddress { - return EthereumAddress( - '0x' + Array.from({ length: 40 }).map(randomHexDigit).join(''), - ) -} - -EthereumAddress.unsafe = function unsafe(address: string): EthereumAddress { - return address as unknown as EthereumAddress -} diff --git a/packages/types/src/Hash256.test.ts b/packages/types/src/Hash256.test.ts deleted file mode 100644 index bf95f9ab..00000000 --- a/packages/types/src/Hash256.test.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { expect } from 'earl' - -import { Hash256 } from './Hash256' - -describe(Hash256.name, () => { - it('accepts lowercase hashes', () => { - const hash = Hash256( - '0xabcdabcd12345678abcdabcd12345678abcdabcd12345678abcdabcd12345678', - ) - expect(hash).toBeA(String) - }) - - it('does not accept mixed case hashes', () => { - expect(() => - Hash256( - '0xabcdabcd12345678ABCDABCD12345678ABCDABCD12345678abcdabcd12345678', - ), - ).toThrow(TypeError, 'Invalid Hash256') - }) - - it('does not accept invalid strings', () => { - expect(() => Hash256('foo')).toThrow(TypeError, 'Invalid Hash256') - }) -}) diff --git a/packages/types/src/Hash256.ts b/packages/types/src/Hash256.ts deleted file mode 100644 index 17a91297..00000000 --- a/packages/types/src/Hash256.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { randomHexDigit } from './utils/randomHexDigit' - -export interface Hash256 extends String { - _Hash256Brand: string -} - -export function Hash256(value: string): Hash256 { - if (!/^0x[\da-f]{64}$/.test(value)) { - throw new TypeError('Invalid Hash256') - } - return value as unknown as Hash256 -} - -Hash256.random = function random(): Hash256 { - return Hash256('0x' + Array.from({ length: 64 }).map(randomHexDigit).join('')) -} diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts deleted file mode 100644 index b602e4d6..00000000 --- a/packages/types/src/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './Discovery' -export * from './EthereumAddress' -export * from './Hash256' -export * from './proxyDetails' diff --git a/packages/types/src/utils/randomHexDigit.ts b/packages/types/src/utils/randomHexDigit.ts deleted file mode 100644 index 93220da6..00000000 --- a/packages/types/src/utils/randomHexDigit.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function randomHexDigit(): string { - return '0123456789abcdef'[Math.floor(Math.random() * 16)] ?? '0' -} From 17866ad6697d62687afa965c5b9a4371ea183fab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sobieraj-Jakubiec?= Date: Wed, 23 Aug 2023 11:32:01 +0200 Subject: [PATCH 6/7] Rename package to @l2beat/tools --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c5c0c5b1..4c38f917 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "l2beat-uif", + "name": "@l2beat/tools", "license": "MIT", "private": true, "scripts": { From 6ffce4674a0c96972963acf3ed984d518a787543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Sobieraj-Jakubiec?= Date: Wed, 23 Aug 2023 11:47:45 +0200 Subject: [PATCH 7/7] Update lockfile --- yarn.lock | 99 ------------------------------------------------------- 1 file changed, 99 deletions(-) diff --git a/yarn.lock b/yarn.lock index 4afb105a..6fa7807e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,11 +2,6 @@ # yarn lockfile v1 -"@adraffy/ens-normalize@1.9.0": - version "1.9.0" - resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz#223572538f6bea336750039bb43a4016dcc8182d" - integrity sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ== - "@babel/code-frame@^7.0.0": version "7.22.5" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.22.5.tgz#234d98e1551960604f1246e6475891a570ad5658" @@ -452,30 +447,6 @@ globby "^11.0.0" read-yaml-file "^1.1.0" -"@noble/curves@1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.1.0.tgz#f13fc667c89184bc04cccb9b11e8e7bae27d8c3d" - integrity sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA== - dependencies: - "@noble/hashes" "1.3.1" - -"@noble/curves@~1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.0.0.tgz#e40be8c7daf088aaf291887cbc73f43464a92932" - integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw== - dependencies: - "@noble/hashes" "1.3.0" - -"@noble/hashes@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.0.tgz#085fd70f6d7d9d109671090ccae1d3bec62554a1" - integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== - -"@noble/hashes@1.3.1", "@noble/hashes@~1.3.0": - version "1.3.1" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.1.tgz#8831ef002114670c603c458ab8b11328406953a9" - integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz" @@ -497,28 +468,6 @@ "@nodelib/fs.scandir" "2.1.5" fastq "^1.6.0" -"@scure/base@~1.1.0": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938" - integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA== - -"@scure/bip32@1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.0.tgz#6c8d980ef3f290987736acd0ee2e0f0d50068d87" - integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q== - dependencies: - "@noble/curves" "~1.0.0" - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - -"@scure/bip39@1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.0.tgz#a207e2ef96de354de7d0002292ba1503538fc77b" - integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg== - dependencies: - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" - "@sinonjs/commons@^3.0.0": version "3.0.0" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.0.tgz#beb434fe875d965265e04722ccfc21df7f755d72" @@ -600,11 +549,6 @@ resolved "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.1.tgz" integrity sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q== -"@types/node@*": - version "20.5.2" - resolved "https://registry.yarnpkg.com/@types/node/-/node-20.5.2.tgz#02850ed821c8113fd6ed9ae5c744b7f7cd6d6f51" - integrity sha512-5j/lXt7unfPOUlrKC34HIaedONleyLtwkKggiD/0uuMfT8gg2EOpg0dz4lCD15Ga7muC+1WzJZAjIB9simWd6Q== - "@types/node@^12.7.1": version "12.20.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-12.20.55.tgz#c329cbd434c42164f846b909bd6f85b5537f6240" @@ -630,13 +574,6 @@ resolved "https://registry.yarnpkg.com/@types/sinonjs__fake-timers/-/sinonjs__fake-timers-8.1.2.tgz#bf2e02a3dbd4aecaf95942ecd99b7402e03fad5e" integrity sha512-9GcLXF0/v3t80caGs5p2rRfkB+a8VBGLJZVih6CNFkx8IZ994wiKKLSRs9nuFwk1HevWs/1mnUmkApGrSGsShA== -"@types/ws@^8.5.4": - version "8.5.5" - resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.5.tgz#af587964aa06682702ee6dcbc7be41a80e4b28eb" - integrity sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg== - dependencies: - "@types/node" "*" - "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" @@ -733,16 +670,6 @@ "@typescript-eslint/types" "5.59.5" eslint-visitor-keys "^3.3.0" -"@wagmi/chains@1.7.0": - version "1.7.0" - resolved "https://registry.yarnpkg.com/@wagmi/chains/-/chains-1.7.0.tgz#8f6ad81cf867e1788417f7c978ca92bc083ecaf6" - integrity sha512-TKVeHv0GqP5sV1yQ8BDGYToAFezPnCexbbBpeH14x7ywi5a1dDStPffpt9x+ytE6LJWkZ6pAMs/HNWXBQ5Nqmw== - -abitype@0.9.3: - version "0.9.3" - resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.3.tgz#294d25288ee683d72baf4e1fed757034e3c8c277" - integrity sha512-dz4qCQLurx97FQhnb/EIYTk/ldQ+oafEDUqC0VVIeQS1Q48/YWt/9YNfMmp9SLFqN41ktxny3c8aYxHjmFIB/w== - acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz" @@ -2194,11 +2121,6 @@ isexe@^2.0.0: resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -isomorphic-ws@5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/isomorphic-ws/-/isomorphic-ws-5.0.0.tgz#e5529148912ecb9b451b46ed44d53dae1ce04bbf" - integrity sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw== - jest-changed-files@^24.9.0: version "24.9.0" resolved "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-24.9.0.tgz" @@ -3394,22 +3316,6 @@ validate-npm-package-license@^3.0.1: spdx-correct "^3.0.0" spdx-expression-parse "^3.0.0" -viem@^1.6.7: - version "1.6.7" - resolved "https://registry.yarnpkg.com/viem/-/viem-1.6.7.tgz#2445ea47aae96f5bfc3b79ed08df20ce9530ca7a" - integrity sha512-w2OMJqKcQrzPQnmMFxe4ex+md8wSwfle6L3LvEi25CBvDKhkuljVrsWY19UzG05ssQhiZ+cdxU3YMBrX817Qiw== - dependencies: - "@adraffy/ens-normalize" "1.9.0" - "@noble/curves" "1.1.0" - "@noble/hashes" "1.3.0" - "@scure/bip32" "1.3.0" - "@scure/bip39" "1.2.0" - "@types/ws" "^8.5.4" - "@wagmi/chains" "1.7.0" - abitype "0.9.3" - isomorphic-ws "5.0.0" - ws "8.12.0" - wait-for-expect@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/wait-for-expect/-/wait-for-expect-3.0.2.tgz#d2f14b2f7b778c9b82144109c8fa89ceaadaa463" @@ -3514,11 +3420,6 @@ wrappy@1: resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@8.12.0: - version "8.12.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.12.0.tgz#485074cc392689da78e1828a9ff23585e06cddd8" - integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== - wsrun@^5.2.4: version "5.2.4" resolved "https://registry.npmjs.org/wsrun/-/wsrun-5.2.4.tgz"