blockfrost-js-ratelimited
Version:
A JavaScript/TypeScript SDK for interacting with the https://blockfrost.io API
68 lines (67 loc) • 2.25 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BlockFrostIPFS = void 0;
const config_1 = require("./config");
const ipfs_1 = require("./endpoints/ipfs");
const url_join_1 = __importDefault(require("url-join"));
const utils_1 = require("./utils");
const axios_1 = require("./utils/axios");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const packageJson = require('../package.json');
class BlockFrostIPFS {
constructor(options) {
var _a;
/**
* add - Add a file or directory to ipfs
*
* @returns information about added ipfs object
*/
this.add = ipfs_1.add;
/**
* gateway - Relay to an ipfs gateway
*
* @returns the object content
*
*/
this.gateway = ipfs_1.gateway;
/**
* pin - Pin an object
*
* @returns pinned object
*
*/
this.pin = ipfs_1.pin;
/**
* listByPath - List objects pinned to local storage
*
* @returns list of pinned objects
*
*/
this.listByPath = ipfs_1.listByPath;
/**
* list - List objects pinned to local storage
*
* @returns list of pinned objects
*
*/
this.list = ipfs_1.list;
/**
* pinRemove - Remove pinned objects from local storage
*
* @returns removed pinned object
*
*/
this.pinRemove = ipfs_1.pinRemove;
this.options = utils_1.validateOptions(options);
const apiBase = config_1.API_URLS.ipfs;
this.apiUrl = url_join_1.default(apiBase, `v${this.options.version}`);
this.userAgent =
(_a = options === null || options === void 0 ? void 0 : options.userAgent) !== null && _a !== void 0 ? _a : `${packageJson.name}@${packageJson.version}`;
this.axiosInstance = axios_1.hackInstance(this.options, this.userAgent);
this.projectId = this.options.projectId;
}
}
exports.BlockFrostIPFS = BlockFrostIPFS;