Skip to content

Commit

Permalink
Rename example names and update readme (#996)
Browse files Browse the repository at this point in the history
* Rename example names and update readme

* Commit abi files for next example

* Rename vercel project name

---------

Co-authored-by: Luca Steeb <[email protected]>
  • Loading branch information
JunichiSugiura and steebchen authored Nov 7, 2024
1 parent 4f800c2 commit 1579f50
Show file tree
Hide file tree
Showing 48 changed files with 63 additions and 37 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ jobs:
steps.vars.outputs.sha_short }}.preview.cartridge.gg --scope=cartridge
--token=${{ secrets.VERCEL_TOKEN }}

cartridge-starknet-react-next:
controller-example-next:
runs-on: ubuntu-latest
env:
VERCEL_PROJECT_ID: "cartridge-starknet-react-next"
VERCEL_PROJECT_ID: "controller-example-next"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -296,8 +296,8 @@ jobs:
- name: Build Project Artifacts (Preview)
if: github.ref != 'refs/heads/main'
run: |
echo "NEXT_PUBLIC_KEYCHAIN_DEPLOYMENT_URL=https://keychain-${{ steps.vars.outputs.sha_short }}.preview.cartridge.gg" >> ./examples/starknet-react-next/.env.local
echo "NEXT_PUBLIC_PROFILE_DEPLOYMENT_URL=https://profile-${{ steps.vars.outputs.sha_short }}.preview.cartridge.gg" >> ./examples/starknet-react-next/.env.local
echo "NEXT_PUBLIC_KEYCHAIN_DEPLOYMENT_URL=https://keychain-${{ steps.vars.outputs.sha_short }}.preview.cartridge.gg" >> ./examples/next/.env.local
echo "NEXT_PUBLIC_PROFILE_DEPLOYMENT_URL=https://profile-${{ steps.vars.outputs.sha_short }}.preview.cartridge.gg" >> ./examples/next/.env.local
pnpm vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts (Production)
if: github.ref == 'refs/heads/main'
Expand Down
62 changes: 43 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,33 @@

# Controller

Controller is a gaming specific smart contract wallet that enables seamless player onboarding and game interactions.
Controller is a gaming specific smart contract wallet that enables seamless
player onboarding and game interactions.

It supports transaction signing using Passkeys and Session Tokens.

## Project structure
The project consists of several subfolders located in the ```packages``` directory:

- **[account_sdk](packages/account_sdk)** - a rust sdk for interacting interacting with the controller account contract.
- **[account-wasm](packages/account-wasm)** - a wasm version of the rust account sdk for usage in the browser.
- **[contracts](packages/contracts)** - a cairo project containing the controller account contract, signer, and session implementations.
- **[keychain](packages/keychain)** - a sandboxed application hosted at https://x.cartridge.gg/ and responsible for sensitive operations, such as signing transactions. When an application requests to sign or execute a transaction, keychain enforces client side authorization logic and displays UI for user approval if necessary.
- **[controller](packages/controller)** sdk. Controller implements the account interfaces required by [starknet.js](https://github.com/0xs34n/starknet.js). Underneath, the implementation communicates with an embedded sandboxed keychain iframe.
The project consists of several subfolders located in the `packages` directory:

- **[account_sdk](packages/account_sdk)** - a rust sdk for interacting
interacting with the controller account contract.
- **[account-wasm](packages/account-wasm)** - a wasm version of the rust account
sdk for usage in the browser.
- **[contracts](packages/contracts)** - a cairo project containing the
controller account contract, signer, and session implementations.
- **[keychain](packages/keychain)** - a sandboxed application hosted at
https://x.cartridge.gg/ and responsible for sensitive operations, such as
signing transactions. When an application requests to sign or execute a
transaction, keychain enforces client side authorization logic and displays UI
for user approval if necessary.
- **[profile](packages/profile)** - a sandboxed application hosted at
https://profile.cartridge.gg/ and responsible for displaying the state of
Controller account, such as token balances, activities, and achievement.
- **[controller](packages/controller)** sdk. Controller implements the account
interfaces required by [starknet.js](https://github.com/0xs34n/starknet.js).
Underneath, the implementation communicates with an embedded sandboxed
keychain iframe.

## Development

Expand All @@ -31,19 +46,19 @@ Install dependencies:
pnpm i
```

Build dependencies:

```sh
pnpm build
```

Run `keychain` and `starknet-react-next`:
Run Controller with examples:

```sh
pnpm dev
```

Open <http://localhost:3002> in your browser.
This command builds all workspace dependencies first and start these servers:

- http://localhost:3002: Controller Example (Next.js)
- http://localhost:5174: Controller Example (Svelte)
- http://localhost:3001: Keychain
- http://localhost:3003: Profile
- http://localhost:5173: Documentation

The simplest way to then develop with your cartridge account is to port it over
from the production keychain:
Expand Down Expand Up @@ -76,13 +91,19 @@ make

in the root directory.

#### Commiting changes
#### Commiting changes

The compiled account is stored in the git repository in the `crates/account_sdk/artifacts/` folder. To make sure that the tests are run against the most reacent version of the code run `make` in the root repository. The `make` command should also be run before commiting any changes to ensure a valid state of the compiled code.
The compiled account is stored in the git repository in the
`crates/account_sdk/artifacts/` folder. To make sure that the tests are run
against the most reacent version of the code run `make` in the root repository.
The `make` command should also be run before commiting any changes to ensure a
valid state of the compiled code.

#### Running the tests

Note, that to run the tests you first have to [compile](#compiling-the-cairo-code) (to sierra and casm) the contract in the `controller` folder.
Note, that to run the tests you first have to
[compile](#compiling-the-cairo-code) (to sierra and casm) the contract in the
`controller` folder.

Starknet Foundry tests:

Expand All @@ -102,4 +123,7 @@ After the contract is compiled run the tests using `cargo`:
cargo test
```

The scarb builds the contract and saves the compiled code in the `controller/target` folder. The tests then fetch (at compile time) the comipled code and deploy it to the local network. Note that obviously the contract needs to be recompiled for any changes to be applied in the compiled code.
The scarb builds the contract and saves the compiled code in the
`controller/target` folder. The tests then fetch (at compile time) the comipled
code and deploy it to the local network. Note that obviously the contract needs
to be recompiled for any changes to be applied in the compiled code.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
/playwright-report/
/blob-report/
/playwright/.cache/
!/src/abi/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "starknet-react-next",
"name": "@cartridge/controller-example-next",
"private": true,
"version": "0.5.0-alpha.7",
"scripts": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/svelte/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "svelte",
"name": "@cartridge/controller-example-svelte",
"version": "0.5.0-alpha.7",
"private": true,
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"ui:next": "pnpm --filter @cartridge/ui-next",
"profil": "pnpm --filter @cartridge/profile",
"utils": "pnpm --filter @cartridge/utils",
"example:next": "pnpm --filter starknet-react-next",
"example:next": "pnpm --filter @cartridge/controller-example-next",
"example:svelte": "pnpm --filter @cartridge/controller-example-svelte",
"test": "pnpm keychain test",
"test:ci": "pnpm keychain test:ci",
"test:storybook": "pnpm turbo build:deps test:storybook"
Expand Down
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
packages:
- examples/starknet-react-next
- examples/next
- examples/svelte
- packages/*
- documentation

0 comments on commit 1579f50

Please sign in to comment.