UNPKG

@blockfrost/blockfrost-js

Version:

A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API

35 lines (34 loc) 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BlockFrostIPFS = void 0; /* eslint-disable tsdoc/syntax */ const config_1 = require("./config"); const ipfs_1 = require("./endpoints/ipfs"); const utils_1 = require("./utils"); const got_1 = require("./utils/got"); const limiter_1 = require("./utils/limiter"); // eslint-disable-next-line @typescript-eslint/no-var-requires const packageJson = require('../package.json'); class BlockFrostIPFS { constructor(options) { this.add = ipfs_1.add; this.gateway = ipfs_1.gateway; this.pin = ipfs_1.pin; this.listByPath = ipfs_1.listByPath; this.list = ipfs_1.list; this.pinRemove = ipfs_1.pinRemove; this.options = (0, utils_1.validateOptions)(options); const apiBase = config_1.API_URLS.ipfs; this.apiUrl = `${apiBase}/v${this.options.version}`; this.apiUrl = this.options?.customBackend || `${apiBase}/v${this.options.version}`; this.userAgent = options?.userAgent ?? `${packageJson.name}@${packageJson.version}`; this.rateLimiter = this.options.rateLimiter ? (0, limiter_1.getLimiter)(this.options.rateLimiter) : undefined; this.instance = (0, got_1.getInstance)(this.apiUrl, this.options, this.userAgent, this.rateLimiter); this.projectId = this.options.projectId; } } exports.BlockFrostIPFS = BlockFrostIPFS;