@onekeyfe/hd-web-sdk 0.2.10 → 0.2.11

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.
@@ -25977,6 +25977,14 @@ class CardanoGetAddress extends BaseMethod {
25977
25977
  });
25978
25978
  }
25979
25979
 
25980
+ getVersionRange() {
25981
+ return {
25982
+ model_mini: {
25983
+ min: '2.10.0'
25984
+ }
25985
+ };
25986
+ }
25987
+
25980
25988
  run() {
25981
25989
  return __awaiter(this, void 0, void 0, function* () {
25982
25990
  const responses = [];
@@ -26072,6 +26080,14 @@ class CardanoGetPublicKey extends BaseMethod {
26072
26080
  });
26073
26081
  }
26074
26082
 
26083
+ getVersionRange() {
26084
+ return {
26085
+ model_mini: {
26086
+ min: '2.10.0'
26087
+ }
26088
+ };
26089
+ }
26090
+
26075
26091
  run() {
26076
26092
  return __awaiter(this, void 0, void 0, function* () {
26077
26093
  const responses = [];
@@ -26649,6 +26665,14 @@ const gatherWitnessPaths = (inputsWithPath, certificatesWithPoolOwnersAndRelays,
26649
26665
  };
26650
26666
 
26651
26667
  class CardanoSignTransaction extends BaseMethod {
26668
+ getVersionRange() {
26669
+ return {
26670
+ model_mini: {
26671
+ min: '2.10.0'
26672
+ }
26673
+ };
26674
+ }
26675
+
26652
26676
  init() {
26653
26677
  var _a;
26654
26678
 
@@ -27933,6 +27957,7 @@ __webpack_unused_export__ = getEnv;
27933
27957
  __webpack_unused_export__ = getHDPath;
27934
27958
  __webpack_unused_export__ = getLog;
27935
27959
  exports.jl = getLogger;
27960
+ __webpack_unused_export__ = getOutputScriptType;
27936
27961
  __webpack_unused_export__ = getSDKVersion;
27937
27962
  __webpack_unused_export__ = getScriptType;
27938
27963
  __webpack_unused_export__ = getTimeStamp;
@@ -43592,7 +43617,7 @@ module.exports = function GetIntrinsic(name, allowMissing) {
43592
43617
 
43593
43618
  var Buffer = (__webpack_require__(7834).Buffer)
43594
43619
  var Transform = (__webpack_require__(4851).Transform)
43595
- var StringDecoder = (__webpack_require__(214)/* .StringDecoder */ .s)
43620
+ var StringDecoder = (__webpack_require__(3974)/* .StringDecoder */ .s)
43596
43621
  var inherits = __webpack_require__(1285)
43597
43622
 
43598
43623
  function CipherBase (hashMode) {
@@ -60884,7 +60909,7 @@ function ReadableState(options, stream, isDuplex) {
60884
60909
  this.encoding = null;
60885
60910
 
60886
60911
  if (options.encoding) {
60887
- if (!StringDecoder) StringDecoder = (__webpack_require__(214)/* .StringDecoder */ .s);
60912
+ if (!StringDecoder) StringDecoder = (__webpack_require__(1922)/* .StringDecoder */ .s);
60888
60913
  this.decoder = new StringDecoder(options.encoding);
60889
60914
  this.encoding = options.encoding;
60890
60915
  }
@@ -61046,7 +61071,7 @@ Readable.prototype.isPaused = function () {
61046
61071
 
61047
61072
 
61048
61073
  Readable.prototype.setEncoding = function (enc) {
61049
- if (!StringDecoder) StringDecoder = (__webpack_require__(214)/* .StringDecoder */ .s);
61074
+ if (!StringDecoder) StringDecoder = (__webpack_require__(1922)/* .StringDecoder */ .s);
61050
61075
  var decoder = new StringDecoder(enc);
61051
61076
  this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
61052
61077
 
@@ -63569,6 +63594,309 @@ module.exports = {
63569
63594
  module.exports = __webpack_require__(2699).EventEmitter;
63570
63595
 
63571
63596
 
63597
+ /***/ }),
63598
+
63599
+ /***/ 1922:
63600
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
63601
+
63602
+ "use strict";
63603
+ // Copyright Joyent, Inc. and other Node contributors.
63604
+ //
63605
+ // Permission is hereby granted, free of charge, to any person obtaining a
63606
+ // copy of this software and associated documentation files (the
63607
+ // "Software"), to deal in the Software without restriction, including
63608
+ // without limitation the rights to use, copy, modify, merge, publish,
63609
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
63610
+ // persons to whom the Software is furnished to do so, subject to the
63611
+ // following conditions:
63612
+ //
63613
+ // The above copyright notice and this permission notice shall be included
63614
+ // in all copies or substantial portions of the Software.
63615
+ //
63616
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
63617
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
63618
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
63619
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
63620
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
63621
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
63622
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
63623
+
63624
+
63625
+
63626
+ /*<replacement>*/
63627
+
63628
+ var Buffer = (__webpack_require__(7834).Buffer);
63629
+ /*</replacement>*/
63630
+
63631
+ var isEncoding = Buffer.isEncoding || function (encoding) {
63632
+ encoding = '' + encoding;
63633
+ switch (encoding && encoding.toLowerCase()) {
63634
+ case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
63635
+ return true;
63636
+ default:
63637
+ return false;
63638
+ }
63639
+ };
63640
+
63641
+ function _normalizeEncoding(enc) {
63642
+ if (!enc) return 'utf8';
63643
+ var retried;
63644
+ while (true) {
63645
+ switch (enc) {
63646
+ case 'utf8':
63647
+ case 'utf-8':
63648
+ return 'utf8';
63649
+ case 'ucs2':
63650
+ case 'ucs-2':
63651
+ case 'utf16le':
63652
+ case 'utf-16le':
63653
+ return 'utf16le';
63654
+ case 'latin1':
63655
+ case 'binary':
63656
+ return 'latin1';
63657
+ case 'base64':
63658
+ case 'ascii':
63659
+ case 'hex':
63660
+ return enc;
63661
+ default:
63662
+ if (retried) return; // undefined
63663
+ enc = ('' + enc).toLowerCase();
63664
+ retried = true;
63665
+ }
63666
+ }
63667
+ };
63668
+
63669
+ // Do not cache `Buffer.isEncoding` when checking encoding names as some
63670
+ // modules monkey-patch it to support additional encodings
63671
+ function normalizeEncoding(enc) {
63672
+ var nenc = _normalizeEncoding(enc);
63673
+ if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
63674
+ return nenc || enc;
63675
+ }
63676
+
63677
+ // StringDecoder provides an interface for efficiently splitting a series of
63678
+ // buffers into a series of JS strings without breaking apart multi-byte
63679
+ // characters.
63680
+ exports.s = StringDecoder;
63681
+ function StringDecoder(encoding) {
63682
+ this.encoding = normalizeEncoding(encoding);
63683
+ var nb;
63684
+ switch (this.encoding) {
63685
+ case 'utf16le':
63686
+ this.text = utf16Text;
63687
+ this.end = utf16End;
63688
+ nb = 4;
63689
+ break;
63690
+ case 'utf8':
63691
+ this.fillLast = utf8FillLast;
63692
+ nb = 4;
63693
+ break;
63694
+ case 'base64':
63695
+ this.text = base64Text;
63696
+ this.end = base64End;
63697
+ nb = 3;
63698
+ break;
63699
+ default:
63700
+ this.write = simpleWrite;
63701
+ this.end = simpleEnd;
63702
+ return;
63703
+ }
63704
+ this.lastNeed = 0;
63705
+ this.lastTotal = 0;
63706
+ this.lastChar = Buffer.allocUnsafe(nb);
63707
+ }
63708
+
63709
+ StringDecoder.prototype.write = function (buf) {
63710
+ if (buf.length === 0) return '';
63711
+ var r;
63712
+ var i;
63713
+ if (this.lastNeed) {
63714
+ r = this.fillLast(buf);
63715
+ if (r === undefined) return '';
63716
+ i = this.lastNeed;
63717
+ this.lastNeed = 0;
63718
+ } else {
63719
+ i = 0;
63720
+ }
63721
+ if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
63722
+ return r || '';
63723
+ };
63724
+
63725
+ StringDecoder.prototype.end = utf8End;
63726
+
63727
+ // Returns only complete characters in a Buffer
63728
+ StringDecoder.prototype.text = utf8Text;
63729
+
63730
+ // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
63731
+ StringDecoder.prototype.fillLast = function (buf) {
63732
+ if (this.lastNeed <= buf.length) {
63733
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
63734
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
63735
+ }
63736
+ buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
63737
+ this.lastNeed -= buf.length;
63738
+ };
63739
+
63740
+ // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
63741
+ // continuation byte. If an invalid byte is detected, -2 is returned.
63742
+ function utf8CheckByte(byte) {
63743
+ if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
63744
+ return byte >> 6 === 0x02 ? -1 : -2;
63745
+ }
63746
+
63747
+ // Checks at most 3 bytes at the end of a Buffer in order to detect an
63748
+ // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
63749
+ // needed to complete the UTF-8 character (if applicable) are returned.
63750
+ function utf8CheckIncomplete(self, buf, i) {
63751
+ var j = buf.length - 1;
63752
+ if (j < i) return 0;
63753
+ var nb = utf8CheckByte(buf[j]);
63754
+ if (nb >= 0) {
63755
+ if (nb > 0) self.lastNeed = nb - 1;
63756
+ return nb;
63757
+ }
63758
+ if (--j < i || nb === -2) return 0;
63759
+ nb = utf8CheckByte(buf[j]);
63760
+ if (nb >= 0) {
63761
+ if (nb > 0) self.lastNeed = nb - 2;
63762
+ return nb;
63763
+ }
63764
+ if (--j < i || nb === -2) return 0;
63765
+ nb = utf8CheckByte(buf[j]);
63766
+ if (nb >= 0) {
63767
+ if (nb > 0) {
63768
+ if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
63769
+ }
63770
+ return nb;
63771
+ }
63772
+ return 0;
63773
+ }
63774
+
63775
+ // Validates as many continuation bytes for a multi-byte UTF-8 character as
63776
+ // needed or are available. If we see a non-continuation byte where we expect
63777
+ // one, we "replace" the validated continuation bytes we've seen so far with
63778
+ // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
63779
+ // behavior. The continuation byte check is included three times in the case
63780
+ // where all of the continuation bytes for a character exist in the same buffer.
63781
+ // It is also done this way as a slight performance increase instead of using a
63782
+ // loop.
63783
+ function utf8CheckExtraBytes(self, buf, p) {
63784
+ if ((buf[0] & 0xC0) !== 0x80) {
63785
+ self.lastNeed = 0;
63786
+ return '\ufffd';
63787
+ }
63788
+ if (self.lastNeed > 1 && buf.length > 1) {
63789
+ if ((buf[1] & 0xC0) !== 0x80) {
63790
+ self.lastNeed = 1;
63791
+ return '\ufffd';
63792
+ }
63793
+ if (self.lastNeed > 2 && buf.length > 2) {
63794
+ if ((buf[2] & 0xC0) !== 0x80) {
63795
+ self.lastNeed = 2;
63796
+ return '\ufffd';
63797
+ }
63798
+ }
63799
+ }
63800
+ }
63801
+
63802
+ // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
63803
+ function utf8FillLast(buf) {
63804
+ var p = this.lastTotal - this.lastNeed;
63805
+ var r = utf8CheckExtraBytes(this, buf, p);
63806
+ if (r !== undefined) return r;
63807
+ if (this.lastNeed <= buf.length) {
63808
+ buf.copy(this.lastChar, p, 0, this.lastNeed);
63809
+ return this.lastChar.toString(this.encoding, 0, this.lastTotal);
63810
+ }
63811
+ buf.copy(this.lastChar, p, 0, buf.length);
63812
+ this.lastNeed -= buf.length;
63813
+ }
63814
+
63815
+ // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
63816
+ // partial character, the character's bytes are buffered until the required
63817
+ // number of bytes are available.
63818
+ function utf8Text(buf, i) {
63819
+ var total = utf8CheckIncomplete(this, buf, i);
63820
+ if (!this.lastNeed) return buf.toString('utf8', i);
63821
+ this.lastTotal = total;
63822
+ var end = buf.length - (total - this.lastNeed);
63823
+ buf.copy(this.lastChar, 0, end);
63824
+ return buf.toString('utf8', i, end);
63825
+ }
63826
+
63827
+ // For UTF-8, a replacement character is added when ending on a partial
63828
+ // character.
63829
+ function utf8End(buf) {
63830
+ var r = buf && buf.length ? this.write(buf) : '';
63831
+ if (this.lastNeed) return r + '\ufffd';
63832
+ return r;
63833
+ }
63834
+
63835
+ // UTF-16LE typically needs two bytes per character, but even if we have an even
63836
+ // number of bytes available, we need to check if we end on a leading/high
63837
+ // surrogate. In that case, we need to wait for the next two bytes in order to
63838
+ // decode the last character properly.
63839
+ function utf16Text(buf, i) {
63840
+ if ((buf.length - i) % 2 === 0) {
63841
+ var r = buf.toString('utf16le', i);
63842
+ if (r) {
63843
+ var c = r.charCodeAt(r.length - 1);
63844
+ if (c >= 0xD800 && c <= 0xDBFF) {
63845
+ this.lastNeed = 2;
63846
+ this.lastTotal = 4;
63847
+ this.lastChar[0] = buf[buf.length - 2];
63848
+ this.lastChar[1] = buf[buf.length - 1];
63849
+ return r.slice(0, -1);
63850
+ }
63851
+ }
63852
+ return r;
63853
+ }
63854
+ this.lastNeed = 1;
63855
+ this.lastTotal = 2;
63856
+ this.lastChar[0] = buf[buf.length - 1];
63857
+ return buf.toString('utf16le', i, buf.length - 1);
63858
+ }
63859
+
63860
+ // For UTF-16LE we do not explicitly append special replacement characters if we
63861
+ // end on a partial character, we simply let v8 handle that.
63862
+ function utf16End(buf) {
63863
+ var r = buf && buf.length ? this.write(buf) : '';
63864
+ if (this.lastNeed) {
63865
+ var end = this.lastTotal - this.lastNeed;
63866
+ return r + this.lastChar.toString('utf16le', 0, end);
63867
+ }
63868
+ return r;
63869
+ }
63870
+
63871
+ function base64Text(buf, i) {
63872
+ var n = (buf.length - i) % 3;
63873
+ if (n === 0) return buf.toString('base64', i);
63874
+ this.lastNeed = 3 - n;
63875
+ this.lastTotal = 3;
63876
+ if (n === 1) {
63877
+ this.lastChar[0] = buf[buf.length - 1];
63878
+ } else {
63879
+ this.lastChar[0] = buf[buf.length - 2];
63880
+ this.lastChar[1] = buf[buf.length - 1];
63881
+ }
63882
+ return buf.toString('base64', i, buf.length - n);
63883
+ }
63884
+
63885
+ function base64End(buf) {
63886
+ var r = buf && buf.length ? this.write(buf) : '';
63887
+ if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
63888
+ return r;
63889
+ }
63890
+
63891
+ // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
63892
+ function simpleWrite(buf) {
63893
+ return buf.toString(this.encoding);
63894
+ }
63895
+
63896
+ function simpleEnd(buf) {
63897
+ return buf && buf.length ? this.write(buf) : '';
63898
+ }
63899
+
63572
63900
  /***/ }),
63573
63901
 
63574
63902
  /***/ 696:
@@ -71353,10 +71681,9 @@ Stream.prototype.pipe = function(dest, options) {
71353
71681
 
71354
71682
  /***/ }),
71355
71683
 
71356
- /***/ 214:
71684
+ /***/ 3974:
71357
71685
  /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
71358
71686
 
71359
- "use strict";
71360
71687
  // Copyright Joyent, Inc. and other Node contributors.
71361
71688
  //
71362
71689
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -71378,282 +71705,208 @@ Stream.prototype.pipe = function(dest, options) {
71378
71705
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
71379
71706
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
71380
71707
 
71708
+ var Buffer = (__webpack_require__(8834).Buffer);
71381
71709
 
71710
+ var isBufferEncoding = Buffer.isEncoding
71711
+ || function(encoding) {
71712
+ switch (encoding && encoding.toLowerCase()) {
71713
+ case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true;
71714
+ default: return false;
71715
+ }
71716
+ }
71382
71717
 
71383
- /*<replacement>*/
71384
71718
 
71385
- var Buffer = (__webpack_require__(7834).Buffer);
71386
- /*</replacement>*/
71387
-
71388
- var isEncoding = Buffer.isEncoding || function (encoding) {
71389
- encoding = '' + encoding;
71390
- switch (encoding && encoding.toLowerCase()) {
71391
- case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw':
71392
- return true;
71393
- default:
71394
- return false;
71719
+ function assertEncoding(encoding) {
71720
+ if (encoding && !isBufferEncoding(encoding)) {
71721
+ throw new Error('Unknown encoding: ' + encoding);
71395
71722
  }
71396
- };
71397
-
71398
- function _normalizeEncoding(enc) {
71399
- if (!enc) return 'utf8';
71400
- var retried;
71401
- while (true) {
71402
- switch (enc) {
71403
- case 'utf8':
71404
- case 'utf-8':
71405
- return 'utf8';
71406
- case 'ucs2':
71407
- case 'ucs-2':
71408
- case 'utf16le':
71409
- case 'utf-16le':
71410
- return 'utf16le';
71411
- case 'latin1':
71412
- case 'binary':
71413
- return 'latin1';
71414
- case 'base64':
71415
- case 'ascii':
71416
- case 'hex':
71417
- return enc;
71418
- default:
71419
- if (retried) return; // undefined
71420
- enc = ('' + enc).toLowerCase();
71421
- retried = true;
71422
- }
71423
- }
71424
- };
71425
-
71426
- // Do not cache `Buffer.isEncoding` when checking encoding names as some
71427
- // modules monkey-patch it to support additional encodings
71428
- function normalizeEncoding(enc) {
71429
- var nenc = _normalizeEncoding(enc);
71430
- if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc);
71431
- return nenc || enc;
71432
71723
  }
71433
71724
 
71434
71725
  // StringDecoder provides an interface for efficiently splitting a series of
71435
71726
  // buffers into a series of JS strings without breaking apart multi-byte
71436
- // characters.
71437
- exports.s = StringDecoder;
71438
- function StringDecoder(encoding) {
71439
- this.encoding = normalizeEncoding(encoding);
71440
- var nb;
71727
+ // characters. CESU-8 is handled as part of the UTF-8 encoding.
71728
+ //
71729
+ // @TODO Handling all encodings inside a single object makes it very difficult
71730
+ // to reason about this code, so it should be split up in the future.
71731
+ // @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code
71732
+ // points as used by CESU-8.
71733
+ var StringDecoder = exports.s = function(encoding) {
71734
+ this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, '');
71735
+ assertEncoding(encoding);
71441
71736
  switch (this.encoding) {
71442
- case 'utf16le':
71443
- this.text = utf16Text;
71444
- this.end = utf16End;
71445
- nb = 4;
71446
- break;
71447
71737
  case 'utf8':
71448
- this.fillLast = utf8FillLast;
71449
- nb = 4;
71738
+ // CESU-8 represents each of Surrogate Pair by 3-bytes
71739
+ this.surrogateSize = 3;
71740
+ break;
71741
+ case 'ucs2':
71742
+ case 'utf16le':
71743
+ // UTF-16 represents each of Surrogate Pair by 2-bytes
71744
+ this.surrogateSize = 2;
71745
+ this.detectIncompleteChar = utf16DetectIncompleteChar;
71450
71746
  break;
71451
71747
  case 'base64':
71452
- this.text = base64Text;
71453
- this.end = base64End;
71454
- nb = 3;
71748
+ // Base-64 stores 3 bytes in 4 chars, and pads the remainder.
71749
+ this.surrogateSize = 3;
71750
+ this.detectIncompleteChar = base64DetectIncompleteChar;
71455
71751
  break;
71456
71752
  default:
71457
- this.write = simpleWrite;
71458
- this.end = simpleEnd;
71753
+ this.write = passThroughWrite;
71459
71754
  return;
71460
71755
  }
71461
- this.lastNeed = 0;
71462
- this.lastTotal = 0;
71463
- this.lastChar = Buffer.allocUnsafe(nb);
71464
- }
71465
71756
 
71466
- StringDecoder.prototype.write = function (buf) {
71467
- if (buf.length === 0) return '';
71468
- var r;
71469
- var i;
71470
- if (this.lastNeed) {
71471
- r = this.fillLast(buf);
71472
- if (r === undefined) return '';
71473
- i = this.lastNeed;
71474
- this.lastNeed = 0;
71475
- } else {
71476
- i = 0;
71477
- }
71478
- if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i);
71479
- return r || '';
71757
+ // Enough space to store all bytes of a single character. UTF-8 needs 4
71758
+ // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate).
71759
+ this.charBuffer = new Buffer(6);
71760
+ // Number of bytes received for the current incomplete multi-byte character.
71761
+ this.charReceived = 0;
71762
+ // Number of bytes expected for the current incomplete multi-byte character.
71763
+ this.charLength = 0;
71480
71764
  };
71481
71765
 
71482
- StringDecoder.prototype.end = utf8End;
71483
71766
 
71484
- // Returns only complete characters in a Buffer
71485
- StringDecoder.prototype.text = utf8Text;
71767
+ // write decodes the given buffer and returns it as JS string that is
71768
+ // guaranteed to not contain any partial multi-byte characters. Any partial
71769
+ // character found at the end of the buffer is buffered up, and will be
71770
+ // returned when calling write again with the remaining bytes.
71771
+ //
71772
+ // Note: Converting a Buffer containing an orphan surrogate to a String
71773
+ // currently works, but converting a String to a Buffer (via `new Buffer`, or
71774
+ // Buffer#write) will replace incomplete surrogates with the unicode
71775
+ // replacement character. See https://codereview.chromium.org/121173009/ .
71776
+ StringDecoder.prototype.write = function(buffer) {
71777
+ var charStr = '';
71778
+ // if our last write ended with an incomplete multibyte character
71779
+ while (this.charLength) {
71780
+ // determine how many remaining bytes this buffer has to offer for this char
71781
+ var available = (buffer.length >= this.charLength - this.charReceived) ?
71782
+ this.charLength - this.charReceived :
71783
+ buffer.length;
71784
+
71785
+ // add the new bytes to the char buffer
71786
+ buffer.copy(this.charBuffer, this.charReceived, 0, available);
71787
+ this.charReceived += available;
71788
+
71789
+ if (this.charReceived < this.charLength) {
71790
+ // still not enough chars in this buffer? wait for more ...
71791
+ return '';
71792
+ }
71793
+
71794
+ // remove bytes belonging to the current character from the buffer
71795
+ buffer = buffer.slice(available, buffer.length);
71796
+
71797
+ // get the character that was split
71798
+ charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding);
71799
+
71800
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
71801
+ var charCode = charStr.charCodeAt(charStr.length - 1);
71802
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
71803
+ this.charLength += this.surrogateSize;
71804
+ charStr = '';
71805
+ continue;
71806
+ }
71807
+ this.charReceived = this.charLength = 0;
71486
71808
 
71487
- // Attempts to complete a partial non-UTF-8 character using bytes from a Buffer
71488
- StringDecoder.prototype.fillLast = function (buf) {
71489
- if (this.lastNeed <= buf.length) {
71490
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed);
71491
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
71809
+ // if there are no more bytes in this buffer, just emit our char
71810
+ if (buffer.length === 0) {
71811
+ return charStr;
71812
+ }
71813
+ break;
71492
71814
  }
71493
- buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length);
71494
- this.lastNeed -= buf.length;
71495
- };
71496
71815
 
71497
- // Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a
71498
- // continuation byte. If an invalid byte is detected, -2 is returned.
71499
- function utf8CheckByte(byte) {
71500
- if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4;
71501
- return byte >> 6 === 0x02 ? -1 : -2;
71502
- }
71816
+ // determine and set charLength / charReceived
71817
+ this.detectIncompleteChar(buffer);
71503
71818
 
71504
- // Checks at most 3 bytes at the end of a Buffer in order to detect an
71505
- // incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4)
71506
- // needed to complete the UTF-8 character (if applicable) are returned.
71507
- function utf8CheckIncomplete(self, buf, i) {
71508
- var j = buf.length - 1;
71509
- if (j < i) return 0;
71510
- var nb = utf8CheckByte(buf[j]);
71511
- if (nb >= 0) {
71512
- if (nb > 0) self.lastNeed = nb - 1;
71513
- return nb;
71514
- }
71515
- if (--j < i || nb === -2) return 0;
71516
- nb = utf8CheckByte(buf[j]);
71517
- if (nb >= 0) {
71518
- if (nb > 0) self.lastNeed = nb - 2;
71519
- return nb;
71819
+ var end = buffer.length;
71820
+ if (this.charLength) {
71821
+ // buffer the incomplete character bytes we got
71822
+ buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end);
71823
+ end -= this.charReceived;
71520
71824
  }
71521
- if (--j < i || nb === -2) return 0;
71522
- nb = utf8CheckByte(buf[j]);
71523
- if (nb >= 0) {
71524
- if (nb > 0) {
71525
- if (nb === 2) nb = 0;else self.lastNeed = nb - 3;
71526
- }
71527
- return nb;
71528
- }
71529
- return 0;
71530
- }
71531
71825
 
71532
- // Validates as many continuation bytes for a multi-byte UTF-8 character as
71533
- // needed or are available. If we see a non-continuation byte where we expect
71534
- // one, we "replace" the validated continuation bytes we've seen so far with
71535
- // a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding
71536
- // behavior. The continuation byte check is included three times in the case
71537
- // where all of the continuation bytes for a character exist in the same buffer.
71538
- // It is also done this way as a slight performance increase instead of using a
71539
- // loop.
71540
- function utf8CheckExtraBytes(self, buf, p) {
71541
- if ((buf[0] & 0xC0) !== 0x80) {
71542
- self.lastNeed = 0;
71543
- return '\ufffd';
71544
- }
71545
- if (self.lastNeed > 1 && buf.length > 1) {
71546
- if ((buf[1] & 0xC0) !== 0x80) {
71547
- self.lastNeed = 1;
71548
- return '\ufffd';
71549
- }
71550
- if (self.lastNeed > 2 && buf.length > 2) {
71551
- if ((buf[2] & 0xC0) !== 0x80) {
71552
- self.lastNeed = 2;
71553
- return '\ufffd';
71554
- }
71555
- }
71556
- }
71557
- }
71826
+ charStr += buffer.toString(this.encoding, 0, end);
71558
71827
 
71559
- // Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer.
71560
- function utf8FillLast(buf) {
71561
- var p = this.lastTotal - this.lastNeed;
71562
- var r = utf8CheckExtraBytes(this, buf, p);
71563
- if (r !== undefined) return r;
71564
- if (this.lastNeed <= buf.length) {
71565
- buf.copy(this.lastChar, p, 0, this.lastNeed);
71566
- return this.lastChar.toString(this.encoding, 0, this.lastTotal);
71828
+ var end = charStr.length - 1;
71829
+ var charCode = charStr.charCodeAt(end);
71830
+ // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character
71831
+ if (charCode >= 0xD800 && charCode <= 0xDBFF) {
71832
+ var size = this.surrogateSize;
71833
+ this.charLength += size;
71834
+ this.charReceived += size;
71835
+ this.charBuffer.copy(this.charBuffer, size, 0, size);
71836
+ buffer.copy(this.charBuffer, 0, 0, size);
71837
+ return charStr.substring(0, end);
71567
71838
  }
71568
- buf.copy(this.lastChar, p, 0, buf.length);
71569
- this.lastNeed -= buf.length;
71570
- }
71571
71839
 
71572
- // Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a
71573
- // partial character, the character's bytes are buffered until the required
71574
- // number of bytes are available.
71575
- function utf8Text(buf, i) {
71576
- var total = utf8CheckIncomplete(this, buf, i);
71577
- if (!this.lastNeed) return buf.toString('utf8', i);
71578
- this.lastTotal = total;
71579
- var end = buf.length - (total - this.lastNeed);
71580
- buf.copy(this.lastChar, 0, end);
71581
- return buf.toString('utf8', i, end);
71582
- }
71840
+ // or just emit the charStr
71841
+ return charStr;
71842
+ };
71583
71843
 
71584
- // For UTF-8, a replacement character is added when ending on a partial
71585
- // character.
71586
- function utf8End(buf) {
71587
- var r = buf && buf.length ? this.write(buf) : '';
71588
- if (this.lastNeed) return r + '\ufffd';
71589
- return r;
71590
- }
71844
+ // detectIncompleteChar determines if there is an incomplete UTF-8 character at
71845
+ // the end of the given buffer. If so, it sets this.charLength to the byte
71846
+ // length that character, and sets this.charReceived to the number of bytes
71847
+ // that are available for this character.
71848
+ StringDecoder.prototype.detectIncompleteChar = function(buffer) {
71849
+ // determine how many bytes we have to check at the end of this buffer
71850
+ var i = (buffer.length >= 3) ? 3 : buffer.length;
71591
71851
 
71592
- // UTF-16LE typically needs two bytes per character, but even if we have an even
71593
- // number of bytes available, we need to check if we end on a leading/high
71594
- // surrogate. In that case, we need to wait for the next two bytes in order to
71595
- // decode the last character properly.
71596
- function utf16Text(buf, i) {
71597
- if ((buf.length - i) % 2 === 0) {
71598
- var r = buf.toString('utf16le', i);
71599
- if (r) {
71600
- var c = r.charCodeAt(r.length - 1);
71601
- if (c >= 0xD800 && c <= 0xDBFF) {
71602
- this.lastNeed = 2;
71603
- this.lastTotal = 4;
71604
- this.lastChar[0] = buf[buf.length - 2];
71605
- this.lastChar[1] = buf[buf.length - 1];
71606
- return r.slice(0, -1);
71607
- }
71852
+ // Figure out if one of the last i bytes of our buffer announces an
71853
+ // incomplete char.
71854
+ for (; i > 0; i--) {
71855
+ var c = buffer[buffer.length - i];
71856
+
71857
+ // See http://en.wikipedia.org/wiki/UTF-8#Description
71858
+
71859
+ // 110XXXXX
71860
+ if (i == 1 && c >> 5 == 0x06) {
71861
+ this.charLength = 2;
71862
+ break;
71608
71863
  }
71609
- return r;
71610
- }
71611
- this.lastNeed = 1;
71612
- this.lastTotal = 2;
71613
- this.lastChar[0] = buf[buf.length - 1];
71614
- return buf.toString('utf16le', i, buf.length - 1);
71615
- }
71616
71864
 
71617
- // For UTF-16LE we do not explicitly append special replacement characters if we
71618
- // end on a partial character, we simply let v8 handle that.
71619
- function utf16End(buf) {
71620
- var r = buf && buf.length ? this.write(buf) : '';
71621
- if (this.lastNeed) {
71622
- var end = this.lastTotal - this.lastNeed;
71623
- return r + this.lastChar.toString('utf16le', 0, end);
71865
+ // 1110XXXX
71866
+ if (i <= 2 && c >> 4 == 0x0E) {
71867
+ this.charLength = 3;
71868
+ break;
71869
+ }
71870
+
71871
+ // 11110XXX
71872
+ if (i <= 3 && c >> 3 == 0x1E) {
71873
+ this.charLength = 4;
71874
+ break;
71875
+ }
71624
71876
  }
71625
- return r;
71626
- }
71877
+ this.charReceived = i;
71878
+ };
71627
71879
 
71628
- function base64Text(buf, i) {
71629
- var n = (buf.length - i) % 3;
71630
- if (n === 0) return buf.toString('base64', i);
71631
- this.lastNeed = 3 - n;
71632
- this.lastTotal = 3;
71633
- if (n === 1) {
71634
- this.lastChar[0] = buf[buf.length - 1];
71635
- } else {
71636
- this.lastChar[0] = buf[buf.length - 2];
71637
- this.lastChar[1] = buf[buf.length - 1];
71880
+ StringDecoder.prototype.end = function(buffer) {
71881
+ var res = '';
71882
+ if (buffer && buffer.length)
71883
+ res = this.write(buffer);
71884
+
71885
+ if (this.charReceived) {
71886
+ var cr = this.charReceived;
71887
+ var buf = this.charBuffer;
71888
+ var enc = this.encoding;
71889
+ res += buf.slice(0, cr).toString(enc);
71638
71890
  }
71639
- return buf.toString('base64', i, buf.length - n);
71640
- }
71641
71891
 
71642
- function base64End(buf) {
71643
- var r = buf && buf.length ? this.write(buf) : '';
71644
- if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed);
71645
- return r;
71892
+ return res;
71893
+ };
71894
+
71895
+ function passThroughWrite(buffer) {
71896
+ return buffer.toString(this.encoding);
71646
71897
  }
71647
71898
 
71648
- // Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex)
71649
- function simpleWrite(buf) {
71650
- return buf.toString(this.encoding);
71899
+ function utf16DetectIncompleteChar(buffer) {
71900
+ this.charReceived = buffer.length % 2;
71901
+ this.charLength = this.charReceived ? 2 : 0;
71651
71902
  }
71652
71903
 
71653
- function simpleEnd(buf) {
71654
- return buf && buf.length ? this.write(buf) : '';
71904
+ function base64DetectIncompleteChar(buffer) {
71905
+ this.charReceived = buffer.length % 3;
71906
+ this.charLength = this.charReceived ? 3 : 0;
71655
71907
  }
71656
71908
 
71909
+
71657
71910
  /***/ }),
71658
71911
 
71659
71912
  /***/ 5803:
@@ -73424,7 +73677,7 @@ module.exports = {"i8":"6.5.4"};
73424
73677
  /***/ ((module) => {
73425
73678
 
73426
73679
  "use strict";
73427
- module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.10","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.10","@onekeyfe/hd-transport":"^0.2.10","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3","ripple-keypairs":"^1.1.4"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9","ripple-keypairs":"^1.1.4"}}');
73680
+ module.exports = JSON.parse('{"name":"@onekeyfe/hd-core","version":"0.2.11","description":"> TODO: description","author":"OneKey","homepage":"https://github.com/OneKeyHQ/hardware-js-sdk#readme","license":"ISC","main":"dist/index.js","types":"dist/index.d.ts","repository":{"type":"git","url":"git+https://github.com/OneKeyHQ/hardware-js-sdk.git"},"publishConfig":{"access":"public"},"scripts":{"dev":"rimraf dist && rollup -c ../../build/rollup.config.js -w","build":"rimraf dist && rollup -c ../../build/rollup.config.js","lint":"eslint .","lint:fix":"eslint . --fix"},"bugs":{"url":"https://github.com/OneKeyHQ/hardware-js-sdk/issues"},"dependencies":{"@onekeyfe/hd-shared":"^0.2.11","@onekeyfe/hd-transport":"^0.2.11","axios":"^0.27.2","bignumber.js":"^9.0.2","jszip":"^3.10.1","parse-uri":"^1.0.7","semver":"^7.3.7"},"peerDependencies":{"@noble/hashes":"^1.1.3","ripple-keypairs":"^1.1.4"},"devDependencies":{"@noble/hashes":"^1.1.3","@types/parse-uri":"^1.0.0","@types/semver":"^7.3.9","ripple-keypairs":"^1.1.4"}}');
73428
73681
 
73429
73682
  /***/ })
73430
73683
 
@@ -75963,7 +76216,7 @@ const src_init = async settings => {
75963
76216
 
75964
76217
  try {
75965
76218
  await init({ ..._settings,
75966
- version: "0.2.10"
76219
+ version: "0.2.11"
75967
76220
  });
75968
76221
  return true;
75969
76222
  } catch (e) {