create-web3-dapp-dev
Version:
<p align="center"> <br /> <a href="https://createweb3dapp.alchemy.com"> <img src=".github/images/cw3d-logo.png" width="200" alt=""/></a> <br /> </p>
29 lines • 1.15 kB
JavaScript
import { smartContractInfoToDependenciesDictionary } from "../smartContractInfoToDependenciesDictionary.js";
import { SmartContractStandard } from "./smartContractStandards.js";
export function getSmartContractDependencies(smartContractInfo) {
const libraries = [];
const { standard } = smartContractInfo;
switch (standard) {
case SmartContractStandard.ERC20:
libraries.push(`import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
`);
break;
case SmartContractStandard.ERC721:
libraries.push(`import "@openzeppelin/contracts/token/ERC721/ERC721.sol";`);
break;
default:
return [];
break;
}
for (const [key, value] of Object.entries(smartContractInfo)) {
if (typeof value == "boolean" && value) {
const libraryURL = smartContractInfoToDependenciesDictionary[key][standard]
.libraryURL;
if (libraryURL.length > 0) {
libraries.push(libraryURL);
}
}
}
return libraries;
}
//# sourceMappingURL=getSmartContractDependencies.js.map