Fix up missing Provider interfaces and refactor providerUtils.standardizeOrThrow()
This commit is contained in:
@@ -19,7 +19,7 @@ export { SignedOrder } from '@0x/types';
|
||||
export {
|
||||
JSONRPCRequestPayload,
|
||||
JSONRPCErrorCallback,
|
||||
Provider,
|
||||
SupportedProvider,
|
||||
JSONRPCResponsePayload,
|
||||
JSONRPCResponseError,
|
||||
} from 'ethereum-types';
|
||||
|
||||
@@ -34,7 +34,7 @@ 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, Provider, SupportedProvider } 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';
|
||||
@@ -79,7 +79,7 @@ export class OrderWatcher {
|
||||
private readonly _orderStateByOrderHashCache: OrderStateByOrderHash = {};
|
||||
private readonly _orderByOrderHash: OrderByOrderHash = {};
|
||||
private readonly _eventWatcher: EventWatcher;
|
||||
private readonly _provider: Provider;
|
||||
private readonly _provider: ZeroExProvider;
|
||||
private readonly _collisionResistantAbiDecoder: CollisionResistanceAbiDecoder;
|
||||
private readonly _expirationWatcher: ExpirationWatcher;
|
||||
private readonly _orderStateUtils: OrderStateUtils;
|
||||
|
||||
@@ -5,19 +5,19 @@ import { Schema } from '@0x/json-schemas';
|
||||
import { ECSignature } from '@0x/types';
|
||||
import { BigNumber } from '@0x/utils';
|
||||
// tslint:enable:no-unused-variable
|
||||
import { Provider } from 'ethereum-types';
|
||||
import { SupportedProvider } from 'ethereum-types';
|
||||
|
||||
import { signatureUtils } from '@0x/order-utils';
|
||||
|
||||
export const assert = {
|
||||
...sharedAssert,
|
||||
async isValidSignatureAsync(
|
||||
provider: Provider,
|
||||
supportedProvider: SupportedProvider,
|
||||
orderHash: string,
|
||||
signature: string,
|
||||
signerAddress: string,
|
||||
): Promise<void> {
|
||||
const isValid = await signatureUtils.isValidSignatureAsync(provider, 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`);
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { web3Factory } from '@0x/dev-utils';
|
||||
import { Web3ProviderEngine } from '@0x/subproviders';
|
||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||
import { Provider } from 'ethereum-types';
|
||||
|
||||
const provider: Provider = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true });
|
||||
const provider: Web3ProviderEngine = web3Factory.getRpcProvider({ shouldUseInProcessGanache: true });
|
||||
const web3Wrapper = new Web3Wrapper(provider);
|
||||
|
||||
export { provider, web3Wrapper };
|
||||
|
||||
Reference in New Issue
Block a user