@solana/web3.js 1.34.0 → 1.34.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.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
|
@@ -14030,6 +14030,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
14030
14030
|
}
|
|
14031
14031
|
}
|
|
14032
14032
|
|
|
14033
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
14034
|
+
/**
|
|
14035
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
14036
|
+
*/
|
|
14037
|
+
|
|
14038
|
+
function guardedShift(byteArray) {
|
|
14039
|
+
if (byteArray.length === 0) {
|
|
14040
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14041
|
+
}
|
|
14042
|
+
|
|
14043
|
+
return byteArray.shift();
|
|
14044
|
+
}
|
|
14045
|
+
/**
|
|
14046
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
14047
|
+
* the array.
|
|
14048
|
+
*/
|
|
14049
|
+
|
|
14050
|
+
function guardedSplice(byteArray, ...args) {
|
|
14051
|
+
var _args$;
|
|
14052
|
+
|
|
14053
|
+
const [start] = args;
|
|
14054
|
+
|
|
14055
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
14056
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
14057
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14058
|
+
}
|
|
14059
|
+
|
|
14060
|
+
return byteArray.splice(...args);
|
|
14061
|
+
}
|
|
14062
|
+
|
|
14033
14063
|
/**
|
|
14034
14064
|
* The message header, identifying signed and read-only account
|
|
14035
14065
|
*/
|
|
@@ -14128,32 +14158,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
14128
14158
|
static from(buffer$1) {
|
|
14129
14159
|
// Slice up wire data
|
|
14130
14160
|
let byteArray = [...buffer$1];
|
|
14131
|
-
const numRequiredSignatures = byteArray
|
|
14132
|
-
const numReadonlySignedAccounts = byteArray
|
|
14133
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
14161
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
14162
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
14163
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
14134
14164
|
const accountCount = decodeLength(byteArray);
|
|
14135
14165
|
let accountKeys = [];
|
|
14136
14166
|
|
|
14137
14167
|
for (let i = 0; i < accountCount; i++) {
|
|
14138
|
-
const account = byteArray
|
|
14139
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14168
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14140
14169
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
14141
14170
|
}
|
|
14142
14171
|
|
|
14143
|
-
const recentBlockhash = byteArray
|
|
14144
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14172
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14145
14173
|
const instructionCount = decodeLength(byteArray);
|
|
14146
14174
|
let instructions = [];
|
|
14147
14175
|
|
|
14148
14176
|
for (let i = 0; i < instructionCount; i++) {
|
|
14149
|
-
const programIdIndex = byteArray
|
|
14177
|
+
const programIdIndex = guardedShift(byteArray);
|
|
14150
14178
|
const accountCount = decodeLength(byteArray);
|
|
14151
|
-
const accounts = byteArray
|
|
14152
|
-
byteArray = byteArray.slice(accountCount);
|
|
14179
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
14153
14180
|
const dataLength = decodeLength(byteArray);
|
|
14154
|
-
const dataSlice = byteArray
|
|
14181
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
14155
14182
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
14156
|
-
byteArray = byteArray.slice(dataLength);
|
|
14157
14183
|
instructions.push({
|
|
14158
14184
|
programIdIndex,
|
|
14159
14185
|
accounts,
|
|
@@ -14182,6 +14208,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
14182
14208
|
}
|
|
14183
14209
|
}
|
|
14184
14210
|
|
|
14211
|
+
/**
|
|
14212
|
+
* Transaction signature as base-58 encoded string
|
|
14213
|
+
*/
|
|
14214
|
+
|
|
14185
14215
|
/**
|
|
14186
14216
|
* Default (empty) signature
|
|
14187
14217
|
*
|
|
@@ -14768,8 +14798,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
14768
14798
|
let signatures = [];
|
|
14769
14799
|
|
|
14770
14800
|
for (let i = 0; i < signatureCount; i++) {
|
|
14771
|
-
const signature = byteArray
|
|
14772
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
14801
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
14773
14802
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
14774
14803
|
}
|
|
14775
14804
|
|
|
@@ -28960,10 +28989,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28960
28989
|
const configKeys = [];
|
|
28961
28990
|
|
|
28962
28991
|
for (let i = 0; i < 2; i++) {
|
|
28963
|
-
const publicKey = new PublicKey(byteArray
|
|
28964
|
-
|
|
28965
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28966
|
-
byteArray = byteArray.slice(1);
|
|
28992
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28993
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28967
28994
|
configKeys.push({
|
|
28968
28995
|
publicKey,
|
|
28969
28996
|
isSigner
|