Prettier fixes

This commit is contained in:
Fabio Berger 2019-02-19 22:48:09 -08:00
parent 13eb9103a7
commit 6b775628d5
10 changed files with 68 additions and 13 deletions

View File

@ -1,4 +1,11 @@
import { FillResults, formatters, LogDecoder, OrderInfo, orderUtils, Web3ProviderEngine } from '@0x/contracts-test-utils';
import {
FillResults,
formatters,
LogDecoder,
OrderInfo,
orderUtils,
Web3ProviderEngine,
} from '@0x/contracts-test-utils';
import { SignedOrder, SignedZeroExTransaction } from '@0x/types';
import { AbiEncoder, BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';

View File

@ -91,7 +91,11 @@ export class AssetBuyer {
*
* @return An instance of AssetBuyer
*/
constructor(supportedProvider: SupportedProvider, orderProvider: OrderProvider, options: Partial<AssetBuyerOpts> = {}) {
constructor(
supportedProvider: SupportedProvider,
orderProvider: OrderProvider,
options: Partial<AssetBuyerOpts> = {},
) {
const { networkId, orderRefreshIntervalMs, expiryBufferSeconds } = _.merge(
{},
constants.DEFAULT_ASSET_BUYER_OPTS,

View File

@ -18,7 +18,12 @@ export const assert = {
signature: string,
signerAddress: string,
): Promise<void> {
const isValid = await signatureUtils.isValidSignatureAsync(supportedProvider, orderHash, signature, signerAddress);
const isValid = await signatureUtils.isValidSignatureAsync(
supportedProvider,
orderHash,
signature,
signerAddress,
);
sharedAssert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
},
isValidSubscriptionToken(variableName: string, subscriptionToken: string): void {

View File

@ -204,7 +204,10 @@ let _cachedContractAddresses: ContractAddresses;
* @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter).
* @returns The addresses of the contracts that were deployed.
*/
export async function runMigrationsOnceAsync(provider: Web3ProviderEngine, txDefaults: TxData): Promise<ContractAddresses> {
export async function runMigrationsOnceAsync(
provider: Web3ProviderEngine,
txDefaults: TxData,
): Promise<ContractAddresses> {
if (!_.isUndefined(_cachedContractAddresses)) {
return _cachedContractAddresses;
}

View File

@ -118,7 +118,10 @@ export class OrderValidationUtils {
* @param supportedProvider Web3 provider to use for JSON RPC calls
* @return An instance of OrderValidationUtils
*/
constructor(orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher, supportedProvider: SupportedProvider) {
constructor(
orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher,
supportedProvider: SupportedProvider,
) {
this._orderFilledCancelledFetcher = orderFilledCancelledFetcher;
const provider = providerUtils.standardizeOrThrow(supportedProvider);
this._provider = provider;

View File

@ -91,7 +91,11 @@ export const signatureUtils = {
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
* @return Whether the data was preSigned by the supplied signerAddress
*/
async isValidPresignedSignatureAsync(supportedProvider: SupportedProvider, data: string, signerAddress: string): Promise<boolean> {
async isValidPresignedSignatureAsync(
supportedProvider: SupportedProvider,
data: string,
signerAddress: string,
): Promise<boolean> {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
assert.isHexString('data', data);
assert.isETHAddressHex('signerAddress', signerAddress);
@ -210,7 +214,11 @@ export const signatureUtils = {
* must be available via the supplied Provider.
* @return A SignedOrder containing the order and Elliptic curve signature with Signature Type.
*/
async ecSignOrderAsync(supportedProvider: SupportedProvider, order: Order, signerAddress: string): Promise<SignedOrder> {
async ecSignOrderAsync(
supportedProvider: SupportedProvider,
order: Order,
signerAddress: string,
): Promise<SignedOrder> {
assert.doesConformToSchema('order', order, schemas.orderSchema, [schemas.hexSchema]);
try {
const signedOrder = await signatureUtils.ecSignTypedDataOrderAsync(supportedProvider, order, signerAddress);
@ -241,7 +249,11 @@ export const signatureUtils = {
* must be available via the supplied Provider.
* @return A SignedOrder containing the order and Elliptic curve signature with Signature Type.
*/
async ecSignTypedDataOrderAsync(supportedProvider: SupportedProvider, order: Order, signerAddress: string): Promise<SignedOrder> {
async ecSignTypedDataOrderAsync(
supportedProvider: SupportedProvider,
order: Order,
signerAddress: string,
): Promise<SignedOrder> {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
assert.isETHAddressHex('signerAddress', signerAddress);
assert.doesConformToSchema('order', order, schemas.orderSchema, [schemas.hexSchema]);
@ -280,7 +292,11 @@ export const signatureUtils = {
* must be available via the supplied Provider.
* @return A hex encoded string containing the Elliptic curve signature generated by signing the msgHash and the Signature Type.
*/
async ecSignHashAsync(supportedProvider: SupportedProvider, msgHash: string, signerAddress: string): Promise<string> {
async ecSignHashAsync(
supportedProvider: SupportedProvider,
msgHash: string,
signerAddress: string,
): Promise<string> {
const provider = providerUtils.standardizeOrThrow(supportedProvider);
assert.isHexString('msgHash', msgHash);
assert.isETHAddressHex('signerAddress', signerAddress);

View File

@ -34,7 +34,13 @@ import {
} from '@0x/order-utils';
import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder, Stats } from '@0x/types';
import { errorUtils, intervalUtils, providerUtils } from '@0x/utils';
import { BlockParamLiteral, LogEntryEvent, LogWithDecodedArgs, SupportedProvider, ZeroExProvider } from 'ethereum-types';
import {
BlockParamLiteral,
LogEntryEvent,
LogWithDecodedArgs,
SupportedProvider,
ZeroExProvider,
} from 'ethereum-types';
import * as _ from 'lodash';
import { orderWatcherPartialConfigSchema } from '../schemas/order_watcher_partial_config_schema';

View File

@ -17,7 +17,12 @@ export const assert = {
signature: string,
signerAddress: string,
): Promise<void> {
const isValid = await signatureUtils.isValidSignatureAsync(supportedProvider, orderHash, signature, signerAddress);
const isValid = await signatureUtils.isValidSignatureAsync(
supportedProvider,
orderHash,
signature,
signerAddress,
);
assert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
},
};

View File

@ -22,7 +22,13 @@ import {
import { SignedOrder, Token as ZeroExToken } from '@0x/types';
import { BigNumber, intervalUtils, logUtils, providerUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { BlockParam, LogWithDecodedArgs, Provider, TransactionReceiptWithDecodedLogs, ZeroExProvider } from 'ethereum-types';
import {
BlockParam,
LogWithDecodedArgs,
Provider,
TransactionReceiptWithDecodedLogs,
ZeroExProvider,
} from 'ethereum-types';
import * as _ from 'lodash';
import * as moment from 'moment';
import * as React from 'react';