diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-11 18:32:57 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-11 18:32:57 +0800 |
commit | d370296e82c11d67bbb16a1dc73432c3625682aa (patch) | |
tree | c8e5d440bc2b78feae89644c11ba3ed778da6015 /packages/sol-compiler/src/utils/encoder.ts | |
parent | f78b5741c3ba3495c066dc800ce62d8a1f3fb75f (diff) | |
parent | f42f608f3f97a5244f09f17ae5ee184c0f775de3 (diff) | |
download | dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.gz dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.bz2 dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.lz dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.xz dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.tar.zst dexon-sol-tools-d370296e82c11d67bbb16a1dc73432c3625682aa.zip |
Merge branch 'development' into breakUp0xjs
* development:
Fix ganache subprovider config
Fix a bug in compiler config precedence
Fix linter errors
Fix templates
Remove unused deployer docs configs
Add a legacy endpoint for the deployer
Add a check for compiler output
Add a comment
Put ARTIFACTS_VERSION in a config
Improve a comment
Remove _applyDefaultsToDeployTxDataAsync
Add a HACK comment
Fix linter issues
Rename deployer to sol-compiler
Remove deployer
Remove deployer from 0x.js and migrations
Configure migrations with a compiler.json
Remove deployer from metacoin and contract tests
Update wallet footer and add remove token functionality
# Conflicts:
# .gitignore
# packages/0x.js/package.json
# packages/0x.js/src/0x.ts
# packages/contracts/package.json
# packages/contracts/test/multi_sig_with_time_lock.ts
# packages/contracts/test/multi_sig_with_time_lock_except_remove_auth_addr.ts
# packages/contracts/util/artifacts.ts
# packages/deployer/test/deployer_test.ts
# packages/migrations/package.json
Diffstat (limited to 'packages/sol-compiler/src/utils/encoder.ts')
-rw-r--r-- | packages/sol-compiler/src/utils/encoder.ts | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/sol-compiler/src/utils/encoder.ts b/packages/sol-compiler/src/utils/encoder.ts new file mode 100644 index 000000000..806efbbca --- /dev/null +++ b/packages/sol-compiler/src/utils/encoder.ts @@ -0,0 +1,18 @@ +import { AbiDefinition, AbiType, ContractAbi, DataItem } from '@0xproject/types'; +import * as _ from 'lodash'; +import * as web3Abi from 'web3-eth-abi'; + +export const encoder = { + encodeConstructorArgsFromAbi(args: any[], abi: ContractAbi): string { + const constructorTypes: string[] = []; + _.each(abi, (element: AbiDefinition) => { + if (element.type === AbiType.Constructor) { + _.each(element.inputs, (input: DataItem) => { + constructorTypes.push(input.type); + }); + } + }); + const encodedParameters = web3Abi.encodeParameters(constructorTypes, args); + return encodedParameters; + }, +}; |