solana/web3.js
Justin Starry 6304814be3 chore: rollup dependency conflict (#366)
* bump rollup-plugin-node-resolve from 4.2.3 to 5.0.0

* Fix NPM warnings

* bump rollup-plugin-commonjs from 9.3.4 to 10.0.0
2020-06-14 21:57:04 -07:00
..
bin fix: inline testnet-default-channel.js 2020-06-14 21:57:04 -07:00
css code highlight style change 2020-06-14 21:57:04 -07:00
examples fix: drop solana-sdk-bpf-utils version 2020-06-14 21:57:04 -07:00
flow-typed chore(deps-dev): bump flow-bin from 0.98.1 to 0.99.1 2020-06-14 21:57:04 -07:00
src fix: add {min,max}LamportsPerSignature fields 2020-06-14 21:57:04 -07:00
test chore: update noop to new Rust conventions (#365) 2020-06-14 21:57:04 -07:00
.babelrc fix: upgrade to babel 7; dump uglify for terser; upgrade to jest 24 2020-06-14 21:57:04 -07:00
.esdoc.json fix: add esdoc css theme placeholder 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 refactor: employ prettier 2020-06-14 21:57:04 -07:00
.flowconfig Activate flow 2020-06-14 21:57:04 -07:00
.gitignore fix: avoid packaging bpf-sdk binaries that the user downloads 2020-06-14 21:57:04 -07:00
.mergify.yml ci: remove automerge label on CI failure 2020-06-14 21:57:04 -07:00
.prettierrc.yaml refactor: employ prettier 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 ci: ignore dependabot branches 2020-06-14 21:57:04 -07:00
CONTRIBUTING.md docs: add more details 2020-06-14 21:57:04 -07:00
LICENSE
README.md Add BPF Rust noop example (#316) 2020-06-14 21:57:04 -07:00
commitlint.config.js
jest.json
module.flow.js feat: expose feeCalculator 2020-06-14 21:57:04 -07:00
package-lock.json chore: rollup dependency conflict (#366) 2020-06-14 21:57:04 -07:00
package.json chore: rollup dependency conflict (#366) 2020-06-14 21:57:04 -07:00
rollup.config.js chore: rollup dependency conflict (#366) 2020-06-14 21:57:04 -07:00

README.md

Build status codecov esdoc
npm npm-downloads david david
semantic-release code-style-prettier

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>

BPF program development

clang-7.0 must be installed to build BPF programs, such as examples/bpf-c-noop/. See bpf-sdk/README.md for installation details.

Rust must be installed to build Rust BPF programs, see: https://www.rust-lang.org/install.html such as examples/bpf-rust-noop/. See https://www.rust-lang.org/install.html for installation details.

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 cluster locally on your machine. Docker must be installed. The JSON RPC endpoint of the local cluster 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 cluster

$ npx solana-localnet up

While the cluster is running logs are available with:

$ npx solana-localnet logs -f

Stop the cluster 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)