@solana/web3.js 1.17.0 → 1.17.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
|
@@ -11888,6 +11888,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
11888
11888
|
}
|
|
11889
11889
|
}
|
|
11890
11890
|
|
|
11891
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
11892
|
+
/**
|
|
11893
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
11894
|
+
*/
|
|
11895
|
+
|
|
11896
|
+
function guardedShift(byteArray) {
|
|
11897
|
+
if (byteArray.length === 0) {
|
|
11898
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
11899
|
+
}
|
|
11900
|
+
|
|
11901
|
+
return byteArray.shift();
|
|
11902
|
+
}
|
|
11903
|
+
/**
|
|
11904
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
11905
|
+
* the array.
|
|
11906
|
+
*/
|
|
11907
|
+
|
|
11908
|
+
function guardedSplice(byteArray, ...args) {
|
|
11909
|
+
var _args$;
|
|
11910
|
+
|
|
11911
|
+
const [start] = args;
|
|
11912
|
+
|
|
11913
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
11914
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
11915
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
11916
|
+
}
|
|
11917
|
+
|
|
11918
|
+
return byteArray.splice(...args);
|
|
11919
|
+
}
|
|
11920
|
+
|
|
11891
11921
|
/**
|
|
11892
11922
|
* The message header, identifying signed and read-only account
|
|
11893
11923
|
*/
|
|
@@ -11972,32 +12002,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
11972
12002
|
static from(buffer$1) {
|
|
11973
12003
|
// Slice up wire data
|
|
11974
12004
|
let byteArray = [...buffer$1];
|
|
11975
|
-
const numRequiredSignatures = byteArray
|
|
11976
|
-
const numReadonlySignedAccounts = byteArray
|
|
11977
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
12005
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
12006
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
12007
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
11978
12008
|
const accountCount = decodeLength(byteArray);
|
|
11979
12009
|
let accountKeys = [];
|
|
11980
12010
|
|
|
11981
12011
|
for (let i = 0; i < accountCount; i++) {
|
|
11982
|
-
const account = byteArray
|
|
11983
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12012
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
11984
12013
|
accountKeys.push(bs58.encode(buffer.Buffer.from(account)));
|
|
11985
12014
|
}
|
|
11986
12015
|
|
|
11987
|
-
const recentBlockhash = byteArray
|
|
11988
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
12016
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
11989
12017
|
const instructionCount = decodeLength(byteArray);
|
|
11990
12018
|
let instructions = [];
|
|
11991
12019
|
|
|
11992
12020
|
for (let i = 0; i < instructionCount; i++) {
|
|
11993
|
-
const programIdIndex = byteArray
|
|
12021
|
+
const programIdIndex = guardedShift(byteArray);
|
|
11994
12022
|
const accountCount = decodeLength(byteArray);
|
|
11995
|
-
const accounts = byteArray
|
|
11996
|
-
byteArray = byteArray.slice(accountCount);
|
|
12023
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
11997
12024
|
const dataLength = decodeLength(byteArray);
|
|
11998
|
-
const dataSlice = byteArray
|
|
12025
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
11999
12026
|
const data = bs58.encode(buffer.Buffer.from(dataSlice));
|
|
12000
|
-
byteArray = byteArray.slice(dataLength);
|
|
12001
12027
|
instructions.push({
|
|
12002
12028
|
programIdIndex,
|
|
12003
12029
|
accounts,
|
|
@@ -12020,6 +12046,10 @@ var solanaWeb3 = (function (exports) {
|
|
|
12020
12046
|
|
|
12021
12047
|
}
|
|
12022
12048
|
|
|
12049
|
+
/**
|
|
12050
|
+
* Transaction signature as base-58 encoded string
|
|
12051
|
+
*/
|
|
12052
|
+
|
|
12023
12053
|
/**
|
|
12024
12054
|
* Default (empty) signature
|
|
12025
12055
|
*
|
|
@@ -12613,8 +12643,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
12613
12643
|
let signatures = [];
|
|
12614
12644
|
|
|
12615
12645
|
for (let i = 0; i < signatureCount; i++) {
|
|
12616
|
-
const signature = byteArray
|
|
12617
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
12646
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
12618
12647
|
signatures.push(bs58.encode(buffer.Buffer.from(signature)));
|
|
12619
12648
|
}
|
|
12620
12649
|
|
|
@@ -22118,9 +22147,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22118
22147
|
"minimalistic-assert": "^1.0.1",
|
|
22119
22148
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
22120
22149
|
};
|
|
22121
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
22122
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
22123
|
-
var _from = "elliptic@6.5.4";
|
|
22124
22150
|
var require$$0 = {
|
|
22125
22151
|
name: name,
|
|
22126
22152
|
version: version,
|
|
@@ -22135,10 +22161,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22135
22161
|
bugs: bugs,
|
|
22136
22162
|
homepage: homepage,
|
|
22137
22163
|
devDependencies: devDependencies,
|
|
22138
|
-
dependencies: dependencies
|
|
22139
|
-
_resolved: _resolved,
|
|
22140
|
-
_integrity: _integrity,
|
|
22141
|
-
_from: _from
|
|
22164
|
+
dependencies: dependencies
|
|
22142
22165
|
};
|
|
22143
22166
|
|
|
22144
22167
|
var utils$m = {};
|
|
@@ -28782,10 +28805,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28782
28805
|
const configKeys = [];
|
|
28783
28806
|
|
|
28784
28807
|
for (let i = 0; i < 2; i++) {
|
|
28785
|
-
const publicKey = new PublicKey(byteArray
|
|
28786
|
-
|
|
28787
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28788
|
-
byteArray = byteArray.slice(1);
|
|
28808
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28809
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28789
28810
|
configKeys.push({
|
|
28790
28811
|
publicKey,
|
|
28791
28812
|
isSigner
|