diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00000000000..b5ca7626dff
--- /dev/null
+++ b/.github/workflows/test.yml
@@ -0,0 +1,71 @@
+name: "Test"
+on:
+ push:
+ branches:
+ - master
+ tags:
+ - "*"
+ pull_request:
+ types: [opened, reopened, synchronize]
+jobs:
+ unit:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ node: [8, 10, 11, 12]
+ env:
+ TEST: "unit"
+ steps:
+ - uses: actions/setup-node@v1
+ with:
+ node-version: ${{ matrix.node }}
+ - uses: actions/checkout@v1
+ - run: bash ./scripts/install.sh
+ - run: bash ./scripts/ci.sh
+ build_and_lint:
+ runs-on: ${{ matrix.os }}
+ env:
+ TEST: "build_and_lint"
+ steps:
+ - uses: actions/setup-node@v1
+ with:
+ node-version: 10
+ - uses: actions/checkout@v1
+ - run: bash ./scripts/install.sh
+ - run: bash ./scripts/ci.sh
+ e2e:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ testCmd:
+ [
+ "unit_and_e2e_clients",
+ "e2e_ganache",
+ "e2e_mosaic",
+ "e2e_ens",
+ "e2e_browsers",
+ ]
+ env:
+ TEST: ${{ matrix.testCmd }}
+ CI: true
+ DISPLAY: :99.0
+ PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true
+ steps:
+ - uses: actions/setup-node@v1
+ with:
+ node-version: 12
+ - uses: actions/checkout@v1
+ - run: bash ./scripts/install.sh
+ - run: bash ./scripts/ci.sh
+ e2e_windows:
+ runs-on: windows-latest
+ env:
+ TEST: "e2e_windows"
+ CI: true
+ steps:
+ - uses: actions/setup-node@v1
+ with:
+ node-version: 12
+ - uses: actions/checkout@v1
+ - run: bash ./scripts/install.sh
+ - run: bash ./scripts/ci.sh
diff --git a/.npmignore b/.npmignore
index 1047e38dedf..4c71292fe6e 100644
--- a/.npmignore
+++ b/.npmignore
@@ -6,6 +6,5 @@ coverage
scripts
.gitignore
.editorconfig
-.travis.yml
.npmignore
.DS_Store
diff --git a/README.md b/README.md
index c2898f617a3..9eafd4e6b5a 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
# web3.js - Ethereum JavaScript API
-[![Join the chat at https://gitter.im/ethereum/web3.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/web3.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![npm](https://img.shields.io/npm/dm/web3.svg)](https://www.npmjs.com/package/web3) [![Build Status][travis-image]][travis-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] [![Coverage Status][coveralls-image]][coveralls-url]
+[![Join the chat at https://gitter.im/ethereum/web3.js](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/web3.js?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![npm](https://img.shields.io/npm/dm/web3.svg)](https://www.npmjs.com/package/web3) [![Build Status][actions-image]][actions-url] [![dependency status][dep-image]][dep-url] [![dev dependency status][dep-dev-image]][dep-dev-url] [![Coverage Status][coveralls-image]][coveralls-url]
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lerna.js.org/)
This is the Ethereum [JavaScript API][docs]
@@ -53,11 +53,13 @@ Or via jsDelivr CDN
```html
```
+
UNPKG
```html
```
+
## Usage
```js
@@ -77,9 +79,9 @@ console.log(web3);
Additionally you can set a provider using `web3.setProvider()` (e.g. WebsocketProvider):
```js
-web3.setProvider('ws://localhost:8546');
+web3.setProvider("ws://localhost:8546");
// or
-web3.setProvider(new Web3.providers.WebsocketProvider('ws://localhost:8546'));
+web3.setProvider(new Web3.providers.WebsocketProvider("ws://localhost:8546"));
```
There you go, now you can use it:
@@ -95,8 +97,8 @@ We support types within the repo itself. Please open an issue here if you find a
You can use `web3.js` as follows:
```typescript
-import Web3 from 'web3';
-const web3 = new Web3('ws://localhost:8546');
+import Web3 from "web3";
+const web3 = new Web3("ws://localhost:8546");
```
If you are using the types in a `commonjs` module like for example a node app you just have to enable `esModuleInterop` in your `tsconfig` compile option, also enable `allowSyntheticDefaultImports` for typesystem compatibility:
@@ -170,8 +172,8 @@ The contribution guidelines are provided in [CONTRIBUTIONS](./CONTRIBUTIONS.md)
[docs]: http://web3js.readthedocs.io/
[npm-image]: https://badge.fury.io/js/web3.png
[npm-url]: https://npmjs.org/package/web3
-[travis-image]: https://travis-ci.org/ethereum/web3.js.svg
-[travis-url]: https://travis-ci.org/ethereum/web3.js
+[actions-image]: https://github.com/ethereum/web3.js/workflows/Test/badge.svg
+[actions-url]: https://github.com/ethereum/web3.js/actions
[dep-image]: https://david-dm.org/ethereum/web3.js.svg
[dep-url]: https://david-dm.org/ethereum/web3.js
[dep-dev-image]: https://david-dm.org/ethereum/web3.js/dev-status.svg
diff --git a/bower.json b/bower.json
index 689e4c10767..52cb6d88cf7 100644
--- a/bower.json
+++ b/bower.json
@@ -1,75 +1,73 @@
{
- "namespace": "ethereum",
- "name": "web3",
- "version": "1.2.6",
- "description": "Ethereum JavaScript API",
- "license": "LGPL-3.0",
- "main": [
- "./dist/web3.min.js"
- ],
- "moduleType": "global",
- "dependencies": {
- "bn.js": ">=4.11.6"
- },
- "repository": {
- "type": "git",
- "url": "git://github.com/ethereum/web3.js.git"
- },
- "homepage": "https://github.com/ethereum/web3.js",
- "bugs": {
- "url": "https://github.com/ethereum/web3.js/issues"
- },
- "keywords": [
- "Ethereum",
- "JavaScript",
- "RPC",
- "Swarm",
- "Whisper",
- "Smart Contracts",
- "API"
- ],
- "authors": [
- {
- "name": "Fabian Vogelsteller",
- "email": "fabian@ethereum.org",
- "homepage": "http://frozeman.de"
+ "namespace": "ethereum",
+ "name": "web3",
+ "version": "1.2.6",
+ "description": "Ethereum JavaScript API",
+ "license": "LGPL-3.0",
+ "main": ["./dist/web3.min.js"],
+ "moduleType": "global",
+ "dependencies": {
+ "bn.js": ">=4.11.6"
},
- {
- "name": "Marek Kotewicz",
- "email": "marek@parity.io",
- "url": "https://github.com/debris"
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/ethereum/web3.js.git"
},
- {
- "name": "Marian Oancea",
- "url": "https://github.com/cubedro"
+ "homepage": "https://github.com/ethereum/web3.js",
+ "bugs": {
+ "url": "https://github.com/ethereum/web3.js/issues"
},
- {
- "name": "Gav Wood",
- "email": "g@parity.io",
- "homepage": "http://gavwood.com"
- },
- {
- "name": "Jeffery Wilcke",
- "email": "jeffrey.wilcke@ethereum.org",
- "url": "https://github.com/obscuren"
- }
- ],
- "ignore": [
- "test",
- "packages",
- "src",
- "node_modules",
- "package.json",
- "package.js",
- ".versions",
- ".bowerrc",
- ".editorconfig",
- ".gitignore",
- ".jshintrc",
- ".npmignore",
- ".travis.yml",
- "gulpfile.js",
- "index.js",
- "**/*.txt"
- ]
+ "keywords": [
+ "Ethereum",
+ "JavaScript",
+ "RPC",
+ "Swarm",
+ "Whisper",
+ "Smart Contracts",
+ "API"
+ ],
+ "authors": [
+ {
+ "name": "Fabian Vogelsteller",
+ "email": "fabian@ethereum.org",
+ "homepage": "http://frozeman.de"
+ },
+ {
+ "name": "Marek Kotewicz",
+ "email": "marek@parity.io",
+ "url": "https://github.com/debris"
+ },
+ {
+ "name": "Marian Oancea",
+ "url": "https://github.com/cubedro"
+ },
+ {
+ "name": "Gav Wood",
+ "email": "g@parity.io",
+ "homepage": "http://gavwood.com"
+ },
+ {
+ "name": "Jeffery Wilcke",
+ "email": "jeffrey.wilcke@ethereum.org",
+ "url": "https://github.com/obscuren"
+ }
+ ],
+ "ignore": [
+ "test",
+ "packages",
+ "src",
+ "node_modules",
+ "package.json",
+ "package.js",
+ ".versions",
+ ".bowerrc",
+ ".editorconfig",
+ ".gitignore",
+ ".jshintrc",
+ ".npmignore",
+ ".github",
+ "gulpfile.js",
+ "index.js",
+ "**/*.txt"
+ ]
}
diff --git a/karma.conf.js b/karma.conf.js
index 00caf992889..d4ae71607f3 100644
--- a/karma.conf.js
+++ b/karma.conf.js
@@ -1,67 +1,61 @@
process.env.MOZ_HEADLESS = 1;
-if (!process.env.TRAVIS){
- process.env.CHROME_BIN = require('puppeteer').executablePath();
+if (!process.env.GITHUB_ACTION) {
+ process.env.CHROME_BIN = require("puppeteer").executablePath();
}
// BROWSER_BUNDLE_TEST is set for an un-browserified check that both bundles load correctly.
// BROWSER_BUNDLE_TEST is not set for the e2e unit tests, which check that bundle internals are ok.
-function getTestFiles(){
- switch (process.env.BROWSER_BUNDLE_TEST){
- case 'publishedDist': return ["packages/web3/dist/web3.min.js", "test/e2e.minified.js"]
- case 'gitRepoDist': return ["dist/web3.min.js", "test/e2e.minified.js"]
- default: return ["test/**/e2e*.js"]
+function getTestFiles() {
+ switch (process.env.BROWSER_BUNDLE_TEST) {
+ case "publishedDist":
+ return ["packages/web3/dist/web3.min.js", "test/e2e.minified.js"];
+ case "gitRepoDist":
+ return ["dist/web3.min.js", "test/e2e.minified.js"];
+ default:
+ return ["test/**/e2e*.js"];
}
}
// Only loads browserified preprocessor for the logic unit tests so we can `require` stuff.
-function getPreprocessors(){
- if (!process.env.BROWSER_BUNDLE_TEST){
- return { 'test/**/e2e*.js': [ 'browserify' ] }
+function getPreprocessors() {
+ if (!process.env.BROWSER_BUNDLE_TEST) {
+ return { "test/**/e2e*.js": ["browserify"] };
}
}
-module.exports = function (config) {
+module.exports = function(config) {
var configuration = {
- frameworks: [
- 'mocha',
- 'browserify'
- ],
+ frameworks: ["mocha", "browserify"],
files: getTestFiles(),
preprocessors: getPreprocessors(),
plugins: [
- 'karma-chrome-launcher',
- 'karma-firefox-launcher',
- 'karma-mocha',
- 'karma-browserify',
- 'karma-spec-reporter'
+ "karma-chrome-launcher",
+ "karma-firefox-launcher",
+ "karma-mocha",
+ "karma-browserify",
+ "karma-spec-reporter"
],
- reporters: ['spec'],
- port: 9876, // karma web server port
+ reporters: ["spec"],
+ port: 9876, // karma web server port
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
- browsers: [
- 'ChromeHeadless',
- 'FirefoxHeadless'
- ],
+ browsers: ["ChromeHeadless", "FirefoxHeadless"],
customLaunchers: {
FirefoxHeadless: {
- base: 'Firefox',
- flags: ['-headless'],
+ base: "Firefox",
+ flags: ["-headless"]
},
- Chrome_travis_ci: {
- base: 'Chrome',
- flags: ['--no-sandbox']
+ Chrome_ci: {
+ base: "Chrome",
+ flags: ["--no-sandbox"]
}
- },
+ }
};
- if(process.env.TRAVIS) {
- configuration.browsers = [
- 'Chrome_travis_ci',
- 'FirefoxHeadless'
- ];
+ if (process.env.GITHUB_ACTION) {
+ configuration.browsers = ["Chrome_ci", "FirefoxHeadless"];
}
config.set(configuration);
diff --git a/packages/web3-eth-accounts/package.json b/packages/web3-eth-accounts/package.json
index 4bc29db3631..005dac1e54e 100644
--- a/packages/web3-eth-accounts/package.json
+++ b/packages/web3-eth-accounts/package.json
@@ -1,32 +1,25 @@
{
- "name": "web3-eth-accounts",
- "version": "1.2.6",
- "description": "Web3 module to generate Ethereum accounts and sign data and transactions.",
- "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth-accounts",
- "license": "LGPL-3.0",
- "engines": {
- "node": ">=8.0.0"
- },
- "types": "types/index.d.ts",
- "scripts": {
- "dtslint": "dtslint types --onlyTestTsNext"
- },
- "main": "src/index.js",
- "dependencies": {
- "@web3-js/scrypt-shim": "^0.1.0",
- "crypto-browserify": "3.12.0",
- "eth-lib": "^0.2.8",
- "ethereumjs-common": "^1.3.2",
- "ethereumjs-tx": "^2.1.1",
- "underscore": "1.9.1",
- "uuid": "3.3.2",
- "web3-core": "1.2.6",
- "web3-core-helpers": "1.2.6",
- "web3-core-method": "1.2.6",
- "web3-utils": "1.2.6"
- },
- "devDependencies": {
- "definitelytyped-header-parser": "^1.0.1",
- "dtslint": "0.4.2"
- }
+ "name": "web3-eth-accounts",
+ "version": "1.2.6",
+ "description": "Web3 module to generate Ethereum accounts and sign data and transactions.",
+ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth-accounts",
+ "license": "LGPL-3.0",
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "types": "types/index.d.ts",
+ "main": "src/index.js",
+ "dependencies": {
+ "@web3-js/scrypt-shim": "^0.1.0",
+ "crypto-browserify": "3.12.0",
+ "eth-lib": "^0.2.8",
+ "ethereumjs-common": "^1.3.2",
+ "ethereumjs-tx": "^2.1.1",
+ "underscore": "1.9.1",
+ "uuid": "3.3.2"
+ },
+ "devDependencies": {
+ "definitelytyped-header-parser": "^1.0.1",
+ "dtslint": "0.4.2"
+ }
}
diff --git a/packages/web3-eth-accounts/package.json.lerna_backup b/packages/web3-eth-accounts/package.json.lerna_backup
new file mode 100644
index 00000000000..4bc29db3631
--- /dev/null
+++ b/packages/web3-eth-accounts/package.json.lerna_backup
@@ -0,0 +1,32 @@
+{
+ "name": "web3-eth-accounts",
+ "version": "1.2.6",
+ "description": "Web3 module to generate Ethereum accounts and sign data and transactions.",
+ "repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-eth-accounts",
+ "license": "LGPL-3.0",
+ "engines": {
+ "node": ">=8.0.0"
+ },
+ "types": "types/index.d.ts",
+ "scripts": {
+ "dtslint": "dtslint types --onlyTestTsNext"
+ },
+ "main": "src/index.js",
+ "dependencies": {
+ "@web3-js/scrypt-shim": "^0.1.0",
+ "crypto-browserify": "3.12.0",
+ "eth-lib": "^0.2.8",
+ "ethereumjs-common": "^1.3.2",
+ "ethereumjs-tx": "^2.1.1",
+ "underscore": "1.9.1",
+ "uuid": "3.3.2",
+ "web3-core": "1.2.6",
+ "web3-core-helpers": "1.2.6",
+ "web3-core-method": "1.2.6",
+ "web3-utils": "1.2.6"
+ },
+ "devDependencies": {
+ "definitelytyped-header-parser": "^1.0.1",
+ "dtslint": "0.4.2"
+ }
+}
diff --git a/scripts/ci.sh b/scripts/ci.sh
index a4f0b8f766e..83ee9c516ea 100755
--- a/scripts/ci.sh
+++ b/scripts/ci.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# -----------------------------
-# Travis CI matrix job selector
+# CI matrix job selector
# -----------------------------
# Exit immediately on error
diff --git a/scripts/e2e.ganache.core.sh b/scripts/e2e.ganache.core.sh
index fbd3029cc78..95cc8448e19 100755
--- a/scripts/e2e.ganache.core.sh
+++ b/scripts/e2e.ganache.core.sh
@@ -19,7 +19,7 @@ echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
npm install
npm uninstall --save-dev web3
-npm install --save-dev web3@e2e --registry http://localhost:4873
+npm install --save-dev web3@e2e --registry http://localhost:4873 --network-timeout 600000
npm list web3
npm list web3-utils
diff --git a/scripts/e2e.mosaic.sh b/scripts/e2e.mosaic.sh
index 26d84019428..ec2907399ec 100755
--- a/scripts/e2e.mosaic.sh
+++ b/scripts/e2e.mosaic.sh
@@ -33,7 +33,7 @@ echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
git submodule update --init --recursive
yarn --registry http://localhost:4873
-yarn add web3@e2e --registry http://localhost:4873
+yarn add web3@e2e --registry http://localhost:4873 --network-timeout 600000
yarn list web3
yarn list web3-utils
diff --git a/scripts/e2e.npm.publish.sh b/scripts/e2e.npm.publish.sh
index 3a8a703a431..474a50fc630 100755
--- a/scripts/e2e.npm.publish.sh
+++ b/scripts/e2e.npm.publish.sh
@@ -21,7 +21,7 @@ fi
# To model publication correctly, this script needs to run
# without web3's dev deps being installed. It installs
# what it needs here.
-npm install -g verdaccio@4.4.2
+npm install -g verdaccio@4.4.4
npm install -g npm-auth-to-token@1.0.0
npm install -g lerna@3.18.3
@@ -46,11 +46,10 @@ npm-auth-to-token \
-r http://localhost:4873
# Prep branch for Lerna's git-checks
-BRANCH=$TRAVIS_PULL_REQUEST_BRANCH
-if [ -z "$BRANCH" ]; then
-
- BRANCH=$TRAVIS_BRANCH
-
+if [[ $GITHUB_REF = 'refs/pull/'* ]]; then
+ BRANCH=${GITHUB_HEAD_REF##*/}
+else
+ BRANCH=${GITHUB_REF##*/}
fi
git checkout $BRANCH --
@@ -63,8 +62,9 @@ lerna version minor \
--allow-branch $BRANCH \
--yes
-# Set email prior to publishing (necessary for Windows)
+# Set identity prior to publishing (necessary for Windows)
git config user.email "you@example.com"
+git config user.name "Your Name"
# Commit changes because lerna checks git before
git commit -a -m 'virtual-version-bump'
diff --git a/scripts/e2e.truffle.sh b/scripts/e2e.truffle.sh
index 6d9cfcbe804..1fd5640416c 100755
--- a/scripts/e2e.truffle.sh
+++ b/scripts/e2e.truffle.sh
@@ -2,7 +2,7 @@
# --------------------------------------------------------------------------------
# NB: This script temporarily removed from CI while truffle remains on Web3@1.2.1.
-# To re-enable, add a `env: TEST=e2e_truffle` job to the matrix in travis.yml.
+# To re-enable, add a `e2e_truffle` job to the matrix in `.github/workflows/test.yml`.
# --------------------------------------------------------------------------------
# -------------------------------------------------------------------------
diff --git a/scripts/install.sh b/scripts/install.sh
index 0d7943f5610..749d8cfe18e 100755
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# This script contains conditional installation logic for Travis CI
+# This script contains conditional installation logic for CI
# CI jobs we'd like to skip default installation for:
# Helpful for E2E tests where the dev deps might cause problems
diff --git a/test/eth.accounts.wallet.js b/test/eth.accounts.wallet.js
index 55ecba899f3..79cf6f71692 100644
--- a/test/eth.accounts.wallet.js
+++ b/test/eth.accounts.wallet.js
@@ -1,36 +1,39 @@
var Accounts = require("./../packages/web3-eth-accounts");
-var chai = require('chai');
+var chai = require("chai");
var assert = chai.assert;
-var Web3 = require('../packages/web3');
+var Web3 = require("../packages/web3");
var web3 = new Web3();
var tests = [
{
- address: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
- privateKey: '0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728',
- data: 'Some data',
+ address: "0xEB014f8c8B418Db6b45774c326A0E64C78914dC0",
+ privateKey:
+ "0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728",
+ data: "Some data",
// signature done with personal_sign
- signature: '0xa8037a6116c176a25e6fc224947fde9e79a2deaa0dd8b67b366fbdfdbffc01f953e41351267b20d4a89ebfe9c8f03c04de9b345add4a52f15bd026b63c8fb1501b'
- }, {
- address: '0xEB014f8c8B418Db6b45774c326A0E64C78914dC0',
- privateKey: '0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728',
- data: 'Some data!%$$%&@*',
+ signature:
+ "0xa8037a6116c176a25e6fc224947fde9e79a2deaa0dd8b67b366fbdfdbffc01f953e41351267b20d4a89ebfe9c8f03c04de9b345add4a52f15bd026b63c8fb1501b"
+ },
+ {
+ address: "0xEB014f8c8B418Db6b45774c326A0E64C78914dC0",
+ privateKey:
+ "0xbe6383dad004f233317e46ddb46ad31b16064d14447a95cc1d8c8d4bc61c3728",
+ data: "Some data!%$$%&@*",
// signature done with personal_sign
- signature: '0x05252412b097c5d080c994d1ea12abcee6f1cae23feb225517a0b691a66e12866b3f54292f9cfef98f390670b4d010fc4af7fcd46e41d72870602c117b14921c1c'
+ signature:
+ "0x05252412b097c5d080c994d1ea12abcee6f1cae23feb225517a0b691a66e12866b3f54292f9cfef98f390670b4d010fc4af7fcd46e41d72870602c117b14921c1c"
}
];
-
-describe("eth", function () {
- describe("accounts.wallet", function () {
-
- tests.forEach(function (test, i) {
+describe("eth", function() {
+ describe("accounts.wallet", function() {
+ tests.forEach(function(test, i) {
it("creates the right number of wallets", function() {
var ethAccounts = new Accounts();
assert.equal(ethAccounts.wallet.length, 0);
- var wallet = ethAccounts.wallet.create(2, '542342f!@#$$');
+ var wallet = ethAccounts.wallet.create(2, "542342f!@#$$");
assert.equal(ethAccounts.wallet.length, 2);
assert.equal(wallet.length, 2);
@@ -41,7 +44,9 @@ describe("eth", function () {
assert.equal(wallet.length, 5);
assert.isTrue(web3.utils.isAddress(wallet[1].address));
- assert.isTrue(web3.utils.isAddress(ethAccounts.wallet[2].address));
+ assert.isTrue(
+ web3.utils.isAddress(ethAccounts.wallet[2].address)
+ );
});
it("add wallet using a privatekey", function() {
@@ -56,8 +61,14 @@ describe("eth", function () {
assert.equal(wallet.index, 0);
// test if its retrievabe via address and index
- assert.equal(ethAccounts.wallet[test.address].address, test.address);
- assert.equal(ethAccounts.wallet[test.address.toLowerCase()].address, test.address);
+ assert.equal(
+ ethAccounts.wallet[test.address].address,
+ test.address
+ );
+ assert.equal(
+ ethAccounts.wallet[test.address.toLowerCase()].address,
+ test.address
+ );
assert.equal(ethAccounts.wallet[0].address, test.address);
assert.equal(ethAccounts.wallet.length, 1);
@@ -78,8 +89,14 @@ describe("eth", function () {
assert.equal(wallet.index, 0);
// test if its retrievabe via address and index
- assert.equal(ethAccounts.wallet[test.address].address, test.address);
- assert.equal(ethAccounts.wallet[test.address.toLowerCase()].address, test.address);
+ assert.equal(
+ ethAccounts.wallet[test.address].address,
+ test.address
+ );
+ assert.equal(
+ ethAccounts.wallet[test.address.toLowerCase()].address,
+ test.address
+ );
assert.equal(ethAccounts.wallet[0].address, test.address);
assert.equal(ethAccounts.wallet.length, 1);
@@ -106,8 +123,14 @@ describe("eth", function () {
assert.equal(wallet.index, 0);
// test if its retrievabe via address and index
- assert.equal(ethAccounts.wallet[test.address].address, test.address);
- assert.equal(ethAccounts.wallet[test.address.toLowerCase()].address, test.address);
+ assert.equal(
+ ethAccounts.wallet[test.address].address,
+ test.address
+ );
+ assert.equal(
+ ethAccounts.wallet[test.address.toLowerCase()].address,
+ test.address
+ );
assert.equal(ethAccounts.wallet[0].address, test.address);
assert.equal(ethAccounts.wallet.length, 1);
@@ -124,10 +147,11 @@ describe("eth", function () {
assert.isUndefined(ethAccounts.wallet[0]);
assert.isUndefined(ethAccounts.wallet[wallet.address]);
- assert.isUndefined(ethAccounts.wallet[wallet.address.toLowerCase()]);
+ assert.isUndefined(
+ ethAccounts.wallet[wallet.address.toLowerCase()]
+ );
assert.equal(ethAccounts.wallet.length, 0);
-
});
it("remove wallet using an address", function() {
@@ -141,10 +165,11 @@ describe("eth", function () {
assert.isUndefined(ethAccounts.wallet[0]);
assert.isUndefined(ethAccounts.wallet[wallet.address]);
- assert.isUndefined(ethAccounts.wallet[wallet.address.toLowerCase()]);
+ assert.isUndefined(
+ ethAccounts.wallet[wallet.address.toLowerCase()]
+ );
assert.equal(ethAccounts.wallet.length, 0);
-
});
it("remove wallet using an lowercase address", function() {
@@ -158,10 +183,11 @@ describe("eth", function () {
assert.isUndefined(ethAccounts.wallet[0]);
assert.isUndefined(ethAccounts.wallet[wallet.address]);
- assert.isUndefined(ethAccounts.wallet[wallet.address.toLowerCase()]);
+ assert.isUndefined(
+ ethAccounts.wallet[wallet.address.toLowerCase()]
+ );
assert.equal(ethAccounts.wallet.length, 0);
-
});
it("create 5 wallets, remove two, create two more and check for overwrites", function() {
@@ -170,25 +196,35 @@ describe("eth", function () {
assert.equal(ethAccounts.wallet.length, 0);
var wallet = ethAccounts.wallet.create(count);
- var initialAddresses = [0,1,2,3,4].map(function(n) { return wallet[n].address } );
+ var initialAddresses = [0, 1, 2, 3, 4].map(function(n) {
+ return wallet[n].address;
+ });
assert.equal(ethAccounts.wallet.length, count);
var thirdAddress = ethAccounts.wallet[2].address;
var lastAddress = ethAccounts.wallet[4].address;
- var remainingAddresses = [0,1,3];
- var beforeRemoval = remainingAddresses.map(function(n) { return wallet[n].address } );
+ var remainingAddresses = [0, 1, 3];
+ var beforeRemoval = remainingAddresses.map(function(n) {
+ return wallet[n].address;
+ });
ethAccounts.wallet.remove(2);
ethAccounts.wallet.remove(4);
assert.isUndefined(ethAccounts.wallet[2]);
assert.isUndefined(ethAccounts.wallet[thirdAddress]);
- assert.isUndefined(ethAccounts.wallet[thirdAddress.toLowerCase()]);
+ assert.isUndefined(
+ ethAccounts.wallet[thirdAddress.toLowerCase()]
+ );
assert.isUndefined(ethAccounts.wallet[4]);
assert.isUndefined(ethAccounts.wallet[lastAddress]);
- assert.isUndefined(ethAccounts.wallet[lastAddress.toLowerCase()]);
+ assert.isUndefined(
+ ethAccounts.wallet[lastAddress.toLowerCase()]
+ );
- var afterRemoval = remainingAddresses.map(function(n) { return wallet[n].address } );
+ var afterRemoval = remainingAddresses.map(function(n) {
+ return wallet[n].address;
+ });
assert.equal(ethAccounts.wallet._findSafeIndex(), 2);
assert.equal(ethAccounts.wallet.length, 3);
@@ -198,13 +234,29 @@ describe("eth", function () {
assert.isTrue(web3.utils.isAddress(wallet[4].address));
assert.isUndefined(ethAccounts.wallet[5]);
- var afterMoreCreation = remainingAddresses.map(function(n) { return wallet[n].address } );
- var newAddresses = [0,1,2,3,4].map(function(n) { return wallet[n].address } );
+ var afterMoreCreation = remainingAddresses.map(function(n) {
+ return wallet[n].address;
+ });
+ var newAddresses = [0, 1, 2, 3, 4].map(function(n) {
+ return wallet[n].address;
+ });
// Checks for account overwrites
- assert.sameOrderedMembers(beforeRemoval, afterMoreCreation, "same ordered members");
- assert.sameOrderedMembers(afterRemoval, afterMoreCreation, "same ordered members");
- assert.notSameMembers(initialAddresses, newAddresses, "not same members");
+ assert.sameOrderedMembers(
+ beforeRemoval,
+ afterMoreCreation,
+ "same ordered members"
+ );
+ assert.sameOrderedMembers(
+ afterRemoval,
+ afterMoreCreation,
+ "same ordered members"
+ );
+ assert.notSameMembers(
+ initialAddresses,
+ newAddresses,
+ "not same members"
+ );
assert.equal(ethAccounts.wallet.length, count);
});
@@ -227,7 +279,9 @@ describe("eth", function () {
for (var i = 0; i < count; i++) {
assert.isUndefined(ethAccounts.wallet[i]);
assert.isUndefined(ethAccounts.wallet[addresses[i]]);
- assert.isUndefined(ethAccounts.wallet[addresses[i].toLowerCase()]);
+ assert.isUndefined(
+ ethAccounts.wallet[addresses[i].toLowerCase()]
+ );
}
assert.equal(ethAccounts.wallet.length, 0);
@@ -247,18 +301,19 @@ describe("eth", function () {
}
ethAccounts.wallet.remove(0);
- assert.isUndefined(ethAccounts.wallet[0])
+ assert.isUndefined(ethAccounts.wallet[0]);
ethAccounts.wallet.remove(5);
- assert.isUndefined(ethAccounts.wallet[5])
-
- setTimeout(function () {
+ assert.isUndefined(ethAccounts.wallet[5]);
+ setTimeout(function() {
ethAccounts.wallet.clear();
for (var i = 0; i < count; i++) {
assert.isUndefined(ethAccounts.wallet[i]);
assert.isUndefined(ethAccounts.wallet[addresses[i]]);
- assert.isUndefined(ethAccounts.wallet[addresses[i].toLowerCase()]);
+ assert.isUndefined(
+ ethAccounts.wallet[addresses[i].toLowerCase()]
+ );
}
assert.equal(ethAccounts.wallet.length, 0);
@@ -268,6 +323,7 @@ describe("eth", function () {
});
it("encrypt then decrypt wallet", function() {
+ this.timeout(10000);
var ethAccounts = new Accounts();
var password = "qwerty";
diff --git a/verdaccio.yml b/verdaccio.yml
index 066ade8ec2e..f40068a6d28 100644
--- a/verdaccio.yml
+++ b/verdaccio.yml
@@ -1,23 +1,29 @@
storage: ./storage
auth:
- htpasswd:
- file: ./htpasswd
+ htpasswd:
+ file: ./htpasswd
uplinks:
- npmjs:
- url: https://registry.npmjs.org/
- timeout: 100000ms
- yarn:
- url: https://registry.yarnpkg.com/
- timeout: 100000ms
+ npmjs:
+ url: https://registry.npmjs.org/
+ timeout: 10m
+ fail_timeout: 10m
+ max_fails: 20
+ yarn:
+ url: https://registry.yarnpkg.com/
+ timeout: 10m
+ fail_timeout: 10m
+ max_fails: 20
packages:
- '@*/*':
- # scoped packages
- access: $all
- publish: $all
- proxy: npmjs
- '**':
- access: $all
- publish: $all
- proxy: npmjs
+ "@*/*":
+ # scoped packages
+ access: $all
+ publish: $all
+ proxy: yarn npmjs
+ "**":
+ access: $all
+ publish: $all
+ proxy: yarn npmjs
logs:
- - {type: stdout, format: pretty, level: warn}
+ - { type: stdout, format: pretty, level: warn }
+server:
+ keepAliveTimeout: 600 # specified in seconds