2019-05-14 18:48:48 -04:00
|
|
|
"use strict";
|
|
|
|
var __extends = (this && this.__extends) || (function () {
|
|
|
|
var extendStatics = function (d, b) {
|
|
|
|
extendStatics = Object.setPrototypeOf ||
|
|
|
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
|
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
|
|
return extendStatics(d, b);
|
|
|
|
};
|
|
|
|
return function (d, b) {
|
|
|
|
extendStatics(d, b);
|
|
|
|
function __() { this.constructor = d; }
|
|
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
|
var bytes_1 = require("@ethersproject/bytes");
|
|
|
|
var properties_1 = require("@ethersproject/properties");
|
2019-08-02 02:10:58 -04:00
|
|
|
var logger_1 = require("@ethersproject/logger");
|
|
|
|
var _version_1 = require("./_version");
|
|
|
|
var logger = new logger_1.Logger(_version_1.version);
|
2019-05-14 18:48:48 -04:00
|
|
|
;
|
|
|
|
;
|
|
|
|
//export type CallTransactionable = {
|
|
|
|
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
|
|
|
|
//};
|
2019-06-11 17:57:04 -04:00
|
|
|
var ForkEvent = /** @class */ (function (_super) {
|
|
|
|
__extends(ForkEvent, _super);
|
|
|
|
function ForkEvent() {
|
|
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
2019-05-14 18:48:48 -04:00
|
|
|
}
|
2019-06-11 17:57:04 -04:00
|
|
|
ForkEvent.isForkEvent = function (value) {
|
|
|
|
return !!(value && value._isForkEvent);
|
|
|
|
};
|
2019-05-14 18:48:48 -04:00
|
|
|
return ForkEvent;
|
2019-06-11 17:57:04 -04:00
|
|
|
}(properties_1.Description));
|
2019-05-14 18:48:48 -04:00
|
|
|
exports.ForkEvent = ForkEvent;
|
|
|
|
var BlockForkEvent = /** @class */ (function (_super) {
|
|
|
|
__extends(BlockForkEvent, _super);
|
2020-05-21 00:07:41 -04:00
|
|
|
function BlockForkEvent(blockHash, expiry) {
|
2019-05-14 18:48:48 -04:00
|
|
|
var _this = this;
|
2020-05-21 00:07:41 -04:00
|
|
|
if (!bytes_1.isHexString(blockHash, 32)) {
|
|
|
|
logger.throwArgumentError("invalid blockHash", "blockHash", blockHash);
|
2019-05-14 18:48:48 -04:00
|
|
|
}
|
2019-06-11 17:57:04 -04:00
|
|
|
_this = _super.call(this, {
|
|
|
|
_isForkEvent: true,
|
|
|
|
_isBlockForkEvent: true,
|
|
|
|
expiry: (expiry || 0),
|
2020-05-21 00:07:41 -04:00
|
|
|
blockHash: blockHash
|
2019-06-11 17:57:04 -04:00
|
|
|
}) || this;
|
2019-05-14 18:48:48 -04:00
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
return BlockForkEvent;
|
|
|
|
}(ForkEvent));
|
|
|
|
exports.BlockForkEvent = BlockForkEvent;
|
|
|
|
var TransactionForkEvent = /** @class */ (function (_super) {
|
|
|
|
__extends(TransactionForkEvent, _super);
|
|
|
|
function TransactionForkEvent(hash, expiry) {
|
|
|
|
var _this = this;
|
|
|
|
if (!bytes_1.isHexString(hash, 32)) {
|
2019-08-02 02:10:58 -04:00
|
|
|
logger.throwArgumentError("invalid transaction hash", "hash", hash);
|
2019-05-14 18:48:48 -04:00
|
|
|
}
|
2019-06-11 17:57:04 -04:00
|
|
|
_this = _super.call(this, {
|
|
|
|
_isForkEvent: true,
|
|
|
|
_isTransactionForkEvent: true,
|
|
|
|
expiry: (expiry || 0),
|
|
|
|
hash: hash
|
|
|
|
}) || this;
|
2019-05-14 18:48:48 -04:00
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
return TransactionForkEvent;
|
|
|
|
}(ForkEvent));
|
|
|
|
exports.TransactionForkEvent = TransactionForkEvent;
|
|
|
|
var TransactionOrderForkEvent = /** @class */ (function (_super) {
|
|
|
|
__extends(TransactionOrderForkEvent, _super);
|
|
|
|
function TransactionOrderForkEvent(beforeHash, afterHash, expiry) {
|
|
|
|
var _this = this;
|
|
|
|
if (!bytes_1.isHexString(beforeHash, 32)) {
|
2019-08-02 02:10:58 -04:00
|
|
|
logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash);
|
2019-05-14 18:48:48 -04:00
|
|
|
}
|
|
|
|
if (!bytes_1.isHexString(afterHash, 32)) {
|
2019-08-02 02:10:58 -04:00
|
|
|
logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
|
2019-05-14 18:48:48 -04:00
|
|
|
}
|
2019-06-11 17:57:04 -04:00
|
|
|
_this = _super.call(this, {
|
|
|
|
_isForkEvent: true,
|
|
|
|
_isTransactionOrderForkEvent: true,
|
|
|
|
expiry: (expiry || 0),
|
|
|
|
beforeHash: beforeHash,
|
|
|
|
afterHash: afterHash
|
|
|
|
}) || this;
|
2019-05-14 18:48:48 -04:00
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
return TransactionOrderForkEvent;
|
|
|
|
}(ForkEvent));
|
|
|
|
exports.TransactionOrderForkEvent = TransactionOrderForkEvent;
|
|
|
|
///////////////////////////////
|
|
|
|
// Exported Abstracts
|
|
|
|
var Provider = /** @class */ (function () {
|
|
|
|
function Provider() {
|
|
|
|
var _newTarget = this.constructor;
|
2019-08-03 01:07:19 -04:00
|
|
|
logger.checkAbstract(_newTarget, Provider);
|
2019-06-11 17:57:04 -04:00
|
|
|
properties_1.defineReadOnly(this, "_isProvider", true);
|
2019-05-14 18:48:48 -04:00
|
|
|
}
|
|
|
|
// Alias for "on"
|
|
|
|
Provider.prototype.addListener = function (eventName, listener) {
|
|
|
|
return this.on(eventName, listener);
|
|
|
|
};
|
|
|
|
// Alias for "off"
|
|
|
|
Provider.prototype.removeListener = function (eventName, listener) {
|
|
|
|
return this.off(eventName, listener);
|
|
|
|
};
|
2019-06-11 17:57:04 -04:00
|
|
|
Provider.isProvider = function (value) {
|
|
|
|
return !!(value && value._isProvider);
|
|
|
|
};
|
2019-05-14 18:48:48 -04:00
|
|
|
return Provider;
|
|
|
|
}());
|
|
|
|
exports.Provider = Provider;
|
2020-07-13 08:03:56 -04:00
|
|
|
//# sourceMappingURL=index.js.map
|