solana/web3.js
Michael Vines 4acccb3976 fix: add flowtype for SignaturePubkeyPair 2020-06-14 21:57:04 -07:00
..
bin fix: surface system_program info logs by default 2020-06-14 21:57:04 -07:00
examples fix: adapt to SolKeyedAccount name change 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: add flowtype for SignaturePubkeyPair 2020-06-14 21:57:04 -07:00
test feat: add support for partial Transaction signing 2020-06-14 21:57:04 -07:00
.babelrc
.esdoc.json
.eslintignore
.eslintrc.js refactor: employ prettier 2020-06-14 21:57:04 -07:00
.flowconfig
.gitignore chore: add script to fetch bpf sdk 2020-06-14 21:57:04 -07:00
.mergify.yml ci: tweak .mergify.yml 2020-06-14 21:57:04 -07:00
.prettierrc.yaml refactor: employ prettier 2020-06-14 21:57:04 -07:00
.sgcrc
.travis.yml fix: validate bpf example 2020-06-14 21:57:04 -07:00
CONTRIBUTING.md
LICENSE
README.md chore: remove elfy from rollup 2020-06-14 21:57:04 -07:00
commitlint.config.js
jest.json
module.flow.js fix: add flowtype for SignaturePubkeyPair 2020-06-14 21:57:04 -07:00
package-lock.json fix: update some devDependencies 2020-06-14 21:57:04 -07:00
package.json fix: flatten symlinks in bpf-sdk/ as |npm pack| strips all symlinks 2020-06-14 21:57:04 -07:00
rollup.config.js chore: remove elfy from rollup 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

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)