2.2.0 • Published 4 years ago

truffle-declarative v2.2.0

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

truffle-declarative

Run complex playbooks of blockchain scripts using simple declarative syntax

Command Line

./node_modules/.bin/truffle-play

Programmatic

const TruffleDeclarative = require('truffle-declarative');
const run = new TruffleDeclarative({
  output: 'results.yml',
  networkName: 'development',
  dryRun: true
});

const results = await run([{
  description: 'Deploy a new version of SafeMathLib',
  contract: 'SafeMathLib',
  run: 'new',
  inputs: [{
    from: '0x1f9c410d5562bb6590b8f891f2e26311f9a6ef8c',
    gasPrice: 11e9,
  }],
  outputs: {
    'address': 'safeMathLib'
  }
}, {
  description: 'Link IDRP to new SafeMathLib',
  contract: 'IDRP',
  run: 'link',
  inputs: ['$contracts.SafeMathLib', {
    from: '0x1f9c410d5562bb6590b8f891f2e26311f9a6ef8c',
  }],
  outputs: {
    'address': 'idrp'
  }
}, {
  description: 'Deploy new CouponStorage',
  contract: 'CouponStorage',
  run: 'new',
  inputs: [{    
    safeMathLib: '$outputs.safeMathLib',
    stableCoin: '$outputs.idrp',
    initialSupply: 1e30,
  }, {
    from: '0x1f9c410d5562bb6590b8f891f2e26311f9a6ef8c',
  }],
  outputs: {
    'address': 'couponStorage'
  }
}, {
  description: 'Check CouponStorage balance for wallet #1.',
  contract: 'CouponStorage',
  at: '$outputs.couponStorage',
  run: 'balanceOf',
  inputs: ['0x1f9c410d5562bb6590b8f891f2e26311f9a6ef8c'],
  outputs: 'balanceOfWallet1'
}]);

special

Run special utils, such as truffle-object-mapper:

const TruffleDeclarative = require('truffle-declarative');
const run = new TruffleDeclarative({
  map: path.join(__dirname, 'map.js'),
});

const results = await run([{
  description: 'Dump the current contract',
  contract: 'CouponStorage',
  at: '0x1f9c410d5562bb6590b8f891f2e26311f9a6ef8c',
  run: 'util.map'
}]);

TODO

  • Improve docs
  • Add pretty HTML docs
  • Allow for/each on path
2.2.0

4 years ago

2.1.6

4 years ago

2.1.5

4 years ago

2.1.4

4 years ago

2.1.2

4 years ago

2.1.3

4 years ago

2.1.1

4 years ago

2.1.0

4 years ago

2.0.4

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.2.0

4 years ago

1.3.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago