Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blockfrost/blockfrost-js

Package Overview
Dependencies
Maintainers
2
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockfrost/blockfrost-js - npm Package Compare versions

Comparing version 3.0.0-beta.3 to 3.0.0-beta.4

49

lib/BlockFrostAPI.d.ts

@@ -7,4 +7,4 @@ import { Got } from 'got';

import { blocks, blocksLatest, blocksLatestTxs, blocksLatestTxsAll, blocksNext, blocksPrevious, blocksTxs, blocksTxsAll } from './endpoints/api/blocks';
import { epochs, epochsBlocks, epochsBlocksByPoolId, epochsLatest, epochsNext, epochsParameters, epochsPrevious, epochsStakes, epochsStakesByPoolId } from './endpoints/api/epochs';
import { pools, poolMetadata, poolsById, poolsByIdBlocks, poolsByIdDelegators, poolsByIdHistory, poolsByIdRelays, poolsByIdUpdates, poolsRetired, poolsRetiring } from './endpoints/api/pools';
import { epochs, epochsBlocks, epochsBlocksAll, epochsBlocksByPoolId, epochsBlocksByPoolIdAll, epochsLatest, epochsNext, epochsParameters, epochsPrevious, epochsStakes, epochsStakesAll, epochsStakesByPoolId, epochsStakesByPoolIdAll } from './endpoints/api/epochs';
import { pools, poolsAll, poolMetadata, poolsById, poolsByIdBlocks, poolsByIdDelegators, poolsByIdHistory, poolsByIdRelays, poolsByIdUpdates, poolsRetired, poolsRetiring } from './endpoints/api/pools';
import { genesis } from './endpoints/api/ledger';

@@ -340,5 +340,14 @@ import { root } from './endpoints/api/root';

/**
* epochsBlocksAll
*
* @param number
* @returns xxx
*
*/
epochsBlocksAll: typeof epochsBlocksAll;
/**
* epochsBlocksByPoolId
*
* @param blocksTxs
* @param number
* @param poolId
* @returns xxx

@@ -349,2 +358,11 @@ *

/**
* epochsBlocksByPoolIdAll
*
* @param number
* @param poolId
* @returns xxx
*
*/
epochsBlocksByPoolIdAll: typeof epochsBlocksByPoolIdAll;
/**
* epochsLatest

@@ -389,5 +407,14 @@ *

/**
* epochsStakesAll
*
* @param number
* @returns xxx
*
*/
epochsStakesAll: typeof epochsStakesAll;
/**
* epochsStakesByPoolId
*
* @param number
* @param poolId
* @returns xxx

@@ -398,2 +425,11 @@ *

/**
* epochsStakesByPoolIdAll
*
* @param number
* @param poolId
* @returns xxx
*
*/
epochsStakesByPoolIdAll: typeof epochsStakesByPoolIdAll;
/**
* health

@@ -514,2 +550,9 @@ *

/**
* poolsAll
*
* @returns xxx
*
*/
poolsAll: typeof poolsAll;
/**
* poolMetadata

@@ -516,0 +559,0 @@ *

@@ -345,5 +345,14 @@ "use strict";

/**
* epochsBlocksAll
*
* @param number
* @returns xxx
*
*/
this.epochsBlocksAll = epochs_1.epochsBlocksAll;
/**
* epochsBlocksByPoolId
*
* @param blocksTxs
* @param number
* @param poolId
* @returns xxx

@@ -354,2 +363,11 @@ *

/**
* epochsBlocksByPoolIdAll
*
* @param number
* @param poolId
* @returns xxx
*
*/
this.epochsBlocksByPoolIdAll = epochs_1.epochsBlocksByPoolIdAll;
/**
* epochsLatest

@@ -394,5 +412,14 @@ *

/**
* epochsStakesAll
*
* @param number
* @returns xxx
*
*/
this.epochsStakesAll = epochs_1.epochsStakesAll;
/**
* epochsStakesByPoolId
*
* @param number
* @param poolId
* @returns xxx

@@ -403,2 +430,11 @@ *

/**
* epochsStakesByPoolIdAll
*
* @param number
* @param poolId
* @returns xxx
*
*/
this.epochsStakesByPoolIdAll = epochs_1.epochsStakesByPoolIdAll;
/**
* health

@@ -519,2 +555,9 @@ *

/**
* poolsAll
*
* @returns xxx
*
*/
this.poolsAll = pools_1.poolsAll;
/**
* poolMetadata

@@ -521,0 +564,0 @@ *

201

lib/endpoints/api/accounts/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.accountsAddressesAssetsAll = exports.accountsAddressesAssets = exports.accountsAddressesAll = exports.accountsAddresses = exports.accountsRegistrationsAll = exports.accountsRegistrations = exports.accountsDelegationsAll = exports.accountsDelegations = exports.accountsMirsAll = exports.accountsMirs = exports.accountsWithdrawalsAll = exports.accountsWithdrawals = exports.accountsHistoryAll = exports.accountsHistory = exports.accountsRewardsAll = exports.accountsRewards = exports.accounts = void 0;
const config_1 = require("../../../config");
const utils_1 = require("../../../utils");

@@ -35,26 +34,3 @@ const errors_1 = require("../../../utils/errors");

async function accountsRewardsAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsRewards(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsRewards(stakeAddress, pagination), allMethodOptions);
}

@@ -80,26 +56,3 @@ exports.accountsRewardsAll = accountsRewardsAll;

async function accountsHistoryAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsHistory(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsHistory(stakeAddress, pagination), allMethodOptions);
}

@@ -125,26 +78,3 @@ exports.accountsHistoryAll = accountsHistoryAll;

async function accountsWithdrawalsAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsWithdrawals(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsWithdrawals(stakeAddress, pagination), allMethodOptions);
}

@@ -170,26 +100,3 @@ exports.accountsWithdrawalsAll = accountsWithdrawalsAll;

async function accountsMirsAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsMirs(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsMirs(stakeAddress, pagination), allMethodOptions);
}

@@ -215,26 +122,3 @@ exports.accountsMirsAll = accountsMirsAll;

async function accountsDelegationsAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const options = utils_1.getAllMethodOptions(allMethodOptions);
const res = [];
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsDelegations(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsDelegations(stakeAddress, pagination), allMethodOptions);
}

@@ -260,26 +144,3 @@ exports.accountsDelegationsAll = accountsDelegationsAll;

async function accountsRegistrationsAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsRegistrations(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsRegistrations(stakeAddress, pagination), allMethodOptions);
}

@@ -305,26 +166,3 @@ exports.accountsRegistrationsAll = accountsRegistrationsAll;

async function accountsAddressesAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsAddresses(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsAddresses(stakeAddress, pagination), allMethodOptions);
}

@@ -350,27 +188,4 @@ exports.accountsAddressesAll = accountsAddressesAll;

async function accountsAddressesAssetsAll(stakeAddress, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.accountsAddressesAssets(stakeAddress, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.accountsAddressesAssets(stakeAddress, pagination), allMethodOptions);
}
exports.accountsAddressesAssetsAll = accountsAddressesAssetsAll;

@@ -6,3 +6,2 @@ "use strict";

const errors_1 = require("../../../utils/errors");
const config_1 = require("../../../config");
async function addresses(address) {

@@ -54,29 +53,3 @@ return new Promise((resolve, reject) => {

async function addressesTransactionsAll(address, allMethodOptions, additionalOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.addressesTransactions(address, {
page: page + i,
count,
order: options.order,
}, {
from: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.from,
to: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.to,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod((pagination, additionalOptions) => this.addressesTransactions(address, pagination, additionalOptions), allMethodOptions, additionalOptions);
}

@@ -102,26 +75,4 @@ exports.addressesTransactionsAll = addressesTransactionsAll;

async function addressesUtxosAll(address, allMethodOptions) {
let page = 1;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.addressesUtxos(address, {
page: page + i,
count: config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT,
order: options.order,
}));
page += options.batchSize || config_1.DEFAULT_BATCH_SIZE;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.addressesUtxos(address, pagination), allMethodOptions);
}
exports.addressesUtxosAll = addressesUtxosAll;

@@ -6,3 +6,2 @@ "use strict";

const errors_1 = require("../../../utils/errors");
const config_1 = require("../../../config");
async function assets(pagination) {

@@ -53,26 +52,3 @@ const paginationOptions = utils_1.getPaginationOptions(pagination);

async function assetsHistoryAll(asset, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.assetsHistory(asset, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.assetsHistory(asset, pagination), allMethodOptions);
}

@@ -132,27 +108,4 @@ exports.assetsHistoryAll = assetsHistoryAll;

async function assetsPolicyByIdAll(policy, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.assetsPolicyById(policy, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.assetsPolicyById(policy, pagination), allMethodOptions);
}
exports.assetsPolicyByIdAll = assetsPolicyByIdAll;

@@ -6,3 +6,2 @@ "use strict";

const errors_1 = require("../../../utils/errors");
const config_1 = require("../../../config");
async function blocks(hashOrNumber) {

@@ -52,26 +51,3 @@ return new Promise((resolve, reject) => {

async function blocksLatestTxsAll(allMethodOptions) {
let page = 1;
const res = [];
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.blocksLatestTxs({
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.blocksLatestTxs(pagination), allMethodOptions);
}

@@ -137,27 +113,4 @@ exports.blocksLatestTxsAll = blocksLatestTxsAll;

async function blocksTxsAll(hashOrNumber, allMethodOptions) {
let page = 1;
const res = [];
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.blocksTxs(hashOrNumber, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.blocksTxs(hashOrNumber, pagination), allMethodOptions);
}
exports.blocksTxsAll = blocksTxsAll;

@@ -1,2 +0,2 @@

import { PaginationOptions } from '../../../types';
import { AllMethodOptions, PaginationOptions } from '../../../types';
import { components } from '../../../types/OpenApi';

@@ -9,5 +9,9 @@ import { BlockFrostAPI } from '../../../index';

export declare function epochsStakes(this: BlockFrostAPI, number: number, pagination?: PaginationOptions): Promise<components['schemas']['epoch_stake_content']>;
export declare function epochsStakesByPoolId(this: BlockFrostAPI, number: number, poolId: string, pagination?: PaginationOptions): Promise<components['schemas']['epoch_block_content']>;
export declare function epochsStakesAll(this: BlockFrostAPI, number: number, allMethodOptions?: AllMethodOptions): Promise<components['schemas']['epoch_stake_content']>;
export declare function epochsStakesByPoolId(this: BlockFrostAPI, number: number, poolId: string, pagination?: PaginationOptions): Promise<components['schemas']['epoch_stake_pool_content']>;
export declare function epochsStakesByPoolIdAll(this: BlockFrostAPI, number: number, poolId: string, allMethodOptions?: AllMethodOptions): Promise<components['schemas']['epoch_stake_pool_content']>;
export declare function epochsBlocks(this: BlockFrostAPI, number: number, pagination?: PaginationOptions): Promise<components['schemas']['epoch_block_content']>;
export declare function epochsBlocksByPoolId(this: BlockFrostAPI, number: number, poolId: string, pagination?: PaginationOptions): Promise<components['schemas']['epoch_stake_pool_content']>;
export declare function epochsBlocksAll(this: BlockFrostAPI, number: number, allMethodOptions?: AllMethodOptions): Promise<components['schemas']['epoch_block_content']>;
export declare function epochsBlocksByPoolId(this: BlockFrostAPI, number: number, poolId: string, pagination?: PaginationOptions): Promise<components['schemas']['epoch_block_content']>;
export declare function epochsBlocksByPoolIdAll(this: BlockFrostAPI, number: number, poolId: string, allMethodOptions?: AllMethodOptions): Promise<components['schemas']['epoch_block_content']>;
export declare function epochsParameters(this: BlockFrostAPI, number: number): Promise<components['schemas']['epoch_param_content']>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.epochsParameters = exports.epochsBlocksByPoolId = exports.epochsBlocks = exports.epochsStakesByPoolId = exports.epochsStakes = exports.epochsPrevious = exports.epochsNext = exports.epochsLatest = exports.epochs = void 0;
exports.epochsParameters = exports.epochsBlocksByPoolIdAll = exports.epochsBlocksByPoolId = exports.epochsBlocksAll = exports.epochsBlocks = exports.epochsStakesByPoolIdAll = exports.epochsStakesByPoolId = exports.epochsStakesAll = exports.epochsStakes = exports.epochsPrevious = exports.epochsNext = exports.epochsLatest = exports.epochs = void 0;
const utils_1 = require("../../../utils");

@@ -87,2 +87,6 @@ const errors_1 = require("../../../utils/errors");

exports.epochsStakes = epochsStakes;
async function epochsStakesAll(number, allMethodOptions) {
return utils_1.paginateMethod(pagination => this.epochsStakes(number, pagination), allMethodOptions);
}
exports.epochsStakesAll = epochsStakesAll;
async function epochsStakesByPoolId(number, poolId, pagination) {

@@ -107,2 +111,6 @@ const paginationOptions = utils_1.getPaginationOptions(pagination);

exports.epochsStakesByPoolId = epochsStakesByPoolId;
async function epochsStakesByPoolIdAll(number, poolId, allMethodOptions) {
return utils_1.paginateMethod(pagination => this.epochsStakesByPoolId(number, poolId, pagination), allMethodOptions);
}
exports.epochsStakesByPoolIdAll = epochsStakesByPoolIdAll;
async function epochsBlocks(number, pagination) {

@@ -127,2 +135,6 @@ const paginationOptions = utils_1.getPaginationOptions(pagination);

exports.epochsBlocks = epochsBlocks;
async function epochsBlocksAll(number, allMethodOptions) {
return utils_1.paginateMethod(pagination => this.epochsBlocks(number, pagination), allMethodOptions);
}
exports.epochsBlocksAll = epochsBlocksAll;
async function epochsBlocksByPoolId(number, poolId, pagination) {

@@ -147,2 +159,6 @@ const paginationOptions = utils_1.getPaginationOptions(pagination);

exports.epochsBlocksByPoolId = epochsBlocksByPoolId;
async function epochsBlocksByPoolIdAll(number, poolId, allMethodOptions) {
return utils_1.paginateMethod(pagination => this.epochsBlocksByPoolId(number, poolId, pagination), allMethodOptions);
}
exports.epochsBlocksByPoolIdAll = epochsBlocksByPoolIdAll;
async function epochsParameters(number) {

@@ -149,0 +165,0 @@ return new Promise((resolve, reject) => {

@@ -6,3 +6,2 @@ "use strict";

const errors_1 = require("../../../utils/errors");
const config_1 = require("../../../config");
async function nutlinkAddress(address) {

@@ -36,26 +35,3 @@ return new Promise((resolve, reject) => {

async function nutlinkAddressTickersAll(address, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.nutlinkAddressTickers(address, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.nutlinkAddressTickers(address, pagination), allMethodOptions);
}

@@ -81,26 +57,3 @@ exports.nutlinkAddressTickersAll = nutlinkAddressTickersAll;

async function nutlinkAddressTickerAll(address, ticker, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.nutlinkAddressTicker(address, ticker, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.nutlinkAddressTicker(address, ticker, pagination), allMethodOptions);
}

@@ -126,27 +79,4 @@ exports.nutlinkAddressTickerAll = nutlinkAddressTickerAll;

async function nutlinkTickersAll(ticker, allMethodOptions) {
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const res = [];
const options = utils_1.getAllMethodOptions(allMethodOptions);
const getPromiseBundle = () => {
const promises = [...Array(options.batchSize).keys()].map(i => this.nutlinkTickers(ticker, {
page: page + i,
count,
order: options.order,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const promiseBundle = getPromiseBundle();
const pages = await Promise.all(promiseBundle);
for (const page of pages) {
res.push(...page);
if (page.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res;
}
}
}
return utils_1.paginateMethod(pagination => this.nutlinkTickers(ticker, pagination), allMethodOptions);
}
exports.nutlinkTickersAll = nutlinkTickersAll;
import { components } from '../../../types/OpenApi';
import { BlockFrostAPI } from '../../../index';
import { PaginationOptions } from '../../../types';
import { AllMethodOptions, PaginationOptions } from '../../../types';
export declare function pools(this: BlockFrostAPI, pagination?: PaginationOptions): Promise<components['schemas']['pool_list']>;
export declare function poolsAll(this: BlockFrostAPI, allMethodOptions?: AllMethodOptions): Promise<components['schemas']['pool_list']>;
export declare function poolsRetired(this: BlockFrostAPI, pagination?: PaginationOptions): Promise<components['schemas']['pool_list_retire']>;

@@ -6,0 +7,0 @@ export declare function poolsRetiring(this: BlockFrostAPI, pagination?: PaginationOptions): Promise<components['schemas']['pool_list_retire']>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.poolsByIdUpdates = exports.poolsByIdBlocks = exports.poolsByIdDelegators = exports.poolsByIdRelays = exports.poolMetadata = exports.poolsByIdHistory = exports.poolsById = exports.poolsRetiring = exports.poolsRetired = exports.pools = void 0;
exports.poolsByIdUpdates = exports.poolsByIdBlocks = exports.poolsByIdDelegators = exports.poolsByIdRelays = exports.poolMetadata = exports.poolsByIdHistory = exports.poolsById = exports.poolsRetiring = exports.poolsRetired = exports.poolsAll = exports.pools = void 0;
const utils_1 = require("../../../utils");

@@ -25,2 +25,6 @@ const errors_1 = require("../../../utils/errors");

exports.pools = pools;
async function poolsAll(allMethodOptions) {
return utils_1.paginateMethod(pagination => this.pools(pagination), allMethodOptions);
}
exports.poolsAll = poolsAll;
async function poolsRetired(pagination) {

@@ -27,0 +31,0 @@ const paginationOptions = utils_1.getPaginationOptions(pagination);

@@ -10,3 +10,2 @@ import { CacheError, CancelError, TimeoutError, RequestError, ReadError, ParseError, UploadError, HTTPError, MaxRedirectsError, UnsupportedProtocolError, RequiredRetryOptions } from 'got';

customBackend: string;
isTestnet: boolean;
};

@@ -16,2 +15,3 @@ declare type AdditionalOptions = {

version?: number;
http2?: boolean;
userAgent?: string;

@@ -26,2 +26,3 @@ requestTimeout?: number;

requestTimeout: number;
http2?: boolean;
projectId?: string;

@@ -28,0 +29,0 @@ isTestnet?: boolean;

@@ -11,3 +11,3 @@ "use strict";

responseType: 'json',
http2: true,
http2: options.http2,
headers: {

@@ -14,0 +14,0 @@ project_id: options.projectId,

@@ -12,1 +12,2 @@ import { ParseAssetResult } from '../types/utils';

export declare const parseAsset: (hex: string) => ParseAssetResult;
export declare const paginateMethod: <T extends (pagination: PaginationOptions, additionalOptions?: AdditionalEndpointOptions | undefined) => any>(fn: T, allMethodOptions: AllMethodOptions | undefined, additionalOptions?: AdditionalEndpointOptions | undefined) => Promise<ReturnType<T>>;

@@ -6,7 +6,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.parseAsset = exports.getFingerprint = exports.getAllMethodOptions = exports.getPaginationOptions = exports.getAdditionalParams = exports.validateOptions = void 0;
exports.paginateMethod = exports.parseAsset = exports.getFingerprint = exports.getAllMethodOptions = exports.getPaginationOptions = exports.getAdditionalParams = exports.validateOptions = void 0;
const cip14_js_1 = __importDefault(require("@emurgo/cip14-js"));
const config_1 = require("../config");
const validateOptions = (options) => {
var _a;
var _a, _b, _c;
if (!options || (!options.customBackend && !options.projectId)) {

@@ -27,10 +27,29 @@ throw Error('Missing customBackend or projectId option');

projectId: options.projectId,
isTestnet: options.isTestnet,
isTestnet: (_a = options.isTestnet) !== null && _a !== void 0 ? _a : deriveTestnetOption(options.projectId, options.isTestnet),
version: options.version || config_1.DEFAULT_API_VERSION,
http2: (_b = options.http2) !== null && _b !== void 0 ? _b : true,
// see: https://github.com/sindresorhus/got/blob/main/documentation/7-retry.md#retry
retrySettings: options.retrySettings,
requestTimeout: (_a = options.requestTimeout) !== null && _a !== void 0 ? _a : 20000, // 20 seconds
requestTimeout: (_c = options.requestTimeout) !== null && _c !== void 0 ? _c : 20000, // 20 seconds
};
};
exports.validateOptions = validateOptions;
const deriveTestnetOption = (projectId, isTestnet) => {
if (!projectId)
return undefined;
if (projectId.includes('mainnet')) {
return false;
}
if (projectId.includes('testnet')) {
return true;
}
if (projectId.includes('ipfs')) {
return false;
}
if (!isTestnet) {
console.log('WARNING: Old token was used without isTestnet parameter switching to mainnet network');
return false;
}
return undefined;
};
const getAdditionalParams = (options) => {

@@ -100,1 +119,30 @@ if (!options) {

exports.parseAsset = parseAsset;
const paginateMethod = async (fn, allMethodOptions, additionalOptions) => {
const res = [];
let page = 1;
const count = config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT;
const options = exports.getAllMethodOptions(allMethodOptions);
const getSlice = () => {
const promises = [...Array(options.batchSize).keys()].map(i => fn({
page: page + i,
count,
order: options.order,
}, {
from: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.from,
to: additionalOptions === null || additionalOptions === void 0 ? void 0 : additionalOptions.to,
}));
page += options.batchSize;
return promises;
};
// eslint-disable-next-line no-constant-condition
while (true) {
const pages = await Promise.all(getSlice());
for (const p of pages) {
res.push(...p);
if (p.length < config_1.DEFAULT_PAGINATION_PAGE_ITEMS_COUNT) {
return res; // yikes
}
}
}
};
exports.paginateMethod = paginateMethod;
{
"name": "@blockfrost/blockfrost-js",
"version": "3.0.0-beta.3",
"version": "3.0.0-beta.4",
"description": "A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc