diff --git a/CHANGELOG.md b/CHANGELOG.md index 9345046cdc5..dfcacb10598 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -317,3 +317,4 @@ Released with 1.0.0-beta.37 code base. - Remove `notImplemented` flag from ETH2 Beacon Chain package methods schema - Fixed mutation of inputs to encoding and decoding functions (#3748) +- Rename `web3-eth2-base` to `web3-eth2-core` and `web3-eth2-beacon` to `web3-eth2-beaconchain` diff --git a/packages/web3-eth2-beacon/.babelrc b/packages/web3-eth2-beaconchain/.babelrc similarity index 100% rename from packages/web3-eth2-beacon/.babelrc rename to packages/web3-eth2-beaconchain/.babelrc diff --git a/packages/web3-eth2-beacon/Makefile b/packages/web3-eth2-beaconchain/Makefile similarity index 100% rename from packages/web3-eth2-beacon/Makefile rename to packages/web3-eth2-beaconchain/Makefile diff --git a/packages/web3-eth2-base/jest.config.js b/packages/web3-eth2-beaconchain/jest.config.js similarity index 100% rename from packages/web3-eth2-base/jest.config.js rename to packages/web3-eth2-beaconchain/jest.config.js diff --git a/packages/web3-eth2-beacon/package-lock.json b/packages/web3-eth2-beaconchain/package-lock.json similarity index 100% rename from packages/web3-eth2-beacon/package-lock.json rename to packages/web3-eth2-beaconchain/package-lock.json diff --git a/packages/web3-eth2-beacon/package.json b/packages/web3-eth2-beaconchain/package.json similarity index 88% rename from packages/web3-eth2-beacon/package.json rename to packages/web3-eth2-beaconchain/package.json index e208e25b295..f25f8416ffb 100644 --- a/packages/web3-eth2-beacon/package.json +++ b/packages/web3-eth2-beaconchain/package.json @@ -1,8 +1,8 @@ { - "name": "web3-eth2-beacon", + "name": "web3-eth2-beaconchain", "version": "1.3.0", "description": "Web3 ETH2 Beacon chain API wrappers.", - "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-beacon", + "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-beaconchain", "license": "LGPL-3.0", "engines": { "node": ">=8.0.0" @@ -15,7 +15,7 @@ }, "main": "lib/index.js", "dependencies": { - "web3-eth2-base": "^1.3.0" + "web3-eth2-core": "^1.3.0" }, "devDependencies": { "@chainsafe/lodestar-types": "^0.11.0", diff --git a/packages/web3-eth2-beacon/src/index.ts b/packages/web3-eth2-beaconchain/src/index.ts similarity index 65% rename from packages/web3-eth2-beacon/src/index.ts rename to packages/web3-eth2-beaconchain/src/index.ts index 5161a134177..7859a21ddc1 100644 --- a/packages/web3-eth2-beacon/src/index.ts +++ b/packages/web3-eth2-beaconchain/src/index.ts @@ -1,15 +1,15 @@ // @ts-ignore - types not full implemented yet -import { ETH2Base } from 'web3-eth2-base' +import { ETH2Core } from 'web3-eth2-core' import { DefaultSchema } from './schema' -import { IETH2Beacon } from '../types/index' +import { IETH2BeaconChain } from '../types/index' // @ts-ignore - types not full implemented yet import { IBaseAPISchema } from 'web3-eth2-core' // @ts-ignore - types not full implemented yet import { ETH2BaseOpts } from 'web3-eth2-core' -// @ts-ignore - ETH2Beacon incorrectly implements interface IETH2Beacon -export class ETH2Beacon extends ETH2Base implements IETH2Beacon { +// @ts-ignore - ETH2BeaconChain incorrectly implements interface IETH2BeaconChain +export class ETH2BeaconChain extends ETH2Core implements IETH2BeaconChain { constructor( provider: string, schema: IBaseAPISchema = DefaultSchema, diff --git a/packages/web3-eth2-beacon/src/schema.ts b/packages/web3-eth2-beaconchain/src/schema.ts similarity index 98% rename from packages/web3-eth2-beacon/src/schema.ts rename to packages/web3-eth2-beaconchain/src/schema.ts index 5a21126e62a..5e63aabe1a0 100644 --- a/packages/web3-eth2-beacon/src/schema.ts +++ b/packages/web3-eth2-beaconchain/src/schema.ts @@ -1,7 +1,7 @@ -import { IBaseAPISchema } from '../../web3-eth2-base/src/schema' +import { IBaseAPISchema } from '../../web3-eth2-core/src/schema' export const DefaultSchema: IBaseAPISchema = { - packageName: 'eth2-beacon', + packageName: 'eth2-beaconchain', routePrefix: '/eth/v1/beacon/', methods: [ { diff --git a/packages/web3-eth2-beacon/test/axiosMock.ts b/packages/web3-eth2-beaconchain/test/axiosMock.ts similarity index 100% rename from packages/web3-eth2-beacon/test/axiosMock.ts rename to packages/web3-eth2-beaconchain/test/axiosMock.ts diff --git a/packages/web3-eth2-beacon/test/constructor.test.ts b/packages/web3-eth2-beaconchain/test/constructor.test.ts similarity index 72% rename from packages/web3-eth2-beacon/test/constructor.test.ts rename to packages/web3-eth2-beaconchain/test/constructor.test.ts index af42b58c78a..2ccc4ac2f7c 100644 --- a/packages/web3-eth2-beacon/test/constructor.test.ts +++ b/packages/web3-eth2-beaconchain/test/constructor.test.ts @@ -1,13 +1,13 @@ -import { ETH2Beacon } from '../src/index' +import { ETH2BeaconChain } from '../src/index' const provider = 'http://127.0.0.1:9596' const providerSuffix = '/eth/v1/beacon/' it('constructs a ETH2BeaconChain instance with expected properties', () => { - const eth2BeaconChain = new ETH2Beacon(provider) + const eth2BeaconChain = new ETH2BeaconChain(provider) // @ts-ignore - types not full implemented yet - expect(eth2BeaconChain.name).toBe('eth2-beacon') + expect(eth2BeaconChain.name).toBe('eth2-beaconchain') // @ts-ignore - types not full implemented yet expect(eth2BeaconChain.provider).toBe(`${provider}${providerSuffix}`) // @ts-ignore - types not full implemented yet diff --git a/packages/web3-eth2-beacon/test/schemaMethods.test.ts b/packages/web3-eth2-beaconchain/test/schemaMethods.test.ts similarity index 99% rename from packages/web3-eth2-beacon/test/schemaMethods.test.ts rename to packages/web3-eth2-beaconchain/test/schemaMethods.test.ts index 9b2d9e0fc75..6df3f5c55f1 100644 --- a/packages/web3-eth2-beacon/test/schemaMethods.test.ts +++ b/packages/web3-eth2-beaconchain/test/schemaMethods.test.ts @@ -1,4 +1,4 @@ -import { ETH2Beacon } from '../src/index' +import { ETH2BeaconChain } from '../src/index' // Jest doesn't have a native method to test if value is boolean expect.extend({ @@ -18,7 +18,7 @@ let eth2BeaconChain: any // should be ETH2BeaconChain but types aren't implement beforeAll(() => { // const provider = 'http://127.0.0.1:9596' // default port for Lodestar const provider = 'http://127.0.0.1:5052' // default port for Lighthouse - eth2BeaconChain = new ETH2Beacon(provider) + eth2BeaconChain = new ETH2BeaconChain(provider) }) it('getGenesis', async () => { diff --git a/packages/web3-eth2-beacon/tsconfig.json b/packages/web3-eth2-beaconchain/tsconfig.json similarity index 100% rename from packages/web3-eth2-beacon/tsconfig.json rename to packages/web3-eth2-beaconchain/tsconfig.json diff --git a/packages/web3-eth2-beacon/types/index.d.ts b/packages/web3-eth2-beaconchain/types/index.d.ts similarity index 77% rename from packages/web3-eth2-beacon/types/index.d.ts rename to packages/web3-eth2-beaconchain/types/index.d.ts index faed63b576f..51356bca690 100644 --- a/packages/web3-eth2-beacon/types/index.d.ts +++ b/packages/web3-eth2-beaconchain/types/index.d.ts @@ -1,6 +1,6 @@ import { Genesis } from '@chainsafe/lodestar-types' -export interface IETH2Beacon { +export interface IETH2BeaconChain { getGenesis(): Promise getBlockHeader(): Promise } diff --git a/packages/web3-eth2-beacon/types/tsconfig.json b/packages/web3-eth2-beaconchain/types/tsconfig.json similarity index 89% rename from packages/web3-eth2-beacon/types/tsconfig.json rename to packages/web3-eth2-beaconchain/types/tsconfig.json index a2ddfaad631..812242a77b5 100644 --- a/packages/web3-eth2-beacon/types/tsconfig.json +++ b/packages/web3-eth2-beaconchain/types/tsconfig.json @@ -11,7 +11,7 @@ "allowSyntheticDefaultImports": false, "baseUrl": ".", "paths": { - "web3-eth2-beacon": ["."] + "web3-eth2-beaconchain": ["."] } } } diff --git a/packages/web3-eth2-beacon/types/tslint.json b/packages/web3-eth2-beaconchain/types/tslint.json similarity index 100% rename from packages/web3-eth2-beacon/types/tslint.json rename to packages/web3-eth2-beaconchain/types/tslint.json diff --git a/packages/web3-eth2-beacon/jest.config.js b/packages/web3-eth2-core/jest.config.js similarity index 100% rename from packages/web3-eth2-beacon/jest.config.js rename to packages/web3-eth2-core/jest.config.js diff --git a/packages/web3-eth2-base/package-lock.json b/packages/web3-eth2-core/package-lock.json similarity index 100% rename from packages/web3-eth2-base/package-lock.json rename to packages/web3-eth2-core/package-lock.json diff --git a/packages/web3-eth2-base/package.json b/packages/web3-eth2-core/package.json similarity index 85% rename from packages/web3-eth2-base/package.json rename to packages/web3-eth2-core/package.json index 34841f00f4a..5b78115d8d8 100644 --- a/packages/web3-eth2-base/package.json +++ b/packages/web3-eth2-core/package.json @@ -1,8 +1,8 @@ { - "name": "web3-eth2-base", + "name": "web3-eth2-core", "version": "1.3.0", - "description": "Web3 ETH2 base tools for sub-packages. This is an internal package.", - "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-base", + "description": "Web3 ETH2 core tools for sub-packages. This is an internal package.", + "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-core", "license": "LGPL-3.0", "engines": { "node": ">=8.0.0" diff --git a/packages/web3-eth2-base/src/index.ts b/packages/web3-eth2-core/src/index.ts similarity index 97% rename from packages/web3-eth2-base/src/index.ts rename to packages/web3-eth2-core/src/index.ts index 800cf7a8a88..921b03bd370 100644 --- a/packages/web3-eth2-base/src/index.ts +++ b/packages/web3-eth2-core/src/index.ts @@ -5,7 +5,7 @@ Axios.defaults.adapter = require('axios/lib/adapters/http'); import { ETH2BaseOpts, ETH2Function } from '../types/index' import { IBaseAPISchema } from './schema' -export class ETH2Base { +export class ETH2Core { private _httpClient: AxiosInstance [ key: string ]: ETH2Function | any; @@ -37,7 +37,7 @@ export class ETH2Base { throw new Error(`Invalid HTTP(S) provider: ${provider}`) } - this._httpClient = ETH2Base.createHttpClient(provider) + this._httpClient = ETH2Core.createHttpClient(provider) this.provider = provider } catch (error) { throw new Error(`Failed to set provider: ${error.message}`) diff --git a/packages/web3-eth2-base/src/schema.ts b/packages/web3-eth2-core/src/schema.ts similarity index 100% rename from packages/web3-eth2-base/src/schema.ts rename to packages/web3-eth2-core/src/schema.ts diff --git a/packages/web3-eth2-base/test/constructor.test.ts b/packages/web3-eth2-core/test/constructor.test.ts similarity index 87% rename from packages/web3-eth2-base/test/constructor.test.ts rename to packages/web3-eth2-core/test/constructor.test.ts index 230450fbdc7..598a49faebb 100644 --- a/packages/web3-eth2-base/test/constructor.test.ts +++ b/packages/web3-eth2-core/test/constructor.test.ts @@ -1,4 +1,4 @@ -import { ETH2Base } from '../src/index' +import { ETH2Core } from '../src/index' const provider = 'http://127.0.0.1:9596' const testAPISchema = { @@ -18,7 +18,7 @@ const testAPISchema = { } it('constructs a ETH2Core instance with expected properties', () => { - const eth2Core = new ETH2Base(provider, testAPISchema, { protectProvider: true }) + const eth2Core = new ETH2Core(provider, testAPISchema, { protectProvider: true }) expect(eth2Core.name).toBe(testAPISchema.packageName) expect(eth2Core.provider).toBe(`${provider}${testAPISchema.routePrefix}`) diff --git a/packages/web3-eth2-base/test/routeBuild.test.ts b/packages/web3-eth2-core/test/routeBuild.test.ts similarity index 96% rename from packages/web3-eth2-base/test/routeBuild.test.ts rename to packages/web3-eth2-core/test/routeBuild.test.ts index 163a608678e..829dc4d7cb2 100644 --- a/packages/web3-eth2-base/test/routeBuild.test.ts +++ b/packages/web3-eth2-core/test/routeBuild.test.ts @@ -1,4 +1,4 @@ -import { ETH2Base } from '../src/index' +import { ETH2Core } from '../src/index' const provider = 'http://127.0.0.1:9596' const testAPISchema = { @@ -38,7 +38,7 @@ const testAPISchema = { let eth2Core beforeAll(() => { - eth2Core = new ETH2Base(provider, testAPISchema, { protectProvider: true }) + eth2Core = new ETH2Core(provider, testAPISchema, { protectProvider: true }) }) it('Should build expectedComputedRoute with 1 parameter', () => { diff --git a/packages/web3-eth2-base/tsconfig.json b/packages/web3-eth2-core/tsconfig.json similarity index 100% rename from packages/web3-eth2-base/tsconfig.json rename to packages/web3-eth2-core/tsconfig.json diff --git a/packages/web3-eth2-base/types/index.d.ts b/packages/web3-eth2-core/types/index.d.ts similarity index 100% rename from packages/web3-eth2-base/types/index.d.ts rename to packages/web3-eth2-core/types/index.d.ts diff --git a/packages/web3-eth2-base/types/tsconfig.json b/packages/web3-eth2-core/types/tsconfig.json similarity index 91% rename from packages/web3-eth2-base/types/tsconfig.json rename to packages/web3-eth2-core/types/tsconfig.json index aa8ba16ccdc..8515b4d84ea 100644 --- a/packages/web3-eth2-base/types/tsconfig.json +++ b/packages/web3-eth2-core/types/tsconfig.json @@ -11,7 +11,7 @@ "allowSyntheticDefaultImports": false, "baseUrl": ".", "paths": { - "web3-eth2-base": ["."] + "web3-eth2-core": ["."] } } } diff --git a/packages/web3-eth2-base/types/tslint.json b/packages/web3-eth2-core/types/tslint.json similarity index 100% rename from packages/web3-eth2-base/types/tslint.json rename to packages/web3-eth2-core/types/tslint.json