@solana/web3.js 1.43.1 → 1.43.4
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.browser.cjs.js +37 -593
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +37 -593
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +86 -63
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +14 -5
- package/lib/index.esm.js +85 -62
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +18265 -17925
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +4 -4
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +6 -5
- package/src/__forks__/browser/fetch-impl.ts +4 -0
- package/src/connection.ts +17 -14
- package/src/fetch-impl.ts +13 -0
- package/src/transaction.ts +16 -11
package/lib/index.browser.esm.js
CHANGED
|
@@ -22,12 +22,6 @@ const toBuffer = arr => {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
26
|
-
|
|
27
|
-
function getDefaultExportFromCjs (x) {
|
|
28
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
25
|
var hash$1 = {};
|
|
32
26
|
|
|
33
27
|
var utils$9 = {};
|
|
@@ -1264,22 +1258,22 @@ Hmac.prototype.digest = function digest(enc) {
|
|
|
1264
1258
|
};
|
|
1265
1259
|
|
|
1266
1260
|
(function (exports) {
|
|
1267
|
-
var hash = exports;
|
|
1268
|
-
|
|
1269
|
-
hash.utils = utils$9;
|
|
1270
|
-
hash.common = common$5;
|
|
1271
|
-
hash.sha = sha;
|
|
1272
|
-
hash.ripemd = ripemd;
|
|
1273
|
-
hash.hmac = hmac;
|
|
1274
|
-
|
|
1275
|
-
// Proxy hash functions to the main object
|
|
1276
|
-
hash.sha1 = hash.sha.sha1;
|
|
1277
|
-
hash.sha256 = hash.sha.sha256;
|
|
1278
|
-
hash.sha224 = hash.sha.sha224;
|
|
1279
|
-
hash.sha384 = hash.sha.sha384;
|
|
1280
|
-
hash.sha512 = hash.sha.sha512;
|
|
1281
|
-
hash.ripemd160 = hash.ripemd.ripemd160;
|
|
1282
|
-
}(hash$1));
|
|
1261
|
+
var hash = exports;
|
|
1262
|
+
|
|
1263
|
+
hash.utils = utils$9;
|
|
1264
|
+
hash.common = common$5;
|
|
1265
|
+
hash.sha = sha;
|
|
1266
|
+
hash.ripemd = ripemd;
|
|
1267
|
+
hash.hmac = hmac;
|
|
1268
|
+
|
|
1269
|
+
// Proxy hash functions to the main object
|
|
1270
|
+
hash.sha1 = hash.sha.sha1;
|
|
1271
|
+
hash.sha256 = hash.sha.sha256;
|
|
1272
|
+
hash.sha224 = hash.sha.sha224;
|
|
1273
|
+
hash.sha384 = hash.sha.sha384;
|
|
1274
|
+
hash.sha512 = hash.sha.sha512;
|
|
1275
|
+
hash.ripemd160 = hash.ripemd.ripemd160;
|
|
1276
|
+
} (hash$1));
|
|
1283
1277
|
|
|
1284
1278
|
var hash = hash$1;
|
|
1285
1279
|
|
|
@@ -2574,13 +2568,6 @@ class Transaction {
|
|
|
2574
2568
|
isSigner: false,
|
|
2575
2569
|
isWritable: false
|
|
2576
2570
|
});
|
|
2577
|
-
}); // Sort. Prioritizing first by signer, then by writable
|
|
2578
|
-
|
|
2579
|
-
accountMetas.sort(function (x, y) {
|
|
2580
|
-
const pubkeySorting = x.pubkey.toBase58().localeCompare(y.pubkey.toBase58());
|
|
2581
|
-
const checkSigner = x.isSigner === y.isSigner ? 0 : x.isSigner ? -1 : 1;
|
|
2582
|
-
const checkWritable = x.isWritable === y.isWritable ? pubkeySorting : x.isWritable ? -1 : 1;
|
|
2583
|
-
return checkSigner || checkWritable;
|
|
2584
2571
|
}); // Cull duplicate account metas
|
|
2585
2572
|
|
|
2586
2573
|
const uniqueMetas = [];
|
|
@@ -2592,9 +2579,25 @@ class Transaction {
|
|
|
2592
2579
|
|
|
2593
2580
|
if (uniqueIndex > -1) {
|
|
2594
2581
|
uniqueMetas[uniqueIndex].isWritable = uniqueMetas[uniqueIndex].isWritable || accountMeta.isWritable;
|
|
2582
|
+
uniqueMetas[uniqueIndex].isSigner = uniqueMetas[uniqueIndex].isSigner || accountMeta.isSigner;
|
|
2595
2583
|
} else {
|
|
2596
2584
|
uniqueMetas.push(accountMeta);
|
|
2597
2585
|
}
|
|
2586
|
+
}); // Sort. Prioritizing first by signer, then by writable
|
|
2587
|
+
|
|
2588
|
+
uniqueMetas.sort(function (x, y) {
|
|
2589
|
+
if (x.isSigner !== y.isSigner) {
|
|
2590
|
+
// Signers always come before non-signers
|
|
2591
|
+
return x.isSigner ? -1 : 1;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
if (x.isWritable !== y.isWritable) {
|
|
2595
|
+
// Writable accounts always come before read-only accounts
|
|
2596
|
+
return x.isWritable ? -1 : 1;
|
|
2597
|
+
} // Otherwise, sort by pubkey.
|
|
2598
|
+
|
|
2599
|
+
|
|
2600
|
+
return x.pubkey._bn.cmp(y.pubkey._bn);
|
|
2598
2601
|
}); // Move fee payer to the front
|
|
2599
2602
|
|
|
2600
2603
|
const feePayerIndex = uniqueMetas.findIndex(x => {
|
|
@@ -4311,567 +4314,6 @@ class ComputeBudgetProgram {
|
|
|
4311
4314
|
}
|
|
4312
4315
|
ComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');
|
|
4313
4316
|
|
|
4314
|
-
var browserPonyfill = {exports: {}};
|
|
4315
|
-
|
|
4316
|
-
(function (module, exports) {
|
|
4317
|
-
var global = typeof self !== 'undefined' ? self : commonjsGlobal;
|
|
4318
|
-
var __self__ = (function () {
|
|
4319
|
-
function F() {
|
|
4320
|
-
this.fetch = false;
|
|
4321
|
-
this.DOMException = global.DOMException;
|
|
4322
|
-
}
|
|
4323
|
-
F.prototype = global;
|
|
4324
|
-
return new F();
|
|
4325
|
-
})();
|
|
4326
|
-
(function(self) {
|
|
4327
|
-
|
|
4328
|
-
((function (exports) {
|
|
4329
|
-
|
|
4330
|
-
var support = {
|
|
4331
|
-
searchParams: 'URLSearchParams' in self,
|
|
4332
|
-
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
|
4333
|
-
blob:
|
|
4334
|
-
'FileReader' in self &&
|
|
4335
|
-
'Blob' in self &&
|
|
4336
|
-
(function() {
|
|
4337
|
-
try {
|
|
4338
|
-
new Blob();
|
|
4339
|
-
return true
|
|
4340
|
-
} catch (e) {
|
|
4341
|
-
return false
|
|
4342
|
-
}
|
|
4343
|
-
})(),
|
|
4344
|
-
formData: 'FormData' in self,
|
|
4345
|
-
arrayBuffer: 'ArrayBuffer' in self
|
|
4346
|
-
};
|
|
4347
|
-
|
|
4348
|
-
function isDataView(obj) {
|
|
4349
|
-
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
4350
|
-
}
|
|
4351
|
-
|
|
4352
|
-
if (support.arrayBuffer) {
|
|
4353
|
-
var viewClasses = [
|
|
4354
|
-
'[object Int8Array]',
|
|
4355
|
-
'[object Uint8Array]',
|
|
4356
|
-
'[object Uint8ClampedArray]',
|
|
4357
|
-
'[object Int16Array]',
|
|
4358
|
-
'[object Uint16Array]',
|
|
4359
|
-
'[object Int32Array]',
|
|
4360
|
-
'[object Uint32Array]',
|
|
4361
|
-
'[object Float32Array]',
|
|
4362
|
-
'[object Float64Array]'
|
|
4363
|
-
];
|
|
4364
|
-
|
|
4365
|
-
var isArrayBufferView =
|
|
4366
|
-
ArrayBuffer.isView ||
|
|
4367
|
-
function(obj) {
|
|
4368
|
-
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
4369
|
-
};
|
|
4370
|
-
}
|
|
4371
|
-
|
|
4372
|
-
function normalizeName(name) {
|
|
4373
|
-
if (typeof name !== 'string') {
|
|
4374
|
-
name = String(name);
|
|
4375
|
-
}
|
|
4376
|
-
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
|
|
4377
|
-
throw new TypeError('Invalid character in header field name')
|
|
4378
|
-
}
|
|
4379
|
-
return name.toLowerCase()
|
|
4380
|
-
}
|
|
4381
|
-
|
|
4382
|
-
function normalizeValue(value) {
|
|
4383
|
-
if (typeof value !== 'string') {
|
|
4384
|
-
value = String(value);
|
|
4385
|
-
}
|
|
4386
|
-
return value
|
|
4387
|
-
}
|
|
4388
|
-
|
|
4389
|
-
// Build a destructive iterator for the value list
|
|
4390
|
-
function iteratorFor(items) {
|
|
4391
|
-
var iterator = {
|
|
4392
|
-
next: function() {
|
|
4393
|
-
var value = items.shift();
|
|
4394
|
-
return {done: value === undefined, value: value}
|
|
4395
|
-
}
|
|
4396
|
-
};
|
|
4397
|
-
|
|
4398
|
-
if (support.iterable) {
|
|
4399
|
-
iterator[Symbol.iterator] = function() {
|
|
4400
|
-
return iterator
|
|
4401
|
-
};
|
|
4402
|
-
}
|
|
4403
|
-
|
|
4404
|
-
return iterator
|
|
4405
|
-
}
|
|
4406
|
-
|
|
4407
|
-
function Headers(headers) {
|
|
4408
|
-
this.map = {};
|
|
4409
|
-
|
|
4410
|
-
if (headers instanceof Headers) {
|
|
4411
|
-
headers.forEach(function(value, name) {
|
|
4412
|
-
this.append(name, value);
|
|
4413
|
-
}, this);
|
|
4414
|
-
} else if (Array.isArray(headers)) {
|
|
4415
|
-
headers.forEach(function(header) {
|
|
4416
|
-
this.append(header[0], header[1]);
|
|
4417
|
-
}, this);
|
|
4418
|
-
} else if (headers) {
|
|
4419
|
-
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
4420
|
-
this.append(name, headers[name]);
|
|
4421
|
-
}, this);
|
|
4422
|
-
}
|
|
4423
|
-
}
|
|
4424
|
-
|
|
4425
|
-
Headers.prototype.append = function(name, value) {
|
|
4426
|
-
name = normalizeName(name);
|
|
4427
|
-
value = normalizeValue(value);
|
|
4428
|
-
var oldValue = this.map[name];
|
|
4429
|
-
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
|
4430
|
-
};
|
|
4431
|
-
|
|
4432
|
-
Headers.prototype['delete'] = function(name) {
|
|
4433
|
-
delete this.map[normalizeName(name)];
|
|
4434
|
-
};
|
|
4435
|
-
|
|
4436
|
-
Headers.prototype.get = function(name) {
|
|
4437
|
-
name = normalizeName(name);
|
|
4438
|
-
return this.has(name) ? this.map[name] : null
|
|
4439
|
-
};
|
|
4440
|
-
|
|
4441
|
-
Headers.prototype.has = function(name) {
|
|
4442
|
-
return this.map.hasOwnProperty(normalizeName(name))
|
|
4443
|
-
};
|
|
4444
|
-
|
|
4445
|
-
Headers.prototype.set = function(name, value) {
|
|
4446
|
-
this.map[normalizeName(name)] = normalizeValue(value);
|
|
4447
|
-
};
|
|
4448
|
-
|
|
4449
|
-
Headers.prototype.forEach = function(callback, thisArg) {
|
|
4450
|
-
for (var name in this.map) {
|
|
4451
|
-
if (this.map.hasOwnProperty(name)) {
|
|
4452
|
-
callback.call(thisArg, this.map[name], name, this);
|
|
4453
|
-
}
|
|
4454
|
-
}
|
|
4455
|
-
};
|
|
4456
|
-
|
|
4457
|
-
Headers.prototype.keys = function() {
|
|
4458
|
-
var items = [];
|
|
4459
|
-
this.forEach(function(value, name) {
|
|
4460
|
-
items.push(name);
|
|
4461
|
-
});
|
|
4462
|
-
return iteratorFor(items)
|
|
4463
|
-
};
|
|
4464
|
-
|
|
4465
|
-
Headers.prototype.values = function() {
|
|
4466
|
-
var items = [];
|
|
4467
|
-
this.forEach(function(value) {
|
|
4468
|
-
items.push(value);
|
|
4469
|
-
});
|
|
4470
|
-
return iteratorFor(items)
|
|
4471
|
-
};
|
|
4472
|
-
|
|
4473
|
-
Headers.prototype.entries = function() {
|
|
4474
|
-
var items = [];
|
|
4475
|
-
this.forEach(function(value, name) {
|
|
4476
|
-
items.push([name, value]);
|
|
4477
|
-
});
|
|
4478
|
-
return iteratorFor(items)
|
|
4479
|
-
};
|
|
4480
|
-
|
|
4481
|
-
if (support.iterable) {
|
|
4482
|
-
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
|
4483
|
-
}
|
|
4484
|
-
|
|
4485
|
-
function consumed(body) {
|
|
4486
|
-
if (body.bodyUsed) {
|
|
4487
|
-
return Promise.reject(new TypeError('Already read'))
|
|
4488
|
-
}
|
|
4489
|
-
body.bodyUsed = true;
|
|
4490
|
-
}
|
|
4491
|
-
|
|
4492
|
-
function fileReaderReady(reader) {
|
|
4493
|
-
return new Promise(function(resolve, reject) {
|
|
4494
|
-
reader.onload = function() {
|
|
4495
|
-
resolve(reader.result);
|
|
4496
|
-
};
|
|
4497
|
-
reader.onerror = function() {
|
|
4498
|
-
reject(reader.error);
|
|
4499
|
-
};
|
|
4500
|
-
})
|
|
4501
|
-
}
|
|
4502
|
-
|
|
4503
|
-
function readBlobAsArrayBuffer(blob) {
|
|
4504
|
-
var reader = new FileReader();
|
|
4505
|
-
var promise = fileReaderReady(reader);
|
|
4506
|
-
reader.readAsArrayBuffer(blob);
|
|
4507
|
-
return promise
|
|
4508
|
-
}
|
|
4509
|
-
|
|
4510
|
-
function readBlobAsText(blob) {
|
|
4511
|
-
var reader = new FileReader();
|
|
4512
|
-
var promise = fileReaderReady(reader);
|
|
4513
|
-
reader.readAsText(blob);
|
|
4514
|
-
return promise
|
|
4515
|
-
}
|
|
4516
|
-
|
|
4517
|
-
function readArrayBufferAsText(buf) {
|
|
4518
|
-
var view = new Uint8Array(buf);
|
|
4519
|
-
var chars = new Array(view.length);
|
|
4520
|
-
|
|
4521
|
-
for (var i = 0; i < view.length; i++) {
|
|
4522
|
-
chars[i] = String.fromCharCode(view[i]);
|
|
4523
|
-
}
|
|
4524
|
-
return chars.join('')
|
|
4525
|
-
}
|
|
4526
|
-
|
|
4527
|
-
function bufferClone(buf) {
|
|
4528
|
-
if (buf.slice) {
|
|
4529
|
-
return buf.slice(0)
|
|
4530
|
-
} else {
|
|
4531
|
-
var view = new Uint8Array(buf.byteLength);
|
|
4532
|
-
view.set(new Uint8Array(buf));
|
|
4533
|
-
return view.buffer
|
|
4534
|
-
}
|
|
4535
|
-
}
|
|
4536
|
-
|
|
4537
|
-
function Body() {
|
|
4538
|
-
this.bodyUsed = false;
|
|
4539
|
-
|
|
4540
|
-
this._initBody = function(body) {
|
|
4541
|
-
this._bodyInit = body;
|
|
4542
|
-
if (!body) {
|
|
4543
|
-
this._bodyText = '';
|
|
4544
|
-
} else if (typeof body === 'string') {
|
|
4545
|
-
this._bodyText = body;
|
|
4546
|
-
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
4547
|
-
this._bodyBlob = body;
|
|
4548
|
-
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
4549
|
-
this._bodyFormData = body;
|
|
4550
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
4551
|
-
this._bodyText = body.toString();
|
|
4552
|
-
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
4553
|
-
this._bodyArrayBuffer = bufferClone(body.buffer);
|
|
4554
|
-
// IE 10-11 can't handle a DataView body.
|
|
4555
|
-
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
|
4556
|
-
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
4557
|
-
this._bodyArrayBuffer = bufferClone(body);
|
|
4558
|
-
} else {
|
|
4559
|
-
this._bodyText = body = Object.prototype.toString.call(body);
|
|
4560
|
-
}
|
|
4561
|
-
|
|
4562
|
-
if (!this.headers.get('content-type')) {
|
|
4563
|
-
if (typeof body === 'string') {
|
|
4564
|
-
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
|
4565
|
-
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
4566
|
-
this.headers.set('content-type', this._bodyBlob.type);
|
|
4567
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
4568
|
-
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
4569
|
-
}
|
|
4570
|
-
}
|
|
4571
|
-
};
|
|
4572
|
-
|
|
4573
|
-
if (support.blob) {
|
|
4574
|
-
this.blob = function() {
|
|
4575
|
-
var rejected = consumed(this);
|
|
4576
|
-
if (rejected) {
|
|
4577
|
-
return rejected
|
|
4578
|
-
}
|
|
4579
|
-
|
|
4580
|
-
if (this._bodyBlob) {
|
|
4581
|
-
return Promise.resolve(this._bodyBlob)
|
|
4582
|
-
} else if (this._bodyArrayBuffer) {
|
|
4583
|
-
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
4584
|
-
} else if (this._bodyFormData) {
|
|
4585
|
-
throw new Error('could not read FormData body as blob')
|
|
4586
|
-
} else {
|
|
4587
|
-
return Promise.resolve(new Blob([this._bodyText]))
|
|
4588
|
-
}
|
|
4589
|
-
};
|
|
4590
|
-
|
|
4591
|
-
this.arrayBuffer = function() {
|
|
4592
|
-
if (this._bodyArrayBuffer) {
|
|
4593
|
-
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
|
4594
|
-
} else {
|
|
4595
|
-
return this.blob().then(readBlobAsArrayBuffer)
|
|
4596
|
-
}
|
|
4597
|
-
};
|
|
4598
|
-
}
|
|
4599
|
-
|
|
4600
|
-
this.text = function() {
|
|
4601
|
-
var rejected = consumed(this);
|
|
4602
|
-
if (rejected) {
|
|
4603
|
-
return rejected
|
|
4604
|
-
}
|
|
4605
|
-
|
|
4606
|
-
if (this._bodyBlob) {
|
|
4607
|
-
return readBlobAsText(this._bodyBlob)
|
|
4608
|
-
} else if (this._bodyArrayBuffer) {
|
|
4609
|
-
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
4610
|
-
} else if (this._bodyFormData) {
|
|
4611
|
-
throw new Error('could not read FormData body as text')
|
|
4612
|
-
} else {
|
|
4613
|
-
return Promise.resolve(this._bodyText)
|
|
4614
|
-
}
|
|
4615
|
-
};
|
|
4616
|
-
|
|
4617
|
-
if (support.formData) {
|
|
4618
|
-
this.formData = function() {
|
|
4619
|
-
return this.text().then(decode)
|
|
4620
|
-
};
|
|
4621
|
-
}
|
|
4622
|
-
|
|
4623
|
-
this.json = function() {
|
|
4624
|
-
return this.text().then(JSON.parse)
|
|
4625
|
-
};
|
|
4626
|
-
|
|
4627
|
-
return this
|
|
4628
|
-
}
|
|
4629
|
-
|
|
4630
|
-
// HTTP methods whose capitalization should be normalized
|
|
4631
|
-
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
|
4632
|
-
|
|
4633
|
-
function normalizeMethod(method) {
|
|
4634
|
-
var upcased = method.toUpperCase();
|
|
4635
|
-
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
4636
|
-
}
|
|
4637
|
-
|
|
4638
|
-
function Request(input, options) {
|
|
4639
|
-
options = options || {};
|
|
4640
|
-
var body = options.body;
|
|
4641
|
-
|
|
4642
|
-
if (input instanceof Request) {
|
|
4643
|
-
if (input.bodyUsed) {
|
|
4644
|
-
throw new TypeError('Already read')
|
|
4645
|
-
}
|
|
4646
|
-
this.url = input.url;
|
|
4647
|
-
this.credentials = input.credentials;
|
|
4648
|
-
if (!options.headers) {
|
|
4649
|
-
this.headers = new Headers(input.headers);
|
|
4650
|
-
}
|
|
4651
|
-
this.method = input.method;
|
|
4652
|
-
this.mode = input.mode;
|
|
4653
|
-
this.signal = input.signal;
|
|
4654
|
-
if (!body && input._bodyInit != null) {
|
|
4655
|
-
body = input._bodyInit;
|
|
4656
|
-
input.bodyUsed = true;
|
|
4657
|
-
}
|
|
4658
|
-
} else {
|
|
4659
|
-
this.url = String(input);
|
|
4660
|
-
}
|
|
4661
|
-
|
|
4662
|
-
this.credentials = options.credentials || this.credentials || 'same-origin';
|
|
4663
|
-
if (options.headers || !this.headers) {
|
|
4664
|
-
this.headers = new Headers(options.headers);
|
|
4665
|
-
}
|
|
4666
|
-
this.method = normalizeMethod(options.method || this.method || 'GET');
|
|
4667
|
-
this.mode = options.mode || this.mode || null;
|
|
4668
|
-
this.signal = options.signal || this.signal;
|
|
4669
|
-
this.referrer = null;
|
|
4670
|
-
|
|
4671
|
-
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
4672
|
-
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
4673
|
-
}
|
|
4674
|
-
this._initBody(body);
|
|
4675
|
-
}
|
|
4676
|
-
|
|
4677
|
-
Request.prototype.clone = function() {
|
|
4678
|
-
return new Request(this, {body: this._bodyInit})
|
|
4679
|
-
};
|
|
4680
|
-
|
|
4681
|
-
function decode(body) {
|
|
4682
|
-
var form = new FormData();
|
|
4683
|
-
body
|
|
4684
|
-
.trim()
|
|
4685
|
-
.split('&')
|
|
4686
|
-
.forEach(function(bytes) {
|
|
4687
|
-
if (bytes) {
|
|
4688
|
-
var split = bytes.split('=');
|
|
4689
|
-
var name = split.shift().replace(/\+/g, ' ');
|
|
4690
|
-
var value = split.join('=').replace(/\+/g, ' ');
|
|
4691
|
-
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
4692
|
-
}
|
|
4693
|
-
});
|
|
4694
|
-
return form
|
|
4695
|
-
}
|
|
4696
|
-
|
|
4697
|
-
function parseHeaders(rawHeaders) {
|
|
4698
|
-
var headers = new Headers();
|
|
4699
|
-
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
4700
|
-
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
4701
|
-
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
4702
|
-
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
|
4703
|
-
var parts = line.split(':');
|
|
4704
|
-
var key = parts.shift().trim();
|
|
4705
|
-
if (key) {
|
|
4706
|
-
var value = parts.join(':').trim();
|
|
4707
|
-
headers.append(key, value);
|
|
4708
|
-
}
|
|
4709
|
-
});
|
|
4710
|
-
return headers
|
|
4711
|
-
}
|
|
4712
|
-
|
|
4713
|
-
Body.call(Request.prototype);
|
|
4714
|
-
|
|
4715
|
-
function Response(bodyInit, options) {
|
|
4716
|
-
if (!options) {
|
|
4717
|
-
options = {};
|
|
4718
|
-
}
|
|
4719
|
-
|
|
4720
|
-
this.type = 'default';
|
|
4721
|
-
this.status = options.status === undefined ? 200 : options.status;
|
|
4722
|
-
this.ok = this.status >= 200 && this.status < 300;
|
|
4723
|
-
this.statusText = 'statusText' in options ? options.statusText : 'OK';
|
|
4724
|
-
this.headers = new Headers(options.headers);
|
|
4725
|
-
this.url = options.url || '';
|
|
4726
|
-
this._initBody(bodyInit);
|
|
4727
|
-
}
|
|
4728
|
-
|
|
4729
|
-
Body.call(Response.prototype);
|
|
4730
|
-
|
|
4731
|
-
Response.prototype.clone = function() {
|
|
4732
|
-
return new Response(this._bodyInit, {
|
|
4733
|
-
status: this.status,
|
|
4734
|
-
statusText: this.statusText,
|
|
4735
|
-
headers: new Headers(this.headers),
|
|
4736
|
-
url: this.url
|
|
4737
|
-
})
|
|
4738
|
-
};
|
|
4739
|
-
|
|
4740
|
-
Response.error = function() {
|
|
4741
|
-
var response = new Response(null, {status: 0, statusText: ''});
|
|
4742
|
-
response.type = 'error';
|
|
4743
|
-
return response
|
|
4744
|
-
};
|
|
4745
|
-
|
|
4746
|
-
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
4747
|
-
|
|
4748
|
-
Response.redirect = function(url, status) {
|
|
4749
|
-
if (redirectStatuses.indexOf(status) === -1) {
|
|
4750
|
-
throw new RangeError('Invalid status code')
|
|
4751
|
-
}
|
|
4752
|
-
|
|
4753
|
-
return new Response(null, {status: status, headers: {location: url}})
|
|
4754
|
-
};
|
|
4755
|
-
|
|
4756
|
-
exports.DOMException = self.DOMException;
|
|
4757
|
-
try {
|
|
4758
|
-
new exports.DOMException();
|
|
4759
|
-
} catch (err) {
|
|
4760
|
-
exports.DOMException = function(message, name) {
|
|
4761
|
-
this.message = message;
|
|
4762
|
-
this.name = name;
|
|
4763
|
-
var error = Error(message);
|
|
4764
|
-
this.stack = error.stack;
|
|
4765
|
-
};
|
|
4766
|
-
exports.DOMException.prototype = Object.create(Error.prototype);
|
|
4767
|
-
exports.DOMException.prototype.constructor = exports.DOMException;
|
|
4768
|
-
}
|
|
4769
|
-
|
|
4770
|
-
function fetch(input, init) {
|
|
4771
|
-
return new Promise(function(resolve, reject) {
|
|
4772
|
-
var request = new Request(input, init);
|
|
4773
|
-
|
|
4774
|
-
if (request.signal && request.signal.aborted) {
|
|
4775
|
-
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
|
4776
|
-
}
|
|
4777
|
-
|
|
4778
|
-
var xhr = new XMLHttpRequest();
|
|
4779
|
-
|
|
4780
|
-
function abortXhr() {
|
|
4781
|
-
xhr.abort();
|
|
4782
|
-
}
|
|
4783
|
-
|
|
4784
|
-
xhr.onload = function() {
|
|
4785
|
-
var options = {
|
|
4786
|
-
status: xhr.status,
|
|
4787
|
-
statusText: xhr.statusText,
|
|
4788
|
-
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
4789
|
-
};
|
|
4790
|
-
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
4791
|
-
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
4792
|
-
resolve(new Response(body, options));
|
|
4793
|
-
};
|
|
4794
|
-
|
|
4795
|
-
xhr.onerror = function() {
|
|
4796
|
-
reject(new TypeError('Network request failed'));
|
|
4797
|
-
};
|
|
4798
|
-
|
|
4799
|
-
xhr.ontimeout = function() {
|
|
4800
|
-
reject(new TypeError('Network request failed'));
|
|
4801
|
-
};
|
|
4802
|
-
|
|
4803
|
-
xhr.onabort = function() {
|
|
4804
|
-
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
4805
|
-
};
|
|
4806
|
-
|
|
4807
|
-
xhr.open(request.method, request.url, true);
|
|
4808
|
-
|
|
4809
|
-
if (request.credentials === 'include') {
|
|
4810
|
-
xhr.withCredentials = true;
|
|
4811
|
-
} else if (request.credentials === 'omit') {
|
|
4812
|
-
xhr.withCredentials = false;
|
|
4813
|
-
}
|
|
4814
|
-
|
|
4815
|
-
if ('responseType' in xhr && support.blob) {
|
|
4816
|
-
xhr.responseType = 'blob';
|
|
4817
|
-
}
|
|
4818
|
-
|
|
4819
|
-
request.headers.forEach(function(value, name) {
|
|
4820
|
-
xhr.setRequestHeader(name, value);
|
|
4821
|
-
});
|
|
4822
|
-
|
|
4823
|
-
if (request.signal) {
|
|
4824
|
-
request.signal.addEventListener('abort', abortXhr);
|
|
4825
|
-
|
|
4826
|
-
xhr.onreadystatechange = function() {
|
|
4827
|
-
// DONE (success or failure)
|
|
4828
|
-
if (xhr.readyState === 4) {
|
|
4829
|
-
request.signal.removeEventListener('abort', abortXhr);
|
|
4830
|
-
}
|
|
4831
|
-
};
|
|
4832
|
-
}
|
|
4833
|
-
|
|
4834
|
-
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
|
4835
|
-
})
|
|
4836
|
-
}
|
|
4837
|
-
|
|
4838
|
-
fetch.polyfill = true;
|
|
4839
|
-
|
|
4840
|
-
if (!self.fetch) {
|
|
4841
|
-
self.fetch = fetch;
|
|
4842
|
-
self.Headers = Headers;
|
|
4843
|
-
self.Request = Request;
|
|
4844
|
-
self.Response = Response;
|
|
4845
|
-
}
|
|
4846
|
-
|
|
4847
|
-
exports.Headers = Headers;
|
|
4848
|
-
exports.Request = Request;
|
|
4849
|
-
exports.Response = Response;
|
|
4850
|
-
exports.fetch = fetch;
|
|
4851
|
-
|
|
4852
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4853
|
-
|
|
4854
|
-
return exports;
|
|
4855
|
-
|
|
4856
|
-
}))({});
|
|
4857
|
-
})(__self__);
|
|
4858
|
-
__self__.fetch.ponyfill = true;
|
|
4859
|
-
// Remove "polyfill" property added by whatwg-fetch
|
|
4860
|
-
delete __self__.fetch.polyfill;
|
|
4861
|
-
// Choose between native implementation (global) or custom implementation (__self__)
|
|
4862
|
-
// var ctx = global.fetch ? global : __self__;
|
|
4863
|
-
var ctx = __self__; // this line disable service worker support temporarily
|
|
4864
|
-
exports = ctx.fetch; // To enable: import fetch from 'cross-fetch'
|
|
4865
|
-
exports.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
|
|
4866
|
-
exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
|
|
4867
|
-
exports.Headers = ctx.Headers;
|
|
4868
|
-
exports.Request = ctx.Request;
|
|
4869
|
-
exports.Response = ctx.Response;
|
|
4870
|
-
module.exports = exports;
|
|
4871
|
-
}(browserPonyfill, browserPonyfill.exports));
|
|
4872
|
-
|
|
4873
|
-
var crossFetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
|
|
4874
|
-
|
|
4875
4317
|
var objToString = Object.prototype.toString;
|
|
4876
4318
|
var objKeys = Object.keys || function(obj) {
|
|
4877
4319
|
var keys = [];
|
|
@@ -5053,6 +4495,8 @@ class SendTransactionError extends Error {
|
|
|
5053
4495
|
|
|
5054
4496
|
}
|
|
5055
4497
|
|
|
4498
|
+
var fetchImpl = globalThis.fetch;
|
|
4499
|
+
|
|
5056
4500
|
// TODO: These constants should be removed in favor of reading them out of a
|
|
5057
4501
|
// Syscall account
|
|
5058
4502
|
|
|
@@ -5302,15 +4746,15 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(type({
|
|
|
5302
4746
|
*/
|
|
5303
4747
|
|
|
5304
4748
|
function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
|
|
5305
|
-
const fetch = customFetch ? customFetch :
|
|
4749
|
+
const fetch = customFetch ? customFetch : fetchImpl;
|
|
5306
4750
|
|
|
5307
4751
|
let fetchWithMiddleware;
|
|
5308
4752
|
|
|
5309
4753
|
if (fetchMiddleware) {
|
|
5310
|
-
fetchWithMiddleware = async (
|
|
4754
|
+
fetchWithMiddleware = async (info, init) => {
|
|
5311
4755
|
const modifiedFetchArgs = await new Promise((resolve, reject) => {
|
|
5312
4756
|
try {
|
|
5313
|
-
fetchMiddleware(
|
|
4757
|
+
fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit]));
|
|
5314
4758
|
} catch (error) {
|
|
5315
4759
|
reject(error);
|
|
5316
4760
|
}
|