Skip to content

Commit

Permalink
Merge branch '1.x' into deps/bump-ts-node
Browse files Browse the repository at this point in the history
  • Loading branch information
frankiebee committed Dec 15, 2020
2 parents a5a61db + 27c9679 commit 21c0eed
Show file tree
Hide file tree
Showing 28 changed files with 45 additions and 40 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,8 @@ Released with 1.0.0-beta.37 code base.

### Added

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

### Changed
Expand Down
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-core",
"name": "web3-eth2-base",
"version": "1.3.0",
"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",
"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",
"license": "LGPL-3.0",
"engines": {
"node": ">=8.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Axios, {AxiosInstance} from 'axios'
import { ETH2BaseOpts, ETH2Function } from '../types/index'
import { IBaseAPISchema } from './schema'

export class ETH2Core {
export class ETH2Base {
private _httpClient: AxiosInstance

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

this._httpClient = ETH2Core.createHttpClient(provider)
this._httpClient = ETH2Base.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 { ETH2Core } from '../src/index'
import { ETH2Base } 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 ETH2Core(provider, testAPISchema, { protectProvider: true })
const eth2Core = new ETH2Base(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 { ETH2Core } from '../src/index'
import { ETH2Base } 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 ETH2Core(provider, testAPISchema, { protectProvider: true })
eth2Core = new ETH2Base(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-core": ["."]
"web3-eth2-base": ["."]
}
}
}
File renamed without changes.
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 All @@ -15,7 +15,7 @@
},
"main": "lib/index.js",
"dependencies": {
"web3-eth2-core": "^1.3.0"
"web3-eth2-base": "^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 { 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.
28 changes: 16 additions & 12 deletions test/e2e.method.signing.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,22 +394,26 @@ describe('transaction and message signing [ @E2E ]', function() {
// Smoke test to validate browserify's buffer polyfills (feross/buffer@5)
// A companion regression test for Webpack & feross/buffer@4.9.2 exists at:
// test/eth.accounts.webpack.js
it("encrypt then decrypt wallet", async function() {
this.timeout(10000);

const password = "qwerty";
const addressFromWallet = wallet[0].address;
it("encrypt then decrypt wallet", function(done) {
this.timeout(20000);
try {
const password = "qwerty";
const addressFromWallet = wallet[0].address;

const keystore = wallet.encrypt(password);
const keystore = wallet.encrypt(password);

// Wallet created w/ 10 accounts in before block
assert.equal(keystore.length, 10);
// Wallet created w/ 10 accounts in before block
assert.equal(keystore.length, 10);

wallet.decrypt(keystore, password);
assert.equal(wallet.length, 10);
wallet.decrypt(keystore, password);
assert.equal(wallet.length, 10);

const addressFromKeystore = wallet[0].address;
assert.equal(addressFromKeystore, addressFromWallet);
const addressFromKeystore = wallet[0].address;
assert.equal(addressFromKeystore, addressFromWallet);
done()
} catch(error) {
done(error)
}
});
});

1 change: 1 addition & 0 deletions test/eth.ens.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ describe('ens', function () {
});

it('should set the owner record for a name', async function () {
this.timeout(10000);
const signature = 'setOwner(bytes32,address)';

prepareProviderForSetter(
Expand Down

0 comments on commit 21c0eed

Please sign in to comment.