diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-03-06 07:08:56 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-03-06 07:08:56 +0800 |
commit | d171ce4fba97847a617fc4c8fd7e3b759586c933 (patch) | |
tree | c800ae90713a098cd00a418bffe516776b579baf /packages/contracts/util/crypto.ts | |
parent | 92b9dbd706768fd0edfc8f72a90f197abd8b3d66 (diff) | |
parent | 994935b5da0b15796958a32c5bab0a25b9430b5a (diff) | |
download | dexon-sol-tools-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar dexon-sol-tools-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar.gz dexon-sol-tools-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar.bz2 dexon-sol-tools-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar.lz dexon-sol-tools-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar.xz dexon-sol-tools-d171ce4fba97847a617fc4c8fd7e3b759586c933.tar.zst dexon-sol-tools-d171ce4fba97847a617fc4c8fd7e3b759586c933.zip |
Merge branch 'development' into feature/sra-reporter
* development: (79 commits)
remove from devDeps
Remove date for now
Add ethers typescript typings to 0x.js deps. The library works without this atm since another dep of 0x.js has it as a dep. But it's more robust to have it here.
Add missing instructions to add external types to tsconfig.json after installing the package
Fix bugs in postpublish_utils.js
Update @0xproject/utils in top-level package.json
Changelog tweaks
Publish
Updated CHANGELOGS
Fix typo
Add PR number to changelog entry
Add changelog update to subproviders package
Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` and add tests
Remove unnecessary type assertion
Fix comments
Add comments
Don't need any external packages for 0x connect docs yet
Instead of adding `@0xproject/types` to tsconfig.json, let's only add it when calling TypeDoc
Fix styling
Make prettier ignore postpublish_utils
...
Diffstat (limited to 'packages/contracts/util/crypto.ts')
-rw-r--r-- | packages/contracts/util/crypto.ts | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/contracts/util/crypto.ts b/packages/contracts/util/crypto.ts index 9173df643..97b8f5643 100644 --- a/packages/contracts/util/crypto.ts +++ b/packages/contracts/util/crypto.ts @@ -13,6 +13,12 @@ export const crypto = { * valid Ethereum address -> address */ solSHA3(args: any[]): Buffer { + return crypto._solHash(args, ABI.soliditySHA3); + }, + solSHA256(args: any[]): Buffer { + return crypto._solHash(args, ABI.soliditySHA256); + }, + _solHash(args: any[], hashFunction: (types: string[], values: any[]) => Buffer) { const argTypes: string[] = []; _.each(args, (arg, i) => { const isNumber = _.isFinite(arg); @@ -31,7 +37,7 @@ export const crypto = { throw new Error(`Unable to guess arg type: ${arg}`); } }); - const hash = ABI.soliditySHA3(argTypes, args); + const hash = hashFunction(argTypes, args); return hash; }, }; |