2019-05-15 01:48:48 +03: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; }) ||
|
2021-03-08 02:24:04 +03:00
|
|
|
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
2019-05-15 01:48:48 +03:00
|
|
|
return extendStatics(d, b);
|
|
|
|
};
|
|
|
|
return function (d, b) {
|
2021-03-08 02:24:04 +03:00
|
|
|
if (typeof b !== "function" && b !== null)
|
|
|
|
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
2019-05-15 01:48:48 +03:00
|
|
|
extendStatics(d, b);
|
|
|
|
function __() { this.constructor = d; }
|
|
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
|
|
};
|
|
|
|
})();
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-03-08 02:24:04 +03:00
|
|
|
exports.Provider = exports.TransactionOrderForkEvent = exports.TransactionForkEvent = exports.BlockForkEvent = exports.ForkEvent = void 0;
|
2019-05-15 01:48:48 +03:00
|
|
|
var bytes_1 = require("@ethersproject/bytes");
|
|
|
|
var properties_1 = require("@ethersproject/properties");
|
2019-08-02 09:10:58 +03:00
|
|
|
var logger_1 = require("@ethersproject/logger");
|
|
|
|
var _version_1 = require("./_version");
|
|
|
|
var logger = new logger_1.Logger(_version_1.version);
|
2019-05-15 01:48:48 +03:00
|
|
|
;
|
|
|
|
;
|
|
|
|
//export type CallTransactionable = {
|
|
|
|
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
|
|
|
|
//};
|
2019-06-12 00:57:04 +03:00
|
|
|
var ForkEvent = /** @class */ (function (_super) {
|
|
|
|
__extends(ForkEvent, _super);
|
|
|
|
function ForkEvent() {
|
|
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
2019-05-15 01:48:48 +03:00
|
|
|
}
|
2019-06-12 00:57:04 +03:00
|
|
|
ForkEvent.isForkEvent = function (value) {
|
|
|
|
return !!(value && value._isForkEvent);
|
|
|
|
};
|
2019-05-15 01:48:48 +03:00
|
|
|
return ForkEvent;
|
2019-06-12 00:57:04 +03:00
|
|
|
}(properties_1.Description));
|
2019-05-15 01:48:48 +03:00
|
|
|
exports.ForkEvent = ForkEvent;
|
|
|
|
var BlockForkEvent = /** @class */ (function (_super) {
|
|
|
|
__extends(BlockForkEvent, _super);
|
2020-05-21 07:07:41 +03:00
|
|
|
function BlockForkEvent(blockHash, expiry) {
|
2019-05-15 01:48:48 +03:00
|
|
|
var _this = this;
|
2020-05-21 07:07:41 +03:00
|
|
|
if (!bytes_1.isHexString(blockHash, 32)) {
|
|
|
|
logger.throwArgumentError("invalid blockHash", "blockHash", blockHash);
|
2019-05-15 01:48:48 +03:00
|
|
|
}
|
2019-06-12 00:57:04 +03:00
|
|
|
_this = _super.call(this, {
|
|
|
|
_isForkEvent: true,
|
|
|
|
_isBlockForkEvent: true,
|
|
|
|
expiry: (expiry || 0),
|
2020-05-21 07:07:41 +03:00
|
|
|
blockHash: blockHash
|
2019-06-12 00:57:04 +03:00
|
|
|
}) || this;
|
2019-05-15 01:48:48 +03: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 09:10:58 +03:00
|
|
|
logger.throwArgumentError("invalid transaction hash", "hash", hash);
|
2019-05-15 01:48:48 +03:00
|
|
|
}
|
2019-06-12 00:57:04 +03:00
|
|
|
_this = _super.call(this, {
|
|
|
|
_isForkEvent: true,
|
|
|
|
_isTransactionForkEvent: true,
|
|
|
|
expiry: (expiry || 0),
|
|
|
|
hash: hash
|
|
|
|
}) || this;
|
2019-05-15 01:48:48 +03: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 09:10:58 +03:00
|
|
|
logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash);
|
2019-05-15 01:48:48 +03:00
|
|
|
}
|
|
|
|
if (!bytes_1.isHexString(afterHash, 32)) {
|
2019-08-02 09:10:58 +03:00
|
|
|
logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
|
2019-05-15 01:48:48 +03:00
|
|
|
}
|
2019-06-12 00:57:04 +03:00
|
|
|
_this = _super.call(this, {
|
|
|
|
_isForkEvent: true,
|
|
|
|
_isTransactionOrderForkEvent: true,
|
|
|
|
expiry: (expiry || 0),
|
|
|
|
beforeHash: beforeHash,
|
|
|
|
afterHash: afterHash
|
|
|
|
}) || this;
|
2019-05-15 01:48:48 +03:00
|
|
|
return _this;
|
|
|
|
}
|
|
|
|
return TransactionOrderForkEvent;
|
|
|
|
}(ForkEvent));
|
|
|
|
exports.TransactionOrderForkEvent = TransactionOrderForkEvent;
|
|
|
|
///////////////////////////////
|
|
|
|
// Exported Abstracts
|
|
|
|
var Provider = /** @class */ (function () {
|
|
|
|
function Provider() {
|
|
|
|
var _newTarget = this.constructor;
|
2019-08-03 08:07:19 +03:00
|
|
|
logger.checkAbstract(_newTarget, Provider);
|
2019-06-12 00:57:04 +03:00
|
|
|
properties_1.defineReadOnly(this, "_isProvider", true);
|
2019-05-15 01:48:48 +03: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-12 00:57:04 +03:00
|
|
|
Provider.isProvider = function (value) {
|
|
|
|
return !!(value && value._isProvider);
|
|
|
|
};
|
2019-05-15 01:48:48 +03:00
|
|
|
return Provider;
|
|
|
|
}());
|
|
|
|
exports.Provider = Provider;
|
2020-07-13 15:03:56 +03:00
|
|
|
//# sourceMappingURL=index.js.map
|