@zoralabs/nft-cli
Advanced tools
Comparing version 0.0.5 to 0.0.6
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.mintsCommand = void 0; | ||
const queries_sdk_1 = require("@zoralabs/zdk-alpha/dist/queries/queries-sdk"); | ||
const queries_sdk_1 = require("@zoralabs/zdk/dist/queries/queries-sdk"); | ||
const parsers_1 = require("../parsers"); | ||
@@ -68,5 +68,5 @@ const utils_1 = require("../utils"); | ||
} | ||
const mintsFull = await (0, utils_1.fetchLoop)(async (offset, limit) => { | ||
const mintsFull = await (0, utils_1.fetchLoop)(async (after, limit) => { | ||
const result = await (0, utils_1.getZdk)().mints({ | ||
pagination: { limit: limit, offset }, | ||
pagination: { limit: limit, after }, | ||
where: where, | ||
@@ -80,3 +80,6 @@ filter: {}, | ||
}); | ||
return result.mints.nodes; | ||
return [ | ||
result.mints.nodes, | ||
result.mints.pageInfo.endCursor || undefined, | ||
]; | ||
}, options.limit); | ||
@@ -83,0 +86,0 @@ if (options.count) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.salesCommand = void 0; | ||
const queries_sdk_1 = require("@zoralabs/zdk-alpha/dist/queries/queries-sdk"); | ||
const queries_sdk_1 = require("@zoralabs/zdk/dist/queries/queries-sdk"); | ||
const parsers_1 = require("../parsers"); | ||
const utils_1 = require("../utils"); | ||
const SALES_SORT_FIELD_MAP = { | ||
eth: queries_sdk_1.SaleSortKey.EthPrice, | ||
eth: queries_sdk_1.SaleSortKey.ChainTokenPrice, | ||
price: queries_sdk_1.SaleSortKey.NativePrice, | ||
@@ -76,5 +76,5 @@ time: queries_sdk_1.SaleSortKey.Time, | ||
} | ||
const salesFull = await (0, utils_1.fetchLoop)(async (offset, limit) => { | ||
const salesFull = await (0, utils_1.fetchLoop)(async (after, limit) => { | ||
const result = await (0, utils_1.getZdk)().sales({ | ||
pagination: { limit: Math.min(limit, 200), offset }, | ||
pagination: { limit: Math.min(limit, 200), after }, | ||
where: where, | ||
@@ -88,3 +88,6 @@ filter: filter, | ||
}); | ||
return result.sales.nodes; | ||
return [ | ||
result.sales.nodes, | ||
result.sales.pageInfo.endCursor || undefined, | ||
]; | ||
}, options.limit); | ||
@@ -91,0 +94,0 @@ if (options.count) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.tokensCommand = void 0; | ||
const queries_sdk_1 = require("@zoralabs/zdk-alpha/dist/queries/queries-sdk"); | ||
const queries_sdk_1 = require("@zoralabs/zdk/dist/queries/queries-sdk"); | ||
const parsers_1 = require("../parsers"); | ||
const utils_1 = require("../utils"); | ||
const TOKENS_SORT_FIELD_MAP = { | ||
eth: queries_sdk_1.TokenSortKey.EthPrice, | ||
eth: queries_sdk_1.TokenSortKey.ChainTokenPrice, | ||
minted: queries_sdk_1.TokenSortKey.Minted, | ||
@@ -64,5 +64,5 @@ price: queries_sdk_1.TokenSortKey.NativePrice, | ||
} | ||
const tokensFull = await (0, utils_1.fetchLoop)(async (offset, limit) => { | ||
const tokensFull = await (0, utils_1.fetchLoop)(async (after, limit) => { | ||
const result = await (0, utils_1.getZdk)().tokens({ | ||
pagination: { limit: Math.min(limit, 200), offset }, | ||
pagination: { limit: Math.min(limit, 400), after }, | ||
where: where, | ||
@@ -76,3 +76,6 @@ filter: {}, | ||
}); | ||
return result.tokens.nodes; | ||
return [ | ||
result.tokens.nodes, | ||
result.tokens.pageInfo.endCursor || undefined, | ||
]; | ||
}, options.limit); | ||
@@ -79,0 +82,0 @@ if (options.count) { |
@@ -1,3 +0,3 @@ | ||
import { ZDK } from "@zoralabs/zdk-alpha"; | ||
import { Chain, Network } from "@zoralabs/zdk-alpha/dist/queries/queries-sdk"; | ||
import { ZDK } from "@zoralabs/zdk"; | ||
import { Chain, Network } from "@zoralabs/zdk/dist/queries/queries-sdk"; | ||
export declare function getZdk(): ZDK; | ||
@@ -8,3 +8,3 @@ export declare const networksDefault: { | ||
}[]; | ||
export declare function fetchLoop<T>(fetchFn: (offset: number, limit: number) => Promise<T[]>, userLimit: number, maxLimit?: number): Promise<T[]>; | ||
export declare function fetchLoop<T>(fetchFn: (after: string | undefined, limit: number) => Promise<[T[], string | undefined]>, userLimit: number, maxLimit?: number): Promise<T[]>; | ||
export declare function processResult(fields: string[] | undefined, header: boolean, type: "csv" | "json"): <R>(results: R[]) => void; |
@@ -5,4 +5,4 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const zdk_alpha_1 = require("@zoralabs/zdk-alpha"); | ||
const queries_sdk_1 = require("@zoralabs/zdk-alpha/dist/queries/queries-sdk"); | ||
const zdk_1 = require("@zoralabs/zdk"); | ||
const queries_sdk_1 = require("@zoralabs/zdk/dist/queries/queries-sdk"); | ||
const lodash_1 = require("lodash"); | ||
@@ -17,3 +17,3 @@ // @ts-ignore | ||
function getZdk() { | ||
return new zdk_alpha_1.ZDK(); | ||
return new zdk_1.ZDK(); | ||
} | ||
@@ -52,8 +52,9 @@ exports.getZdk = getZdk; | ||
const fullLimit = Math.min(userLimit, maxLimit); | ||
let offset = 0; | ||
let last; | ||
do { | ||
mintsPage = await fetchFn(offset, Math.min(fullLimit, constants_1.PAGE_LIMIT)); | ||
// @ts-ignore | ||
const [mintsPage, endCursor] = await fetchFn(last, Math.min(fullLimit, constants_1.PAGE_LIMIT)); | ||
pageCount += 1; | ||
mintsFull = mintsFull.concat(mintsPage); | ||
offset = mintsFull.length; | ||
last = endCursor; | ||
} while (mintsPage.length > 0 && mintsFull.length <= fullLimit); | ||
@@ -60,0 +61,0 @@ clearInterval(pulseInterval); |
{ | ||
"name": "@zoralabs/nft-cli", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"main": "dist/index.js", | ||
@@ -23,3 +23,3 @@ "author": "iain <iain@zora.co>", | ||
"@types/lodash": "^4.14.182", | ||
"@zoralabs/zdk-alpha": "^0.0.40", | ||
"@zoralabs/zdk": "^2.0.0", | ||
"chalk": "^5.0.1", | ||
@@ -26,0 +26,0 @@ "chrono-node": "2.3.8", |
21310
479
+ Added@zoralabs/zdk@^2.0.0
+ Added@zoralabs/zdk@2.4.0(transitive)
- Removed@zoralabs/zdk-alpha@^0.0.40
- Removed@zoralabs/zdk-alpha@0.0.40(transitive)