import { Deployer , ContractClass , ContractInstance , getTruffleConfig } from './truffle' ; import { ValidationOptions , withValidationDefaults } from '@openzeppelin/upgrades-core' ; export interface Options extends ValidationOptions { deployer ? : Deployer ; constructorArgs ? : unknown [ ] ; } export function withDefaults ( opts = { } ) { return { deployer : opts . deployer ?? defaultDeployer , constructorArgs : opts . constructorArgs ?? [ ] , ... withValidationDefaults ( opts ) , } ; } export interface DeployProxyOptions extends Options { initializer ? : string | false ; } export interface UpgradeOptions extends Options { call ? : { fn : string ; args ? : unknown [ ] ; } | string ; } const defaultDeployer = { get provider ( ) { return getTruffleConfig ( ) . provider ; } , async deploy ( Contract , ... args ) { return Contract . new ( ... args ) ; } , } ;