@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.
- package/lib/index.browser.cjs.js +111 -588
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +110 -586
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +164 -62
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +54 -11
- package/lib/index.esm.js +162 -59
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +26048 -26051
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +6 -4
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +8 -7
- package/src/__forks__/browser/fetch-impl.ts +4 -0
- package/src/compute-budget.ts +92 -3
- package/src/connection.ts +24 -19
- package/src/fetch-impl.ts +13 -0
- package/src/system-program.ts +1 -1
- package/src/transaction.ts +0 -1
- package/src/util/bigint.ts +43 -0
- package/src/util/send-and-confirm-raw-transaction.ts +6 -6
package/lib/index.browser.esm.js
CHANGED
|
@@ -4,7 +4,8 @@ import BN from 'bn.js';
|
|
|
4
4
|
import bs58 from 'bs58';
|
|
5
5
|
import { serialize, deserialize, deserializeUnchecked } from 'borsh';
|
|
6
6
|
import * as BufferLayout from '@solana/buffer-layout';
|
|
7
|
-
import {
|
|
7
|
+
import { blob } from '@solana/buffer-layout';
|
|
8
|
+
import { toBigIntLE, toBufferLE } from 'bigint-buffer';
|
|
8
9
|
import { coerce, instance, string, tuple, literal, unknown, union, type, optional, any, number, array, nullable, create, boolean, record, assert as assert$7 } from 'superstruct';
|
|
9
10
|
import { Client } from 'rpc-websockets';
|
|
10
11
|
import RpcClient from 'jayson/lib/client/browser';
|
|
@@ -21,12 +22,6 @@ const toBuffer = arr => {
|
|
|
21
22
|
}
|
|
22
23
|
};
|
|
23
24
|
|
|
24
|
-
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
25
|
-
|
|
26
|
-
function getDefaultExportFromCjs (x) {
|
|
27
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
25
|
var hash$1 = {};
|
|
31
26
|
|
|
32
27
|
var utils$9 = {};
|
|
@@ -1263,22 +1258,22 @@ Hmac.prototype.digest = function digest(enc) {
|
|
|
1263
1258
|
};
|
|
1264
1259
|
|
|
1265
1260
|
(function (exports) {
|
|
1266
|
-
var hash = exports;
|
|
1267
|
-
|
|
1268
|
-
hash.utils = utils$9;
|
|
1269
|
-
hash.common = common$5;
|
|
1270
|
-
hash.sha = sha;
|
|
1271
|
-
hash.ripemd = ripemd;
|
|
1272
|
-
hash.hmac = hmac;
|
|
1273
|
-
|
|
1274
|
-
// Proxy hash functions to the main object
|
|
1275
|
-
hash.sha1 = hash.sha.sha1;
|
|
1276
|
-
hash.sha256 = hash.sha.sha256;
|
|
1277
|
-
hash.sha224 = hash.sha.sha224;
|
|
1278
|
-
hash.sha384 = hash.sha.sha384;
|
|
1279
|
-
hash.sha512 = hash.sha.sha512;
|
|
1280
|
-
hash.ripemd160 = hash.ripemd.ripemd160;
|
|
1281
|
-
}(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));
|
|
1282
1277
|
|
|
1283
1278
|
var hash = hash$1;
|
|
1284
1279
|
|
|
@@ -2796,8 +2791,6 @@ class Transaction {
|
|
|
2796
2791
|
const message = this._compile();
|
|
2797
2792
|
|
|
2798
2793
|
this._partialSign(message, ...uniqueSigners);
|
|
2799
|
-
|
|
2800
|
-
this._verifySignatures(message.serialize(), true);
|
|
2801
2794
|
}
|
|
2802
2795
|
/**
|
|
2803
2796
|
* Partially sign a transaction with the specified accounts. All accounts must
|
|
@@ -3177,6 +3170,38 @@ class NonceAccount {
|
|
|
3177
3170
|
|
|
3178
3171
|
}
|
|
3179
3172
|
|
|
3173
|
+
const encodeDecode = layout => {
|
|
3174
|
+
const decode = layout.decode.bind(layout);
|
|
3175
|
+
const encode = layout.encode.bind(layout);
|
|
3176
|
+
return {
|
|
3177
|
+
decode,
|
|
3178
|
+
encode
|
|
3179
|
+
};
|
|
3180
|
+
};
|
|
3181
|
+
|
|
3182
|
+
const bigInt = length => property => {
|
|
3183
|
+
const layout = blob(length, property);
|
|
3184
|
+
const {
|
|
3185
|
+
encode,
|
|
3186
|
+
decode
|
|
3187
|
+
} = encodeDecode(layout);
|
|
3188
|
+
const bigIntLayout = layout;
|
|
3189
|
+
|
|
3190
|
+
bigIntLayout.decode = (buffer, offset) => {
|
|
3191
|
+
const src = decode(buffer, offset);
|
|
3192
|
+
return toBigIntLE(Buffer.from(src));
|
|
3193
|
+
};
|
|
3194
|
+
|
|
3195
|
+
bigIntLayout.encode = (bigInt, buffer, offset) => {
|
|
3196
|
+
const src = toBufferLE(bigInt, length);
|
|
3197
|
+
return encode(src, buffer, offset);
|
|
3198
|
+
};
|
|
3199
|
+
|
|
3200
|
+
return bigIntLayout;
|
|
3201
|
+
};
|
|
3202
|
+
|
|
3203
|
+
const u64 = bigInt(8);
|
|
3204
|
+
|
|
3180
3205
|
/**
|
|
3181
3206
|
* Create account system transaction params
|
|
3182
3207
|
*/
|
|
@@ -4155,6 +4180,34 @@ class ComputeBudgetInstruction {
|
|
|
4155
4180
|
bytes
|
|
4156
4181
|
};
|
|
4157
4182
|
}
|
|
4183
|
+
/**
|
|
4184
|
+
* Decode set compute unit limit compute budget instruction and retrieve the instruction params.
|
|
4185
|
+
*/
|
|
4186
|
+
|
|
4187
|
+
|
|
4188
|
+
static decodeSetComputeUnitLimit(instruction) {
|
|
4189
|
+
this.checkProgramId(instruction.programId);
|
|
4190
|
+
const {
|
|
4191
|
+
units
|
|
4192
|
+
} = decodeData(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit, instruction.data);
|
|
4193
|
+
return {
|
|
4194
|
+
units
|
|
4195
|
+
};
|
|
4196
|
+
}
|
|
4197
|
+
/**
|
|
4198
|
+
* Decode set compute unit price compute budget instruction and retrieve the instruction params.
|
|
4199
|
+
*/
|
|
4200
|
+
|
|
4201
|
+
|
|
4202
|
+
static decodeSetComputeUnitPrice(instruction) {
|
|
4203
|
+
this.checkProgramId(instruction.programId);
|
|
4204
|
+
const {
|
|
4205
|
+
microLamports
|
|
4206
|
+
} = decodeData(COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice, instruction.data);
|
|
4207
|
+
return {
|
|
4208
|
+
microLamports
|
|
4209
|
+
};
|
|
4210
|
+
}
|
|
4158
4211
|
/**
|
|
4159
4212
|
* @internal
|
|
4160
4213
|
*/
|
|
@@ -4183,6 +4236,14 @@ const COMPUTE_BUDGET_INSTRUCTION_LAYOUTS = Object.freeze({
|
|
|
4183
4236
|
RequestHeapFrame: {
|
|
4184
4237
|
index: 1,
|
|
4185
4238
|
layout: BufferLayout.struct([BufferLayout.u8('instruction'), BufferLayout.u32('bytes')])
|
|
4239
|
+
},
|
|
4240
|
+
SetComputeUnitLimit: {
|
|
4241
|
+
index: 2,
|
|
4242
|
+
layout: BufferLayout.struct([BufferLayout.u8('instruction'), BufferLayout.u32('units')])
|
|
4243
|
+
},
|
|
4244
|
+
SetComputeUnitPrice: {
|
|
4245
|
+
index: 3,
|
|
4246
|
+
layout: BufferLayout.struct([BufferLayout.u8('instruction'), u64('microLamports')])
|
|
4186
4247
|
}
|
|
4187
4248
|
});
|
|
4188
4249
|
/**
|
|
@@ -4219,569 +4280,30 @@ class ComputeBudgetProgram {
|
|
|
4219
4280
|
});
|
|
4220
4281
|
}
|
|
4221
4282
|
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4228
|
-
|
|
4229
|
-
var __self__ = (function () {
|
|
4230
|
-
function F() {
|
|
4231
|
-
this.fetch = false;
|
|
4232
|
-
this.DOMException = global.DOMException;
|
|
4233
|
-
}
|
|
4234
|
-
F.prototype = global;
|
|
4235
|
-
return new F();
|
|
4236
|
-
})();
|
|
4237
|
-
(function(self) {
|
|
4238
|
-
|
|
4239
|
-
((function (exports) {
|
|
4240
|
-
|
|
4241
|
-
var support = {
|
|
4242
|
-
searchParams: 'URLSearchParams' in self,
|
|
4243
|
-
iterable: 'Symbol' in self && 'iterator' in Symbol,
|
|
4244
|
-
blob:
|
|
4245
|
-
'FileReader' in self &&
|
|
4246
|
-
'Blob' in self &&
|
|
4247
|
-
(function() {
|
|
4248
|
-
try {
|
|
4249
|
-
new Blob();
|
|
4250
|
-
return true
|
|
4251
|
-
} catch (e) {
|
|
4252
|
-
return false
|
|
4253
|
-
}
|
|
4254
|
-
})(),
|
|
4255
|
-
formData: 'FormData' in self,
|
|
4256
|
-
arrayBuffer: 'ArrayBuffer' in self
|
|
4257
|
-
};
|
|
4258
|
-
|
|
4259
|
-
function isDataView(obj) {
|
|
4260
|
-
return obj && DataView.prototype.isPrototypeOf(obj)
|
|
4261
|
-
}
|
|
4262
|
-
|
|
4263
|
-
if (support.arrayBuffer) {
|
|
4264
|
-
var viewClasses = [
|
|
4265
|
-
'[object Int8Array]',
|
|
4266
|
-
'[object Uint8Array]',
|
|
4267
|
-
'[object Uint8ClampedArray]',
|
|
4268
|
-
'[object Int16Array]',
|
|
4269
|
-
'[object Uint16Array]',
|
|
4270
|
-
'[object Int32Array]',
|
|
4271
|
-
'[object Uint32Array]',
|
|
4272
|
-
'[object Float32Array]',
|
|
4273
|
-
'[object Float64Array]'
|
|
4274
|
-
];
|
|
4275
|
-
|
|
4276
|
-
var isArrayBufferView =
|
|
4277
|
-
ArrayBuffer.isView ||
|
|
4278
|
-
function(obj) {
|
|
4279
|
-
return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
|
|
4280
|
-
};
|
|
4281
|
-
}
|
|
4282
|
-
|
|
4283
|
-
function normalizeName(name) {
|
|
4284
|
-
if (typeof name !== 'string') {
|
|
4285
|
-
name = String(name);
|
|
4286
|
-
}
|
|
4287
|
-
if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
|
|
4288
|
-
throw new TypeError('Invalid character in header field name')
|
|
4289
|
-
}
|
|
4290
|
-
return name.toLowerCase()
|
|
4291
|
-
}
|
|
4292
|
-
|
|
4293
|
-
function normalizeValue(value) {
|
|
4294
|
-
if (typeof value !== 'string') {
|
|
4295
|
-
value = String(value);
|
|
4296
|
-
}
|
|
4297
|
-
return value
|
|
4298
|
-
}
|
|
4299
|
-
|
|
4300
|
-
// Build a destructive iterator for the value list
|
|
4301
|
-
function iteratorFor(items) {
|
|
4302
|
-
var iterator = {
|
|
4303
|
-
next: function() {
|
|
4304
|
-
var value = items.shift();
|
|
4305
|
-
return {done: value === undefined, value: value}
|
|
4306
|
-
}
|
|
4307
|
-
};
|
|
4308
|
-
|
|
4309
|
-
if (support.iterable) {
|
|
4310
|
-
iterator[Symbol.iterator] = function() {
|
|
4311
|
-
return iterator
|
|
4312
|
-
};
|
|
4313
|
-
}
|
|
4314
|
-
|
|
4315
|
-
return iterator
|
|
4316
|
-
}
|
|
4317
|
-
|
|
4318
|
-
function Headers(headers) {
|
|
4319
|
-
this.map = {};
|
|
4320
|
-
|
|
4321
|
-
if (headers instanceof Headers) {
|
|
4322
|
-
headers.forEach(function(value, name) {
|
|
4323
|
-
this.append(name, value);
|
|
4324
|
-
}, this);
|
|
4325
|
-
} else if (Array.isArray(headers)) {
|
|
4326
|
-
headers.forEach(function(header) {
|
|
4327
|
-
this.append(header[0], header[1]);
|
|
4328
|
-
}, this);
|
|
4329
|
-
} else if (headers) {
|
|
4330
|
-
Object.getOwnPropertyNames(headers).forEach(function(name) {
|
|
4331
|
-
this.append(name, headers[name]);
|
|
4332
|
-
}, this);
|
|
4333
|
-
}
|
|
4334
|
-
}
|
|
4335
|
-
|
|
4336
|
-
Headers.prototype.append = function(name, value) {
|
|
4337
|
-
name = normalizeName(name);
|
|
4338
|
-
value = normalizeValue(value);
|
|
4339
|
-
var oldValue = this.map[name];
|
|
4340
|
-
this.map[name] = oldValue ? oldValue + ', ' + value : value;
|
|
4341
|
-
};
|
|
4342
|
-
|
|
4343
|
-
Headers.prototype['delete'] = function(name) {
|
|
4344
|
-
delete this.map[normalizeName(name)];
|
|
4345
|
-
};
|
|
4346
|
-
|
|
4347
|
-
Headers.prototype.get = function(name) {
|
|
4348
|
-
name = normalizeName(name);
|
|
4349
|
-
return this.has(name) ? this.map[name] : null
|
|
4350
|
-
};
|
|
4351
|
-
|
|
4352
|
-
Headers.prototype.has = function(name) {
|
|
4353
|
-
return this.map.hasOwnProperty(normalizeName(name))
|
|
4354
|
-
};
|
|
4355
|
-
|
|
4356
|
-
Headers.prototype.set = function(name, value) {
|
|
4357
|
-
this.map[normalizeName(name)] = normalizeValue(value);
|
|
4358
|
-
};
|
|
4359
|
-
|
|
4360
|
-
Headers.prototype.forEach = function(callback, thisArg) {
|
|
4361
|
-
for (var name in this.map) {
|
|
4362
|
-
if (this.map.hasOwnProperty(name)) {
|
|
4363
|
-
callback.call(thisArg, this.map[name], name, this);
|
|
4364
|
-
}
|
|
4365
|
-
}
|
|
4366
|
-
};
|
|
4367
|
-
|
|
4368
|
-
Headers.prototype.keys = function() {
|
|
4369
|
-
var items = [];
|
|
4370
|
-
this.forEach(function(value, name) {
|
|
4371
|
-
items.push(name);
|
|
4372
|
-
});
|
|
4373
|
-
return iteratorFor(items)
|
|
4374
|
-
};
|
|
4375
|
-
|
|
4376
|
-
Headers.prototype.values = function() {
|
|
4377
|
-
var items = [];
|
|
4378
|
-
this.forEach(function(value) {
|
|
4379
|
-
items.push(value);
|
|
4380
|
-
});
|
|
4381
|
-
return iteratorFor(items)
|
|
4382
|
-
};
|
|
4383
|
-
|
|
4384
|
-
Headers.prototype.entries = function() {
|
|
4385
|
-
var items = [];
|
|
4386
|
-
this.forEach(function(value, name) {
|
|
4387
|
-
items.push([name, value]);
|
|
4283
|
+
static setComputeUnitLimit(params) {
|
|
4284
|
+
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitLimit;
|
|
4285
|
+
const data = encodeData(type, params);
|
|
4286
|
+
return new TransactionInstruction({
|
|
4287
|
+
keys: [],
|
|
4288
|
+
programId: this.programId,
|
|
4289
|
+
data
|
|
4388
4290
|
});
|
|
4389
|
-
return iteratorFor(items)
|
|
4390
|
-
};
|
|
4391
|
-
|
|
4392
|
-
if (support.iterable) {
|
|
4393
|
-
Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
|
|
4394
4291
|
}
|
|
4395
4292
|
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
reader.onload = function() {
|
|
4406
|
-
resolve(reader.result);
|
|
4407
|
-
};
|
|
4408
|
-
reader.onerror = function() {
|
|
4409
|
-
reject(reader.error);
|
|
4410
|
-
};
|
|
4411
|
-
})
|
|
4412
|
-
}
|
|
4413
|
-
|
|
4414
|
-
function readBlobAsArrayBuffer(blob) {
|
|
4415
|
-
var reader = new FileReader();
|
|
4416
|
-
var promise = fileReaderReady(reader);
|
|
4417
|
-
reader.readAsArrayBuffer(blob);
|
|
4418
|
-
return promise
|
|
4419
|
-
}
|
|
4420
|
-
|
|
4421
|
-
function readBlobAsText(blob) {
|
|
4422
|
-
var reader = new FileReader();
|
|
4423
|
-
var promise = fileReaderReady(reader);
|
|
4424
|
-
reader.readAsText(blob);
|
|
4425
|
-
return promise
|
|
4426
|
-
}
|
|
4427
|
-
|
|
4428
|
-
function readArrayBufferAsText(buf) {
|
|
4429
|
-
var view = new Uint8Array(buf);
|
|
4430
|
-
var chars = new Array(view.length);
|
|
4431
|
-
|
|
4432
|
-
for (var i = 0; i < view.length; i++) {
|
|
4433
|
-
chars[i] = String.fromCharCode(view[i]);
|
|
4434
|
-
}
|
|
4435
|
-
return chars.join('')
|
|
4436
|
-
}
|
|
4437
|
-
|
|
4438
|
-
function bufferClone(buf) {
|
|
4439
|
-
if (buf.slice) {
|
|
4440
|
-
return buf.slice(0)
|
|
4441
|
-
} else {
|
|
4442
|
-
var view = new Uint8Array(buf.byteLength);
|
|
4443
|
-
view.set(new Uint8Array(buf));
|
|
4444
|
-
return view.buffer
|
|
4445
|
-
}
|
|
4446
|
-
}
|
|
4447
|
-
|
|
4448
|
-
function Body() {
|
|
4449
|
-
this.bodyUsed = false;
|
|
4450
|
-
|
|
4451
|
-
this._initBody = function(body) {
|
|
4452
|
-
this._bodyInit = body;
|
|
4453
|
-
if (!body) {
|
|
4454
|
-
this._bodyText = '';
|
|
4455
|
-
} else if (typeof body === 'string') {
|
|
4456
|
-
this._bodyText = body;
|
|
4457
|
-
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
|
|
4458
|
-
this._bodyBlob = body;
|
|
4459
|
-
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
|
|
4460
|
-
this._bodyFormData = body;
|
|
4461
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
4462
|
-
this._bodyText = body.toString();
|
|
4463
|
-
} else if (support.arrayBuffer && support.blob && isDataView(body)) {
|
|
4464
|
-
this._bodyArrayBuffer = bufferClone(body.buffer);
|
|
4465
|
-
// IE 10-11 can't handle a DataView body.
|
|
4466
|
-
this._bodyInit = new Blob([this._bodyArrayBuffer]);
|
|
4467
|
-
} else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
|
|
4468
|
-
this._bodyArrayBuffer = bufferClone(body);
|
|
4469
|
-
} else {
|
|
4470
|
-
this._bodyText = body = Object.prototype.toString.call(body);
|
|
4471
|
-
}
|
|
4472
|
-
|
|
4473
|
-
if (!this.headers.get('content-type')) {
|
|
4474
|
-
if (typeof body === 'string') {
|
|
4475
|
-
this.headers.set('content-type', 'text/plain;charset=UTF-8');
|
|
4476
|
-
} else if (this._bodyBlob && this._bodyBlob.type) {
|
|
4477
|
-
this.headers.set('content-type', this._bodyBlob.type);
|
|
4478
|
-
} else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
|
|
4479
|
-
this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
|
|
4480
|
-
}
|
|
4481
|
-
}
|
|
4482
|
-
};
|
|
4483
|
-
|
|
4484
|
-
if (support.blob) {
|
|
4485
|
-
this.blob = function() {
|
|
4486
|
-
var rejected = consumed(this);
|
|
4487
|
-
if (rejected) {
|
|
4488
|
-
return rejected
|
|
4489
|
-
}
|
|
4490
|
-
|
|
4491
|
-
if (this._bodyBlob) {
|
|
4492
|
-
return Promise.resolve(this._bodyBlob)
|
|
4493
|
-
} else if (this._bodyArrayBuffer) {
|
|
4494
|
-
return Promise.resolve(new Blob([this._bodyArrayBuffer]))
|
|
4495
|
-
} else if (this._bodyFormData) {
|
|
4496
|
-
throw new Error('could not read FormData body as blob')
|
|
4497
|
-
} else {
|
|
4498
|
-
return Promise.resolve(new Blob([this._bodyText]))
|
|
4499
|
-
}
|
|
4500
|
-
};
|
|
4501
|
-
|
|
4502
|
-
this.arrayBuffer = function() {
|
|
4503
|
-
if (this._bodyArrayBuffer) {
|
|
4504
|
-
return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
|
|
4505
|
-
} else {
|
|
4506
|
-
return this.blob().then(readBlobAsArrayBuffer)
|
|
4507
|
-
}
|
|
4508
|
-
};
|
|
4509
|
-
}
|
|
4510
|
-
|
|
4511
|
-
this.text = function() {
|
|
4512
|
-
var rejected = consumed(this);
|
|
4513
|
-
if (rejected) {
|
|
4514
|
-
return rejected
|
|
4515
|
-
}
|
|
4516
|
-
|
|
4517
|
-
if (this._bodyBlob) {
|
|
4518
|
-
return readBlobAsText(this._bodyBlob)
|
|
4519
|
-
} else if (this._bodyArrayBuffer) {
|
|
4520
|
-
return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
|
|
4521
|
-
} else if (this._bodyFormData) {
|
|
4522
|
-
throw new Error('could not read FormData body as text')
|
|
4523
|
-
} else {
|
|
4524
|
-
return Promise.resolve(this._bodyText)
|
|
4525
|
-
}
|
|
4526
|
-
};
|
|
4527
|
-
|
|
4528
|
-
if (support.formData) {
|
|
4529
|
-
this.formData = function() {
|
|
4530
|
-
return this.text().then(decode)
|
|
4531
|
-
};
|
|
4532
|
-
}
|
|
4533
|
-
|
|
4534
|
-
this.json = function() {
|
|
4535
|
-
return this.text().then(JSON.parse)
|
|
4536
|
-
};
|
|
4537
|
-
|
|
4538
|
-
return this
|
|
4539
|
-
}
|
|
4540
|
-
|
|
4541
|
-
// HTTP methods whose capitalization should be normalized
|
|
4542
|
-
var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
|
|
4543
|
-
|
|
4544
|
-
function normalizeMethod(method) {
|
|
4545
|
-
var upcased = method.toUpperCase();
|
|
4546
|
-
return methods.indexOf(upcased) > -1 ? upcased : method
|
|
4547
|
-
}
|
|
4548
|
-
|
|
4549
|
-
function Request(input, options) {
|
|
4550
|
-
options = options || {};
|
|
4551
|
-
var body = options.body;
|
|
4552
|
-
|
|
4553
|
-
if (input instanceof Request) {
|
|
4554
|
-
if (input.bodyUsed) {
|
|
4555
|
-
throw new TypeError('Already read')
|
|
4556
|
-
}
|
|
4557
|
-
this.url = input.url;
|
|
4558
|
-
this.credentials = input.credentials;
|
|
4559
|
-
if (!options.headers) {
|
|
4560
|
-
this.headers = new Headers(input.headers);
|
|
4561
|
-
}
|
|
4562
|
-
this.method = input.method;
|
|
4563
|
-
this.mode = input.mode;
|
|
4564
|
-
this.signal = input.signal;
|
|
4565
|
-
if (!body && input._bodyInit != null) {
|
|
4566
|
-
body = input._bodyInit;
|
|
4567
|
-
input.bodyUsed = true;
|
|
4568
|
-
}
|
|
4569
|
-
} else {
|
|
4570
|
-
this.url = String(input);
|
|
4571
|
-
}
|
|
4572
|
-
|
|
4573
|
-
this.credentials = options.credentials || this.credentials || 'same-origin';
|
|
4574
|
-
if (options.headers || !this.headers) {
|
|
4575
|
-
this.headers = new Headers(options.headers);
|
|
4576
|
-
}
|
|
4577
|
-
this.method = normalizeMethod(options.method || this.method || 'GET');
|
|
4578
|
-
this.mode = options.mode || this.mode || null;
|
|
4579
|
-
this.signal = options.signal || this.signal;
|
|
4580
|
-
this.referrer = null;
|
|
4581
|
-
|
|
4582
|
-
if ((this.method === 'GET' || this.method === 'HEAD') && body) {
|
|
4583
|
-
throw new TypeError('Body not allowed for GET or HEAD requests')
|
|
4584
|
-
}
|
|
4585
|
-
this._initBody(body);
|
|
4586
|
-
}
|
|
4587
|
-
|
|
4588
|
-
Request.prototype.clone = function() {
|
|
4589
|
-
return new Request(this, {body: this._bodyInit})
|
|
4590
|
-
};
|
|
4591
|
-
|
|
4592
|
-
function decode(body) {
|
|
4593
|
-
var form = new FormData();
|
|
4594
|
-
body
|
|
4595
|
-
.trim()
|
|
4596
|
-
.split('&')
|
|
4597
|
-
.forEach(function(bytes) {
|
|
4598
|
-
if (bytes) {
|
|
4599
|
-
var split = bytes.split('=');
|
|
4600
|
-
var name = split.shift().replace(/\+/g, ' ');
|
|
4601
|
-
var value = split.join('=').replace(/\+/g, ' ');
|
|
4602
|
-
form.append(decodeURIComponent(name), decodeURIComponent(value));
|
|
4603
|
-
}
|
|
4604
|
-
});
|
|
4605
|
-
return form
|
|
4606
|
-
}
|
|
4607
|
-
|
|
4608
|
-
function parseHeaders(rawHeaders) {
|
|
4609
|
-
var headers = new Headers();
|
|
4610
|
-
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
|
|
4611
|
-
// https://tools.ietf.org/html/rfc7230#section-3.2
|
|
4612
|
-
var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
|
|
4613
|
-
preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
|
|
4614
|
-
var parts = line.split(':');
|
|
4615
|
-
var key = parts.shift().trim();
|
|
4616
|
-
if (key) {
|
|
4617
|
-
var value = parts.join(':').trim();
|
|
4618
|
-
headers.append(key, value);
|
|
4619
|
-
}
|
|
4293
|
+
static setComputeUnitPrice(params) {
|
|
4294
|
+
const type = COMPUTE_BUDGET_INSTRUCTION_LAYOUTS.SetComputeUnitPrice;
|
|
4295
|
+
const data = encodeData(type, {
|
|
4296
|
+
microLamports: BigInt(params.microLamports)
|
|
4297
|
+
});
|
|
4298
|
+
return new TransactionInstruction({
|
|
4299
|
+
keys: [],
|
|
4300
|
+
programId: this.programId,
|
|
4301
|
+
data
|
|
4620
4302
|
});
|
|
4621
|
-
return headers
|
|
4622
|
-
}
|
|
4623
|
-
|
|
4624
|
-
Body.call(Request.prototype);
|
|
4625
|
-
|
|
4626
|
-
function Response(bodyInit, options) {
|
|
4627
|
-
if (!options) {
|
|
4628
|
-
options = {};
|
|
4629
|
-
}
|
|
4630
|
-
|
|
4631
|
-
this.type = 'default';
|
|
4632
|
-
this.status = options.status === undefined ? 200 : options.status;
|
|
4633
|
-
this.ok = this.status >= 200 && this.status < 300;
|
|
4634
|
-
this.statusText = 'statusText' in options ? options.statusText : 'OK';
|
|
4635
|
-
this.headers = new Headers(options.headers);
|
|
4636
|
-
this.url = options.url || '';
|
|
4637
|
-
this._initBody(bodyInit);
|
|
4638
|
-
}
|
|
4639
|
-
|
|
4640
|
-
Body.call(Response.prototype);
|
|
4641
|
-
|
|
4642
|
-
Response.prototype.clone = function() {
|
|
4643
|
-
return new Response(this._bodyInit, {
|
|
4644
|
-
status: this.status,
|
|
4645
|
-
statusText: this.statusText,
|
|
4646
|
-
headers: new Headers(this.headers),
|
|
4647
|
-
url: this.url
|
|
4648
|
-
})
|
|
4649
|
-
};
|
|
4650
|
-
|
|
4651
|
-
Response.error = function() {
|
|
4652
|
-
var response = new Response(null, {status: 0, statusText: ''});
|
|
4653
|
-
response.type = 'error';
|
|
4654
|
-
return response
|
|
4655
|
-
};
|
|
4656
|
-
|
|
4657
|
-
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
4658
|
-
|
|
4659
|
-
Response.redirect = function(url, status) {
|
|
4660
|
-
if (redirectStatuses.indexOf(status) === -1) {
|
|
4661
|
-
throw new RangeError('Invalid status code')
|
|
4662
|
-
}
|
|
4663
|
-
|
|
4664
|
-
return new Response(null, {status: status, headers: {location: url}})
|
|
4665
|
-
};
|
|
4666
|
-
|
|
4667
|
-
exports.DOMException = self.DOMException;
|
|
4668
|
-
try {
|
|
4669
|
-
new exports.DOMException();
|
|
4670
|
-
} catch (err) {
|
|
4671
|
-
exports.DOMException = function(message, name) {
|
|
4672
|
-
this.message = message;
|
|
4673
|
-
this.name = name;
|
|
4674
|
-
var error = Error(message);
|
|
4675
|
-
this.stack = error.stack;
|
|
4676
|
-
};
|
|
4677
|
-
exports.DOMException.prototype = Object.create(Error.prototype);
|
|
4678
|
-
exports.DOMException.prototype.constructor = exports.DOMException;
|
|
4679
|
-
}
|
|
4680
|
-
|
|
4681
|
-
function fetch(input, init) {
|
|
4682
|
-
return new Promise(function(resolve, reject) {
|
|
4683
|
-
var request = new Request(input, init);
|
|
4684
|
-
|
|
4685
|
-
if (request.signal && request.signal.aborted) {
|
|
4686
|
-
return reject(new exports.DOMException('Aborted', 'AbortError'))
|
|
4687
|
-
}
|
|
4688
|
-
|
|
4689
|
-
var xhr = new XMLHttpRequest();
|
|
4690
|
-
|
|
4691
|
-
function abortXhr() {
|
|
4692
|
-
xhr.abort();
|
|
4693
|
-
}
|
|
4694
|
-
|
|
4695
|
-
xhr.onload = function() {
|
|
4696
|
-
var options = {
|
|
4697
|
-
status: xhr.status,
|
|
4698
|
-
statusText: xhr.statusText,
|
|
4699
|
-
headers: parseHeaders(xhr.getAllResponseHeaders() || '')
|
|
4700
|
-
};
|
|
4701
|
-
options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
|
|
4702
|
-
var body = 'response' in xhr ? xhr.response : xhr.responseText;
|
|
4703
|
-
resolve(new Response(body, options));
|
|
4704
|
-
};
|
|
4705
|
-
|
|
4706
|
-
xhr.onerror = function() {
|
|
4707
|
-
reject(new TypeError('Network request failed'));
|
|
4708
|
-
};
|
|
4709
|
-
|
|
4710
|
-
xhr.ontimeout = function() {
|
|
4711
|
-
reject(new TypeError('Network request failed'));
|
|
4712
|
-
};
|
|
4713
|
-
|
|
4714
|
-
xhr.onabort = function() {
|
|
4715
|
-
reject(new exports.DOMException('Aborted', 'AbortError'));
|
|
4716
|
-
};
|
|
4717
|
-
|
|
4718
|
-
xhr.open(request.method, request.url, true);
|
|
4719
|
-
|
|
4720
|
-
if (request.credentials === 'include') {
|
|
4721
|
-
xhr.withCredentials = true;
|
|
4722
|
-
} else if (request.credentials === 'omit') {
|
|
4723
|
-
xhr.withCredentials = false;
|
|
4724
|
-
}
|
|
4725
|
-
|
|
4726
|
-
if ('responseType' in xhr && support.blob) {
|
|
4727
|
-
xhr.responseType = 'blob';
|
|
4728
|
-
}
|
|
4729
|
-
|
|
4730
|
-
request.headers.forEach(function(value, name) {
|
|
4731
|
-
xhr.setRequestHeader(name, value);
|
|
4732
|
-
});
|
|
4733
|
-
|
|
4734
|
-
if (request.signal) {
|
|
4735
|
-
request.signal.addEventListener('abort', abortXhr);
|
|
4736
|
-
|
|
4737
|
-
xhr.onreadystatechange = function() {
|
|
4738
|
-
// DONE (success or failure)
|
|
4739
|
-
if (xhr.readyState === 4) {
|
|
4740
|
-
request.signal.removeEventListener('abort', abortXhr);
|
|
4741
|
-
}
|
|
4742
|
-
};
|
|
4743
|
-
}
|
|
4744
|
-
|
|
4745
|
-
xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
|
|
4746
|
-
})
|
|
4747
|
-
}
|
|
4748
|
-
|
|
4749
|
-
fetch.polyfill = true;
|
|
4750
|
-
|
|
4751
|
-
if (!self.fetch) {
|
|
4752
|
-
self.fetch = fetch;
|
|
4753
|
-
self.Headers = Headers;
|
|
4754
|
-
self.Request = Request;
|
|
4755
|
-
self.Response = Response;
|
|
4756
4303
|
}
|
|
4757
4304
|
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
exports.Response = Response;
|
|
4761
|
-
exports.fetch = fetch;
|
|
4762
|
-
|
|
4763
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4764
|
-
|
|
4765
|
-
return exports;
|
|
4766
|
-
|
|
4767
|
-
}))({});
|
|
4768
|
-
})(__self__);
|
|
4769
|
-
__self__.fetch.ponyfill = true;
|
|
4770
|
-
// Remove "polyfill" property added by whatwg-fetch
|
|
4771
|
-
delete __self__.fetch.polyfill;
|
|
4772
|
-
// Choose between native implementation (global) or custom implementation (__self__)
|
|
4773
|
-
// var ctx = global.fetch ? global : __self__;
|
|
4774
|
-
var ctx = __self__; // this line disable service worker support temporarily
|
|
4775
|
-
exports = ctx.fetch; // To enable: import fetch from 'cross-fetch'
|
|
4776
|
-
exports.default = ctx.fetch; // For TypeScript consumers without esModuleInterop.
|
|
4777
|
-
exports.fetch = ctx.fetch; // To enable: import {fetch} from 'cross-fetch'
|
|
4778
|
-
exports.Headers = ctx.Headers;
|
|
4779
|
-
exports.Request = ctx.Request;
|
|
4780
|
-
exports.Response = ctx.Response;
|
|
4781
|
-
module.exports = exports;
|
|
4782
|
-
}(browserPonyfill, browserPonyfill.exports));
|
|
4783
|
-
|
|
4784
|
-
var crossFetch = /*@__PURE__*/getDefaultExportFromCjs(browserPonyfill.exports);
|
|
4305
|
+
}
|
|
4306
|
+
ComputeBudgetProgram.programId = new PublicKey('ComputeBudget111111111111111111111111111111');
|
|
4785
4307
|
|
|
4786
4308
|
var objToString = Object.prototype.toString;
|
|
4787
4309
|
var objKeys = Object.keys || function(obj) {
|
|
@@ -4964,6 +4486,8 @@ class SendTransactionError extends Error {
|
|
|
4964
4486
|
|
|
4965
4487
|
}
|
|
4966
4488
|
|
|
4489
|
+
var fetchImpl = globalThis.fetch;
|
|
4490
|
+
|
|
4967
4491
|
// TODO: These constants should be removed in favor of reading them out of a
|
|
4968
4492
|
// Syscall account
|
|
4969
4493
|
|
|
@@ -5213,15 +4737,15 @@ const BlockProductionResponseStruct = jsonRpcResultAndContext(type({
|
|
|
5213
4737
|
*/
|
|
5214
4738
|
|
|
5215
4739
|
function createRpcClient(url, useHttps, httpHeaders, customFetch, fetchMiddleware, disableRetryOnRateLimit) {
|
|
5216
|
-
const fetch = customFetch ? customFetch :
|
|
4740
|
+
const fetch = customFetch ? customFetch : fetchImpl;
|
|
5217
4741
|
|
|
5218
4742
|
let fetchWithMiddleware;
|
|
5219
4743
|
|
|
5220
4744
|
if (fetchMiddleware) {
|
|
5221
|
-
fetchWithMiddleware = async (
|
|
4745
|
+
fetchWithMiddleware = async (info, init) => {
|
|
5222
4746
|
const modifiedFetchArgs = await new Promise((resolve, reject) => {
|
|
5223
4747
|
try {
|
|
5224
|
-
fetchMiddleware(
|
|
4748
|
+
fetchMiddleware(info, init, (modifiedInfo, modifiedInit) => resolve([modifiedInfo, modifiedInit]));
|
|
5225
4749
|
} catch (error) {
|
|
5226
4750
|
reject(error);
|
|
5227
4751
|
}
|
|
@@ -10166,7 +9690,7 @@ VoteProgram.space = 3731;
|
|
|
10166
9690
|
*
|
|
10167
9691
|
* @param {Connection} connection
|
|
10168
9692
|
* @param {Buffer} rawTransaction
|
|
10169
|
-
* @param {
|
|
9693
|
+
* @param {BlockheightBasedTransactionConfirmationStrategy} confirmationStrategy
|
|
10170
9694
|
* @param {ConfirmOptions} [options]
|
|
10171
9695
|
* @returns {Promise<TransactionSignature>}
|
|
10172
9696
|
*/
|