0.0.19 • Published 2 years ago

@taikai/dappkit-launchpad v0.0.19

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

dappkit-launchpad

Solidity to Typescript transpiler for @taikai/dappkit with templates

$ npm install -g @taikai/dappkit-launchpad

Usage

$ dlt -f path/to/your/contract/abi.json

CLI usage

All non provided cli options will be overriden by their counterpart value on the json configuration, and if none exists a default will be used.

  -f, --file                File to parse                             [required]
  -i, --interfaceDir        directory to output interface file into
  -c, --classDir            directory to output class file into
  -n, --name                change the file name
  -I, --overwriteInterface  allow interface file overwrite
  -C, --overwriteClass      allow class file overwrite
  -e, --eventsDir           directory to output events to
  -E, --overwriteEvent      allow event interface file overwrite (events will be
                             spawned on same folder as interface)
  -j, --json                json configuration file
  -p, --asPackage           outputs imports from dappkit istead of source (deprecated)
  -h, --help                Show help                                 

Example

Given the ERC20 standard from @openzepplin and its compilation json, ERC20.json, issuing

$ dk-transpile -f ERC20.json -i ./ -c ./ -e ./ -IEC

Will output,

$ dk-transpile -f ERC20.json -i ./interfaces -c ./classes -e ./events -IEC

Created /interfaces/erc20.ts
Created /classes/erc20.ts
Created /events/erc20-events.ts

These proxies can then be customizable and will eventually look like the one provided by @taikai/dappkit.

Configuration

All the cli options are available as a json configuration,

optiondescription
asPackageasPackage is a backwards compatability flag that should always be true and will be deprecated.
templatesDirsource for the hbs templates. If you provide a custom path, you'll need to provide ALL templates
pathspaths works when asPackage=false and is a backwards compatability flag, it can be ignored as it will be deprecated
pathsbasedappkit base folder
pathsabiwhere all abis are
pathsinterfaceswhere interfaces are imported from/exported to
pathsmethodswhere the methods are imported from/exported to
pathseventswhere the events are imported from/exported to
outputOutput controls where the generated files will be created; Leaving it empty the file will be outputted to the terminal
outputinterfaceDirfolder for interfaces output
outputclassDirfolder for model extension output
outputeventsDirfolder for events output
overwriteWhich files can be overwritten if already exist
overwriteinterface
overwriteclass
overwriteevents
default configuration (config.mjs)
{
  paths: {                            // import paths, ignore if asPackage: true
    base: "@base",                    // @taikai/dappkit base folder
    abi: "@abi",                      // @taikai/dappkit abi folder        | will be rewritten if asPackage = true, path.dirname(--file)
    interfaces: "@interfaces",        // @taikai/dappkit interfaces folder | will be rewritten if asPackage = true, output.interfaceDir
    methods: "@methods",              // @taikai/dappkit methods folder    | will be rewritten if asPackage = true, output.interfaceDir
    events: "@events"                 // @taikai/dappkit events folder     | will be rewritten if asPackage = true, output.eventsDir
  },
  output: {                           // where to output each file (empty defaults to console.log)
    interfaceDir: "",
    classDir: "",
    eventsDir: ""
  },
  overwrite: {                        // which files can be overwritten
    interface: false,
    class: false,
    events: false
  },
  asPackage: true,                    // used internally, "false" will use imports from @taikai/dappkit source
  templatesDir: "./src/templates"     // where to get the handlebars templates from, you'll need to provide ALL files
}

Templates

Templates can essentially be used to complement customizations in a standard way, and by providing the templatesDir option on the configuration file along with all the handlebars templates this is easily achievable.

0.0.15

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago