Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 124b7c0

Browse files
Rename eth2 packages (#3800)
* Rename web3-eth2-core to web3-eth2-base * Rename beaconchain package to beacon * Rename packages * update changelog * Update web3-eth2-core name
1 parent 942161c commit 124b7c0

26 files changed

+28
-28
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ Released with 1.0.0-beta.37 code base.
292292

293293
### Added
294294

295-
- Add `web3-eth2-core` package (#3743)
296-
- Add `web3-eth2-beaconchain` package (#3743)
295+
- Add `web3-eth2-core` package (#3743) (renamed to `web3-eth2-base`)
296+
- Add `web3-eth2-beaconchain` package (#3743) (renamed to `web3-eth2-beacon`)
297297
- Add `stripHexPrefix` method to `web3-utils` package (#3776)
298298

299299
### Changed

packages/web3-eth2-core/package.json renamed to packages/web3-eth2-base/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "web3-eth2-core",
2+
"name": "web3-eth2-base",
33
"version": "1.3.0",
4-
"description": "Web3 ETH2 core tools for sub-packages. This is an internal package.",
5-
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-core",
4+
"description": "Web3 ETH2 base tools for sub-packages. This is an internal package.",
5+
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-base",
66
"license": "LGPL-3.0",
77
"engines": {
88
"node": ">=8.0.0"

packages/web3-eth2-core/src/index.ts renamed to packages/web3-eth2-base/src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Axios, {AxiosInstance} from 'axios'
33
import { ETH2BaseOpts, ETH2Function } from '../types/index'
44
import { IBaseAPISchema } from './schema'
55

6-
export class ETH2Core {
6+
export class ETH2Base {
77
private _httpClient: AxiosInstance
88

99
[ key: string ]: ETH2Function | any;
@@ -35,7 +35,7 @@ export class ETH2Core {
3535
throw new Error(`Invalid HTTP(S) provider: ${provider}`)
3636
}
3737

38-
this._httpClient = ETH2Core.createHttpClient(provider)
38+
this._httpClient = ETH2Base.createHttpClient(provider)
3939
this.provider = provider
4040
} catch (error) {
4141
throw new Error(`Failed to set provider: ${error.message}`)

packages/web3-eth2-core/test/constructor.test.ts renamed to packages/web3-eth2-base/test/constructor.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ETH2Core } from '../src/index'
1+
import { ETH2Base } from '../src/index'
22

33
const provider = 'http://127.0.0.1:9596'
44
const testAPISchema = {
@@ -18,7 +18,7 @@ const testAPISchema = {
1818
}
1919

2020
it('constructs a ETH2Core instance with expected properties', () => {
21-
const eth2Core = new ETH2Core(provider, testAPISchema, { protectProvider: true })
21+
const eth2Core = new ETH2Base(provider, testAPISchema, { protectProvider: true })
2222

2323
expect(eth2Core.name).toBe(testAPISchema.packageName)
2424
expect(eth2Core.provider).toBe(`${provider}${testAPISchema.routePrefix}`)

packages/web3-eth2-core/test/routeBuild.test.ts renamed to packages/web3-eth2-base/test/routeBuild.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ETH2Core } from '../src/index'
1+
import { ETH2Base } from '../src/index'
22

33
const provider = 'http://127.0.0.1:9596'
44
const testAPISchema = {
@@ -38,7 +38,7 @@ const testAPISchema = {
3838
let eth2Core
3939

4040
beforeAll(() => {
41-
eth2Core = new ETH2Core(provider, testAPISchema, { protectProvider: true })
41+
eth2Core = new ETH2Base(provider, testAPISchema, { protectProvider: true })
4242
})
4343

4444
it('Should build expectedComputedRoute with 1 parameter', () => {

packages/web3-eth2-core/types/tsconfig.json renamed to packages/web3-eth2-base/types/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"allowSyntheticDefaultImports": false,
1212
"baseUrl": ".",
1313
"paths": {
14-
"web3-eth2-core": ["."]
14+
"web3-eth2-base": ["."]
1515
}
1616
}
1717
}

packages/web3-eth2-beaconchain/package.json renamed to packages/web3-eth2-beacon/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
2-
"name": "web3-eth2-beaconchain",
2+
"name": "web3-eth2-beacon",
33
"version": "1.3.0",
44
"description": "Web3 ETH2 Beacon chain API wrappers.",
5-
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-beaconchain",
5+
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-beacon",
66
"license": "LGPL-3.0",
77
"engines": {
88
"node": ">=8.0.0"
@@ -15,7 +15,7 @@
1515
},
1616
"main": "lib/index.js",
1717
"dependencies": {
18-
"web3-eth2-core": "^1.3.0"
18+
"web3-eth2-base": "^1.3.0"
1919
},
2020
"devDependencies": {
2121
"@chainsafe/lodestar-types": "^0.11.0",

packages/web3-eth2-beaconchain/src/index.ts renamed to packages/web3-eth2-beacon/src/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
// @ts-ignore - types not full implemented yet
2-
import { ETH2Core } from 'web3-eth2-core'
2+
import { ETH2Base } from 'web3-eth2-base'
33
import { DefaultSchema } from './schema'
44

5-
import { IETH2BeaconChain } from '../types/index'
5+
import { IETH2Beacon } from '../types/index'
66
// @ts-ignore - types not full implemented yet
77
import { IBaseAPISchema } from 'web3-eth2-core'
88
// @ts-ignore - types not full implemented yet
99
import { ETH2BaseOpts } from 'web3-eth2-core'
1010

11-
// @ts-ignore - ETH2BeaconChain incorrectly implements interface IETH2BeaconChain
12-
export class ETH2BeaconChain extends ETH2Core implements IETH2BeaconChain {
11+
// @ts-ignore - ETH2Beacon incorrectly implements interface IETH2Beacon
12+
export class ETH2Beacon extends ETH2Base implements IETH2Beacon {
1313
constructor(
1414
provider: string,
1515
schema: IBaseAPISchema = DefaultSchema,

packages/web3-eth2-beaconchain/src/schema.ts renamed to packages/web3-eth2-beacon/src/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import { IBaseAPISchema } from '../../web3-eth2-core/src/schema'
1+
import { IBaseAPISchema } from '../../web3-eth2-base/src/schema'
22

33
export const DefaultSchema: IBaseAPISchema = {
4-
packageName: 'eth2-beaconchain',
4+
packageName: 'eth2-beacon',
55
routePrefix: '/eth/v1/beacon/',
66
methods: [
77
{

packages/web3-eth2-beaconchain/test/constructor.test.ts renamed to packages/web3-eth2-beacon/test/constructor.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import { ETH2BeaconChain } from '../src/index'
1+
import { ETH2Beacon } from '../src/index'
22

33
const provider = 'http://127.0.0.1:9596'
44
const providerSuffix = '/eth/v1/beacon/'
55

66
it('constructs a ETH2BeaconChain instance with expected properties', () => {
7-
const eth2BeaconChain = new ETH2BeaconChain(provider)
7+
const eth2BeaconChain = new ETH2Beacon(provider)
88

99
// @ts-ignore - types not full implemented yet
10-
expect(eth2BeaconChain.name).toBe('eth2-beaconchain')
10+
expect(eth2BeaconChain.name).toBe('eth2-beacon')
1111
// @ts-ignore - types not full implemented yet
1212
expect(eth2BeaconChain.provider).toBe(`${provider}${providerSuffix}`)
1313
// @ts-ignore - types not full implemented yet

packages/web3-eth2-beaconchain/test/schemaMethods.test.ts renamed to packages/web3-eth2-beacon/test/schemaMethods.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ETH2BeaconChain } from '../src/index'
1+
import { ETH2Beacon } from '../src/index'
22

33
// Jest doesn't have a native method to test if value is boolean
44
expect.extend({
@@ -17,7 +17,7 @@ let eth2BeaconChain: any // should be ETH2BeaconChain but types aren't implement
1717

1818
beforeAll(() => {
1919
const provider = 'http://127.0.0.1:9596' // default port for Lodestar
20-
eth2BeaconChain = new ETH2BeaconChain(provider)
20+
eth2BeaconChain = new ETH2Beacon(provider)
2121
})
2222

2323
it('getGenesis', async () => {
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Genesis } from '@chainsafe/lodestar-types'
22

3-
export interface IETH2BeaconChain {
3+
export interface IETH2Beacon {
44
getGenesis(): Promise<Genesis>
55
getBlockHeader(): Promise<any>
66
}

packages/web3-eth2-beaconchain/types/tsconfig.json renamed to packages/web3-eth2-beacon/types/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"allowSyntheticDefaultImports": false,
1212
"baseUrl": ".",
1313
"paths": {
14-
"web3-eth2-beaconchain": ["."]
14+
"web3-eth2-beacon": ["."]
1515
}
1616
}
1717
}

0 commit comments

Comments
 (0)