diff --git a/packages/snfoundry/scripts_js/deploy.js b/packages/snfoundry/scripts_js/deploy.js index b0b1beb8..384be09f 100644 --- a/packages/snfoundry/scripts_js/deploy.js +++ b/packages/snfoundry/scripts_js/deploy.js @@ -1,13 +1,4 @@ -const fs = require("fs"); -const path = require("path"); -const networks = require("./helpers/networks"); -const argv = require("yargs/yargs")(process.argv.slice(2)).argv; - -const { TransactionStatus } = require("starknet"); -const { hash } = require("starknet"); - -const { CallData } = require("starknet-dev"); -const deployContract = require("./deploy_contract"); +const { deployContract } = require("./deploy_contract"); const deployScript = async () => { // const { @@ -27,7 +18,7 @@ const deployScript = async () => { owner: "0x4b3f4ba8c00a02b66142a4b1dd41a4dfab4f92650922a3280977b0f03c75ee1", }, // last account in devnet accounts - "Challenge0", + "Challenge0" ); // await deployContract( diff --git a/packages/snfoundry/scripts_js/deploy_contract.js b/packages/snfoundry/scripts_js/deploy_contract.js index b6ec06e2..691c50e3 100644 --- a/packages/snfoundry/scripts_js/deploy_contract.js +++ b/packages/snfoundry/scripts_js/deploy_contract.js @@ -1,10 +1,13 @@ const fs = require("fs"); const path = require("path"); const networks = require("./helpers/networks"); -const {hash, CallData, TransactionStatus} = require("starknet"); +const argv = require("yargs/yargs")(process.argv.slice(2)).argv; +const { hash, TransactionStatus } = require("starknet"); +const { CallData } = require("starknet-dev"); + const networkName = argv.network; -const {provider, deployer} = networks[networkName]; +const { provider, deployer } = networks[networkName]; const deployContract = async ( constructorArgs, contractName, @@ -48,7 +51,7 @@ const deployContract = async ( let totalFee = 0n; try { - const {suggestedMaxFee: estimatedFeeDeclare} = + const { suggestedMaxFee: estimatedFeeDeclare } = await deployer.estimateDeclareFee( { contract: compiledContractSierra, @@ -58,7 +61,7 @@ const deployContract = async ( ); totalFee = estimatedFeeDeclare * 2n; } catch (e) { - const {suggestedMaxFee: estimatedFeeDeploy} = + const { suggestedMaxFee: estimatedFeeDeploy } = await deployer.estimateDeployFee({ classHash: precomputedClassHash, constructorCalldata, @@ -118,4 +121,6 @@ const deployContract = async ( }; }; -export default deployContract \ No newline at end of file +module.exports = { + deployContract, +};