diff --git a/dist/src/builder.js b/dist/src/builder.js index 5b1f799..01b81d1 100644 --- a/dist/src/builder.js +++ b/dist/src/builder.js @@ -59,12 +59,13 @@ var PackBuilder = /** @class */ (function () { this._pack = (0, pure_1.blank)(network); (0, pure_1.assertValidPack)(this._pack); } - PackBuilder.prototype.packType = function (t) { + PackBuilder.prototype.packType = function (t, pin) { + if (pin === void 0) { pin = false; } return __awaiter(this, void 0, void 0, function () { var cid, info; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, (0, ipfs_util_1.putIpfsJson)(t.artifact)]; + case 0: return [4 /*yield*/, (0, ipfs_util_1.putIpfsJson)(t.artifact, pin)]; case 1: cid = (_a.sent()).toString(); info = (0, util_1.copy)(t); @@ -80,13 +81,14 @@ var PackBuilder = /** @class */ (function () { this._pack = (0, pure_1.addType)(this._pack, t); return this; }; - PackBuilder.prototype.packObject = function (o, alsoPackType) { + PackBuilder.prototype.packObject = function (o, alsoPackType, pin) { if (alsoPackType === void 0) { alsoPackType = true; } + if (pin === void 0) { pin = false; } return __awaiter(this, void 0, void 0, function () { var cid, info, pack; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [4 /*yield*/, (0, ipfs_util_1.putIpfsJson)(o.artifact)]; + case 0: return [4 /*yield*/, (0, ipfs_util_1.putIpfsJson)(o.artifact, pin)]; case 1: cid = (_a.sent()).toString(); info = (0, util_1.copy)(o); diff --git a/package.json b/package.json index 8437bdc..be7b564 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@etherpacks/dpack", - "version": "0.0.31", + "version": "0.0.32", "author": "nikolai mushegian ", "license": "GPL-3.0", "main": "./dist/index.js", diff --git a/src/builder.ts b/src/builder.ts index b31541f..08c608f 100644 --- a/src/builder.ts +++ b/src/builder.ts @@ -22,8 +22,8 @@ export class PackBuilder { assertValidPack(this._pack) } - async packType (t: any): Promise { - const cid = (await putIpfsJson(t.artifact)).toString() + async packType (t: any, pin: boolean = false): Promise { + const cid = (await putIpfsJson(t.artifact, pin)).toString() const info = copy(t) info.artifact = { '/': cid } this._pack = _addType(this._pack, info) @@ -35,8 +35,8 @@ export class PackBuilder { return this } - async packObject (o: any, alsoPackType: boolean = true): Promise { - const cid = (await putIpfsJson(o.artifact)).toString() + async packObject (o: any, alsoPackType: boolean = true, pin: boolean = false): Promise { + const cid = (await putIpfsJson(o.artifact, pin)).toString() const info = copy(o) info.artifact = { '/': cid }