Skip to content

Commit

Permalink
refactor: use getValidators method in set validators example (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason-W123 authored Sep 12, 2024
1 parent 15e0ddd commit 2f33e44
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions examples/set-new-validators/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
createRollupFetchTransactionHash,
createRollupPrepareTransactionReceipt,
rollupAdminLogicPublicActions,
// Uncomment it when you want to use getValidators() to get validator status
// getValidators,
} from '@arbitrum/orbit-sdk';
import { sanitizePrivateKey } from '@arbitrum/orbit-sdk/utils';
import { config } from 'dotenv';
Expand Down Expand Up @@ -76,6 +78,17 @@ async function main() {
`Before executing, the address ${newValidators[0]} status in validator list is ${beforeStatus}`,
);

/*
You can also use the following code to check validator status, it will return a list
of whitelist validators.
console.log('Fetching current validator address list in the parent chain...');
const beforeValidatorList = await getValidators(parentChainPublicClient, {
rollup: coreContracts.rollup,
});
console.log(`Before executing, the validator list is ${beforeValidatorList.validators}`);
*/

// prepare set validator transaction request
const setValidatorTransactionRequest =
await parentChainPublicClient.rollupAdminLogicPrepareTransactionRequest({
Expand Down

0 comments on commit 2f33e44

Please sign in to comment.