Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 39f8fd5

Browse files
nazarhussainspacesailor24jdevcs
authored
Web3 Eth Personal (#4781)
* Add @ethereumjs/tx dependency * Update Web3BaseProvider to SupportedProviders for Web3Eth constructor * WIP eth-tx * Add support for undefined values for convertToValidType * Remove unused Web3BaseProvider * WIP eth-tx utils * Export privateKeyToAddress * Add web3-eth-accounts dependency * WIP web3-eth-tx util methods * Replace inline errors with error constructors * Change types for transaction r and s properties. Correct hardforks in detectTransactionType * Init formatTransaction tests and fixture * Init detectTransactionType and fixture * Add more descriptive error messages * Logic fixes for validateTransactionForSigning * Init validateTransactionForSigning tests and fixtures * Add esModuleInterop: true to tsconfig * Small bug fixes and added TODOs * Add parent describe to detect_transaction_type test * Add parent describe to format_transaction test * Add web3-providers-http as dev dependency for tests * Init populate_transaction tests * Move types from eth_tx.ts to types.ts * Remove TODOs * Add missing , * Remove TODO * Remove TODO * Fix transaction type import issues * Update convertToValidType test data for undefined * Update override method tests * Update packages/web3-eth/src/eth_tx.ts Co-authored-by: jdevcs <86780488+jdevcs@users.noreply.github.com> * Move getBlock to after type check for populateTransaction * Replace N/A with name of error for error.msg * Assign formattedTransaction type Transaction<ReturnType> * convertToValidType now throws error for value === undefined * NumberType extends Numbers * Transaction type related changes * Refactor DesiredType logic * Convert to deep copy for formatTransaction method * skip override method test - needs to be refactored. General formatting * Skip override method test - needs to be refactored. Set input.type > 0x7f * Refactor formatTransaction * Add error codes to web3-eth errors * Refactor validateGate if statements into readable consts * Update comment * Add link to error message from 1.x * Fix bug with is gas consts in validateGas * Init InvalidConvertibleValueError * Replace error with InvalidConvertibleValueError * Update tests for formatting undefined * Update expected errors for validateGas tests * No longer default tx.type if undefined * Refactor detectTransactionType * Fix type error for return in detectTransactionType * Init rpc_method_wrappers.ts * Remove Web3Eth import * Refactor use of web3Context.defaults * Restore Formatted transaction types * Init web3_rpc_method_wrappers tests * Refactor web3_eth_methods_with_parameters test * Replace if X === undefined checks with ? * Un-export consts that aren't used * Add defaultTransactionType and defaultMaxPriorityFeePerGas * Update defaults for chain and hardfork to mainnet and london * Update to use web3Context.default chain and hardfork. Init tests for defaults * Update test to account for added defaults * Refactor validateGas to use helper methods * remove TODO * Init error TransactionGasMismatchError * Fix tests and refactor transaction validator helper methods * Move validation methods to validation.ts * Add input to Transaction type * Add @ethereumjs/common dependency * yarn format * Remove null for defaultTransactionType * Add default for defaultTransactionType * Update default for defaultTransactionType * Bug fixes, refactors, and init prepareTransactionForSigning and tests * Remove unused test code * revert transaction data and value to default to 0x * Fix failing populate_transaction tests * Add defaultNetworkId to web3_config * Add TODO for failing prepare_transaction_for_signing test * Remove TODO * Init TransactionDataAndInputError * Add else if to populateTransaction - data * Refactor populateTransaction - chainId * Comment out unused ifs * Remove populateTransaction - gas * Remove populateTransaction - hexTxType * Replace use of ValidReturnTypes[ValidTypes.HexString] with HexString * Remove toHex import * Remove | null for Web3ConfigOptions defaultChain and defaultHardfork * Refactor getEthereumjsTransactionOptions * Remove no longer needed populateTransaction - gas test * Update packages/web3-eth/src/validation.ts * Remove unnecessary rpc method wrappers * Web3Eth now extends Web3Context instead of instantiating it * Init getPendingTransactions * Init requestAccounts * Add EIP-1102 as a comment for requestAccounts * Init getChainId * Init getProof * Init Web3EthExecutionAPI * Fix imports for AccountObject in fixtures * Add formatting to getPendingTransactions. Move formatTransaction to seperate file * Add TODO to investigate transaction.data * Add formatting to getChainId response * Init getNodeInfo * Revert esModuleInterop change * Combine networkId and chainId if statements * yarn format * Add Partial to type of transaction for eth_sendTransaction * Init transactionReceiptPollingInterval and transactionConfirmationPollingInterval * Add TODO and Partial to transaction type for sendTransaction * WIP sendTransaction and PromiEvent integration * Add eslint-disable-next-line * Add eslint-disable-next-line * Move TransactionEvents * eslint fixes * Update sendSignedTransaction to use PromiEvent * Init signTransaction * Refactor TransactionCall * Comment out validation for call * Init TransactionCall type for web3-eth types * Remove as BaseTransaction from isTransactionCall * Implement call for rpc_method_wrappers * Uncomment sendTransaction, signTransaction, and call * ✨ Add skeleton for the web3-eth-personal * 🎨 Add initial structure * 🎨 Update web3-eth packageto export utility functions * ✨ Add eth-personal api implementation * ✅ Add unit tests for web3-eth-personal * Apply suggestions from code review Co-authored-by: Junaid <86780488+jdevcs@users.noreply.github.com> * 🎨 Update the code as per feebdack Co-authored-by: Wyatt Barnes <me@wyatt.email> Co-authored-by: jdevcs <86780488+jdevcs@users.noreply.github.com>
1 parent 30b8672 commit 39f8fd5

30 files changed

+2718
-254
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dist
2+
jest.config.js
3+
.eslintrc.js
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = {
2+
extends: '../../.eslintrc.js',
3+
parserOptions: {
4+
project: './tsconfig.json',
5+
tsconfigRootDir: __dirname,
6+
},
7+
};

packages/web3-eth-personal/.gitignore

Whitespace-only changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.babelrc
2+
.eslintignore
3+
.eslintrc.json
4+
.eslintrc.js
5+
.gitignore
6+
.lintstagedrc.json
7+
.nycrc
8+
.prettierrc.json
9+
.prettierignore
10+
cypress.json
11+
index.html
12+
Jenkinsfile*
13+
*.log
14+
15+
.nyc_output/
16+
coverage/
17+
benchmark/
18+
.coverage/
19+
cypress/
20+
fixtures/
21+
tmp/
22+
logs/
23+
test/
24+
scripts/
25+
browsertest/
26+
examples/

packages/web3-eth-personal/.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
message = ":arrow_up: Version %s"
2+
save-exact = false
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Files
2+
LICENSE
3+
.gitkeep
4+
mocha.opts
5+
.DS_Store
6+
REVISION
7+
8+
# rc files
9+
.*rc
10+
## ignore files
11+
.*ignore
12+
13+
# Ignore extensions
14+
*.png
15+
*.jpg
16+
*.svg
17+
*.ai
18+
*.sql
19+
*.sh
20+
*.html
21+
*.info
22+
*.xml
23+
*.log
24+
*.proto
25+
*.csv
26+
*.cmd
27+
*.tsbuildinfo
28+
29+
## jest snapshot
30+
*.snap
31+
32+
# project specific paths
33+
coverage/
34+
dist/
35+
tmp/
36+
browsertest.build/
37+
.coverage
38+
.coverage-unit
39+
# Eth2 specs
40+
*.yaml
41+
*.yml
42+
.tool-versions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 100,
3+
"singleQuote": true,
4+
"trailingComma": "all",
5+
"useTabs": true,
6+
"arrowParens": "avoid"
7+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
<!-- EXAMPLE
9+
10+
## [1.0.0]
11+
12+
### Added
13+
14+
- I've added feature XY (#1000)
15+
16+
### Changed
17+
18+
- I've cleaned up XY (#1000)
19+
20+
### Deprecated
21+
22+
- I've deprecated XY (#1000)
23+
24+
### Removed
25+
26+
- I've removed XY (#1000)
27+
28+
### Fixed
29+
30+
- I've fixed XY (#1000)
31+
32+
### Security
33+
34+
- I've improved the security in XY (#1000)
35+
36+
-->
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<p align="center">
2+
<img src="assets/logo/web3js.jpg" width="500" alt="web3.js" />
3+
</p>
4+
5+
# web3.js - Web3-Eth-Personal
6+
7+
![ES Version](https://img.shields.io/badge/ES-2020-yellow)
8+
![Node Version](https://img.shields.io/badge/node-14.x-green)
9+
[![NPM Package][npm-image]][npm-url]
10+
[![Dependency Status][deps-image]][deps-url]
11+
[![Dev Dependency Status][deps-dev-image]][deps-dev-url]
12+
13+
This is a sub-package of [web3.js][repo].
14+
15+
`web3-eth-personal` Web3 module to interact with the Ethereum blockchain accounts stored in the node.
16+
17+
###### Get it from the NPM Registry
18+
19+
```bash
20+
yarn add web3-eth-personal
21+
```
22+
23+
## Getting Started
24+
25+
- :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)
26+
![Discord](https://img.shields.io/discord/593655374469660673.svg?label=Discord&logo=discord)
27+
28+
## Prerequisites
29+
30+
- :gear: [NodeJS](https://nodejs.org/) (LTS/Fermium)
31+
- :toolbox: [Yarn](https://yarnpkg.com/)/[Lerna](https://lerna.js.org/)
32+
33+
## Package.json Scripts
34+
35+
| Script | Description |
36+
| ---------------- | -------------------------------------------------- |
37+
| clean | Uses `rimraf` to remove `dist/` |
38+
| build | Uses `tsc` to build package and dependent packages |
39+
| lint | Uses `eslint` to lint package |
40+
| lint:fix | Uses `eslint` to check and fix any warnings |
41+
| format | Uses `prettier` to format the code |
42+
| test | Uses `jest` to run unit tests |
43+
| test:integration | Uses `jest` to run tests under `/test/integration` |
44+
| test:unit | Uses `jest` to run tests under `/test/unit` |
45+
46+
[docs]: http://web3js.readthedocs.io/en/4.0/
47+
[repo]: https://github.com/ethereum/web3.js
48+
[npm-image]: https://img.shields.io/npm/v/web3-eth-personal.svg
49+
[npm-url]: https://npmjs.org/packages/web3-eth-personal
50+
[deps-image]: https://david-dm.org/ethereum/web3.js/4.x/status.svg?path=tools/web3-eth-personal
51+
[deps-url]: https://david-dm.org/ethereum/web3.js/4.x?path=tools/web3-eth-personal
52+
[deps-dev-image]: https://david-dm.org/ethereum/web3.js/4.x/dev-status.svg?path=tools/web3-eth-personal
53+
[deps-dev-url]: https://david-dm.org/ethereum/web3.js/4.x?type=dev&path=tools/web3-eth-personal

packages/web3-eth-personal/assets/logo/web3js.ai

Lines changed: 1516 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)