"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 RESPONSE_TYPE = (0, superstruct_1.array)((0, superstruct_1.string)());
var DEFAULT_NAME = "Risk Labs";
var DEFAULT_URL = "https://blacklist.risklabs.foundation/api/blacklist";
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, err_1;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0:
                        _a.trys.push([0, 2, , 3]);
                        return [4, this.fetch(this.name, this.path, this.timeout, this.retries)];
                    case 1:
                        response = _a.sent();
                        return [3, 3];
                    case 2:
                        err_1 = _a.sent();
                        return [2, this.error(err_1)];
                    case 3:
                        if (!RESPONSE_TYPE.is(response)) {
                            return [2, this.error("Failed to validate response")];
                        }
                        return [2, response];
                }
            });
        });
    };
    return AddressList;
}(abstract_1.AbstractAdapter));
exports.AddressList = AddressList;
//# sourceMappingURL=risklabs.js.map