diff --git a/README.md b/README.md index a9737c5a..f0da52e8 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ The following examples are available. interactions of a store that sells restricted items, and supports payment in EUROe tokens (or generally any CIS2 token). -- [track-and-trace](./track-and-trace/) demonstrates an example frontend, backend, and event indexer to track items along the supply chain. +- [track-and-trace](./track-and-trace/) demonstrates an example frontend, backend, smart contract and event indexer to track items along the supply chain. ## Setup diff --git a/trackAndTrace/scripts/README.md b/trackAndTrace/scripts/README.md index c2355d7a..6b1741a5 100644 --- a/trackAndTrace/scripts/README.md +++ b/trackAndTrace/scripts/README.md @@ -4,20 +4,19 @@ This package contains a test script to facilitate filling the track and trace co There are a few options to configure the script: -- `--node` is the endpoint to the Concordium node grpc v2 API. +- `--node` is the endpoint to the Concordium node grpc v2 API. If not specified the default value `https://grpc.testnet.concordium.com:20000` is used. -- `--module` must point to a compiled track-and-trace smart contract module with the name `track_and_trace.wasm.v1`. - This module will be used to create a new instance of the track-and-trace smart contract and fill it with data. +- `--module` should point to a compiled track-and-trace smart contract module with e.g. the name `module.wasm.v1`. If not specified the default value `../smart-contract/concordium-out/module.wasm.v1` is used. The given module will be used to create a new instance of the track-and-trace smart contract and fill it with data. - You can generate the `track-and-trace.wasm.v1` file as follows: - - Navigate into the folder `https://github.com/Concordium/concordium-rust-smart-contracts/tree/main/examples/track-and-trace`. - - Compile the track-and-trace contract: `cargo concordium build -e -o ./concordium-out/track_and_trace.wasm.v1`. - - You can find the file `track_and_trace.wasm.v1` in `./concordium-out/track_and_trace.wasm.v1`. + You can generate the `module.wasm.v1` file as follows: + - Navigate into the folder `../smart-contract`. + - Compile the track-and-trace contract: `cargo concordium build -e -o ./concordium-out/module.wasm.v1`. + - You can find the file `module.wasm.v1` in `./concordium-out/module.wasm.v1`. - `--admin-key-file` **directory** with one key in the browser wallet export format. This key is used for all transactions executed by the script. -- `--num-items` optional value to specify the number of items to be created in the track-and-trace smart contract. The default value is 1. The states of these items will be updated from 'Produced' -> 'InTransit' -> 'InStore' -> 'Sold'. +- `--num-items` is the number of items to be created in the track-and-trace smart contract. The states of these items will be updated from 'Produced' -> 'InTransit' -> 'InStore' -> 'Sold'. ## Build @@ -42,17 +41,14 @@ which can be run. To run the script use for example the following command in this folder: ``` -cargo run --release -- --node http://node.testnet.concordium.com:20000 --admin-key-file ./4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export --module ./track_and_trace.wasm.v1 --num-items 2 +cargo run --release -- --node https://grpc.testnet.concordium.com:20000 --admin-key-file ./4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export --module ../smart-contract/concordium-out/module.wasm.v1 --num-items 2 ``` assuming the wallet export file `/4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export` is in this directory. -To get your account file (the `4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export` file in the above example), export it from the Concordium Browser wallet for web. +To get your account file (the `4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export` file in the above example), export it from the [Concordium Browser wallet for web](http://developer.concordium.software/en/mainnet/net/guides/export-key.html). - - - ### diff --git a/trackAndTrace/scripts/pic/pic1.png b/trackAndTrace/scripts/pic/pic1.png deleted file mode 100644 index 85432dfb..00000000 Binary files a/trackAndTrace/scripts/pic/pic1.png and /dev/null differ diff --git a/trackAndTrace/scripts/pic/pic2.png b/trackAndTrace/scripts/pic/pic2.png deleted file mode 100644 index 13f8a3f7..00000000 Binary files a/trackAndTrace/scripts/pic/pic2.png and /dev/null differ diff --git a/trackAndTrace/scripts/pic/pic3.png b/trackAndTrace/scripts/pic/pic3.png deleted file mode 100644 index f7e951d2..00000000 Binary files a/trackAndTrace/scripts/pic/pic3.png and /dev/null differ diff --git a/trackAndTrace/scripts/src/main.rs b/trackAndTrace/scripts/src/main.rs index 6f051ffe..48d6b795 100644 --- a/trackAndTrace/scripts/src/main.rs +++ b/trackAndTrace/scripts/src/main.rs @@ -13,7 +13,6 @@ use concordium_rust_sdk::{ }, v2::{self as sdk, BlockIdentifier}, }; -use std::sync::Arc; use track_and_trace::*; pub enum TrackAndTraceContract {} @@ -23,20 +22,19 @@ pub enum TrackAndTraceContract {} struct Args { #[arg( long = "node", - default_value = "http://node.testnet.concordium.com:20000", + default_value = "https://grpc.testnet.concordium.com:20000", help = "The endpoints are expected to point to concordium node grpc v2 API's.", global = true )] node_endpoint: concordium_rust_sdk::v2::Endpoint, #[arg( long = "module", - default_value = "./track-and-trace.wasm.v1", + default_value = "../smart-contract/concordium-out/module.wasm.v1", help = "Source module from which to initialize the contract instances." )] module: std::path::PathBuf, #[arg( long = "num-items", - default_value = "1", help = "Number of items to be created in the contract." )] num_items: usize, @@ -68,11 +66,9 @@ async fn main() -> anyhow::Result<()> { .context("Unable to establish connection to the node.")?; // Load account keys and sender address from a file - let keys: WalletAccount = WalletAccount::from_json_file(args.admin_keys_path) + let admin_key: WalletAccount = WalletAccount::from_json_file(args.admin_keys_path) .context("Could not read the keys file.")?; - let admin_key = Arc::new(keys); - eprintln!("Starting script with admin account {}.", admin_key.address); // Deploy module diff --git a/trackAndTrace/scripts/track_and_trace.wasm.v1 b/trackAndTrace/scripts/track_and_trace.wasm.v1 deleted file mode 100644 index 4b9c1abd..00000000 Binary files a/trackAndTrace/scripts/track_and_trace.wasm.v1 and /dev/null differ