@solana/web3.js 1.28.0 → 1.28.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 +46 -25
- 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/package.json +27 -27
- 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
|
@@ -12423,6 +12423,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
12423
12423
|
}
|
|
12424
12424
|
}
|
|
12425
12425
|
|
|
12426
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
12427
|
+
/**
|
|
12428
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
12429
|
+
*/
|
|
12430
|
+
|
|
12431
|
+
function guardedShift(byteArray) {
|
|
12432
|
+
if (byteArray.length === 0) {
|
|
12433
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
12434
|
+
}
|
|
12435
|
+
|
|
12436
|
+
return byteArray.shift();
|
|
12437
|
+
}
|
|
12438
|
+
/**
|
|
12439
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
12440
|
+
* the array.
|
|
12441
|
+
*/
|
|
12442
|
+
|
|
12443
|
+
function guardedSplice(byteArray, ...args) {
|
|
12444
|
+
var _args$;
|
|
12445
|
+
|
|
12446
|
+
const [start] = args;
|
|
12447
|
+
|
|
12448
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
12449
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
12450
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
12451
|
+
}
|
|
12452
|
+
|
|
12453
|
+
return byteArray.splice(...args);
|
|
12454
|
+
}
|
|
12455
|
+
|
|
12426
12456
|
/**
|
|
12427
12457
|
* The message header, identifying signed and read-only account
|
|
12428
12458
|
*/
|
|
@@ -12526,32 +12556,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
12526
12556
|
static from(buffer$1) {
|
|
12527
12557
|
// Slice up wire data
|
|
12528
12558
|
let byteArray = [...buffer$1];
|
|
12529
|
-
const numRequiredSignatures = byteArray
|
|
12530
|
-
const numReadonlySignedAccounts = byteArray
|
|
12531
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
12559
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
12560
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
12561
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
12532
12562
|
const accountCount = decodeLength(byteArray);
|
|
12533
12563
|
let accountKeys = [];
|
|
12534
12564
|
|
|
12535
12565
|
for (let i = 0; i < accountCount; i++) {
|
|
12536
|
-
const account = byteArray
|
|
12537
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12566
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
12538
12567
|
accountKeys.push(bs58$1.encode(buffer.Buffer.from(account)));
|
|
12539
12568
|
}
|
|
12540
12569
|
|
|
12541
|
-
const recentBlockhash = byteArray
|
|
12542
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12570
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
12543
12571
|
const instructionCount = decodeLength(byteArray);
|
|
12544
12572
|
let instructions = [];
|
|
12545
12573
|
|
|
12546
12574
|
for (let i = 0; i < instructionCount; i++) {
|
|
12547
|
-
const programIdIndex = byteArray
|
|
12575
|
+
const programIdIndex = guardedShift(byteArray);
|
|
12548
12576
|
const accountCount = decodeLength(byteArray);
|
|
12549
|
-
const accounts = byteArray
|
|
12550
|
-
byteArray = byteArray.slice(accountCount);
|
|
12577
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
12551
12578
|
const dataLength = decodeLength(byteArray);
|
|
12552
|
-
const dataSlice = byteArray
|
|
12579
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
12553
12580
|
const data = bs58$1.encode(buffer.Buffer.from(dataSlice));
|
|
12554
|
-
byteArray = byteArray.slice(dataLength);
|
|
12555
12581
|
instructions.push({
|
|
12556
12582
|
programIdIndex,
|
|
12557
12583
|
accounts,
|
|
@@ -12580,6 +12606,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
12580
12606
|
}
|
|
12581
12607
|
}
|
|
12582
12608
|
|
|
12609
|
+
/**
|
|
12610
|
+
* Transaction signature as base-58 encoded string
|
|
12611
|
+
*/
|
|
12612
|
+
|
|
12583
12613
|
/**
|
|
12584
12614
|
* Default (empty) signature
|
|
12585
12615
|
*
|
|
@@ -13173,8 +13203,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
13173
13203
|
let signatures = [];
|
|
13174
13204
|
|
|
13175
13205
|
for (let i = 0; i < signatureCount; i++) {
|
|
13176
|
-
const signature = byteArray
|
|
13177
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
13206
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
13178
13207
|
signatures.push(bs58$1.encode(buffer.Buffer.from(signature)));
|
|
13179
13208
|
}
|
|
13180
13209
|
|
|
@@ -22515,9 +22544,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22515
22544
|
"minimalistic-assert": "^1.0.1",
|
|
22516
22545
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
22517
22546
|
};
|
|
22518
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
22519
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
22520
|
-
var _from = "elliptic@6.5.4";
|
|
22521
22547
|
var require$$0 = {
|
|
22522
22548
|
name: name,
|
|
22523
22549
|
version: version,
|
|
@@ -22532,10 +22558,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22532
22558
|
bugs: bugs,
|
|
22533
22559
|
homepage: homepage,
|
|
22534
22560
|
devDependencies: devDependencies,
|
|
22535
|
-
dependencies: dependencies
|
|
22536
|
-
_resolved: _resolved,
|
|
22537
|
-
_integrity: _integrity,
|
|
22538
|
-
_from: _from
|
|
22561
|
+
dependencies: dependencies
|
|
22539
22562
|
};
|
|
22540
22563
|
|
|
22541
22564
|
var utils$m = {};
|
|
@@ -29195,10 +29218,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
29195
29218
|
const configKeys = [];
|
|
29196
29219
|
|
|
29197
29220
|
for (let i = 0; i < 2; i++) {
|
|
29198
|
-
const publicKey = new PublicKey(byteArray
|
|
29199
|
-
|
|
29200
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
29201
|
-
byteArray = byteArray.slice(1);
|
|
29221
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
29222
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
29202
29223
|
configKeys.push({
|
|
29203
29224
|
publicKey,
|
|
29204
29225
|
isSigner
|