solana/web3.js
Michael Vines 33c59b73b4 fix: finalize/spawn in same transaction 2020-06-14 21:57:04 -07:00
..
bin fix: expose websocket 2020-06-14 21:57:04 -07:00
examples feat: add bpf-c-noop example 2020-06-14 21:57:04 -07:00
flow-typed feat: add account change notifications 2020-06-14 21:57:04 -07:00
src fix: finalize/spawn in same transaction 2020-06-14 21:57:04 -07:00
test feat: add bpf-c-noop example 2020-06-14 21:57:04 -07:00
.babelrc Activate flow 2020-06-14 21:57:04 -07:00
.esdoc.json Add esdoc boilerplate 2020-06-14 21:57:04 -07:00
.eslintignore chore: ignore module.flow.js, it's not expected to lint cleanly 2020-06-14 21:57:04 -07:00
.eslintrc.js Adjust eslint configuration 2020-06-14 21:57:04 -07:00
.flowconfig Activate flow 2020-06-14 21:57:04 -07:00
.gitignore chore: add script to fetch bpf sdk 2020-06-14 21:57:04 -07:00
.package.json.swo feat: add solana-localnet program 2020-06-14 21:57:04 -07:00
.sgcrc chore: add semantic-git-commit-cli config file 2020-06-14 21:57:04 -07:00
.travis.yml feat: add solana-localnet program 2020-06-14 21:57:04 -07:00
CONTRIBUTING.md docs: add more details 2020-06-14 21:57:04 -07:00
LICENSE Project boilerplate from eunikitin/modern-package-boilerplate 2020-06-14 21:57:04 -07:00
README.md docs: up -> down 2020-06-14 21:57:04 -07:00
commitlint.config.js
jest.json Project boilerplate from eunikitin/modern-package-boilerplate 2020-06-14 21:57:04 -07:00
module.flow.js fix: add BpfLoader flow definition 2020-06-14 21:57:04 -07:00
package-lock.json chore: update package-lock.json 2020-06-14 21:57:04 -07:00
package.json fix: ship src/ again 2020-06-14 21:57:04 -07:00
rollup.config.js feat: add account change notifications 2020-06-14 21:57:04 -07:00

README.md

Build status codecov esdoc
npm npm-downloads david david semantic-release

Solana JavaScript API

This is the Solana Javascript API built on the Solana JSON RPC API

Latest API Documentation

Installation

Yarn

$ yarn add @solana/web3.js

npm

$ npm install --save @solana/web3.js

Browser bundle

<script src="https://github.com/solana-labs/solana-web3.js/releases/download/v0.0.6/solanaWeb3.min.js"></script>

Usage

Javascript

const solanaWeb3 = require('@solana/web3.js');
console.log(solanaWeb3);

ES6

import solanaWeb3 from '@solana/web3.js';
console.log(solanaWeb3);

Browser bundle

// `solanaWeb3` is provided in the global namespace by the `solanaWeb3.min.js` script bundle.
console.log(solanaWeb3);

Local Network

The solana-localnet program is provided to easily start a test Solana network locally on your machine. Docker must be installed. The JSON RPC endpoint of the local network is http://localhost:8899.

To start, first fetch the latest Docker image by running:

$ npx solana-localnet update

Then run the following command to start the network

$ npx solana-localnet up

While the network is running logs are available with:

$ npx solana-localnet logs -f

Stop the network with:

$ npx solana-localnet down

Flow

A Flow library definition is provided at module.flow.js. Add the following line under the [libs] section of your project's .flowconfig to activate it:

[libs]
node_modules/@solana/web3.js/module.flow.js

Examples

See the examples/ directory for small snippets.

Standalone examples:

Releases

Releases are available on Github and npmjs.com

Each Github release features a tarball containing API documentation and a minified version of the module suitable for direct use in a browser environment (<script> tag)