UNPKG

dingojs

Version:

A simple but feature filled interface between Filecoin's Lotus client and JS.

26 lines 878 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.postJson = void 0; const axios_1 = __importDefault(require("axios")); /** @internal */ function postJson(filMethod, bundle, params) { var _a; const pushData = { method: 'POST', url: bundle.endpoint, data: { jsonrpc: "2.0", method: filMethod, id: 1, params: params || [] } }; pushData.headers = ((_a = bundle.tokenStr) === null || _a === void 0 ? void 0 : _a.length) ? { "Authorization": `Bearer ${bundle.tokenStr}` } : {}; return axios_1.default(pushData) .then(res => res.data); } exports.postJson = postJson; //# sourceMappingURL=network.js.map