This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename truffle-workflow-compile to @truffle/workflow-compile
- Loading branch information
1 parent
a5b121e
commit d867f6f
Showing
30 changed files
with
50 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,64 @@ | ||
const TruffleContract = require('truffle-contract'); | ||
const workflow = require('truffle-workflow-compile'); | ||
const path = require('path'); | ||
const fs = require('fs-extra'); | ||
const TruffleContract = require("truffle-contract"); | ||
const workflow = require("@truffle/workflow-compile"); | ||
const path = require("path"); | ||
const fs = require("fs-extra"); | ||
|
||
const utils = { | ||
|
||
miningId: null, | ||
|
||
// Constants | ||
zeroAddress: '0x0000000000000000000000000000000000000000', | ||
zeroAddress: "0x0000000000000000000000000000000000000000", | ||
|
||
// Paths | ||
buildDir: path.join(__dirname, '../build'), | ||
sourcesDir: path.join(__dirname, '../sources'), | ||
buildDir: path.join(__dirname, "../build"), | ||
sourcesDir: path.join(__dirname, "../sources"), | ||
|
||
compile: async function(){ | ||
const config = { | ||
compile: async function() { | ||
const config = { | ||
contracts_build_directory: utils.buildDir, | ||
contracts_directory: utils.sourcesDir | ||
}; | ||
|
||
return new Promise((accept, reject) => { | ||
workflow.compile(config, err => err ? reject(err) : accept()); | ||
workflow.compile(config, err => (err ? reject(err) : accept())); | ||
}); | ||
}, | ||
|
||
evm_mine: function(web3){ | ||
return new Promise(function(accept, reject){ | ||
web3.currentProvider.send({ | ||
jsonrpc: "2.0", | ||
method: "evm_mine", | ||
id: new Date().getTime() | ||
}, function(err, result){ | ||
(err) ? reject(err) : accept(result); | ||
}); | ||
evm_mine: function(web3) { | ||
return new Promise(function(accept, reject) { | ||
web3.currentProvider.send( | ||
{ | ||
jsonrpc: "2.0", | ||
method: "evm_mine", | ||
id: new Date().getTime() | ||
}, | ||
function(err, result) { | ||
err ? reject(err) : accept(result); | ||
} | ||
); | ||
}); | ||
}, | ||
|
||
startAutoMine: function(web3, interval){ | ||
utils.miningId = setInterval(async() => { | ||
startAutoMine: function(web3, interval) { | ||
utils.miningId = setInterval(async () => { | ||
await utils.evm_mine(web3); | ||
}, interval); | ||
}, | ||
|
||
stopAutoMine: () => clearInterval(utils.miningId), | ||
|
||
waitMS: async (ms) => new Promise(resolve => setTimeout(() => resolve(), ms)), | ||
waitMS: async ms => new Promise(resolve => setTimeout(() => resolve(), ms)), | ||
|
||
cleanUp: () => fs.removeSync(utils.buildDir), | ||
|
||
getContract: function(name, provider, networkId, account){ | ||
getContract: function(name, provider, networkId, account) { | ||
const json = require(`../build/${name}`); | ||
const contract = TruffleContract(json); | ||
contract.setProvider(provider); | ||
contract.setNetwork(networkId); | ||
contract.defaults({ from: account }); | ||
return contract; | ||
}, | ||
} | ||
}; | ||
|
||
module.exports = utils; |
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
packages/truffle-workflow-compile/README.md → packages/workflow-compile/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...es/truffle-workflow-compile/test/shims.js → packages/workflow-compile/test/shims.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.