@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.
Files changed (81) hide show
  1. package/README.md +10 -55
  2. package/lib/index.browser.esm.js +48 -24
  3. package/lib/index.browser.esm.js.map +1 -1
  4. package/lib/index.cjs.js +101 -56
  5. package/lib/index.cjs.js.map +1 -1
  6. package/lib/index.esm.js +88 -64
  7. package/lib/index.esm.js.map +1 -1
  8. package/lib/index.iife.js +42 -25
  9. package/lib/index.iife.js.map +1 -1
  10. package/lib/index.iife.min.js +2 -2
  11. package/lib/index.iife.min.js.map +1 -1
  12. package/lib/types/index.d.ts.map +1 -1
  13. package/package.json +27 -45
  14. package/src/message.ts +9 -12
  15. package/src/transaction.ts +2 -2
  16. package/src/util/guarded-array-utils.ts +37 -0
  17. package/src/validator-info.ts +5 -4
  18. package/bin/bpf-sdk-install.sh +0 -38
  19. package/bin/localnet.sh +0 -161
  20. package/bpf-sdk/LICENSE +0 -13
  21. package/bpf-sdk/c/README.md +0 -44
  22. package/bpf-sdk/c/bpf.ld +0 -20
  23. package/bpf-sdk/c/bpf.mk +0 -249
  24. package/bpf-sdk/c/inc/deserialize_deprecated.h +0 -115
  25. package/bpf-sdk/c/inc/solana_sdk.h +0 -669
  26. package/bpf-sdk/c/inc/stdio.h +0 -4
  27. package/bpf-sdk/c/inc/stdlib.h +0 -2
  28. package/bpf-sdk/c/inc/string.h +0 -7
  29. package/bpf-sdk/c/inc/sys/param.h +0 -1
  30. package/bpf-sdk/c/inc/wchar.h +0 -1
  31. package/bpf-sdk/env.sh +0 -39
  32. package/bpf-sdk/rust/bpf.ld +0 -20
  33. package/bpf-sdk/rust/build.sh +0 -21
  34. package/bpf-sdk/rust/clean.sh +0 -17
  35. package/bpf-sdk/rust/xargo-build.sh +0 -29
  36. package/bpf-sdk/scripts/dump.sh +0 -45
  37. package/bpf-sdk/scripts/install.sh +0 -178
  38. package/bpf-sdk/scripts/objcopy.sh +0 -6
  39. package/bpf-sdk/scripts/package.sh +0 -19
  40. package/bpf-sdk/scripts/strip.sh +0 -23
  41. package/bpf-sdk/version.txt +0 -2
  42. package/doc/assets/css/main.css +0 -2660
  43. package/doc/assets/images/icons.png +0 -0
  44. package/doc/assets/images/icons@2x.png +0 -0
  45. package/doc/assets/images/widgets.png +0 -0
  46. package/doc/assets/images/widgets@2x.png +0 -0
  47. package/doc/assets/js/main.js +0 -248
  48. package/doc/assets/js/search.js +0 -1
  49. package/doc/classes/account.html +0 -244
  50. package/doc/classes/authorized.html +0 -234
  51. package/doc/classes/bpfloader.html +0 -267
  52. package/doc/classes/connection.html +0 -2354
  53. package/doc/classes/loader.html +0 -275
  54. package/doc/classes/lockup.html +0 -250
  55. package/doc/classes/message.html +0 -326
  56. package/doc/classes/nonceaccount.html +0 -233
  57. package/doc/classes/publickey.html +0 -411
  58. package/doc/classes/secp256k1program.html +0 -308
  59. package/doc/classes/stakeinstruction.html +0 -403
  60. package/doc/classes/stakeprogram.html +0 -503
  61. package/doc/classes/systeminstruction.html +0 -563
  62. package/doc/classes/systemprogram.html +0 -503
  63. package/doc/classes/transaction.html +0 -688
  64. package/doc/classes/transactioninstruction.html +0 -240
  65. package/doc/classes/validatorinfo.html +0 -279
  66. package/doc/classes/voteaccount.html +0 -331
  67. package/doc/index.html +0 -640
  68. package/doc/interfaces/feecalculator.html +0 -166
  69. package/doc/modules.html +0 -4682
  70. package/examples/README.md +0 -10
  71. package/examples/account.html +0 -24
  72. package/examples/account.js +0 -10
  73. package/examples/bpf-c-noop/.gitignore +0 -1
  74. package/examples/bpf-c-noop/makefile +0 -1
  75. package/examples/bpf-c-noop/src/noop/noop.c +0 -19
  76. package/examples/bpf-rust-noop/.gitignore +0 -3
  77. package/examples/bpf-rust-noop/Cargo.toml +0 -23
  78. package/examples/bpf-rust-noop/Xargo.toml +0 -2
  79. package/examples/bpf-rust-noop/src/lib.rs +0 -70
  80. package/examples/get-balance.html +0 -37
  81. 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.shift();
10860
- const numReadonlySignedAccounts = byteArray.shift();
10861
- const numReadonlyUnsignedAccounts = byteArray.shift();
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.slice(0, PUBKEY_LENGTH);
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.slice(0, PUBKEY_LENGTH);
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.shift();
10905
+ const programIdIndex = guardedShift(byteArray);
10878
10906
  const accountCount = decodeLength(byteArray);
10879
- const accounts = byteArray.slice(0, accountCount);
10880
- byteArray = byteArray.slice(accountCount);
10907
+ const accounts = guardedSplice(byteArray, 0, accountCount);
10881
10908
  const dataLength = decodeLength(byteArray);
10882
- const dataSlice = byteArray.slice(0, dataLength);
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.slice(0, SIGNATURE_LENGTH);
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.slice(0, PUBKEY_LENGTH));
26962
- byteArray = byteArray.slice(PUBKEY_LENGTH);
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