aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-doc/src/cli.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-10-05 01:59:55 +0800
committerFabio Berger <me@fabioberger.com>2018-10-05 01:59:55 +0800
commit3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e (patch)
tree87bda5d41b34973960ec230dfb9320e54aea6588 /packages/sol-doc/src/cli.ts
parente7ab9938ce5bde17600130584fc75bc8a45f6dc5 (diff)
parent2da7626b5356f7b0ec809719f1b9da14b2969a07 (diff)
downloaddexon-sol-tools-3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e.tar
dexon-sol-tools-3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e.tar.gz
dexon-sol-tools-3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e.tar.bz2
dexon-sol-tools-3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e.tar.lz
dexon-sol-tools-3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e.tar.xz
dexon-sol-tools-3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e.tar.zst
dexon-sol-tools-3991e66a58f28dbed5e75f74ef4aaaf6bb3a4d3e.zip
merge developmemnt
Diffstat (limited to 'packages/sol-doc/src/cli.ts')
-rw-r--r--packages/sol-doc/src/cli.ts17
1 files changed, 15 insertions, 2 deletions
diff --git a/packages/sol-doc/src/cli.ts b/packages/sol-doc/src/cli.ts
index eb0f00bf6..a1847e868 100644
--- a/packages/sol-doc/src/cli.ts
+++ b/packages/sol-doc/src/cli.ts
@@ -3,7 +3,7 @@ import * as yargs from 'yargs';
import { logUtils } from '@0xproject/utils';
-import { generateSolDocAsync } from './solidity_doc_generator';
+import { SolDoc } from './sol_doc';
const JSON_TAB_WIDTH = 4;
@@ -20,7 +20,20 @@ const JSON_TAB_WIDTH = 4;
.demandOption('contracts-dir')
.array('contracts')
.help().argv;
- const doc = await generateSolDocAsync(argv.contractsDir, argv.contracts);
+ // Unfortunately, the only way to currently retrieve the declared structs within Solidity contracts
+ // is to tease them out of the params/return values included in the ABI. These structures do
+ // not include the structs actual name, so we need a mapping to assign the proper name to a
+ // struct. If the name is not in this mapping, the structs name will default to the param/return value
+ // name (which mostly coincide).
+ const customTypeHashToName: { [hash: string]: string } = {
+ '52d4a768701076c7bac06e386e430883975eb398732eccba797fd09dd064a60e': 'Order',
+ '46f7e8c4d144d11a72ce5338458ea37b933500d7a65e740cbca6d16e350eaa48': 'FillResults',
+ c22239cf0d29df1e6cf1be54f21692a8c0b3a48b9367540d4ffff4608b331ce9: 'OrderInfo',
+ c21e9ff31a30941c22e1cb43752114bb467c34dea58947f98966c9030fc8e4a9: 'TraderInfo',
+ '6de3264a1040e027d4bdd29c71e963028238ac4ef060541078a7aced44a4d46f': 'MatchedFillResults',
+ };
+ const solDoc = new SolDoc();
+ const doc = await solDoc.generateSolDocAsync(argv.contractsDir, argv.contracts, customTypeHashToName);
process.stdout.write(JSON.stringify(doc, null, JSON_TAB_WIDTH));
})().catch(err => {
logUtils.warn(err);