From 4fc5f4c1416685ee502369da231755235c491ed3 Mon Sep 17 00:00:00 2001 From: Tabish Shaikh Date: Thu, 28 Nov 2024 15:44:37 +0530 Subject: [PATCH] fix: take address from cli for tictactoe frontend (#275) * fix: add address from cli * error: if address not passed * Delete examples/tictactoe/yarn.lock * Delete examples/tictactoe/package-lock.json --- examples/tictactoe/package.json | 4 ++-- examples/tictactoe/src/constants/tictactoe.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/tictactoe/package.json b/examples/tictactoe/package.json index cbd7f71b..33a57c83 100644 --- a/examples/tictactoe/package.json +++ b/examples/tictactoe/package.json @@ -4,8 +4,8 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite", - "build": "tsc -b && vite build", + "dev": "test -n \"$npm_config_address\" && TICTACTOE_ADDRESS=$npm_config_address vite || (echo 'Error: --address parameter is required' && exit 1)", + "build": "test -n \"$npm_config_address\" && TICTACTOE_ADDRESS=$npm_config_address tsc -b && vite build || (echo 'Error: --address parameter is required' && exit 1)", "lint": "eslint .", "preview": "vite preview" }, diff --git a/examples/tictactoe/src/constants/tictactoe.ts b/examples/tictactoe/src/constants/tictactoe.ts index 8a901941..adf572b3 100644 --- a/examples/tictactoe/src/constants/tictactoe.ts +++ b/examples/tictactoe/src/constants/tictactoe.ts @@ -1,4 +1,4 @@ -export const address = '0x81D8CB015e36922F7ecC5CEAdd018dc7327e6FC7' +export const address = import.meta.env.TICTACTOE_ADDRESS export const abi = [ {