@emurgo/yoroi-lib
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -69,5 +69,6 @@ import { WasmFactory } from "./internals/utils/crypto"; | ||
private readonly apiUrl; | ||
private readonly wasmFactory; | ||
private readonly requestSize; | ||
private transitionSaturationThreshold; | ||
constructor(apiUrl: string); | ||
constructor(apiUrl: string, wasmFactory?: WasmFactory | null); | ||
/** | ||
@@ -74,0 +75,0 @@ * @param hash HEX key-hash |
@@ -19,3 +19,2 @@ "use strict"; | ||
const crypto_1 = require("./internals/utils/crypto"); | ||
const url_1 = require("url"); | ||
const js_1 = require("./internals/utils/js"); | ||
@@ -77,6 +76,7 @@ const explorerApi = 'https://a.cexplorer.io/yoroi-api/'; | ||
class PoolInfoApi { | ||
constructor(apiUrl) { | ||
constructor(apiUrl, wasmFactory = null) { | ||
this.requestSize = 50; | ||
this.transitionSaturationThreshold = null; | ||
this.apiUrl = apiUrl; | ||
this.wasmFactory = wasmFactory; | ||
} | ||
@@ -126,4 +126,4 @@ /** | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const url = new url_1.URL('/pool/info', this.apiUrl).href; | ||
const { data } = yield axios_1.default.post(url, { | ||
const url = addPathToUrl(this.apiUrl, '/pool/info'); | ||
const { data } = yield axios_1.default.post(url.href, { | ||
poolIds: hashes | ||
@@ -159,3 +159,6 @@ }); | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const params = new URLSearchParams({ search: hash }); | ||
const { id } = this.wasmFactory ? yield normalisePoolIdentifierOrKey(hash, this.wasmFactory) : { id: null }; | ||
if (id == null) | ||
throw new Error('getSingleExplorerPoolInfo: not possible to get pool id'); | ||
const params = new URLSearchParams({ search: id }); | ||
const { data } = yield axios_1.default.post(explorerApi, params.toString(), { | ||
@@ -247,1 +250,8 @@ headers: { | ||
exports.PoolInfoApi = PoolInfoApi; | ||
function addPathToUrl(apiURL, path) { | ||
const url = new URL(apiURL); | ||
const basePath = url.pathname.replace(/\/$/, ''); | ||
const sanitizedPath = path.startsWith('/') ? path.slice(1) : path; | ||
url.pathname = `${basePath}/${sanitizedPath}`; | ||
return url; | ||
} |
{ | ||
"name": "@emurgo/yoroi-lib", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
342890
6256