Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track and Trace V2 #113

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions trackAndTrace/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ services:
environment:
CCD_SERVER_DB_CONNECTION: "host=postgres dbname=indexer user=postgres password=password port=5432"
CCD_SERVER_CONTRACT_ADDRESS: ${TRACK_AND_TRACE_CONTRACT_ADDRESS:?Please specify the Track and Trace contract instance address (format <1234,0>)}
CCD_SERVER_PINATA_JWT: ${TRACK_AND_TRACE_PINATA_JWT:?Please specify the Pinata JWT for IPFS uploads}
CCD_SERVER_PINATA_GATEWAY: ${TRACK_AND_TRACE_PINATA_GATEWAY:?Please specify the Pinata Gateway URL for IPFS access}
CCD_SERVER_SPONSORED_TRANSACTION_BACKEND: "http://localhost:8000"
CCD_SERVER_NETWORK: ${TRACK_AND_TRACE_NETWORK:-testnet}
CCD_SERVER_NODE: ${TRACK_AND_TRACE_NODE:-https://grpc.testnet.concordium.com:20000}
Expand Down
1 change: 1 addition & 0 deletions trackAndTrace/frontend/.eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
node_modules/
dist/
generated/
src/components/ui/
1 change: 1 addition & 0 deletions trackAndTrace/frontend/.prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.vite
generated
src/components/ui/
12 changes: 6 additions & 6 deletions trackAndTrace/frontend/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

## 1.2.0

- Display the `initial_status` field from the create event.
- Change to match the `TokenIdU64` type for the `item_id` field in the create event and update event.
- Display the `initial_status` field from the create event.
- Change to match the `TokenIdU64` type for the `item_id` field in the create event and update event.

## 1.1.0

- Add transition edges management by admin to front end.
- Add transition edges management by admin to front end.

## 1.0.2

- Fix `Writable` error via polyfill in `walletConnect` dependency.
- Fix `Writable` error via polyfill in `walletConnect` dependency.

## 1.0.1

- Fix explorer page crash when item does not exist in the database.
- Fix explorer page crash when item does not exist in the database.

## 1.0.0

- Initial `front end`.
- Initial `front end`.
12 changes: 6 additions & 6 deletions trackAndTrace/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

Make sure to have the following installed:

- [NodeJs](https://nodejs.org).
- Rust and cargo (Recommended to install using [rustup](https://rustup.rs)).
- Recent version of [cargo concordium](https://crates.io/crates/cargo-concordium). Install using `cargo install --locked cargo-concordium`.
- [NodeJs](https://nodejs.org).
- Rust and cargo (Recommended to install using [rustup](https://rustup.rs)).
- Recent version of [cargo concordium](https://crates.io/crates/cargo-concordium). Install using `cargo install --locked cargo-concordium`.

## Frontend

Expand All @@ -22,9 +22,9 @@ Set the environment variable `TRACK_AND_TRACE_CONTRACT_ADDRESS`, or prefix it be

This front end calls three backend endpoints:

- `/api/submitTransaction` from the [sponsored transaction backend service](../sponsored-transaction-service)
- `/api/getItemStatusChangedEvents` from the [backend server](../indexer)
- `/api/getItemCreatedEvent` from the [backend server](../indexer)
- `/api/submitTransaction` from the [sponsored transaction backend service](../sponsored-transaction-service)
- `/api/getItemStatusChangedEvents` from the [backend server](../indexer)
- `/api/getItemCreatedEvent` from the [backend server](../indexer)

See the [Environment variables](#environment-variables) section below for configuration options regarding the sponsored service.

Expand Down
21 changes: 21 additions & 0 deletions trackAndTrace/frontend/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "src/index.css",
"baseColor": "neutral",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils",
"ui": "@/components/ui",
"lib": "@/lib",
"hooks": "@/hooks"
},
"iconLibrary": "lucide"
}
12 changes: 6 additions & 6 deletions trackAndTrace/frontend/generated/module.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// @ts-nocheck
import * as SDK from "@concordium/web-sdk";
/** The reference of the smart contract module supported by the provided client. */
export const moduleReference: SDK.ModuleReference.Type = /*#__PURE__*/ SDK.ModuleReference.fromHexString('7f24e586bb7dcac318ca0c2876d3e4b5c07f36d48d0c7b20f8d82dad0552f1e3');
export const moduleReference: SDK.ModuleReference.Type = /*#__PURE__*/ SDK.ModuleReference.fromHexString('757693d8e141665881e9dbc40be07da4cba32ef89d8824fb579cd66619443129');

/** Client for an on-chain smart contract module with module reference '7f24e586bb7dcac318ca0c2876d3e4b5c07f36d48d0c7b20f8d82dad0552f1e3', can be used for instantiating new smart contract instances. */
/** Client for an on-chain smart contract module with module reference '757693d8e141665881e9dbc40be07da4cba32ef89d8824fb579cd66619443129', can be used for instantiating new smart contract instances. */
class ModuleModule {
/** Having a private field prevents similar structured objects to be considered the same type (similar to nominal typing). */
private __nominal = true;
Expand All @@ -16,7 +16,7 @@ class ModuleModule {
}
}

/** Client for an on-chain smart contract module with module reference '7f24e586bb7dcac318ca0c2876d3e4b5c07f36d48d0c7b20f8d82dad0552f1e3', can be used for instantiating new smart contract instances. */
/** Client for an on-chain smart contract module with module reference '757693d8e141665881e9dbc40be07da4cba32ef89d8824fb579cd66619443129', can be used for instantiating new smart contract instances. */
export type Type = ModuleModule;

/**
Expand Down Expand Up @@ -45,7 +45,7 @@ export function createUnchecked(grpcClient: SDK.ConcordiumGRPCClient): ModuleMod
/**
* Construct a ModuleModule client for interacting with a smart contract module on chain.
* This function ensures the smart contract module is deployed on chain.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '7f24e586bb7dcac318ca0c2876d3e4b5c07f36d48d0c7b20f8d82dad0552f1e3'.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '757693d8e141665881e9dbc40be07da4cba32ef89d8824fb579cd66619443129'.
* @throws If failing to communicate with the concordium node or if the module reference is not present on chain.
* @returns {ModuleModule} A module client ensured to be deployed on chain.
*/
Expand All @@ -55,7 +55,7 @@ export function checkOnChain(moduleClient: ModuleModule): Promise<void> {

/**
* Get the module source of the deployed smart contract module.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '7f24e586bb7dcac318ca0c2876d3e4b5c07f36d48d0c7b20f8d82dad0552f1e3'.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '757693d8e141665881e9dbc40be07da4cba32ef89d8824fb579cd66619443129'.
* @throws {SDK.RpcError} If failing to communicate with the concordium node or module not found.
* @returns {SDK.VersionedModuleSource} Module source of the deployed smart contract module.
*/
Expand Down Expand Up @@ -159,7 +159,7 @@ export function createTrackAndTraceParameterWebWallet(parameter: TrackAndTracePa

/**
* Send transaction for instantiating a new 'track_and_trace' smart contract instance.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '7f24e586bb7dcac318ca0c2876d3e4b5c07f36d48d0c7b20f8d82dad0552f1e3'.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '757693d8e141665881e9dbc40be07da4cba32ef89d8824fb579cd66619443129'.
* @param {SDK.ContractTransactionMetadata} transactionMetadata - Metadata related to constructing a transaction for a smart contract module.
* @param {TrackAndTraceParameter} parameter - Parameter to provide as part of the transaction for the instantiation of a new smart contract contract.
* @param {SDK.AccountSigner} signer - The signer of the update contract transaction.
Expand Down
Loading