"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddressList = void 0;
var tslib_1 = require("tslib");
var superstruct_1 = require("superstruct");
var abstract_1 = require("./abstract");
var DEFAULT_NAME = "bybit";
var DEFAULT_URL = "https://hackscan.hackbounty.io/public/hack-address.json";
var bybitResponse = (0, superstruct_1.type)({
    "0221": (0, superstruct_1.type)({
        eth: (0, superstruct_1.defaulted)((0, superstruct_1.array)((0, superstruct_1.string)()), []),
        bsc: (0, superstruct_1.defaulted)((0, superstruct_1.array)((0, superstruct_1.string)()), []),
        arbi: (0, superstruct_1.defaulted)((0, superstruct_1.array)((0, superstruct_1.string)()), []),
    }),
});
var AddressList = (function (_super) {
    tslib_1.__extends(AddressList, _super);
    function AddressList(opts) {
        var _a, _b;
        return _super.call(this, (_a = opts === null || opts === void 0 ? void 0 : opts.name) !== null && _a !== void 0 ? _a : DEFAULT_NAME, (_b = opts === null || opts === void 0 ? void 0 : opts.path) !== null && _b !== void 0 ? _b : DEFAULT_URL, opts) || this;
    }
    AddressList.prototype.update = function () {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var response;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4, this.fetch(this.name, this.path, this.timeout, this.retries)];
                    case 1:
                        response = _a.sent();
                        if (!bybitResponse.is(response)) {
                            return [2, this.error("Failed to validate response")];
                        }
                        return [2, tslib_1.__spreadArray(tslib_1.__spreadArray(tslib_1.__spreadArray([], response["0221"].eth, true), response["0221"].bsc, true), response["0221"].arbi, true)];
                }
            });
        });
    };
    return AddressList;
}(abstract_1.AbstractAdapter));
exports.AddressList = AddressList;
//# sourceMappingURL=bybit.js.map