2018-08-22 13:30:04 -07:00
|
|
|
[](https://travis-ci.org/solana-labs/solana-web3.js)
|
|
|
|
[](https://coveralls.io/github/solana-labs/solana-web3.js?branch=master)
|
2018-08-22 16:04:16 -07:00
|
|
|
[](https://www.npmjs.com/package/@solana/web3.js)
|
2018-08-22 13:30:04 -07:00
|
|
|
|
|
|
|
# Solana JavaScript API
|
|
|
|
|
|
|
|
This is the Solana Javascript API built on the Solana JSON RPC API (**TODO: add
|
|
|
|
link**).
|
|
|
|
|
2018-08-22 13:53:13 -07:00
|
|
|
[Latest API Documentation](https://solana-labs.github.io/solana-web3.js/)
|
2018-08-22 13:30:04 -07:00
|
|
|
|
|
|
|
|
2018-08-23 08:12:51 -07:00
|
|
|
## Installation
|
2018-08-22 20:06:29 -07:00
|
|
|
|
2018-08-23 08:12:51 -07:00
|
|
|
### Yarn
|
|
|
|
```
|
|
|
|
$ yarn add @solana/web3.js
|
|
|
|
```
|
|
|
|
|
|
|
|
### npm
|
2018-08-22 20:06:29 -07:00
|
|
|
```
|
|
|
|
$ npm install --save @solana/web3.js
|
|
|
|
```
|
|
|
|
|
2018-08-23 08:12:51 -07:00
|
|
|
### Browser bundle
|
|
|
|
```html
|
|
|
|
<script src="https://github.com/solana-labs/solana-web3.js/releases/download/v0.0.3/solanaWeb3.min.js"></script>
|
|
|
|
```
|
2018-08-22 20:06:29 -07:00
|
|
|
|
2018-08-23 08:12:51 -07:00
|
|
|
## Usage
|
2018-08-22 20:06:29 -07:00
|
|
|
|
2018-08-23 08:12:51 -07:00
|
|
|
### Javascript
|
|
|
|
```js
|
|
|
|
const solanaWeb3 = require('@solana/web3.js');
|
|
|
|
console.log(solanaWeb3);
|
|
|
|
```
|
2018-08-22 20:06:29 -07:00
|
|
|
|
2018-08-23 08:12:51 -07:00
|
|
|
### ES6
|
|
|
|
```js
|
|
|
|
import solanaWeb3 from '@solana/web3.js';
|
|
|
|
console.log(solanaWeb3);
|
|
|
|
```
|
|
|
|
|
|
|
|
### Browser bundle
|
|
|
|
```js
|
|
|
|
// `solanaWeb3` is provided in the global namespace by the `solanaWeb3.min.js` script bundle.
|
|
|
|
console.log(solanaWeb3);
|
|
|
|
```
|
2018-08-22 13:30:04 -07:00
|
|
|
|
2018-08-23 08:12:51 -07:00
|
|
|
## Examples
|
|
|
|
See the [examples/](https://github.com/solana-labs/solana-web3.js/tree/master/examples) directory
|
|
|
|
|
|
|
|
## Releases
|
2018-08-22 20:06:29 -07:00
|
|
|
Releases are available on [Github](https://github.com/solana-labs/solana-web3.js/releases)
|
|
|
|
and [npmjs.com](https://www.npmjs.com/package/@solana/web3.js).
|
2018-08-22 13:30:04 -07:00
|
|
|
|
2018-08-22 20:06:29 -07:00
|
|
|
Each Github release features a tarball containing the API documentation release
|
|
|
|
and a minified version of the module suitable for direct use in a browser
|
|
|
|
environment (<script> tag)
|