Skip to content

Commit

Permalink
Merge 6f95b0b into 4469516
Browse files Browse the repository at this point in the history
  • Loading branch information
spacesailor24 committed Jan 4, 2021
2 parents 4469516 + 6f95b0b commit 0cf5fef
Show file tree
Hide file tree
Showing 26 changed files with 27 additions and 26 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,4 @@ Released with 1.0.0-beta.37 code base.
### Changed

- Remove `notImplemented` flag from ETH2 Beacon Chain package methods schema
- Rename `web3-eth2-base` to `web3-eth2-core` and `web3-eth2-beacon` to `web3-eth2-beaconchain`
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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: [
{
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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({
Expand All @@ -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 () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Genesis } from '@chainsafe/lodestar-types'

export interface IETH2Beacon {
export interface IETH2BeaconChain {
getGenesis(): Promise<Genesis>
getBlockHeader(): Promise<any>
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"allowSyntheticDefaultImports": false,
"baseUrl": ".",
"paths": {
"web3-eth2-beacon": ["."]
"web3-eth2-beaconchain": ["."]
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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}`)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ETH2Base } from '../src/index'
import { ETH2Core } from '../src/index'

const provider = 'http://127.0.0.1:9596'
const testAPISchema = {
Expand All @@ -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}`)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ETH2Base } from '../src/index'
import { ETH2Core } from '../src/index'

const provider = 'http://127.0.0.1:9596'
const testAPISchema = {
Expand Down Expand Up @@ -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', () => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"allowSyntheticDefaultImports": false,
"baseUrl": ".",
"paths": {
"web3-eth2-base": ["."]
"web3-eth2-core": ["."]
}
}
}
File renamed without changes.

0 comments on commit 0cf5fef

Please sign in to comment.