@solana/web3.js 1.73.1 → 1.73.3
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 +58 -57
- package/lib/index.browser.cjs.js +567 -1532
- package/lib/index.browser.cjs.js.map +1 -1
- package/lib/index.browser.esm.js +566 -1533
- package/lib/index.browser.esm.js.map +1 -1
- package/lib/index.cjs.js +816 -1717
- package/lib/index.cjs.js.map +1 -1
- package/lib/index.d.ts +1586 -2158
- package/lib/index.esm.js +811 -1713
- package/lib/index.esm.js.map +1 -1
- package/lib/index.iife.js +3161 -3876
- package/lib/index.iife.js.map +1 -1
- package/lib/index.iife.min.js +5 -5
- package/lib/index.iife.min.js.map +1 -1
- package/lib/index.native.js +567 -1532
- package/lib/index.native.js.map +1 -1
- package/package.json +30 -36
- package/src/__forks__/browser/rpc-websocket-factory.ts +1 -0
- package/src/__forks__/react-native/rpc-websocket-factory.ts +1 -0
- package/src/connection.ts +12 -6
- package/src/programs/stake.ts +15 -3
- package/src/programs/system.ts +5 -1
- package/src/rpc-websocket-factory.ts +4 -0
- package/src/rpc-websocket.ts +79 -0
package/README.md
CHANGED
|
@@ -1,45 +1,33 @@
|
|
|
1
|
-
[![codecov][codecov-image]][codecov-url]
|
|
2
|
-
<br>
|
|
3
1
|
[![npm][npm-image]][npm-url]
|
|
4
2
|
[![npm-downloads][npm-downloads-image]][npm-url]
|
|
5
|
-
<br>
|
|
6
3
|
[![semantic-release][semantic-release-image]][semantic-release-url]
|
|
4
|
+
<br />
|
|
5
|
+
[![codecov][codecov-image]][codecov-url]
|
|
7
6
|
[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]
|
|
8
7
|
|
|
8
|
+
[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
|
|
9
|
+
[code-style-prettier-url]: https://github.com/prettier/prettier
|
|
9
10
|
[codecov-image]: https://codecov.io/gh/solana-labs/solana-web3.js/branch/master/graph/badge.svg
|
|
10
11
|
[codecov-url]: https://codecov.io/gh/solana-labs/solana-web3.js
|
|
11
|
-
[npm-image]: https://img.shields.io/npm/v/@solana/web3.js.svg?style=flat
|
|
12
12
|
[npm-downloads-image]: https://img.shields.io/npm/dm/@solana/web3.js.svg?style=flat
|
|
13
|
+
[npm-image]: https://img.shields.io/npm/v/@solana/web3.js.svg?style=flat
|
|
13
14
|
[npm-url]: https://www.npmjs.com/package/@solana/web3.js
|
|
14
15
|
[semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
|
|
15
16
|
[semantic-release-url]: https://github.com/semantic-release/semantic-release
|
|
16
|
-
[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
|
|
17
|
-
[code-style-prettier-url]: https://github.com/prettier/prettier
|
|
18
|
-
|
|
19
|
-
# Solana JavaScript API
|
|
20
|
-
|
|
21
|
-
This is the Solana Javascript API built on the Solana [JSON RPC API](https://docs.solana.com/apps/jsonrpc-api)
|
|
22
17
|
|
|
23
|
-
|
|
18
|
+
# Solana JavaScript SDK
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
- For more detail on individual functions, see the [latest API Documentation](https://solana-labs.github.io/solana-web3.js/)
|
|
20
|
+
Use this to interact with accounts and programs on the Solana network through the Solana [JSON RPC API](https://docs.solana.com/apps/jsonrpc-api).
|
|
27
21
|
|
|
28
22
|
## Installation
|
|
29
23
|
|
|
30
|
-
###
|
|
31
|
-
|
|
32
|
-
```
|
|
33
|
-
$ yarn add @solana/web3.js
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### npm
|
|
24
|
+
### For use in Node.js or a web application
|
|
37
25
|
|
|
38
26
|
```
|
|
39
27
|
$ npm install --save @solana/web3.js
|
|
40
28
|
```
|
|
41
29
|
|
|
42
|
-
###
|
|
30
|
+
### For use in a browser, without a build system
|
|
43
31
|
|
|
44
32
|
```html
|
|
45
33
|
<!-- Development (un-minified) -->
|
|
@@ -49,40 +37,20 @@ $ npm install --save @solana/web3.js
|
|
|
49
37
|
<script src="https://unpkg.com/@solana/web3.js@latest/lib/index.iife.min.js"></script>
|
|
50
38
|
```
|
|
51
39
|
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
Install the latest Solana release from https://docs.solana.com/cli/install-solana-cli-tools
|
|
55
|
-
|
|
56
|
-
### Run test validator
|
|
57
|
-
|
|
58
|
-
**Use `solana-test-validator` from the latest Solana release**
|
|
59
|
-
|
|
60
|
-
### SBF program development
|
|
61
|
-
|
|
62
|
-
**Use `cargo build-bpf` from the latest Solana release**
|
|
63
|
-
|
|
64
|
-
## Usage
|
|
40
|
+
## Documentation and examples
|
|
65
41
|
|
|
66
|
-
|
|
42
|
+
- [The Solana Cookbook](https://solanacookbook.com/) has extensive task-based documentation using this library.
|
|
43
|
+
- For more detail on individual functions, see the [latest API Documentation](https://solana-labs.github.io/solana-web3.js)
|
|
67
44
|
|
|
68
|
-
|
|
69
|
-
const solanaWeb3 = require('@solana/web3.js');
|
|
70
|
-
console.log(solanaWeb3);
|
|
71
|
-
```
|
|
45
|
+
## Getting help
|
|
72
46
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
```js
|
|
76
|
-
import * as solanaWeb3 from '@solana/web3.js';
|
|
77
|
-
console.log(solanaWeb3);
|
|
78
|
-
```
|
|
47
|
+
Have a question or a problem? Check the [Solana Stack Exchange](https://solana.stackexchange.com) to see if anyone else is having the same one. If not, [post a new question](https://solana.stackexchange.com/questions/ask).
|
|
79
48
|
|
|
80
|
-
|
|
49
|
+
Include:
|
|
81
50
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
```
|
|
51
|
+
- A detailed description of what you're trying to achieve
|
|
52
|
+
- Source code, if possible
|
|
53
|
+
- The text of any errors you encountered, with stacktraces if available
|
|
86
54
|
|
|
87
55
|
## Compatibility
|
|
88
56
|
|
|
@@ -102,18 +70,51 @@ This library requires a JavaScript runtime that supports [`BigInt`](https://deve
|
|
|
102
70
|
- React Native:
|
|
103
71
|
- \>=0.7.0 using the [Hermes](https://reactnative.dev/blog/2022/07/08/hermes-as-the-default) engine ([integration guide](https://solanacookbook.com/integrations/react-native.html#how-to-use-solana-web3-js-in-a-react-native-app)):
|
|
104
72
|
|
|
105
|
-
##
|
|
73
|
+
## Development environment setup
|
|
74
|
+
|
|
75
|
+
### Testing
|
|
76
|
+
|
|
77
|
+
#### Unit tests
|
|
78
|
+
|
|
79
|
+
To run the full suite of unit tests, excute the following in the root:
|
|
80
|
+
|
|
81
|
+
```shell
|
|
82
|
+
$ npm test
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
#### Integration tests
|
|
86
|
+
|
|
87
|
+
Integration tests require a validator client running on your machine.
|
|
88
|
+
|
|
89
|
+
To install a test validator:
|
|
90
|
+
|
|
91
|
+
```shell
|
|
92
|
+
$ npm run test:live-with-test-validator:setup
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
To start the test validator and run all of the integration tests in live mode:
|
|
96
|
+
|
|
97
|
+
```shell
|
|
98
|
+
$ cd packages/library-legacy
|
|
99
|
+
$ npm run test:live-with-test-validator
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Speed up build times with remote caching
|
|
106
103
|
|
|
107
|
-
|
|
108
|
-
and [npmjs.com](https://www.npmjs.com/package/@solana/web3.js)
|
|
104
|
+
Cache build artifacts remotely so that you, others, and the CI server can take advantage of each others' build efforts.
|
|
109
105
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
106
|
+
1. Log the Turborepo CLI into the Solana Vercel account
|
|
107
|
+
```shell
|
|
108
|
+
pnpm turbo login
|
|
109
|
+
```
|
|
110
|
+
2. Link the repository to the remote cache
|
|
111
|
+
```shell
|
|
112
|
+
pnpm turbo link
|
|
113
|
+
```
|
|
113
114
|
|
|
114
115
|
## Contributing
|
|
115
116
|
|
|
116
|
-
If you
|
|
117
|
+
If you found a bug or would like to request a feature, please [file an issue](https://github.com/solana-labs/solana-web3.js/issues/new). If, based on the discussion on an issue you would like to offer a code change, please make a [pull request](https://github.com/solana-labs/solana-web3.js/compare). If neither of these describes what you would like to contribute, read the [getting help](#getting-help) section above.
|
|
117
118
|
|
|
118
119
|
## Disclaimer
|
|
119
120
|
|