aboutsummaryrefslogtreecommitdiffstats
path: root/packages/0x.js/src/0x.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/0x.js/src/0x.ts')
-rw-r--r--packages/0x.js/src/0x.ts66
1 files changed, 37 insertions, 29 deletions
diff --git a/packages/0x.js/src/0x.ts b/packages/0x.js/src/0x.ts
index 780d1b52a..bf776cd95 100644
--- a/packages/0x.js/src/0x.ts
+++ b/packages/0x.js/src/0x.ts
@@ -40,12 +40,38 @@ export class ZeroEx {
*/
public static NULL_ADDRESS = constants.NULL_ADDRESS;
/**
+ * An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract.
+ */
+ public exchange: ExchangeWrapper;
+ /**
+ * An instance of the TokenRegistryWrapper class containing methods for interacting with the 0x
+ * TokenRegistry smart contract.
+ */
+ public tokenRegistry: TokenRegistryWrapper;
+ /**
+ * An instance of the TokenWrapper class containing methods for interacting with any ERC20 token smart contract.
+ */
+ public token: TokenWrapper;
+ /**
+ * An instance of the EtherTokenWrapper class containing methods for interacting with the
+ * wrapped ETH ERC20 token smart contract.
+ */
+ public etherToken: EtherTokenWrapper;
+ /**
+ * An instance of the TokenTransferProxyWrapper class containing methods for interacting with the
+ * tokenTransferProxy smart contract.
+ */
+ public proxy: TokenTransferProxyWrapper;
+ private _web3Wrapper: Web3Wrapper;
+ /**
* Generates a pseudo-random 256-bit salt.
* The salt can be included in a 0x order, ensuring that the order generates a unique orderHash
* and will not collide with other outstanding orders that are identical in all other parameters.
* @return A pseudo-random 256-bit number that can be used as a salt.
*/
- public static generatePseudoRandomSalt = generatePseudoRandomSalt;
+ public static generatePseudoRandomSalt(): BigNumber {
+ return generatePseudoRandomSalt();
+ }
/**
* Verifies that the elliptic curve signature `signature` was generated
* by signing `data` with the private key corresponding to the `signerAddress` address.
@@ -54,13 +80,17 @@ export class ZeroEx {
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
* @return Whether the signature is valid for the supplied signerAddress and data.
*/
- public static isValidSignature = isValidSignature;
+ public static isValidSignature(data: string, signature: ECSignature, signerAddress: string): boolean {
+ return isValidSignature(data, signature, signerAddress);
+ }
/**
* Computes the orderHash for a supplied order.
* @param order An object that conforms to the Order or SignedOrder interface definitions.
* @return The resulting orderHash from hashing the supplied order.
*/
- public static getOrderHashHex = getOrderHashHex;
+ public static getOrderHashHex(order: Order | SignedOrder): string {
+ return getOrderHashHex(order);
+ }
/**
* Checks if the supplied hex encoded order hash is valid.
* Note: Valid means it has the expected format, not that an order with the orderHash exists.
@@ -68,32 +98,9 @@ export class ZeroEx {
* @param orderHash Hex encoded orderHash.
* @return Whether the supplied orderHash has the expected format.
*/
- public static isValidOrderHash = isValidOrderHash;
-
- /**
- * An instance of the ExchangeWrapper class containing methods for interacting with the 0x Exchange smart contract.
- */
- public exchange: ExchangeWrapper;
- /**
- * An instance of the TokenRegistryWrapper class containing methods for interacting with the 0x
- * TokenRegistry smart contract.
- */
- public tokenRegistry: TokenRegistryWrapper;
- /**
- * An instance of the TokenWrapper class containing methods for interacting with any ERC20 token smart contract.
- */
- public token: TokenWrapper;
- /**
- * An instance of the EtherTokenWrapper class containing methods for interacting with the
- * wrapped ETH ERC20 token smart contract.
- */
- public etherToken: EtherTokenWrapper;
- /**
- * An instance of the TokenTransferProxyWrapper class containing methods for interacting with the
- * tokenTransferProxy smart contract.
- */
- public proxy: TokenTransferProxyWrapper;
- private _web3Wrapper: Web3Wrapper;
+ public static isValidOrderHash(orderHash: string): boolean {
+ return isValidOrderHash(orderHash);
+ }
/**
* A unit amount is defined as the amount of a token above the specified decimal places (integer part).
* E.g: If a currency has 18 decimal places, 1e18 or one quintillion of the currency is equivalent
@@ -185,6 +192,7 @@ export class ZeroEx {
}
/**
* Get the provider instance currently used by 0x.js
+ * @return Web3 provider instance
*/
public getProvider(): Provider {
return this._web3Wrapper.getProvider();