Skip to content

Commit

Permalink
fix dev mod for passport sample sdk (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
shineli1984 committed Jul 19, 2024
1 parent 1914698 commit e2bf08e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
7 changes: 6 additions & 1 deletion dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:"
Expand All @@ -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
Expand Down
16 changes: 9 additions & 7 deletions packages/passport/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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`.

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`.
4 changes: 2 additions & 2 deletions packages/passport/sdk-sample-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit e2bf08e

Please sign in to comment.