From e2bf08e9866fd7465eb7036194ffd9e25db53fcf Mon Sep 17 00:00:00 2001 From: Shine Li Date: Fri, 19 Jul 2024 16:27:49 +1000 Subject: [PATCH] fix dev mod for passport sample sdk (#1986) --- dev.sh | 7 ++++++- packages/passport/README.md | 16 +++++++++------- packages/passport/sdk-sample-app/package.json | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/dev.sh b/dev.sh index 2485bb068f..44ad4a48d0 100755 --- a/dev.sh +++ b/dev.sh @@ -6,7 +6,7 @@ if [ -z "$1" ]; then echo "" echo "Fetching package list..." # This command might change based on your nx setup. It assumes you can list projects like this. - nx show projects | grep @ | sort | awk '{print NR-1 " " $1}' > /tmp/nx_projects + nx show projects | grep @ | grep -v sample-app | sort | awk '{print NR-1 " " $1}' > /tmp/nx_projects cat /tmp/nx_projects echo "" echo "Enter the number of the project you want to select:" @@ -21,6 +21,11 @@ else PACKAGE_NAME=$1 fi +if echo "$PACKAGE_NAME" | grep -q "sample"; then + echo -e "You are targeting a sample app. Dev mode only supports SDK packages. \nPlease run development script in your sample app instead." + exit 1 +fi + # Run nx commands with the selected or provided package name echo "Running commands for package: $PACKAGE_NAME" nx run $PACKAGE_NAME:d --parallel=5 diff --git a/packages/passport/README.md b/packages/passport/README.md index 3f32bfa342..705f2e4352 100644 --- a/packages/passport/README.md +++ b/packages/passport/README.md @@ -31,9 +31,8 @@ yarn dev Running the Passport SDK Sample App with the Passport SDK supporting hot reloading: ```bash -# Run the Passport SDK first -# Context: passport in ./sdk -yarn dev +# Run dev mode at root +yarn dev @imtbl/passport # Run the Passport SDK Sample App in a new terminal # Context: passport-sdk-sample-app in ./sdk-sample-app @@ -74,24 +73,27 @@ Typechecking: yarn typecheck ``` -### About +### About Passport is a blockchain-based identity and wallet system that caters to the needs of Web3 games. It offers a persistent identity that accompanies users across Web3 games, ensuring a consistent configuration across all applications. Passport also comes equipped with a non-custodial wallet as a default option for each user, ensuring a transaction experience comparable to web2 standards. -The Passport sample application is a simple NextJS web app that provides a basic UI for many of the features in the Passport SDK. It can also be used to locally test any changes to the SDK. +The Passport sample application is a simple NextJS web app that provides a basic UI for many of the features in the Passport SDK. It can also be used to locally test any changes to the SDK. [Read more about the Passport SDK here](../../README.md#passport) ### Sample App Usage #### IMX workflows + For all IMX workflows, you are required to log in with Passport before you can interact. You can do this with the dedicated `Login` button in the `Passport Methods` group, or be prompted when you first click the `Connect` button in the `IMX Workflow` group. if this is your first time setting up Passport, you will need to click the `Register User` button before interacting with any of the other workflows. #### ZkEvm workflows -All ZkEvm workflows except `eth_requestAccounts` and `eth_sendTransaction` do not require you to be logged in and can be executed without having a connected Passport wallet. Specifically for `eth_sendTransaction` however, you must call `eth_requestAccounts` first. + +All ZkEvm workflows except `eth_requestAccounts` and `eth_sendTransaction` do not require you to be logged in and can be executed without having a connected Passport wallet. Specifically for `eth_sendTransaction` however, you must call `eth_requestAccounts` first. Some function calls, such as `eth_gasPrice` and `eth_getBalance` will return a value prefixed by `0x` - these are in hexidecimal format and must be converted to base 10 if you are looking for the actual number. #### Logging out -The sample app will keep authentication tokens in local storage and attempt to silently re-authenticate you if they are expired. If you wish to clear your authentication token in order to change accounts or environments, you can use the `Logout` button under `Passport Methods`. \ No newline at end of file + +The sample app will keep authentication tokens in local storage and attempt to silently re-authenticate you if they are expired. If you wish to clear your authentication token in order to change accounts or environments, you can use the `Logout` button under `Passport Methods`. diff --git a/packages/passport/sdk-sample-app/package.json b/packages/passport/sdk-sample-app/package.json index 3485e06aa4..47236c8dca 100644 --- a/packages/passport/sdk-sample-app/package.json +++ b/packages/passport/sdk-sample-app/package.json @@ -34,8 +34,8 @@ "private": true, "scripts": { "build": "next build", - "d": "next dev", - "dev-with-sdk": "concurrently 'yarn workspace @imtbl/passport-sdk-sample-app dev' 'yarn workspace @imtbl/passport dev'", + "dev": "next dev", + "dev-with-sdk": "concurrently 'yarn dev' 'yarn run --top-level dev @imtbl/passport'", "export": "next export", "lint": "eslint ./src --ext .ts --max-warnings=0", "start": "next start",