@openzeppelin/hardhat-upgrades
Version:
[](https://docs.openzeppelin.com/upgrades-plugins/hardhat-upgrades) [](https://www.npmjs.org/package/@openzeppelin/h
36 lines • 1.36 kB
JavaScript
import { getNetwork } from './utils.js';
import { getDeployClient } from './client.js';
export function makeGetDeployApprovalProcess(hre, connection) {
return async function getDeployApprovalProcess() {
return await getApprovalProcess(hre, 'deploy', connection);
};
}
export function makeGetUpgradeApprovalProcess(hre, connection) {
return async function getUpgradeApprovalProcess() {
return await getApprovalProcess(hre, 'upgrade', connection);
};
}
async function getApprovalProcess(hre, kind, connection) {
const client = getDeployClient(hre);
const network = await getNetwork(hre, connection);
let response;
switch (kind) {
case 'deploy':
response = await client.getDeployApprovalProcess(network);
break;
case 'upgrade':
response = await client.getUpgradeApprovalProcess(network);
break;
// default case should be unreachable
}
if (response.network !== network) {
// This should not happen
throw new Error(`Returned an approval process for network ${response.network} which does not match current network ${network}`);
}
return {
approvalProcessId: response.approvalProcessId,
address: response.via,
viaType: response.viaType,
};
}
//# sourceMappingURL=get-approval-process.js.map