Skip to content

Commit 94b0abc

Browse files
committed
Updated dist files.
1 parent 72edcd0 commit 94b0abc

File tree

6 files changed

+54
-38
lines changed

6 files changed

+54
-38
lines changed

dist/ethers.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10712,17 +10712,19 @@ var BaseProvider = /** @class */ (function (_super) {
1071210712
if (confirmations == null) {
1071310713
confirmations = 1;
1071410714
}
10715-
return web_1.poll(function () {
10716-
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
10717-
if (confirmations === 0) {
10718-
return receipt;
10719-
}
10720-
if (receipt == null || receipt.confirmations < confirmations) {
10721-
return undefined;
10715+
if (confirmations === 0) {
10716+
return this.getTransactionReceipt(transactionHash);
10717+
}
10718+
return new Promise(function (resolve) {
10719+
var handler = function (receipt) {
10720+
if (receipt.confirmations < confirmations) {
10721+
return;
1072210722
}
10723-
return receipt;
10724-
});
10725-
}, { onceBlock: this });
10723+
_this.removeListener(transactionHash, handler);
10724+
resolve(receipt);
10725+
};
10726+
_this.on(transactionHash, handler);
10727+
});
1072610728
};
1072710729
BaseProvider.prototype.getBlockNumber = function () {
1072810730
var _this = this;
@@ -11225,13 +11227,19 @@ var BaseProvider = /** @class */ (function (_super) {
1122511227
});
1122611228
};
1122711229
BaseProvider.prototype.removeAllListeners = function (eventName) {
11228-
var eventTag = getEventTag(eventName);
11229-
this._events = this._events.filter(function (event) {
11230-
return (event.tag !== eventTag);
11231-
});
11232-
if (eventName === 'pending') {
11230+
if (eventName == null) {
11231+
this._events = [];
1123311232
this._stopPending();
1123411233
}
11234+
else {
11235+
var eventTag_1 = getEventTag(eventName);
11236+
this._events = this._events.filter(function (event) {
11237+
return (event.tag !== eventTag_1);
11238+
});
11239+
if (eventName === 'pending') {
11240+
this._stopPending();
11241+
}
11242+
}
1123511243
if (this._events.length === 0) {
1123611244
this.polling = false;
1123711245
}
@@ -11241,13 +11249,13 @@ var BaseProvider = /** @class */ (function (_super) {
1124111249
var found = false;
1124211250
var eventTag = getEventTag(eventName);
1124311251
this._events = this._events.filter(function (event) {
11244-
if (event.tag !== eventTag) {
11252+
if (event.tag !== eventTag || event.listener != listener) {
1124511253
return true;
1124611254
}
1124711255
if (found) {
1124811256
return true;
1124911257
}
11250-
found = false;
11258+
found = true;
1125111259
return false;
1125211260
});
1125311261
if (eventName === 'pending' && this.listenerCount('pending') === 0) {

dist/ethers.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ethers.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ethers.types.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ declare module 'ethers/providers/base-provider' {
784784
emit(eventName: EventType, ...args: Array<any>): boolean;
785785
listenerCount(eventName?: EventType): number;
786786
listeners(eventName: EventType): Array<Listener>;
787-
removeAllListeners(eventName: EventType): Provider;
787+
removeAllListeners(eventName?: EventType): Provider;
788788
removeListener(eventName: EventType, listener: Listener): Provider;
789789
}
790790
}

providers/base-provider.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,6 @@ export declare class BaseProvider extends Provider {
6969
emit(eventName: EventType, ...args: Array<any>): boolean;
7070
listenerCount(eventName?: EventType): number;
7171
listeners(eventName: EventType): Array<Listener>;
72-
removeAllListeners(eventName: EventType): Provider;
72+
removeAllListeners(eventName?: EventType): Provider;
7373
removeListener(eventName: EventType, listener: Listener): Provider;
7474
}

providers/base-provider.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -656,17 +656,19 @@ var BaseProvider = /** @class */ (function (_super) {
656656
if (confirmations == null) {
657657
confirmations = 1;
658658
}
659-
return web_1.poll(function () {
660-
return _this.getTransactionReceipt(transactionHash).then(function (receipt) {
661-
if (confirmations === 0) {
662-
return receipt;
663-
}
664-
if (receipt == null || receipt.confirmations < confirmations) {
665-
return undefined;
659+
if (confirmations === 0) {
660+
return this.getTransactionReceipt(transactionHash);
661+
}
662+
return new Promise(function (resolve) {
663+
var handler = function (receipt) {
664+
if (receipt.confirmations < confirmations) {
665+
return;
666666
}
667-
return receipt;
668-
});
669-
}, { onceBlock: this });
667+
_this.removeListener(transactionHash, handler);
668+
resolve(receipt);
669+
};
670+
_this.on(transactionHash, handler);
671+
});
670672
};
671673
BaseProvider.prototype.getBlockNumber = function () {
672674
var _this = this;
@@ -1169,13 +1171,19 @@ var BaseProvider = /** @class */ (function (_super) {
11691171
});
11701172
};
11711173
BaseProvider.prototype.removeAllListeners = function (eventName) {
1172-
var eventTag = getEventTag(eventName);
1173-
this._events = this._events.filter(function (event) {
1174-
return (event.tag !== eventTag);
1175-
});
1176-
if (eventName === 'pending') {
1174+
if (eventName == null) {
1175+
this._events = [];
11771176
this._stopPending();
11781177
}
1178+
else {
1179+
var eventTag_1 = getEventTag(eventName);
1180+
this._events = this._events.filter(function (event) {
1181+
return (event.tag !== eventTag_1);
1182+
});
1183+
if (eventName === 'pending') {
1184+
this._stopPending();
1185+
}
1186+
}
11791187
if (this._events.length === 0) {
11801188
this.polling = false;
11811189
}
@@ -1185,13 +1193,13 @@ var BaseProvider = /** @class */ (function (_super) {
11851193
var found = false;
11861194
var eventTag = getEventTag(eventName);
11871195
this._events = this._events.filter(function (event) {
1188-
if (event.tag !== eventTag) {
1196+
if (event.tag !== eventTag || event.listener != listener) {
11891197
return true;
11901198
}
11911199
if (found) {
11921200
return true;
11931201
}
1194-
found = false;
1202+
found = true;
11951203
return false;
11961204
});
11971205
if (eventName === 'pending' && this.listenerCount('pending') === 0) {

0 commit comments

Comments
 (0)