@solana/web3.js 0.98.0 → 1.0.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/README.md +10 -55
- package/lib/index.browser.esm.js +48 -24
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +101 -56
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.esm.js +88 -64
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +42 -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/lib/types/index.d.ts.map +1 -1
- package/package.json +27 -45
- 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/bin/bpf-sdk-install.sh +0 -38
- package/bin/localnet.sh +0 -161
- package/bpf-sdk/LICENSE +0 -13
- package/bpf-sdk/c/README.md +0 -44
- package/bpf-sdk/c/bpf.ld +0 -20
- package/bpf-sdk/c/bpf.mk +0 -249
- package/bpf-sdk/c/inc/deserialize_deprecated.h +0 -115
- package/bpf-sdk/c/inc/solana_sdk.h +0 -669
- package/bpf-sdk/c/inc/stdio.h +0 -4
- package/bpf-sdk/c/inc/stdlib.h +0 -2
- package/bpf-sdk/c/inc/string.h +0 -7
- package/bpf-sdk/c/inc/sys/param.h +0 -1
- package/bpf-sdk/c/inc/wchar.h +0 -1
- package/bpf-sdk/env.sh +0 -39
- package/bpf-sdk/rust/bpf.ld +0 -20
- package/bpf-sdk/rust/build.sh +0 -21
- package/bpf-sdk/rust/clean.sh +0 -17
- package/bpf-sdk/rust/xargo-build.sh +0 -29
- package/bpf-sdk/scripts/dump.sh +0 -45
- package/bpf-sdk/scripts/install.sh +0 -178
- package/bpf-sdk/scripts/objcopy.sh +0 -6
- package/bpf-sdk/scripts/package.sh +0 -19
- package/bpf-sdk/scripts/strip.sh +0 -23
- package/bpf-sdk/version.txt +0 -2
- package/doc/assets/css/main.css +0 -2660
- package/doc/assets/images/icons.png +0 -0
- package/doc/assets/images/icons@2x.png +0 -0
- package/doc/assets/images/widgets.png +0 -0
- package/doc/assets/images/widgets@2x.png +0 -0
- package/doc/assets/js/main.js +0 -248
- package/doc/assets/js/search.js +0 -1
- package/doc/classes/account.html +0 -244
- package/doc/classes/authorized.html +0 -234
- package/doc/classes/bpfloader.html +0 -267
- package/doc/classes/connection.html +0 -2354
- package/doc/classes/loader.html +0 -275
- package/doc/classes/lockup.html +0 -250
- package/doc/classes/message.html +0 -326
- package/doc/classes/nonceaccount.html +0 -233
- package/doc/classes/publickey.html +0 -411
- package/doc/classes/secp256k1program.html +0 -308
- package/doc/classes/stakeinstruction.html +0 -403
- package/doc/classes/stakeprogram.html +0 -503
- package/doc/classes/systeminstruction.html +0 -563
- package/doc/classes/systemprogram.html +0 -503
- package/doc/classes/transaction.html +0 -688
- package/doc/classes/transactioninstruction.html +0 -240
- package/doc/classes/validatorinfo.html +0 -279
- package/doc/classes/voteaccount.html +0 -331
- package/doc/index.html +0 -640
- package/doc/interfaces/feecalculator.html +0 -166
- package/doc/modules.html +0 -4682
- package/examples/README.md +0 -10
- package/examples/account.html +0 -24
- package/examples/account.js +0 -10
- package/examples/bpf-c-noop/.gitignore +0 -1
- package/examples/bpf-c-noop/makefile +0 -1
- package/examples/bpf-c-noop/src/noop/noop.c +0 -19
- package/examples/bpf-rust-noop/.gitignore +0 -3
- package/examples/bpf-rust-noop/Cargo.toml +0 -23
- package/examples/bpf-rust-noop/Xargo.toml +0 -2
- package/examples/bpf-rust-noop/src/lib.rs +0 -70
- package/examples/get-balance.html +0 -37
- package/examples/get-balance.js +0 -18
package/lib/index.iife.js
CHANGED
|
@@ -10766,6 +10766,36 @@ var solanaWeb3 = (function (exports) {
|
|
|
10766
10766
|
}
|
|
10767
10767
|
}
|
|
10768
10768
|
|
|
10769
|
+
const END_OF_BUFFER_ERROR_MESSAGE = 'Reached end of buffer unexpectedly';
|
|
10770
|
+
/**
|
|
10771
|
+
* Delegates to `Array#shift`, but throws if the array is zero-length.
|
|
10772
|
+
*/
|
|
10773
|
+
|
|
10774
|
+
function guardedShift(byteArray) {
|
|
10775
|
+
if (byteArray.length === 0) {
|
|
10776
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
10777
|
+
}
|
|
10778
|
+
|
|
10779
|
+
return byteArray.shift();
|
|
10780
|
+
}
|
|
10781
|
+
/**
|
|
10782
|
+
* Delegates to `Array#splice`, but throws if the section being spliced out extends past the end of
|
|
10783
|
+
* the array.
|
|
10784
|
+
*/
|
|
10785
|
+
|
|
10786
|
+
function guardedSplice(byteArray, ...args) {
|
|
10787
|
+
var _args$;
|
|
10788
|
+
|
|
10789
|
+
const [start] = args;
|
|
10790
|
+
|
|
10791
|
+
if (args.length === 2 // Implies that `deleteCount` was supplied
|
|
10792
|
+
? start + ((_args$ = args[1]) !== null && _args$ !== void 0 ? _args$ : 0) > byteArray.length : start >= byteArray.length) {
|
|
10793
|
+
throw new Error(END_OF_BUFFER_ERROR_MESSAGE);
|
|
10794
|
+
}
|
|
10795
|
+
|
|
10796
|
+
return byteArray.splice(...args);
|
|
10797
|
+
}
|
|
10798
|
+
|
|
10769
10799
|
/**
|
|
10770
10800
|
* The message header, identifying signed and read-only account
|
|
10771
10801
|
*
|
|
@@ -10856,32 +10886,28 @@ var solanaWeb3 = (function (exports) {
|
|
|
10856
10886
|
static from(buffer$1) {
|
|
10857
10887
|
// Slice up wire data
|
|
10858
10888
|
let byteArray = [...buffer$1];
|
|
10859
|
-
const numRequiredSignatures = byteArray
|
|
10860
|
-
const numReadonlySignedAccounts = byteArray
|
|
10861
|
-
const numReadonlyUnsignedAccounts = byteArray
|
|
10889
|
+
const numRequiredSignatures = guardedShift(byteArray);
|
|
10890
|
+
const numReadonlySignedAccounts = guardedShift(byteArray);
|
|
10891
|
+
const numReadonlyUnsignedAccounts = guardedShift(byteArray);
|
|
10862
10892
|
const accountCount = decodeLength(byteArray);
|
|
10863
10893
|
let accountKeys = [];
|
|
10864
10894
|
|
|
10865
10895
|
for (let i = 0; i < accountCount; i++) {
|
|
10866
|
-
const account = byteArray
|
|
10867
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
10896
|
+
const account = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
10868
10897
|
accountKeys.push(bs58.encode(buffer.Buffer.from(account)));
|
|
10869
10898
|
}
|
|
10870
10899
|
|
|
10871
|
-
const recentBlockhash = byteArray
|
|
10872
|
-
byteArray = byteArray.slice(PUBKEY_LENGTH);
|
|
10900
|
+
const recentBlockhash = guardedSplice(byteArray, 0, PUBKEY_LENGTH);
|
|
10873
10901
|
const instructionCount = decodeLength(byteArray);
|
|
10874
10902
|
let instructions = [];
|
|
10875
10903
|
|
|
10876
10904
|
for (let i = 0; i < instructionCount; i++) {
|
|
10877
|
-
const programIdIndex = byteArray
|
|
10905
|
+
const programIdIndex = guardedShift(byteArray);
|
|
10878
10906
|
const accountCount = decodeLength(byteArray);
|
|
10879
|
-
const accounts = byteArray
|
|
10880
|
-
byteArray = byteArray.slice(accountCount);
|
|
10907
|
+
const accounts = guardedSplice(byteArray, 0, accountCount);
|
|
10881
10908
|
const dataLength = decodeLength(byteArray);
|
|
10882
|
-
const dataSlice = byteArray
|
|
10909
|
+
const dataSlice = guardedSplice(byteArray, 0, dataLength);
|
|
10883
10910
|
const data = bs58.encode(buffer.Buffer.from(dataSlice));
|
|
10884
|
-
byteArray = byteArray.slice(dataLength);
|
|
10885
10911
|
instructions.push({
|
|
10886
10912
|
programIdIndex,
|
|
10887
10913
|
accounts,
|
|
@@ -11506,8 +11532,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
11506
11532
|
let signatures = [];
|
|
11507
11533
|
|
|
11508
11534
|
for (let i = 0; i < signatureCount; i++) {
|
|
11509
|
-
const signature = byteArray
|
|
11510
|
-
byteArray = byteArray.slice(SIGNATURE_LENGTH);
|
|
11535
|
+
const signature = guardedSplice(byteArray, 0, SIGNATURE_LENGTH);
|
|
11511
11536
|
signatures.push(bs58.encode(buffer.Buffer.from(signature)));
|
|
11512
11537
|
}
|
|
11513
11538
|
|
|
@@ -20386,9 +20411,6 @@ var solanaWeb3 = (function (exports) {
|
|
|
20386
20411
|
"minimalistic-assert": "^1.0.0",
|
|
20387
20412
|
"minimalistic-crypto-utils": "^1.0.0"
|
|
20388
20413
|
};
|
|
20389
|
-
var _resolved = "https://registry.npmjs.org/elliptic/-/elliptic-6.5.3.tgz";
|
|
20390
|
-
var _integrity = "sha512-IMqzv5wNQf+E6aHeIqATs0tOLeOTwj1QKbRcS3jBbYkl5oLAserA8yJTT7/VyHUYG91PRmPyeQDObKLPpeS4dw==";
|
|
20391
|
-
var _from = "elliptic@6.5.3";
|
|
20392
20414
|
var require$$0 = {
|
|
20393
20415
|
name: name,
|
|
20394
20416
|
version: version,
|
|
@@ -20403,10 +20425,7 @@ var solanaWeb3 = (function (exports) {
|
|
|
20403
20425
|
bugs: bugs,
|
|
20404
20426
|
homepage: homepage,
|
|
20405
20427
|
devDependencies: devDependencies,
|
|
20406
|
-
dependencies: dependencies
|
|
20407
|
-
_resolved: _resolved,
|
|
20408
|
-
_integrity: _integrity,
|
|
20409
|
-
_from: _from
|
|
20428
|
+
dependencies: dependencies
|
|
20410
20429
|
};
|
|
20411
20430
|
|
|
20412
20431
|
var minimalisticAssert = assert$9;
|
|
@@ -26958,10 +26977,8 @@ var solanaWeb3 = (function (exports) {
|
|
|
26958
26977
|
const configKeys = [];
|
|
26959
26978
|
|
|
26960
26979
|
for (let i = 0; i < 2; i++) {
|
|
26961
|
-
const publicKey = new PublicKey(byteArray
|
|
26962
|
-
|
|
26963
|
-
const isSigner = byteArray.slice(0, 1)[0] === 1;
|
|
26964
|
-
byteArray = byteArray.slice(1);
|
|
26980
|
+
const publicKey = new PublicKey(guardedSplice(byteArray, 0, PUBKEY_LENGTH));
|
|
26981
|
+
const isSigner = guardedShift(byteArray) === 1;
|
|
26965
26982
|
configKeys.push({
|
|
26966
26983
|
publicKey,
|
|
26967
26984
|
isSigner
|