diff --git a/CHANGELOG.md b/CHANGELOG.md index c7ca239e669..3f6f0bfb69d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2237,6 +2237,10 @@ If there are any bugs, improvements, optimizations or any new feature proposal f - Interface `MetaMaskProvider` added and is part of `SupportedProviders` (#6534) - `gasPrice` was added to `Transaction1559UnsignedAPI` type. (#6539) +#### web3-eth-accounts + +- Added support for `ETNIP-1 PriorityTransactions` + ### Changed #### web3 diff --git a/docs/docs/guides/advanced/support_additional_rpc_methods/index.md b/docs/docs/guides/advanced/support_additional_rpc_methods/index.md index 7416551603f..c44fdc3eb08 100644 --- a/docs/docs/guides/advanced/support_additional_rpc_methods/index.md +++ b/docs/docs/guides/advanced/support_additional_rpc_methods/index.md @@ -24,7 +24,7 @@ This will give your plugin access to [requestManager](/api/web3-core/class/Web3C :::caution ```ts -import { Web3PluginBase } from 'web3'; +import { Web3PluginBase } from '@etn-sc/web3'; export default class CustomRpcMethodsPlugin extends Web3PluginBase { // step 1 @@ -35,7 +35,7 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase { 2. After that add public `pluginNamespace` property. This will be used to access your plugin, as mentioned in step number 5 code example. ```ts -import { Web3PluginBase } from 'web3'; +import { Web3PluginBase } from '@etn-sc/web3'; export default class CustomRpcMethodsPlugin extends Web3PluginBase { public pluginNamespace = 'customRpcMethods'; // step 2 @@ -45,7 +45,7 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase { 3. Once plugin class is created using above mentioned steps, its very easy to add new RPC methods like: ```ts -import { Web3PluginBase } from 'web3'; +import { Web3PluginBase } from '@etn-sc/web3'; export default class CustomRpcMethodsPlugin extends Web3PluginBase { public pluginNamespace = 'customRpcMethods'; @@ -64,7 +64,7 @@ export default class CustomRpcMethodsPlugin extends Web3PluginBase { 4. Final step is setting up module [augmentation](https://www.typescriptlang.org/docs/handbook/declaration-merging.html#module-augmentation), this will allow you to access plugin on web3 object. ```ts -import { Web3PluginBase } from 'web3'; +import { Web3PluginBase } from '@etn-sc/web3'; export default class CustomRpcMethodsPlugin extends Web3PluginBase { public pluginNamespace = 'customRpcMethods'; @@ -99,8 +99,8 @@ After the plugin is ready, it is recommended to publish it on the NPM registry. Once plugin is registered its custom methods will be available to use. ```ts -import { Web3 } from 'web3'; -import CustomRpcMethodsPlugin from 'web3-plugin-example'; +import { Web3 } from '@etn-sc/web3'; +import CustomRpcMethodsPlugin from '@etn-sc/web3-plugin-example'; const web3 = new Web3('http://127.0.0.1:8545'); web3.registerPlugin(new CustomRpcMethodsPlugin()); // step 5 diff --git a/docs/docs/guides/advanced/web3_tree_shaking_support_guide/index.md b/docs/docs/guides/advanced/web3_tree_shaking_support_guide/index.md index 4df076a42e7..3ed564f5fb5 100644 --- a/docs/docs/guides/advanced/web3_tree_shaking_support_guide/index.md +++ b/docs/docs/guides/advanced/web3_tree_shaking_support_guide/index.md @@ -31,13 +31,13 @@ For further information about `sideEffects` see [webpack docs](https://webpack.j For example, if you need `web.eth`: ```ts -import Web3Eth from 'web3-eth'; +import Web3Eth from '@etn-sc/web3-eth'; ``` If you only need a few functions from `web3-utils`: ```ts -import { numberToHex, hexToNumber } from 'web3-utils'; +import { numberToHex, hexToNumber } from '@etn-sc/web3-utils'; ``` You can find an example app with tree shaking [here](https://github.com/ChainSafe/web3js-example-react-app). diff --git a/docs/docs/guides/basics/eth.md b/docs/docs/guides/basics/eth.md index 51d38c67bb9..ce525893dd2 100644 --- a/docs/docs/guides/basics/eth.md +++ b/docs/docs/guides/basics/eth.md @@ -65,7 +65,7 @@ Note that we are installing the latest version of 4.x, at the time of this tutor Next, create a new file called `index.ts` in your project directory and add the following code to it: ```javascript -const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`) +const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from '@etn-sc/web3'`) // Set up a connection to the Ganache network const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545')); @@ -99,7 +99,7 @@ In the first example, we are going to send a simple value transaction. Create a file named `transaction.ts` and fill it with the following code: ```typescript -const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`) +const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from '@etn-sc/web3'`) const fs = require('fs'); const path = require('path'); @@ -202,7 +202,7 @@ transactionHash { In the next example, we are going to use `estimateGas` function to see the expected gas for contract deployment. (For more on contracts, please see the corresponding tutotial). Create a file named `estimate.ts` and fill it with the following code: ```typescript -import Web3, { ETH_DATA_FORMAT, DEFAULT_RETURN_FORMAT } from 'web3'; +import Web3, { ETH_DATA_FORMAT, DEFAULT_RETURN_FORMAT } from '@etn-sc/web3'; async function estimate() { // abi of our contract @@ -284,7 +284,7 @@ If everything is working correctly, you should see something like the following: In the next example we are going to sign a transaction and use `sendSignedTransaction` to send the signed transaction. Create a file named `sendSigned.ts` and fill it with the following code: ```typescript -import Web3 from 'web3'; +import Web3 from '@etn-sc/web3'; const web3 = new Web3('http://localhost:7545'); //make sure to copy the private key from ganache diff --git a/docs/docs/guides/basics/sign_and_send_tx/local_wallet.md b/docs/docs/guides/basics/sign_and_send_tx/local_wallet.md index 4637f539b67..d5c891e3a59 100644 --- a/docs/docs/guides/basics/sign_and_send_tx/local_wallet.md +++ b/docs/docs/guides/basics/sign_and_send_tx/local_wallet.md @@ -11,7 +11,7 @@ The simplest way to sign and send transactions is using a local wallet: ```ts // First step: initialize `web3` instance -import Web3 from 'web3'; +import Web3 from '@etn-sc/web3'; const web3 = new Web3(/* PROVIDER*/); // Second step: add an account to wallet @@ -45,7 +45,7 @@ List of references: ```ts // First step: initialize `web3` instance -import Web3 from 'web3'; +import Web3 from '@etn-sc/web3'; const web3 = new Web3(/* PROVIDER*/); // Second step: add an account to wallet diff --git a/docs/docs/guides/basics/sign_and_send_tx/wallet_of_eth_node.md b/docs/docs/guides/basics/sign_and_send_tx/wallet_of_eth_node.md index f53d412a11e..f6b8ad630c2 100644 --- a/docs/docs/guides/basics/sign_and_send_tx/wallet_of_eth_node.md +++ b/docs/docs/guides/basics/sign_and_send_tx/wallet_of_eth_node.md @@ -11,7 +11,7 @@ If Ethereum node has unlocked account in its wallet you can send transaction wit ```ts // First step: initialize web3 instance -import Web3 from 'web3'; +import Web3 from '@etn-sc/web3'; const web3 = new Web3(/* PROVIDER*/); // Second step: add an account to the Ethereum node and unlock it @@ -54,7 +54,7 @@ List of references: ```ts // First step: initialize web3 instance -import Web3 from 'web3'; +import Web3 from '@etn-sc/web3'; const web3 = new Web3(/* PROVIDER*/); // Second step: add an account to the Ethereum node and unlock it diff --git a/docs/docs/guides/smart_contracts/deploying_and_interacting_with_smart_contracts.md b/docs/docs/guides/smart_contracts/deploying_and_interacting_with_smart_contracts.md index f6c1353cd37..e1f81e18da4 100644 --- a/docs/docs/guides/smart_contracts/deploying_and_interacting_with_smart_contracts.md +++ b/docs/docs/guides/smart_contracts/deploying_and_interacting_with_smart_contracts.md @@ -179,7 +179,7 @@ Note that we are installing the latest version of 4.x, at the time of this tutor Next, create a new file called `index.js` in your project directory and add the following code to it: ```javascript -const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`) +const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from '@etn-sc/web3'`) // Set up a connection to the Ganache network const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:7545')); @@ -214,7 +214,7 @@ Create a file named `deploy.js` and fill it with the following code: ```javascript // For simplicity we use `web3` package here. However, if you are concerned with the size, // you may import individual packages like 'web3-eth', 'web3-eth-contract' and 'web3-providers-http'. -const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`) +const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from '@etn-sc/web3'`) const fs = require('fs'); const path = require('path'); @@ -289,7 +289,7 @@ In this step, we will use web3.js to interact with the smart contract on the Gan Create a file named `interact.js` and fill it with the following code: ```javascript -const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from 'web3'`) +const { Web3 } = require('web3'); // web3.js has native ESM builds and (`import Web3 from '@etn-sc/web3'`) const fs = require('fs'); const path = require('path'); @@ -369,7 +369,7 @@ Here are examples: ```typescript // Configuring Web3Context with `contractDataInputFill` -import { Web3Context } from 'web3-core'; +import { Web3Context } from '@etn-sc/web3-core'; const expectedProvider = 'http://127.0.0.1:8545'; const web3Context = new Web3Context({ diff --git a/docs/docs/guides/smart_contracts/infer_contract_types_guide/index.md b/docs/docs/guides/smart_contracts/infer_contract_types_guide/index.md index c6051b7bd41..52afef52827 100644 --- a/docs/docs/guides/smart_contracts/infer_contract_types_guide/index.md +++ b/docs/docs/guides/smart_contracts/infer_contract_types_guide/index.md @@ -11,7 +11,7 @@ Before we dive into the problem, let's take a quick look at the problem. Web3.js Web3.js uses ABI type to dynamically load available methods and events but Typescript currently [doesn't support loading JSON as const](https://github.com/microsoft/TypeScript/issues/32063). If you go to the [Playground Link](https://www.typescriptlang.org/play?#code/MYewdgzgLgBAhgIwJYwLwwNoCga5gbxz1wCIkwAHAVyghIC5MjjdCWWywoBTAJzDgAbACoBPCtwYwS0XuQDmJADTN20gQFtJjEpu4B9ZavYko47dNkKSxvAF8VagreKce-IWIlSZUOWEVHJ3U4LR8IUQ0EEEFDIKdTc3C-axcYO1sAXXi8XzgeAFkaRCRBJDMfMHAKOFFEQUkc0jNvHVBIPypgKBBeG2IHVTYOOCqwSJAqOkYAMyEIbibpcmpaKWwnYYTyABNuAA9uHalOxbTScncBESSdOB2d3m4IOiXXPR8QAHcwPiNg6QtCwke6PZ50NKDTbnZZgPaHY6MU5vXKXPjXLzA0FPF7-YK6ULAiASOF-FHNW7SbHg-pqKFqLZqTjwo5SOaCBbk2FXTyUkhUS4AJgArAA2PEJD46ABuQiojRhiVa0gFXBF4shWSWBLCOgAghQKLwQLLBBLckCfNxpdwuLTcPTWLYQWMJlM2fMziYVjRpkxoQDmQdWUjePKuW50bzlSCHjjXoqpdIZsaNOaTJa7nGaZCUYzvaSEScw178WiPDcY9TcRGk6YQOmOJmqdncbm0vm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XsH7aq7Do7ENnrZeybV4K4NWuwVcAserAmZpAPcnsODD2vFgthk9NYgCvvg9WvDpBl1IQo8hbEoa13-g3E2ZtgF73btbQRECgJQM0awyBIi6r8K4SQFMIA0xGNjOTP8Qi87Ow4T4gxOgeiEOCfwimithE6PInTaJVI7KtTiUHL+Z8bLKN3HwAAYqmbOt8PGuK8aFPRZpfFxJMXI9aEMKGWL-ntdQmUm52LoQ40BTiHREEyPACAMB2jQAANxAA) and choose ".d.ts" you can check type difference with and without `as const`. ```typescript -import { Contract, Web3 } from 'web3'; +import { Contract, Web3 } from '@etn-sc/web3'; import ERC20 from './node_modules/@openzeppelin/contracts/build/contracts/ERC20.json'; (async function () { @@ -100,7 +100,7 @@ and run the script with `node -r ts-node/register