@eluvio/elv-client-js 3.1.96 → 3.1.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ElvClient-min.js +11 -15
- package/dist/ElvClient-node-min.js +13 -17
- package/dist/ElvFrameClient-min.js +9 -13
- package/dist/ElvPermissionsClient-min.js +9 -13
- package/dist/src/AuthorizationClient.js +1980 -2238
- package/dist/src/ContentObjectVerification.js +173 -164
- package/dist/src/Crypto.js +324 -376
- package/dist/src/ElvClient.js +1019 -1182
- package/dist/src/ElvWallet.js +95 -119
- package/dist/src/EthClient.js +896 -1040
- package/dist/src/FrameClient.js +300 -331
- package/dist/src/HttpClient.js +147 -153
- package/dist/src/Id.js +3 -1
- package/dist/src/PermissionsClient.js +1168 -1294
- package/dist/src/RemoteSigner.js +211 -263
- package/dist/src/UserProfileClient.js +1023 -1164
- package/dist/src/Utils.js +197 -209
- package/dist/src/client/ABRPublishing.js +858 -895
- package/dist/src/client/AccessGroups.js +959 -1102
- package/dist/src/client/ContentAccess.js +3434 -3727
- package/dist/src/client/ContentManagement.js +2068 -2252
- package/dist/src/client/Contracts.js +563 -647
- package/dist/src/client/Files.js +1757 -1886
- package/dist/src/client/NFT.js +112 -126
- package/dist/src/client/NTP.js +422 -478
- package/package-lock.json +22001 -0
- package/package.json +1 -1
- package/src/Utils.js +22 -0
package/dist/src/Utils.js
CHANGED
|
@@ -2,17 +2,15 @@ var _toConsumableArray = require("@babel/runtime/helpers/toConsumableArray");
|
|
|
2
2
|
|
|
3
3
|
var _regeneratorRuntime = require("@babel/runtime/regenerator");
|
|
4
4
|
|
|
5
|
-
var _asyncToGenerator = require("@babel/runtime/helpers/asyncToGenerator");
|
|
6
|
-
|
|
7
5
|
var _defineProperty = require("@babel/runtime/helpers/defineProperty");
|
|
8
6
|
|
|
9
7
|
var _slicedToArray = require("@babel/runtime/helpers/slicedToArray");
|
|
10
8
|
|
|
11
9
|
var _this = this;
|
|
12
10
|
|
|
13
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly
|
|
11
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
14
12
|
|
|
15
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source =
|
|
13
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
16
14
|
|
|
17
15
|
if (typeof Buffer === "undefined") {
|
|
18
16
|
Buffer = require("buffer/").Buffer;
|
|
@@ -26,6 +24,8 @@ var VarInt = require("varint");
|
|
|
26
24
|
|
|
27
25
|
var URI = require("urijs");
|
|
28
26
|
|
|
27
|
+
var Pako = require("pako");
|
|
28
|
+
|
|
29
29
|
var _require$utils = require("ethers").utils,
|
|
30
30
|
keccak256 = _require$utils.keccak256,
|
|
31
31
|
getAddress = _require$utils.getAddress;
|
|
@@ -167,6 +167,24 @@ var Utils = {
|
|
|
167
167
|
};
|
|
168
168
|
},
|
|
169
169
|
|
|
170
|
+
/**
|
|
171
|
+
* Decode the specified signed token into its component parts
|
|
172
|
+
*
|
|
173
|
+
* @param {string} token - The token to decode
|
|
174
|
+
*
|
|
175
|
+
* @return {Object} - Components of the signed token
|
|
176
|
+
*/
|
|
177
|
+
DecodeSignedToken: function DecodeSignedToken(token) {
|
|
178
|
+
var decodedToken = Utils.FromB58(token.slice(6));
|
|
179
|
+
var signature = "0x".concat(decodedToken.slice(0, 65).toString("hex"));
|
|
180
|
+
var payload = JSON.parse(Buffer.from(Pako.inflateRaw(decodedToken.slice(65))).toString("utf-8"));
|
|
181
|
+
payload.adr = Utils.FormatAddress("0x".concat(Buffer.from(payload.adr, "base64").toString("hex")));
|
|
182
|
+
return {
|
|
183
|
+
payload: payload,
|
|
184
|
+
signature: signature
|
|
185
|
+
};
|
|
186
|
+
},
|
|
187
|
+
|
|
170
188
|
/**
|
|
171
189
|
* Decode the specified write token into its component parts
|
|
172
190
|
*
|
|
@@ -477,233 +495,203 @@ var Utils = {
|
|
|
477
495
|
signature = _token$split2[1];
|
|
478
496
|
|
|
479
497
|
info = JSON.parse(Utils.FromB64(info));
|
|
480
|
-
return _objectSpread(
|
|
498
|
+
return _objectSpread({}, info, {
|
|
481
499
|
signature: signature
|
|
482
500
|
});
|
|
483
501
|
},
|
|
484
|
-
LimitedMap: function () {
|
|
485
|
-
var
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
_context.next = 5;
|
|
503
|
-
break;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
_context.next = 3;
|
|
507
|
-
return new Promise(function (resolve) {
|
|
508
|
-
return setTimeout(resolve, 10);
|
|
509
|
-
});
|
|
510
|
-
|
|
511
|
-
case 3:
|
|
512
|
-
_context.next = 0;
|
|
513
|
-
break;
|
|
514
|
-
|
|
515
|
-
case 5:
|
|
516
|
-
locked = true;
|
|
517
|
-
thisIndex = index;
|
|
518
|
-
index += 1;
|
|
519
|
-
locked = false;
|
|
520
|
-
return _context.abrupt("return", thisIndex);
|
|
521
|
-
|
|
522
|
-
case 10:
|
|
523
|
-
case "end":
|
|
524
|
-
return _context.stop();
|
|
502
|
+
LimitedMap: function LimitedMap(limit, array, f) {
|
|
503
|
+
var index, locked, nextIndex, results, active;
|
|
504
|
+
return _regeneratorRuntime.async(function LimitedMap$(_context3) {
|
|
505
|
+
while (1) {
|
|
506
|
+
switch (_context3.prev = _context3.next) {
|
|
507
|
+
case 0:
|
|
508
|
+
index = 0;
|
|
509
|
+
locked = false;
|
|
510
|
+
|
|
511
|
+
nextIndex = function nextIndex() {
|
|
512
|
+
var thisIndex;
|
|
513
|
+
return _regeneratorRuntime.async(function nextIndex$(_context) {
|
|
514
|
+
while (1) {
|
|
515
|
+
switch (_context.prev = _context.next) {
|
|
516
|
+
case 0:
|
|
517
|
+
if (!locked) {
|
|
518
|
+
_context.next = 5;
|
|
519
|
+
break;
|
|
525
520
|
}
|
|
526
|
-
}
|
|
527
|
-
}, _callee);
|
|
528
|
-
}));
|
|
529
|
-
|
|
530
|
-
return function nextIndex() {
|
|
531
|
-
return _ref.apply(this, arguments);
|
|
532
|
-
};
|
|
533
|
-
}();
|
|
534
|
-
|
|
535
|
-
results = [];
|
|
536
|
-
active = 0;
|
|
537
|
-
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
538
|
-
_toConsumableArray(Array(limit || 1)).forEach( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
539
|
-
var index;
|
|
540
|
-
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
541
|
-
while (1) {
|
|
542
|
-
switch (_context2.prev = _context2.next) {
|
|
543
|
-
case 0:
|
|
544
|
-
active += 1;
|
|
545
|
-
_context2.next = 3;
|
|
546
|
-
return nextIndex();
|
|
547
|
-
|
|
548
|
-
case 3:
|
|
549
|
-
index = _context2.sent;
|
|
550
|
-
|
|
551
|
-
case 4:
|
|
552
|
-
if (!(index < array.length)) {
|
|
553
|
-
_context2.next = 19;
|
|
554
|
-
break;
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
_context2.prev = 5;
|
|
558
|
-
_context2.next = 8;
|
|
559
|
-
return f(array[index], index);
|
|
560
|
-
|
|
561
|
-
case 8:
|
|
562
|
-
results[index] = _context2.sent;
|
|
563
|
-
_context2.next = 14;
|
|
564
|
-
break;
|
|
565
|
-
|
|
566
|
-
case 11:
|
|
567
|
-
_context2.prev = 11;
|
|
568
|
-
_context2.t0 = _context2["catch"](5);
|
|
569
|
-
reject(_context2.t0);
|
|
570
521
|
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
522
|
+
_context.next = 3;
|
|
523
|
+
return _regeneratorRuntime.awrap(new Promise(function (resolve) {
|
|
524
|
+
return setTimeout(resolve, 10);
|
|
525
|
+
}));
|
|
526
|
+
|
|
527
|
+
case 3:
|
|
528
|
+
_context.next = 0;
|
|
529
|
+
break;
|
|
530
|
+
|
|
531
|
+
case 5:
|
|
532
|
+
locked = true;
|
|
533
|
+
thisIndex = index;
|
|
534
|
+
index += 1;
|
|
535
|
+
locked = false;
|
|
536
|
+
return _context.abrupt("return", thisIndex);
|
|
537
|
+
|
|
538
|
+
case 10:
|
|
539
|
+
case "end":
|
|
540
|
+
return _context.stop();
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
results = [];
|
|
547
|
+
active = 0;
|
|
548
|
+
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
549
|
+
_toConsumableArray(Array(limit || 1)).forEach(function _callee() {
|
|
550
|
+
var index;
|
|
551
|
+
return _regeneratorRuntime.async(function _callee$(_context2) {
|
|
552
|
+
while (1) {
|
|
553
|
+
switch (_context2.prev = _context2.next) {
|
|
554
|
+
case 0:
|
|
555
|
+
active += 1;
|
|
556
|
+
_context2.next = 3;
|
|
557
|
+
return _regeneratorRuntime.awrap(nextIndex());
|
|
558
|
+
|
|
559
|
+
case 3:
|
|
560
|
+
index = _context2.sent;
|
|
561
|
+
|
|
562
|
+
case 4:
|
|
563
|
+
if (!(index < array.length)) {
|
|
564
|
+
_context2.next = 19;
|
|
578
565
|
break;
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
_context2.prev = 5;
|
|
569
|
+
_context2.next = 8;
|
|
570
|
+
return _regeneratorRuntime.awrap(f(array[index], index));
|
|
571
|
+
|
|
572
|
+
case 8:
|
|
573
|
+
results[index] = _context2.sent;
|
|
574
|
+
_context2.next = 14;
|
|
575
|
+
break;
|
|
576
|
+
|
|
577
|
+
case 11:
|
|
578
|
+
_context2.prev = 11;
|
|
579
|
+
_context2.t0 = _context2["catch"](5);
|
|
580
|
+
reject(_context2.t0);
|
|
581
|
+
|
|
582
|
+
case 14:
|
|
583
|
+
_context2.next = 16;
|
|
584
|
+
return _regeneratorRuntime.awrap(nextIndex());
|
|
585
|
+
|
|
586
|
+
case 16:
|
|
587
|
+
index = _context2.sent;
|
|
588
|
+
_context2.next = 4;
|
|
589
|
+
break;
|
|
590
|
+
|
|
591
|
+
case 19:
|
|
592
|
+
// When finished and no more workers are active, resolve
|
|
593
|
+
active -= 1;
|
|
594
|
+
|
|
595
|
+
if (active === 0) {
|
|
596
|
+
resolve(results);
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
case 21:
|
|
600
|
+
case "end":
|
|
601
|
+
return _context2.stop();
|
|
592
602
|
}
|
|
593
|
-
}
|
|
594
|
-
})
|
|
595
|
-
})
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
603
|
+
}
|
|
604
|
+
}, null, null, [[5, 11]]);
|
|
605
|
+
});
|
|
606
|
+
}));
|
|
607
|
+
|
|
608
|
+
case 6:
|
|
609
|
+
case "end":
|
|
610
|
+
return _context3.stop();
|
|
601
611
|
}
|
|
602
|
-
}
|
|
603
|
-
})
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
switch (_context4.prev = _context4.next) {
|
|
616
|
-
case 0:
|
|
617
|
-
return _context4.abrupt("return", Utils.ResponseToFormat("json", response));
|
|
618
|
-
|
|
619
|
-
case 1:
|
|
620
|
-
case "end":
|
|
621
|
-
return _context4.stop();
|
|
622
|
-
}
|
|
612
|
+
}
|
|
613
|
+
});
|
|
614
|
+
},
|
|
615
|
+
ResponseToJson: function ResponseToJson(response) {
|
|
616
|
+
return _regeneratorRuntime.async(function ResponseToJson$(_context4) {
|
|
617
|
+
while (1) {
|
|
618
|
+
switch (_context4.prev = _context4.next) {
|
|
619
|
+
case 0:
|
|
620
|
+
return _context4.abrupt("return", Utils.ResponseToFormat("json", response));
|
|
621
|
+
|
|
622
|
+
case 1:
|
|
623
|
+
case "end":
|
|
624
|
+
return _context4.stop();
|
|
623
625
|
}
|
|
624
|
-
}
|
|
625
|
-
})
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
var _ResponseToFormat = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(format, response) {
|
|
635
|
-
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
636
|
-
while (1) {
|
|
637
|
-
switch (_context5.prev = _context5.next) {
|
|
638
|
-
case 0:
|
|
639
|
-
_context5.next = 2;
|
|
640
|
-
return response;
|
|
626
|
+
}
|
|
627
|
+
});
|
|
628
|
+
},
|
|
629
|
+
ResponseToFormat: function ResponseToFormat(format, response) {
|
|
630
|
+
return _regeneratorRuntime.async(function ResponseToFormat$(_context5) {
|
|
631
|
+
while (1) {
|
|
632
|
+
switch (_context5.prev = _context5.next) {
|
|
633
|
+
case 0:
|
|
634
|
+
_context5.next = 2;
|
|
635
|
+
return _regeneratorRuntime.awrap(response);
|
|
641
636
|
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
637
|
+
case 2:
|
|
638
|
+
response = _context5.sent;
|
|
639
|
+
_context5.t0 = format.toLowerCase();
|
|
640
|
+
_context5.next = _context5.t0 === "json" ? 6 : _context5.t0 === "text" ? 9 : _context5.t0 === "blob" ? 12 : _context5.t0 === "arraybuffer" ? 15 : _context5.t0 === "formdata" ? 18 : _context5.t0 === "buffer" ? 21 : 24;
|
|
641
|
+
break;
|
|
647
642
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
643
|
+
case 6:
|
|
644
|
+
_context5.next = 8;
|
|
645
|
+
return _regeneratorRuntime.awrap(response.json());
|
|
651
646
|
|
|
652
|
-
|
|
653
|
-
|
|
647
|
+
case 8:
|
|
648
|
+
return _context5.abrupt("return", _context5.sent);
|
|
654
649
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
650
|
+
case 9:
|
|
651
|
+
_context5.next = 11;
|
|
652
|
+
return _regeneratorRuntime.awrap(response.text());
|
|
658
653
|
|
|
659
|
-
|
|
660
|
-
|
|
654
|
+
case 11:
|
|
655
|
+
return _context5.abrupt("return", _context5.sent);
|
|
661
656
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
657
|
+
case 12:
|
|
658
|
+
_context5.next = 14;
|
|
659
|
+
return _regeneratorRuntime.awrap(response.blob());
|
|
665
660
|
|
|
666
|
-
|
|
667
|
-
|
|
661
|
+
case 14:
|
|
662
|
+
return _context5.abrupt("return", _context5.sent);
|
|
668
663
|
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
664
|
+
case 15:
|
|
665
|
+
_context5.next = 17;
|
|
666
|
+
return _regeneratorRuntime.awrap(response.arrayBuffer());
|
|
672
667
|
|
|
673
|
-
|
|
674
|
-
|
|
668
|
+
case 17:
|
|
669
|
+
return _context5.abrupt("return", _context5.sent);
|
|
675
670
|
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
671
|
+
case 18:
|
|
672
|
+
_context5.next = 20;
|
|
673
|
+
return _regeneratorRuntime.awrap(response.formData());
|
|
679
674
|
|
|
680
|
-
|
|
681
|
-
|
|
675
|
+
case 20:
|
|
676
|
+
return _context5.abrupt("return", _context5.sent);
|
|
682
677
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
678
|
+
case 21:
|
|
679
|
+
_context5.next = 23;
|
|
680
|
+
return _regeneratorRuntime.awrap(response.buffer());
|
|
686
681
|
|
|
687
|
-
|
|
688
|
-
|
|
682
|
+
case 23:
|
|
683
|
+
return _context5.abrupt("return", _context5.sent);
|
|
689
684
|
|
|
690
|
-
|
|
691
|
-
|
|
685
|
+
case 24:
|
|
686
|
+
return _context5.abrupt("return", response);
|
|
692
687
|
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
}
|
|
688
|
+
case 25:
|
|
689
|
+
case "end":
|
|
690
|
+
return _context5.stop();
|
|
697
691
|
}
|
|
698
|
-
}
|
|
699
|
-
})
|
|
700
|
-
|
|
701
|
-
function ResponseToFormat(_x5, _x6) {
|
|
702
|
-
return _ResponseToFormat.apply(this, arguments);
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
return ResponseToFormat;
|
|
706
|
-
}(),
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
},
|
|
707
695
|
|
|
708
696
|
/**
|
|
709
697
|
* Resize the image file or link URL to the specified maximum height. Can also be used to remove
|
|
@@ -714,9 +702,9 @@ var Utils = {
|
|
|
714
702
|
*
|
|
715
703
|
* @returns {string} - The modified URL with the height parameter
|
|
716
704
|
*/
|
|
717
|
-
ResizeImage: function ResizeImage(
|
|
718
|
-
var imageUrl =
|
|
719
|
-
height =
|
|
705
|
+
ResizeImage: function ResizeImage(_ref) {
|
|
706
|
+
var imageUrl = _ref.imageUrl,
|
|
707
|
+
height = _ref.height;
|
|
720
708
|
|
|
721
709
|
if (!imageUrl || imageUrl && !imageUrl.startsWith("http")) {
|
|
722
710
|
return imageUrl;
|