UNPKG

dingojs

Version:

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

39 lines 1.28 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = __importDefault(require("./helpers/core")); const client_1 = __importDefault(require("./helpers/client")); const wallet_1 = __importDefault(require("./helpers/wallet")); class Dingo extends core_1.default { constructor(rpc, tokenStr) { super(rpc, tokenStr); // children this.wallet = new wallet_1.default(rpc, tokenStr); this.client = new client_1.default(rpc, tokenStr); } version() { return this.postSimpleJson("Filecoin.Version"); } shutdown() { return this.postSimpleJson("Filecoin.Shutdown"); } discover() { return this.postSimpleJson("Filecoin.Discover"); } // Utility Functions daysToBlocks(days) { return 2788 * Number(days); } monthsToBlocks(months) { return 86400 * Number(months); } calculatePaddedSize(size) { const x = Number(size); const val = Math.ceil(x / 127); return 127 * Math.pow(2, (Math.ceil(Math.log(val)))); } } exports.default = Dingo; //# sourceMappingURL=index.js.map