diff --git a/web3.js/README.md b/web3.js/README.md index 695916032c..9ced8ad971 100644 --- a/web3.js/README.md +++ b/web3.js/README.md @@ -10,22 +10,47 @@ link**). [Latest API Documentation](https://solana-labs.github.io/solana-web3.js/) -## Getting started +## Installation +### Yarn +``` +$ yarn add @solana/web3.js +``` + +### npm ``` $ npm install --save @solana/web3.js ``` +### Browser bundle +```html + +``` + +## Usage + +### Javascript +```js +const solanaWeb3 = require('@solana/web3.js'); +console.log(solanaWeb3); +``` + +### 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); +``` + ## Examples - -See the [examples/](https://github.com/solana-labs/solana-web3.js/tree/master/examples) -for simple examples of using the API from node. - -Browser-based examples are also available: -* Account creation - https://jsfiddle.net/mvines/sz4pco6y/ +See the [examples/](https://github.com/solana-labs/solana-web3.js/tree/master/examples) directory ## 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). diff --git a/web3.js/examples/README.md b/web3.js/examples/README.md new file mode 100644 index 0000000000..5105d51dcc --- /dev/null +++ b/web3.js/examples/README.md @@ -0,0 +1,3 @@ +## Examples +Before trying any of the examples in this directory please populate the `lib/` +directory by running `npm install` diff --git a/web3.js/examples/account.html b/web3.js/examples/account.html new file mode 100644 index 0000000000..db6b811f03 --- /dev/null +++ b/web3.js/examples/account.html @@ -0,0 +1,21 @@ + + + + Create a new account + + + Account Public Key: +
?
+ + +

+ This demo is also available on JSFiddle + + diff --git a/web3.js/examples/account.js b/web3.js/examples/account.js index 0961c01118..ca52858315 100644 --- a/web3.js/examples/account.js +++ b/web3.js/examples/account.js @@ -1,11 +1,5 @@ /* - - Creating a new account - - Usage: - $ npm run dev - $ node ./account.js - + Create a new account */ //eslint-disable-next-line import/no-commonjs