Skip to content

Commit

Permalink
Merge branch '1.x' into issue/1648
Browse files Browse the repository at this point in the history
  • Loading branch information
nivida authored Oct 30, 2019
2 parents 1a05194 + 266741c commit 4f856c8
Show file tree
Hide file tree
Showing 10 changed files with 2,029 additions and 400 deletions.
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ services:
- xvfb
language: node_js
matrix:
fast_finish: true
include:
- node_js: 8
env: TEST=unit
Expand All @@ -13,11 +14,17 @@ matrix:
env: TEST=build_and_lint
- node_js: 10
env: TEST=unit_and_e2e_clients
- node_js: 10
env: TEST=e2e_truffle
- node_js: 10
env: TEST=e2e_browsers
addons:
chrome: stable
firefox: latest
allow_failures:
- node_js: 10
env: TEST=e2e_truffle

addons:
apt:
sources:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,11 @@ Released with 1.0.0-beta.37 code base.
- Fix hexToNumber and hexToNumberString prefix validation (#3086)
- The receipt will now returned on a EVM error (this got removed on beta.18) (#3129)
- Fixes transaction confirmations with the HttpProvider (#3140)

## [1.2.3]

### Added

### Fixed

- Fix TS types for eth.subscribe syncing, newBlockHeaders, pendingTransactions (#3159)
2,284 changes: 1,904 additions & 380 deletions package-lock.json

Large diffs are not rendered by default.

9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@
"test": "mocha --grep E2E --invert; jshint *.js packages",
"test:unit": "istanbul cover _mocha -- -R spec --grep E2E --invert",
"dtslint": "lerna run dtslint",
"geth": "geth-dev-assistant --accounts 5 --tag stable",
"test:e2e:ganache": "./scripts/e2e.ganache.sh",
"test:e2e:geth:auto": "./scripts/e2e.geth.automine.sh",
"test:e2e:geth:insta": "./scripts/e2e.geth.instamine.sh",
"test:e2e:clients": "npm run test:e2e:ganache; npm run test:e2e:geth:insta; npm run test:e2e:geth:auto",
"test:e2e:chrome": "./scripts/e2e.chrome.sh",
"test:e2e:firefox": "./scripts/e2e.firefox.sh",
"test:e2e:browsers": "npm run build; npm run test:e2e:chrome; npm run test:e2e:firefox",
"test:e2e:publish": "./scripts/e2e.npm.publish.sh",
"test:e2e:truffle": "./scripts/e2e.truffle.sh",
"ci": "./scripts/ci.sh",
"coveralls": "./scripts/coveralls.sh"
},
Expand Down Expand Up @@ -97,7 +100,7 @@
"ethjs-signer": "^0.1.1",
"exorcist": "^1.0.1",
"ganache-cli": "^6.7.0",
"geth-dev-assistant": "^0.1.0",
"geth-dev-assistant": "^0.1.3",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-jshint": "^2.1.0",
Expand All @@ -114,12 +117,14 @@
"karma-firefox-launcher": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-spec-reporter": "0.0.32",
"lerna": "^2.5.1",
"lerna": "^2.11.0",
"mocha": "^6.2.1",
"npm-auth-to-token": "^1.0.0",
"puppeteer": "^1.20.0",
"sandboxed-module": "^2.0.3",
"typescript": "next",
"underscore": "^1.9.1",
"verdaccio": "^4.3.4",
"vinyl-source-stream": "^2.0.0",
"wait-port": "^0.2.6"
}
Expand Down
13 changes: 1 addition & 12 deletions packages/web3-eth/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,32 +78,21 @@ export class Eth {

subscribe(
type: 'logs',
options?: LogsOptions,
options: LogsOptions,
callback?: (error: Error, log: Log) => void
): Subscription<Log>;
subscribe(
type: 'syncing',
options?: null,
callback?: (error: Error, result: Syncing) => void
): Subscription<Syncing>;
subscribe(
type: 'newBlockHeaders',
options?: null,
callback?: (error: Error, blockHeader: BlockHeader) => void
): Subscription<BlockHeader>;
subscribe(
type: 'pendingTransactions',
options?: null,
callback?: (error: Error, transactionHash: string) => void
): Subscription<string>;
subscribe(
type: 'pendingTransactions' | 'logs' | 'syncing' | 'newBlockHeaders',
options?: null | LogsOptions,
callback?: (
error: Error,
item: Log | Syncing | BlockHeader | string
) => void
): Subscription<Log | BlockHeader | Syncing | string>;

getProtocolVersion(
callback?: (error: Error, protocolVersion: string) => void
Expand Down
10 changes: 4 additions & 6 deletions packages/web3-eth/types/tests/eth.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ eth.net;
// $ExpectType void
eth.clearSubscriptions(() => {});

// $ExpectType Subscription<Log>
eth.subscribe('logs');

// $ExpectType Subscription<Log>
eth.subscribe('logs', {});
// $ExpectType Subscription<Log>
Expand All @@ -90,14 +87,16 @@ eth.subscribe('logs', {}, (error: Error, log: Log) => {});
// $ExpectType Subscription<Syncing>
eth.subscribe('syncing');
// $ExpectType Subscription<Syncing>
eth.subscribe('syncing', null, (error: Error, result: Syncing) => {});
eth.subscribe(
'syncing',
(error: Error, result: Syncing) => {}
);

// $ExpectType Subscription<BlockHeader>
eth.subscribe('newBlockHeaders');
// $ExpectType Subscription<BlockHeader>
eth.subscribe(
'newBlockHeaders',
null,
(error: Error, blockHeader: BlockHeader) => {}
);

Expand All @@ -106,7 +105,6 @@ eth.subscribe('pendingTransactions');
// $ExpectType Subscription<string>
eth.subscribe(
'pendingTransactions',
null,
(error: Error, transactionHash: string) => {}
);

Expand Down
5 changes: 5 additions & 0 deletions scripts/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ elif [ "$TEST" = "e2e_browsers" ]; then
npm run test:e2e:chrome
npm run test:e2e:firefox

elif [ "$TEST" = "e2e_truffle" ]; then

npm run test:e2e:publish
npm run test:e2e:truffle

fi
44 changes: 44 additions & 0 deletions scripts/e2e.npm.publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash

# --------------------------------------------------------------------
# Publishes web3 to a local npm proxy registry in CI so the package
# can be E2E tested by installing it in another project
# --------------------------------------------------------------------

# Exit immediately on error
set -o errexit

if [ -z "$CI" ]; then

echo "======================================================================"
echo "This script publishes web3 to an npm proxy registry. Only run in CI."
echo "======================================================================"

exit 1

fi

# Launch npm proxy registry
npx verdaccio --config verdaccio.yml & npx wait-port 4873

# `npm add user`
curl -XPUT \
-H "Content-type: application/json" \
-d '{ "name": "test", "password": "test" }' \
'http://localhost:4873/-/user/org.couchdb.user:test'

# `npm login`
npx npm-auth-to-token \
-u test \
-p test \
-e test@test.com \
-r http://localhost:4873

# `npm version patch`
npx lerna exec -- npm version patch

# `npm publish`
npx lerna exec --concurrency 1 -- npm publish \
--tag e2e \
--registry http://localhost:4873 \

30 changes: 30 additions & 0 deletions scripts/e2e.truffle.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

# -------------------------------------------------------------------------
# Run @truffle/contract's unit tests using a candidate branch of web3
# which has been published to a proxy npm registry in `e2e.npm.publish.sh`
# -------------------------------------------------------------------------

# Exit immediately on error
set -o errexit

# Launch geth
npm run geth

# Install truffle
git clone https://github.com/trufflesuite/truffle.git
cd truffle
yarn bootstrap

# @truffle/contract
cd packages/contract

# Uninstall / re-install web3
yarn remove web3

npm install web3@e2e \
--registry http://localhost:4873 \
--force

# Geth tests
GETH=true npm test
19 changes: 19 additions & 0 deletions verdaccio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
storage: ./storage
auth:
htpasswd:
file: ./htpasswd
uplinks:
npmjs:
url: https://registry.npmjs.org/
packages:
'@*/*':
# scoped packages
access: $all
publish: $all
proxy: npmjs
'**':
access: $all
publish: $all
proxy: npmjs
logs:
- {type: stdout, format: pretty, level: warn}

0 comments on commit 4f856c8

Please sign in to comment.