Skip to content

Commit

Permalink
Rename packages
Browse files Browse the repository at this point in the history
  • Loading branch information
spacesailor24 committed Dec 1, 2020
1 parent 4ca7fe4 commit 289927e
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 15 deletions.
16 changes: 16 additions & 0 deletions packages/web3-eth2-base/src/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export interface IBaseAPISchema {
packageName: string,
routePrefix: string,
methods: IBaseAPIMethodSchema[]
}

export interface IBaseAPIMethodSchema {
notImplemented?: true,
name: string,
route: string,
restMethod: string
inputFormatter: any,
outputFormatter: any,
errors: any
errorPrefix: string
}
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-beaconchain",
"name": "web3-eth2-beacon",
"version": "1.3.0",
"description": "Web3 ETH2 Beacon chain API wrappers.",
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-beaconchain",
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth2-beacon",
"license": "LGPL-3.0",
"engines": {
"node": ">=8.0.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 { ETH2Core } from 'web3-eth2-core'
import { ETH2Base } from 'web3-eth2-base'
import { DefaultSchema } from './schema'

import { IETH2BeaconChain } from '../types/index'
import { IETH2Beacon } 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 - ETH2BeaconChain incorrectly implements interface IETH2BeaconChain
export class ETH2BeaconChain extends ETH2Core implements IETH2BeaconChain {
// @ts-ignore - ETH2Beacon incorrectly implements interface IETH2Beacon
export class ETH2Beacon extends ETH2Base implements IETH2Beacon {
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-core/src/schema'
import { IBaseAPISchema } from '../../web3-eth2-base/src/schema'

export const DefaultSchema: IBaseAPISchema = {
packageName: 'eth2-beaconchain',
packageName: 'eth2-beacon',
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 { ETH2BeaconChain } from '../src/index'
import { ETH2Beacon } 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 ETH2BeaconChain(provider)
const eth2BeaconChain = new ETH2Beacon(provider)

// @ts-ignore - types not full implemented yet
expect(eth2BeaconChain.name).toBe('eth2-beaconchain')
expect(eth2BeaconChain.name).toBe('eth2-beacon')
// @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 { ETH2BeaconChain } from '../src/index'
import { ETH2Beacon } from '../src/index'

// Jest doesn't have a native method to test if value is boolean
expect.extend({
Expand All @@ -17,7 +17,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
eth2BeaconChain = new ETH2BeaconChain(provider)
eth2BeaconChain = new ETH2Beacon(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 IETH2BeaconChain {
export interface IETH2Beacon {
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-beaconchain": ["."]
"web3-eth2-beacon": ["."]
}
}
}
File renamed without changes.

0 comments on commit 289927e

Please sign in to comment.