@solana/web3.js 1.21.1 → 1.22.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 CHANGED
@@ -25,20 +25,22 @@ This is the Solana Javascript API built on the Solana [JSON RPC API](https://doc
25
25
 
26
26
  [Latest API Documentation](https://solana-labs.github.io/solana-web3.js/)
27
27
 
28
-
29
28
  ## Installation
30
29
 
31
30
  ### Yarn
31
+
32
32
  ```
33
33
  $ yarn add @solana/web3.js
34
34
  ```
35
35
 
36
36
  ### npm
37
+
37
38
  ```
38
39
  $ npm install --save @solana/web3.js
39
40
  ```
40
41
 
41
42
  ### Browser bundle
43
+
42
44
  ```html
43
45
  <!-- Development (un-minified) -->
44
46
  <script src="https://unpkg.com/@solana/web3.js@latest/lib/index.iife.js"></script>
@@ -62,35 +64,50 @@ Install the latest Solana release from https://docs.solana.com/cli/install-solan
62
64
  ## Usage
63
65
 
64
66
  ### Javascript
67
+
65
68
  ```js
66
69
  const solanaWeb3 = require('@solana/web3.js');
67
70
  console.log(solanaWeb3);
68
71
  ```
69
72
 
70
73
  ### ES6
74
+
71
75
  ```js
72
76
  import * as solanaWeb3 from '@solana/web3.js';
73
77
  console.log(solanaWeb3);
74
78
  ```
75
79
 
76
80
  ### Browser bundle
81
+
77
82
  ```js
78
83
  // `solanaWeb3` is provided in the global namespace by the `solanaWeb3.min.js` script bundle.
79
84
  console.log(solanaWeb3);
80
85
  ```
81
86
 
87
+ ## Examples
88
+
89
+ Example scripts for the web3.js repo and native programs:
90
+
91
+ - [Web3 Examples](./examples)
92
+
93
+ Example scripts for the Solana Program Library:
94
+
95
+ - [Token Program Examples](https://github.com/solana-labs/solana-program-library/tree/master/token/js/examples)
96
+
82
97
  ## Flow
83
98
 
84
99
  A [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at
85
100
  https://unpkg.com/@solana/web3.js@latest/module.flow.js.
86
101
  Download the file and add the following line under the [libs] section of your project's `.flowconfig` to
87
102
  activate it:
103
+
88
104
  ```ini
89
105
  [libs]
90
106
  node_modules/@solana/web3.js/module.flow.js
91
107
  ```
92
108
 
93
109
  ## Releases
110
+
94
111
  Releases are available on [Github](https://github.com/solana-labs/solana-web3.js/releases)
95
112
  and [npmjs.com](https://www.npmjs.com/package/@solana/web3.js)
96
113
 
@@ -3756,6 +3756,25 @@ class Connection {
3756
3756
  throw new Error('failed to get info about account ' + publicKey.toBase58() + ': ' + e);
3757
3757
  }
3758
3758
  }
3759
+ /**
3760
+ * Fetch all the account info for multiple accounts specified by an array of public keys
3761
+ */
3762
+
3763
+
3764
+ async getMultipleAccountsInfo(publicKeys, commitment) {
3765
+ const keys = publicKeys.map(key => key.toBase58());
3766
+
3767
+ const args = this._buildArgs([keys], commitment, 'base64');
3768
+
3769
+ const unsafeRes = await this._rpcRequest('getMultipleAccounts', args);
3770
+ const res = create(unsafeRes, jsonRpcResultAndContext(nullable(array(AccountInfoResult))));
3771
+
3772
+ if ('error' in res) {
3773
+ throw new Error('failed to get info for accounts ' + keys + ': ' + res.error.message);
3774
+ }
3775
+
3776
+ return res.result.value;
3777
+ }
3759
3778
  /**
3760
3779
  * Returns epoch activation information for a stake account that has been delegated
3761
3780
  */