@solana/web3.js 1.51.0 → 1.51.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 +46 -19
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +46 -19
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +46 -19
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +46 -19
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +46 -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 +46 -19
- package/lib/index.native.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
|
@@ -14083,6 +14083,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
14083
14083
|
}
|
|
14084
14084
|
}
|
|
14085
14085
|
|
|
14086
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
14087
|
+
/**
|
|
14088
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
14089
|
+
*/
|
|
14090
|
+
|
|
14091
|
+
function guardedShift(byteArray) {
|
|
14092
|
+
if (byteArray.length === 0) {
|
|
14093
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14094
|
+
}
|
|
14095
|
+
|
|
14096
|
+
return byteArray.shift();
|
|
14097
|
+
}
|
|
14098
|
+
/**
|
|
14099
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
14100
|
+
* the array.
|
|
14101
|
+
*/
|
|
14102
|
+
|
|
14103
|
+
function guardedSplice(byteArray, ...args) {
|
|
14104
|
+
var _args$;
|
|
14105
|
+
|
|
14106
|
+
const [start] = args;
|
|
14107
|
+
|
|
14108
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
14109
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
14110
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
14111
|
+
}
|
|
14112
|
+
|
|
14113
|
+
return byteArray.splice(...args);
|
|
14114
|
+
}
|
|
14115
|
+
|
|
14086
14116
|
/**
|
|
14087
14117
|
* The message header, identifying signed and read-only account
|
|
14088
14118
|
*/
|
|
@@ -14181,32 +14211,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
14181
14211
|
static from(buffer$1) {
|
|
14182
14212
|
// Slice up wire data
|
|
14183
14213
|
let byteArray = [...buffer$1];
|
|
14184
|
-
const numRequiredSignatures = byteArray
|
|
14185
|
-
const numReadonlySignedAccounts = byteArray
|
|
14186
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
14214
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
14215
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
14216
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
14187
14217
|
const accountCount = decodeLength(byteArray);
|
|
14188
14218
|
let accountKeys = [];
|
|
14189
14219
|
|
|
14190
14220
|
for (let i = 0; i < accountCount; i++) {
|
|
14191
|
-
const account = byteArray
|
|
14192
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14221
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14193
14222
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
14194
14223
|
}
|
|
14195
14224
|
|
|
14196
|
-
const recentBlockhash = byteArray
|
|
14197
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
14225
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
14198
14226
|
const instructionCount = decodeLength(byteArray);
|
|
14199
14227
|
let instructions = [];
|
|
14200
14228
|
|
|
14201
14229
|
for (let i = 0; i < instructionCount; i++) {
|
|
14202
|
-
const programIdIndex = byteArray
|
|
14230
|
+
const programIdIndex = guardedShift(byteArray);
|
|
14203
14231
|
const accountCount = decodeLength(byteArray);
|
|
14204
|
-
const accounts = byteArray
|
|
14205
|
-
byteArray = byteArray.slice(accountCount);
|
|
14232
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
14206
14233
|
const dataLength = decodeLength(byteArray);
|
|
14207
|
-
const dataSlice = byteArray
|
|
14234
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
14208
14235
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
14209
|
-
byteArray = byteArray.slice(dataLength);
|
|
14210
14236
|
instructions.push({
|
|
14211
14237
|
programIdIndex,
|
|
14212
14238
|
accounts,
|
|
@@ -14235,6 +14261,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
14235
14261
|
}
|
|
14236
14262
|
}
|
|
14237
14263
|
|
|
14264
|
+
/**
|
|
14265
|
+
* Transaction signature as base-58 encoded string
|
|
14266
|
+
*/
|
|
14267
|
+
|
|
14238
14268
|
exports.TransactionStatus = void 0;
|
|
14239
14269
|
/**
|
|
14240
14270
|
* Default (empty) signature
|
|
@@ -14914,8 +14944,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
14914
14944
|
let signatures = [];
|
|
14915
14945
|
|
|
14916
14946
|
for (let i = 0; i < signatureCount; i++) {
|
|
14917
|
-
const signature = byteArray
|
|
14918
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH_IN_BYTES);
|
|
14947
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH_IN_BYTES);
|
|
14919
14948
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
14920
14949
|
}
|
|
14921
14950
|
|
|
@@ -20680,7 +20709,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
20680
20709
|
|
|
20681
20710
|
/** @internal */
|
|
20682
20711
|
const COMMON_HTTP_HEADERS = {
|
|
20683
|
-
'solana-client': `js/${(_process$env$npm_pack = "
|
|
20712
|
+
'solana-client': `js/${(_process$env$npm_pack = "1.51.1") !== null && _process$env$npm_pack !== void 0 ? _process$env$npm_pack : 'UNKNOWN'}`
|
|
20684
20713
|
};
|
|
20685
20714
|
/**
|
|
20686
20715
|
* A connection to a fullnode JSON RPC endpoint
|
|
@@ -30197,10 +30226,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
30197
30226
|
const configKeys = [];
|
|
30198
30227
|
|
|
30199
30228
|
for (let i = 0; i < 2; i++) {
|
|
30200
|
-
const publicKey = new PublicKey(byteArray
|
|
30201
|
-
|
|
30202
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
30203
|
-
byteArray = byteArray.slice(1);
|
|
30229
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
30230
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
30204
30231
|
configKeys.push({
|
|
30205
30232
|
publicKey,
|
|
30206
30233
|
isSigner
|