docs: update web3 repo readme (#18761)

Update web3 repo readme with links to example scripts
This commit is contained in:
chaseeb
2021-07-19 12:05:24 -04:00
committed by GitHub
parent f9321064e6
commit 4015e638e4

View File

@ -25,20 +25,22 @@ This is the Solana Javascript API built on the Solana [JSON RPC API](https://doc
[Latest API Documentation](https://solana-labs.github.io/solana-web3.js/) [Latest API Documentation](https://solana-labs.github.io/solana-web3.js/)
## Installation ## Installation
### Yarn ### Yarn
``` ```
$ yarn add @solana/web3.js $ yarn add @solana/web3.js
``` ```
### npm ### npm
``` ```
$ npm install --save @solana/web3.js $ npm install --save @solana/web3.js
``` ```
### Browser bundle ### Browser bundle
```html ```html
<!-- Development (un-minified) --> <!-- Development (un-minified) -->
<script src="https://unpkg.com/@solana/web3.js@latest/lib/index.iife.js"></script> <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
## Usage ## Usage
### Javascript ### Javascript
```js ```js
const solanaWeb3 = require('@solana/web3.js'); const solanaWeb3 = require('@solana/web3.js');
console.log(solanaWeb3); console.log(solanaWeb3);
``` ```
### ES6 ### ES6
```js ```js
import * as solanaWeb3 from '@solana/web3.js'; import * as solanaWeb3 from '@solana/web3.js';
console.log(solanaWeb3); console.log(solanaWeb3);
``` ```
### Browser bundle ### Browser bundle
```js ```js
// `solanaWeb3` is provided in the global namespace by the `solanaWeb3.min.js` script bundle. // `solanaWeb3` is provided in the global namespace by the `solanaWeb3.min.js` script bundle.
console.log(solanaWeb3); console.log(solanaWeb3);
``` ```
## Examples
Example scripts for the web3.js repo and native programs:
- [Web3 Examples](./examples)
Example scripts for the Solana Program Library:
- [Token Program Examples](https://github.com/solana-labs/solana-program-library/tree/master/token/js/examples)
## Flow ## Flow
A [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at A [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at
https://unpkg.com/@solana/web3.js@latest/module.flow.js. https://unpkg.com/@solana/web3.js@latest/module.flow.js.
Download the file and add the following line under the [libs] section of your project's `.flowconfig` to Download the file and add the following line under the [libs] section of your project's `.flowconfig` to
activate it: activate it:
```ini ```ini
[libs] [libs]
node_modules/@solana/web3.js/module.flow.js node_modules/@solana/web3.js/module.flow.js
``` ```
## Releases ## Releases
Releases are available on [Github](https://github.com/solana-labs/solana-web3.js/releases) 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) and [npmjs.com](https://www.npmjs.com/package/@solana/web3.js)