diff --git a/web3.js/.gitignore b/web3.js/.gitignore index 70d8589e04..7cc5fcd60c 100644 --- a/web3.js/.gitignore +++ b/web3.js/.gitignore @@ -27,3 +27,6 @@ doc # fixtures /test/fixtures + +# `solana-test-validator` ledger location +test-ledger/ diff --git a/web3.js/.travis.yml b/web3.js/.travis.yml index 40f27d7086..e551117021 100644 --- a/web3.js/.travis.yml +++ b/web3.js/.travis.yml @@ -5,9 +5,6 @@ node_js: - "lts/*" # - "node" disabled due to flaky test failures -services: - - docker - cache: directories: - ~/.npm diff --git a/web3.js/.travis/before_install.sh b/web3.js/.travis/before_install.sh index 05334e6fe0..6c5a4dd074 100644 --- a/web3.js/.travis/before_install.sh +++ b/web3.js/.travis/before_install.sh @@ -8,6 +8,11 @@ sudo apt-get install -y openssl --allow-unauthenticated sudo apt-get install -y libssl-dev --allow-unauthenticated sudo apt-get install -y libssl1.1 --allow-unauthenticated clang-7 --version + curl https://sh.rustup.rs -sSf | sh -s -- -y PATH=$HOME/.cargo/bin:$PATH rustup --version + +sh -c "$(curl -sSfL https://release.solana.com/edge/install)" +PATH="$HOME/.local/share/solana/install/active_release/bin:$PATH" +solana --version diff --git a/web3.js/.travis/script.sh b/web3.js/.travis/script.sh index 74361ace0d..ca3c064374 100644 --- a/web3.js/.travis/script.sh +++ b/web3.js/.travis/script.sh @@ -1,6 +1,7 @@ # |source| this file set -ex +solana --version ls -l lib test -r lib/index.iife.js @@ -12,8 +13,5 @@ npm run flow npm run lint npm run codecov make -C examples/bpf-c-noop/ -examples/bpf-rust-noop/do.sh build -npm run localnet:update -npm run localnet:up -npm run test:live -npm run localnet:down +cargo build-bpf --manifest-path examples/bpf-rust-noop/Cargo.toml +npm run test:live-with-test-validator diff --git a/web3.js/README.md b/web3.js/README.md index d01a9af862..034c68e747 100644 --- a/web3.js/README.md +++ b/web3.js/README.md @@ -46,15 +46,11 @@ $ npm install --save @solana/web3.js ``` -### BPF program development -The Solana BPF SDK is located in the `bpf-sdk/` subdirectory if you installed -solana-web3.js from npmjs.com. -From a git clone, run `npm run bpf-sdk:install` to fetch the latest BPF SDK. - -Additionally Rust must be installed to build Rust BPF programs such as -`examples/bpf-rust-noop/`. See https://www.rust-lang.org/install.html for -installation details. +### Development Environment Setup +To build and run tests: +1. Install Rust from https://rustup.rs/ +2. Install the latest Solana release from https://docs.solana.com/cli/install-solana-cli-tools ## Usage @@ -76,31 +72,6 @@ console.log(solanaWeb3); 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: -```bash -$ npx solana-localnet update -``` - -Then run the following command to start the cluster -```bash -$ npx solana-localnet up -``` - -While the cluster is running logs are available with: -```bash -$ npx solana-localnet logs -f -``` - -Stop the cluster with: -```bash -$ npx solana-localnet down -``` - ## Flow A [Flow library definition](https://flow.org/en/docs/libdefs/) is provided at @@ -127,3 +98,46 @@ and [npmjs.com](https://www.npmjs.com/package/@solana/web3.js) 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) + +## Deprecated + +### Local Network + +**Please use `solana-test-validator` from the latest Solana release instead of the information in this section** + +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: +```bash +$ npx solana-localnet update +``` + +Then run the following command to start the cluster +```bash +$ npx solana-localnet up +``` + +While the cluster is running logs are available with: +```bash +$ npx solana-localnet logs -f +``` + +Stop the cluster with: +```bash +$ npx solana-localnet down +``` + +### BPF program development + +**Please use `cargo build-bpf` from the latest Solana release instead of the information in this section** + +The Solana BPF SDK is located in the `bpf-sdk/` subdirectory if you installed +solana-web3.js from npmjs.com. + +From a git clone, run `npm run bpf-sdk:install` to fetch the latest BPF SDK. + +Additionally Rust must be installed to build Rust BPF programs such as +`examples/bpf-rust-noop/`. See https://www.rust-lang.org/install.html for +installation details. diff --git a/web3.js/examples/bpf-rust-noop/Cargo.toml b/web3.js/examples/bpf-rust-noop/Cargo.toml index e9fc0331bb..f39eaeca6c 100644 --- a/web3.js/examples/bpf-rust-noop/Cargo.toml +++ b/web3.js/examples/bpf-rust-noop/Cargo.toml @@ -1,6 +1,3 @@ - -# Note: This crate must be built using build.sh - [package] name = "solana-bpf-rust-noop" version = "0.1.0" @@ -14,13 +11,9 @@ edition = "2018" [dependencies] num-derive = "0.2" num-traits = "0.2" -solana-sdk = { git = "https://github.com/solana-labs/solana", default-features = false } +solana-program = "1.4.16" thiserror = "1.0" -[features] -program = ["solana-sdk/program"] -default = ["program"] - [workspace] members = [] diff --git a/web3.js/examples/bpf-rust-noop/do.sh b/web3.js/examples/bpf-rust-noop/do.sh deleted file mode 100755 index 648c9bf2e5..0000000000 --- a/web3.js/examples/bpf-rust-noop/do.sh +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env bash - -cd "$(dirname "$0")" - -usage() { - cat < - -If relative_project_path is ommitted then action will -be performed on all projects - -Supported actions: - build - clean - test - clippy - fmt - -EOF -} - -sdkDir=../../bpf-sdk -targetDir="$PWD"/target -profile=bpfel-unknown-unknown/release - -perform_action() { - set -e - case "$1" in - build) - "$sdkDir"/rust/build.sh "$PWD" - - so_path="$targetDir/$profile" - so_name="solana_bpf_rust_noop" - if [ -f "$so_path/${so_name}.so" ]; then - cp "$so_path/${so_name}.so" "$so_path/${so_name}_debug.so" - "$sdkDir"/dependencies/llvm-native/bin/llvm-objcopy --strip-all "$so_path/${so_name}.so" "$so_path/$so_name.so" - fi - ;; - clean) - "$sdkDir"/rust/clean.sh "$PWD" - ;; - test) - echo "test" - cargo +nightly test - ;; - clippy) - echo "clippy" - cargo +nightly clippy - ;; - fmt) - echo "formatting" - cargo fmt - ;; - help) - usage - exit - ;; - *) - echo "Error: Unknown command" - usage - exit - ;; - esac -} - -set -e - -perform_action "$1" diff --git a/web3.js/examples/bpf-rust-noop/src/lib.rs b/web3.js/examples/bpf-rust-noop/src/lib.rs index 960ad4c8a7..94893aa626 100644 --- a/web3.js/examples/bpf-rust-noop/src/lib.rs +++ b/web3.js/examples/bpf-rust-noop/src/lib.rs @@ -1,10 +1,8 @@ //! @brief Example Rust-based BPF program that prints out the parameters passed to it -#![allow(unreachable_code)] -extern crate solana_sdk; -use solana_sdk::{ - account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, info, log::*, pubkey::Pubkey, +use solana_program::{ + account_info::AccountInfo, entrypoint, entrypoint::ProgramResult, msg, log::*, pubkey::Pubkey, }; #[derive(Debug, PartialEq)] @@ -25,13 +23,13 @@ fn process_instruction( accounts: &[AccountInfo], instruction_data: &[u8], ) -> ProgramResult { - info!("Program identifier:"); + msg!("Program identifier:"); program_id.log(); // Log the provided account keys and instruction input data. In the case of // the no-op program, no account keys or input data are expected but real // programs will have specific requirements so they can do their work. - info!("Account keys and instruction input data:"); + msg!("Account keys and instruction input data:"); sol_log_params(accounts, instruction_data); { @@ -42,7 +40,7 @@ fn process_instruction( let result_str = std::str::from_utf8(&sparkle_heart).unwrap(); assert_eq!(4, result_str.len()); assert_eq!("💖", result_str); - info!(result_str); + msg!(result_str); } { diff --git a/web3.js/package-lock.json b/web3.js/package-lock.json index 4bb08cd11f..fe84bebd80 100644 --- a/web3.js/package-lock.json +++ b/web3.js/package-lock.json @@ -3634,6 +3634,21 @@ } } }, + "@hapi/hoek": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.1.0.tgz", + "integrity": "sha512-i9YbZPN3QgfighY/1X1Pu118VUz2Fmmhd6b2n0/O8YVgGGfw0FbUYoA97k7FkpGJ+pLCFEDLUmAPPV4D1kpeFw==", + "dev": true + }, + "@hapi/topo": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@hapi/topo/-/topo-5.0.0.tgz", + "integrity": "sha512-tFJlT47db0kMqVm3H4nQYgn6Pwg10GTZHb1pwmSiv1K4ks6drQOtfEF5ZnPjkvC+y4/bUPHK+bc87QvLcL+WMw==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -5103,6 +5118,27 @@ } } }, + "@sideway/address": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.0.tgz", + "integrity": "sha512-wAH/JYRXeIFQRsxerIuLjgUu2Xszam+O5xKeatJ4oudShOOirfmsQ1D6LL54XOU2tizpCYku+s1wmU0SYdpoSA==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0" + } + }, + "@sideway/formula": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", + "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==", + "dev": true + }, + "@sideway/pinpoint": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@sideway/pinpoint/-/pinpoint-2.0.0.tgz", + "integrity": "sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==", + "dev": true + }, "@sindresorhus/is": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-2.1.1.tgz", @@ -6346,6 +6382,15 @@ "dev": true, "optional": true }, + "axios": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.19.2.tgz", + "integrity": "sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA==", + "dev": true, + "requires": { + "follow-redirects": "1.5.10" + } + }, "babel-code-frame": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", @@ -7407,6 +7452,12 @@ "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=", "dev": true }, + "check-more-types": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", + "integrity": "sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA=", + "dev": true + }, "cheerio": { "version": "1.0.0-rc.2", "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.2.tgz", @@ -8767,6 +8818,12 @@ "integrity": "sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw==", "dev": true }, + "duplexer": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", + "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", + "dev": true + }, "duplexer2": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", @@ -10098,6 +10155,32 @@ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, + "event-stream": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/event-stream/-/event-stream-3.3.4.tgz", + "integrity": "sha1-SrTJoPWlTbkzi0w02Gv86PSzVXE=", + "dev": true, + "requires": { + "duplexer": "~0.1.1", + "from": "~0", + "map-stream": "~0.1.0", + "pause-stream": "0.0.11", + "split": "0.3", + "stream-combiner": "~0.0.4", + "through": "~2.3.1" + }, + "dependencies": { + "split": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/split/-/split-0.3.3.tgz", + "integrity": "sha1-zQ7qXmOiEd//frDwkcQTPi0N0o8=", + "dev": true, + "requires": { + "through": "2" + } + } + } + }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -10693,6 +10776,26 @@ } } }, + "follow-redirects": { + "version": "1.5.10", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz", + "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==", + "dev": true, + "requires": { + "debug": "=3.1.0" + }, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -10730,6 +10833,12 @@ "map-cache": "^0.2.2" } }, + "from": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/from/-/from-0.1.7.tgz", + "integrity": "sha1-g8YK/Fi5xWmXAH7Rp2izqzA6RP4=", + "dev": true + }, "from2": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", @@ -13860,6 +13969,19 @@ } } }, + "joi": { + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-17.3.0.tgz", + "integrity": "sha512-Qh5gdU6niuYbUIUV5ejbsMiiFmBdw8Kcp8Buj2JntszCkCfxJ9Cz76OtHxOZMPXrt5810iDIXs+n1nNVoquHgg==", + "dev": true, + "requires": { + "@hapi/hoek": "^9.0.0", + "@hapi/topo": "^5.0.0", + "@sideway/address": "^4.1.0", + "@sideway/formula": "^3.0.0", + "@sideway/pinpoint": "^2.0.0" + } + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -14265,6 +14387,12 @@ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", "dev": true }, + "lazy-ass": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", + "integrity": "sha1-eZllXoZGwX8In90YfRUNMyTVRRM=", + "dev": true + }, "level-blobs": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/level-blobs/-/level-blobs-0.1.7.tgz", @@ -14803,6 +14931,12 @@ "integrity": "sha512-glc9y00wgtwcDmp7GaE/0b0OnxpNJsVf3ael/An6Fe2Q51LLwN1er6sdomLRzz5h0+yMpiYLhWYF5R7HeqVd4g==", "dev": true }, + "map-stream": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", + "integrity": "sha1-5WqpTEyAVaFkBKBnS3jyFffI4ZQ=", + "dev": true + }, "map-visit": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", @@ -19706,6 +19840,15 @@ "pify": "^2.0.0" } }, + "pause-stream": { + "version": "0.0.11", + "resolved": "https://registry.npmjs.org/pause-stream/-/pause-stream-0.0.11.tgz", + "integrity": "sha1-/lo0sMvOErWqaitAPuLnO2AvFEU=", + "dev": true, + "requires": { + "through": "~2.3" + } + }, "pbkdf2": { "version": "3.0.16", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", @@ -19958,6 +20101,15 @@ "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", "dev": true }, + "ps-tree": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/ps-tree/-/ps-tree-1.2.0.tgz", + "integrity": "sha512-0VnamPPYHl4uaU/nSFeZZpR21QAWRz+sRv4iW9+v/GS/J5U5iZB5BNN6J0RMoOvdx2gWM2+ZFMIm58q24e4UYA==", + "dev": true, + "requires": { + "event-stream": "=3.3.4" + } + }, "psl": { "version": "1.8.0", "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", @@ -20888,6 +21040,15 @@ "integrity": "sha512-DEqnSRTDw/Tc3FXf49zedI638Z9onwUotBMiUFKmrO2sdFKIbXamXGQ3Axd4qgphxKB4kw/qP1w5kTxnfU1B9Q==", "dev": true }, + "rxjs": { + "version": "6.6.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz", + "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", @@ -21948,6 +22109,124 @@ } } }, + "start-server-and-test": { + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/start-server-and-test/-/start-server-and-test-1.11.6.tgz", + "integrity": "sha512-+0T83W/R7CVgIE2HJcrpJDleLt7Skc2Xj8jWWsItRGdpZwenAv0YtIpBEKoL64pwUtPAPoHuYUtvWUOfCRoVjg==", + "dev": true, + "requires": { + "bluebird": "3.7.2", + "check-more-types": "2.24.0", + "debug": "4.3.1", + "execa": "3.4.0", + "lazy-ass": "1.6.0", + "ps-tree": "1.2.0", + "wait-on": "5.2.0" + }, + "dependencies": { + "bluebird": { + "version": "3.7.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", + "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==", + "dev": true + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "debug": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.1.tgz", + "integrity": "sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "execa": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-3.4.0.tgz", + "integrity": "sha512-r9vdGQk4bmCuK1yKQu1KTwcT2zwfWdbdaXfCtAh+5nU/4fSX+JAb7vZGvI5naJrQlvONrEB20jeruESI69530g==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "human-signals": "^1.1.1", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "static-extend": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", @@ -21975,6 +22254,15 @@ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=", "dev": true }, + "stream-combiner": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/stream-combiner/-/stream-combiner-0.0.4.tgz", + "integrity": "sha1-TV5DPBhSYd3mI8o/RMWGvPXErRQ=", + "dev": true, + "requires": { + "duplexer": "~0.1.1" + } + }, "stream-combiner2": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", @@ -23398,6 +23686,19 @@ "xml-name-validator": "^3.0.0" } }, + "wait-on": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/wait-on/-/wait-on-5.2.0.tgz", + "integrity": "sha512-U1D9PBgGw2XFc6iZqn45VBubw02VsLwnZWteQ1au4hUVHasTZuFSKRzlTB2dqgLhji16YVI8fgpEpwUdCr8B6g==", + "dev": true, + "requires": { + "axios": "^0.19.2", + "joi": "^17.1.1", + "lodash": "^4.17.19", + "minimist": "^1.2.5", + "rxjs": "^6.5.5" + } + }, "walker": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.7.tgz", diff --git a/web3.js/package.json b/web3.js/package.json index 5a0c0e8803..bf401d0b9f 100644 --- a/web3.js/package.json +++ b/web3.js/package.json @@ -40,8 +40,8 @@ "bpf-sdk:install": "npm run clean:fixtures; bin/bpf-sdk-install.sh .", "bpf-sdk:remove-symlinks": "find bpf-sdk -type l -print -exec cp {} {}.tmp \\; -exec mv {}.tmp {} \\;", "build": "cross-env NODE_ENV=production rollup -c", - "build:fixtures": "./test/fixtures/noop-c/build.sh; ./test/fixtures/noop-rust/build.sh", - "clean:fixtures": "examples/bpf-rust-noop/do.sh clean; make -C examples/bpf-c-noop clean ", + "build:fixtures": "set -ex; ./test/fixtures/noop-c/build.sh; ./test/fixtures/noop-rust/build.sh", + "clean:fixtures": "make -C examples/bpf-c-noop clean ", "clean": "rimraf ./coverage ./lib", "codecov": "set -ex; npm run test:cover; cat ./coverage/lcov.info | codecov", "dev": "cross-env NODE_ENV=development rollup -c", @@ -67,6 +67,7 @@ "test": "npm run build:fixtures && cross-env NODE_ENV=test jest --useStderr", "test:cover": "npm run build:fixtures && cross-env NODE_ENV=test jest --coverage --useStderr", "test:live": "npm run build:fixtures && cross-env NODE_ENV=test TEST_LIVE=1 jest --useStderr", + "test:live-with-test-validator": "start-server-and-test 'solana-test-validator --reset --quiet' http://localhost:8899/health test:live", "test:watch": "npm run build:fixtures && cross-env NODE_ENV=test jest --watch --useStderr" }, "jest": { @@ -139,6 +140,7 @@ "rollup-plugin-replace": "2.2.0", "rollup-plugin-terser": "^7.0.0", "semantic-release": "^17.0.2", + "start-server-and-test": "^1.11.6", "typescript": "^4.0.2", "watch": "^1.0.2" } diff --git a/web3.js/test/connection.test.js b/web3.js/test/connection.test.js index 3cae4ff804..073ed73da6 100644 --- a/web3.js/test/connection.test.js +++ b/web3.js/test/connection.test.js @@ -1388,8 +1388,8 @@ test('get supply', async () => { const supply = (await connection.getSupply()).value; expect(supply.total).toBeGreaterThan(0); expect(supply.circulating).toBeGreaterThan(0); - expect(supply.nonCirculating).toBeGreaterThan(0); - expect(supply.nonCirculatingAccounts.length).toBeGreaterThan(0); + expect(supply.nonCirculating).toBeGreaterThanOrEqual(0); + expect(supply.nonCirculatingAccounts.length).toBeGreaterThanOrEqual(0); }); test('get performance samples', async () => { diff --git a/web3.js/test/fixtures/noop-rust/build.sh b/web3.js/test/fixtures/noop-rust/build.sh index 1fb83d193e..622775f783 100755 --- a/web3.js/test/fixtures/noop-rust/build.sh +++ b/web3.js/test/fixtures/noop-rust/build.sh @@ -3,5 +3,5 @@ set -ex cd "$(dirname "$0")" -../../../examples/bpf-rust-noop/do.sh build -cp ../../../examples/bpf-rust-noop/target/bpfel-unknown-unknown/release/solana_bpf_rust_noop.so . +cargo build-bpf --manifest-path=../../../examples/bpf-rust-noop/Cargo.toml +cp ../../../examples/bpf-rust-noop/target/deploy/solana_bpf_rust_noop.so .