@hyperlane-xyz/sdk
Version:
The official SDK for the Hyperlane Network
36 lines • 1.71 kB
JavaScript
import { rootLogger } from '@hyperlane-xyz/utils';
import { ExplorerFamily } from '../../metadata/chainMetadataTypes.js';
import { MultiGeneric } from '../../utils/MultiGeneric.js';
import { ContractVerifier } from './ContractVerifier.js';
export class PostDeploymentContractVerifier extends MultiGeneric {
multiProvider;
logger = rootLogger.child({
module: 'PostDeploymentContractVerifier',
});
contractVerifier;
constructor(verificationInputs, multiProvider, apiKeys, buildArtifact, licenseType) {
super(verificationInputs);
this.multiProvider = multiProvider;
this.contractVerifier = new ContractVerifier(multiProvider, apiKeys, buildArtifact, licenseType);
}
verify(targets = this.chains()) {
return Promise.allSettled(targets.map(async (chain) => {
// can check explorer family here to avoid doing these checks for each input in verifier
const { family } = this.multiProvider.getExplorerApi(chain);
if (family === ExplorerFamily.Other) {
this.logger.warn(`Skipping verification for ${chain} due to unsupported explorer family.`);
return;
}
this.logger.debug(`Verifying ${chain}...`);
for (const input of this.get(chain)) {
try {
await this.contractVerifier.verifyContract(chain, input, this.logger);
}
catch (error) {
this.logger.error({ name: input.name, address: input.address }, `Failed to verify contract on ${chain}`, error);
}
}
}));
}
}
//# sourceMappingURL=PostDeploymentContractVerifier.js.map