Skip to content

Commit

Permalink
doc improvement (#6615)
Browse files Browse the repository at this point in the history
* doc comments and checked all code examples

* corrections in acct

* added contracts missing functions

* ens intro

* iban intro

* personal doc

* web3 net docs

* utils doc correction

* utils doc correction

* web3 eth desc

* abi docs

* acct docs formatting

* wallet docs

* utils desc

* doc config

* remove html tag <br/> from comments

---------

Co-authored-by: Muhammad Altabba <[email protected]>
  • Loading branch information
jdevcs and Muhammad-Altabba authored Dec 5, 2023
1 parent cdd99e7 commit b819ee4
Show file tree
Hide file tree
Showing 18 changed files with 470 additions and 82 deletions.
5 changes: 5 additions & 0 deletions packages/web3-eth-abi/src/api/errors_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
*
* @module ABI
*/

import { sha3Raw } from 'web3-utils';
import { AbiError } from 'web3-errors';
import { AbiErrorFragment } from 'web3-types';
Expand Down
5 changes: 5 additions & 0 deletions packages/web3-eth-abi/src/api/events_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
*
* @module ABI
*/

import { sha3Raw } from 'web3-utils';
import { AbiError } from 'web3-errors';
import { AbiEventFragment } from 'web3-types';
Expand Down
4 changes: 4 additions & 0 deletions packages/web3-eth-abi/src/api/functions_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
*
* @module ABI
*/
import { AbiError } from 'web3-errors';
import { sha3Raw } from 'web3-utils';
import { AbiFunctionFragment } from 'web3-types';
Expand Down
5 changes: 5 additions & 0 deletions packages/web3-eth-abi/src/api/logs_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
*
* @module ABI
*/

import { HexString, AbiParameter, DecodedParams } from 'web3-types';
import { decodeParameter, decodeParametersWith } from './parameters_api.js';

Expand Down
6 changes: 6 additions & 0 deletions packages/web3-eth-abi/src/api/parameters_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
*
* @module ABI
*/

import { AbiError } from 'web3-errors';
import { AbiInput, HexString } from 'web3-types';
import { decodeParameters as decodeParametersInternal } from '../coders/decode.js';
Expand Down
46 changes: 45 additions & 1 deletion packages/web3-eth-abi/src/eip_712.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,53 @@ along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* @note This code was taken from: https://github.com/Mrtenz/eip-712/tree/master
* The web3.eth.abi functions let you encode and decode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).
*
* For using Web3 ABI functions, first install Web3 package using `npm i web3` or `yarn add web3`.
* After that, Web3 ABI functions will be available.
* ```ts
* import { Web3 } from 'web3';
*
* const web3 = new Web3();
* const encoded = web3.eth.abi.encodeFunctionSignature({
* name: 'myMethod',
* type: 'function',
* inputs: [{
* type: 'uint256',
* name: 'myNumber'
* },{
* type: 'string',
* name: 'myString'
* }]
* });
*
* ```
*
* For using individual package install `web3-eth-abi` package using `npm i web3-eth-abi` or `yarn add web3-eth-abi` and only import required functions.
* This is more efficient approach for building lightweight applications.
* ```ts
* import { encodeFunctionSignature } from 'web3-eth-abi';
*
* const encoded = encodeFunctionSignature({
* name: 'myMethod',
* type: 'function',
* inputs: [{
* type: 'uint256',
* name: 'myNumber'
* },{
* type: 'string',
* name: 'myString'
* }]
* });
*
* ```
*
* @module ABI
*/


// This code was taken from: https://github.com/Mrtenz/eip-712/tree/master

import { Eip712TypedData } from 'web3-types';
import { isNullish, keccak256 } from 'web3-utils';
import { encodeParameters } from './coders/encode.js';
Expand Down
3 changes: 0 additions & 3 deletions packages/web3-eth-abi/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see <http://www.gnu.org/licenses/>.
*/

/**
* The web3.eth.abi functions let you encode and decode parameters to ABI (Application Binary Interface) for function calls to the EVM (Ethereum Virtual Machine).
*/
export * from './api/errors_api.js';
export * from './api/events_api.js';
export * from './api/functions_api.js';
Expand Down
Loading

0 comments on commit b819ee4

Please sign in to comment.