@dcspark/carp-client
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -1,11 +0,3 @@ | ||
import type { EndpointTypes } from "../../shared/routes"; | ||
import type { ErrorShape } from "../../shared/errors"; | ||
import type { AxiosError, AxiosResponse } from "axios"; | ||
import type { Routes } from "../../shared/routes"; | ||
export type { RelationFilter, RelationFilterType, Pagination, UtxoPointer, } from "../../shared/models/common"; | ||
export * from "../../shared/routes"; | ||
export * from "../../shared/errors"; | ||
export type { EndpointTypes } from "../../shared/routes"; | ||
export type { ErrorShape } from "../../shared/errors"; | ||
export declare function query<T extends Routes>(urlBase: string, route: T, data: EndpointTypes[T]["input"]): Promise<EndpointTypes[T]["response"]>; | ||
export declare function getErrorResponse(err: AxiosError<ErrorShape, unknown>): AxiosResponse<ErrorShape, unknown>; | ||
export * from './template'; | ||
export * from './paginated'; | ||
export * from "../../shared"; |
@@ -16,20 +16,5 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getErrorResponse = exports.query = void 0; | ||
const axios_1 = __importDefault(require("axios")); | ||
__exportStar(require("../../shared/routes"), exports); | ||
__exportStar(require("../../shared/errors"), exports); | ||
async function query(urlBase, route, data) { | ||
const result = await axios_1.default.post(`${urlBase}/${route}`, data); | ||
return result.data; | ||
} | ||
exports.query = query; | ||
function getErrorResponse(err) { | ||
if (err.response == null) | ||
throw new Error(`Unexpected null response`); | ||
return err.response; | ||
} | ||
exports.getErrorResponse = getErrorResponse; | ||
__exportStar(require("./template"), exports); | ||
__exportStar(require("./paginated"), exports); | ||
__exportStar(require("../../shared"), exports); |
@@ -1,3 +0,3 @@ | ||
import type { EndpointTypes } from "./index"; | ||
import { Routes } from "./index"; | ||
import type { EndpointTypes } from "../../shared/routes"; | ||
import { Routes } from "../../shared/routes"; | ||
import type { Pagination } from "../../shared/models/common"; | ||
@@ -4,0 +4,0 @@ import type cml from "@dcspark/cardano-multiplatform-lib-nodejs"; |
@@ -7,4 +7,4 @@ "use strict"; | ||
exports.nftCborToJson = exports.paginatedMetadataNft = exports.paginatedTransactionHistory = exports.paginateQuery = void 0; | ||
const index_1 = require("./index"); | ||
const index_2 = require("./index"); | ||
const template_1 = require("./template"); | ||
const routes_1 = require("../../shared/routes"); | ||
const chunk_1 = __importDefault(require("lodash/chunk")); | ||
@@ -34,3 +34,3 @@ const constants_1 = require("../../shared/constants"); | ||
async function paginatedTransactionHistory(urlBase, initialRequest) { | ||
const result = await paginateQuery(initialRequest, async (request) => (await (0, index_1.query)(urlBase, index_2.Routes.transactionHistory, request)).transactions, (resp) => resp != null | ||
const result = await paginateQuery(initialRequest, async (request) => (await (0, template_1.query)(urlBase, routes_1.Routes.transactionHistory, request)).transactions, (resp) => resp != null | ||
? { | ||
@@ -65,3 +65,3 @@ block: resp.block.hash, | ||
let result = { cip25: {} }; | ||
const chunkedResult = await Promise.all((0, chunk_1.default)(pairs, constants_1.ASSET_LIMIT.REQUEST).map((chunk) => (0, index_1.query)(urlBase, index_2.Routes.metadataNft, pairsToAssetMap(chunk)))); | ||
const chunkedResult = await Promise.all((0, chunk_1.default)(pairs, constants_1.ASSET_LIMIT.REQUEST).map((chunk) => (0, template_1.query)(urlBase, routes_1.Routes.metadataNft, pairsToAssetMap(chunk)))); | ||
for (const chunk of chunkedResult) { | ||
@@ -68,0 +68,0 @@ result = (0, merge_1.default)(result, chunk); |
{ | ||
"name": "@dcspark/carp-client", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Web client for the Carp server", | ||
"main": "app/index.js", | ||
"main": "client/src/index.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "eslint": "eslint src", |
52846
52
1342