Skip to content

Commit

Permalink
add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
tuminfei committed Jan 10, 2025
1 parent e7a74f8 commit 039202b
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 1,162 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,45 @@ sh icrc7_launchpad.sh
```

## Creating Asset Storage and Uploading Assets

The **ICRC7 Launchpad** also supports asset storage for uploading and managing images or files associated with your NFTs.

Follow the steps below to create asset storage and upload your assets:

### 1. Deploy the Asset Storage Canister
Run the following command to create an asset storage canister:
```bash
dfx deploy ic_canister_assets
```

### 2. Organize Local Assets

Place all your local assets (e.g., images, files) into the `assets` directory in your project.

### 3. Set Upload Parameters
Modify the relevant parameters in `tests/src/lib.rs` to specify details for the upload process, such as:
- Path to the `assets` directory.
- Metadata or configurations related to the assets.

### 4. Execute the Upload Test
Run the following command to upload the assets to the canister:
```bash
cargo test --package tests --lib -- --show-output
```

### 5. Retrieve Asset URLs
After the upload is complete, the script will output the paths of the uploaded assets. Use these paths to link the uploaded images or files to your NFTs.

```
example: nft_image.jpg
local network: http://{ic_canister_assets_canister_id}.raw.localhost:4943/nft_image.jpg
ic network: https://{ic_canister_assets_canister_id}.raw.icp0.io/nft_image.jpg
```

## ICRC7 Init

ICRC7 Init args:
Expand Down
7 changes: 0 additions & 7 deletions dfx.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
{
"canisters": {
"asset_storage": {
"candid": "wasm/assetstorage.did",
"init_arg": "opt variant { Init = record {} }",
"package": "asset_storage",
"type": "custom",
"wasm": "wasm/assetstorage.wasm.gz"
},
"ic_canister_assets": {
"candid": "wasm/ic_canister_assets.did",
"package": "ic_canister_assets",
Expand Down
7 changes: 2 additions & 5 deletions scripts/uploader.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
cargo install icx-proxy

icx-proxy --fetch-root-key --address 127.0.0.1:8453 --dns-alias myproject.localhost:bkyz2-fmaaa-aaaaa-qaaaq-cai -v -v
dfx deploy ic_canister_assets

cargo test --package tests --lib -- --show-output

dfx canister call ic_canister_assets permission_set_admin '(principal "3yyxm-t5fpe-v32em-ac6lr-xyort-wuscb-dvl4x-3wnwi-hqkyj-xortw-oqe")'

dfx canister call ic_canister_assets permission_is_admin '(principal "3yyxm-t5fpe-v32em-ac6lr-xyort-wuscb-dvl4x-3wnwi-hqkyj-xortw-oqe")'


: (principal) -> (bool) query;
Binary file removed src/asset_uploader/data/nft_image.jpg
Binary file not shown.
Loading

0 comments on commit 039202b

Please sign in to comment.