Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init web3 eth accounts 4.x #4496

Merged
merged 3 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/web3-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<img src="assets/logo/web3js.jpg" width="500" alt="web3.js" />
</p>

# web3.js - Package Template
# web3.js - Web3 Core
spacesailor24 marked this conversation as resolved.
Show resolved Hide resolved

![ES Version](https://img.shields.io/badge/ES-2020-yellow)
![Node Version](https://img.shields.io/badge/node-14.x-green)
Expand Down
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/.eslintignore
7 changes: 7 additions & 0 deletions packages/web3-eth-accounts/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: '../../.eslintrc.js',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
Empty file.
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/.npmignore
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/.npmrc
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/.prettierignore
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/.prettierrc.json
36 changes: 36 additions & 0 deletions packages/web3-eth-accounts/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

<!-- EXAMPLE

## [1.0.0]

### Added

- I've added feature XY (#1000)

### Changed

- I've cleaned up XY (#1000)

### Deprecated

- I've deprecated XY (#1000)

### Removed

- I've removed XY (#1000)

### Fixed

- I've fixed XY (#1000)

### Security

- I've improved the security in XY (#1000)

-->
53 changes: 53 additions & 0 deletions packages/web3-eth-accounts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<p align="center">
<img src="assets/logo/web3js.jpg" width="500" alt="web3.js" />
</p>

# web3.js - Web3 Eth Accounts

![ES Version](https://img.shields.io/badge/ES-2020-yellow)
![Node Version](https://img.shields.io/badge/node-14.x-green)
[![NPM Package][npm-image]][npm-url]
[![Dependency Status][deps-image]][deps-url]
[![Dev Dependency Status][deps-dev-image]][deps-dev-url]

This is a sub-package of [web3.js][repo].

`web3-eth-accounts` contains functionality for managing Ethereum accounts and signing.

###### Get it from the NPM Registry

```bash
yarn add web3-eth-accounts
```

## Getting Started

- :writing_hand: If you have questions [submit an issue](https://github.com/ChainSafe/web3.js/issues/new) or join us on [Discord](https://discord.gg/yjyvFRP)
![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)

## Prerequisites

- :gear: [NodeJS](https://nodejs.org/) (LTS/Fermium)
- :toolbox: [Yarn](https://yarnpkg.com/)/[Lerna](https://lerna.js.org/)

## Package.json Scripts

| Script | Description |
| ---------------- | -------------------------------------------------- |
| clean | Uses `rimraf` to remove `dist/` |
| build | Uses `tsc` to build package and dependent packages |
| lint | Uses `eslint` to lint package |
| lint:fix | Uses `eslint` to check and fix any warnings |
| format | Uses `prettier` to format the code |
| test | Uses `jest` to run unit tests |
| test:integration | Uses `jest` to run tests under `/test/integration` |
| test:unit | Uses `jest` to run tests under `/test/unit` |

[docs]: http://web3js.readthedocs.io/en/4.0/
[repo]: https://github.com/ethereum/web3.js
[npm-image]: https://img.shields.io/npm/v/web3-core-method.svg
[npm-url]: https://npmjs.org/packages/web3-package-tempalte
[deps-image]: https://david-dm.org/ethereum/web3.js/4.x/status.svg?path=tools/web3-package-tempalte
[deps-url]: https://david-dm.org/ethereum/web3.js/4.x?path=tools/web3-package-tempalte
[deps-dev-image]: https://david-dm.org/ethereum/web3.js/4.x/dev-status.svg?path=tools/web3-package-tempalte
[deps-dev-url]: https://david-dm.org/ethereum/web3.js/4.x?type=dev&path=tools/web3-package-tempalte
1,516 changes: 1,516 additions & 0 deletions packages/web3-eth-accounts/assets/logo/web3js.ai

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions packages/web3-eth-accounts/assets/logo/web3js.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions packages/web3-eth-accounts/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "web3-eth-accounts",
"version": "4.0.0-alpha.0",
"description": "Package for managing Ethereum accounts and signing",
"main": "dist/index.js",
"repository": "https://github.com/ChainSafe/web3.js",
"author": "ChainSafe Systems",
"license": "LGPL-3.0",
"files": [
"dist/**/*"
],
"scripts": {
"clean": "rimraf dist",
"prebuild": "rimraf dist",
"build": "tsc --build",
"build:check": "node -e \"require('./dist')\"",
"lint": "eslint --ext .js,.ts .",
"lint:fix": "eslint --fix --ext .js,.ts .",
"format": "prettier --write '**/*'",
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
"test:unit": "jest --config=./test/unit/jest.config.js",
"test:integration": "jest --config=./test/integration/jest.config.js"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-web3-base": "0.1.0",
"eslint-plugin-import": "^2.24.2",
"jest": "^27.2.1",
"jest-extended": "^0.11.5",
"prettier": "^2.4.1",
"ts-jest": "^27.0.5",
"typescript": "^4.4.3"
}
}
Empty file.
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions packages/web3-eth-accounts/test/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
extends: '../../../.eslintrc.test.js',
parserOptions: {
project: './tsconfig.json',
tsconfigRootDir: __dirname,
},
};
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/test/config/jest.config.js
7 changes: 7 additions & 0 deletions packages/web3-eth-accounts/test/config/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Have to use `require` because of Jest issue https://jestjs.io/docs/ecmascript-modules
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('jest-extended');

// @todo extend jest to have "toHaveBeenCalledOnceWith" matcher.

process.env.NODE_ENV = 'test';
33 changes: 33 additions & 0 deletions packages/web3-eth-accounts/test/integration/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
'use strict';

const base = require('../config/jest.config');

module.exports = {
...base,
setupFilesAfterEnv: ['<rootDir>/test/integration/setup.js'],
testMatch: ['<rootDir>/test/integration/**/*.(spec|test).(js|ts)'],
/**
* restoreMocks [boolean]
*
* Default: false
*
* Automatically restore mock state between every test.
* Equivalent to calling jest.restoreAllMocks() between each test.
* This will lead to any mocks having their fake implementations removed
* and restores their initial implementation.
*/
restoreMocks: true,

/**
* resetModules [boolean]
*
* Default: false
*
* By default, each test file gets its own independent module registry.
* Enabling resetModules goes a step further and resets the module registry before running each individual test.
* This is useful to isolate modules for every test so that local module state doesn't conflict between tests.
* This can be done programmatically using jest.resetModules().
*/
resetModules: true,
coverageDirectory: '.coverage/integration',
};
7 changes: 7 additions & 0 deletions packages/web3-eth-accounts/test/integration/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Have to use `require` because of Jest issue https://jestjs.io/docs/ecmascript-modules
// eslint-disable-next-line @typescript-eslint/no-require-imports
require('../config/setup');

const jestTimeout = 15000;

jest.setTimeout(jestTimeout);
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/test/tsconfig.json
20 changes: 20 additions & 0 deletions packages/web3-eth-accounts/test/unit/constructor.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// import Web3ProviderBase from '../../src/index'
// import {ProviderOptions} from '../../types'

describe('constructs a PLACEHOLDER instance with expected properties', () => {
// let providerOptions: ProviderOptions

beforeEach(() => {
// providerOptions = {
// providerUrl: 'http://127.0.0.1:8545'
// }
});

it('should construct with expected properties', () => {
// const web3ProviderBase = new Web3ProviderBase(providerOptions)
// expect(web3ProviderBase).toMatchObject({
// _providerUrl: providerOptions.providerUrl
// })
expect(true).toBeTruthy();
});
});
9 changes: 9 additions & 0 deletions packages/web3-eth-accounts/test/unit/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const base = require('../config/jest.config');

module.exports = {
...base,
testMatch: ['<rootDir>/test/unit/**/*.(spec|test).(js|ts)'],

coverageDirectory: '.coverage/unit',
collectCoverageFrom: ['src/controller/**', 'src/application/**'],
};
1 change: 1 addition & 0 deletions packages/web3-eth-accounts/tsconfig.json