Prettier fixes
This commit is contained in:
parent
13eb9103a7
commit
6b775628d5
@ -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 { SignedOrder, SignedZeroExTransaction } from '@0x/types';
|
||||||
import { AbiEncoder, BigNumber } from '@0x/utils';
|
import { AbiEncoder, BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
|
@ -91,7 +91,11 @@ export class AssetBuyer {
|
|||||||
*
|
*
|
||||||
* @return An instance of 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(
|
const { networkId, orderRefreshIntervalMs, expiryBufferSeconds } = _.merge(
|
||||||
{},
|
{},
|
||||||
constants.DEFAULT_ASSET_BUYER_OPTS,
|
constants.DEFAULT_ASSET_BUYER_OPTS,
|
||||||
|
@ -18,7 +18,12 @@ export const assert = {
|
|||||||
signature: string,
|
signature: string,
|
||||||
signerAddress: string,
|
signerAddress: string,
|
||||||
): Promise<void> {
|
): 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`);
|
sharedAssert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
|
||||||
},
|
},
|
||||||
isValidSubscriptionToken(variableName: string, subscriptionToken: string): void {
|
isValidSubscriptionToken(variableName: string, subscriptionToken: string): void {
|
||||||
|
@ -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).
|
* @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.
|
* @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)) {
|
if (!_.isUndefined(_cachedContractAddresses)) {
|
||||||
return _cachedContractAddresses;
|
return _cachedContractAddresses;
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,10 @@ export class OrderValidationUtils {
|
|||||||
* @param supportedProvider Web3 provider to use for JSON RPC calls
|
* @param supportedProvider Web3 provider to use for JSON RPC calls
|
||||||
* @return An instance of OrderValidationUtils
|
* @return An instance of OrderValidationUtils
|
||||||
*/
|
*/
|
||||||
constructor(orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher, supportedProvider: SupportedProvider) {
|
constructor(
|
||||||
|
orderFilledCancelledFetcher: AbstractOrderFilledCancelledFetcher,
|
||||||
|
supportedProvider: SupportedProvider,
|
||||||
|
) {
|
||||||
this._orderFilledCancelledFetcher = orderFilledCancelledFetcher;
|
this._orderFilledCancelledFetcher = orderFilledCancelledFetcher;
|
||||||
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
this._provider = provider;
|
this._provider = provider;
|
||||||
|
@ -91,7 +91,11 @@ export const signatureUtils = {
|
|||||||
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
|
* @param signerAddress The hex encoded address that signed the data, producing the supplied signature.
|
||||||
* @return Whether the data was preSigned by the supplied signerAddress
|
* @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);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isHexString('data', data);
|
assert.isHexString('data', data);
|
||||||
assert.isETHAddressHex('signerAddress', signerAddress);
|
assert.isETHAddressHex('signerAddress', signerAddress);
|
||||||
@ -210,7 +214,11 @@ export const signatureUtils = {
|
|||||||
* must be available via the supplied Provider.
|
* must be available via the supplied Provider.
|
||||||
* @return A SignedOrder containing the order and Elliptic curve signature with Signature Type.
|
* @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]);
|
assert.doesConformToSchema('order', order, schemas.orderSchema, [schemas.hexSchema]);
|
||||||
try {
|
try {
|
||||||
const signedOrder = await signatureUtils.ecSignTypedDataOrderAsync(supportedProvider, order, signerAddress);
|
const signedOrder = await signatureUtils.ecSignTypedDataOrderAsync(supportedProvider, order, signerAddress);
|
||||||
@ -241,7 +249,11 @@ export const signatureUtils = {
|
|||||||
* must be available via the supplied Provider.
|
* must be available via the supplied Provider.
|
||||||
* @return A SignedOrder containing the order and Elliptic curve signature with Signature Type.
|
* @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);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isETHAddressHex('signerAddress', signerAddress);
|
assert.isETHAddressHex('signerAddress', signerAddress);
|
||||||
assert.doesConformToSchema('order', order, schemas.orderSchema, [schemas.hexSchema]);
|
assert.doesConformToSchema('order', order, schemas.orderSchema, [schemas.hexSchema]);
|
||||||
@ -280,7 +292,11 @@ export const signatureUtils = {
|
|||||||
* must be available via the supplied Provider.
|
* 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.
|
* @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);
|
const provider = providerUtils.standardizeOrThrow(supportedProvider);
|
||||||
assert.isHexString('msgHash', msgHash);
|
assert.isHexString('msgHash', msgHash);
|
||||||
assert.isETHAddressHex('signerAddress', signerAddress);
|
assert.isETHAddressHex('signerAddress', signerAddress);
|
||||||
|
@ -34,7 +34,13 @@ import {
|
|||||||
} from '@0x/order-utils';
|
} from '@0x/order-utils';
|
||||||
import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder, Stats } from '@0x/types';
|
import { AssetProxyId, ExchangeContractErrs, OrderState, SignedOrder, Stats } from '@0x/types';
|
||||||
import { errorUtils, intervalUtils, providerUtils } from '@0x/utils';
|
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 * as _ from 'lodash';
|
||||||
|
|
||||||
import { orderWatcherPartialConfigSchema } from '../schemas/order_watcher_partial_config_schema';
|
import { orderWatcherPartialConfigSchema } from '../schemas/order_watcher_partial_config_schema';
|
||||||
|
@ -17,7 +17,12 @@ export const assert = {
|
|||||||
signature: string,
|
signature: string,
|
||||||
signerAddress: string,
|
signerAddress: string,
|
||||||
): Promise<void> {
|
): 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`);
|
assert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -22,7 +22,13 @@ import {
|
|||||||
import { SignedOrder, Token as ZeroExToken } from '@0x/types';
|
import { SignedOrder, Token as ZeroExToken } from '@0x/types';
|
||||||
import { BigNumber, intervalUtils, logUtils, providerUtils } from '@0x/utils';
|
import { BigNumber, intervalUtils, logUtils, providerUtils } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
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 _ from 'lodash';
|
||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user