@solana/web3.js 1.18.0 → 1.18.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
|
|
|
@@ -22226,9 +22255,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22226
22255
|
"minimalistic-assert": "^1.0.1",
|
|
22227
22256
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
22228
22257
|
};
|
|
22229
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
22230
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
22231
|
-
var _from = "elliptic@6.5.4";
|
|
22232
22258
|
var require$$0 = {
|
|
22233
22259
|
name: name,
|
|
22234
22260
|
version: version,
|
|
@@ -22243,10 +22269,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22243
22269
|
bugs: bugs,
|
|
22244
22270
|
homepage: homepage,
|
|
22245
22271
|
devDependencies: devDependencies,
|
|
22246
|
-
dependencies: dependencies
|
|
22247
|
-
_resolved: _resolved,
|
|
22248
|
-
_integrity: _integrity,
|
|
22249
|
-
_from: _from
|
|
22272
|
+
dependencies: dependencies
|
|
22250
22273
|
};
|
|
22251
22274
|
|
|
22252
22275
|
var utils$m = {};
|
|
@@ -28890,10 +28913,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28890
28913
|
const configKeys = [];
|
|
28891
28914
|
|
|
28892
28915
|
for (let i = 0; i < 2; i++) {
|
|
28893
|
-
const publicKey = new PublicKey(byteArray
|
|
28894
|
-
|
|
28895
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28896
|
-
byteArray = byteArray.slice(1);
|
|
28916
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28917
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28897
28918
|
configKeys.push({
|
|
28898
28919
|
publicKey,
|
|
28899
28920
|
isSigner
|