Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added and Enriched basics/hello-solana/seahorse #242

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions basics/hello-solana/seahorse/hello_solana/Anchor.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
[features]
seeds = true
[programs.localnet]
hello_solana = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
hello_solana = "4uQFcoLe2AWRFShXRk18skBzrHJtg8TUHdgjRKHSwDz3"

[registry]
url = "https://anchor.projectserum.com"

[provider]
cluster = "localnet"
wallet = "/home/thefunnyintrovert/.config/solana/id.json"
wallet = "~/.config/solana/id.json"

[scripts]
test = "pnpm ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"

[toolchain]
anchor_version = "0.30.1"
3 changes: 3 additions & 0 deletions basics/hello-solana/seahorse/hello_solana/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ members = [
"programs/*"
]
resolver = "2"

[profile.release]
overflow-checks = true
32 changes: 30 additions & 2 deletions basics/hello-solana/seahorse/hello_solana/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# hello_solana

This project was created by Seahorse 0.1.5.
This project was created by Seahorse 0.2.0. It is a good starting point for using Seahorse, which facilitate Solana developoment in Python.

To get started, just add your code to **programs_py/hello_solana.py** and run `seahorse build`.
To get started, you need to install the Seahorse. Please follow the guidelines highlighted here:
[Seahorse Installation](https://www.seahorse.dev/introduction/installation)

After the installation above, open the terminal and run *solana-test-validator*. This start up a local emulator for Solana network.

<img src="img/solana_test_validator.png" alt="Seahourse Build">

Now, open another terminal and clone the source. Go to ***basics/hello-solana/seahorse/hello_solana***.

You need to compile the code by running *"seahorse build"*. A successful build will generate output as below:

<img src="img/seahorse_build.png" alt="Seahourse Build">

Run *"anchor deploy"* to deploy the complied program to your local Solana network.
Take note of the program Id. Compare the one shown in ***Anchor.toml***.

<img src="img/anchor_deploy.png" alt="Anchor Deploy">

If these 2 IDs are different, update the ID in both the ***programs_py/hello_solan.py*** and ***Anchor.toml***. These IDs have to be the same as the one outputted in *"anchor deploy"*. Save the changes and run *"seahorse build"*, and then *"anchor deploy"* again.

<img src="img/program_id.png" alt="program id">

Run *"anchor run test"*. If things go well, following will be outputted.

<img src="img/anchor_run_test.png" alt="program id">

You might make changes and add your codes to ***programs_py/hello_solana.py***. The **hello()** function is a good example you can refer to when adding your function. Run *"seahorse build"* and *"anchor deploy"* to get your codes deployed to local Solana network.

Add the corresponding test at ***tests/hello_solana.ts***. The section **it('Say hello!', async()=>...** is a good starting point to look at when adding the test for your function. Run *"anchor run test"* to call and test your codes.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[61,149,78,28,158,202,61,28,212,53,63,41,19,128,196,216,249,68,219,142,234,209,19,222,167,220,246,240,112,232,231,119,240,170,230,143,103,37,191,177,11,251,180,183,213,157,168,97,223,58,92,238,72,142,96,110,42,235,16,246,234,237,60,198]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion basics/hello-solana/seahorse/hello_solana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.0"
"@coral-xyz/anchor": "^0.30.0",
"@project-serum/anchor": "^0.26.0"
},
"devDependencies": {
"@types/bn.js": "^5.1.0",
Expand Down
Loading