From 2f33e44220ecac81465c83ee94ff2f28cd8c9936 Mon Sep 17 00:00:00 2001 From: Jason-W123 <147362502+Jason-W123@users.noreply.github.com> Date: Thu, 12 Sep 2024 15:06:20 +0800 Subject: [PATCH] refactor: use getValidators method in set validators example (#185) --- examples/set-new-validators/index.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/examples/set-new-validators/index.ts b/examples/set-new-validators/index.ts index d8858e7b..d26f38b7 100644 --- a/examples/set-new-validators/index.ts +++ b/examples/set-new-validators/index.ts @@ -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'; @@ -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({