@solana/web3.js 1.12.0 → 1.12.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
|
|
|
@@ -21985,9 +22014,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
21985
22014
|
"minimalistic-assert": "^1.0.1",
|
|
21986
22015
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
21987
22016
|
};
|
|
21988
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
21989
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
21990
|
-
var _from = "elliptic@6.5.4";
|
|
21991
22017
|
var require$$0 = {
|
|
21992
22018
|
name: name,
|
|
21993
22019
|
version: version,
|
|
@@ -22002,10 +22028,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22002
22028
|
bugs: bugs,
|
|
22003
22029
|
homepage: homepage,
|
|
22004
22030
|
devDependencies: devDependencies,
|
|
22005
|
-
dependencies: dependencies
|
|
22006
|
-
_resolved: _resolved,
|
|
22007
|
-
_integrity: _integrity,
|
|
22008
|
-
_from: _from
|
|
22031
|
+
dependencies: dependencies
|
|
22009
22032
|
};
|
|
22010
22033
|
|
|
22011
22034
|
var utils$m = {};
|
|
@@ -28645,10 +28668,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28645
28668
|
const configKeys = [];
|
|
28646
28669
|
|
|
28647
28670
|
for (let i = 0; i < 2; i++) {
|
|
28648
|
-
const publicKey = new PublicKey(byteArray
|
|
28649
|
-
|
|
28650
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28651
|
-
byteArray = byteArray.slice(1);
|
|
28671
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28672
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28652
28673
|
configKeys.push({
|
|
28653
28674
|
publicKey,
|
|
28654
28675
|
isSigner
|