Created
June 30, 2016 18:42
-
-
Save niran/02b2fbd8572d961cde7bbf962920ce9c to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/** | |
* Export Truffle-generated contract data that can be used without Pudding. | |
*/ | |
import t from 'tcomb'; | |
import PledgesLoader from '../environments/development/contracts/Pledges.sol.js'; | |
const Contract = t.struct({ | |
abi: t.list(t.Object), | |
binary: t.String, | |
unlinked_binary: t.String, | |
address: t.String, | |
generated_with: t.String, | |
contract_name: t.String, | |
}, 'Contract'); | |
// Mock the Pudding interface with a whisk method that collects contract data. | |
const collector = { | |
contracts: {}, | |
whisk(contractData) { | |
const contractName = contractData.contract_name; | |
collector.contracts[contractName] = Contract(contractData); | |
}, | |
}; | |
PledgesLoader.load(collector); | |
export const Pledges = collector.contracts.Pledges; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment