@solana/web3.js 1.10.1 → 1.10.2
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 +2 -2
- 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
|
@@ -10794,6 +10794,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
10794
10794
|
}
|
|
10795
10795
|
}
|
|
10796
10796
|
|
|
10797
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
10798
|
+
/**
|
|
10799
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
10800
|
+
*/
|
|
10801
|
+
|
|
10802
|
+
function guardedShift(byteArray) {
|
|
10803
|
+
if (byteArray.length === 0) {
|
|
10804
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
10805
|
+
}
|
|
10806
|
+
|
|
10807
|
+
return byteArray.shift();
|
|
10808
|
+
}
|
|
10809
|
+
/**
|
|
10810
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
10811
|
+
* the array.
|
|
10812
|
+
*/
|
|
10813
|
+
|
|
10814
|
+
function guardedSplice(byteArray, ...args) {
|
|
10815
|
+
var _args$;
|
|
10816
|
+
|
|
10817
|
+
const [start] = args;
|
|
10818
|
+
|
|
10819
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
10820
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
10821
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
10822
|
+
}
|
|
10823
|
+
|
|
10824
|
+
return byteArray.splice(...args);
|
|
10825
|
+
}
|
|
10826
|
+
|
|
10797
10827
|
/**
|
|
10798
10828
|
* The message header, identifying signed and read-only account
|
|
10799
10829
|
*/
|
|
@@ -10870,32 +10900,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
10870
10900
|
static from(buffer$1) {
|
|
10871
10901
|
// Slice up wire data
|
|
10872
10902
|
let byteArray = [...buffer$1];
|
|
10873
|
-
const numRequiredSignatures = byteArray
|
|
10874
|
-
const numReadonlySignedAccounts = byteArray
|
|
10875
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
10903
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
10904
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
10905
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
10876
10906
|
const accountCount = decodeLength(byteArray);
|
|
10877
10907
|
let accountKeys = [];
|
|
10878
10908
|
|
|
10879
10909
|
for (let i = 0; i < accountCount; i++) {
|
|
10880
|
-
const account = byteArray
|
|
10881
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
10910
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
10882
10911
|
accountKeys.push(bs58.encode(buffer.Buffer.from(account)));
|
|
10883
10912
|
}
|
|
10884
10913
|
|
|
10885
|
-
const recentBlockhash = byteArray
|
|
10886
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
10914
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
10887
10915
|
const instructionCount = decodeLength(byteArray);
|
|
10888
10916
|
let instructions = [];
|
|
10889
10917
|
|
|
10890
10918
|
for (let i = 0; i < instructionCount; i++) {
|
|
10891
|
-
const programIdIndex = byteArray
|
|
10919
|
+
const programIdIndex = guardedShift(byteArray);
|
|
10892
10920
|
const accountCount = decodeLength(byteArray);
|
|
10893
|
-
const accounts = byteArray
|
|
10894
|
-
byteArray = byteArray.slice(accountCount);
|
|
10921
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
10895
10922
|
const dataLength = decodeLength(byteArray);
|
|
10896
|
-
const dataSlice = byteArray
|
|
10923
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
10897
10924
|
const data = bs58.encode(buffer.Buffer.from(dataSlice));
|
|
10898
|
-
byteArray = byteArray.slice(dataLength);
|
|
10899
10925
|
instructions.push({
|
|
10900
10926
|
programIdIndex,
|
|
10901
10927
|
accounts,
|
|
@@ -10918,6 +10944,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
10918
10944
|
|
|
10919
10945
|
}
|
|
10920
10946
|
|
|
10947
|
+
/**
|
|
10948
|
+
* Transaction signature as base-58 encoded string
|
|
10949
|
+
*/
|
|
10950
|
+
|
|
10921
10951
|
/**
|
|
10922
10952
|
* Default (empty) signature
|
|
10923
10953
|
*
|
|
@@ -11501,8 +11531,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
11501
11531
|
let signatures = [];
|
|
11502
11532
|
|
|
11503
11533
|
for (let i = 0; i < signatureCount; i++) {
|
|
11504
|
-
const signature = byteArray
|
|
11505
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
11534
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
11506
11535
|
signatures.push(bs58.encode(buffer.Buffer.from(signature)));
|
|
11507
11536
|
}
|
|
11508
11537
|
|
|
@@ -20899,9 +20928,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
20899
20928
|
"minimalistic-assert": "^1.0.1",
|
|
20900
20929
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
20901
20930
|
};
|
|
20902
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
20903
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
20904
|
-
var _from = "elliptic@6.5.4";
|
|
20905
20931
|
var require$$0 = {
|
|
20906
20932
|
name: name,
|
|
20907
20933
|
version: version,
|
|
@@ -20916,10 +20942,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
20916
20942
|
bugs: bugs,
|
|
20917
20943
|
homepage: homepage,
|
|
20918
20944
|
devDependencies: devDependencies,
|
|
20919
|
-
dependencies: dependencies
|
|
20920
|
-
_resolved: _resolved,
|
|
20921
|
-
_integrity: _integrity,
|
|
20922
|
-
_from: _from
|
|
20945
|
+
dependencies: dependencies
|
|
20923
20946
|
};
|
|
20924
20947
|
|
|
20925
20948
|
var utils$m = {};
|
|
@@ -27559,10 +27582,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
27559
27582
|
const configKeys = [];
|
|
27560
27583
|
|
|
27561
27584
|
for (let i = 0; i < 2; i++) {
|
|
27562
|
-
const publicKey = new PublicKey(byteArray
|
|
27563
|
-
|
|
27564
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
27565
|
-
byteArray = byteArray.slice(1);
|
|
27585
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
27586
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
27566
27587
|
configKeys.push({
|
|
27567
27588
|
publicKey,
|
|
27568
27589
|
isSigner
|