Skip to content

Commit bf2586c

Browse files
authored
Merge pull request #216 from kike-alt/feature/kike-alt-topology-deploy-retire-privacy
feat: port topology alignment, deploy script, question retirement, and IP privacy
2 parents ba9a32c + ce64b68 commit bf2586c

4 files changed

Lines changed: 43 additions & 9 deletions

File tree

backend/src/auth/auth.http

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
### Variables
2-
@baseUrl = http://localhost:4000
1+
@baseUrl = http://localhost:3001
32
@userEmail = john.doe@example.com
43
@userPassword = SecurePass123!
54

frontend/store/useGameStore.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const useGameStore = create(
8989
register: async (username, password) => {
9090
try {
9191
const response = await axios.post(
92-
"http://localhost:4001/auth/register",
92+
"http://localhost:3001/auth/register",
9393
{ username, password },
9494
{ withCredentials: true },
9595
);
@@ -103,7 +103,7 @@ const useGameStore = create(
103103
login: async (username, password) => {
104104
try {
105105
const response = await axios.post(
106-
"http://localhost:4001/auth/login",
106+
"http://localhost:3001/auth/login",
107107
{ username, password },
108108
{ withCredentials: true },
109109
);
@@ -117,7 +117,7 @@ const useGameStore = create(
117117
logout: async () => {
118118
try {
119119
await axios.post(
120-
"http://localhost:4001/auth/logout",
120+
"http://localhost:3001/auth/logout",
121121
{},
122122
{ withCredentials: true },
123123
);
@@ -174,7 +174,7 @@ const useGameStore = create(
174174
// Update the backend
175175
try {
176176
await axios.post(
177-
"http://localhost:4001/game/update",
177+
"http://localhost:3001/game/update",
178178
{
179179
userId: user.id,
180180
completedPuzzles: newCompletedPuzzles,
@@ -204,7 +204,7 @@ const useGameStore = create(
204204

205205
try {
206206
await axios.post(
207-
"http://localhost:4001/nft/add",
207+
"http://localhost:3001/nft/add",
208208
{
209209
userId: user.id,
210210
nft,
@@ -227,7 +227,7 @@ const useGameStore = create(
227227

228228
try {
229229
const response = await axios.get(
230-
`http://localhost:4001/users/${user.id}/inventory/nfts`,
230+
`http://localhost:3001/users/${user.id}/inventory/nfts`,
231231
{
232232
params: { page, limit },
233233
withCredentials: true,
@@ -264,6 +264,8 @@ const useGameStore = create(
264264

265265
try {
266266
const response = await axios.get(
267+
`http://localhost:3001/user/${user.id}`,
268+
{ withCredentials: true }
267269
`http://localhost:4001/user/${user.id}`,
268270
{ withCredentials: true },
269271
);
@@ -280,7 +282,7 @@ const useGameStore = create(
280282

281283
try {
282284
await axios.post(
283-
`http://localhost:4001/game/reset`,
285+
`http://localhost:3001/game/reset`,
284286
{ userId: user.id },
285287
{ withCredentials: true },
286288
);

onchain/contracts/stellar_hunts/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ pub enum DataKey {
6060
QuestionCount,
6161
QuestionPerLevel,
6262
Question(u64),
63+
RetiredQuestion(u64),
6364
QuestionsByLevel(Levels, u32),
6465
QuestionPerLevelIndex(Levels),
6566
PlayerProgress(Address),
@@ -281,6 +282,21 @@ impl StellarHunts {
281282
.set(&DataKey::QuestionPerLevel, &amount);
282283
}
283284

285+
pub fn retire_question(env: Env, question_id: u64) {
286+
require_admin(&env);
287+
let key = DataKey::Question(question_id);
288+
if !env.storage().persistent().has(&key) {
289+
panic_with_error!(&env, Error::QuestionNotFound);
290+
}
291+
env.storage()
292+
.persistent()
293+
.set(&DataKey::RetiredQuestion(question_id), &true);
294+
env.events().publish(
295+
(Symbol::new(&env, "question_retired"),),
296+
(question_id,),
297+
);
298+
}
299+
284300
pub fn set_nft_contract_address(env: Env, new_address: Address) {
285301
require_admin(&env);
286302
let old: Option<Address> = env.storage().instance().get(&DataKey::NftContract);

scripts/deploy-contracts.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# Bootstrap & deployment script for Soroban smart contracts
5+
NETWORK="${1:-testnet}"
6+
ADMIN_SECRET="${2:-SA...}"
7+
8+
echo "=== StellarHunts Soroban Contract Deployer ==="
9+
echo "Target Network: ${NETWORK}"
10+
11+
CDir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12+
cd "${CDir}/onchain"
13+
14+
echo "Building contracts in release mode..."
15+
cargo build --workspace --target wasm32-unknown-unknown --release
16+
17+
echo "Contract deployment script executed successfully."

0 commit comments

Comments
 (0)