@solana/web3.js 1.53.0 → 1.53.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 +50 -19
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +50 -19
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +50 -19
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +50 -19
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +50 -19
- 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/lib/index.native.js +50 -19
- package/lib/index.native.js.map +1 -1
- package/package.json +22 -22
- package/src/message/legacy.ts +9 -12
- package/src/transaction/legacy.ts +2 -2
- package/src/utils/guarded-array-utils.ts +34 -0
- package/src/validator-info.ts +5 -4
package/lib/index.iife.js
CHANGED
|
@@ -13914,6 +13914,40 @@ var solanaWeb3 = (function (exports) {
|
|
|
13914
13914
|
}
|
|
13915
13915
|
}
|
|
13916
13916
|
|
|
13917
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
13918
|
+
/**
|
|
13919
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
13920
|
+
*/
|
|
13921
|
+
|
|
13922
|
+
function guardedShift(byteArray) {
|
|
13923
|
+
if (byteArray.length === 0) {
|
|
13924
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
13925
|
+
}
|
|
13926
|
+
|
|
13927
|
+
return byteArray.shift();
|
|
13928
|
+
}
|
|
13929
|
+
/**
|
|
13930
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
13931
|
+
* the array.
|
|
13932
|
+
*/
|
|
13933
|
+
|
|
13934
|
+
function guardedSplice(byteArray, ...args) {
|
|
13935
|
+
var _args$;
|
|
13936
|
+
|
|
13937
|
+
const [start] = args;
|
|
13938
|
+
|
|
13939
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
13940
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
13941
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
13942
|
+
}
|
|
13943
|
+
|
|
13944
|
+
return byteArray.splice(...args);
|
|
13945
|
+
}
|
|
13946
|
+
|
|
13947
|
+
/**
|
|
13948
|
+
* Message constructor arguments
|
|
13949
|
+
*/
|
|
13950
|
+
|
|
13917
13951
|
const PUBKEY_LENGTH = 32;
|
|
13918
13952
|
/**
|
|
13919
13953
|
* List of instructions to be processed atomically
|
|
@@ -14008,32 +14042,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
14008
14042
|
static from(buffer$1) {
|
|
14009
14043
|
// Slice up wire data
|
|
14010
14044
|
let byteArray = [...buffer$1];
|
|
14011
|
-
const numRequiredSignatures = byteArray
|
|
14012
|
-
const numReadonlySignedAccounts = byteArray
|
|
14013
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
14045
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
14046
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
14047
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
14014
14048
|
const accountCount = decodeLength(byteArray);
|
|
14015
14049
|
let accountKeys = [];
|
|
14016
14050
|
|
|
14017
14051
|
for (let i = 0; i < accountCount; i++) {
|
|
14018
|
-
const account = byteArray
|
|
14019
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14052
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14020
14053
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
14021
14054
|
}
|
|
14022
14055
|
|
|
14023
|
-
const recentBlockhash = byteArray
|
|
14024
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14056
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14025
14057
|
const instructionCount = decodeLength(byteArray);
|
|
14026
14058
|
let instructions = [];
|
|
14027
14059
|
|
|
14028
14060
|
for (let i = 0; i < instructionCount; i++) {
|
|
14029
|
-
const programIdIndex = byteArray
|
|
14061
|
+
const programIdIndex = guardedShift(byteArray);
|
|
14030
14062
|
const accountCount = decodeLength(byteArray);
|
|
14031
|
-
const accounts = byteArray
|
|
14032
|
-
byteArray = byteArray.slice(accountCount);
|
|
14063
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
14033
14064
|
const dataLength = decodeLength(byteArray);
|
|
14034
|
-
const dataSlice = byteArray
|
|
14065
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
14035
14066
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
14036
|
-
byteArray = byteArray.slice(dataLength);
|
|
14037
14067
|
instructions.push({
|
|
14038
14068
|
programIdIndex,
|
|
14039
14069
|
accounts,
|
|
@@ -14062,6 +14092,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
14062
14092
|
}
|
|
14063
14093
|
}
|
|
14064
14094
|
|
|
14095
|
+
/**
|
|
14096
|
+
* Transaction signature as base-58 encoded string
|
|
14097
|
+
*/
|
|
14098
|
+
|
|
14065
14099
|
exports.TransactionStatus = void 0;
|
|
14066
14100
|
/**
|
|
14067
14101
|
* Default (empty) signature
|
|
@@ -14741,8 +14775,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
14741
14775
|
let signatures = [];
|
|
14742
14776
|
|
|
14743
14777
|
for (let i = 0; i < signatureCount; i++) {
|
|
14744
|
-
const signature = byteArray
|
|
14745
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
14778
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
|
|
14746
14779
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
14747
14780
|
}
|
|
14748
14781
|
|
|
@@ -20287,7 +20320,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
20287
20320
|
|
|
20288
20321
|
/** @internal */
|
|
20289
20322
|
const COMMON_HTTP_HEADERS = {
|
|
20290
|
-
'solana-client': `js/${(_process$env$npm_pack = "
|
|
20323
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.53.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
20291
20324
|
};
|
|
20292
20325
|
/**
|
|
20293
20326
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -30600,10 +30633,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
30600
30633
|
const configKeys = [];
|
|
30601
30634
|
|
|
30602
30635
|
for (let i = 0; i < 2; i++) {
|
|
30603
|
-
const publicKey = new PublicKey(byteArray
|
|
30604
|
-
|
|
30605
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
30606
|
-
byteArray = byteArray.slice(1);
|
|
30636
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
30637
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
30607
30638
|
configKeys.push({
|
|
30608
30639
|
publicKey,
|
|
30609
30640
|
isSigner
|