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

Add removing and adding of transition edges #76

Merged
merged 8 commits into from
Apr 9, 2024
Merged
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
15 changes: 14 additions & 1 deletion trackAndTrace/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Track and Trace Project

## Hosted front end

[Hosted front end link](https://trackntrace.testnet.concordium.com/)

## Overview

This project contains a complete implementation of a track and trace solution with [CIS-3](https://proposals.concordium.software/CIS/cis-3.html) compliant sponsored transactions.

It has five primary components.
Expand All @@ -20,13 +26,20 @@ However, the easiest option is to use [docker-compose](https://docs.docker.com/c
For this to work, you should do the following:

1. Deploy and initialize your version of the Track and Trace smart contract.
2. [Export your account keys from the Browser Wallet](https://developer.concordium.software/en/mainnet/net/guides/export-key.html) and note the location you save the keys.
2. [Export your account keys from the Browser Wallet](https://developer.concordium.software/en/mainnet/net/guides/export-key.html) and generate a `./private-keys` folder to save the key file into it.
3. Set the following environment variables:
- Set the `TRACK_AND_TRACE_CONTRACT_ADDRESS` variable to the contract address of your contract instance.
- Set the `TRACK_AND_TRACE_PRIVATE_KEY_FILE` variable to the path of your keys from step 2.
- (Optional) Set the `TRACK_AND_TRACE_NETWORK` variable to the correct net (testnet/mainnet). Defaults to testnet.
- (Optional) Set the `TRACK_AND_TRACE_NODE` to the gRPC endpoint of the node you want to use. Make sure it runs on the right net, i.e., testnet or mainnet. Defaults to `https://grpc.testnet.concordium.com:20000`.
4. Run `docker-compose up` to build and start all the services.

e.g.

```bash
TRACK_AND_TRACE_CONTRACT_ADDRESS="<8527,0>" TRACK_AND_TRACE_PRIVATE_KEY_FILE="./private-keys/4SizPU2ipqQQza9Xa6fUkQBCDjyd1vTNUNDGbBeiRGpaJQc6qX.export" docker-compose up
```

5. Access the frontend at `http://localhost:8080`
- The sponsored transaction service runs on port `8000` by default, and the postgres database runs on `5432`. Both are configurable in the `./docker-compose.yml` file.

Expand Down
4 changes: 4 additions & 0 deletions trackAndTrace/frontend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Unreleased changes

## 1.1.0

- Add transition edges management by admin to front end.

## 1.0.2

- Fix `Writable` error via polyfill in `walletConnect` dependency.
Expand Down
6 changes: 6 additions & 0 deletions trackAndTrace/frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ To start a development environment make sure to first generate the smart contrac
yarn dev
```

e.g.

```bash
TRACK_AND_TRACE_CONTRACT_ADDRESS="<8527,0>" yarn dev
```

This will launch a development server with hot module replacement enabled.

_Please note that calls to the backend server do not work in the development setup._
Expand Down
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('2826a0cf9516115386fd2c8587ab2a179fdc9b40203143044de13fdacf02733e');
export const moduleReference: SDK.ModuleReference.Type = /*#__PURE__*/ SDK.ModuleReference.fromHexString('2c484449e32d435dcaa3921b7c04b395b3b4b8b25b1ccdc3d3002322dd04edcb');

/** Client for an on-chain smart contract module with module reference '2826a0cf9516115386fd2c8587ab2a179fdc9b40203143044de13fdacf02733e', can be used for instantiating new smart contract instances. */
/** Client for an on-chain smart contract module with module reference '2c484449e32d435dcaa3921b7c04b395b3b4b8b25b1ccdc3d3002322dd04edcb', 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 '2826a0cf9516115386fd2c8587ab2a179fdc9b40203143044de13fdacf02733e', can be used for instantiating new smart contract instances. */
/** Client for an on-chain smart contract module with module reference '2c484449e32d435dcaa3921b7c04b395b3b4b8b25b1ccdc3d3002322dd04edcb', 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 '2826a0cf9516115386fd2c8587ab2a179fdc9b40203143044de13fdacf02733e'.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '2c484449e32d435dcaa3921b7c04b395b3b4b8b25b1ccdc3d3002322dd04edcb'.
* @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 '2826a0cf9516115386fd2c8587ab2a179fdc9b40203143044de13fdacf02733e'.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '2c484449e32d435dcaa3921b7c04b395b3b4b8b25b1ccdc3d3002322dd04edcb'.
* @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 '2826a0cf9516115386fd2c8587ab2a179fdc9b40203143044de13fdacf02733e'.
* @param {ModuleModule} moduleClient - The client of the on-chain smart contract module with referecence '2c484449e32d435dcaa3921b7c04b395b3b4b8b25b1ccdc3d3002322dd04edcb'.
* @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
Loading