diff options
Diffstat (limited to 'packages/order-watcher/src/utils/assert.ts')
-rw-r--r-- | packages/order-watcher/src/utils/assert.ts | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/packages/order-watcher/src/utils/assert.ts b/packages/order-watcher/src/utils/assert.ts index 5d7f72716..a891a60d2 100644 --- a/packages/order-watcher/src/utils/assert.ts +++ b/packages/order-watcher/src/utils/assert.ts @@ -1,17 +1,23 @@ import { assert as sharedAssert } from '@0xproject/assert'; -// We need those two unused imports because they're actually used by sharedAssert which gets injected here +// HACK: We need those two unused imports because they're actually used by sharedAssert which gets injected here // tslint:disable:no-unused-variable import { Schema } from '@0xproject/json-schemas'; import { ECSignature } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; // tslint:enable:no-unused-variable +import { Provider } from 'ethereum-types'; -import { isValidSignature } from '@0xproject/order-utils'; +import { isValidSignatureAsync } from '@0xproject/order-utils'; export const assert = { ...sharedAssert, - isValidSignature(orderHash: string, ecSignature: ECSignature, signerAddress: string): void { - const isValid = isValidSignature(orderHash, ecSignature, signerAddress); - this.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`); + async isValidSignatureAsync( + provider: Provider, + orderHash: string, + signature: string, + signerAddress: string, + ): Promise<void> { + const isValid = await isValidSignatureAsync(provider, orderHash, signature, signerAddress); + assert.assert(isValid, `Expected order with hash '${orderHash}' to have a valid signature`); }, }; |