@0x/base-contract: Make PromiseWithTransactionHash fully compatible with regular Promise types.
`@0x/contracts/exchange` Make `OrderValidator` and `WalletOrderValidator` signature types checked for every fill (not just first)'
This commit is contained in:
committed by
Amir Bandeali
parent
2e5645108b
commit
5f8ebc3601
@@ -38,19 +38,27 @@ export interface AbiEncoderByFunctionSignature {
|
||||
* `awaitTransactionSuccessAsync()`.
|
||||
* Maybe there's a better place for this.
|
||||
*/
|
||||
export class PromiseWithTransactionHash<T> implements PromiseLike<T> {
|
||||
export class PromiseWithTransactionHash<T> implements Promise<T> {
|
||||
public readonly txHashPromise: Promise<string>;
|
||||
private readonly _promise: Promise<T>;
|
||||
constructor(txHashPromise: Promise<string>, promise: Promise<T>) {
|
||||
this.txHashPromise = txHashPromise;
|
||||
this._promise = promise;
|
||||
}
|
||||
// tslint:disable-next-line:async-suffix
|
||||
public then<TResult>(
|
||||
onFulfilled?: (v: T) => TResult | PromiseLike<TResult>,
|
||||
onRejected?: (reason: any) => PromiseLike<never>,
|
||||
): PromiseLike<TResult> {
|
||||
onFulfilled?: (v: T) => TResult | Promise<TResult>,
|
||||
onRejected?: (reason: any) => Promise<never>,
|
||||
): Promise<TResult> {
|
||||
return this._promise.then<TResult>(onFulfilled, onRejected);
|
||||
}
|
||||
// tslint:disable-next-line:async-suffix
|
||||
public catch<TResult>(onRejected?: (reason: any) => Promise<TResult>): Promise<TResult | T> {
|
||||
return this._promise.catch(onRejected);
|
||||
}
|
||||
get [Symbol.toStringTag](): 'Promise' {
|
||||
return this._promise[Symbol.toStringTag];
|
||||
}
|
||||
}
|
||||
|
||||
export class BaseContract {
|
||||
|
||||
Reference in New Issue
Block a user