@solana/web3.js 1.32.2 → 1.32.3
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 +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 +23 -23
- 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
|
@@ -14023,6 +14023,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
14023
14023
|
}
|
|
14024
14024
|
}
|
|
14025
14025
|
|
|
14026
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
14027
|
+
/**
|
|
14028
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
14029
|
+
*/
|
|
14030
|
+
|
|
14031
|
+
function guardedShift(byteArray) {
|
|
14032
|
+
if (byteArray.length === 0) {
|
|
14033
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14034
|
+
}
|
|
14035
|
+
|
|
14036
|
+
return byteArray.shift();
|
|
14037
|
+
}
|
|
14038
|
+
/**
|
|
14039
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
14040
|
+
* the array.
|
|
14041
|
+
*/
|
|
14042
|
+
|
|
14043
|
+
function guardedSplice(byteArray, ...args) {
|
|
14044
|
+
var _args$;
|
|
14045
|
+
|
|
14046
|
+
const [start] = args;
|
|
14047
|
+
|
|
14048
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
14049
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
14050
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14051
|
+
}
|
|
14052
|
+
|
|
14053
|
+
return byteArray.splice(...args);
|
|
14054
|
+
}
|
|
14055
|
+
|
|
14026
14056
|
/**
|
|
14027
14057
|
* The message header, identifying signed and read-only account
|
|
14028
14058
|
*/
|
|
@@ -14121,32 +14151,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
14121
14151
|
static from(buffer$1) {
|
|
14122
14152
|
// Slice up wire data
|
|
14123
14153
|
let byteArray = [...buffer$1];
|
|
14124
|
-
const numRequiredSignatures = byteArray
|
|
14125
|
-
const numReadonlySignedAccounts = byteArray
|
|
14126
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
14154
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
14155
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
14156
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
14127
14157
|
const accountCount = decodeLength(byteArray);
|
|
14128
14158
|
let accountKeys = [];
|
|
14129
14159
|
|
|
14130
14160
|
for (let i = 0; i < accountCount; i++) {
|
|
14131
|
-
const account = byteArray
|
|
14132
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14161
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14133
14162
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
14134
14163
|
}
|
|
14135
14164
|
|
|
14136
|
-
const recentBlockhash = byteArray
|
|
14137
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14165
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14138
14166
|
const instructionCount = decodeLength(byteArray);
|
|
14139
14167
|
let instructions = [];
|
|
14140
14168
|
|
|
14141
14169
|
for (let i = 0; i < instructionCount; i++) {
|
|
14142
|
-
const programIdIndex = byteArray
|
|
14170
|
+
const programIdIndex = guardedShift(byteArray);
|
|
14143
14171
|
const accountCount = decodeLength(byteArray);
|
|
14144
|
-
const accounts = byteArray
|
|
14145
|
-
byteArray = byteArray.slice(accountCount);
|
|
14172
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
14146
14173
|
const dataLength = decodeLength(byteArray);
|
|
14147
|
-
const dataSlice = byteArray
|
|
14174
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
14148
14175
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
14149
|
-
byteArray = byteArray.slice(dataLength);
|
|
14150
14176
|
instructions.push({
|
|
14151
14177
|
programIdIndex,
|
|
14152
14178
|
accounts,
|
|
@@ -14175,6 +14201,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
14175
14201
|
}
|
|
14176
14202
|
}
|
|
14177
14203
|
|
|
14204
|
+
/**
|
|
14205
|
+
* Transaction signature as base-58 encoded string
|
|
14206
|
+
*/
|
|
14207
|
+
|
|
14178
14208
|
/**
|
|
14179
14209
|
* Default (empty) signature
|
|
14180
14210
|
*
|
|
@@ -14761,8 +14791,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
14761
14791
|
let signatures = [];
|
|
14762
14792
|
|
|
14763
14793
|
for (let i = 0; i < signatureCount; i++) {
|
|
14764
|
-
const signature = byteArray
|
|
14765
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
14794
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
14766
14795
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
14767
14796
|
}
|
|
14768
14797
|
|
|
@@ -28953,10 +28982,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28953
28982
|
const configKeys = [];
|
|
28954
28983
|
|
|
28955
28984
|
for (let i = 0; i < 2; i++) {
|
|
28956
|
-
const publicKey = new PublicKey(byteArray
|
|
28957
|
-
|
|
28958
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28959
|
-
byteArray = byteArray.slice(1);
|
|
28985
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28986
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28960
28987
|
configKeys.push({
|
|
28961
28988
|
publicKey,
|
|
28962
28989
|
isSigner
|