Skip to content

Commit

Permalink
Revert "add: Redirect to main docs for hello world (#612)" (#613)
Browse files Browse the repository at this point in the history
This reverts commit e496783.
  • Loading branch information
jacobcreech authored Jul 20, 2023
1 parent e496783 commit a765fda
Show file tree
Hide file tree
Showing 34 changed files with 12,116 additions and 1 deletion.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/

This comment has been minimized.

Copy link
@keshavishwakarma
32 changes: 32 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"root": true,
"env": {
"node": true,
"browser": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"prettier",
"prettier/@typescript-eslint"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"parser": "babel-eslint",
"project": "./tsconfig.json",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"no-console": 0,
"semi": 0,
"@typescript-eslint/no-explicit-any": 0
}
}

48 changes: 48 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: 2
updates:
- package-ecosystem: cargo
directory: "/src/program-rust"
schedule:
interval: daily
time: "01:00"
timezone: America/Los_Angeles
labels:
- "automerge"
open-pull-requests-limit: 3
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "01:00"
timezone: America/Los_Angeles
labels:
- "automerge"
open-pull-requests-limit: 3
ignore:
- dependency-name: eslint-config-prettier
versions:
- "> 6.15.0"
- dependency-name: eslint
versions:
- 7.25.0
- dependency-name: "@typescript-eslint/parser"
versions:
- 4.14.1
- 4.14.2
- 4.15.0
- 4.18.0
- 4.19.0
- 4.20.0
- 4.21.0
- dependency-name: "@types/eslint"
versions:
- 7.2.6
- dependency-name: "@typescript-eslint/eslint-plugin"
versions:
- 4.14.1
- 4.14.2
- 4.15.0
- dependency-name: "@types/prettier"
versions:
- 2.1.6
- 2.2.0
51 changes: 51 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Hello Example
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
Build:
runs-on: ubuntu-20.04
steps:
- name: multiple paths
uses: actions/cache@v2
with:
path: ~/.npm
key: '${{ runner.os }}-${{ hashFiles(''TODO'') }}'
- uses: actions/checkout@v2
- run: |
rustup install stable
cargo --version
docker --version
- run: >-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- run: >-
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
- run: |
sudo apt-get update
sudo apt-get install -y openssl --allow-unauthenticated
sudo apt-get install -y libssl-dev --allow-unauthenticated
sudo apt-get install -y clang-7 --allow-unauthenticated
sudo apt-get install -y libssl1.1 --allow-unauthenticated
clang-7 --version
npm install node
node --version
npm install
sh -c "$(curl -sSfL https://release.solana.com/v1.8.14/install)"
export PATH=~/.local/share/solana/install/active_release/bin:$PATH
solana-install info
solana-keygen new --no-bip39-passphrase
solana-test-validator --quiet &
npm run lint
npm run build:program-rust
npm run test:program-rust
cargo test-bpf --manifest-path=./src/program-rust/Cargo.toml
solana config set --url http://127.0.0.1:8899
solana program deploy dist/program/helloworld.so
npm run start
npm run build:program-c
solana program deploy dist/program/helloworld.so
npm run start
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/node_modules
*.sw[po]
/.cargo
/dist
.env
src/client/util/store
test-ledger/
.DS_Store
33 changes: 33 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
tasks:
- init: |
sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
export PATH="/home/gitpod/.local/share/solana/install/active_release/bin:$PATH"
eval $(gp env -e PATH=$HOME/.local/share/solana/install/active_release/bin:$PATH)
npm install
npm run build:program-rust
command: |
gp open README-gitpod.md
solana-keygen new --no-bip39-passphrase -o keypair.json
solana config set --keypair keypair.json
solana config set --url localhost
github:
prebuilds:
# enable for the master/default branch (defaults to true)
master: true
# enable for all branches in this repo (defaults to false)
branches: false
# enable for pull requests coming from this repo (defaults to true)
pullRequests: true
# add a check to pull requests (defaults to true)
addCheck: true
# add a "Review in Gitpod" button as a comment to pull requests (defaults to false)
addComment: true
ports:
- port: 1024
onOpen: ignore
- port: 8899
onOpen: ignore
- port: 8900
onOpen: ignore
- port: 9900
onOpen: ignore
22 changes: 22 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pull_request_rules:
- name: automatic merge on CI success
conditions:
- status-success=Build
- label=automerge
actions:
merge:
method: rebase
- name: remove automerge label on CI failure
conditions:
- status-failure=Build
- label=automerge
actions:
label:
remove:
- automerge
- name: remove outdated reviews
conditions:
- base=master
actions:
dismiss_reviews:
changes_requested: true
6 changes: 6 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
arrowParens: "avoid"
bracketSpacing: false
semi: true
singleQuote: true
tabWidth: 2
trailingComma: "all"
4 changes: 4 additions & 0 deletions .theia/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"workbench.iconTheme": "theia-file-icons",
"preview.openByDefault": true
}
44 changes: 44 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
dist: bionic
sudo: required
language: rust
services:
- docker
cache:
cargo: true
directories:
- "~/.npm"
notifications:
email: false

install:
- rustup install nightly
- cargo --version
- docker --version
- wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
- sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-10 main"
- sudo apt-get update
- sudo apt-get install -y clang-7 --allow-unauthenticated
- 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
- nvm install node
- node --version
- npm install
- sh -c "$(curl -sSfL https://release.solana.com/v1.10.35/install)"
- export PATH=~/.local/share/solana/install/active_release/bin:$PATH
- solana-install info

script:
- solana-keygen new --no-bip39-passphrase
- solana-test-validator --quiet &
- npm run lint
- npm run build:program-rust
- npm run test:program-rust
- cargo test-bpf --manifest-path=./src/program-rust/Cargo.toml
- solana config set --url localhost
- solana program deploy dist/program/helloworld.so
- npm run start
- npm run build:program-c
- solana program deploy dist/program/helloworld.so
- npm run start
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2018 Solana Labs, Inc

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
67 changes: 67 additions & 0 deletions README-gitpod.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[![Build status][travis-image]][travis-url] [![Gitpod
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)


[travis-image]:
https://travis-ci.org/solana-labs/example-helloworld.svg?branch=master
[travis-url]: https://travis-ci.org/solana-labs/example-helloworld

# Hello world on Solana (Gitpod version)

This project demonstrates how to use the [Solana Javascript
API](https://github.com/solana-labs/solana-web3.js) to build, deploy, and
interact with programs on the Solana blockchain.

The project comprises of:

* An on-chain hello world program
* A client that can send a "hello" to an account and get back the number of
times "hello" has been sent

## Table of Contents
- [Hello world on Solana (Gitpod
version)](#hello-world-on-solana-gitpod-version)
- [Table of Contents](#table-of-contents)
- [Quick Start](#quick-start)
- [Expected output](#expected-output)
- [Customizing the Program](#customizing-the-program)
- [Learn about Solana](#learn-about-solana)
- [Learn about the client](#learn-about-the-client)
- [Learn about the on-chain program](#learn-about-the-on-chain-program)
- [Expand your skills with advanced
examples](#expand-your-skills-with-advanced-examples)

## Quick Start

Using this example in Gitpod connects to the public Solana `devnet` cluster. Use
the environment variable `CLUSTER` to choose a different Solana cluster.

Start a local Solana cluster:
```bash
solana-test-validator
```

Deploy the on-chain program:
```bash
solana program deploy ./dist/program/helloworld.so
```

Run the client to load and interact with the on-chain program:
```bash
npm run start
```

The remaining sections of this document point back to the non-Gitpod version of
the README for more information.

### [Expected output](README.md#expected-output)

### [Customizing the Program](README.md#Customizing-the-Program)

## [Learn about Solana](README.md#learn-about-solana)

## [Learn about the client](README.md#learn-about-the-client)

## [Learn about the on-chain program](README.md#learn-about-the-on-chain-program)

## [Expand your skills with advanced examples](README.md#expand-your-skills-with-advanced-examples)
34 changes: 34 additions & 0 deletions README-installation-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Installation Notes
if you are a first-time user of Rust, the notes below may help you to install
some of the dependencies on a Mac or Linux workstation.

### Rust
We suggest that you install Rust using the 'rustup' tool. Rustup will install
the latest version of Rust, Cargo, and the other binaries used in Solana.

Follow the instructions at [Installing
Rust](https://www.rust-lang.org/tools/install).

For Mac users, Homebrew is also an option. The Mac Homebrew command is `brew
install rustup` and then `rustup-init`. See [Mac
Setup](https://sourabhbajaj.com/mac-setup/Rust/) & [Installing
Rust](https://www.rust-lang.org/tools/install) for more details.

After installation, you should have `rustc`, `cargo`, & `rustup`. You should
also have `~/.cargo/bin` in your PATH environment variable.

### NodeJS/NPM
Fetch the `npm` dependencies, including `@solana/web3.js`, by running:
```bash
$ npm install
```

### Git Repository
Clone the 'example-helloworld' repository into your development machine:
```bash
$ cd /path/to/your/work/folder/
$ git clone https://github.com/solana-labs/example-helloworld.git
$ cd example-helloworld
```
(If you plan to submit changes in a pull request, be sure to create a fork first
and then clone your fork.)
Loading

0 comments on commit a765fda

Please sign in to comment.