@solana/web3.js 1.26.0 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.browser.esm.js +45 -18
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +45 -18
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +45 -18
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +46 -25
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +3 -3
- package/lib/index.iife.min.js.map +1 -1
- package/package.json +27 -27
- package/src/message.ts +9 -12
- package/src/transaction.ts +2 -2
- package/src/util/guarded-array-utils.ts +37 -0
- package/src/validator-info.ts +5 -4
package/lib/index.iife.js
CHANGED
|
@@ -12420,6 +12420,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
12420
12420
|
}
|
|
12421
12421
|
}
|
|
12422
12422
|
|
|
12423
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
12424
|
+
/**
|
|
12425
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
12426
|
+
*/
|
|
12427
|
+
|
|
12428
|
+
function guardedShift(byteArray) {
|
|
12429
|
+
if (byteArray.length === 0) {
|
|
12430
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
12431
|
+
}
|
|
12432
|
+
|
|
12433
|
+
return byteArray.shift();
|
|
12434
|
+
}
|
|
12435
|
+
/**
|
|
12436
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
12437
|
+
* the array.
|
|
12438
|
+
*/
|
|
12439
|
+
|
|
12440
|
+
function guardedSplice(byteArray, ...args) {
|
|
12441
|
+
var _args$;
|
|
12442
|
+
|
|
12443
|
+
const [start] = args;
|
|
12444
|
+
|
|
12445
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
12446
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
12447
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
12448
|
+
}
|
|
12449
|
+
|
|
12450
|
+
return byteArray.splice(...args);
|
|
12451
|
+
}
|
|
12452
|
+
|
|
12423
12453
|
/**
|
|
12424
12454
|
* The message header, identifying signed and read-only account
|
|
12425
12455
|
*/
|
|
@@ -12504,32 +12534,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
12504
12534
|
static from(buffer$1) {
|
|
12505
12535
|
// Slice up wire data
|
|
12506
12536
|
let byteArray = [...buffer$1];
|
|
12507
|
-
const numRequiredSignatures = byteArray
|
|
12508
|
-
const numReadonlySignedAccounts = byteArray
|
|
12509
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
12537
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
12538
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
12539
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
12510
12540
|
const accountCount = decodeLength(byteArray);
|
|
12511
12541
|
let accountKeys = [];
|
|
12512
12542
|
|
|
12513
12543
|
for (let i = 0; i < accountCount; i++) {
|
|
12514
|
-
const account = byteArray
|
|
12515
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12544
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
12516
12545
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
12517
12546
|
}
|
|
12518
12547
|
|
|
12519
|
-
const recentBlockhash = byteArray
|
|
12520
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12548
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
12521
12549
|
const instructionCount = decodeLength(byteArray);
|
|
12522
12550
|
let instructions = [];
|
|
12523
12551
|
|
|
12524
12552
|
for (let i = 0; i < instructionCount; i++) {
|
|
12525
|
-
const programIdIndex = byteArray
|
|
12553
|
+
const programIdIndex = guardedShift(byteArray);
|
|
12526
12554
|
const accountCount = decodeLength(byteArray);
|
|
12527
|
-
const accounts = byteArray
|
|
12528
|
-
byteArray = byteArray.slice(accountCount);
|
|
12555
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
12529
12556
|
const dataLength = decodeLength(byteArray);
|
|
12530
|
-
const dataSlice = byteArray
|
|
12557
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
12531
12558
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
12532
|
-
byteArray = byteArray.slice(dataLength);
|
|
12533
12559
|
instructions.push({
|
|
12534
12560
|
programIdIndex,
|
|
12535
12561
|
accounts,
|
|
@@ -12558,6 +12584,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
12558
12584
|
}
|
|
12559
12585
|
}
|
|
12560
12586
|
|
|
12587
|
+
/**
|
|
12588
|
+
* Transaction signature as base-58 encoded string
|
|
12589
|
+
*/
|
|
12590
|
+
|
|
12561
12591
|
/**
|
|
12562
12592
|
* Default (empty) signature
|
|
12563
12593
|
*
|
|
@@ -13151,8 +13181,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
13151
13181
|
let signatures = [];
|
|
13152
13182
|
|
|
13153
13183
|
for (let i = 0; i < signatureCount; i++) {
|
|
13154
|
-
const signature = byteArray
|
|
13155
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
13184
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
13156
13185
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
13157
13186
|
}
|
|
13158
13187
|
|
|
@@ -22372,9 +22401,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22372
22401
|
"minimalistic-assert": "^1.0.1",
|
|
22373
22402
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
22374
22403
|
};
|
|
22375
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
22376
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
22377
|
-
var _from = "elliptic@6.5.4";
|
|
22378
22404
|
var require$$0 = {
|
|
22379
22405
|
name: name,
|
|
22380
22406
|
version: version,
|
|
@@ -22389,10 +22415,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22389
22415
|
bugs: bugs,
|
|
22390
22416
|
homepage: homepage,
|
|
22391
22417
|
devDependencies: devDependencies,
|
|
22392
|
-
dependencies: dependencies
|
|
22393
|
-
_resolved: _resolved,
|
|
22394
|
-
_integrity: _integrity,
|
|
22395
|
-
_from: _from
|
|
22418
|
+
dependencies: dependencies
|
|
22396
22419
|
};
|
|
22397
22420
|
|
|
22398
22421
|
var utils$m = {};
|
|
@@ -29052,10 +29075,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
29052
29075
|
const configKeys = [];
|
|
29053
29076
|
|
|
29054
29077
|
for (let i = 0; i < 2; i++) {
|
|
29055
|
-
const publicKey = new PublicKey(byteArray
|
|
29056
|
-
|
|
29057
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
29058
|
-
byteArray = byteArray.slice(1);
|
|
29078
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
29079
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
29059
29080
|
configKeys.push({
|
|
29060
29081
|
publicKey,
|
|
29061
29082
|
isSigner
|