@solana/web3.js 1.13.0 → 1.13.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 +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
|
@@ -11880,6 +11880,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
11880
11880
|
}
|
|
11881
11881
|
}
|
|
11882
11882
|
|
|
11883
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
11884
|
+
/**
|
|
11885
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
11886
|
+
*/
|
|
11887
|
+
|
|
11888
|
+
function guardedShift(byteArray) {
|
|
11889
|
+
if (byteArray.length === 0) {
|
|
11890
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
11891
|
+
}
|
|
11892
|
+
|
|
11893
|
+
return byteArray.shift();
|
|
11894
|
+
}
|
|
11895
|
+
/**
|
|
11896
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
11897
|
+
* the array.
|
|
11898
|
+
*/
|
|
11899
|
+
|
|
11900
|
+
function guardedSplice(byteArray, ...args) {
|
|
11901
|
+
var _args$;
|
|
11902
|
+
|
|
11903
|
+
const [start] = args;
|
|
11904
|
+
|
|
11905
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
11906
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
11907
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
11908
|
+
}
|
|
11909
|
+
|
|
11910
|
+
return byteArray.splice(...args);
|
|
11911
|
+
}
|
|
11912
|
+
|
|
11883
11913
|
/**
|
|
11884
11914
|
* The message header, identifying signed and read-only account
|
|
11885
11915
|
*/
|
|
@@ -11956,32 +11986,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
11956
11986
|
static from(buffer$1) {
|
|
11957
11987
|
// Slice up wire data
|
|
11958
11988
|
let byteArray = [...buffer$1];
|
|
11959
|
-
const numRequiredSignatures = byteArray
|
|
11960
|
-
const numReadonlySignedAccounts = byteArray
|
|
11961
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
11989
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
11990
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
11991
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
11962
11992
|
const accountCount = decodeLength(byteArray);
|
|
11963
11993
|
let accountKeys = [];
|
|
11964
11994
|
|
|
11965
11995
|
for (let i = 0; i < accountCount; i++) {
|
|
11966
|
-
const account = byteArray
|
|
11967
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
11996
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
11968
11997
|
accountKeys.push(bs58.encode(buffer.Buffer.from(account)));
|
|
11969
11998
|
}
|
|
11970
11999
|
|
|
11971
|
-
const recentBlockhash = byteArray
|
|
11972
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12000
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
11973
12001
|
const instructionCount = decodeLength(byteArray);
|
|
11974
12002
|
let instructions = [];
|
|
11975
12003
|
|
|
11976
12004
|
for (let i = 0; i < instructionCount; i++) {
|
|
11977
|
-
const programIdIndex = byteArray
|
|
12005
|
+
const programIdIndex = guardedShift(byteArray);
|
|
11978
12006
|
const accountCount = decodeLength(byteArray);
|
|
11979
|
-
const accounts = byteArray
|
|
11980
|
-
byteArray = byteArray.slice(accountCount);
|
|
12007
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
11981
12008
|
const dataLength = decodeLength(byteArray);
|
|
11982
|
-
const dataSlice = byteArray
|
|
12009
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
11983
12010
|
const data = bs58.encode(buffer.Buffer.from(dataSlice));
|
|
11984
|
-
byteArray = byteArray.slice(dataLength);
|
|
11985
12011
|
instructions.push({
|
|
11986
12012
|
programIdIndex,
|
|
11987
12013
|
accounts,
|
|
@@ -12004,6 +12030,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
12004
12030
|
|
|
12005
12031
|
}
|
|
12006
12032
|
|
|
12033
|
+
/**
|
|
12034
|
+
* Transaction signature as base-58 encoded string
|
|
12035
|
+
*/
|
|
12036
|
+
|
|
12007
12037
|
/**
|
|
12008
12038
|
* Default (empty) signature
|
|
12009
12039
|
*
|
|
@@ -12587,8 +12617,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
12587
12617
|
let signatures = [];
|
|
12588
12618
|
|
|
12589
12619
|
for (let i = 0; i < signatureCount; i++) {
|
|
12590
|
-
const signature = byteArray
|
|
12591
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
12620
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
12592
12621
|
signatures.push(bs58.encode(buffer.Buffer.from(signature)));
|
|
12593
12622
|
}
|
|
12594
12623
|
|
|
@@ -21988,9 +22017,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
21988
22017
|
"minimalistic-assert": "^1.0.1",
|
|
21989
22018
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
21990
22019
|
};
|
|
21991
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
21992
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
21993
|
-
var _from = "elliptic@6.5.4";
|
|
21994
22020
|
var require$$0 = {
|
|
21995
22021
|
name: name,
|
|
21996
22022
|
version: version,
|
|
@@ -22005,10 +22031,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22005
22031
|
bugs: bugs,
|
|
22006
22032
|
homepage: homepage,
|
|
22007
22033
|
devDependencies: devDependencies,
|
|
22008
|
-
dependencies: dependencies
|
|
22009
|
-
_resolved: _resolved,
|
|
22010
|
-
_integrity: _integrity,
|
|
22011
|
-
_from: _from
|
|
22034
|
+
dependencies: dependencies
|
|
22012
22035
|
};
|
|
22013
22036
|
|
|
22014
22037
|
var utils$m = {};
|
|
@@ -28648,10 +28671,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28648
28671
|
const configKeys = [];
|
|
28649
28672
|
|
|
28650
28673
|
for (let i = 0; i < 2; i++) {
|
|
28651
|
-
const publicKey = new PublicKey(byteArray
|
|
28652
|
-
|
|
28653
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28654
|
-
byteArray = byteArray.slice(1);
|
|
28674
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28675
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28655
28676
|
configKeys.push({
|
|
28656
28677
|
publicKey,
|
|
28657
28678
|
isSigner
|