diff --git a/web3.js/.package.json.swo b/web3.js/.package.json.swo new file mode 100644 index 0000000000..dc043302b9 Binary files /dev/null and b/web3.js/.package.json.swo differ diff --git a/web3.js/.travis.yml b/web3.js/.travis.yml index 2146072073..71aa10631e 100644 --- a/web3.js/.travis.yml +++ b/web3.js/.travis.yml @@ -1,8 +1,12 @@ +sudo: required language: node_js node_js: - "lts/*" - "node" +services: + - docker + cache: directories: - ~/.npm @@ -14,8 +18,12 @@ script: - npm run doc - npm run flow - npm run lint - - npm run examples - npm run codecov + - npm run localnet:update + - npm run localnet:up + - npm run examples + - npm run test:live + - npm run localnet:down before_deploy: - rm -rf deploy diff --git a/web3.js/README.md b/web3.js/README.md index c122119832..68c46df710 100644 --- a/web3.js/README.md +++ b/web3.js/README.md @@ -68,6 +68,31 @@ console.log(solanaWeb3); console.log(solanaWeb3); ``` +## Local Network +The `solana-localnet` program is provide 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: +```bash +$ npx solana-localnet update +``` + +Then run the following command to start the network +```bash +$ npx solana-localnet up +``` + +While the network is running logs are available with: +```bash +$ npx solana-localnet logs -f +``` + +Stop the network with: +```bash +$ npx solana-localnet up +``` + ## Flow A [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at @@ -79,7 +104,6 @@ activate it: node_modules/@solana/web3.js/module.flow.js ``` - ## Examples See the [examples/](https://github.com/solana-labs/solana-web3.js/tree/master/examples) directory for small snippets. diff --git a/web3.js/bin/localnet.sh b/web3.js/bin/localnet.sh new file mode 100755 index 0000000000..56c245410e --- /dev/null +++ b/web3.js/bin/localnet.sh @@ -0,0 +1,88 @@ +#!/bin/bash -e + +usage() { + exitcode=0 + if [[ -n "$1" ]]; then + exitcode=1 + echo "Error: $*" + fi + cat <