diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-02 20:25:30 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-02 21:01:01 +0800 |
commit | adaff92c9243e7e13737f92cf4b6ade77ebd6e43 (patch) | |
tree | 48a3952855d3e3d1485ec1845928dc0d0a5c3145 | |
parent | 0499541e114e6dd36565428f4f914e0dbdece2b8 (diff) | |
download | dexon-0x-contracts-adaff92c9243e7e13737f92cf4b6ade77ebd6e43.tar.gz dexon-0x-contracts-adaff92c9243e7e13737f92cf4b6ade77ebd6e43.tar.zst dexon-0x-contracts-adaff92c9243e7e13737f92cf4b6ade77ebd6e43.zip |
Create wrapper functions so that docs render properly
-rw-r--r-- | packages/0x.js/src/0x.ts | 66 | ||||
-rw-r--r-- | packages/order-utils/.npmignore | 1 |
2 files changed, 38 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(); diff --git a/packages/order-utils/.npmignore b/packages/order-utils/.npmignore index 24e65ad5b..89302c908 100644 --- a/packages/order-utils/.npmignore +++ b/packages/order-utils/.npmignore @@ -1,6 +1,7 @@ .* yarn-error.log /scripts/ +/generated_docs/ /src/ tsconfig.json /lib/monorepo_scripts/ |