@cardano-sdk/blockfrost
Advanced tools
Comparing version 0.6.0-nightly.9 to 0.6.0-nightly.10
@@ -195,17 +195,20 @@ "use strict"; | ||
const transactionsByHashes = async ({ ids }) => Promise.all(ids.map((id) => fetchTransaction(id))); | ||
const transactionsByAddresses = async ({ addresses, sinceBlock }) => { | ||
const transactionsByAddresses = async ({ addresses, blockRange, pagination }) => { | ||
if (pagination) | ||
throw new core_1.ProviderError(core_1.ProviderFailure.NotImplemented); | ||
const addressTransactions = await Promise.all(addresses.map(async (address) => (0, util_1.fetchByAddressSequentially)({ | ||
address, | ||
haveEnoughItems: sinceBlock | ||
? (transactions) => transactions.length > 0 && transactions[transactions.length - 1].block_height < sinceBlock | ||
haveEnoughItems: blockRange?.lowerBound | ||
? (transactions) => transactions.length > 0 && transactions[transactions.length - 1].block_height < blockRange.lowerBound | ||
: undefined, | ||
paginationOptions: { count: 5, order: 'desc' }, | ||
request: (addr, pagination) => blockfrost.addressesTransactions(addr.toString(), pagination) | ||
request: (addr, paginationOptions) => blockfrost.addressesTransactions(addr.toString(), paginationOptions) | ||
}))); | ||
const allTransactions = (0, orderBy_1.default)(addressTransactions.flat(1), ['block_height', 'tx_index']); | ||
const addressTransactionsSinceBlock = sinceBlock | ||
? allTransactions.filter(({ block_height }) => block_height >= sinceBlock) | ||
const addressTransactionsSinceBlock = blockRange?.lowerBound | ||
? allTransactions.filter(({ block_height }) => block_height >= blockRange.lowerBound) | ||
: allTransactions; | ||
const ids = addressTransactionsSinceBlock.map(({ tx_hash }) => core_1.Cardano.TransactionId(tx_hash)); | ||
return transactionsByHashes({ ids }); | ||
const pageResults = await transactionsByHashes({ ids }); | ||
return { pageResults, totalResultCount: allTransactions.length }; | ||
}; | ||
@@ -212,0 +215,0 @@ return { |
@@ -189,17 +189,20 @@ import { BlockfrostToCore } from './BlockfrostToCore'; | ||
const transactionsByHashes = async ({ ids }) => Promise.all(ids.map((id) => fetchTransaction(id))); | ||
const transactionsByAddresses = async ({ addresses, sinceBlock }) => { | ||
const transactionsByAddresses = async ({ addresses, blockRange, pagination }) => { | ||
if (pagination) | ||
throw new ProviderError(ProviderFailure.NotImplemented); | ||
const addressTransactions = await Promise.all(addresses.map(async (address) => fetchByAddressSequentially({ | ||
address, | ||
haveEnoughItems: sinceBlock | ||
? (transactions) => transactions.length > 0 && transactions[transactions.length - 1].block_height < sinceBlock | ||
haveEnoughItems: blockRange?.lowerBound | ||
? (transactions) => transactions.length > 0 && transactions[transactions.length - 1].block_height < blockRange.lowerBound | ||
: undefined, | ||
paginationOptions: { count: 5, order: 'desc' }, | ||
request: (addr, pagination) => blockfrost.addressesTransactions(addr.toString(), pagination) | ||
request: (addr, paginationOptions) => blockfrost.addressesTransactions(addr.toString(), paginationOptions) | ||
}))); | ||
const allTransactions = orderBy(addressTransactions.flat(1), ['block_height', 'tx_index']); | ||
const addressTransactionsSinceBlock = sinceBlock | ||
? allTransactions.filter(({ block_height }) => block_height >= sinceBlock) | ||
const addressTransactionsSinceBlock = blockRange?.lowerBound | ||
? allTransactions.filter(({ block_height }) => block_height >= blockRange.lowerBound) | ||
: allTransactions; | ||
const ids = addressTransactionsSinceBlock.map(({ tx_hash }) => Cardano.TransactionId(tx_hash)); | ||
return transactionsByHashes({ ids }); | ||
const pageResults = await transactionsByHashes({ ids }); | ||
return { pageResults, totalResultCount: allTransactions.length }; | ||
}; | ||
@@ -206,0 +209,0 @@ return { |
{ | ||
"name": "@cardano-sdk/blockfrost", | ||
"version": "0.6.0-nightly.9", | ||
"version": "0.6.0-nightly.10", | ||
"description": "Blockfrost provider for Cardano JS SDK", | ||
@@ -62,3 +62,3 @@ "engines": { | ||
"@blockfrost/blockfrost-js": "npm:blockfrost-js-ratelimited@2.0.4", | ||
"@cardano-sdk/core": "^0.6.0-nightly.9", | ||
"@cardano-sdk/core": "^0.6.0-nightly.10", | ||
"@cardano-sdk/util": "^0.6.0-nightly.2", | ||
@@ -74,3 +74,3 @@ "lodash": "^4.17.21", | ||
], | ||
"gitHead": "5cb619833e5efa783a13de422da613bb5e9367cc" | ||
"gitHead": "1e00489fe324000ba09b79685d97119024802885" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
428197
1445
+ Addednanoid@3.3.8(transitive)
- Removednanoid@3.3.7(transitive)