Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #123 from NethermindEth/fix/artifact-folder-path
Browse files Browse the repository at this point in the history
Files now saved to artifacts folder within current workspace
  • Loading branch information
taco-paco authored Jun 27, 2024
2 parents 4da0ce2 + 7d50f10 commit d9ef1e7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions api/src/handlers/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ pub async fn do_compile(compilation_request: CompilationRequest) -> Result<Json<
// initialize the files
initialize_files(compilation_request.contracts, workspace_path).await?;

// TODO(edwin): change to tokio
let command = Command::new("npx")
.arg("hardhat")
.arg("compile")
Expand Down
7 changes: 4 additions & 3 deletions plugin/src/types/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,16 @@ interface DeployedContract extends Contract {
interface CompilationResult {
status: string
message: string
file_content: SolFile[]
file_content: CompiledArtifact[]
}

interface VerificationResult {
status: string
message: string
}

interface SolFile {
interface CompiledArtifact {
// Is a relative path to a file
file_name: string
file_content: string
is_contract: boolean
Expand Down Expand Up @@ -68,5 +69,5 @@ export type {
DeployedContract,
CompilationResult,
VerificationResult,
SolFile
CompiledArtifact
}
3 changes: 1 addition & 2 deletions plugin/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ const getFileNameFromPath = (path: string): string => path.split('/').pop() ?? '
const getContractNameFromFullName = (fullName: string): string => fullName.split('.')[0]

const artifactFolder = (path: string): string => {
if (path.includes('artifacts')) return path.split('/').slice(0, -1).join('/')
return path.split('/').slice(0, -1).join('/').concat('/artifacts')
return path.concat('/artifacts')
}

const artifactFilename = (ext: '.json' | '.casm', filename: string): string => filename.split('.')[0].concat(ext)
Expand Down

0 comments on commit d9ef1e7

Please sign in to comment.