aboutsummaryrefslogtreecommitdiffstats
path: root/packages/order-utils/src
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-08-04 16:09:08 +0800
committerFabio Berger <me@fabioberger.com>2018-08-04 16:09:08 +0800
commit7759e67a5a51a213e19083f63df13e80ea4aefa2 (patch)
tree9eedc8e87196c080787f0a6841bdb67199cbcfed /packages/order-utils/src
parent4d75689790075f734df9a2e3b80443c85e1ddc95 (diff)
downloaddexon-sol-tools-7759e67a5a51a213e19083f63df13e80ea4aefa2.tar
dexon-sol-tools-7759e67a5a51a213e19083f63df13e80ea4aefa2.tar.gz
dexon-sol-tools-7759e67a5a51a213e19083f63df13e80ea4aefa2.tar.bz2
dexon-sol-tools-7759e67a5a51a213e19083f63df13e80ea4aefa2.tar.lz
dexon-sol-tools-7759e67a5a51a213e19083f63df13e80ea4aefa2.tar.xz
dexon-sol-tools-7759e67a5a51a213e19083f63df13e80ea4aefa2.tar.zst
dexon-sol-tools-7759e67a5a51a213e19083f63df13e80ea4aefa2.zip
Rename EIP712Utils to eip712Utils since objectLiterals shouldn't start with caps
Diffstat (limited to 'packages/order-utils/src')
-rw-r--r--packages/order-utils/src/eip712_utils.ts20
-rw-r--r--packages/order-utils/src/index.ts2
-rw-r--r--packages/order-utils/src/order_hash.ts8
3 files changed, 15 insertions, 15 deletions
diff --git a/packages/order-utils/src/eip712_utils.ts b/packages/order-utils/src/eip712_utils.ts
index c7b20f824..b303c93dc 100644
--- a/packages/order-utils/src/eip712_utils.ts
+++ b/packages/order-utils/src/eip712_utils.ts
@@ -18,14 +18,14 @@ const EIP712_DOMAIN_SCHEMA: EIP712Schema = {
],
};
-export const EIP712Utils = {
+export const eip712Utils = {
/**
* Compiles the EIP712Schema and returns the hash of the schema.
* @param schema The EIP712 schema.
* @return The hash of the compiled schema
*/
compileSchema(schema: EIP712Schema): Buffer {
- const eip712Schema = EIP712Utils._encodeType(schema);
+ const eip712Schema = eip712Utils._encodeType(schema);
const eip712SchemaHashBuffer = crypto.solSHA3([eip712Schema]);
return eip712SchemaHashBuffer;
},
@@ -36,7 +36,7 @@ export const EIP712Utils = {
* @return The hash of an EIP712 message with domain separator prefixed
*/
createEIP712Message(hashStruct: Buffer, contractAddress: string): Buffer {
- const domainSeparatorHashBuffer = EIP712Utils._getDomainSeparatorHashBuffer(contractAddress);
+ const domainSeparatorHashBuffer = eip712Utils._getDomainSeparatorHashBuffer(contractAddress);
const messageBuff = crypto.solSHA3([EIP191_PREFIX, domainSeparatorHashBuffer, hashStruct]);
return messageBuff;
},
@@ -47,7 +47,7 @@ export const EIP712Utils = {
*/
pad32Address(address: string): Buffer {
const addressBuffer = ethUtil.toBuffer(address);
- const addressPadded = EIP712Utils.pad32Buffer(addressBuffer);
+ const addressPadded = eip712Utils.pad32Buffer(addressBuffer);
return addressPadded;
},
/**
@@ -66,17 +66,17 @@ export const EIP712Utils = {
* @return A buffer containing the SHA256 hash of the schema and encoded data
*/
structHash(schema: EIP712Schema, data: { [key: string]: any }): Buffer {
- const encodedData = EIP712Utils._encodeData(schema, data);
- const schemaHash = EIP712Utils.compileSchema(schema);
+ const encodedData = eip712Utils._encodeData(schema, data);
+ const schemaHash = eip712Utils.compileSchema(schema);
const hashBuffer = crypto.solSHA3([schemaHash, ...encodedData]);
return hashBuffer;
},
_getDomainSeparatorSchemaBuffer(): Buffer {
- return EIP712Utils.compileSchema(EIP712_DOMAIN_SCHEMA);
+ return eip712Utils.compileSchema(EIP712_DOMAIN_SCHEMA);
},
_getDomainSeparatorHashBuffer(exchangeAddress: string): Buffer {
- const domainSeparatorSchemaBuffer = EIP712Utils._getDomainSeparatorSchemaBuffer();
- const encodedData = EIP712Utils._encodeData(EIP712_DOMAIN_SCHEMA, {
+ const domainSeparatorSchemaBuffer = eip712Utils._getDomainSeparatorSchemaBuffer();
+ const encodedData = eip712Utils._encodeData(EIP712_DOMAIN_SCHEMA, {
name: EIP712_DOMAIN_NAME,
version: EIP712_DOMAIN_VERSION,
verifyingContract: exchangeAddress,
@@ -99,7 +99,7 @@ export const EIP712Utils = {
} else if (parameter.type === EIP712Types.Uint256) {
encodedValues.push(value);
} else if (parameter.type === EIP712Types.Address) {
- encodedValues.push(EIP712Utils.pad32Address(value));
+ encodedValues.push(eip712Utils.pad32Address(value));
} else {
throw new Error(`Unable to encode ${parameter.type}`);
}
diff --git a/packages/order-utils/src/index.ts b/packages/order-utils/src/index.ts
index 50a5106ca..f3b00a583 100644
--- a/packages/order-utils/src/index.ts
+++ b/packages/order-utils/src/index.ts
@@ -2,7 +2,7 @@ export { orderHashUtils } from './order_hash';
export { signatureUtils } from './signature_utils';
export { generatePseudoRandomSalt } from './salt';
export { assetDataUtils } from './asset_data_utils';
-export { EIP712Utils } from './eip712_utils';
+export { eip712Utils } from './eip712_utils';
export { OrderStateUtils } from './order_state_utils';
export { AbstractBalanceAndProxyAllowanceFetcher } from './abstract/abstract_balance_and_proxy_allowance_fetcher';
diff --git a/packages/order-utils/src/order_hash.ts b/packages/order-utils/src/order_hash.ts
index 54c500653..8e98f8767 100644
--- a/packages/order-utils/src/order_hash.ts
+++ b/packages/order-utils/src/order_hash.ts
@@ -3,7 +3,7 @@ import { Order, SignedOrder } from '@0xproject/types';
import * as _ from 'lodash';
import { assert } from './assert';
-import { EIP712Utils } from './eip712_utils';
+import { eip712Utils } from './eip712_utils';
import { EIP712Schema, EIP712Types } from './types';
const INVALID_TAKER_FORMAT = 'instance.takerAddress is not of a type(s) string';
@@ -69,11 +69,11 @@ export const orderHashUtils = {
* @return The resulting orderHash from hashing the supplied order as a Buffer
*/
getOrderHashBuffer(order: SignedOrder | Order): Buffer {
- const orderParamsHashBuff = EIP712Utils.structHash(EIP712_ORDER_SCHEMA, order);
- const orderHashBuff = EIP712Utils.createEIP712Message(orderParamsHashBuff, order.exchangeAddress);
+ const orderParamsHashBuff = eip712Utils.structHash(EIP712_ORDER_SCHEMA, order);
+ const orderHashBuff = eip712Utils.createEIP712Message(orderParamsHashBuff, order.exchangeAddress);
return orderHashBuff;
},
_getOrderSchemaBuffer(): Buffer {
- return EIP712Utils.compileSchema(EIP712_ORDER_SCHEMA);
+ return eip712Utils.compileSchema(EIP712_ORDER_SCHEMA);
},
};