How to use @truffle/contract-schema - 2 common examples

To help you get started, we’ve selected a few @truffle/contract-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github trufflesuite / truffle / packages / contract / index.js View on Github external
const contract = (json = {}, networkType = "ethereum") => {
  const normalizedArtifactObject = Object.assign({}, Schema.normalize(json), {
    networkType
  });

  // Note we don't use `new` here at all. This will cause the class to
  // "mutate" instead of instantiate an instance.
  return Contract.clone(normalizedArtifactObject);
};
github trufflesuite / truffle / packages / external-compile / index.js View on Github external
async function processTargets(targets, cwd, logger) {
  const contracts = {};
  for (let target of targets) {
    let targetContracts = await processTarget(target, cwd, logger);
    for (let [name, contract] of Object.entries(targetContracts)) {
      contracts[name] = Schema.validate(contract);
    }
  }

  return contracts;
}

@truffle/contract-schema

JSON schema for contract artifacts

MIT
Latest version published 1 year ago

Package Health Score

61 / 100
Full package analysis