@solana/web3.js 1.9.1 → 1.9.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.esm.js +41 -18
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +41 -18
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +41 -18
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +42 -25
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +2 -2
- 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
|
@@ -10783,6 +10783,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
10783
10783
|
}
|
|
10784
10784
|
}
|
|
10785
10785
|
|
|
10786
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
10787
|
+
/**
|
|
10788
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
10789
|
+
*/
|
|
10790
|
+
|
|
10791
|
+
function guardedShift(byteArray) {
|
|
10792
|
+
if (byteArray.length === 0) {
|
|
10793
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
10794
|
+
}
|
|
10795
|
+
|
|
10796
|
+
return byteArray.shift();
|
|
10797
|
+
}
|
|
10798
|
+
/**
|
|
10799
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
10800
|
+
* the array.
|
|
10801
|
+
*/
|
|
10802
|
+
|
|
10803
|
+
function guardedSplice(byteArray, ...args) {
|
|
10804
|
+
var _args$;
|
|
10805
|
+
|
|
10806
|
+
const [start] = args;
|
|
10807
|
+
|
|
10808
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
10809
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
10810
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
10811
|
+
}
|
|
10812
|
+
|
|
10813
|
+
return byteArray.splice(...args);
|
|
10814
|
+
}
|
|
10815
|
+
|
|
10786
10816
|
/**
|
|
10787
10817
|
* The message header, identifying signed and read-only account
|
|
10788
10818
|
*/
|
|
@@ -10859,32 +10889,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
10859
10889
|
static from(buffer$1) {
|
|
10860
10890
|
// Slice up wire data
|
|
10861
10891
|
let byteArray = [...buffer$1];
|
|
10862
|
-
const numRequiredSignatures = byteArray
|
|
10863
|
-
const numReadonlySignedAccounts = byteArray
|
|
10864
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
10892
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
10893
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
10894
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
10865
10895
|
const accountCount = decodeLength(byteArray);
|
|
10866
10896
|
let accountKeys = [];
|
|
10867
10897
|
|
|
10868
10898
|
for (let i = 0; i < accountCount; i++) {
|
|
10869
|
-
const account = byteArray
|
|
10870
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
10899
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
10871
10900
|
accountKeys.push(bs58.encode(buffer.Buffer.from(account)));
|
|
10872
10901
|
}
|
|
10873
10902
|
|
|
10874
|
-
const recentBlockhash = byteArray
|
|
10875
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
10903
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
10876
10904
|
const instructionCount = decodeLength(byteArray);
|
|
10877
10905
|
let instructions = [];
|
|
10878
10906
|
|
|
10879
10907
|
for (let i = 0; i < instructionCount; i++) {
|
|
10880
|
-
const programIdIndex = byteArray
|
|
10908
|
+
const programIdIndex = guardedShift(byteArray);
|
|
10881
10909
|
const accountCount = decodeLength(byteArray);
|
|
10882
|
-
const accounts = byteArray
|
|
10883
|
-
byteArray = byteArray.slice(accountCount);
|
|
10910
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
10884
10911
|
const dataLength = decodeLength(byteArray);
|
|
10885
|
-
const dataSlice = byteArray
|
|
10912
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
10886
10913
|
const data = bs58.encode(buffer.Buffer.from(dataSlice));
|
|
10887
|
-
byteArray = byteArray.slice(dataLength);
|
|
10888
10914
|
instructions.push({
|
|
10889
10915
|
programIdIndex,
|
|
10890
10916
|
accounts,
|
|
@@ -11494,8 +11520,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
11494
11520
|
let signatures = [];
|
|
11495
11521
|
|
|
11496
11522
|
for (let i = 0; i < signatureCount; i++) {
|
|
11497
|
-
const signature = byteArray
|
|
11498
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
11523
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
11499
11524
|
signatures.push(bs58.encode(buffer.Buffer.from(signature)));
|
|
11500
11525
|
}
|
|
11501
11526
|
|
|
@@ -20763,9 +20788,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
20763
20788
|
"minimalistic-assert": "^1.0.1",
|
|
20764
20789
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
20765
20790
|
};
|
|
20766
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
20767
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
20768
|
-
var _from = "elliptic@6.5.4";
|
|
20769
20791
|
var require$$0 = {
|
|
20770
20792
|
name: name,
|
|
20771
20793
|
version: version,
|
|
@@ -20780,10 +20802,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
20780
20802
|
bugs: bugs,
|
|
20781
20803
|
homepage: homepage,
|
|
20782
20804
|
devDependencies: devDependencies,
|
|
20783
|
-
dependencies: dependencies
|
|
20784
|
-
_resolved: _resolved,
|
|
20785
|
-
_integrity: _integrity,
|
|
20786
|
-
_from: _from
|
|
20805
|
+
dependencies: dependencies
|
|
20787
20806
|
};
|
|
20788
20807
|
|
|
20789
20808
|
var minimalisticAssert = assert$9;
|
|
@@ -27385,10 +27404,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
27385
27404
|
const configKeys = [];
|
|
27386
27405
|
|
|
27387
27406
|
for (let i = 0; i < 2; i++) {
|
|
27388
|
-
const publicKey = new PublicKey(byteArray
|
|
27389
|
-
|
|
27390
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
27391
|
-
byteArray = byteArray.slice(1);
|
|
27407
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
27408
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
27392
27409
|
configKeys.push({
|
|
27393
27410
|
publicKey,
|
|
27394
27411
|
isSigner
|