@solana/web3.js 1.42.0 → 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.
@@ -8,7 +8,7 @@ var BN = require('bn.js');
8
8
  var bs58 = require('bs58');
9
9
  var borsh = require('borsh');
10
10
  var BufferLayout = require('@solana/buffer-layout');
11
- var bufferLayoutUtils = require('@solana/buffer-layout-utils');
11
+ var bigintBuffer = require('bigint-buffer');
12
12
  var superstruct = require('superstruct');
13
13
  var rpcWebsockets = require('rpc-websockets');
14
14
  var RpcClient = require('jayson/lib/client/browser');
@@ -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
 
@@ -2828,8 +2822,6 @@ class Transaction {
2828
2822
  const message = this._compile();
2829
2823
 
2830
2824
  this._partialSign(message, ...uniqueSigners);
2831
-
2832
- this._verifySignatures(message.serialize(), true);
2833
2825
  }
2834
2826
  /**
2835
2827
  * Partially sign a transaction with the specified accounts. All accounts must
@@ -3209,6 +3201,38 @@ class NonceAccount {
3209
3201
 
3210
3202
  }
3211
3203
 
3204
+ const encodeDecode = layout => {
3205
+ const decode = layout.decode.bind(layout);
3206
+ const encode = layout.encode.bind(layout);
3207
+ return {
3208
+ decode,
3209
+ encode
3210
+ };
3211
+ };
3212
+
3213
+ const bigInt = length => property => {
3214
+ const layout = BufferLayout.blob(length, property);
3215
+ const {
3216
+ encode,
3217
+ decode
3218
+ } = encodeDecode(layout);
3219
+ const bigIntLayout = layout;
3220
+
3221
+ bigIntLayout.decode = (buffer$1, offset) => {
3222
+ const src = decode(buffer$1, offset);
3223
+ return bigintBuffer.toBigIntLE(buffer.Buffer.from(src));
3224
+ };
3225
+
3226
+ bigIntLayout.encode = (bigInt, buffer, offset) => {
3227
+ const src = bigintBuffer.toBufferLE(bigInt, length);
3228
+ return encode(src, buffer, offset);
3229
+ };
3230
+
3231
+ return bigIntLayout;
3232
+ };
3233
+
3234
+ const u64 = bigInt(8);
3235
+
3212
3236
  /**
3213
3237
  * Create account system transaction params
3214
3238
  */
@@ -3510,7 +3534,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
3510
3534
  },
3511
3535
  Transfer: {
3512
3536
  index: 2,
3513
- layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports')])
3537
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports')])
3514
3538
  },
3515
3539
  CreateWithSeed: {
3516
3540
  index: 3,
@@ -3546,7 +3570,7 @@ const SYSTEM_INSTRUCTION_LAYOUTS = Object.freeze({
3546
3570
  },
3547
3571
  TransferWithSeed: {
3548
3572
  index: 11,
3549
- layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), bufferLayoutUtils.u64('lamports'), rustString('seed'), publicKey('programId')])
3573
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u32('instruction'), u64('lamports'), rustString('seed'), publicKey('programId')])
3550
3574
  }
3551
3575
  });
3552
3576
  /**
@@ -4187,6 +4211,34 @@ class ComputeBudgetInstruction {
4187
4211
  bytes
4188
4212
  };
4189
4213
  }
4214
+ /**
4215
+ * Decode set compute unit limit compute budget instruction and retrieve the instruction params.
4216
+ */
4217
+
4218
+
4219
+ static decodeSetComputeUnitLimit(instruction) {
4220
+ this.checkProgramId(instruction.programId);
4221
+ const {
4222
+ units
4223
+ } = decodeData(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit, instruction.data);
4224
+ return {
4225
+ units
4226
+ };
4227
+ }
4228
+ /**
4229
+ * Decode set compute unit price compute budget instruction and retrieve the instruction params.
4230
+ */
4231
+
4232
+
4233
+ static decodeSetComputeUnitPrice(instruction) {
4234
+ this.checkProgramId(instruction.programId);
4235
+ const {
4236
+ microLamports
4237
+ } = decodeData(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice, instruction.data);
4238
+ return {
4239
+ microLamports
4240
+ };
4241
+ }
4190
4242
  /**
4191
4243
  * @internal
4192
4244
  */
@@ -4215,6 +4267,14 @@ const COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze({
4215
4267
  RequestHeapFrame: {
4216
4268
  index: 1,
4217
4269
  layout: BufferLayout__namespace.struct([BufferLayout__namespace.u8('instruction'), BufferLayout__namespace.u32('bytes')])
4270
+ },
4271
+ SetComputeUnitLimit: {
4272
+ index: 2,
4273
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u8('instruction'), BufferLayout__namespace.u32('units')])
4274
+ },
4275
+ SetComputeUnitPrice: {
4276
+ index: 3,
4277
+ layout: BufferLayout__namespace.struct([BufferLayout__namespace.u8('instruction'), u64('microLamports')])
4218
4278
  }
4219
4279
  });
4220
4280
  /**
@@ -4251,569 +4311,30 @@ class ComputeBudgetProgram {
4251
4311
  });
4252
4312
  }
4253
4313
 
4254
- }
4255
- ComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');
4256
-
4257
- var browserPonyfill = {exports: {}};
4258
-
4259
- (function (module, exports) {
4260
- var global = typeof self !== 'undefined' ? self : commonjsGlobal;
4261
- var __self__ = (function () {
4262
- function F() {
4263
- this.fetch = false;
4264
- this.DOMException = global.DOMException;
4265
- }
4266
- F.prototype = global;
4267
- return new F();
4268
- })();
4269
- (function(self) {
4270
-
4271
- ((function (exports) {
4272
-
4273
- var support = {
4274
- searchParams: 'URLSearchParams' in self,
4275
- iterable: 'Symbol' in self && 'iterator' in Symbol,
4276
- blob:
4277
- 'FileReader' in self &&
4278
- 'Blob' in self &&
4279
- (function() {
4280
- try {
4281
- new Blob();
4282
- return true
4283
- } catch (e) {
4284
- return false
4285
- }
4286
- })(),
4287
- formData: 'FormData' in self,
4288
- arrayBuffer: 'ArrayBuffer' in self
4289
- };
4290
-
4291
- function isDataView(obj) {
4292
- return obj && DataView.prototype.isPrototypeOf(obj)
4293
- }
4294
-
4295
- if (support.arrayBuffer) {
4296
- var viewClasses = [
4297
- '[object Int8Array]',
4298
- '[object Uint8Array]',
4299
- '[object Uint8ClampedArray]',
4300
- '[object Int16Array]',
4301
- '[object Uint16Array]',
4302
- '[object Int32Array]',
4303
- '[object Uint32Array]',
4304
- '[object Float32Array]',
4305
- '[object Float64Array]'
4306
- ];
4307
-
4308
- var isArrayBufferView =
4309
- ArrayBuffer.isView ||
4310
- function(obj) {
4311
- return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
4312
- };
4313
- }
4314
-
4315
- function normalizeName(name) {
4316
- if (typeof name !== 'string') {
4317
- name = String(name);
4318
- }
4319
- if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
4320
- throw new TypeError('Invalid character in header field name')
4321
- }
4322
- return name.toLowerCase()
4323
- }
4324
-
4325
- function normalizeValue(value) {
4326
- if (typeof value !== 'string') {
4327
- value = String(value);
4328
- }
4329
- return value
4330
- }
4331
-
4332
- // Build a destructive iterator for the value list
4333
- function iteratorFor(items) {
4334
- var iterator = {
4335
- next: function() {
4336
- var value = items.shift();
4337
- return {done: value === undefined, value: value}
4338
- }
4339
- };
4340
-
4341
- if (support.iterable) {
4342
- iterator[Symbol.iterator] = function() {
4343
- return iterator
4344
- };
4345
- }
4346
-
4347
- return iterator
4348
- }
4349
-
4350
- function Headers(headers) {
4351
- this.map = {};
4352
-
4353
- if (headers instanceof Headers) {
4354
- headers.forEach(function(value, name) {
4355
- this.append(name, value);
4356
- }, this);
4357
- } else if (Array.isArray(headers)) {
4358
- headers.forEach(function(header) {
4359
- this.append(header[0], header[1]);
4360
- }, this);
4361
- } else if (headers) {
4362
- Object.getOwnPropertyNames(headers).forEach(function(name) {
4363
- this.append(name, headers[name]);
4364
- }, this);
4365
- }
4366
- }
4367
-
4368
- Headers.prototype.append = function(name, value) {
4369
- name = normalizeName(name);
4370
- value = normalizeValue(value);
4371
- var oldValue = this.map[name];
4372
- this.map[name] = oldValue ? oldValue + ', ' + value : value;
4373
- };
4374
-
4375
- Headers.prototype['delete'] = function(name) {
4376
- delete this.map[normalizeName(name)];
4377
- };
4378
-
4379
- Headers.prototype.get = function(name) {
4380
- name = normalizeName(name);
4381
- return this.has(name) ? this.map[name] : null
4382
- };
4383
-
4384
- Headers.prototype.has = function(name) {
4385
- return this.map.hasOwnProperty(normalizeName(name))
4386
- };
4387
-
4388
- Headers.prototype.set = function(name, value) {
4389
- this.map[normalizeName(name)] = normalizeValue(value);
4390
- };
4391
-
4392
- Headers.prototype.forEach = function(callback, thisArg) {
4393
- for (var name in this.map) {
4394
- if (this.map.hasOwnProperty(name)) {
4395
- callback.call(thisArg, this.map[name], name, this);
4396
- }
4397
- }
4398
- };
4399
-
4400
- Headers.prototype.keys = function() {
4401
- var items = [];
4402
- this.forEach(function(value, name) {
4403
- items.push(name);
4404
- });
4405
- return iteratorFor(items)
4406
- };
4407
-
4408
- Headers.prototype.values = function() {
4409
- var items = [];
4410
- this.forEach(function(value) {
4411
- items.push(value);
4412
- });
4413
- return iteratorFor(items)
4414
- };
4415
-
4416
- Headers.prototype.entries = function() {
4417
- var items = [];
4418
- this.forEach(function(value, name) {
4419
- items.push([name, value]);
4314
+ static setComputeUnitLimit(params) {
4315
+ const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
4316
+ const data = encodeData(type, params);
4317
+ return new TransactionInstruction({
4318
+ keys: [],
4319
+ programId: this.programId,
4320
+ data
4420
4321
  });
4421
- return iteratorFor(items)
4422
- };
4423
-
4424
- if (support.iterable) {
4425
- Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
4426
4322
  }
4427
4323
 
4428
- function consumed(body) {
4429
- if (body.bodyUsed) {
4430
- return Promise.reject(new TypeError('Already read'))
4431
- }
4432
- body.bodyUsed = true;
4433
- }
4434
-
4435
- function fileReaderReady(reader) {
4436
- return new Promise(function(resolve, reject) {
4437
- reader.onload = function() {
4438
- resolve(reader.result);
4439
- };
4440
- reader.onerror = function() {
4441
- reject(reader.error);
4442
- };
4443
- })
4444
- }
4445
-
4446
- function readBlobAsArrayBuffer(blob) {
4447
- var reader = new FileReader();
4448
- var promise = fileReaderReady(reader);
4449
- reader.readAsArrayBuffer(blob);
4450
- return promise
4451
- }
4452
-
4453
- function readBlobAsText(blob) {
4454
- var reader = new FileReader();
4455
- var promise = fileReaderReady(reader);
4456
- reader.readAsText(blob);
4457
- return promise
4458
- }
4459
-
4460
- function readArrayBufferAsText(buf) {
4461
- var view = new Uint8Array(buf);
4462
- var chars = new Array(view.length);
4463
-
4464
- for (var i = 0; i < view.length; i++) {
4465
- chars[i] = String.fromCharCode(view[i]);
4466
- }
4467
- return chars.join('')
4468
- }
4469
-
4470
- function bufferClone(buf) {
4471
- if (buf.slice) {
4472
- return buf.slice(0)
4473
- } else {
4474
- var view = new Uint8Array(buf.byteLength);
4475
- view.set(new Uint8Array(buf));
4476
- return view.buffer
4477
- }
4478
- }
4479
-
4480
- function Body() {
4481
- this.bodyUsed = false;
4482
-
4483
- this._initBody = function(body) {
4484
- this._bodyInit = body;
4485
- if (!body) {
4486
- this._bodyText = '';
4487
- } else if (typeof body === 'string') {
4488
- this._bodyText = body;
4489
- } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
4490
- this._bodyBlob = body;
4491
- } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
4492
- this._bodyFormData = body;
4493
- } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
4494
- this._bodyText = body.toString();
4495
- } else if (support.arrayBuffer && support.blob && isDataView(body)) {
4496
- this._bodyArrayBuffer = bufferClone(body.buffer);
4497
- // IE 10-11 can't handle a DataView body.
4498
- this._bodyInit = new Blob([this._bodyArrayBuffer]);
4499
- } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
4500
- this._bodyArrayBuffer = bufferClone(body);
4501
- } else {
4502
- this._bodyText = body = Object.prototype.toString.call(body);
4503
- }
4504
-
4505
- if (!this.headers.get('content-type')) {
4506
- if (typeof body === 'string') {
4507
- this.headers.set('content-type', 'text/plain;charset=UTF-8');
4508
- } else if (this._bodyBlob && this._bodyBlob.type) {
4509
- this.headers.set('content-type', this._bodyBlob.type);
4510
- } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
4511
- this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
4512
- }
4513
- }
4514
- };
4515
-
4516
- if (support.blob) {
4517
- this.blob = function() {
4518
- var rejected = consumed(this);
4519
- if (rejected) {
4520
- return rejected
4521
- }
4522
-
4523
- if (this._bodyBlob) {
4524
- return Promise.resolve(this._bodyBlob)
4525
- } else if (this._bodyArrayBuffer) {
4526
- return Promise.resolve(new Blob([this._bodyArrayBuffer]))
4527
- } else if (this._bodyFormData) {
4528
- throw new Error('could not read FormData body as blob')
4529
- } else {
4530
- return Promise.resolve(new Blob([this._bodyText]))
4531
- }
4532
- };
4533
-
4534
- this.arrayBuffer = function() {
4535
- if (this._bodyArrayBuffer) {
4536
- return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
4537
- } else {
4538
- return this.blob().then(readBlobAsArrayBuffer)
4539
- }
4540
- };
4541
- }
4542
-
4543
- this.text = function() {
4544
- var rejected = consumed(this);
4545
- if (rejected) {
4546
- return rejected
4547
- }
4548
-
4549
- if (this._bodyBlob) {
4550
- return readBlobAsText(this._bodyBlob)
4551
- } else if (this._bodyArrayBuffer) {
4552
- return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
4553
- } else if (this._bodyFormData) {
4554
- throw new Error('could not read FormData body as text')
4555
- } else {
4556
- return Promise.resolve(this._bodyText)
4557
- }
4558
- };
4559
-
4560
- if (support.formData) {
4561
- this.formData = function() {
4562
- return this.text().then(decode)
4563
- };
4564
- }
4565
-
4566
- this.json = function() {
4567
- return this.text().then(JSON.parse)
4568
- };
4569
-
4570
- return this
4571
- }
4572
-
4573
- // HTTP methods whose capitalization should be normalized
4574
- var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
4575
-
4576
- function normalizeMethod(method) {
4577
- var upcased = method.toUpperCase();
4578
- return methods.indexOf(upcased) > -1 ? upcased : method
4579
- }
4580
-
4581
- function Request(input, options) {
4582
- options = options || {};
4583
- var body = options.body;
4584
-
4585
- if (input instanceof Request) {
4586
- if (input.bodyUsed) {
4587
- throw new TypeError('Already read')
4588
- }
4589
- this.url = input.url;
4590
- this.credentials = input.credentials;
4591
- if (!options.headers) {
4592
- this.headers = new Headers(input.headers);
4593
- }
4594
- this.method = input.method;
4595
- this.mode = input.mode;
4596
- this.signal = input.signal;
4597
- if (!body && input._bodyInit != null) {
4598
- body = input._bodyInit;
4599
- input.bodyUsed = true;
4600
- }
4601
- } else {
4602
- this.url = String(input);
4603
- }
4604
-
4605
- this.credentials = options.credentials || this.credentials || 'same-origin';
4606
- if (options.headers || !this.headers) {
4607
- this.headers = new Headers(options.headers);
4608
- }
4609
- this.method = normalizeMethod(options.method || this.method || 'GET');
4610
- this.mode = options.mode || this.mode || null;
4611
- this.signal = options.signal || this.signal;
4612
- this.referrer = null;
4613
-
4614
- if ((this.method === 'GET' || this.method === 'HEAD') && body) {
4615
- throw new TypeError('Body not allowed for GET or HEAD requests')
4616
- }
4617
- this._initBody(body);
4618
- }
4619
-
4620
- Request.prototype.clone = function() {
4621
- return new Request(this, {body: this._bodyInit})
4622
- };
4623
-
4624
- function decode(body) {
4625
- var form = new FormData();
4626
- body
4627
- .trim()
4628
- .split('&')
4629
- .forEach(function(bytes) {
4630
- if (bytes) {
4631
- var split = bytes.split('=');
4632
- var name = split.shift().replace(/\+/g, ' ');
4633
- var value = split.join('=').replace(/\+/g, ' ');
4634
- form.append(decodeURIComponent(name), decodeURIComponent(value));
4635
- }
4636
- });
4637
- return form
4638
- }
4639
-
4640
- function parseHeaders(rawHeaders) {
4641
- var headers = new Headers();
4642
- // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
4643
- // https://tools.ietf.org/html/rfc7230#section-3.2
4644
- var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
4645
- preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
4646
- var parts = line.split(':');
4647
- var key = parts.shift().trim();
4648
- if (key) {
4649
- var value = parts.join(':').trim();
4650
- headers.append(key, value);
4651
- }
4324
+ static setComputeUnitPrice(params) {
4325
+ const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice;
4326
+ const data = encodeData(type, {
4327
+ microLamports: BigInt(params.microLamports)
4328
+ });
4329
+ return new TransactionInstruction({
4330
+ keys: [],
4331
+ programId: this.programId,
4332
+ data
4652
4333
  });
4653
- return headers
4654
- }
4655
-
4656
- Body.call(Request.prototype);
4657
-
4658
- function Response(bodyInit, options) {
4659
- if (!options) {
4660
- options = {};
4661
- }
4662
-
4663
- this.type = 'default';
4664
- this.status = options.status === undefined ? 200 : options.status;
4665
- this.ok = this.status >= 200 && this.status < 300;
4666
- this.statusText = 'statusText' in options ? options.statusText : 'OK';
4667
- this.headers = new Headers(options.headers);
4668
- this.url = options.url || '';
4669
- this._initBody(bodyInit);
4670
- }
4671
-
4672
- Body.call(Response.prototype);
4673
-
4674
- Response.prototype.clone = function() {
4675
- return new Response(this._bodyInit, {
4676
- status: this.status,
4677
- statusText: this.statusText,
4678
- headers: new Headers(this.headers),
4679
- url: this.url
4680
- })
4681
- };
4682
-
4683
- Response.error = function() {
4684
- var response = new Response(null, {status: 0, statusText: ''});
4685
- response.type = 'error';
4686
- return response
4687
- };
4688
-
4689
- var redirectStatuses = [301, 302, 303, 307, 308];
4690
-
4691
- Response.redirect = function(url, status) {
4692
- if (redirectStatuses.indexOf(status) === -1) {
4693
- throw new RangeError('Invalid status code')
4694
- }
4695
-
4696
- return new Response(null, {status: status, headers: {location: url}})
4697
- };
4698
-
4699
- exports.DOMException = self.DOMException;
4700
- try {
4701
- new exports.DOMException();
4702
- } catch (err) {
4703
- exports.DOMException = function(message, name) {
4704
- this.message = message;
4705
- this.name = name;
4706
- var error = Error(message);
4707
- this.stack = error.stack;
4708
- };
4709
- exports.DOMException.prototype = Object.create(Error.prototype);
4710
- exports.DOMException.prototype.constructor = exports.DOMException;
4711
- }
4712
-
4713
- function fetch(input, init) {
4714
- return new Promise(function(resolve, reject) {
4715
- var request = new Request(input, init);
4716
-
4717
- if (request.signal && request.signal.aborted) {
4718
- return reject(new exports.DOMException('Aborted', 'AbortError'))
4719
- }
4720
-
4721
- var xhr = new XMLHttpRequest();
4722
-
4723
- function abortXhr() {
4724
- xhr.abort();
4725
- }
4726
-
4727
- xhr.onload = function() {
4728
- var options = {
4729
- status: xhr.status,
4730
- statusText: xhr.statusText,
4731
- headers: parseHeaders(xhr.getAllResponseHeaders() || '')
4732
- };
4733
- options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
4734
- var body = 'response' in xhr ? xhr.response : xhr.responseText;
4735
- resolve(new Response(body, options));
4736
- };
4737
-
4738
- xhr.onerror = function() {
4739
- reject(new TypeError('Network request failed'));
4740
- };
4741
-
4742
- xhr.ontimeout = function() {
4743
- reject(new TypeError('Network request failed'));
4744
- };
4745
-
4746
- xhr.onabort = function() {
4747
- reject(new exports.DOMException('Aborted', 'AbortError'));
4748
- };
4749
-
4750
- xhr.open(request.method, request.url, true);
4751
-
4752
- if (request.credentials === 'include') {
4753
- xhr.withCredentials = true;
4754
- } else if (request.credentials === 'omit') {
4755
- xhr.withCredentials = false;
4756
- }
4757
-
4758
- if ('responseType' in xhr && support.blob) {
4759
- xhr.responseType = 'blob';
4760
- }
4761
-
4762
- request.headers.forEach(function(value, name) {
4763
- xhr.setRequestHeader(name, value);
4764
- });
4765
-
4766
- if (request.signal) {
4767
- request.signal.addEventListener('abort', abortXhr);
4768
-
4769
- xhr.onreadystatechange = function() {
4770
- // DONE (success or failure)
4771
- if (xhr.readyState === 4) {
4772
- request.signal.removeEventListener('abort', abortXhr);
4773
- }
4774
- };
4775
- }
4776
-
4777
- xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
4778
- })
4779
- }
4780
-
4781
- fetch.polyfill = true;
4782
-
4783
- if (!self.fetch) {
4784
- self.fetch = fetch;
4785
- self.Headers = Headers;
4786
- self.Request = Request;
4787
- self.Response = Response;
4788
4334
  }
4789
4335
 
4790
- exports.Headers = Headers;
4791
- exports.Request = Request;
4792
- exports.Response = Response;
4793
- exports.fetch = fetch;
4794
-
4795
- Object.defineProperty(exports, '__esModule', { value: true });
4796
-
4797
- return exports;
4798
-
4799
- }))({});
4800
- })(__self__);
4801
- __self__.fetch.ponyfill = true;
4802
- // Remove "polyfill" property added by whatwg-fetch
4803
- delete __self__.fetch.polyfill;
4804
- // Choose between native implementation (global) or custom implementation (__self__)
4805
- // var ctx = global.fetch ? global : __self__;
4806
- var ctx = __self__; // this line disable service worker support temporarily
4807
- exports = ctx.fetch; // To enable: import fetch from 'cross-fetch'
4808
- exports.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
4809
- exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
4810
- exports.Headers = ctx.Headers;
4811
- exports.Request = ctx.Request;
4812
- exports.Response = ctx.Response;
4813
- module.exports = exports;
4814
- }(browserPonyfill, browserPonyfill.exports));
4815
-
4816
- var crossFetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
4336
+ }
4337
+ ComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');
4817
4338
 
4818
4339
  var objToString = Object.prototype.toString;
4819
4340
  var objKeys = Object.keys || function(obj) {
@@ -4996,6 +4517,8 @@ class SendTransactionError extends Error {
4996
4517
 
4997
4518
  }
4998
4519
 
4520
+ var fetchImpl = globalThis.fetch;
4521
+
4999
4522
  // TODO: These constants should be removed in favor of reading them out of a
5000
4523
  // Syscall account
5001
4524
 
@@ -5245,15 +4768,15 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(superstruct.type({
5245
4768
  */
5246
4769
 
5247
4770
  function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
5248
- const fetch = customFetch ? customFetch : crossFetch;
4771
+ const fetch = customFetch ? customFetch : fetchImpl;
5249
4772
 
5250
4773
  let fetchWithMiddleware;
5251
4774
 
5252
4775
  if (fetchMiddleware) {
5253
- fetchWithMiddleware = async (url, options) => {
4776
+ fetchWithMiddleware = async (info, init) => {
5254
4777
  const modifiedFetchArgs = await new Promise((resolve, reject) => {
5255
4778
  try {
5256
- fetchMiddleware(url, options, (modifiedUrl, modifiedOptions) => resolve([modifiedUrl, modifiedOptions]));
4779
+ fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit]));
5257
4780
  } catch (error) {
5258
4781
  reject(error);
5259
4782
  }
@@ -10198,7 +9721,7 @@ VoteProgram.space = 3731;
10198
9721
  *
10199
9722
  * @param {Connection} connection
10200
9723
  * @param {Buffer} rawTransaction
10201
- * @param {BlockheightBasedTransactionConfimationStrategy} confirmationStrategy
9724
+ * @param {BlockheightBasedTransactionConfirmationStrategy} confirmationStrategy
10202
9725
  * @param {ConfirmOptions} [options]
10203
9726
  * @returns {Promise<TransactionSignature>}
10204
9727
  */