diff options
author | Jacob Evans <dekz@dekz.net> | 2018-06-18 19:50:35 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-18 19:50:35 +0800 |
commit | 190eafc30e2e444ed15b76217a6162ec04b33f73 (patch) | |
tree | b20cbad73ff7a069dc0f0ef43ebc0373c714ad02 /packages/abi-gen | |
parent | d4ee0e862297c16f8ee62efccd31f1193052c64e (diff) | |
parent | 0c238448fda99c4d7997901d0fe4d72cb06b79cc (diff) | |
download | dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.gz dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.bz2 dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.lz dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.xz dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.tar.zst dexon-sol-tools-190eafc30e2e444ed15b76217a6162ec04b33f73.zip |
Merge branch 'v2-prototype' into bug/contracts/eip712-191-prefix
Diffstat (limited to 'packages/abi-gen')
-rw-r--r-- | packages/abi-gen/README.md | 5 | ||||
-rw-r--r-- | packages/abi-gen/package.json | 2 | ||||
-rw-r--r-- | packages/abi-gen/src/index.ts | 2 | ||||
-rw-r--r-- | packages/abi-gen/src/utils.ts | 2 |
4 files changed, 5 insertions, 6 deletions
diff --git a/packages/abi-gen/README.md b/packages/abi-gen/README.md index 4240ba7ba..b6dd37cd1 100644 --- a/packages/abi-gen/README.md +++ b/packages/abi-gen/README.md @@ -4,8 +4,7 @@ This package allows you to generate TypeScript contract wrappers from ABI files. It's heavily inspired by [Geth abigen](https://github.com/ethereum/go-ethereum/wiki/Native-DApps:-Go-bindings-to-Ethereum-contracts) but takes a different approach. You can write your custom handlebars templates which will allow you to seamlessly integrate the generated code into your existing codebase with existing conventions. -For an example of the generated [wrapper files](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/src/contract_wrappers/generated) check out 0x.js. -[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate those files. +[Here](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) are the templates used to generate the contract wrappers used by 0x.js.e ## Installation @@ -45,7 +44,7 @@ You need to also specify the location of your main template used for every contr ## How to write custom templates? -The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/0x.js/contract_templates) and start adjusting them for your needs. +The best way to get started is to copy [0x.js templates](https://github.com/0xProject/0x-monorepo/tree/development/packages/contract_templates) and start adjusting them for your needs. We use [handlebars](http://handlebarsjs.com/) template engine under the hood. You need to have a master template called `contract.mustache`. it will be used to generate each contract wrapper. Although - you don't need and probably shouldn't write all your logic in a single template file. You can write [partial templates](http://handlebarsjs.com/partials.html) and as long as they are within a partials folder - they will be registered and available. diff --git a/packages/abi-gen/package.json b/packages/abi-gen/package.json index e02b930ed..19977fc86 100644 --- a/packages/abi-gen/package.json +++ b/packages/abi-gen/package.json @@ -8,7 +8,7 @@ "main": "lib/index.js", "types": "lib/index.d.ts", "scripts": { - "watch": "tsc -w", + "watch_without_deps": "tsc -w", "lint": "tslint --project .", "clean": "shx rm -rf lib scripts", "build": "tsc && copyfiles -u 2 './lib/monorepo_scripts/**/*' ./scripts", diff --git a/packages/abi-gen/src/index.ts b/packages/abi-gen/src/index.ts index b7e6722ea..0d053cdd1 100644 --- a/packages/abi-gen/src/index.ts +++ b/packages/abi-gen/src/index.ts @@ -12,7 +12,7 @@ import * as yargs from 'yargs'; import toSnakeCase = require('to-snake-case'); -import { ContextData, ContractsBackend, Method, ParamKind } from './types'; +import { ContextData, ContractsBackend, ParamKind } from './types'; import { utils } from './utils'; const ABI_TYPE_CONSTRUCTOR = 'constructor'; diff --git a/packages/abi-gen/src/utils.ts b/packages/abi-gen/src/utils.ts index a46209dad..66390174c 100644 --- a/packages/abi-gen/src/utils.ts +++ b/packages/abi-gen/src/utils.ts @@ -56,7 +56,7 @@ export const utils = { const componentType = `${component.name}: ${componentValueType}`; return componentType; }); - const tsType = `{${componentsType}}`; + const tsType = `{${componentsType.join(';')}}`; return tsType; } throw new Error(`Unknown Solidity type found: ${solType}`); |