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

"My first dapp, check readme" #59

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions soroban-react-dapp/.soroban/identity/admin.toml
PrincesoDan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 2 additions & 0 deletions soroban-react-dapp/.soroban/network/testnet.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rpc_url = "https://soroban-testnet.stellar.org/"
network_passphrase = "Test SDF Network ; September 2015"
136 changes: 135 additions & 1 deletion soroban-react-dapp/README.md
PrincesoDan marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,136 @@
🛡️ Welcome to Title Contract

Hello and welcome to Title Contract! 🎉
🚀 What is Title?

This contract acts as the guardian, controlling who can modify the character associated with this wallet. Only those with the "magic trick" will have the power to make changes.
🛠️ Project Setup

1. Clone the Repository:

Follow the instructions here: Manual Cloning:

https://create-soroban-dapp.paltalabs.io/create-soroban-dapp/manual_cloning.html

Navigate to the Project Directory:

bash

cd soroban-react-dapp

2. Set Up Your Secrets:

When deploying contracts, you’ll need the secret key of the deployer account. Store this key in a file located at ./contracts/.env.

To set up your secrets, run:

bash

cp contracts/.env.example contracts/.env

If you’re already in the contracts folder (e.g., inside the Docker container), run:

bash

cp .env.example .env

Edit the .env file to include your secret keys and RPC URLs. The file should look like this:

plaintext

# Stellar accounts Secret Keys
ADMIN_SECRET_KEY=

# RPC Setup
MAINNET_RPC_URL=https://mainnet.stellar.validationcloud.io/v1/3uELU0BKP-ARJhn6hngelkg5Y24i8xGgUA9QtB8KsYc

USER_1=
USER_2=
USER_3=
NEW_ADMIN=

You can generate new accounts and private keys from Stellar Laboratory. Copy your secret keys into the .env file.

Note: The initial ADMIN will start as the administrator. After executing test_title.txs, the contract’s admin will be NEW_ADMIN, and USER_1 and USER_2 will be authorized to modify the title. Create multiple accounts in Stellar Laboratory or use your own for testing the smart contract.

If you plan to deploy on the mainnet, you'll need a Mainnet RPC Provider. Consider using providers like Validation Cloud or NowNodes.

3. Container Setup:

Navigate to the right directory:

bash

cd soroban-react-dapp/

Bring up the necessary containers:

bash

docker-compose up -d
./run.sh

4. Build and Test Contracts:

Run the following commands:

bash

cd contracts
make build
make test
yarn deploy

You can test the contract by invoking it with the ID shown in the console:

bash

soroban contract invoke --id XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --source admin --network testnet

For testnet:

bash

soroban config network add --rpc-url https://soroban-testnet.stellar.org/ --network-passphrase "Test SDF Network ; September 2015" testnet

5. Execute the Test Title:

Run:

bash

yarn testtitle testnet

Run the Frontend:

6. Navigate back and start the development server:

bash

cd ..
yarn dev

Watch what happens and get ready to explore!

7. Freight Configuration:

Don’t forget to configure Freight with Title to efficiently manage your tests.

8. Additional Testing:

Finally, add more test addresses to ensure that only those chosen by Title can modify the character. Test the security of your contract and enjoy the process!

Extra: Stopping the Containers:

When you’re finished, you can stop the containers by running:

bash

docker-compose down

###################################################################################


# Welcome to your soroban react dapp boilerplate!

This dapp largely inspired by the [ink!athon](https://github.com/scio-labs/inkathon) project will help you kickstart your soroban dapp creator journey.
Expand Down Expand Up @@ -96,4 +229,5 @@ You then need to adapt the `contractInvoke()` calls in these functions to match

Finally feel, of course, free to change the front-end how you wish, to match your desired functionalities.

*Good luck building!*
*Good luck building!*

5 changes: 0 additions & 5 deletions soroban-react-dapp/contracts/.env.example

This file was deleted.

7 changes: 6 additions & 1 deletion soroban-react-dapp/contracts/deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
{
"contractId": "greeting",
"networkPassphrase": "Test SDF Network ; September 2015",
"contractAddress": "CDWGVPSUXXSGABQ663FVV4TZJH4Q2R3HVAKTKWFFFMWPF23O7KMNS4KU"
"contractAddress": "CBYZPXMH3T7S6SAATE66NPA6JOIWE6NPYLVPFTOS73VGKPIHLW2MFDKE"
},
{
"contractId": "title",
"networkPassphrase": "Test SDF Network ; September 2015",
"contractAddress": "CACLC6ZO3XLNJF2X6KDLFHHNSOYINOETOV7ABKVN2EQPWKGAYB7IYPPR"
}
]
Loading