diff --git a/README.md b/README.md index b2990a1..4699dfd 100644 --- a/README.md +++ b/README.md @@ -47,73 +47,3 @@ cargo run --bin gol -- create-puzzles bash -e -x <(linera extract-script-from-markdown backend/README.md) ``` - -## Testing scores against the production app - -Run the commands below using `bash -e -x <(linera extract-script-from-markdown README.md)`. - -```bash -# Production app -APP_ID=750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace - -# Scoring chains -CHAIN_0=1b2a5089b0b8cd0971aca985f1819ebb2f23088aca5f864cc99a2666585226ad -CHAIN_1=f30e18278e8cf01ff39d44b856782805b5b22ca5c5dec19ca4694a724cdbf1cd -CHAIN_2=7cc367a5baebdb26f82c4d1753736319cb9bfe1aa920d6a894e93bfc597e2377 -CHAIN_3=e3747adab559105a41e361bc52c141a284b31bc5eb0ef738f37c4f3f8651cb39 - -# Test user and its pinned scoring chain -MATHIEU_CLI="0x359C1a2203aE35adBFA85bC9C1EAB540bF8797a7" -# 2 == 0x359C1a220 % 4 -CHAIN=$CHAIN_2 - -# Getting a chain and tracking the scores -FAUCET_URL=https://faucet.testnet-conway.linera.net - -LINERA_TMP_DIR=$(mktemp -d) -export LINERA_WALLET="$LINERA_TMP_DIR/wallet.json" -export LINERA_KEYSTORE="$LINERA_TMP_DIR/keystore.json" -export LINERA_STORAGE="rocksdb:$LINERA_TMP_DIR/client.db" - -linera wallet init --faucet $FAUCET_URL -linera wallet follow-chain $CHAIN - -linera service --port 8080 & -``` - -```gql,uri=http://localhost:8080/chains/$CHAIN/applications/$APP_ID -query { - reportedSolutions { - entry(key: "$MATHIEU_CLI") { - key - value { - entries(input: {}) { - key - value - } - } - } - } -} -``` - -## Previous scoring chains - -The following chains were used previously and may contain valid scoring information from early users. - -``` -# APP_ID=750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace -CHAIN_V3_0=b4b3575bf33fc466b925b250812bb53147e4013d2be1d629efb7acb172d3c97b -CHAIN_V3_1=ad6dbf944468255c573b4ad36daddbfe03c2de255c471cf8a0bca74e6c044ffd -CHAIN_V3_2=35e0742d9f2171abd0758a334d3f3dbbe2c97567f5d455f0c4fca64a7c6ea3d3 -CHAIN_V3_3=0325662e35fb81d180b532af3083c303878ac60d63d850229c5eddc535dfbb9d - -# APP_ID=750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace -CHAIN_V2_0=74b5850ecf6a7389523f7a9748dc6f81fc71533757f617b65e5c9f01fa1430b8 -CHAIN_V2_1=3e6bdd095d2e4e30f12e8da38ea1409f2442696b01badbda4226577df09479ff -CHAIN_V2_2=78bfe088e0e6ab2acbb894c7bac4b537650a98ca7337667cef38359b6c590508 -CHAIN_V2_3=d6e2e25987b75a51f9ac1df8851bd0e0d16d858e7e2896b1e9d511bac8e13f92 - -# /!\ APP_ID=27145fa604adf9996647a9a2add1dafe8f80f1a547835edf62ee408cd8903dd3 -CHAIN_V1=e71636fde3a70cdbfdb7fd9bef6cb1ba632af8b0567b8f76df47b35489972dd3 -``` diff --git a/frontend/index.html b/frontend/index.html index 82f1537..684c931 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -12,13 +12,6 @@ content="frame-src https://app.dynamicauth.com 'self';" /> -
diff --git a/frontend/package.json b/frontend/package.json index 9978070..b50fd79 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -34,8 +34,7 @@ "@heroui/system": "2.4.20", "@heroui/tabs": "^2.2.21", "@heroui/theme": "2.4.20", - "@linera/client": "0.15.5", - "@linera/signer": "0.15.5", + "@linera/client": "0.15.7", "@react-aria/ssr": "3.9.10", "@react-aria/visually-hidden": "3.8.26", "@tailwindcss/postcss": "4.1.11", diff --git a/frontend/src/lib/linera/constants.ts b/frontend/src/lib/linera/constants.ts index 2babdce..2a1047f 100644 --- a/frontend/src/lib/linera/constants.ts +++ b/frontend/src/lib/linera/constants.ts @@ -2,12 +2,7 @@ export const LINERA_RPC_URL = "https://faucet.testnet-conway.linera.net/"; // Game of Life scoring chain IDs -export const GOL_SCORING_CHAIN_IDS = [ - "1b2a5089b0b8cd0971aca985f1819ebb2f23088aca5f864cc99a2666585226ad", - "f30e18278e8cf01ff39d44b856782805b5b22ca5c5dec19ca4694a724cdbf1cd", - "7cc367a5baebdb26f82c4d1753736319cb9bfe1aa920d6a894e93bfc597e2377", - "e3747adab559105a41e361bc52c141a284b31bc5eb0ef738f37c4f3f8651cb39", -] +export const GOL_SCORING_CHAIN_IDS = [] // Game of Life application ID export const GOL_APP_ID = "750eb4b947761eeece6c52fd488ec23442dce240fab150b93ea2212b014aaace"; diff --git a/frontend/src/lib/linera/lib/linera-adapter.ts b/frontend/src/lib/linera/lib/linera-adapter.ts index fd6e606..b4502e2 100644 --- a/frontend/src/lib/linera/lib/linera-adapter.ts +++ b/frontend/src/lib/linera/lib/linera-adapter.ts @@ -1,4 +1,4 @@ -import initLinera, { Faucet, Client, Wallet, Application } from "@linera/client"; +import { initialize, Faucet, Client, Wallet, Application } from "@linera/client"; import type { Wallet as DynamicWallet } from "@dynamic-labs/sdk-react-core"; import { DynamicSigner } from "./dynamic-signer"; @@ -41,7 +41,7 @@ export class LineraAdapter { console.log("🔗 Connecting with Dynamic wallet:", address); try { - if (!this.wasmInitPromise) this.wasmInitPromise = initLinera(); + if (!this.wasmInitPromise) this.wasmInitPromise = initialize(); await this.wasmInitPromise; console.log("✅ Linera WASM modules initialized successfully"); } catch (e) { @@ -105,7 +105,7 @@ export class LineraAdapter { async setApplications(appId: string, previousAppIds: string[]) { if (!this.provider) throw new Error("Not connected to Linera"); - const application = await this.provider.client.frontend().application(appId); + const application = await this.provider.client.application(appId); if (!application) throw new Error("Failed to get application"); this.application = application; @@ -113,7 +113,7 @@ export class LineraAdapter { const applications = [] for (const appId of previousAppIds) { - const application = await this.provider.client.frontend().application(appId); + const application = await this.provider.client.application(appId); if (!application) throw new Error("Failed to get previous application"); applications.push(application); } diff --git a/frontend/src/lib/linera/services/LineraService.ts b/frontend/src/lib/linera/services/LineraService.ts index 45f6e93..54764e7 100644 --- a/frontend/src/lib/linera/services/LineraService.ts +++ b/frontend/src/lib/linera/services/LineraService.ts @@ -18,7 +18,7 @@ import { export interface WalletInfo { chainId: string; createdAt: string; - scoringChainId: string; + scoringChainId: string | null; } export class LineraService { @@ -50,10 +50,13 @@ export class LineraService { await lineraAdapter.setApplications(GOL_APP_ID, PREVIOUS_GOL_APP_IDS); - const address = lineraAdapter.getAddress(); - const value = Number(address.substring(0, 10)); // top 8 hex digits including 0x - const index = value % GOL_SCORING_CHAIN_IDS.length; - const scoringChainId = GOL_SCORING_CHAIN_IDS[index]; + var scoringChainId = null; + if (GOL_SCORING_CHAIN_IDS.length > 0) { + const address = lineraAdapter.getAddress(); + const value = Number(address.substring(0, 10)); // top 8 hex digits including 0x + const index = value % GOL_SCORING_CHAIN_IDS.length; + scoringChainId = GOL_SCORING_CHAIN_IDS[index]; + } this.walletInfo = { chainId: provider.chainId, @@ -164,7 +167,7 @@ export class LineraService { try { const mutation = { query: ` - mutation SubmitSolution($puzzleId: String!, $board: BoardInput!, $scoringChainId: String!) { + mutation SubmitSolution($puzzleId: String!, $board: BoardInput!, $scoringChainId: String) { submitSolution(puzzleId: $puzzleId, board: $board, scoringChainId: $scoringChainId) } `,