@solana/web3.js 1.29.3 → 1.29.4
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 +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
|
@@ -14693,6 +14693,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
14693
14693
|
}
|
|
14694
14694
|
}
|
|
14695
14695
|
|
|
14696
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
14697
|
+
/**
|
|
14698
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
14699
|
+
*/
|
|
14700
|
+
|
|
14701
|
+
function guardedShift(byteArray) {
|
|
14702
|
+
if (byteArray.length === 0) {
|
|
14703
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14704
|
+
}
|
|
14705
|
+
|
|
14706
|
+
return byteArray.shift();
|
|
14707
|
+
}
|
|
14708
|
+
/**
|
|
14709
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
14710
|
+
* the array.
|
|
14711
|
+
*/
|
|
14712
|
+
|
|
14713
|
+
function guardedSplice(byteArray, ...args) {
|
|
14714
|
+
var _args$;
|
|
14715
|
+
|
|
14716
|
+
const [start] = args;
|
|
14717
|
+
|
|
14718
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
14719
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
14720
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14721
|
+
}
|
|
14722
|
+
|
|
14723
|
+
return byteArray.splice(...args);
|
|
14724
|
+
}
|
|
14725
|
+
|
|
14696
14726
|
/**
|
|
14697
14727
|
* The message header, identifying signed and read-only account
|
|
14698
14728
|
*/
|
|
@@ -14796,32 +14826,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
14796
14826
|
static from(buffer$1) {
|
|
14797
14827
|
// Slice up wire data
|
|
14798
14828
|
let byteArray = [...buffer$1];
|
|
14799
|
-
const numRequiredSignatures = byteArray
|
|
14800
|
-
const numReadonlySignedAccounts = byteArray
|
|
14801
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
14829
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
14830
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
14831
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
14802
14832
|
const accountCount = decodeLength(byteArray);
|
|
14803
14833
|
let accountKeys = [];
|
|
14804
14834
|
|
|
14805
14835
|
for (let i = 0; i < accountCount; i++) {
|
|
14806
|
-
const account = byteArray
|
|
14807
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14836
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14808
14837
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
14809
14838
|
}
|
|
14810
14839
|
|
|
14811
|
-
const recentBlockhash = byteArray
|
|
14812
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14840
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14813
14841
|
const instructionCount = decodeLength(byteArray);
|
|
14814
14842
|
let instructions = [];
|
|
14815
14843
|
|
|
14816
14844
|
for (let i = 0; i < instructionCount; i++) {
|
|
14817
|
-
const programIdIndex = byteArray
|
|
14845
|
+
const programIdIndex = guardedShift(byteArray);
|
|
14818
14846
|
const accountCount = decodeLength(byteArray);
|
|
14819
|
-
const accounts = byteArray
|
|
14820
|
-
byteArray = byteArray.slice(accountCount);
|
|
14847
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
14821
14848
|
const dataLength = decodeLength(byteArray);
|
|
14822
|
-
const dataSlice = byteArray
|
|
14849
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
14823
14850
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
14824
|
-
byteArray = byteArray.slice(dataLength);
|
|
14825
14851
|
instructions.push({
|
|
14826
14852
|
programIdIndex,
|
|
14827
14853
|
accounts,
|
|
@@ -14850,6 +14876,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
14850
14876
|
}
|
|
14851
14877
|
}
|
|
14852
14878
|
|
|
14879
|
+
/**
|
|
14880
|
+
* Transaction signature as base-58 encoded string
|
|
14881
|
+
*/
|
|
14882
|
+
|
|
14853
14883
|
/**
|
|
14854
14884
|
* Default (empty) signature
|
|
14855
14885
|
*
|
|
@@ -15443,8 +15473,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
15443
15473
|
let signatures = [];
|
|
15444
15474
|
|
|
15445
15475
|
for (let i = 0; i < signatureCount; i++) {
|
|
15446
|
-
const signature = byteArray
|
|
15447
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
15476
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
15448
15477
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
15449
15478
|
}
|
|
15450
15479
|
|
|
@@ -24807,9 +24836,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
24807
24836
|
"minimalistic-assert": "^1.0.1",
|
|
24808
24837
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
24809
24838
|
};
|
|
24810
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
24811
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
24812
|
-
var _from = "elliptic@6.5.4";
|
|
24813
24839
|
var require$$0 = {
|
|
24814
24840
|
name: name,
|
|
24815
24841
|
version: version,
|
|
@@ -24824,10 +24850,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
24824
24850
|
bugs: bugs,
|
|
24825
24851
|
homepage: homepage,
|
|
24826
24852
|
devDependencies: devDependencies,
|
|
24827
|
-
dependencies: dependencies
|
|
24828
|
-
_resolved: _resolved,
|
|
24829
|
-
_integrity: _integrity,
|
|
24830
|
-
_from: _from
|
|
24853
|
+
dependencies: dependencies
|
|
24831
24854
|
};
|
|
24832
24855
|
|
|
24833
24856
|
var utils$c = {};
|
|
@@ -28802,10 +28825,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28802
28825
|
const configKeys = [];
|
|
28803
28826
|
|
|
28804
28827
|
for (let i = 0; i < 2; i++) {
|
|
28805
|
-
const publicKey = new PublicKey(byteArray
|
|
28806
|
-
|
|
28807
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28808
|
-
byteArray = byteArray.slice(1);
|
|
28828
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28829
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28809
28830
|
configKeys.push({
|
|
28810
28831
|
publicKey,
|
|
28811
28832
|
isSigner
|