@solana/web3.js 1.24.2 → 1.24.3
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
|
@@ -12416,6 +12416,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
12416
12416
|
}
|
|
12417
12417
|
}
|
|
12418
12418
|
|
|
12419
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
12420
|
+
/**
|
|
12421
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
12422
|
+
*/
|
|
12423
|
+
|
|
12424
|
+
function guardedShift(byteArray) {
|
|
12425
|
+
if (byteArray.length === 0) {
|
|
12426
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
12427
|
+
}
|
|
12428
|
+
|
|
12429
|
+
return byteArray.shift();
|
|
12430
|
+
}
|
|
12431
|
+
/**
|
|
12432
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
12433
|
+
* the array.
|
|
12434
|
+
*/
|
|
12435
|
+
|
|
12436
|
+
function guardedSplice(byteArray, ...args) {
|
|
12437
|
+
var _args$;
|
|
12438
|
+
|
|
12439
|
+
const [start] = args;
|
|
12440
|
+
|
|
12441
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
12442
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
12443
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
12444
|
+
}
|
|
12445
|
+
|
|
12446
|
+
return byteArray.splice(...args);
|
|
12447
|
+
}
|
|
12448
|
+
|
|
12419
12449
|
/**
|
|
12420
12450
|
* The message header, identifying signed and read-only account
|
|
12421
12451
|
*/
|
|
@@ -12500,32 +12530,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
12500
12530
|
static from(buffer$1) {
|
|
12501
12531
|
// Slice up wire data
|
|
12502
12532
|
let byteArray = [...buffer$1];
|
|
12503
|
-
const numRequiredSignatures = byteArray
|
|
12504
|
-
const numReadonlySignedAccounts = byteArray
|
|
12505
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
12533
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
12534
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
12535
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
12506
12536
|
const accountCount = decodeLength(byteArray);
|
|
12507
12537
|
let accountKeys = [];
|
|
12508
12538
|
|
|
12509
12539
|
for (let i = 0; i < accountCount; i++) {
|
|
12510
|
-
const account = byteArray
|
|
12511
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12540
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
12512
12541
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
12513
12542
|
}
|
|
12514
12543
|
|
|
12515
|
-
const recentBlockhash = byteArray
|
|
12516
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12544
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
12517
12545
|
const instructionCount = decodeLength(byteArray);
|
|
12518
12546
|
let instructions = [];
|
|
12519
12547
|
|
|
12520
12548
|
for (let i = 0; i < instructionCount; i++) {
|
|
12521
|
-
const programIdIndex = byteArray
|
|
12549
|
+
const programIdIndex = guardedShift(byteArray);
|
|
12522
12550
|
const accountCount = decodeLength(byteArray);
|
|
12523
|
-
const accounts = byteArray
|
|
12524
|
-
byteArray = byteArray.slice(accountCount);
|
|
12551
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
12525
12552
|
const dataLength = decodeLength(byteArray);
|
|
12526
|
-
const dataSlice = byteArray
|
|
12553
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
12527
12554
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
12528
|
-
byteArray = byteArray.slice(dataLength);
|
|
12529
12555
|
instructions.push({
|
|
12530
12556
|
programIdIndex,
|
|
12531
12557
|
accounts,
|
|
@@ -12554,6 +12580,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
12554
12580
|
}
|
|
12555
12581
|
}
|
|
12556
12582
|
|
|
12583
|
+
/**
|
|
12584
|
+
* Transaction signature as base-58 encoded string
|
|
12585
|
+
*/
|
|
12586
|
+
|
|
12557
12587
|
/**
|
|
12558
12588
|
* Default (empty) signature
|
|
12559
12589
|
*
|
|
@@ -13147,8 +13177,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
13147
13177
|
let signatures = [];
|
|
13148
13178
|
|
|
13149
13179
|
for (let i = 0; i < signatureCount; i++) {
|
|
13150
|
-
const signature = byteArray
|
|
13151
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
13180
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
13152
13181
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
13153
13182
|
}
|
|
13154
13183
|
|
|
@@ -21823,9 +21852,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
21823
21852
|
"minimalistic-assert": "^1.0.1",
|
|
21824
21853
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
21825
21854
|
};
|
|
21826
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
21827
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
21828
|
-
var _from = "elliptic@6.5.4";
|
|
21829
21855
|
var require$$0 = {
|
|
21830
21856
|
name: name,
|
|
21831
21857
|
version: version,
|
|
@@ -21840,10 +21866,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
21840
21866
|
bugs: bugs,
|
|
21841
21867
|
homepage: homepage,
|
|
21842
21868
|
devDependencies: devDependencies,
|
|
21843
|
-
dependencies: dependencies
|
|
21844
|
-
_resolved: _resolved,
|
|
21845
|
-
_integrity: _integrity,
|
|
21846
|
-
_from: _from
|
|
21869
|
+
dependencies: dependencies
|
|
21847
21870
|
};
|
|
21848
21871
|
|
|
21849
21872
|
var utils$m = {};
|
|
@@ -28503,10 +28526,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28503
28526
|
const configKeys = [];
|
|
28504
28527
|
|
|
28505
28528
|
for (let i = 0; i < 2; i++) {
|
|
28506
|
-
const publicKey = new PublicKey(byteArray
|
|
28507
|
-
|
|
28508
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28509
|
-
byteArray = byteArray.slice(1);
|
|
28529
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28530
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28510
28531
|
configKeys.push({
|
|
28511
28532
|
publicKey,
|
|
28512
28533
|
isSigner
|