@openzeppelin/hardhat-upgrades
Version:
[](https://docs.openzeppelin.com/upgrades-plugins/hardhat-upgrades) [](https://www.npmjs.org/package/@openzeppelin/h
15 lines (13 loc) • 507 B
text/typescript
import { Signer } from 'ethers';
import { InitialOwner } from './options.js';
import { UpgradesError } from '@openzeppelin/upgrades-core';
export async function getInitialOwner(opts: InitialOwner, signer?: Signer) {
const result = opts.initialOwner ?? (await signer?.getAddress()) ?? undefined;
if (result === undefined) {
throw new UpgradesError(
'Initial owner must be specified',
() => `Set the initial owner address using the \`initialOwner\` option`,
);
}
return result;
}