Skip to content

Commit 2b1c82a

Browse files
authored
chore: fix verification of README code snippets (#7471)
Replacement for #6868 which got a bit stale and had workarounds in it which are no longer required. Closes #6300
1 parent 8be81d6 commit 2b1c82a

File tree

4 files changed

+14
-12
lines changed

4 files changed

+14
-12
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"supertest": "^6.3.3",
7272
"ts-node": "^10.9.2",
7373
"typescript": "^5.4.2",
74-
"typescript-docs-verifier": "^2.5.0",
74+
"typescript-docs-verifier": "^2.5.3",
7575
"vite": "^5.3.4",
7676
"vite-plugin-dts": "^3.9.1",
7777
"vite-plugin-node-polyfills": "^0.22.0",

packages/prover/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A set of tools allowing to verify EL client JSON-RPC calls.
1414
You can use the `@lodestar/prover` in two ways, as a Web3 Provider and as proxy. For prover use case see below example.
1515

1616
```ts
17-
import Web3 from "web3";
17+
import {Web3} from "web3";
1818
import {createVerifiedExecutionProvider, LCTransport} from "@lodestar/prover";
1919

2020
const httpProvider = new Web3.providers.HttpProvider("https://lodestar-sepoliarpc.chainsafe.io");
@@ -38,7 +38,7 @@ In this scenario the actual provider is mutated to handle the RPC requests and v
3838
For some scenarios when you don't want to mutate the provider you can pass an option `mutateProvider` as `false`. In this scenario the object `httpProvider` is not mutated and you get a new object `provider`. This is useful when your provider object does not allow mutation, e.g. Metamask provider accessible through `window.ethereum`. If not provided `mutateProvider` is considered as `true` by default. In coming releases we will switch its default behavior to `false`.
3939

4040
```ts
41-
import Web3 from "web3";
41+
import {Web3} from "web3";
4242
import {createVerifiedExecutionProvider, LCTransport} from "@lodestar/prover";
4343

4444
const httpProvider = new Web3.providers.HttpProvider("https://lodestar-sepoliarpc.chainsafe.io");
@@ -51,7 +51,7 @@ const {provider, proofProvider} = createVerifiedExecutionProvider(httpProvider,
5151
mutateProvider: false,
5252
});
5353

54-
const web3 = new Web3(provider);
54+
const web3 = new Web3(httpProvider);
5555

5656
const address = "0xf97e180c050e5Ab072211Ad2C213Eb5AEE4DF134";
5757
const balance = await web3.eth.getBalance(address, "latest");

packages/types/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,15 @@ import {Epoch, ssz} from "@lodestar/types";
6767
const epoch: Epoch = ssz.Epoch.defaultValue();
6868
```
6969

70-
In some cases, we need interfaces that accept types across all forks, like when the fork is not known ahead of time. SSZ Types typed to these interfaces are also provided under an `allForks` namespace, but keyed by `ForkName`.
70+
In some cases, we need interfaces that accept types across all forks, like when the fork is not known ahead of time. Those are directly available without a namespace and SSZ Types typed to these interfaces can be retrieved by calling `sszTypesFor` with the `ForkName`.
7171

7272
```typescript
73-
import {ForkName} from "@lodestar/params";
74-
import {ssz, BeaconState} from "@lodestar/types";
73+
import {ForkName, ForkPostAltair} from "@lodestar/params";
74+
import {sszTypesFor, BeaconState} from "@lodestar/types";
7575

76-
const state: BeaconState<ForkName.phase0> = ssz.allForks[ForkName.phase0].BeaconState.defaultValue();
76+
const fork = ForkName.altair;
77+
78+
const state: BeaconState<ForkPostAltair> = sszTypesFor(fork).BeaconState.defaultValue();
7779
```
7880

7981
## License

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12410,10 +12410,10 @@ typedarray@^0.0.6:
1241012410
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
1241112411
integrity sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==
1241212412

12413-
typescript-docs-verifier@^2.5.0:
12414-
version "2.5.0"
12415-
resolved "https://registry.yarnpkg.com/typescript-docs-verifier/-/typescript-docs-verifier-2.5.0.tgz#5a39c89b492aca31100b20affd477913daa82f7d"
12416-
integrity sha512-h+1fW9LEJi5Q8fMZxdpVoXjGQohx7CAYTylF5JWmmj6IM0J21HgII1vpLAX/Q5B+jlIg8V7v7sGfwBI7LIG4oA==
12413+
typescript-docs-verifier@^2.5.3:
12414+
version "2.5.3"
12415+
resolved "https://registry.yarnpkg.com/typescript-docs-verifier/-/typescript-docs-verifier-2.5.3.tgz#2fcb393cdae955a2c86bf272008cf6f7fb3d1fbf"
12416+
integrity sha512-fATV69QQZzIQWDGfUzo2USUcUTK0hPqTm7XZuyHf4QOkZUshnkwDk8TEk2IxaIlHxKjbM+5RtyDgxCtKYycjXA==
1241712417
dependencies:
1241812418
chalk "^4.1.2"
1241912419
fs-extra "^10.0.0"

0 commit comments

Comments
 (0)