Skip to content

Commit

Permalink
fix: apply consistent naming for canister, directory and project (#26)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephen Antoni <[email protected]>
Co-authored-by: Agustinus Theodorus <[email protected]>
  • Loading branch information
3 people authored Aug 8, 2024
1 parent a2151ce commit 8a01ebe
Show file tree
Hide file tree
Showing 20 changed files with 23 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: cargo clippy -- -D warnings

- name: Build with cargo
run: cargo build --release --target wasm32-unknown-unknown --package icp_prototype_backend
run: cargo build --release --target wasm32-unknown-unknown --package icp_subaccount_indexer

- name: Run tests with cargo
run: cargo test --features "happy_path" && cargo test --features "sad_path"
4 changes: 2 additions & 2 deletions .maintain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Create or modify `canister_ids.json` in the project root:

```json
{
"icp_prototype_backend": {
"icp_subaccount_indexer": {
"ic": "upy4y-myaaa-aaaaal-qjbxa-cai"
}
}
Expand Down Expand Up @@ -97,7 +97,7 @@ Use the `deploy.sh` script for deployment:
Alternatively, you can use the dfx command directly:

```bash
dfx deploy icp_prototype_backend --network ic --no-wallet --argument "(variant { Mainnet }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$CUSTODIAN_PRINCIPAL\")"
dfx deploy icp_subaccount_indexer --network ic --no-wallet --argument "(variant { Mainnet }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$CUSTODIAN_PRINCIPAL\")"
```

Note: If you encounter issues with the `wasm32-unknown-unknown` target, install it:
Expand Down
4 changes: 2 additions & 2 deletions .maintain/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ print_colored "$GREEN" "Custodian Principal: $CUSTODIAN_PRINCIPAL"
# Deploy the backend canister
print_colored "$YELLOW" "Deploying backend canister..."
if [ "$NETWORK" = "ic" ]; then
dfx deploy icp_prototype_backend --network ic --no-wallet --argument "(variant { Mainnet }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$CUSTODIAN_PRINCIPAL\")"
dfx deploy icp_subaccount_indexer --network ic --no-wallet --argument "(variant { Mainnet }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$CUSTODIAN_PRINCIPAL\")"
else
dfx deploy icp_prototype_backend --network "$NETWORK" --argument "(variant { Local }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$CUSTODIAN_PRINCIPAL\")"
dfx deploy icp_subaccount_indexer --network "$NETWORK" --argument "(variant { Local }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$CUSTODIAN_PRINCIPAL\")"
fi
check_command "Deploy backend canister"

Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[workspace]
members = [
"src/icp_prototype_backend"
"src/icp_subaccount_indexer"
]
resolver = "2"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ICSI is built with a focus on modularity and extensibility. The core components
## Canister Methods

The canister provides several methods to assist with ICP-token deposit management. The complete methods can be observed inside
[Candid File](./src/icp_prototype_backend/icp_prototype_backend.did)
[Candid File](./src/icp_subaccount_indexer/icp_subaccount_indexer.did)

```
add_subaccount : () -> (variant { Ok : text; Err : Error });
Expand Down
5 changes: 1 addition & 4 deletions canister_ids.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"icp_prototype_backend": {
"icp_subaccount_indexer": {
"ic": "uiz2m-baaaa-aaaal-qjbxq-cai"
},
"www": {
"ic": "upy4y-myaaa-aaaal-qjbxa-cai"
}
}
10 changes: 5 additions & 5 deletions dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
}
}
},
"icp_prototype_backend": {
"candid": "src/icp_prototype_backend/icp_prototype_backend.did",
"package": "icp_prototype_backend",
"icp_subaccount_indexer": {
"candid": "src/icp_subaccount_indexer/icp_subaccount_indexer.did",
"package": "icp_subaccount_indexer",
"type": "rust"
}
},
Expand All @@ -31,14 +31,14 @@
"environments": {
"local": {
"canisters": {
"icp_prototype_backend": {
"icp_subaccount_indexer": {
"dependencies": ["icp_ledger_canister"]
}
}
},
"ic": {
"canisters": {
"icp_prototype_backend": {}
"icp_subaccount_indexer": {}
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions docs/canister-deployment-guideline.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ Within your project’s root directory, add or adjust the following file `canist

```json
{
"icp_prototype_backend": {
"icp_subaccount_indexer": {
"ic": "upy4y-myaaa-aaaal-qjbxa-cai"
}
}
Expand All @@ -112,7 +112,7 @@ dfx cycles convert 0.3 --network ic
Ensure the currently active identity is the correct `custodian` identity linked as the controller on NNS from previous steps. Don’t forget to export the value for `CUSTODIAN_PRINCIPAL` using the sub-step from step 5.

```bash
dfx deploy icp_prototype_backend --network ic --no-wallet --argument "(variant { Mainnet }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$(echo $CUSTODIAN_PRINCIPAL)\")"
dfx deploy icp_subaccount_indexer --network ic --no-wallet --argument "(variant { Mainnet }, 15 : nat64, 10 : nat32, \"ryjl3-tyaaa-aaaaa-aaaba-cai\", \"$(echo $CUSTODIAN_PRINCIPAL)\")"
```

Some roadblocks you may encounter:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "icp_prototype",
"name": "icp_subaccount_indexer",
"type": "module",
"scripts": {
"build": "webpack",
Expand All @@ -8,10 +8,10 @@
"start:local:env": "dfx start --clean --host 127.0.0.1:8000 --use-old-metering",
"deploy:local": ".maintain/deploy.sh",
"deploy:ic": "dfx deploy --network=ic",
"generate": "npm run generate:did && dfx generate icp_prototype_backend",
"generate": "npm run generate:did && dfx generate icp_subaccount_indexer",
"generate:did": "npm run generate:did:backend && npm run generate:did:ts",
"generate:did:ts": "didc bind src/icp_prototype_backend/icp_prototype_backend.did -t ts > src/icp_prototype_backend/icp_prototype_backend.did.ts",
"generate:did:backend": "cargo build --release --target wasm32-unknown-unknown --package icp_prototype_backend && candid-extractor target/wasm32-unknown-unknown/release/icp_prototype_backend.wasm > src/icp_prototype_backend/icp_prototype_backend.did",
"generate:did:ts": "didc bind src/icp_subaccount_indexer/icp_subaccount_indexer.did -t ts > src/icp_subaccount_indexer/icp_subaccount_indexer.did.ts",
"generate:did:backend": "cargo build --release --target wasm32-unknown-unknown --package icp_subaccount_indexer && candid-extractor target/wasm32-unknown-unknown/release/icp_subaccount_indexer.wasm > src/icp_subaccount_indexer/icp_subaccount_indexer.did",
"format": "cargo fmt && prettier --write .",
"test:happy_path": "cargo test --features 'happy_path'",
"test:sad_path": "cargo test --features 'sad_path'",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "icp_prototype_backend"
name = "icp_subaccount_indexer"
version = "0.1.0"
edition = "2021"

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.

0 comments on commit 8a01ebe

Please sign in to comment.