@solana/web3.js 1.25.0 → 1.25.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
|
|
|
@@ -22357,9 +22386,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22357
22386
|
"minimalistic-assert": "^1.0.1",
|
|
22358
22387
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
22359
22388
|
};
|
|
22360
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
22361
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
22362
|
-
var _from = "elliptic@6.5.4";
|
|
22363
22389
|
var require$$0 = {
|
|
22364
22390
|
name: name,
|
|
22365
22391
|
version: version,
|
|
@@ -22374,10 +22400,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22374
22400
|
bugs: bugs,
|
|
22375
22401
|
homepage: homepage,
|
|
22376
22402
|
devDependencies: devDependencies,
|
|
22377
|
-
dependencies: dependencies
|
|
22378
|
-
_resolved: _resolved,
|
|
22379
|
-
_integrity: _integrity,
|
|
22380
|
-
_from: _from
|
|
22403
|
+
dependencies: dependencies
|
|
22381
22404
|
};
|
|
22382
22405
|
|
|
22383
22406
|
var utils$m = {};
|
|
@@ -29037,10 +29060,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
29037
29060
|
const configKeys = [];
|
|
29038
29061
|
|
|
29039
29062
|
for (let i = 0; i < 2; i++) {
|
|
29040
|
-
const publicKey = new PublicKey(byteArray
|
|
29041
|
-
|
|
29042
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
29043
|
-
byteArray = byteArray.slice(1);
|
|
29063
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
29064
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
29044
29065
|
configKeys.push({
|
|
29045
29066
|
publicKey,
|
|
29046
29067
|
isSigner
|