Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit a765fda

Browse files
authored
Revert "add: Redirect to main docs for hello world (#612)" (#613)
This reverts commit e496783.
1 parent e496783 commit a765fda

34 files changed

+12116
-1
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dist/

.eslintrc.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"root": true,
3+
"env": {
4+
"node": true,
5+
"browser": true
6+
},
7+
"extends": [
8+
"eslint:recommended",
9+
"plugin:@typescript-eslint/eslint-recommended",
10+
"plugin:@typescript-eslint/recommended",
11+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
12+
"prettier",
13+
"prettier/@typescript-eslint"
14+
],
15+
"parser": "@typescript-eslint/parser",
16+
"parserOptions": {
17+
"ecmaVersion": 2020,
18+
"parser": "babel-eslint",
19+
"project": "./tsconfig.json",
20+
"sourceType": "module"
21+
},
22+
"plugins": [
23+
"@typescript-eslint",
24+
"prettier"
25+
],
26+
"rules": {
27+
"no-console": 0,
28+
"semi": 0,
29+
"@typescript-eslint/no-explicit-any": 0
30+
}
31+
}
32+

.github/dependabot.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: cargo
4+
directory: "/src/program-rust"
5+
schedule:
6+
interval: daily
7+
time: "01:00"
8+
timezone: America/Los_Angeles
9+
labels:
10+
- "automerge"
11+
open-pull-requests-limit: 3
12+
- package-ecosystem: npm
13+
directory: "/"
14+
schedule:
15+
interval: daily
16+
time: "01:00"
17+
timezone: America/Los_Angeles
18+
labels:
19+
- "automerge"
20+
open-pull-requests-limit: 3
21+
ignore:
22+
- dependency-name: eslint-config-prettier
23+
versions:
24+
- "> 6.15.0"
25+
- dependency-name: eslint
26+
versions:
27+
- 7.25.0
28+
- dependency-name: "@typescript-eslint/parser"
29+
versions:
30+
- 4.14.1
31+
- 4.14.2
32+
- 4.15.0
33+
- 4.18.0
34+
- 4.19.0
35+
- 4.20.0
36+
- 4.21.0
37+
- dependency-name: "@types/eslint"
38+
versions:
39+
- 7.2.6
40+
- dependency-name: "@typescript-eslint/eslint-plugin"
41+
versions:
42+
- 4.14.1
43+
- 4.14.2
44+
- 4.15.0
45+
- dependency-name: "@types/prettier"
46+
versions:
47+
- 2.1.6
48+
- 2.2.0

.github/workflows/main.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Hello Example
2+
on:
3+
push:
4+
branches:
5+
- master
6+
pull_request:
7+
branches:
8+
- master
9+
jobs:
10+
Build:
11+
runs-on: ubuntu-20.04
12+
steps:
13+
- name: multiple paths
14+
uses: actions/cache@v2
15+
with:
16+
path: ~/.npm
17+
key: '${{ runner.os }}-${{ hashFiles(''TODO'') }}'
18+
- uses: actions/checkout@v2
19+
- run: |
20+
rustup install stable
21+
cargo --version
22+
docker --version
23+
- run: >-
24+
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
25+
- run: >-
26+
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
27+
- run: |
28+
sudo apt-get update
29+
sudo apt-get install -y openssl --allow-unauthenticated
30+
sudo apt-get install -y libssl-dev --allow-unauthenticated
31+
sudo apt-get install -y clang-7 --allow-unauthenticated
32+
sudo apt-get install -y libssl1.1 --allow-unauthenticated
33+
clang-7 --version
34+
npm install node
35+
node --version
36+
npm install
37+
sh -c "$(curl -sSfL https://release.solana.com/v1.8.14/install)"
38+
export PATH=~/.local/share/solana/install/active_release/bin:$PATH
39+
solana-install info
40+
solana-keygen new --no-bip39-passphrase
41+
solana-test-validator --quiet &
42+
npm run lint
43+
npm run build:program-rust
44+
npm run test:program-rust
45+
cargo test-bpf --manifest-path=./src/program-rust/Cargo.toml
46+
solana config set --url http://127.0.0.1:8899
47+
solana program deploy dist/program/helloworld.so
48+
npm run start
49+
npm run build:program-c
50+
solana program deploy dist/program/helloworld.so
51+
npm run start

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/node_modules
2+
*.sw[po]
3+
/.cargo
4+
/dist
5+
.env
6+
src/client/util/store
7+
test-ledger/
8+
.DS_Store

.gitpod.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
tasks:
2+
- init: |
3+
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
4+
export PATH="/home/gitpod/.local/share/solana/install/active_release/bin:$PATH"
5+
eval $(gp env -e PATH=$HOME/.local/share/solana/install/active_release/bin:$PATH)
6+
npm install
7+
npm run build:program-rust
8+
command: |
9+
gp open README-gitpod.md
10+
solana-keygen new --no-bip39-passphrase -o keypair.json
11+
solana config set --keypair keypair.json
12+
solana config set --url localhost
13+
github:
14+
prebuilds:
15+
# enable for the master/default branch (defaults to true)
16+
master: true
17+
# enable for all branches in this repo (defaults to false)
18+
branches: false
19+
# enable for pull requests coming from this repo (defaults to true)
20+
pullRequests: true
21+
# add a check to pull requests (defaults to true)
22+
addCheck: true
23+
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
24+
addComment: true
25+
ports:
26+
- port: 1024
27+
onOpen: ignore
28+
- port: 8899
29+
onOpen: ignore
30+
- port: 8900
31+
onOpen: ignore
32+
- port: 9900
33+
onOpen: ignore

.mergify.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
pull_request_rules:
2+
- name: automatic merge on CI success
3+
conditions:
4+
- status-success=Build
5+
- label=automerge
6+
actions:
7+
merge:
8+
method: rebase
9+
- name: remove automerge label on CI failure
10+
conditions:
11+
- status-failure=Build
12+
- label=automerge
13+
actions:
14+
label:
15+
remove:
16+
- automerge
17+
- name: remove outdated reviews
18+
conditions:
19+
- base=master
20+
actions:
21+
dismiss_reviews:
22+
changes_requested: true

.prettierrc.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
arrowParens: "avoid"
2+
bracketSpacing: false
3+
semi: true
4+
singleQuote: true
5+
tabWidth: 2
6+
trailingComma: "all"

.theia/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"workbench.iconTheme": "theia-file-icons",
3+
"preview.openByDefault": true
4+
}

.travis.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
dist: bionic
2+
sudo: required
3+
language: rust
4+
services:
5+
- docker
6+
cache:
7+
cargo: true
8+
directories:
9+
- "~/.npm"
10+
notifications:
11+
email: false
12+
13+
install:
14+
- rustup install nightly
15+
- cargo --version
16+
- docker --version
17+
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
18+
- sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
19+
- sudo apt-get update
20+
- sudo apt-get install -y clang-7 --allow-unauthenticated
21+
- sudo apt-get install -y openssl --allow-unauthenticated
22+
- sudo apt-get install -y libssl-dev --allow-unauthenticated
23+
- sudo apt-get install -y libssl1.1 --allow-unauthenticated
24+
- clang-7 --version
25+
- nvm install node
26+
- node --version
27+
- npm install
28+
- sh -c "$(curl -sSfL https://release.solana.com/v1.10.35/install)"
29+
- export PATH=~/.local/share/solana/install/active_release/bin:$PATH
30+
- solana-install info
31+
32+
script:
33+
- solana-keygen new --no-bip39-passphrase
34+
- solana-test-validator --quiet &
35+
- npm run lint
36+
- npm run build:program-rust
37+
- npm run test:program-rust
38+
- cargo test-bpf --manifest-path=./src/program-rust/Cargo.toml
39+
- solana config set --url localhost
40+
- solana program deploy dist/program/helloworld.so
41+
- npm run start
42+
- npm run build:program-c
43+
- solana program deploy dist/program/helloworld.so
44+
- npm run start

LICENSE

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2018 Solana Labs, Inc
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README-gitpod.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
[![Build status][travis-image]][travis-url] [![Gitpod
2+
Ready-to-Code](https://img.shields.io/badge/Gitpod-Ready--to--Code-blue?logo=gitpod)](https://gitpod.io/#https://github.com/solana-labs/example-helloworld)
3+
4+
5+
[travis-image]:
6+
https://travis-ci.org/solana-labs/example-helloworld.svg?branch=master
7+
[travis-url]: https://travis-ci.org/solana-labs/example-helloworld
8+
9+
# Hello world on Solana (Gitpod version)
10+
11+
This project demonstrates how to use the [Solana Javascript
12+
API](https://github.com/solana-labs/solana-web3.js) to build, deploy, and
13+
interact with programs on the Solana blockchain.
14+
15+
The project comprises of:
16+
17+
* An on-chain hello world program
18+
* A client that can send a "hello" to an account and get back the number of
19+
times "hello" has been sent
20+
21+
## Table of Contents
22+
- [Hello world on Solana (Gitpod
23+
version)](#hello-world-on-solana-gitpod-version)
24+
- [Table of Contents](#table-of-contents)
25+
- [Quick Start](#quick-start)
26+
- [Expected output](#expected-output)
27+
- [Customizing the Program](#customizing-the-program)
28+
- [Learn about Solana](#learn-about-solana)
29+
- [Learn about the client](#learn-about-the-client)
30+
- [Learn about the on-chain program](#learn-about-the-on-chain-program)
31+
- [Expand your skills with advanced
32+
examples](#expand-your-skills-with-advanced-examples)
33+
34+
## Quick Start
35+
36+
Using this example in Gitpod connects to the public Solana `devnet` cluster. Use
37+
the environment variable `CLUSTER` to choose a different Solana cluster.
38+
39+
Start a local Solana cluster:
40+
```bash
41+
solana-test-validator
42+
```
43+
44+
Deploy the on-chain program:
45+
```bash
46+
solana program deploy ./dist/program/helloworld.so
47+
```
48+
49+
Run the client to load and interact with the on-chain program:
50+
```bash
51+
npm run start
52+
```
53+
54+
The remaining sections of this document point back to the non-Gitpod version of
55+
the README for more information.
56+
57+
### [Expected output](README.md#expected-output)
58+
59+
### [Customizing the Program](README.md#Customizing-the-Program)
60+
61+
## [Learn about Solana](README.md#learn-about-solana)
62+
63+
## [Learn about the client](README.md#learn-about-the-client)
64+
65+
## [Learn about the on-chain program](README.md#learn-about-the-on-chain-program)
66+
67+
## [Expand your skills with advanced examples](README.md#expand-your-skills-with-advanced-examples)

README-installation-notes.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Installation Notes
2+
if you are a first-time user of Rust, the notes below may help you to install
3+
some of the dependencies on a Mac or Linux workstation.
4+
5+
### Rust
6+
We suggest that you install Rust using the 'rustup' tool. Rustup will install
7+
the latest version of Rust, Cargo, and the other binaries used in Solana.
8+
9+
Follow the instructions at [Installing
10+
Rust](https://www.rust-lang.org/tools/install).
11+
12+
For Mac users, Homebrew is also an option. The Mac Homebrew command is `brew
13+
install rustup` and then `rustup-init`. See [Mac
14+
Setup](https://sourabhbajaj.com/mac-setup/Rust/) & [Installing
15+
Rust](https://www.rust-lang.org/tools/install) for more details.
16+
17+
After installation, you should have `rustc`, `cargo`, & `rustup`. You should
18+
also have `~/.cargo/bin` in your PATH environment variable.
19+
20+
### NodeJS/NPM
21+
Fetch the `npm` dependencies, including `@solana/web3.js`, by running:
22+
```bash
23+
$ npm install
24+
```
25+
26+
### Git Repository
27+
Clone the 'example-helloworld' repository into your development machine:
28+
```bash
29+
$ cd /path/to/your/work/folder/
30+
$ git clone https://github.com/solana-labs/example-helloworld.git
31+
$ cd example-helloworld
32+
```
33+
(If you plan to submit changes in a pull request, be sure to create a fork first
34+
and then clone your fork.)

0 commit comments

Comments
 (0)