@solana/web3.js 1.19.0 → 1.19.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
|
|
|
@@ -22259,9 +22288,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
22259
22288
|
"minimalistic-assert": "^1.0.1",
|
|
22260
22289
|
"minimalistic-crypto-utils": "^1.0.1"
|
|
22261
22290
|
};
|
|
22262
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz";
|
|
22263
|
-
var _integrity = "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==";
|
|
22264
|
-
var _from = "elliptic@6.5.4";
|
|
22265
22291
|
var require$$0 = {
|
|
22266
22292
|
name: name,
|
|
22267
22293
|
version: version,
|
|
@@ -22276,10 +22302,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
22276
22302
|
bugs: bugs,
|
|
22277
22303
|
homepage: homepage,
|
|
22278
22304
|
devDependencies: devDependencies,
|
|
22279
|
-
dependencies: dependencies
|
|
22280
|
-
_resolved: _resolved,
|
|
22281
|
-
_integrity: _integrity,
|
|
22282
|
-
_from: _from
|
|
22305
|
+
dependencies: dependencies
|
|
22283
22306
|
};
|
|
22284
22307
|
|
|
22285
22308
|
var utils$m = {};
|
|
@@ -28923,10 +28946,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
28923
28946
|
const configKeys = [];
|
|
28924
28947
|
|
|
28925
28948
|
for (let i = 0; i < 2; i++) {
|
|
28926
|
-
const publicKey = new PublicKey(byteArray
|
|
28927
|
-
|
|
28928
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
28929
|
-
byteArray = byteArray.slice(1);
|
|
28949
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
28950
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
28930
28951
|
configKeys.push({
|
|
28931
28952
|
publicKey,
|
|
28932
28953
|
isSigner
|