@solana/web3.js 1.42.0 → 1.42.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.cjs.js +45 -18
- package/lib/index.browser.cjs.js.map +1 -1
- 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 +45 -18
- 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 +22 -22
- package/src/message.ts +9 -12
- package/src/transaction.ts +2 -2
- package/src/util/guarded-array-utils.ts +34 -0
- package/src/validator-info.ts +5 -4
package/lib/index.iife.js
CHANGED
|
@@ -13876,6 +13876,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
13876
13876
|
}
|
|
13877
13877
|
}
|
|
13878
13878
|
|
|
13879
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
13880
|
+
/**
|
|
13881
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
13882
|
+
*/
|
|
13883
|
+
|
|
13884
|
+
function guardedShift(byteArray) {
|
|
13885
|
+
if (byteArray.length === 0) {
|
|
13886
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
13887
|
+
}
|
|
13888
|
+
|
|
13889
|
+
return byteArray.shift();
|
|
13890
|
+
}
|
|
13891
|
+
/**
|
|
13892
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
13893
|
+
* the array.
|
|
13894
|
+
*/
|
|
13895
|
+
|
|
13896
|
+
function guardedSplice(byteArray, ...args) {
|
|
13897
|
+
var _args$;
|
|
13898
|
+
|
|
13899
|
+
const [start] = args;
|
|
13900
|
+
|
|
13901
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
13902
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
13903
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
13904
|
+
}
|
|
13905
|
+
|
|
13906
|
+
return byteArray.splice(...args);
|
|
13907
|
+
}
|
|
13908
|
+
|
|
13879
13909
|
/**
|
|
13880
13910
|
* The message header, identifying signed and read-only account
|
|
13881
13911
|
*/
|
|
@@ -13974,32 +14004,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
13974
14004
|
static from(buffer$1) {
|
|
13975
14005
|
// Slice up wire data
|
|
13976
14006
|
let byteArray = [...buffer$1];
|
|
13977
|
-
const numRequiredSignatures = byteArray
|
|
13978
|
-
const numReadonlySignedAccounts = byteArray
|
|
13979
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
14007
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
14008
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
14009
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
13980
14010
|
const accountCount = decodeLength(byteArray);
|
|
13981
14011
|
let accountKeys = [];
|
|
13982
14012
|
|
|
13983
14013
|
for (let i = 0; i < accountCount; i++) {
|
|
13984
|
-
const account = byteArray
|
|
13985
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14014
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
13986
14015
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
13987
14016
|
}
|
|
13988
14017
|
|
|
13989
|
-
const recentBlockhash = byteArray
|
|
13990
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14018
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
13991
14019
|
const instructionCount = decodeLength(byteArray);
|
|
13992
14020
|
let instructions = [];
|
|
13993
14021
|
|
|
13994
14022
|
for (let i = 0; i < instructionCount; i++) {
|
|
13995
|
-
const programIdIndex = byteArray
|
|
14023
|
+
const programIdIndex = guardedShift(byteArray);
|
|
13996
14024
|
const accountCount = decodeLength(byteArray);
|
|
13997
|
-
const accounts = byteArray
|
|
13998
|
-
byteArray = byteArray.slice(accountCount);
|
|
14025
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
13999
14026
|
const dataLength = decodeLength(byteArray);
|
|
14000
|
-
const dataSlice = byteArray
|
|
14027
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
14001
14028
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
14002
|
-
byteArray = byteArray.slice(dataLength);
|
|
14003
14029
|
instructions.push({
|
|
14004
14030
|
programIdIndex,
|
|
14005
14031
|
accounts,
|
|
@@ -14028,6 +14054,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
14028
14054
|
}
|
|
14029
14055
|
}
|
|
14030
14056
|
|
|
14057
|
+
/**
|
|
14058
|
+
* Transaction signature as base-58 encoded string
|
|
14059
|
+
*/
|
|
14060
|
+
|
|
14031
14061
|
exports.TransactionStatus = void 0;
|
|
14032
14062
|
/**
|
|
14033
14063
|
* Default (empty) signature
|
|
@@ -14678,8 +14708,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
14678
14708
|
let signatures = [];
|
|
14679
14709
|
|
|
14680
14710
|
for (let i = 0; i < signatureCount; i++) {
|
|
14681
|
-
const signature = byteArray
|
|
14682
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
14711
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
|
|
14683
14712
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
14684
14713
|
}
|
|
14685
14714
|
|
|
@@ -29690,10 +29719,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
29690
29719
|
const configKeys = [];
|
|
29691
29720
|
|
|
29692
29721
|
for (let i = 0; i < 2; i++) {
|
|
29693
|
-
const publicKey = new PublicKey(byteArray
|
|
29694
|
-
|
|
29695
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
29696
|
-
byteArray = byteArray.slice(1);
|
|
29722
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
29723
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
29697
29724
|
configKeys.push({
|
|
29698
29725
|
publicKey,
|
|
29699
29726
|
isSigner
|