diff --git a/docs/docs/guides/glossary/index.md b/docs/docs/glossary/index.md similarity index 100% rename from docs/docs/guides/glossary/index.md rename to docs/docs/glossary/index.md diff --git a/docs/docs/glossary/json_interface.md b/docs/docs/glossary/json_interface.md deleted file mode 100644 index fe6384e060d..00000000000 --- a/docs/docs/glossary/json_interface.md +++ /dev/null @@ -1,89 +0,0 @@ ---- -title: JSON Interface ---- - -The JSON interface is a `JSON` object describing the [Application Binary Interface (ABI)](https://docs.soliditylang.org/en/develop/abi-spec.html) for an Ethereum smart contract. - -Using this JSON interface, web3.js is able to create a JavaScript object representing the smart contract , its methods and events using the `web3.eth.Contract` object. - -### Specification - -#### Functions - -- `type`: `"function"`, `"constructor"` (can be omitted, defaulting to `"function"`; `"fallback"` also possible but not relevant in web3.js); -- `name`: the name of the function (only present for function types); -- `constant`: `true` if function is specified to not modify the blockchain state; -- `payable`: `true` if function accepts ether, defaults to false; -- `stateMutability`: a `string` with one of the following values: `"pure"` (specified to not read blockchain state), `"view"` (same as constant above), `"non-payable"` and `"payable"` (same as payable above); -- `inputs`: an `Array of objects`, each of which contains: - -- `name`: the name of the parameter; - -- `type`: the canonical type of the parameter. -- `outputs`: an `Array of objects`, same as inputs, can be omitted if no outputs exist. - -#### Events - -- `type`: always `"event"` -- `name`: the name of the event; -- `inputs`: an `Array of objects`, each of which contains: - - - `name`: the name of the parameter; - - - `type`: the canonical type of the parameter. - - - `indexed`: `true` if the field is part of the log’s topics, false if it is one of the log’s data segment. - - - `anonymous`: `true` if the event was declared as anonymous. - -#### Example - -```solidity title='Solidity Contract' -pragma solidity ^0.8.4; - -contract Test { - uint256 a; - address d = 0xdCad3a6d3569DF655070DEd06cb7A1b2Ccd1D3AF; - - constructor(uint256 testInt) { - a = testInt; - } - - event Event(uint256 indexed b, bytes32 c); - - event Event2(uint256 indexed b, bytes32 c); - - function foo(uint256 b, bytes32 c) public returns (address) { - emit Event(b, c); - return d; - } -} - -``` - -```json title='Resulting JSON ABI' -[ - { - "type": "constructor", - "stateMutability": "nonpayable", - "inputs": [{"internalType":"uint256","name":"testInt","type":"uint256"}], - }, - { - "type": "event", - "name": "Event", - "inputs": [{"indexed":true,"internalType":"uint256","name":"b","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"c","type":"bytes32"}], - "anonymous": false, - }, - { - "type": "event", - "name": "Event2", - "inputs": [{"indexed":true,"internalType":"uint256","name":"b","type":"uint256"},{"indexed":false,"internalType":"bytes32","name":"c","type":"bytes32"}], - "anonymous": false, - }, - { - "type": "function", - "name": "foo", - "stateMutability": "nonpayable", - "inputs": [{"internalType":"uint256","name":"b","type":"uint256"},{"internalType":"bytes32","name":"c","type":"bytes32"}], - "outputs": [{"internalType":"address","name":"","type":"address"}], - } -] -``` diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index 29c2c66284c..3cf7c9a8443 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -132,7 +132,7 @@ const config = { position: 'left', }, { - to: '/glossary/json_interface', + to: 'glossary', activeBasePath: '/glossary/', label: 'Glossary', position: 'left', diff --git a/packages/web3-eth-contract/src/log_subscription.ts b/packages/web3-eth-contract/src/log_subscription.ts index 6ace1e17478..3cb1a527941 100644 --- a/packages/web3-eth-contract/src/log_subscription.ts +++ b/packages/web3-eth-contract/src/log_subscription.ts @@ -101,7 +101,7 @@ export class LogsSubscription extends Web3Subscription< public readonly topics?: (Topic | Topic[] | null)[]; /** - * The {@doclink glossary/json_interface | JSON Interface} of the event. + * The {@doclink glossary#json-interface-abi | JSON Interface} of the event. */ public readonly abi: AbiEventFragment & { signature: HexString }; diff --git a/packages/web3-types/src/eth_contract_types.ts b/packages/web3-types/src/eth_contract_types.ts index fb34328ce21..00eba77e5ed 100644 --- a/packages/web3-types/src/eth_contract_types.ts +++ b/packages/web3-types/src/eth_contract_types.ts @@ -114,7 +114,7 @@ export interface ContractOptions { readonly data?: Bytes; /** - * The {@doclink glossary/json_interface | json interface} object derived from the [ABI](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) of this contract. + * The {@doclink glossary#json-interface-abi | json interface} object derived from the [ABI](https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI) of this contract. * * Re-setting this will regenerate the methods and events of the contract instance. *