From 71a0fa1064f0be8ebeb51cf71d411e8cfe780d1b Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Mon, 19 Dec 2022 13:36:27 -0800 Subject: [PATCH 01/10] fix logic for which sections are open --- src/components/UI/docs/DocsLinks.tsx | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index b3c5aa96a9..da4c9dae45 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -1,4 +1,4 @@ -import { FC } from 'react'; +import { FC, useEffect, useState } from 'react'; import { Accordion, AccordionButton, @@ -24,16 +24,33 @@ interface Props { } export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { - const { asPath, query: { slug } } = useRouter(); + const [openSections, setOpenSections] = useState<{ [key: string]: boolean }>({}); + const { + asPath, + query: { slug } + } = useRouter(); + + useEffect(() => { + setOpenSections( + navLinks.reduce( + (acc, navLink) => ({ + ...acc, + [navLink.id]: checkNavLinks({ items: navLink.items, pathCheck: asPath }) + }), + {} + ) + ); + }, [asPath]); // eslint-disable-line react-hooks/exhaustive-deps return ( {navLinks.map(({ id, to, items }, idx) => { const split = to?.split('/'); const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; - const isSectionActive = checkNavLinks({ to, items, pathCheck: asPath.split('#')[0] }) - + const handleToggle = () => { + setOpenSections(prev => ({ ...prev, [id]: !prev[id] })); + }; return ( - + {({ isExpanded }) => ( <> @@ -45,6 +62,7 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { placeContent='flex-end' bg='button-bg' data-group + onClick={handleToggle} > Date: Mon, 19 Dec 2022 15:13:35 -0800 Subject: [PATCH 02/10] fix dependency array --- src/components/UI/docs/DocsLinks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index da4c9dae45..f743850bcb 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -40,7 +40,7 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { {} ) ); - }, [asPath]); // eslint-disable-line react-hooks/exhaustive-deps + }, [asPath, navLinks]); return ( {navLinks.map(({ id, to, items }, idx) => { From e335da5391501347cd011cfd43761f1d47082b9c Mon Sep 17 00:00:00 2001 From: Paul Wackerow <54227730+wackerow@users.noreply.github.com> Date: Mon, 19 Dec 2022 15:17:17 -0800 Subject: [PATCH 03/10] move toggle handler to base component --- src/components/UI/docs/DocsLinks.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index f743850bcb..014291746b 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -41,14 +41,16 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { ) ); }, [asPath, navLinks]); + + const handleSectionToggle = (id: string): void => { + setOpenSections(prev => ({ ...prev, [id]: !prev[id] })); + }; + return ( {navLinks.map(({ id, to, items }, idx) => { const split = to?.split('/'); const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; - const handleToggle = () => { - setOpenSections(prev => ({ ...prev, [id]: !prev[id] })); - }; return ( @@ -62,7 +64,7 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { placeContent='flex-end' bg='button-bg' data-group - onClick={handleToggle} + onClick={() => handleSectionToggle(id)} > Date: Mon, 19 Dec 2022 22:38:28 -0300 Subject: [PATCH 04/10] fix: /docs/tools/clef/introduction link --- docs/interacting-with-geth/rpc/ns-personal-deprecation.md | 2 +- docs/interacting-with-geth/rpc/ns-personal.md | 2 +- docs/tools/clef/clique-signing.md | 2 +- docs/tools/clef/tutorial.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/interacting-with-geth/rpc/ns-personal-deprecation.md b/docs/interacting-with-geth/rpc/ns-personal-deprecation.md index e06845290c..2b2f19ef9b 100644 --- a/docs/interacting-with-geth/rpc/ns-personal-deprecation.md +++ b/docs/interacting-with-geth/rpc/ns-personal-deprecation.md @@ -3,7 +3,7 @@ title: Personal namespace deprecation notes description: Alternatives to the methods in the deprecated personal namespace --- -The JSON-RPC API's `personal` namespace has historically been used to manage accounts and sign transactions and data over RPC. However, it is being deprecated in favour of using [Clef](/docs/tools/clef/Introduction) as an external signer and account manager. One of the major changes is moving away from indiscriminate locking and unlocking of accounts and instead using Clef to explicitly approve or deny specific actions. This page shows the suggested replacement for each method in `personal`. +The JSON-RPC API's `personal` namespace has historically been used to manage accounts and sign transactions and data over RPC. However, it is being deprecated in favour of using [Clef](/docs/tools/clef/introduction) as an external signer and account manager. One of the major changes is moving away from indiscriminate locking and unlocking of accounts and instead using Clef to explicitly approve or deny specific actions. This page shows the suggested replacement for each method in `personal`. ## Methods without replacements diff --git a/docs/interacting-with-geth/rpc/ns-personal.md b/docs/interacting-with-geth/rpc/ns-personal.md index 96edd43bb0..b3abf12813 100644 --- a/docs/interacting-with-geth/rpc/ns-personal.md +++ b/docs/interacting-with-geth/rpc/ns-personal.md @@ -5,7 +5,7 @@ description: Documentation for the JSON-RPC API "personal" namespace The personal namespace will be deprecated in the very near future. -The personal API managed private keys in the key store. It is deprecated in favour of using [Clef](/docs/tools/clef/Introduction) for interacting with accounts Please refer to the [ns_personal deprecation page](/docs/interacting-with-geth/rpc/ns-personal-deprecation) to see the equivalent methods. The following documentation should be treated as archive information and users should migrate tousing Clef for account interactions. +The personal API managed private keys in the key store. It is deprecated in favour of using [Clef](/docs/tools/clef/introduction) for interacting with accounts Please refer to the [ns_personal deprecation page](/docs/interacting-with-geth/rpc/ns-personal-deprecation) to see the equivalent methods. The following documentation should be treated as archive information and users should migrate tousing Clef for account interactions. ## personal_deriveAccount {#personal-deriveaccount} diff --git a/docs/tools/clef/clique-signing.md b/docs/tools/clef/clique-signing.md index b47334634d..21f773cc05 100644 --- a/docs/tools/clef/clique-signing.md +++ b/docs/tools/clef/clique-signing.md @@ -11,7 +11,7 @@ Clef provides a way to safely circumvent `--unlock` while maintaining a enough a ## Prerequisites {#prerequisites} -It is useful to have basic knowledge of private networks and Clef. These topics are covered on our [private networks](/docs/developers/geth-developer/private-network) and [Introduction to Clef](/docs/tools/Clef/introduction) pages. +It is useful to have basic knowledge of private networks and Clef. These topics are covered on our [private networks](/docs/developers/geth-developer/private-network) and [Introduction to Clef](/docs/tools/clef/introduction) pages. ## Prepping a Clique network {#prepping-clique-network} diff --git a/docs/tools/clef/tutorial.md b/docs/tools/clef/tutorial.md index fed28f966f..4c97d1d4b6 100644 --- a/docs/tools/clef/tutorial.md +++ b/docs/tools/clef/tutorial.md @@ -573,5 +573,5 @@ Ultimately, the goal is to deprecate Geth's account management tools completely ## Summary {#summary} -This page includes step-by-step instructions for basic and intermediate uses of Clef, including using it as a standalone app and a backend signer for Geth. Further information is available on our other Clef pages, including [Introduction](/docs/clef/introduction), [Setup](/docs/tools/clef/setup), +This page includes step-by-step instructions for basic and intermediate uses of Clef, including using it as a standalone app and a backend signer for Geth. Further information is available on our other Clef pages, including [Introduction](/docs/tools/clef/introduction), [Setup](/docs/tools/clef/setup), [Rules](/docs/tools/clef/rules), [Communication Datatypes](/docs/clef/datatypes) and [Communication APIs](/docs/tools/clef/apis). Also see the [Clef GitHub](https://github.com/ethereum/go-ethereum/tree/master/cmd/clef) for further reading. From df653f20e93ffdc0d1c6358d08921189e46fe024 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Quiroz?= Date: Mon, 19 Dec 2022 22:38:54 -0300 Subject: [PATCH 05/10] chore: prettier --- src/components/UI/docs/Breadcrumbs.tsx | 2 +- src/theme/search.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/UI/docs/Breadcrumbs.tsx b/src/components/UI/docs/Breadcrumbs.tsx index d98f7321d8..dde19c28d9 100644 --- a/src/components/UI/docs/Breadcrumbs.tsx +++ b/src/components/UI/docs/Breadcrumbs.tsx @@ -11,7 +11,7 @@ export const Breadcrumbs: FC = () => { return ( <> - {router.asPath !== '/docs' && pathSplit.length > 1? ( + {router.asPath !== '/docs' && pathSplit.length > 1 ? ( {pathSplit.map((path: string, idx: number) => { return ( diff --git a/src/theme/search.css b/src/theme/search.css index a169533fcf..39a4245f36 100644 --- a/src/theme/search.css +++ b/src/theme/search.css @@ -149,7 +149,7 @@ svg[aria-label='Algolia'] * { .DocSearch-Button-Container { flex-direction: row-reverse; } - + .DocSearch-Button { padding: 2rem 1rem; width: 100%; From 5f8fc1c2e195ab7e3a62b42383cb59d3636e550c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Quiroz?= Date: Mon, 19 Dec 2022 22:39:51 -0300 Subject: [PATCH 06/10] chore: extract to variable --- src/components/UI/docs/DocsLinks.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index 014291746b..808c6e23b1 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -51,8 +51,10 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { {navLinks.map(({ id, to, items }, idx) => { const split = to?.split('/'); const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; + const isSectionActive = openSections[id]; + return ( - + {({ isExpanded }) => ( <> From aaf7da24c5a57c08b35746f833253a021e900a25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Quiroz?= Date: Mon, 19 Dec 2022 22:43:32 -0300 Subject: [PATCH 07/10] fix: Clef links --- docs/getting-started/index.md | 4 ++-- docs/tools/clef/Introduction.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/getting-started/index.md b/docs/getting-started/index.md index 0b77ad40f0..e54ec122ef 100644 --- a/docs/getting-started/index.md +++ b/docs/getting-started/index.md @@ -7,7 +7,7 @@ This page explains how to set up Geth and execute some basic tasks using the com Geth also needs to be connected to a [consensus client](docs/getting-started/consensus-clients) in order to function as an Ethereum node. The tutorial on this page assumes Geth and a consensus client have been installed successfully and that a firewall has been configured to block external traffic to the JSON-RPC port `8545` see [Security](/docs/fundamentals/security). -This page provides step-by-step instructions covering the fundamentals of using Geth. This includes generating accounts, joining an Ethereum network, syncing the blockchain and sending ether between accounts. This tutorial uses [Clef](/docs/tools/Clef/Tutorial). Clef is an account management tool external to Geth itself that allows users to sign transactions. It is developed and maintained by the Geth team. +This page provides step-by-step instructions covering the fundamentals of using Geth. This includes generating accounts, joining an Ethereum network, syncing the blockchain and sending ether between accounts. This tutorial uses [Clef](/docs/tools/clef/tutorial). Clef is an account management tool external to Geth itself that allows users to sign transactions. It is developed and maintained by the Geth team. ## Prerequisites {#prerequisites} @@ -431,4 +431,4 @@ This requires approval in Clef. Once the password for the sender account has bee ## Summary {#summary} -This tutorial has demonstrated how to generate accounts using Clef, fund them with testnet ether and use those accounts to interact with Ethereum (Sepolia) through a Geth node. Checking account balances, sending transactions and retrieving transaction details were explained using the web3.js library via the Geth console and using the JSON-RPC directly using Curl. For more detailed information about Clef, please see [the Clef docs](/docs/tools/Clef/Tutorial). +This tutorial has demonstrated how to generate accounts using Clef, fund them with testnet ether and use those accounts to interact with Ethereum (Sepolia) through a Geth node. Checking account balances, sending transactions and retrieving transaction details were explained using the web3.js library via the Geth console and using the JSON-RPC directly using Curl. For more detailed information about Clef, please see [the Clef docs](/docs/tools/clef/tutorial). diff --git a/docs/tools/clef/Introduction.md b/docs/tools/clef/Introduction.md index aadce048e1..7774d96eb5 100644 --- a/docs/tools/clef/Introduction.md +++ b/docs/tools/clef/Introduction.md @@ -76,7 +76,7 @@ The general flow for a basic transaction-signing operation using Clef and an Eth In the case illustrated in the schematic above, Geth would be started with `--signer :` and would relay requests to `eth.sendTransaction`. Text in `mono` font positioned along arrows shows the objects passed between each component. -Most users use Clef by manually approving transactions through the UI as in the schematic above, but it is also possible to configure Clef to sign transactions without always prompting the user. This requires defining the precise conditions under which a transaction will be signed. These conditions are known as `Rules` and they are small Javascript snippets that are _attested_ by the user by injecting the snippet's hash into Clef's secure whitelist. Clef is then started with the rule file, so that requests that satisfy the conditions in the whitelisted rule files are automatically signed. This is covered in detail on the [Rules page](/docs/tools/Clef/rules). +Most users use Clef by manually approving transactions through the UI as in the schematic above, but it is also possible to configure Clef to sign transactions without always prompting the user. This requires defining the precise conditions under which a transaction will be signed. These conditions are known as `Rules` and they are small Javascript snippets that are _attested_ by the user by injecting the snippet's hash into Clef's secure whitelist. Clef is then started with the rule file, so that requests that satisfy the conditions in the whitelisted rule files are automatically signed. This is covered in detail on the [Rules page](/docs/tools/clef/rules). ## Basic usage {#basic-usage} @@ -107,7 +107,7 @@ Enter 'ok' to proceed: Requests requiring account access or signing now require explicit consent in this terminal. Activities such as sending transactions via a local Geth node's attached Javascript console or RPC will now hang indefinitely, awaiting approval in this terminal. -A much more detailed Clef tutorial is available on the [Tutorial page](/docs/tools/Clef/tutorial). +A much more detailed Clef tutorial is available on the [Tutorial page](/docs/tools/clef/tutorial). ## Command line options {#command-line-options} From 5973cf8cd52e402ab34e9943c9cff80f1d5a7b82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Quiroz?= Date: Mon, 19 Dec 2022 22:45:31 -0300 Subject: [PATCH 08/10] fix: rename docs/tools/clef/introduction file --- docs/tools/clef/{Introduction.md => introduction.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename docs/tools/clef/{Introduction.md => introduction.md} (100%) diff --git a/docs/tools/clef/Introduction.md b/docs/tools/clef/introduction.md similarity index 100% rename from docs/tools/clef/Introduction.md rename to docs/tools/clef/introduction.md From d3e53af95fc7bf94b50e8e5cf8269f444a087cd7 Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Mon, 19 Dec 2022 22:43:30 -0700 Subject: [PATCH 09/10] Update src/components/UI/docs/DocsLinks.tsx Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com> --- src/components/UI/docs/DocsLinks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index 808c6e23b1..2c467bd486 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -51,7 +51,7 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { {navLinks.map(({ id, to, items }, idx) => { const split = to?.split('/'); const isActive = slug && split && split[split.length - 1] === slug[slug.length - 1]; - const isSectionActive = openSections[id]; + const index = openSections[id] ? 0 : -1; return ( From 5a545a222ad3c761d9b5ffe07a91ede7f0f4783d Mon Sep 17 00:00:00 2001 From: Corwin Smith Date: Mon, 19 Dec 2022 22:43:34 -0700 Subject: [PATCH 10/10] Update src/components/UI/docs/DocsLinks.tsx Co-authored-by: Paul Wackerow <54227730+wackerow@users.noreply.github.com> --- src/components/UI/docs/DocsLinks.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/UI/docs/DocsLinks.tsx b/src/components/UI/docs/DocsLinks.tsx index 2c467bd486..d76a814cbb 100644 --- a/src/components/UI/docs/DocsLinks.tsx +++ b/src/components/UI/docs/DocsLinks.tsx @@ -54,7 +54,7 @@ export const DocsLinks: FC = ({ navLinks, toggleMobileAccordion }) => { const index = openSections[id] ? 0 : -1; return ( - + {({ isExpanded }) => ( <>