dpack icon indicating copy to clipboard operation
dpack copied to clipboard

simpler declarative `build`

Open nmushegian opened this issue 4 years ago • 0 comments

Based on our current usage it seems like we can just have a single pure build function. (We should also still have stateful builder pattern).

const pack = dpack.build({
  network: hh.network.name,
  types: {
    'Gem': {
      artifact: hh.artifacts.readArtifact('Gem')
    },
  },
  objects: {
    'gemfab': {
      typename: 'Gem',
      address: gem.address,
      artifact: hh.artifacts.readArtifact('Gem'),
      alsoPackType: true
    }
  }
})

notice:

  • we can allow omitting redundant typename and objectname in places it can be inferred from the key. In later versions these could be distinct, but here they can't be
  • alsoPackType can be patched onto the object directly

nmushegian avatar Mar 01 '22 12:03 nmushegian