"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.fetchHeightByTimestamp = exports.fetchHeight = exports.fetchDelay = exports.fetchLast = exports.fetchBlocksByAddress = exports.fetchFirst = exports.fetchBlockById = exports.fetchSeq = exports.fetchBlockAt = exports.fetchHeadersById = exports.fetchHeadersAt = exports.fetchHeightById = exports.fetchHeadersLast = exports.fetchHeadersSeq = void 0; var request_1 = __importDefault(require("../../tools/request")); /** * GET /blocks/headers/seq/{from}/{to} * Get block headers at specified heights * @param base * @param from * @param to */ function fetchHeadersSeq(base, from, to, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/headers/seq/" + from + "/" + to, options: options }); } exports.fetchHeadersSeq = fetchHeadersSeq; /** * GET /blocks/headers/last * Last block header * @param base */ function fetchHeadersLast(base, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/headers/last", options: options }); } exports.fetchHeadersLast = fetchHeadersLast; /** * GET /blocks/height/{id} * Height of a block by its id * @param base * @param id */ function fetchHeightById(base, id) { return request_1.default({ base: base, url: "/blocks/height/" + id }); } exports.fetchHeightById = fetchHeightById; /** * GET /blocks/headers/at/{height} * Block header at height * @param base * @param height */ function fetchHeadersAt(base, height, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/headers/at/" + height, options: options }); } exports.fetchHeadersAt = fetchHeadersAt; /** * GET /blocks/headers/{id} * Get block at specified height * @param base * @param height */ function fetchHeadersById(base, id, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/headers/" + id, options: options }); } exports.fetchHeadersById = fetchHeadersById; /** * GET /blocks/at/{height} * Get block at specified height * @param base * @param height */ function fetchBlockAt(base, height, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/at/" + height, options: options }); } exports.fetchBlockAt = fetchBlockAt; /** * GET /blocks/seq/{from}/{to} * Block range * @param base * @param from * @param to */ function fetchSeq(base, from, to, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/seq/" + from + "/" + to, options: options }); } exports.fetchSeq = fetchSeq; /** * GET /blocks/{id} * Get block by its id * @param base * @param id */ function fetchBlockById(base, id, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/" + id, options: options }); } exports.fetchBlockById = fetchBlockById; /** * GET /blocks/first * Get genesis block * @param base */ function fetchFirst(base, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/first", options: options }); } exports.fetchFirst = fetchFirst; /** * /blocks/address/{address}/{from}/{to} * Get list of blocks generated by specified address * @param base * @param address * @param from * @param to */ function fetchBlocksByAddress(base, address, from, to, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/address/" + address + "/" + from + "/" + to, options: options }); } exports.fetchBlocksByAddress = fetchBlocksByAddress; /** * GET /blocks/last * Last block * @param base */ function fetchLast(base, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: '/blocks/last', options: options }); } exports.fetchLast = fetchLast; /** * GET /blocks/delay/{id}/{blockNum} * Average delay in milliseconds between last blockNum blocks starting from block with id * @param base * @param id * @param blockNum */ function fetchDelay(base, id, blockNum) { return request_1.default({ base: base, url: "/blocks/delay/" + id + "/" + blockNum }); } exports.fetchDelay = fetchDelay; /** * GET /blocks/height * @param base */ function fetchHeight(base) { return request_1.default({ base: base, url: '/blocks/height' }); } exports.fetchHeight = fetchHeight; /** * GET /blocks/heightByTimestamp * @param base */ function fetchHeightByTimestamp(base, timestamp, options) { if (options === void 0) { options = Object.create(null); } return request_1.default({ base: base, url: "/blocks/heightByTimestamp/" + timestamp, options: options }); } exports.fetchHeightByTimestamp = fetchHeightByTimestamp; //# sourceMappingURL=index.js.map