@solana/web3.js 1.23.0 → 1.23.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
|
@@ -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
|
|
|
@@ -21742,9 +21771,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
21742
21771
|
"minimalistic-assert": "^1.0.1",
|
|
21743
21772
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
21744
21773
|
};
|
|
21745
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
21746
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
21747
|
-
var _from = "elliptic@6.5.4";
|
|
21748
21774
|
var require$$0 = {
|
|
21749
21775
|
name: name,
|
|
21750
21776
|
version: version,
|
|
@@ -21759,10 +21785,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
21759
21785
|
bugs: bugs,
|
|
21760
21786
|
homepage: homepage,
|
|
21761
21787
|
devDependencies: devDependencies,
|
|
21762
|
-
dependencies: dependencies
|
|
21763
|
-
_resolved: _resolved,
|
|
21764
|
-
_integrity: _integrity,
|
|
21765
|
-
_from: _from
|
|
21788
|
+
dependencies: dependencies
|
|
21766
21789
|
};
|
|
21767
21790
|
|
|
21768
21791
|
var utils$m = {};
|
|
@@ -28422,10 +28445,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28422
28445
|
const configKeys = [];
|
|
28423
28446
|
|
|
28424
28447
|
for (let i = 0; i < 2; i++) {
|
|
28425
|
-
const publicKey = new PublicKey(byteArray
|
|
28426
|
-
|
|
28427
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28428
|
-
byteArray = byteArray.slice(1);
|
|
28448
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28449
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28429
28450
|
configKeys.push({
|
|
28430
28451
|
publicKey,
|
|
28431
28452
|
isSigner
|