@solana/web3.js 0.0.0-next

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 (53) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +158 -0
  3. package/lib/index.browser.cjs.js +10062 -0
  4. package/lib/index.browser.cjs.js.map +1 -0
  5. package/lib/index.browser.esm.js +9976 -0
  6. package/lib/index.browser.esm.js.map +1 -0
  7. package/lib/index.cjs.js +9568 -0
  8. package/lib/index.cjs.js.map +1 -0
  9. package/lib/index.d.ts +3311 -0
  10. package/lib/index.esm.js +9479 -0
  11. package/lib/index.esm.js.map +1 -0
  12. package/lib/index.iife.js +30136 -0
  13. package/lib/index.iife.js.map +1 -0
  14. package/lib/index.iife.min.js +40 -0
  15. package/lib/index.iife.min.js.map +1 -0
  16. package/package.json +140 -0
  17. package/src/account.ts +46 -0
  18. package/src/agent-manager.ts +44 -0
  19. package/src/blockhash.ts +4 -0
  20. package/src/bpf-loader-deprecated.ts +5 -0
  21. package/src/bpf-loader.ts +45 -0
  22. package/src/connection.ts +4935 -0
  23. package/src/ed25519-program.ts +157 -0
  24. package/src/epoch-schedule.ts +102 -0
  25. package/src/errors.ts +9 -0
  26. package/src/fee-calculator.ts +16 -0
  27. package/src/index.ts +31 -0
  28. package/src/instruction.ts +58 -0
  29. package/src/keypair.ts +98 -0
  30. package/src/layout.ts +147 -0
  31. package/src/loader.ts +236 -0
  32. package/src/message.ts +271 -0
  33. package/src/nonce-account.ts +78 -0
  34. package/src/publickey.ts +296 -0
  35. package/src/secp256k1-program.ts +229 -0
  36. package/src/stake-program.ts +923 -0
  37. package/src/system-program.ts +1007 -0
  38. package/src/sysvar.ts +37 -0
  39. package/src/timing.ts +23 -0
  40. package/src/transaction.ts +808 -0
  41. package/src/util/assert.ts +8 -0
  42. package/src/util/borsh-schema.ts +38 -0
  43. package/src/util/cluster.ts +31 -0
  44. package/src/util/promise-timeout.ts +14 -0
  45. package/src/util/send-and-confirm-raw-transaction.ts +46 -0
  46. package/src/util/send-and-confirm-transaction.ts +50 -0
  47. package/src/util/shortvec-encoding.ts +28 -0
  48. package/src/util/sleep.ts +4 -0
  49. package/src/util/to-buffer.ts +11 -0
  50. package/src/util/url.ts +18 -0
  51. package/src/validator-info.ts +106 -0
  52. package/src/vote-account.ts +236 -0
  53. package/src/vote-program.ts +413 -0
package/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2018 Solana Labs, Inc
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ [![Build status][travis-image]][travis-url]
2
+ [![codecov][codecov-image]][codecov-url]
3
+ <br>
4
+ [![npm][npm-image]][npm-url]
5
+ [![npm-downloads][npm-downloads-image]][npm-url]
6
+ <br>
7
+ [![semantic-release][semantic-release-image]][semantic-release-url]
8
+ [![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]
9
+
10
+ [travis-image]: https://api.travis-ci.org/solana-labs/solana-web3.js.svg?branch=master
11
+ [travis-url]: https://travis-ci.org/solana-labs/solana-web3.js
12
+ [codecov-image]: https://codecov.io/gh/solana-labs/solana-web3.js/branch/master/graph/badge.svg
13
+ [codecov-url]: https://codecov.io/gh/solana-labs/solana-web3.js
14
+ [npm-image]: https://img.shields.io/npm/v/@solana/web3.js.svg?style=flat
15
+ [npm-downloads-image]: https://img.shields.io/npm/dm/@solana/web3.js.svg?style=flat
16
+ [npm-url]: https://www.npmjs.com/package/@solana/web3.js
17
+ [semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
18
+ [semantic-release-url]: https://github.com/semantic-release/semantic-release
19
+ [code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
20
+ [code-style-prettier-url]: https://github.com/prettier/prettier
21
+
22
+ # Solana JavaScript API
23
+
24
+ This is the Solana Javascript API built on the Solana [JSON RPC API](https://docs.solana.com/apps/jsonrpc-api)
25
+
26
+ [Latest API Documentation](https://solana-labs.github.io/solana-web3.js/)
27
+
28
+ ## Installation
29
+
30
+ ### Yarn
31
+
32
+ ```
33
+ $ yarn add @solana/web3.js
34
+ ```
35
+
36
+ ### npm
37
+
38
+ ```
39
+ $ npm install --save @solana/web3.js
40
+ ```
41
+
42
+ ### Browser bundle
43
+
44
+ ```html
45
+ <!-- Development (un-minified) -->
46
+ <script src="https://unpkg.com/@solana/web3.js@latest/lib/index.iife.js"></script>
47
+
48
+ <!-- Production (minified) -->
49
+ <script src="https://unpkg.com/@solana/web3.js@latest/lib/index.iife.min.js"></script>
50
+ ```
51
+
52
+ ## Development Environment Setup
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
+ ### BPF program development
61
+
62
+ **Use `cargo build-bpf` from the latest Solana release**
63
+
64
+ ## Usage
65
+
66
+ ### Javascript
67
+
68
+ ```js
69
+ const solanaWeb3 = require('@solana/web3.js');
70
+ console.log(solanaWeb3);
71
+ ```
72
+
73
+ ### ES6
74
+
75
+ ```js
76
+ import * as solanaWeb3 from '@solana/web3.js';
77
+ console.log(solanaWeb3);
78
+ ```
79
+
80
+ ### Browser bundle
81
+
82
+ ```js
83
+ // `solanaWeb3` is provided in the global namespace by the `solanaWeb3.min.js` script bundle.
84
+ console.log(solanaWeb3);
85
+ ```
86
+
87
+ ## Examples
88
+
89
+ Example scripts for the web3.js repo and native programs:
90
+
91
+ - [Web3 Examples](https://github.com/solana-labs/solana/tree/master/web3.js/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
+
97
+ ## Flow Support (Discontinued)
98
+
99
+ Flow types are no longer supported in new releases. The last release with Flow support is v1.37.2 and its
100
+ [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at
101
+ https://unpkg.com/@solana/web3.js@v1.37.2/module.flow.js.
102
+ Download the file and add the following line under the [libs] section of your project's `.flowconfig` to
103
+ activate it:
104
+
105
+ ```ini
106
+ [libs]
107
+ node_modules/@solana/web3.js/module.flow.js
108
+ ```
109
+
110
+ ## Releases
111
+
112
+ Releases are available on [Github](https://github.com/solana-labs/solana-web3.js/releases)
113
+ and [npmjs.com](https://www.npmjs.com/package/@solana/web3.js)
114
+
115
+ Each Github release features a tarball containing API documentation and a
116
+ minified version of the module suitable for direct use in a browser environment
117
+ (`<script>` tag)
118
+
119
+ ## Disclaimer
120
+
121
+ All claims, content, designs, algorithms, estimates, roadmaps,
122
+ specifications, and performance measurements described in this project
123
+ are done with the Solana Foundation's ("SF") best efforts. It is up to
124
+ the reader to check and validate their accuracy and truthfulness.
125
+ Furthermore nothing in this project constitutes a solicitation for
126
+ investment.
127
+
128
+ Any content produced by SF or developer resources that SF provides, are
129
+ for educational and inspiration purposes only. SF does not encourage,
130
+ induce or sanction the deployment, integration or use of any such
131
+ applications (including the code comprising the Solana blockchain
132
+ protocol) in violation of applicable laws or regulations and hereby
133
+ prohibits any such deployment, integration or use. This includes use of
134
+ any such applications by the reader (a) in violation of export control
135
+ or sanctions laws of the United States or any other applicable
136
+ jurisdiction, (b) if the reader is located in or ordinarily resident in
137
+ a country or territory subject to comprehensive sanctions administered
138
+ by the U.S. Office of Foreign Assets Control (OFAC), or (c) if the
139
+ reader is or is working on behalf of a Specially Designated National
140
+ (SDN) or a person subject to similar blocking or denied party
141
+ prohibitions.
142
+
143
+ The reader should be aware that U.S. export control and sanctions laws
144
+ prohibit U.S. persons (and other persons that are subject to such laws)
145
+ from transacting with persons in certain countries and territories or
146
+ that are on the SDN list. As a project based primarily on open-source
147
+ software, it is possible that such sanctioned persons may nevertheless
148
+ bypass prohibitions, obtain the code comprising the Solana blockchain
149
+ protocol (or other project code or applications) and deploy, integrate,
150
+ or otherwise use it. Accordingly, there is a risk to individuals that
151
+ other persons using the Solana blockchain protocol may be sanctioned
152
+ persons and that transactions with such persons would be a violation of
153
+ U.S. export controls and sanctions law. This risk applies to
154
+ individuals, organizations, and other ecosystem participants that
155
+ deploy, integrate, or use the Solana blockchain protocol code directly
156
+ (e.g., as a node operator), and individuals that transact on the Solana
157
+ blockchain through light clients, third party interfaces, and/or wallet
158
+ software.