@solana/web3.js 1.43.1 → 1.43.2

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.
@@ -53,12 +53,6 @@ const toBuffer = arr => {
53
53
  }
54
54
  };
55
55
 
56
- var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
57
-
58
- function getDefaultExportFromCjs (x) {
59
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
60
- }
61
-
62
56
  var hash$1 = {};
63
57
 
64
58
  var utils$9 = {};
@@ -1295,22 +1289,22 @@ Hmac.prototype.digest = function digest(enc) {
1295
1289
  };
1296
1290
 
1297
1291
  (function (exports) {
1298
- var hash = exports;
1299
-
1300
- hash.utils = utils$9;
1301
- hash.common = common$5;
1302
- hash.sha = sha;
1303
- hash.ripemd = ripemd;
1304
- hash.hmac = hmac;
1305
-
1306
- // Proxy hash functions to the main object
1307
- hash.sha1 = hash.sha.sha1;
1308
- hash.sha256 = hash.sha.sha256;
1309
- hash.sha224 = hash.sha.sha224;
1310
- hash.sha384 = hash.sha.sha384;
1311
- hash.sha512 = hash.sha.sha512;
1312
- hash.ripemd160 = hash.ripemd.ripemd160;
1313
- }(hash$1));
1292
+ var hash = exports;
1293
+
1294
+ hash.utils = utils$9;
1295
+ hash.common = common$5;
1296
+ hash.sha = sha;
1297
+ hash.ripemd = ripemd;
1298
+ hash.hmac = hmac;
1299
+
1300
+ // Proxy hash functions to the main object
1301
+ hash.sha1 = hash.sha.sha1;
1302
+ hash.sha256 = hash.sha.sha256;
1303
+ hash.sha224 = hash.sha.sha224;
1304
+ hash.sha384 = hash.sha.sha384;
1305
+ hash.sha512 = hash.sha.sha512;
1306
+ hash.ripemd160 = hash.ripemd.ripemd160;
1307
+ } (hash$1));
1314
1308
 
1315
1309
  var hash = hash$1;
1316
1310
 
@@ -4342,567 +4336,6 @@ class ComputeBudgetProgram {
4342
4336
  }
4343
4337
  ComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');
4344
4338
 
4345
- var browserPonyfill = {exports: {}};
4346
-
4347
- (function (module, exports) {
4348
- var global = typeof self !== 'undefined' ? self : commonjsGlobal;
4349
- var __self__ = (function () {
4350
- function F() {
4351
- this.fetch = false;
4352
- this.DOMException = global.DOMException;
4353
- }
4354
- F.prototype = global;
4355
- return new F();
4356
- })();
4357
- (function(self) {
4358
-
4359
- ((function (exports) {
4360
-
4361
- var support = {
4362
- searchParams: 'URLSearchParams' in self,
4363
- iterable: 'Symbol' in self && 'iterator' in Symbol,
4364
- blob:
4365
- 'FileReader' in self &&
4366
- 'Blob' in self &&
4367
- (function() {
4368
- try {
4369
- new Blob();
4370
- return true
4371
- } catch (e) {
4372
- return false
4373
- }
4374
- })(),
4375
- formData: 'FormData' in self,
4376
- arrayBuffer: 'ArrayBuffer' in self
4377
- };
4378
-
4379
- function isDataView(obj) {
4380
- return obj && DataView.prototype.isPrototypeOf(obj)
4381
- }
4382
-
4383
- if (support.arrayBuffer) {
4384
- var viewClasses = [
4385
- '[object Int8Array]',
4386
- '[object Uint8Array]',
4387
- '[object Uint8ClampedArray]',
4388
- '[object Int16Array]',
4389
- '[object Uint16Array]',
4390
- '[object Int32Array]',
4391
- '[object Uint32Array]',
4392
- '[object Float32Array]',
4393
- '[object Float64Array]'
4394
- ];
4395
-
4396
- var isArrayBufferView =
4397
- ArrayBuffer.isView ||
4398
- function(obj) {
4399
- return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
4400
- };
4401
- }
4402
-
4403
- function normalizeName(name) {
4404
- if (typeof name !== 'string') {
4405
- name = String(name);
4406
- }
4407
- if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
4408
- throw new TypeError('Invalid character in header field name')
4409
- }
4410
- return name.toLowerCase()
4411
- }
4412
-
4413
- function normalizeValue(value) {
4414
- if (typeof value !== 'string') {
4415
- value = String(value);
4416
- }
4417
- return value
4418
- }
4419
-
4420
- // Build a destructive iterator for the value list
4421
- function iteratorFor(items) {
4422
- var iterator = {
4423
- next: function() {
4424
- var value = items.shift();
4425
- return {done: value === undefined, value: value}
4426
- }
4427
- };
4428
-
4429
- if (support.iterable) {
4430
- iterator[Symbol.iterator] = function() {
4431
- return iterator
4432
- };
4433
- }
4434
-
4435
- return iterator
4436
- }
4437
-
4438
- function Headers(headers) {
4439
- this.map = {};
4440
-
4441
- if (headers instanceof Headers) {
4442
- headers.forEach(function(value, name) {
4443
- this.append(name, value);
4444
- }, this);
4445
- } else if (Array.isArray(headers)) {
4446
- headers.forEach(function(header) {
4447
- this.append(header[0], header[1]);
4448
- }, this);
4449
- } else if (headers) {
4450
- Object.getOwnPropertyNames(headers).forEach(function(name) {
4451
- this.append(name, headers[name]);
4452
- }, this);
4453
- }
4454
- }
4455
-
4456
- Headers.prototype.append = function(name, value) {
4457
- name = normalizeName(name);
4458
- value = normalizeValue(value);
4459
- var oldValue = this.map[name];
4460
- this.map[name] = oldValue ? oldValue + ', ' + value : value;
4461
- };
4462
-
4463
- Headers.prototype['delete'] = function(name) {
4464
- delete this.map[normalizeName(name)];
4465
- };
4466
-
4467
- Headers.prototype.get = function(name) {
4468
- name = normalizeName(name);
4469
- return this.has(name) ? this.map[name] : null
4470
- };
4471
-
4472
- Headers.prototype.has = function(name) {
4473
- return this.map.hasOwnProperty(normalizeName(name))
4474
- };
4475
-
4476
- Headers.prototype.set = function(name, value) {
4477
- this.map[normalizeName(name)] = normalizeValue(value);
4478
- };
4479
-
4480
- Headers.prototype.forEach = function(callback, thisArg) {
4481
- for (var name in this.map) {
4482
- if (this.map.hasOwnProperty(name)) {
4483
- callback.call(thisArg, this.map[name], name, this);
4484
- }
4485
- }
4486
- };
4487
-
4488
- Headers.prototype.keys = function() {
4489
- var items = [];
4490
- this.forEach(function(value, name) {
4491
- items.push(name);
4492
- });
4493
- return iteratorFor(items)
4494
- };
4495
-
4496
- Headers.prototype.values = function() {
4497
- var items = [];
4498
- this.forEach(function(value) {
4499
- items.push(value);
4500
- });
4501
- return iteratorFor(items)
4502
- };
4503
-
4504
- Headers.prototype.entries = function() {
4505
- var items = [];
4506
- this.forEach(function(value, name) {
4507
- items.push([name, value]);
4508
- });
4509
- return iteratorFor(items)
4510
- };
4511
-
4512
- if (support.iterable) {
4513
- Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
4514
- }
4515
-
4516
- function consumed(body) {
4517
- if (body.bodyUsed) {
4518
- return Promise.reject(new TypeError('Already read'))
4519
- }
4520
- body.bodyUsed = true;
4521
- }
4522
-
4523
- function fileReaderReady(reader) {
4524
- return new Promise(function(resolve, reject) {
4525
- reader.onload = function() {
4526
- resolve(reader.result);
4527
- };
4528
- reader.onerror = function() {
4529
- reject(reader.error);
4530
- };
4531
- })
4532
- }
4533
-
4534
- function readBlobAsArrayBuffer(blob) {
4535
- var reader = new FileReader();
4536
- var promise = fileReaderReady(reader);
4537
- reader.readAsArrayBuffer(blob);
4538
- return promise
4539
- }
4540
-
4541
- function readBlobAsText(blob) {
4542
- var reader = new FileReader();
4543
- var promise = fileReaderReady(reader);
4544
- reader.readAsText(blob);
4545
- return promise
4546
- }
4547
-
4548
- function readArrayBufferAsText(buf) {
4549
- var view = new Uint8Array(buf);
4550
- var chars = new Array(view.length);
4551
-
4552
- for (var i = 0; i < view.length; i++) {
4553
- chars[i] = String.fromCharCode(view[i]);
4554
- }
4555
- return chars.join('')
4556
- }
4557
-
4558
- function bufferClone(buf) {
4559
- if (buf.slice) {
4560
- return buf.slice(0)
4561
- } else {
4562
- var view = new Uint8Array(buf.byteLength);
4563
- view.set(new Uint8Array(buf));
4564
- return view.buffer
4565
- }
4566
- }
4567
-
4568
- function Body() {
4569
- this.bodyUsed = false;
4570
-
4571
- this._initBody = function(body) {
4572
- this._bodyInit = body;
4573
- if (!body) {
4574
- this._bodyText = '';
4575
- } else if (typeof body === 'string') {
4576
- this._bodyText = body;
4577
- } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
4578
- this._bodyBlob = body;
4579
- } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
4580
- this._bodyFormData = body;
4581
- } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
4582
- this._bodyText = body.toString();
4583
- } else if (support.arrayBuffer && support.blob && isDataView(body)) {
4584
- this._bodyArrayBuffer = bufferClone(body.buffer);
4585
- // IE 10-11 can't handle a DataView body.
4586
- this._bodyInit = new Blob([this._bodyArrayBuffer]);
4587
- } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
4588
- this._bodyArrayBuffer = bufferClone(body);
4589
- } else {
4590
- this._bodyText = body = Object.prototype.toString.call(body);
4591
- }
4592
-
4593
- if (!this.headers.get('content-type')) {
4594
- if (typeof body === 'string') {
4595
- this.headers.set('content-type', 'text/plain;charset=UTF-8');
4596
- } else if (this._bodyBlob && this._bodyBlob.type) {
4597
- this.headers.set('content-type', this._bodyBlob.type);
4598
- } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
4599
- this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
4600
- }
4601
- }
4602
- };
4603
-
4604
- if (support.blob) {
4605
- this.blob = function() {
4606
- var rejected = consumed(this);
4607
- if (rejected) {
4608
- return rejected
4609
- }
4610
-
4611
- if (this._bodyBlob) {
4612
- return Promise.resolve(this._bodyBlob)
4613
- } else if (this._bodyArrayBuffer) {
4614
- return Promise.resolve(new Blob([this._bodyArrayBuffer]))
4615
- } else if (this._bodyFormData) {
4616
- throw new Error('could not read FormData body as blob')
4617
- } else {
4618
- return Promise.resolve(new Blob([this._bodyText]))
4619
- }
4620
- };
4621
-
4622
- this.arrayBuffer = function() {
4623
- if (this._bodyArrayBuffer) {
4624
- return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
4625
- } else {
4626
- return this.blob().then(readBlobAsArrayBuffer)
4627
- }
4628
- };
4629
- }
4630
-
4631
- this.text = function() {
4632
- var rejected = consumed(this);
4633
- if (rejected) {
4634
- return rejected
4635
- }
4636
-
4637
- if (this._bodyBlob) {
4638
- return readBlobAsText(this._bodyBlob)
4639
- } else if (this._bodyArrayBuffer) {
4640
- return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
4641
- } else if (this._bodyFormData) {
4642
- throw new Error('could not read FormData body as text')
4643
- } else {
4644
- return Promise.resolve(this._bodyText)
4645
- }
4646
- };
4647
-
4648
- if (support.formData) {
4649
- this.formData = function() {
4650
- return this.text().then(decode)
4651
- };
4652
- }
4653
-
4654
- this.json = function() {
4655
- return this.text().then(JSON.parse)
4656
- };
4657
-
4658
- return this
4659
- }
4660
-
4661
- // HTTP methods whose capitalization should be normalized
4662
- var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
4663
-
4664
- function normalizeMethod(method) {
4665
- var upcased = method.toUpperCase();
4666
- return methods.indexOf(upcased) > -1 ? upcased : method
4667
- }
4668
-
4669
- function Request(input, options) {
4670
- options = options || {};
4671
- var body = options.body;
4672
-
4673
- if (input instanceof Request) {
4674
- if (input.bodyUsed) {
4675
- throw new TypeError('Already read')
4676
- }
4677
- this.url = input.url;
4678
- this.credentials = input.credentials;
4679
- if (!options.headers) {
4680
- this.headers = new Headers(input.headers);
4681
- }
4682
- this.method = input.method;
4683
- this.mode = input.mode;
4684
- this.signal = input.signal;
4685
- if (!body && input._bodyInit != null) {
4686
- body = input._bodyInit;
4687
- input.bodyUsed = true;
4688
- }
4689
- } else {
4690
- this.url = String(input);
4691
- }
4692
-
4693
- this.credentials = options.credentials || this.credentials || 'same-origin';
4694
- if (options.headers || !this.headers) {
4695
- this.headers = new Headers(options.headers);
4696
- }
4697
- this.method = normalizeMethod(options.method || this.method || 'GET');
4698
- this.mode = options.mode || this.mode || null;
4699
- this.signal = options.signal || this.signal;
4700
- this.referrer = null;
4701
-
4702
- if ((this.method === 'GET' || this.method === 'HEAD') && body) {
4703
- throw new TypeError('Body not allowed for GET or HEAD requests')
4704
- }
4705
- this._initBody(body);
4706
- }
4707
-
4708
- Request.prototype.clone = function() {
4709
- return new Request(this, {body: this._bodyInit})
4710
- };
4711
-
4712
- function decode(body) {
4713
- var form = new FormData();
4714
- body
4715
- .trim()
4716
- .split('&')
4717
- .forEach(function(bytes) {
4718
- if (bytes) {
4719
- var split = bytes.split('=');
4720
- var name = split.shift().replace(/\+/g, ' ');
4721
- var value = split.join('=').replace(/\+/g, ' ');
4722
- form.append(decodeURIComponent(name), decodeURIComponent(value));
4723
- }
4724
- });
4725
- return form
4726
- }
4727
-
4728
- function parseHeaders(rawHeaders) {
4729
- var headers = new Headers();
4730
- // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
4731
- // https://tools.ietf.org/html/rfc7230#section-3.2
4732
- var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
4733
- preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
4734
- var parts = line.split(':');
4735
- var key = parts.shift().trim();
4736
- if (key) {
4737
- var value = parts.join(':').trim();
4738
- headers.append(key, value);
4739
- }
4740
- });
4741
- return headers
4742
- }
4743
-
4744
- Body.call(Request.prototype);
4745
-
4746
- function Response(bodyInit, options) {
4747
- if (!options) {
4748
- options = {};
4749
- }
4750
-
4751
- this.type = 'default';
4752
- this.status = options.status === undefined ? 200 : options.status;
4753
- this.ok = this.status >= 200 && this.status < 300;
4754
- this.statusText = 'statusText' in options ? options.statusText : 'OK';
4755
- this.headers = new Headers(options.headers);
4756
- this.url = options.url || '';
4757
- this._initBody(bodyInit);
4758
- }
4759
-
4760
- Body.call(Response.prototype);
4761
-
4762
- Response.prototype.clone = function() {
4763
- return new Response(this._bodyInit, {
4764
- status: this.status,
4765
- statusText: this.statusText,
4766
- headers: new Headers(this.headers),
4767
- url: this.url
4768
- })
4769
- };
4770
-
4771
- Response.error = function() {
4772
- var response = new Response(null, {status: 0, statusText: ''});
4773
- response.type = 'error';
4774
- return response
4775
- };
4776
-
4777
- var redirectStatuses = [301, 302, 303, 307, 308];
4778
-
4779
- Response.redirect = function(url, status) {
4780
- if (redirectStatuses.indexOf(status) === -1) {
4781
- throw new RangeError('Invalid status code')
4782
- }
4783
-
4784
- return new Response(null, {status: status, headers: {location: url}})
4785
- };
4786
-
4787
- exports.DOMException = self.DOMException;
4788
- try {
4789
- new exports.DOMException();
4790
- } catch (err) {
4791
- exports.DOMException = function(message, name) {
4792
- this.message = message;
4793
- this.name = name;
4794
- var error = Error(message);
4795
- this.stack = error.stack;
4796
- };
4797
- exports.DOMException.prototype = Object.create(Error.prototype);
4798
- exports.DOMException.prototype.constructor = exports.DOMException;
4799
- }
4800
-
4801
- function fetch(input, init) {
4802
- return new Promise(function(resolve, reject) {
4803
- var request = new Request(input, init);
4804
-
4805
- if (request.signal && request.signal.aborted) {
4806
- return reject(new exports.DOMException('Aborted', 'AbortError'))
4807
- }
4808
-
4809
- var xhr = new XMLHttpRequest();
4810
-
4811
- function abortXhr() {
4812
- xhr.abort();
4813
- }
4814
-
4815
- xhr.onload = function() {
4816
- var options = {
4817
- status: xhr.status,
4818
- statusText: xhr.statusText,
4819
- headers: parseHeaders(xhr.getAllResponseHeaders() || '')
4820
- };
4821
- options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
4822
- var body = 'response' in xhr ? xhr.response : xhr.responseText;
4823
- resolve(new Response(body, options));
4824
- };
4825
-
4826
- xhr.onerror = function() {
4827
- reject(new TypeError('Network request failed'));
4828
- };
4829
-
4830
- xhr.ontimeout = function() {
4831
- reject(new TypeError('Network request failed'));
4832
- };
4833
-
4834
- xhr.onabort = function() {
4835
- reject(new exports.DOMException('Aborted', 'AbortError'));
4836
- };
4837
-
4838
- xhr.open(request.method, request.url, true);
4839
-
4840
- if (request.credentials === 'include') {
4841
- xhr.withCredentials = true;
4842
- } else if (request.credentials === 'omit') {
4843
- xhr.withCredentials = false;
4844
- }
4845
-
4846
- if ('responseType' in xhr && support.blob) {
4847
- xhr.responseType = 'blob';
4848
- }
4849
-
4850
- request.headers.forEach(function(value, name) {
4851
- xhr.setRequestHeader(name, value);
4852
- });
4853
-
4854
- if (request.signal) {
4855
- request.signal.addEventListener('abort', abortXhr);
4856
-
4857
- xhr.onreadystatechange = function() {
4858
- // DONE (success or failure)
4859
- if (xhr.readyState === 4) {
4860
- request.signal.removeEventListener('abort', abortXhr);
4861
- }
4862
- };
4863
- }
4864
-
4865
- xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
4866
- })
4867
- }
4868
-
4869
- fetch.polyfill = true;
4870
-
4871
- if (!self.fetch) {
4872
- self.fetch = fetch;
4873
- self.Headers = Headers;
4874
- self.Request = Request;
4875
- self.Response = Response;
4876
- }
4877
-
4878
- exports.Headers = Headers;
4879
- exports.Request = Request;
4880
- exports.Response = Response;
4881
- exports.fetch = fetch;
4882
-
4883
- Object.defineProperty(exports, '__esModule', { value: true });
4884
-
4885
- return exports;
4886
-
4887
- }))({});
4888
- })(__self__);
4889
- __self__.fetch.ponyfill = true;
4890
- // Remove "polyfill" property added by whatwg-fetch
4891
- delete __self__.fetch.polyfill;
4892
- // Choose between native implementation (global) or custom implementation (__self__)
4893
- // var ctx = global.fetch ? global : __self__;
4894
- var ctx = __self__; // this line disable service worker support temporarily
4895
- exports = ctx.fetch; // To enable: import fetch from 'cross-fetch'
4896
- exports.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
4897
- exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
4898
- exports.Headers = ctx.Headers;
4899
- exports.Request = ctx.Request;
4900
- exports.Response = ctx.Response;
4901
- module.exports = exports;
4902
- }(browserPonyfill, browserPonyfill.exports));
4903
-
4904
- var crossFetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
4905
-
4906
4339
  var objToString = Object.prototype.toString;
4907
4340
  var objKeys = Object.keys || function(obj) {
4908
4341
  var keys = [];
@@ -5084,6 +4517,8 @@ class SendTransactionError extends Error {
5084
4517
 
5085
4518
  }
5086
4519
 
4520
+ var fetchImpl = globalThis.fetch;
4521
+
5087
4522
  // TODO: These constants should be removed in favor of reading them out of a
5088
4523
  // Syscall account
5089
4524
 
@@ -5333,15 +4768,15 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(superstruct.type({
5333
4768
  */
5334
4769
 
5335
4770
  function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
5336
- const fetch = customFetch ? customFetch : crossFetch;
4771
+ const fetch = customFetch ? customFetch : fetchImpl;
5337
4772
 
5338
4773
  let fetchWithMiddleware;
5339
4774
 
5340
4775
  if (fetchMiddleware) {
5341
- fetchWithMiddleware = async (url, options) => {
4776
+ fetchWithMiddleware = async (info, init) => {
5342
4777
  const modifiedFetchArgs = await new Promise((resolve, reject) => {
5343
4778
  try {
5344
- fetchMiddleware(url, options, (modifiedUrl, modifiedOptions) => resolve([modifiedUrl, modifiedOptions]));
4779
+ fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit]));
5345
4780
  } catch (error) {
5346
4781
  reject(error);
5347
4782
  }