@solana/web3.js 1.11.1 → 1.12.1

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/lib/index.iife.js CHANGED
@@ -8375,16 +8375,1091 @@ var solanaWeb3 = (function (exports) {
8375
8375
  };
8376
8376
  var sha256 = create$1('SHA-256');
8377
8377
 
8378
+ var lib$1 = {};
8379
+
8380
+ var encoding_lib = {};
8381
+
8382
+ // This is free and unencumbered software released into the public domain.
8383
+ // See LICENSE.md for more information.
8384
+
8385
+ //
8386
+ // Utilities
8387
+ //
8388
+
8389
+ /**
8390
+ * @param {number} a The number to test.
8391
+ * @param {number} min The minimum value in the range, inclusive.
8392
+ * @param {number} max The maximum value in the range, inclusive.
8393
+ * @return {boolean} True if a >= min and a <= max.
8394
+ */
8395
+ function inRange(a, min, max) {
8396
+ return min <= a && a <= max;
8397
+ }
8398
+
8399
+ /**
8400
+ * @param {*} o
8401
+ * @return {Object}
8402
+ */
8403
+ function ToDictionary(o) {
8404
+ if (o === undefined) return {};
8405
+ if (o === Object(o)) return o;
8406
+ throw TypeError('Could not convert argument to dictionary');
8407
+ }
8408
+
8409
+ /**
8410
+ * @param {string} string Input string of UTF-16 code units.
8411
+ * @return {!Array.<number>} Code points.
8412
+ */
8413
+ function stringToCodePoints(string) {
8414
+ // https://heycam.github.io/webidl/#dfn-obtain-unicode
8415
+
8416
+ // 1. Let S be the DOMString value.
8417
+ var s = String(string);
8418
+
8419
+ // 2. Let n be the length of S.
8420
+ var n = s.length;
8421
+
8422
+ // 3. Initialize i to 0.
8423
+ var i = 0;
8424
+
8425
+ // 4. Initialize U to be an empty sequence of Unicode characters.
8426
+ var u = [];
8427
+
8428
+ // 5. While i < n:
8429
+ while (i < n) {
8430
+
8431
+ // 1. Let c be the code unit in S at index i.
8432
+ var c = s.charCodeAt(i);
8433
+
8434
+ // 2. Depending on the value of c:
8435
+
8436
+ // c < 0xD800 or c > 0xDFFF
8437
+ if (c < 0xD800 || c > 0xDFFF) {
8438
+ // Append to U the Unicode character with code point c.
8439
+ u.push(c);
8440
+ }
8441
+
8442
+ // 0xDC00 ≤ c ≤ 0xDFFF
8443
+ else if (0xDC00 <= c && c <= 0xDFFF) {
8444
+ // Append to U a U+FFFD REPLACEMENT CHARACTER.
8445
+ u.push(0xFFFD);
8446
+ }
8447
+
8448
+ // 0xD800 ≤ c ≤ 0xDBFF
8449
+ else if (0xD800 <= c && c <= 0xDBFF) {
8450
+ // 1. If i = n−1, then append to U a U+FFFD REPLACEMENT
8451
+ // CHARACTER.
8452
+ if (i === n - 1) {
8453
+ u.push(0xFFFD);
8454
+ }
8455
+ // 2. Otherwise, i < n−1:
8456
+ else {
8457
+ // 1. Let d be the code unit in S at index i+1.
8458
+ var d = string.charCodeAt(i + 1);
8459
+
8460
+ // 2. If 0xDC00 ≤ d ≤ 0xDFFF, then:
8461
+ if (0xDC00 <= d && d <= 0xDFFF) {
8462
+ // 1. Let a be c & 0x3FF.
8463
+ var a = c & 0x3FF;
8464
+
8465
+ // 2. Let b be d & 0x3FF.
8466
+ var b = d & 0x3FF;
8467
+
8468
+ // 3. Append to U the Unicode character with code point
8469
+ // 2^16+2^10*a+b.
8470
+ u.push(0x10000 + (a << 10) + b);
8471
+
8472
+ // 4. Set i to i+1.
8473
+ i += 1;
8474
+ }
8475
+
8476
+ // 3. Otherwise, d < 0xDC00 or d > 0xDFFF. Append to U a
8477
+ // U+FFFD REPLACEMENT CHARACTER.
8478
+ else {
8479
+ u.push(0xFFFD);
8480
+ }
8481
+ }
8482
+ }
8483
+
8484
+ // 3. Set i to i+1.
8485
+ i += 1;
8486
+ }
8487
+
8488
+ // 6. Return U.
8489
+ return u;
8490
+ }
8491
+
8492
+ /**
8493
+ * @param {!Array.<number>} code_points Array of code points.
8494
+ * @return {string} string String of UTF-16 code units.
8495
+ */
8496
+ function codePointsToString(code_points) {
8497
+ var s = '';
8498
+ for (var i = 0; i < code_points.length; ++i) {
8499
+ var cp = code_points[i];
8500
+ if (cp <= 0xFFFF) {
8501
+ s += String.fromCharCode(cp);
8502
+ } else {
8503
+ cp -= 0x10000;
8504
+ s += String.fromCharCode((cp >> 10) + 0xD800,
8505
+ (cp & 0x3FF) + 0xDC00);
8506
+ }
8507
+ }
8508
+ return s;
8509
+ }
8510
+
8511
+
8512
+ //
8513
+ // Implementation of Encoding specification
8514
+ // https://encoding.spec.whatwg.org/
8515
+ //
8516
+
8517
+ //
8518
+ // 3. Terminology
8519
+ //
8520
+
8521
+ /**
8522
+ * End-of-stream is a special token that signifies no more tokens
8523
+ * are in the stream.
8524
+ * @const
8525
+ */ var end_of_stream = -1;
8526
+
8527
+ /**
8528
+ * A stream represents an ordered sequence of tokens.
8529
+ *
8530
+ * @constructor
8531
+ * @param {!(Array.<number>|Uint8Array)} tokens Array of tokens that provide the
8532
+ * stream.
8533
+ */
8534
+ function Stream(tokens) {
8535
+ /** @type {!Array.<number>} */
8536
+ this.tokens = [].slice.call(tokens);
8537
+ }
8538
+
8539
+ Stream.prototype = {
8540
+ /**
8541
+ * @return {boolean} True if end-of-stream has been hit.
8542
+ */
8543
+ endOfStream: function() {
8544
+ return !this.tokens.length;
8545
+ },
8546
+
8547
+ /**
8548
+ * When a token is read from a stream, the first token in the
8549
+ * stream must be returned and subsequently removed, and
8550
+ * end-of-stream must be returned otherwise.
8551
+ *
8552
+ * @return {number} Get the next token from the stream, or
8553
+ * end_of_stream.
8554
+ */
8555
+ read: function() {
8556
+ if (!this.tokens.length)
8557
+ return end_of_stream;
8558
+ return this.tokens.shift();
8559
+ },
8560
+
8561
+ /**
8562
+ * When one or more tokens are prepended to a stream, those tokens
8563
+ * must be inserted, in given order, before the first token in the
8564
+ * stream.
8565
+ *
8566
+ * @param {(number|!Array.<number>)} token The token(s) to prepend to the stream.
8567
+ */
8568
+ prepend: function(token) {
8569
+ if (Array.isArray(token)) {
8570
+ var tokens = /**@type {!Array.<number>}*/(token);
8571
+ while (tokens.length)
8572
+ this.tokens.unshift(tokens.pop());
8573
+ } else {
8574
+ this.tokens.unshift(token);
8575
+ }
8576
+ },
8577
+
8578
+ /**
8579
+ * When one or more tokens are pushed to a stream, those tokens
8580
+ * must be inserted, in given order, after the last token in the
8581
+ * stream.
8582
+ *
8583
+ * @param {(number|!Array.<number>)} token The tokens(s) to prepend to the stream.
8584
+ */
8585
+ push: function(token) {
8586
+ if (Array.isArray(token)) {
8587
+ var tokens = /**@type {!Array.<number>}*/(token);
8588
+ while (tokens.length)
8589
+ this.tokens.push(tokens.shift());
8590
+ } else {
8591
+ this.tokens.push(token);
8592
+ }
8593
+ }
8594
+ };
8595
+
8596
+ //
8597
+ // 4. Encodings
8598
+ //
8599
+
8600
+ // 4.1 Encoders and decoders
8601
+
8602
+ /** @const */
8603
+ var finished = -1;
8604
+
8605
+ /**
8606
+ * @param {boolean} fatal If true, decoding errors raise an exception.
8607
+ * @param {number=} opt_code_point Override the standard fallback code point.
8608
+ * @return {number} The code point to insert on a decoding error.
8609
+ */
8610
+ function decoderError(fatal, opt_code_point) {
8611
+ if (fatal)
8612
+ throw TypeError('Decoder error');
8613
+ return opt_code_point || 0xFFFD;
8614
+ }
8615
+
8616
+ //
8617
+ // 7. API
8618
+ //
8619
+
8620
+ /** @const */ var DEFAULT_ENCODING = 'utf-8';
8621
+
8622
+ // 7.1 Interface TextDecoder
8623
+
8624
+ /**
8625
+ * @constructor
8626
+ * @param {string=} encoding The label of the encoding;
8627
+ * defaults to 'utf-8'.
8628
+ * @param {Object=} options
8629
+ */
8630
+ function TextDecoder$1(encoding, options) {
8631
+ if (!(this instanceof TextDecoder$1)) {
8632
+ return new TextDecoder$1(encoding, options);
8633
+ }
8634
+ encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;
8635
+ if (encoding !== DEFAULT_ENCODING) {
8636
+ throw new Error('Encoding not supported. Only utf-8 is supported');
8637
+ }
8638
+ options = ToDictionary(options);
8639
+
8640
+ /** @private @type {boolean} */
8641
+ this._streaming = false;
8642
+ /** @private @type {boolean} */
8643
+ this._BOMseen = false;
8644
+ /** @private @type {?Decoder} */
8645
+ this._decoder = null;
8646
+ /** @private @type {boolean} */
8647
+ this._fatal = Boolean(options['fatal']);
8648
+ /** @private @type {boolean} */
8649
+ this._ignoreBOM = Boolean(options['ignoreBOM']);
8650
+
8651
+ Object.defineProperty(this, 'encoding', {value: 'utf-8'});
8652
+ Object.defineProperty(this, 'fatal', {value: this._fatal});
8653
+ Object.defineProperty(this, 'ignoreBOM', {value: this._ignoreBOM});
8654
+ }
8655
+
8656
+ TextDecoder$1.prototype = {
8657
+ /**
8658
+ * @param {ArrayBufferView=} input The buffer of bytes to decode.
8659
+ * @param {Object=} options
8660
+ * @return {string} The decoded string.
8661
+ */
8662
+ decode: function decode(input, options) {
8663
+ var bytes;
8664
+ if (typeof input === 'object' && input instanceof ArrayBuffer) {
8665
+ bytes = new Uint8Array(input);
8666
+ } else if (typeof input === 'object' && 'buffer' in input &&
8667
+ input.buffer instanceof ArrayBuffer) {
8668
+ bytes = new Uint8Array(input.buffer,
8669
+ input.byteOffset,
8670
+ input.byteLength);
8671
+ } else {
8672
+ bytes = new Uint8Array(0);
8673
+ }
8674
+
8675
+ options = ToDictionary(options);
8676
+
8677
+ if (!this._streaming) {
8678
+ this._decoder = new UTF8Decoder({fatal: this._fatal});
8679
+ this._BOMseen = false;
8680
+ }
8681
+ this._streaming = Boolean(options['stream']);
8682
+
8683
+ var input_stream = new Stream(bytes);
8684
+
8685
+ var code_points = [];
8686
+
8687
+ /** @type {?(number|!Array.<number>)} */
8688
+ var result;
8689
+
8690
+ while (!input_stream.endOfStream()) {
8691
+ result = this._decoder.handler(input_stream, input_stream.read());
8692
+ if (result === finished)
8693
+ break;
8694
+ if (result === null)
8695
+ continue;
8696
+ if (Array.isArray(result))
8697
+ code_points.push.apply(code_points, /**@type {!Array.<number>}*/(result));
8698
+ else
8699
+ code_points.push(result);
8700
+ }
8701
+ if (!this._streaming) {
8702
+ do {
8703
+ result = this._decoder.handler(input_stream, input_stream.read());
8704
+ if (result === finished)
8705
+ break;
8706
+ if (result === null)
8707
+ continue;
8708
+ if (Array.isArray(result))
8709
+ code_points.push.apply(code_points, /**@type {!Array.<number>}*/(result));
8710
+ else
8711
+ code_points.push(result);
8712
+ } while (!input_stream.endOfStream());
8713
+ this._decoder = null;
8714
+ }
8715
+
8716
+ if (code_points.length) {
8717
+ // If encoding is one of utf-8, utf-16be, and utf-16le, and
8718
+ // ignore BOM flag and BOM seen flag are unset, run these
8719
+ // subsubsteps:
8720
+ if (['utf-8'].indexOf(this.encoding) !== -1 &&
8721
+ !this._ignoreBOM && !this._BOMseen) {
8722
+ // If token is U+FEFF, set BOM seen flag.
8723
+ if (code_points[0] === 0xFEFF) {
8724
+ this._BOMseen = true;
8725
+ code_points.shift();
8726
+ } else {
8727
+ // Otherwise, if token is not end-of-stream, set BOM seen
8728
+ // flag and append token to output.
8729
+ this._BOMseen = true;
8730
+ }
8731
+ }
8732
+ }
8733
+
8734
+ return codePointsToString(code_points);
8735
+ }
8736
+ };
8737
+
8738
+ // 7.2 Interface TextEncoder
8739
+
8740
+ /**
8741
+ * @constructor
8742
+ * @param {string=} encoding The label of the encoding;
8743
+ * defaults to 'utf-8'.
8744
+ * @param {Object=} options
8745
+ */
8746
+ function TextEncoder$1(encoding, options) {
8747
+ if (!(this instanceof TextEncoder$1))
8748
+ return new TextEncoder$1(encoding, options);
8749
+ encoding = encoding !== undefined ? String(encoding).toLowerCase() : DEFAULT_ENCODING;
8750
+ if (encoding !== DEFAULT_ENCODING) {
8751
+ throw new Error('Encoding not supported. Only utf-8 is supported');
8752
+ }
8753
+ options = ToDictionary(options);
8754
+
8755
+ /** @private @type {boolean} */
8756
+ this._streaming = false;
8757
+ /** @private @type {?Encoder} */
8758
+ this._encoder = null;
8759
+ /** @private @type {{fatal: boolean}} */
8760
+ this._options = {fatal: Boolean(options['fatal'])};
8761
+
8762
+ Object.defineProperty(this, 'encoding', {value: 'utf-8'});
8763
+ }
8764
+
8765
+ TextEncoder$1.prototype = {
8766
+ /**
8767
+ * @param {string=} opt_string The string to encode.
8768
+ * @param {Object=} options
8769
+ * @return {Uint8Array} Encoded bytes, as a Uint8Array.
8770
+ */
8771
+ encode: function encode(opt_string, options) {
8772
+ opt_string = opt_string ? String(opt_string) : '';
8773
+ options = ToDictionary(options);
8774
+
8775
+ // NOTE: This option is nonstandard. None of the encodings
8776
+ // permitted for encoding (i.e. UTF-8, UTF-16) are stateful,
8777
+ // so streaming is not necessary.
8778
+ if (!this._streaming)
8779
+ this._encoder = new UTF8Encoder(this._options);
8780
+ this._streaming = Boolean(options['stream']);
8781
+
8782
+ var bytes = [];
8783
+ var input_stream = new Stream(stringToCodePoints(opt_string));
8784
+ /** @type {?(number|!Array.<number>)} */
8785
+ var result;
8786
+ while (!input_stream.endOfStream()) {
8787
+ result = this._encoder.handler(input_stream, input_stream.read());
8788
+ if (result === finished)
8789
+ break;
8790
+ if (Array.isArray(result))
8791
+ bytes.push.apply(bytes, /**@type {!Array.<number>}*/(result));
8792
+ else
8793
+ bytes.push(result);
8794
+ }
8795
+ if (!this._streaming) {
8796
+ while (true) {
8797
+ result = this._encoder.handler(input_stream, input_stream.read());
8798
+ if (result === finished)
8799
+ break;
8800
+ if (Array.isArray(result))
8801
+ bytes.push.apply(bytes, /**@type {!Array.<number>}*/(result));
8802
+ else
8803
+ bytes.push(result);
8804
+ }
8805
+ this._encoder = null;
8806
+ }
8807
+ return new Uint8Array(bytes);
8808
+ }
8809
+ };
8810
+
8811
+ //
8812
+ // 8. The encoding
8813
+ //
8814
+
8815
+ // 8.1 utf-8
8816
+
8817
+ /**
8818
+ * @constructor
8819
+ * @implements {Decoder}
8820
+ * @param {{fatal: boolean}} options
8821
+ */
8822
+ function UTF8Decoder(options) {
8823
+ var fatal = options.fatal;
8824
+
8825
+ // utf-8's decoder's has an associated utf-8 code point, utf-8
8826
+ // bytes seen, and utf-8 bytes needed (all initially 0), a utf-8
8827
+ // lower boundary (initially 0x80), and a utf-8 upper boundary
8828
+ // (initially 0xBF).
8829
+ var /** @type {number} */ utf8_code_point = 0,
8830
+ /** @type {number} */ utf8_bytes_seen = 0,
8831
+ /** @type {number} */ utf8_bytes_needed = 0,
8832
+ /** @type {number} */ utf8_lower_boundary = 0x80,
8833
+ /** @type {number} */ utf8_upper_boundary = 0xBF;
8834
+
8835
+ /**
8836
+ * @param {Stream} stream The stream of bytes being decoded.
8837
+ * @param {number} bite The next byte read from the stream.
8838
+ * @return {?(number|!Array.<number>)} The next code point(s)
8839
+ * decoded, or null if not enough data exists in the input
8840
+ * stream to decode a complete code point.
8841
+ */
8842
+ this.handler = function(stream, bite) {
8843
+ // 1. If byte is end-of-stream and utf-8 bytes needed is not 0,
8844
+ // set utf-8 bytes needed to 0 and return error.
8845
+ if (bite === end_of_stream && utf8_bytes_needed !== 0) {
8846
+ utf8_bytes_needed = 0;
8847
+ return decoderError(fatal);
8848
+ }
8849
+
8850
+ // 2. If byte is end-of-stream, return finished.
8851
+ if (bite === end_of_stream)
8852
+ return finished;
8853
+
8854
+ // 3. If utf-8 bytes needed is 0, based on byte:
8855
+ if (utf8_bytes_needed === 0) {
8856
+
8857
+ // 0x00 to 0x7F
8858
+ if (inRange(bite, 0x00, 0x7F)) {
8859
+ // Return a code point whose value is byte.
8860
+ return bite;
8861
+ }
8862
+
8863
+ // 0xC2 to 0xDF
8864
+ if (inRange(bite, 0xC2, 0xDF)) {
8865
+ // Set utf-8 bytes needed to 1 and utf-8 code point to byte
8866
+ // − 0xC0.
8867
+ utf8_bytes_needed = 1;
8868
+ utf8_code_point = bite - 0xC0;
8869
+ }
8870
+
8871
+ // 0xE0 to 0xEF
8872
+ else if (inRange(bite, 0xE0, 0xEF)) {
8873
+ // 1. If byte is 0xE0, set utf-8 lower boundary to 0xA0.
8874
+ if (bite === 0xE0)
8875
+ utf8_lower_boundary = 0xA0;
8876
+ // 2. If byte is 0xED, set utf-8 upper boundary to 0x9F.
8877
+ if (bite === 0xED)
8878
+ utf8_upper_boundary = 0x9F;
8879
+ // 3. Set utf-8 bytes needed to 2 and utf-8 code point to
8880
+ // byte − 0xE0.
8881
+ utf8_bytes_needed = 2;
8882
+ utf8_code_point = bite - 0xE0;
8883
+ }
8884
+
8885
+ // 0xF0 to 0xF4
8886
+ else if (inRange(bite, 0xF0, 0xF4)) {
8887
+ // 1. If byte is 0xF0, set utf-8 lower boundary to 0x90.
8888
+ if (bite === 0xF0)
8889
+ utf8_lower_boundary = 0x90;
8890
+ // 2. If byte is 0xF4, set utf-8 upper boundary to 0x8F.
8891
+ if (bite === 0xF4)
8892
+ utf8_upper_boundary = 0x8F;
8893
+ // 3. Set utf-8 bytes needed to 3 and utf-8 code point to
8894
+ // byte − 0xF0.
8895
+ utf8_bytes_needed = 3;
8896
+ utf8_code_point = bite - 0xF0;
8897
+ }
8898
+
8899
+ // Otherwise
8900
+ else {
8901
+ // Return error.
8902
+ return decoderError(fatal);
8903
+ }
8904
+
8905
+ // Then (byte is in the range 0xC2 to 0xF4) set utf-8 code
8906
+ // point to utf-8 code point << (6 × utf-8 bytes needed) and
8907
+ // return continue.
8908
+ utf8_code_point = utf8_code_point << (6 * utf8_bytes_needed);
8909
+ return null;
8910
+ }
8911
+
8912
+ // 4. If byte is not in the range utf-8 lower boundary to utf-8
8913
+ // upper boundary, run these substeps:
8914
+ if (!inRange(bite, utf8_lower_boundary, utf8_upper_boundary)) {
8915
+
8916
+ // 1. Set utf-8 code point, utf-8 bytes needed, and utf-8
8917
+ // bytes seen to 0, set utf-8 lower boundary to 0x80, and set
8918
+ // utf-8 upper boundary to 0xBF.
8919
+ utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
8920
+ utf8_lower_boundary = 0x80;
8921
+ utf8_upper_boundary = 0xBF;
8922
+
8923
+ // 2. Prepend byte to stream.
8924
+ stream.prepend(bite);
8925
+
8926
+ // 3. Return error.
8927
+ return decoderError(fatal);
8928
+ }
8929
+
8930
+ // 5. Set utf-8 lower boundary to 0x80 and utf-8 upper boundary
8931
+ // to 0xBF.
8932
+ utf8_lower_boundary = 0x80;
8933
+ utf8_upper_boundary = 0xBF;
8934
+
8935
+ // 6. Increase utf-8 bytes seen by one and set utf-8 code point
8936
+ // to utf-8 code point + (byte − 0x80) << (6 × (utf-8 bytes
8937
+ // needed − utf-8 bytes seen)).
8938
+ utf8_bytes_seen += 1;
8939
+ utf8_code_point += (bite - 0x80) << (6 * (utf8_bytes_needed - utf8_bytes_seen));
8940
+
8941
+ // 7. If utf-8 bytes seen is not equal to utf-8 bytes needed,
8942
+ // continue.
8943
+ if (utf8_bytes_seen !== utf8_bytes_needed)
8944
+ return null;
8945
+
8946
+ // 8. Let code point be utf-8 code point.
8947
+ var code_point = utf8_code_point;
8948
+
8949
+ // 9. Set utf-8 code point, utf-8 bytes needed, and utf-8 bytes
8950
+ // seen to 0.
8951
+ utf8_code_point = utf8_bytes_needed = utf8_bytes_seen = 0;
8952
+
8953
+ // 10. Return a code point whose value is code point.
8954
+ return code_point;
8955
+ };
8956
+ }
8957
+
8958
+ /**
8959
+ * @constructor
8960
+ * @implements {Encoder}
8961
+ * @param {{fatal: boolean}} options
8962
+ */
8963
+ function UTF8Encoder(options) {
8964
+ options.fatal;
8965
+ /**
8966
+ * @param {Stream} stream Input stream.
8967
+ * @param {number} code_point Next code point read from the stream.
8968
+ * @return {(number|!Array.<number>)} Byte(s) to emit.
8969
+ */
8970
+ this.handler = function(stream, code_point) {
8971
+ // 1. If code point is end-of-stream, return finished.
8972
+ if (code_point === end_of_stream)
8973
+ return finished;
8974
+
8975
+ // 2. If code point is in the range U+0000 to U+007F, return a
8976
+ // byte whose value is code point.
8977
+ if (inRange(code_point, 0x0000, 0x007f))
8978
+ return code_point;
8979
+
8980
+ // 3. Set count and offset based on the range code point is in:
8981
+ var count, offset;
8982
+ // U+0080 to U+07FF: 1 and 0xC0
8983
+ if (inRange(code_point, 0x0080, 0x07FF)) {
8984
+ count = 1;
8985
+ offset = 0xC0;
8986
+ }
8987
+ // U+0800 to U+FFFF: 2 and 0xE0
8988
+ else if (inRange(code_point, 0x0800, 0xFFFF)) {
8989
+ count = 2;
8990
+ offset = 0xE0;
8991
+ }
8992
+ // U+10000 to U+10FFFF: 3 and 0xF0
8993
+ else if (inRange(code_point, 0x10000, 0x10FFFF)) {
8994
+ count = 3;
8995
+ offset = 0xF0;
8996
+ }
8997
+
8998
+ // 4.Let bytes be a byte sequence whose first byte is (code
8999
+ // point >> (6 × count)) + offset.
9000
+ var bytes = [(code_point >> (6 * count)) + offset];
9001
+
9002
+ // 5. Run these substeps while count is greater than 0:
9003
+ while (count > 0) {
9004
+
9005
+ // 1. Set temp to code point >> (6 × (count − 1)).
9006
+ var temp = code_point >> (6 * (count - 1));
9007
+
9008
+ // 2. Append to bytes 0x80 | (temp & 0x3F).
9009
+ bytes.push(0x80 | (temp & 0x3F));
9010
+
9011
+ // 3. Decrease count by one.
9012
+ count -= 1;
9013
+ }
9014
+
9015
+ // 6. Return bytes bytes, in order.
9016
+ return bytes;
9017
+ };
9018
+ }
9019
+
9020
+ encoding_lib.TextEncoder = TextEncoder$1;
9021
+ encoding_lib.TextDecoder = TextDecoder$1;
9022
+
9023
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9024
+ if (k2 === undefined) k2 = k;
9025
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9026
+ }) : (function(o, m, k, k2) {
9027
+ if (k2 === undefined) k2 = k;
9028
+ o[k2] = m[k];
9029
+ }));
9030
+ var __setModuleDefault = (commonjsGlobal && commonjsGlobal.__setModuleDefault) || (Object.create ? (function(o, v) {
9031
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
9032
+ }) : function(o, v) {
9033
+ o["default"] = v;
9034
+ });
9035
+ var __decorate = (commonjsGlobal && commonjsGlobal.__decorate) || function (decorators, target, key, desc) {
9036
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9037
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9038
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
9039
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
9040
+ };
9041
+ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (mod) {
9042
+ if (mod && mod.__esModule) return mod;
9043
+ var result = {};
9044
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
9045
+ __setModuleDefault(result, mod);
9046
+ return result;
9047
+ };
9048
+ var __importDefault = (commonjsGlobal && commonjsGlobal.__importDefault) || function (mod) {
9049
+ return (mod && mod.__esModule) ? mod : { "default": mod };
9050
+ };
9051
+ Object.defineProperty(lib$1, "__esModule", { value: true });
9052
+ lib$1.deserializeUnchecked = deserialize_1 = lib$1.deserialize = serialize_1 = lib$1.serialize = lib$1.BinaryReader = lib$1.BinaryWriter = lib$1.BorshError = lib$1.baseDecode = lib$1.baseEncode = void 0;
9053
+ const bn_js_1 = __importDefault(bn.exports);
9054
+ const bs58_1 = __importDefault(bs58);
9055
+ // TODO: Make sure this polyfill not included when not required
9056
+ const encoding = __importStar(encoding_lib);
9057
+ const TextDecoder = (typeof commonjsGlobal.TextDecoder !== 'function') ? encoding.TextDecoder : commonjsGlobal.TextDecoder;
9058
+ const textDecoder = new TextDecoder('utf-8', { fatal: true });
9059
+ function baseEncode(value) {
9060
+ if (typeof (value) === 'string') {
9061
+ value = buffer.Buffer.from(value, 'utf8');
9062
+ }
9063
+ return bs58_1.default.encode(buffer.Buffer.from(value));
9064
+ }
9065
+ lib$1.baseEncode = baseEncode;
9066
+ function baseDecode(value) {
9067
+ return buffer.Buffer.from(bs58_1.default.decode(value));
9068
+ }
9069
+ lib$1.baseDecode = baseDecode;
9070
+ const INITIAL_LENGTH = 1024;
9071
+ class BorshError extends Error {
9072
+ constructor(message) {
9073
+ super(message);
9074
+ this.fieldPath = [];
9075
+ this.originalMessage = message;
9076
+ }
9077
+ addToFieldPath(fieldName) {
9078
+ this.fieldPath.splice(0, 0, fieldName);
9079
+ // NOTE: Modifying message directly as jest doesn't use .toString()
9080
+ this.message = this.originalMessage + ': ' + this.fieldPath.join('.');
9081
+ }
9082
+ }
9083
+ lib$1.BorshError = BorshError;
9084
+ /// Binary encoder.
9085
+ class BinaryWriter {
9086
+ constructor() {
9087
+ this.buf = buffer.Buffer.alloc(INITIAL_LENGTH);
9088
+ this.length = 0;
9089
+ }
9090
+ maybeResize() {
9091
+ if (this.buf.length < 16 + this.length) {
9092
+ this.buf = buffer.Buffer.concat([this.buf, buffer.Buffer.alloc(INITIAL_LENGTH)]);
9093
+ }
9094
+ }
9095
+ writeU8(value) {
9096
+ this.maybeResize();
9097
+ this.buf.writeUInt8(value, this.length);
9098
+ this.length += 1;
9099
+ }
9100
+ writeU16(value) {
9101
+ this.maybeResize();
9102
+ this.buf.writeUInt16LE(value, this.length);
9103
+ this.length += 2;
9104
+ }
9105
+ writeU32(value) {
9106
+ this.maybeResize();
9107
+ this.buf.writeUInt32LE(value, this.length);
9108
+ this.length += 4;
9109
+ }
9110
+ writeU64(value) {
9111
+ this.maybeResize();
9112
+ this.writeBuffer(buffer.Buffer.from(new bn_js_1.default(value).toArray('le', 8)));
9113
+ }
9114
+ writeU128(value) {
9115
+ this.maybeResize();
9116
+ this.writeBuffer(buffer.Buffer.from(new bn_js_1.default(value).toArray('le', 16)));
9117
+ }
9118
+ writeU256(value) {
9119
+ this.maybeResize();
9120
+ this.writeBuffer(buffer.Buffer.from(new bn_js_1.default(value).toArray('le', 32)));
9121
+ }
9122
+ writeU512(value) {
9123
+ this.maybeResize();
9124
+ this.writeBuffer(buffer.Buffer.from(new bn_js_1.default(value).toArray('le', 64)));
9125
+ }
9126
+ writeBuffer(buffer$1) {
9127
+ // Buffer.from is needed as this.buf.subarray can return plain Uint8Array in browser
9128
+ this.buf = buffer.Buffer.concat([buffer.Buffer.from(this.buf.subarray(0, this.length)), buffer$1, buffer.Buffer.alloc(INITIAL_LENGTH)]);
9129
+ this.length += buffer$1.length;
9130
+ }
9131
+ writeString(str) {
9132
+ this.maybeResize();
9133
+ const b = buffer.Buffer.from(str, 'utf8');
9134
+ this.writeU32(b.length);
9135
+ this.writeBuffer(b);
9136
+ }
9137
+ writeFixedArray(array) {
9138
+ this.writeBuffer(buffer.Buffer.from(array));
9139
+ }
9140
+ writeArray(array, fn) {
9141
+ this.maybeResize();
9142
+ this.writeU32(array.length);
9143
+ for (const elem of array) {
9144
+ this.maybeResize();
9145
+ fn(elem);
9146
+ }
9147
+ }
9148
+ toArray() {
9149
+ return this.buf.subarray(0, this.length);
9150
+ }
9151
+ }
9152
+ lib$1.BinaryWriter = BinaryWriter;
9153
+ function handlingRangeError(target, propertyKey, propertyDescriptor) {
9154
+ const originalMethod = propertyDescriptor.value;
9155
+ propertyDescriptor.value = function (...args) {
9156
+ try {
9157
+ return originalMethod.apply(this, args);
9158
+ }
9159
+ catch (e) {
9160
+ if (e instanceof RangeError) {
9161
+ const code = e.code;
9162
+ if (['ERR_BUFFER_OUT_OF_BOUNDS', 'ERR_OUT_OF_RANGE'].indexOf(code) >= 0) {
9163
+ throw new BorshError('Reached the end of buffer when deserializing');
9164
+ }
9165
+ }
9166
+ throw e;
9167
+ }
9168
+ };
9169
+ }
9170
+ class BinaryReader {
9171
+ constructor(buf) {
9172
+ this.buf = buf;
9173
+ this.offset = 0;
9174
+ }
9175
+ readU8() {
9176
+ const value = this.buf.readUInt8(this.offset);
9177
+ this.offset += 1;
9178
+ return value;
9179
+ }
9180
+ readU16() {
9181
+ const value = this.buf.readUInt16LE(this.offset);
9182
+ this.offset += 2;
9183
+ return value;
9184
+ }
9185
+ readU32() {
9186
+ const value = this.buf.readUInt32LE(this.offset);
9187
+ this.offset += 4;
9188
+ return value;
9189
+ }
9190
+ readU64() {
9191
+ const buf = this.readBuffer(8);
9192
+ return new bn_js_1.default(buf, 'le');
9193
+ }
9194
+ readU128() {
9195
+ const buf = this.readBuffer(16);
9196
+ return new bn_js_1.default(buf, 'le');
9197
+ }
9198
+ readU256() {
9199
+ const buf = this.readBuffer(32);
9200
+ return new bn_js_1.default(buf, 'le');
9201
+ }
9202
+ readU512() {
9203
+ const buf = this.readBuffer(64);
9204
+ return new bn_js_1.default(buf, 'le');
9205
+ }
9206
+ readBuffer(len) {
9207
+ if ((this.offset + len) > this.buf.length) {
9208
+ throw new BorshError(`Expected buffer length ${len} isn't within bounds`);
9209
+ }
9210
+ const result = this.buf.slice(this.offset, this.offset + len);
9211
+ this.offset += len;
9212
+ return result;
9213
+ }
9214
+ readString() {
9215
+ const len = this.readU32();
9216
+ const buf = this.readBuffer(len);
9217
+ try {
9218
+ // NOTE: Using TextDecoder to fail on invalid UTF-8
9219
+ return textDecoder.decode(buf);
9220
+ }
9221
+ catch (e) {
9222
+ throw new BorshError(`Error decoding UTF-8 string: ${e}`);
9223
+ }
9224
+ }
9225
+ readFixedArray(len) {
9226
+ return new Uint8Array(this.readBuffer(len));
9227
+ }
9228
+ readArray(fn) {
9229
+ const len = this.readU32();
9230
+ const result = Array();
9231
+ for (let i = 0; i < len; ++i) {
9232
+ result.push(fn());
9233
+ }
9234
+ return result;
9235
+ }
9236
+ }
9237
+ __decorate([
9238
+ handlingRangeError
9239
+ ], BinaryReader.prototype, "readU8", null);
9240
+ __decorate([
9241
+ handlingRangeError
9242
+ ], BinaryReader.prototype, "readU16", null);
9243
+ __decorate([
9244
+ handlingRangeError
9245
+ ], BinaryReader.prototype, "readU32", null);
9246
+ __decorate([
9247
+ handlingRangeError
9248
+ ], BinaryReader.prototype, "readU64", null);
9249
+ __decorate([
9250
+ handlingRangeError
9251
+ ], BinaryReader.prototype, "readU128", null);
9252
+ __decorate([
9253
+ handlingRangeError
9254
+ ], BinaryReader.prototype, "readU256", null);
9255
+ __decorate([
9256
+ handlingRangeError
9257
+ ], BinaryReader.prototype, "readU512", null);
9258
+ __decorate([
9259
+ handlingRangeError
9260
+ ], BinaryReader.prototype, "readString", null);
9261
+ __decorate([
9262
+ handlingRangeError
9263
+ ], BinaryReader.prototype, "readFixedArray", null);
9264
+ __decorate([
9265
+ handlingRangeError
9266
+ ], BinaryReader.prototype, "readArray", null);
9267
+ lib$1.BinaryReader = BinaryReader;
9268
+ function capitalizeFirstLetter(string) {
9269
+ return string.charAt(0).toUpperCase() + string.slice(1);
9270
+ }
9271
+ function serializeField(schema, fieldName, value, fieldType, writer) {
9272
+ try {
9273
+ // TODO: Handle missing values properly (make sure they never result in just skipped write)
9274
+ if (typeof fieldType === 'string') {
9275
+ writer[`write${capitalizeFirstLetter(fieldType)}`](value);
9276
+ }
9277
+ else if (fieldType instanceof Array) {
9278
+ if (typeof fieldType[0] === 'number') {
9279
+ if (value.length !== fieldType[0]) {
9280
+ throw new BorshError(`Expecting byte array of length ${fieldType[0]}, but got ${value.length} bytes`);
9281
+ }
9282
+ writer.writeFixedArray(value);
9283
+ }
9284
+ else {
9285
+ writer.writeArray(value, (item) => { serializeField(schema, fieldName, item, fieldType[0], writer); });
9286
+ }
9287
+ }
9288
+ else if (fieldType.kind !== undefined) {
9289
+ switch (fieldType.kind) {
9290
+ case 'option': {
9291
+ if (value === null || value === undefined) {
9292
+ writer.writeU8(0);
9293
+ }
9294
+ else {
9295
+ writer.writeU8(1);
9296
+ serializeField(schema, fieldName, value, fieldType.type, writer);
9297
+ }
9298
+ break;
9299
+ }
9300
+ default: throw new BorshError(`FieldType ${fieldType} unrecognized`);
9301
+ }
9302
+ }
9303
+ else {
9304
+ serializeStruct(schema, value, writer);
9305
+ }
9306
+ }
9307
+ catch (error) {
9308
+ if (error instanceof BorshError) {
9309
+ error.addToFieldPath(fieldName);
9310
+ }
9311
+ throw error;
9312
+ }
9313
+ }
9314
+ function serializeStruct(schema, obj, writer) {
9315
+ const structSchema = schema.get(obj.constructor);
9316
+ if (!structSchema) {
9317
+ throw new BorshError(`Class ${obj.constructor.name} is missing in schema`);
9318
+ }
9319
+ if (structSchema.kind === 'struct') {
9320
+ structSchema.fields.map(([fieldName, fieldType]) => {
9321
+ serializeField(schema, fieldName, obj[fieldName], fieldType, writer);
9322
+ });
9323
+ }
9324
+ else if (structSchema.kind === 'enum') {
9325
+ const name = obj[structSchema.field];
9326
+ for (let idx = 0; idx < structSchema.values.length; ++idx) {
9327
+ const [fieldName, fieldType] = structSchema.values[idx];
9328
+ if (fieldName === name) {
9329
+ writer.writeU8(idx);
9330
+ serializeField(schema, fieldName, obj[fieldName], fieldType, writer);
9331
+ break;
9332
+ }
9333
+ }
9334
+ }
9335
+ else {
9336
+ throw new BorshError(`Unexpected schema kind: ${structSchema.kind} for ${obj.constructor.name}`);
9337
+ }
9338
+ }
9339
+ /// Serialize given object using schema of the form:
9340
+ /// { class_name -> [ [field_name, field_type], .. ], .. }
9341
+ function serialize(schema, obj) {
9342
+ const writer = new BinaryWriter();
9343
+ serializeStruct(schema, obj, writer);
9344
+ return writer.toArray();
9345
+ }
9346
+ var serialize_1 = lib$1.serialize = serialize;
9347
+ function deserializeField(schema, fieldName, fieldType, reader) {
9348
+ try {
9349
+ if (typeof fieldType === 'string') {
9350
+ return reader[`read${capitalizeFirstLetter(fieldType)}`]();
9351
+ }
9352
+ if (fieldType instanceof Array) {
9353
+ if (typeof fieldType[0] === 'number') {
9354
+ return reader.readFixedArray(fieldType[0]);
9355
+ }
9356
+ return reader.readArray(() => deserializeField(schema, fieldName, fieldType[0], reader));
9357
+ }
9358
+ if (fieldType.kind === 'option') {
9359
+ const option = reader.readU8();
9360
+ if (option) {
9361
+ return deserializeField(schema, fieldName, fieldType.type, reader);
9362
+ }
9363
+ return undefined;
9364
+ }
9365
+ return deserializeStruct(schema, fieldType, reader);
9366
+ }
9367
+ catch (error) {
9368
+ if (error instanceof BorshError) {
9369
+ error.addToFieldPath(fieldName);
9370
+ }
9371
+ throw error;
9372
+ }
9373
+ }
9374
+ function deserializeStruct(schema, classType, reader) {
9375
+ const structSchema = schema.get(classType);
9376
+ if (!structSchema) {
9377
+ throw new BorshError(`Class ${classType.name} is missing in schema`);
9378
+ }
9379
+ if (structSchema.kind === 'struct') {
9380
+ const result = {};
9381
+ for (const [fieldName, fieldType] of schema.get(classType).fields) {
9382
+ result[fieldName] = deserializeField(schema, fieldName, fieldType, reader);
9383
+ }
9384
+ return new classType(result);
9385
+ }
9386
+ if (structSchema.kind === 'enum') {
9387
+ const idx = reader.readU8();
9388
+ if (idx >= structSchema.values.length) {
9389
+ throw new BorshError(`Enum index: ${idx} is out of range`);
9390
+ }
9391
+ const [fieldName, fieldType] = structSchema.values[idx];
9392
+ const fieldValue = deserializeField(schema, fieldName, fieldType, reader);
9393
+ return new classType({ [fieldName]: fieldValue });
9394
+ }
9395
+ throw new BorshError(`Unexpected schema kind: ${structSchema.kind} for ${classType.constructor.name}`);
9396
+ }
9397
+ /// Deserializes object from bytes using schema.
9398
+ function deserialize(schema, classType, buffer) {
9399
+ const reader = new BinaryReader(buffer);
9400
+ const result = deserializeStruct(schema, classType, reader);
9401
+ if (reader.offset < buffer.length) {
9402
+ throw new BorshError(`Unexpected ${buffer.length - reader.offset} bytes after deserialized data`);
9403
+ }
9404
+ return result;
9405
+ }
9406
+ var deserialize_1 = lib$1.deserialize = deserialize;
9407
+ /// Deserializes object from bytes using schema, without checking the length read
9408
+ function deserializeUnchecked(schema, classType, buffer) {
9409
+ const reader = new BinaryReader(buffer);
9410
+ return deserializeStruct(schema, classType, reader);
9411
+ }
9412
+ lib$1.deserializeUnchecked = deserializeUnchecked;
9413
+
9414
+ class Struct$1 {
9415
+ constructor(properties) {
9416
+ Object.assign(this, properties);
9417
+ }
9418
+
9419
+ encode() {
9420
+ return buffer.Buffer.from(serialize_1(SOLANA_SCHEMA, this));
9421
+ }
9422
+
9423
+ static decode(data) {
9424
+ return deserialize_1(SOLANA_SCHEMA, this, data);
9425
+ }
9426
+
9427
+ } // Class representing a Rust-compatible enum, since enums are only strings or
9428
+ // numbers in pure JS
9429
+
9430
+ class Enum extends Struct$1 {
9431
+ constructor(properties) {
9432
+ super(properties);
9433
+
9434
+ _defineProperty(this, "enum", '');
9435
+
9436
+ if (Object.keys(properties).length !== 1) {
9437
+ throw new Error('Enum can only take single value');
9438
+ }
9439
+
9440
+ Object.keys(properties).map(key => {
9441
+ this.enum = key;
9442
+ });
9443
+ }
9444
+
9445
+ }
9446
+ const SOLANA_SCHEMA = new Map();
9447
+
8378
9448
  /**
8379
9449
  * Maximum length of derived pubkey seed
8380
9450
  */
8381
9451
 
8382
9452
  const MAX_SEED_LENGTH = 32;
9453
+
9454
+ function isPublicKeyData(value) {
9455
+ return value._bn !== undefined;
9456
+ }
8383
9457
  /**
8384
9458
  * A public key
8385
9459
  */
8386
9460
 
8387
- class PublicKey {
9461
+
9462
+ class PublicKey extends Struct$1 {
8388
9463
  /** @internal */
8389
9464
 
8390
9465
  /**
@@ -8392,21 +9467,27 @@ var solanaWeb3 = (function (exports) {
8392
9467
  * @param value ed25519 public key as buffer or base-58 encoded string
8393
9468
  */
8394
9469
  constructor(value) {
8395
- if (typeof value === 'string') {
8396
- // assume base 58 encoding by default
8397
- const decoded = bs58.decode(value);
8398
-
8399
- if (decoded.length != 32) {
8400
- throw new Error("Invalid public key input");
8401
- }
9470
+ super({});
8402
9471
 
8403
- this._bn = new BN$9(decoded);
9472
+ if (isPublicKeyData(value)) {
9473
+ this._bn = value._bn;
8404
9474
  } else {
8405
- this._bn = new BN$9(value);
8406
- }
9475
+ if (typeof value === 'string') {
9476
+ // assume base 58 encoding by default
9477
+ const decoded = bs58.decode(value);
9478
+
9479
+ if (decoded.length != 32) {
9480
+ throw new Error("Invalid public key input");
9481
+ }
9482
+
9483
+ this._bn = new BN$9(decoded);
9484
+ } else {
9485
+ this._bn = new BN$9(value);
9486
+ }
8407
9487
 
8408
- if (this._bn.byteLength() > 32) {
8409
- throw new Error("Invalid public key input");
9488
+ if (this._bn.byteLength() > 32) {
9489
+ throw new Error("Invalid public key input");
9490
+ }
8410
9491
  }
8411
9492
  }
8412
9493
  /**
@@ -8534,10 +9615,15 @@ var solanaWeb3 = (function (exports) {
8534
9615
  return is_on_curve(pubkey) == 1;
8535
9616
  }
8536
9617
 
8537
- } // @ts-ignore
9618
+ }
8538
9619
 
8539
9620
  _defineProperty(PublicKey, "default", new PublicKey('11111111111111111111111111111111'));
8540
9621
 
9622
+ SOLANA_SCHEMA.set(PublicKey, {
9623
+ kind: 'struct',
9624
+ fields: [['_bn', 'u256']]
9625
+ }); // @ts-ignore
9626
+
8541
9627
  let naclLowLevel = nacl.lowlevel; // Check that a pubkey is on the curve.
8542
9628
  // This function and its dependents were sourced from:
8543
9629
  // https://github.com/dchest/tweetnacl-js/blob/f1ec050ceae0861f34280e62498b1d3ed9c350c6/nacl.js#L792
@@ -27736,6 +28822,7 @@ var solanaWeb3 = (function (exports) {
27736
28822
  exports.BPF_LOADER_PROGRAM_ID = BPF_LOADER_PROGRAM_ID;
27737
28823
  exports.BpfLoader = BpfLoader;
27738
28824
  exports.Connection = Connection;
28825
+ exports.Enum = Enum;
27739
28826
  exports.FeeCalculatorLayout = FeeCalculatorLayout;
27740
28827
  exports.Keypair = Keypair;
27741
28828
  exports.LAMPORTS_PER_SOL = LAMPORTS_PER_SOL;
@@ -27747,6 +28834,7 @@ var solanaWeb3 = (function (exports) {
27747
28834
  exports.NonceAccount = NonceAccount;
27748
28835
  exports.PACKET_DATA_SIZE = PACKET_DATA_SIZE;
27749
28836
  exports.PublicKey = PublicKey;
28837
+ exports.SOLANA_SCHEMA = SOLANA_SCHEMA;
27750
28838
  exports.STAKE_CONFIG_ID = STAKE_CONFIG_ID;
27751
28839
  exports.STAKE_INSTRUCTION_LAYOUTS = STAKE_INSTRUCTION_LAYOUTS;
27752
28840
  exports.SYSTEM_INSTRUCTION_LAYOUTS = SYSTEM_INSTRUCTION_LAYOUTS;
@@ -27760,6 +28848,7 @@ var solanaWeb3 = (function (exports) {
27760
28848
  exports.StakeAuthorizationLayout = StakeAuthorizationLayout;
27761
28849
  exports.StakeInstruction = StakeInstruction;
27762
28850
  exports.StakeProgram = StakeProgram;
28851
+ exports.Struct = Struct$1;
27763
28852
  exports.SystemInstruction = SystemInstruction;
27764
28853
  exports.SystemProgram = SystemProgram;
27765
28854
  exports.Transaction = Transaction;