@solana/web3.js 1.30.2 → 1.32.2

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/module.flow.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Flowtype definitions for index
3
3
  * Generated by Flowgen from a Typescript Definition
4
- * Flowgen v1.15.0
4
+ * Flowgen v1.16.0
5
5
  */
6
6
 
7
7
  declare module "@solana/web3.js" {
@@ -64,6 +64,7 @@ declare module "@solana/web3.js" {
64
64
  * Return the base-58 representation of the public key
65
65
  */
66
66
  toBase58(): string;
67
+ toJSON(): string;
67
68
 
68
69
  /**
69
70
  * Return the byte array representation of the public key
@@ -663,6 +664,11 @@ declare module "@solana/web3.js" {
663
664
  * preflight commitment level
664
665
  */
665
666
  preflightCommitment?: Commitment,
667
+
668
+ /**
669
+ * Maximum number of times for the RPC node to retry sending the transaction to the leader.
670
+ */
671
+ maxRetries?: number,
666
672
  ...
667
673
  };
668
674
 
@@ -684,6 +690,11 @@ declare module "@solana/web3.js" {
684
690
  * preflight commitment level
685
691
  */
686
692
  preflightCommitment?: Commitment,
693
+
694
+ /**
695
+ * Maximum number of times for the RPC node to retry sending the transaction to the leader.
696
+ */
697
+ maxRetries?: number,
687
698
  ...
688
699
  };
689
700
 
@@ -1028,14 +1039,21 @@ declare module "@solana/web3.js" {
1028
1039
  declare export type TokenBalance = {
1029
1040
  accountIndex: number,
1030
1041
  mint: string,
1042
+ owner?: string,
1031
1043
  uiTokenAmount: TokenAmount,
1032
1044
  ...
1033
1045
  };
1034
1046
 
1035
1047
  /**
1036
1048
  * Metadata for a parsed confirmed transaction on the ledger
1049
+ * @deprecated [object Object],[object Object],[object Object]
1050
+ */
1051
+ declare export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;
1052
+
1053
+ /**
1054
+ * Metadata for a parsed transaction on the ledger
1037
1055
  */
1038
- declare export type ParsedConfirmedTransactionMeta = {
1056
+ declare export type ParsedTransactionMeta = {
1039
1057
  /**
1040
1058
  * The fee charged for processing the transaction
1041
1059
  */
@@ -1294,8 +1312,14 @@ declare module "@solana/web3.js" {
1294
1312
 
1295
1313
  /**
1296
1314
  * A parsed and confirmed transaction on the ledger
1315
+ * @deprecated [object Object],[object Object],[object Object]
1297
1316
  */
1298
- declare export type ParsedConfirmedTransaction = {
1317
+ declare export type ParsedConfirmedTransaction = ParsedTransactionWithMeta;
1318
+
1319
+ /**
1320
+ * A parsed transaction on the ledger with meta
1321
+ */
1322
+ declare export type ParsedTransactionWithMeta = {
1299
1323
  /**
1300
1324
  * The slot during which the transaction was processed
1301
1325
  */
@@ -1309,7 +1333,7 @@ declare module "@solana/web3.js" {
1309
1333
  /**
1310
1334
  * Metadata produced from the transaction
1311
1335
  */
1312
- meta: ParsedConfirmedTransactionMeta | null,
1336
+ meta: ParsedTransactionMeta | null,
1313
1337
 
1314
1338
  /**
1315
1339
  * The unix timestamp of when the transaction was processed
@@ -1444,9 +1468,9 @@ declare module "@solana/web3.js" {
1444
1468
  };
1445
1469
 
1446
1470
  /**
1447
- * A ConfirmedBlock on the ledger with signatures only
1471
+ * A Block on the ledger with signatures only
1448
1472
  */
1449
- declare export type ConfirmedBlockSignatures = {
1473
+ declare export type BlockSignatures = {
1450
1474
  /**
1451
1475
  * Blockhash of this block
1452
1476
  */
@@ -1817,6 +1841,22 @@ declare module "@solana/web3.js" {
1817
1841
  ...
1818
1842
  };
1819
1843
 
1844
+ /**
1845
+ * Configuration object for getMultipleAccounts
1846
+ */
1847
+ declare export type GetMultipleAccountsConfig = {
1848
+ /**
1849
+ * Optional commitment level
1850
+ */
1851
+ commitment?: Commitment,
1852
+
1853
+ /**
1854
+ * Optional encoding for account data (default base64)
1855
+ */
1856
+ encoding?: "base64" | "jsonParsed",
1857
+ ...
1858
+ };
1859
+
1820
1860
  /**
1821
1861
  * Information describing an account
1822
1862
  */
@@ -1842,7 +1882,7 @@ declare module "@solana/web3.js" {
1842
1882
  data: T,
1843
1883
 
1844
1884
  /**
1845
- * Optional rent epoch infor for account
1885
+ * Optional rent epoch info for account
1846
1886
  */
1847
1887
  rentEpoch?: number,
1848
1888
  ...
@@ -2047,7 +2087,7 @@ declare module "@solana/web3.js" {
2047
2087
  declare export type FetchMiddleware = (
2048
2088
  url: string,
2049
2089
  options: any,
2050
- fetch: Function
2090
+ fetch: (modifiedUrl: string, modifiedOptions: any) => void
2051
2091
  ) => void;
2052
2092
 
2053
2093
  /**
@@ -2246,8 +2286,8 @@ account: AccountInfo<ParsedAccountData>,...
2246
2286
  */
2247
2287
  getMultipleAccountsInfo(
2248
2288
  publicKeys: PublicKey[],
2249
- commitment?: Commitment
2250
- ): Promise<(AccountInfo<Buffer> | null)[]>;
2289
+ configOrCommitment?: GetMultipleAccountsConfig | Commitment
2290
+ ): Promise<(AccountInfo<Buffer | ParsedAccountData> | null)[]>;
2251
2291
 
2252
2292
  /**
2253
2293
  * Returns epoch activation information for a stake account that has been delegated
@@ -2401,6 +2441,7 @@ account: AccountInfo<Buffer | ParsedAccountData>,...
2401
2441
  blockhash: Blockhash,
2402
2442
  feeCalculator: FeeCalculator,...
2403
2443
  }>>}
2444
+ * @deprecated [object Object],[object Object],[object Object]
2404
2445
  */
2405
2446
  getRecentBlockhashAndContext(commitment?: Commitment): Promise<
2406
2447
  RpcResponseAndContext<{
@@ -2418,18 +2459,28 @@ feeCalculator: FeeCalculator,...
2418
2459
 
2419
2460
  /**
2420
2461
  * Fetch the fee calculator for a recent blockhash from the cluster, return with context
2462
+ * @deprecated [object Object],[object Object],[object Object]
2421
2463
  */
2422
2464
  getFeeCalculatorForBlockhash(
2423
2465
  blockhash: Blockhash,
2424
2466
  commitment?: Commitment
2425
2467
  ): Promise<RpcResponseAndContext<FeeCalculator | null>>;
2426
2468
 
2469
+ /**
2470
+ * Fetch the fee for a message from the cluster, return with context
2471
+ */
2472
+ getFeeForMessage(
2473
+ message: Message,
2474
+ commitment?: Commitment
2475
+ ): Promise<RpcResponseAndContext<number>>;
2476
+
2427
2477
  /**
2428
2478
  * Fetch a recent blockhash from the cluster
2429
2479
  * @return {Promise<{
2430
2480
  blockhash: Blockhash,
2431
2481
  feeCalculator: FeeCalculator,...
2432
2482
  }>}
2483
+ * @deprecated [object Object],[object Object],[object Object]
2433
2484
  */
2434
2485
  getRecentBlockhash(commitment?: Commitment): Promise<{
2435
2486
  blockhash: Blockhash,
@@ -2437,6 +2488,34 @@ feeCalculator: FeeCalculator,...
2437
2488
  ...
2438
2489
  }>;
2439
2490
 
2491
+ /**
2492
+ * Fetch the latest blockhash from the cluster
2493
+ * @return {Promise<{
2494
+ blockhash: Blockhash,
2495
+ lastValidBlockHeight: number,...
2496
+ }>}
2497
+ */
2498
+ getLatestBlockhash(commitment?: Commitment): Promise<{
2499
+ blockhash: Blockhash,
2500
+ lastValidBlockHeight: number,
2501
+ ...
2502
+ }>;
2503
+
2504
+ /**
2505
+ * Fetch the latest blockhash from the cluster
2506
+ * @return {Promise<{
2507
+ blockhash: Blockhash,
2508
+ lastValidBlockHeight: number,...
2509
+ }>}
2510
+ */
2511
+ getLatestBlockhashAndContext(commitment?: Commitment): Promise<
2512
+ RpcResponseAndContext<{
2513
+ blockhash: Blockhash,
2514
+ lastValidBlockHeight: number,
2515
+ ...
2516
+ }>
2517
+ >;
2518
+
2440
2519
  /**
2441
2520
  * Fetch the node version
2442
2521
  */
@@ -2459,7 +2538,7 @@ feeCalculator: FeeCalculator,...
2459
2538
  ): Promise<BlockResponse | null>;
2460
2539
 
2461
2540
  /**
2462
- * Fetch a processed transaction from the cluster.
2541
+ * Fetch a confirmed or finalized transaction from the cluster.
2463
2542
  */
2464
2543
  getTransaction(
2465
2544
  signature: string,
@@ -2469,6 +2548,22 @@ feeCalculator: FeeCalculator,...
2469
2548
  }
2470
2549
  ): Promise<TransactionResponse | null>;
2471
2550
 
2551
+ /**
2552
+ * Fetch parsed transaction details for a confirmed or finalized transaction
2553
+ */
2554
+ getParsedTransaction(
2555
+ signature: TransactionSignature,
2556
+ commitment?: Finality
2557
+ ): Promise<ParsedConfirmedTransaction | null>;
2558
+
2559
+ /**
2560
+ * Fetch parsed transaction details for a batch of confirmed transactions
2561
+ */
2562
+ getParsedTransactions(
2563
+ signatures: TransactionSignature[],
2564
+ commitment?: Finality
2565
+ ): Promise<(ParsedConfirmedTransaction | null)[]>;
2566
+
2472
2567
  /**
2473
2568
  * Fetch a list of Transactions and transaction statuses from the cluster
2474
2569
  * for a confirmed block.
@@ -2488,16 +2583,26 @@ feeCalculator: FeeCalculator,...
2488
2583
  commitment?: Finality
2489
2584
  ): Promise<Array<number>>;
2490
2585
 
2586
+ /**
2587
+ * Fetch a list of Signatures from the cluster for a block, excluding rewards
2588
+ */
2589
+ getBlockSignatures(
2590
+ slot: number,
2591
+ commitment?: Finality
2592
+ ): Promise<BlockSignatures>;
2593
+
2491
2594
  /**
2492
2595
  * Fetch a list of Signatures from the cluster for a confirmed block, excluding rewards
2596
+ * @deprecated [object Object],[object Object],[object Object]
2493
2597
  */
2494
2598
  getConfirmedBlockSignatures(
2495
2599
  slot: number,
2496
2600
  commitment?: Finality
2497
- ): Promise<ConfirmedBlockSignatures>;
2601
+ ): Promise<BlockSignatures>;
2498
2602
 
2499
2603
  /**
2500
2604
  * Fetch a transaction details for a confirmed transaction
2605
+ * @deprecated [object Object],[object Object],[object Object]
2501
2606
  */
2502
2607
  getConfirmedTransaction(
2503
2608
  signature: TransactionSignature,
@@ -2506,6 +2611,7 @@ feeCalculator: FeeCalculator,...
2506
2611
 
2507
2612
  /**
2508
2613
  * Fetch parsed transaction details for a confirmed transaction
2614
+ * @deprecated [object Object],[object Object],[object Object]
2509
2615
  */
2510
2616
  getParsedConfirmedTransaction(
2511
2617
  signature: TransactionSignature,
@@ -2514,6 +2620,7 @@ feeCalculator: FeeCalculator,...
2514
2620
 
2515
2621
  /**
2516
2622
  * Fetch parsed transaction details for a batch of confirmed transactions
2623
+ * @deprecated [object Object],[object Object],[object Object]
2517
2624
  */
2518
2625
  getParsedConfirmedTransactions(
2519
2626
  signatures: TransactionSignature[],
@@ -3935,21 +4042,36 @@ feeCalculator: FeeCalculator,...
3935
4042
  prevCredits: number,
3936
4043
  ...
3937
4044
  };
4045
+ declare export type AuthorizedVoter = {
4046
+ epoch: number,
4047
+ authorizedVoter: PublicKey,
4048
+ ...
4049
+ };
4050
+ declare export type PriorVoter = {
4051
+ authorizedPubkey: PublicKey,
4052
+ epochOfLastAuthorizedSwitch: number,
4053
+ targetEpoch: number,
4054
+ ...
4055
+ };
4056
+ declare export type BlockTimestamp = {
4057
+ slot: number,
4058
+ timetamp: number,
4059
+ ...
4060
+ };
3938
4061
 
3939
4062
  /**
3940
4063
  * VoteAccount class
3941
4064
  */
3942
4065
  declare export class VoteAccount {
3943
4066
  nodePubkey: PublicKey;
3944
- authorizedVoterPubkey: PublicKey;
3945
- authorizedWithdrawerPubkey: PublicKey;
4067
+ authorizedWithdrawer: PublicKey;
3946
4068
  commission: number;
3947
- votes: Array<Lockout>;
3948
4069
  rootSlot: number | null;
3949
- epoch: number;
3950
- credits: number;
3951
- lastEpochCredits: number;
3952
- epochCredits: Array<EpochCredits>;
4070
+ votes: Lockout[];
4071
+ authorizedVoters: AuthorizedVoter[];
4072
+ priorVoters: PriorVoter[];
4073
+ epochCredits: EpochCredits[];
4074
+ lastTimestamp: BlockTimestamp;
3953
4075
 
3954
4076
  /**
3955
4077
  * Deserialize VoteAccount from the account data.
@@ -3961,11 +4083,14 @@ feeCalculator: FeeCalculator,...
3961
4083
  ): VoteAccount;
3962
4084
  }
3963
4085
  declare export var SYSVAR_CLOCK_PUBKEY: PublicKey;
4086
+ declare export var SYSVAR_EPOCH_SCHEDULE_PUBKEY: PublicKey;
4087
+ declare export var SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
3964
4088
  declare export var SYSVAR_RECENT_BLOCKHASHES_PUBKEY: PublicKey;
3965
4089
  declare export var SYSVAR_RENT_PUBKEY: PublicKey;
3966
4090
  declare export var SYSVAR_REWARDS_PUBKEY: PublicKey;
4091
+ declare export var SYSVAR_SLOT_HASHES_PUBKEY: PublicKey;
4092
+ declare export var SYSVAR_SLOT_HISTORY_PUBKEY: PublicKey;
3967
4093
  declare export var SYSVAR_STAKE_HISTORY_PUBKEY: PublicKey;
3968
- declare export var SYSVAR_INSTRUCTIONS_PUBKEY: PublicKey;
3969
4094
  declare export class SendTransactionError mixins Error {
3970
4095
  logs: string[] | void;
3971
4096
  constructor(message: string, logs?: string[]): this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "1.30.2",
3
+ "version": "1.32.2",
4
4
  "description": "Solana Javascript API",
5
5
  "keywords": [
6
6
  "api",
@@ -38,7 +38,6 @@
38
38
  ],
39
39
  "scripts": {
40
40
  "build": "npm run clean; cross-env NODE_ENV=production rollup -c; npm run type:gen; npm run flow:gen; npm run flow:check",
41
- "build:browser-test": "rollup -c test/rollup.config.js",
42
41
  "build:fixtures": "set -ex; ./test/fixtures/noop-program/build.sh",
43
42
  "clean": "rimraf ./coverage ./lib",
44
43
  "codecov": "set -ex; npm run test:cover; cat ./coverage/lcov.info | codecov",
@@ -55,9 +54,6 @@
55
54
  "re": "semantic-release --repository-url git@github.com:solana-labs/solana-web3.js.git",
56
55
  "test": "mocha -r ts-node/register './test/**/*.test.ts'",
57
56
  "test:cover": "TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' nyc --reporter=lcov mocha -r ts-node/register './test/**/*.test.ts'",
58
- "test:browser": "TEST_LIVE=1 npm run build:browser-test && mocha-headless-chrome -f http://localhost:8080/mocha.html --timeout 180000",
59
- "test:browser-with-server": "start-server-and-test 'http-server -p 8080' 8080 test:browser",
60
- "test:browser-with-test-validator": "start-server-and-test 'solana-test-validator --reset --quiet' http://localhost:8899/health test:browser-with-server",
61
57
  "test:live": "TEST_LIVE=1 npm run test",
62
58
  "test:live-with-test-validator": "start-server-and-test 'solana-test-validator --reset --quiet' http://localhost:8899/health test:live"
63
59
  },
@@ -84,8 +80,8 @@
84
80
  "@babel/preset-env": "^7.12.11",
85
81
  "@babel/preset-typescript": "^7.12.16",
86
82
  "@babel/register": "^7.12.13",
87
- "@commitlint/config-conventional": "^13.1.0",
88
- "@commitlint/travis-cli": "^13.1.0",
83
+ "@commitlint/config-conventional": "^15.0.0",
84
+ "@commitlint/travis-cli": "^15.0.0",
89
85
  "@rollup/plugin-alias": "^3.1.2",
90
86
  "@rollup/plugin-babel": "^5.2.3",
91
87
  "@rollup/plugin-commonjs": "^21.0.0",
@@ -112,7 +108,7 @@
112
108
  "cross-env": "7.0.3",
113
109
  "eslint": "^7.19.0",
114
110
  "eslint-config-prettier": "^8.0.0",
115
- "eslint-plugin-import": "2.25.2",
111
+ "eslint-plugin-import": "2.25.3",
116
112
  "eslint-plugin-mocha": "^9.0.0",
117
113
  "eslint-plugin-prettier": "^4.0.0",
118
114
  "esm": "^3.2.25",
@@ -120,20 +116,19 @@
120
116
  "flowgen": "^1.13.0",
121
117
  "http-server": "^14.0.0",
122
118
  "mocha": "^8.2.1",
123
- "mocha-headless-chrome": "^3.1.0",
124
119
  "mockttp": "^2.0.1",
125
120
  "mz": "^2.7.0",
126
121
  "npm-run-all": "^4.1.5",
127
122
  "nyc": "^15.1.0",
128
123
  "prettier": "^2.3.0",
129
- "puppeteer": "^10.2.0",
124
+ "puppeteer": "^12.0.0",
130
125
  "rimraf": "3.0.2",
131
- "rollup": "2.58.3",
126
+ "rollup": "2.60.2",
132
127
  "rollup-plugin-dts": "^4.0.0",
133
128
  "rollup-plugin-node-polyfills": "^0.2.1",
134
129
  "rollup-plugin-terser": "^7.0.2",
135
130
  "semantic-release": "^18.0.0",
136
- "sinon": "^11.0.0",
131
+ "sinon": "^12.0.0",
137
132
  "start-server-and-test": "^1.12.0",
138
133
  "ts-node": "^10.0.0",
139
134
  "tslib": "^2.1.0",
package/src/account.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as nacl from 'tweetnacl';
1
+ import nacl from 'tweetnacl';
2
2
  import type {SignKeyPair as KeyPair} from 'tweetnacl';
3
3
  import type {Buffer} from 'buffer';
4
4