Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add importPath option for deploy function #344

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
} from '../types';
import {PartialExtension} from './internal/types';
import {UnknownSignerError} from './errors';
import {mergeABIs, recode} from './utils';
import {mergeABIs, recode, getArtifactFromFolders} from './utils';
import fs from 'fs-extra';

import OpenZeppelinTransparentProxy from '../extendedArtifacts/TransparentUpgradeableProxy.json';
Expand Down Expand Up @@ -495,7 +495,11 @@ export function addHelpers(
if (options.contract) {
if (typeof options.contract === 'string') {
artifactName = options.contract;
artifact = await getArtifact(artifactName);
if (options.importPath) {
artifact = await getArtifactFromFolders(artifactName, [options.importPath]) as Artifact;
} else {
artifact = await getArtifact(artifactName);
}
} else {
artifact = options.contract as Artifact; // TODO better handling
}
Expand Down Expand Up @@ -614,7 +618,7 @@ export function addHelpers(
);
await setupGasPrice(unsignedTx);
await setupNonce(from, unsignedTx);

// Temporary workaround for https://github.com/ethers-io/ethers.js/issues/2078
// TODO: Remove me when LedgerSigner adds proper support for 1559 txns
if (hardwareWallet === 'ledger') {
Expand Down
1 change: 1 addition & 0 deletions types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ export type ArtifactData = {

export interface DeployOptionsBase extends TxOptions {
contract?: string | ArtifactData;
importPath?: string;
args?: any[];
skipIfAlreadyDeployed?: boolean;
linkedData?: any; // JSONable ?
Expand Down