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 2 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 @@
secret_key = "SDDWPQWJFO7UGGFUBOZ4HZJDPBA62MWY3NUK7QTRL2LOTUVT5J3CRY7H"
59 changes: 58 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,59 @@
🛡️ Welcome to Title Contract

Hello and welcome to Title Contract! 🎉

🚀 What is Title?

Title is a special wallet containing the following crucial data:

Account Admin:
Public Key: GAMPJTSVJSEVX4KKWVY2G7JM66AI6PPQIZMTW2EI6ZVJLEZLMKI7GAFK
Secret Key: SCHWRT7BOMNJPOZECVKWZND2XFMEGVVJ4ILZEPFQIRTCYVPGCGKKFAIA

This contract is the guardian that decides who can change the character associated with the wallet. Only those who know "the magic trick" will have that power.
🛠️ Project Setup
1. Environment Configuration readme soroban-react-dapp

First, ensure that Soroban is set up in your environment. If you haven’t done so yet, you can add the admin identity by running:

bash

soroban config identity add --secret-key admin

And, of course, you’ll need to input the secret key for Title (listed above).
2. Build and Testnet

Next, build and deploy the contract on the testnet. Simply run:

bash

yarn deploy testnet title
PrincesoDan marked this conversation as resolved.
Show resolved Hide resolved
PrincesoDan marked this conversation as resolved.
Show resolved Hide resolved

yarn testtitle testnet

This should execute like so:

bash

root@3b15f88a2fa0:/workspace/contracts# yarn testtitle testnet

3. Launch the Application

Now that the contract is set up, it’s time to see the magic in action. Start the application with:

bash

yarn dev

Watch what happens and get ready to explore!
4. Freight Configuration

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

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


# 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 +152,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": "CAS3V3WZFZYQMHFXRJJOCYT2JMLO6CFZSIQK64NN4WR3WN4OB5TXV3XL"
esteblock marked this conversation as resolved.
Show resolved Hide resolved
}
]
228 changes: 228 additions & 0 deletions soroban-react-dapp/contracts/greeting/test_snapshots/test/test.1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"generators": {
"address": 1,
"nonce": 0
},
"auth": [
[],
[],
[]
],
"ledger": {
"protocol_version": 21,
"sequence_number": 0,
"timestamp": 0,
"network_id": "0000000000000000000000000000000000000000000000000000000000000000",
"base_reserve": 0,
"min_persistent_entry_ttl": 4096,
"min_temp_entry_ttl": 16,
"max_entry_ttl": 6312000,
"ledger_entries": [
[
{
"contract_data": {
"contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM",
"key": "ledger_key_contract_instance",
"durability": "persistent"
}
},
[
{
"last_modified_ledger_seq": 0,
"data": {
"contract_data": {
"ext": "v0",
"contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM",
"key": "ledger_key_contract_instance",
"durability": "persistent",
"val": {
"contract_instance": {
"executable": {
"wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
},
"storage": [
{
"key": {
"symbol": "TITLE"
},
"val": {
"string": "My New Title"
}
}
]
}
}
}
},
"ext": "v0"
},
4095
]
],
[
{
"contract_code": {
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
}
},
[
{
"last_modified_ledger_seq": 0,
"data": {
"contract_code": {
"ext": "v0",
"hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"code": ""
}
},
"ext": "v0"
},
4095
]
]
]
},
"events": [
{
"event": {
"ext": "v0",
"contract_id": null,
"type_": "diagnostic",
"body": {
"v0": {
"topics": [
{
"symbol": "fn_call"
},
{
"bytes": "0000000000000000000000000000000000000000000000000000000000000001"
},
{
"symbol": "read_title"
}
],
"data": "void"
}
}
},
"failed_call": false
},
{
"event": {
"ext": "v0",
"contract_id": "0000000000000000000000000000000000000000000000000000000000000001",
"type_": "diagnostic",
"body": {
"v0": {
"topics": [
{
"symbol": "fn_return"
},
{
"symbol": "read_title"
}
],
"data": {
"string": "Default Title"
}
}
}
},
"failed_call": false
},
{
"event": {
"ext": "v0",
"contract_id": null,
"type_": "diagnostic",
"body": {
"v0": {
"topics": [
{
"symbol": "fn_call"
},
{
"bytes": "0000000000000000000000000000000000000000000000000000000000000001"
},
{
"symbol": "set_title"
}
],
"data": {
"string": "My New Title"
}
}
}
},
"failed_call": false
},
{
"event": {
"ext": "v0",
"contract_id": "0000000000000000000000000000000000000000000000000000000000000001",
"type_": "diagnostic",
"body": {
"v0": {
"topics": [
{
"symbol": "fn_return"
},
{
"symbol": "set_title"
}
],
"data": "void"
}
}
},
"failed_call": false
},
{
"event": {
"ext": "v0",
"contract_id": null,
"type_": "diagnostic",
"body": {
"v0": {
"topics": [
{
"symbol": "fn_call"
},
{
"bytes": "0000000000000000000000000000000000000000000000000000000000000001"
},
{
"symbol": "read_title"
}
],
"data": "void"
}
}
},
"failed_call": false
},
{
"event": {
"ext": "v0",
"contract_id": "0000000000000000000000000000000000000000000000000000000000000001",
"type_": "diagnostic",
"body": {
"v0": {
"topics": [
{
"symbol": "fn_return"
},
{
"symbol": "read_title"
}
],
"data": {
"string": "My New Title"
}
}
}
},
"failed_call": false
}
]
}
3 changes: 2 additions & 1 deletion soroban-react-dapp/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"type": "module",
"scripts": {
"build": "tsc",
"deploy": "yarn build && node dist/scripts/deploy.js"
"deploy": "yarn build && node dist/scripts/deploy.js",
"testtitle": "yarn build && node dist/scripts/test_title.js"
PrincesoDan marked this conversation as resolved.
Show resolved Hide resolved
},
"license": "MIT",
"devDependencies": {
Expand Down
Loading