Skip to content

Instantly share code, notes, and snippets.

@niran
Created June 30, 2016 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save niran/02b2fbd8572d961cde7bbf962920ce9c to your computer and use it in GitHub Desktop.
Save niran/02b2fbd8572d961cde7bbf962920ce9c to your computer and use it in GitHub Desktop.
/**
* 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