feat(@embark/pipeline): add minimalContractSize to remove bytecode

This commit is contained in:
Jonathan Rainville 2019-07-11 16:09:52 -04:00
parent 9e74d32f5f
commit b0cccaea05
4 changed files with 17 additions and 0 deletions

View File

@ -51,6 +51,9 @@ module.exports = {
// contracts section.
//strategy: 'implicit',
// minimalContractSize, when set to true, tells Embark to generate contract files without the heavy bytecodes
// minimalContractSize: false,
contracts: {
// example:
//SimpleStorage: {

View File

@ -51,6 +51,9 @@ module.exports = {
// contracts section.
//strategy: 'implicit',
// minimalContractSize, when set to true, tells Embark to generate contract files without the heavy bytecodes
// minimalContractSize: false,
contracts: {
SimpleStorage: {
fromIndex: 0,

View File

@ -51,6 +51,9 @@ module.exports = {
// contracts section.
//strategy: 'implicit',
// minimalContractSize, when set to true, tells Embark to generate contract files without the heavy bytecodes
// minimalContractSize: false,
contracts: {
// example:
//SimpleStorage: {

View File

@ -341,6 +341,14 @@ class Pipeline {
},
function writeContractsJSON(contracts, next) {
async.each(contracts, (contract, eachCb) => {
if (self.embark.config.contractsConfig.minimalContractSize) {
contract = Object.assign({}, contract);
delete contract.code;
delete contract.runtimeBytecode;
delete contract.realRuntimeBytecode;
delete contract.gasEstimates;
delete contract.swarmHash;
}
self.fs.writeJson(dappPath(
self.buildDir,
'contracts', contract.className + '.json'