Coder Social home page Coder Social logo

concordium / concordium-dapp-examples Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 13.0 19.13 MB

Place to put small dApp examples

License: Mozilla Public License 2.0

Dockerfile 0.52% HTML 0.76% CSS 0.73% TypeScript 77.39% JavaScript 0.81% Rust 19.10% SCSS 0.69%

concordium-dapp-examples's People

Contributors

abizjak avatar bargsteen avatar bisgardo avatar doben avatar lassemoldrup avatar orhoj avatar parv0888 avatar shjortconcordium avatar soer8647 avatar soerenbf avatar thahara avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

concordium-dapp-examples's Issues

Sponsored Transactions Auction - Change metadata

Description
Currently the wCCD metadata is used for token metadata. Maybe reuse EUROe metadata or create new one.

In any case, change the number of decimals to be 0 so that it simplifies bidding in a way that we can bid only using int.

Steps to Reproduce
1.Mint 100 tokens.

Expected Result
100 tokens appear in the BW.

Actual Result
0.00100 tokens appear in the wallet.

Versions

  • Software Version: 1.0.0

Rust event indexer for the track-and-trace contract

Task description

The task is to develop an example implementation of an event indexer written in Rust.

The events from the track-and-trace smart contract will be indexed to serve the historical item statuses to the front end. The indexer starts processing old events and then listens for new events that are coming in as the blockchain progresses. The indexer should be configurable to start indexing at a specific time (usually the time around when the smart contract was deployed). The indexer should store checkpoints (block_height, transaction_hash, and event_index) of the current event being processed to aid in debugging and to aid in re-starting the index from the persistent database in case the indexer crashed unintentionally.

The indexer runs a PostgreSQL database at the backend.

There are three tables in the database:

  • setting for global settings and the checkpoints.
  • item_created_events for all the item-created events logged by the contract.
  • item_status_changed_events for all the item-status-changed events logged by the contract.

Smart contracts:
Concordium/concordium-rust-smart-contracts#387 (comment)
https://github.com/Concordium/concordium-dapp-examples/tree/main/trackAndTrace

Sub-tasks

  • Develop an indexer to process events from the blockchain and input them into the PostgreSQL database.
  • Develop an http server that provides two entrypoints for the front end to query the database:
    - [x] GetItemStatusChangedEvents by item_id returns a list of all status-changed events for specified item_id or an empty list if the item does not exist.
    - [x] GetItemCreatedEvent by item_id returns the event when the item was created or None if the item does not exist.

Add label for component and priority.

Track-and-trace dapp improvements

Task description
Summary of improvements for the track-and-trace dapp:

Sub-tasks

  • Display version at the front end.
  • Add link at front-end to the source code repo.
  • Generalize the state machine so that we can easily add/remove new addresses to be producer/seller/... via the front end.
  • Enable updating of the account when switching an account in the wallets
  • Improve error messages shown in the admin pages on the front end.
    - For example when a non-admin tries to add itself as admin:
    image
  • Make navbar not transparent to avoid overlap in text
    image
  • Create a migration script that allows us to read out the current state-machine and admins as set in the smart contract and initialize a new smart contract instance with the same state. This enables us to easily roll out new versions of the hosted dapp without manually adding admins to a newly deployed contract.

[auction-sponsored-transactions] Additional improvements

Tasks

  • Simplify ccd-js-gen integration with the browser wallet once Concordium/concordium-node-sdk-js#324 is merged and a new release of the ccd-js-gen tool is available. Remove hardcoded schemas from the front end.
  • Use ContractClient from the Rust SDK to simplify the interactions with the contract at the backend #32 (comment)
  • Instead of a hardcoded node connection at the front-end to construct the grpc client, use the node connection provided from the connected wallet.
  • Consolidate steps 4 and 5, so that no signerAccount has to be inputted in the input field anymore. The signerAccount can be stored in a useState hook at the point the signature is generated. This will minimize user error.

Sponsored Transactions Auction - number in fields increases with mouse scroll

Description
Inf the field that should have a number is selected and user scrolls, number in fields increases.

I suggest we disable this functionality because it could result with confusing token IDs. I could also notice that the number field for Item Index doesn't have that functionality.

Steps to Reproduce

  1. In the step 1 insert 1 as being Cis2 token id
  2. While focus is still on the field, scroll up.

Expected Result
Cis2 token id should still be 1.

Actual Result
Cis2 token id should still be 2.

Versions

  • Software Version: 1.0.0

Set up automated testing

Since this repository is meant to contain examples it should be exemplary.

It should have tests to make sure it builds, that formatting is as dictated, and that tests pass.

Frontends without linting and formatting

The following example frontends are missing ESLint:

  • signMessage
  • simpleAgeVerification
    Additionally, the frontends in low-code-nft-marketplace need a ESLint config file.

These example frontends are missing a Prettier setup:

  • gallery
  • low-code-nft-marketplace
  • signMessage
  • simpleAgeVerification
  • sponsoredTransactions

When/If these things are added the CI pipeline should be updated.

Track-and-trace standard (CIS6)

Task description

The standard defines the two events to enable tracking of items by external tools (e.g. block explorers).

pub struct ItemCreatedEvent {
    /// The item's id.
    pub item_id:      String,
    /// The item's metadata_url.
    pub metadata_url: Option<MetadataUrl>,
    /// Status when item was created.
    pub initial_status:      Status,
}

pub struct ItemStatusChangedEvent<A: Serial> {
    /// The item's id.
    pub item_id:         String,
    /// The item's new status.
    pub new_status:      Status,
    /// Any additional data encoded as generic bytes. Usecase-specific data can
    /// be included here such as temperature, longitude, latitude, ... .
    pub additional_data: A,
}

In preparation for the standard, the following changes were discussed:

  • Change itemId from a number to a String so that Universally Unique Identifier (UUID) can be used as well.
  • Add initial_status to the CreateEvent and display it at the front end.
  • Add supports (CIS0) function.

SponsoredTransactions: Improvements

Task description
Collections of improvements and minor tasks to do related to the sponsored transaction dApp example.

Sub-tasks

  • Replace deprecated JsonRPC client with GRPC client.
  • Deploy sponsored transaction smart contract to testnet once protocol 6 is live. Update sponsored transaction smart contract index at the front end (package.json file). Update frontend/backend Read.me with the new index and related comments. Also update DockerFile. Remove the hardcoded STAGENET configuration in constants.ts file.

Gallery: mainnet CCDScan link

Bug Description

Gallery dApp is deployed on mainnet. It has a CCDScan link that still points to testnet (for the connected account). Update CCDScan link. This might require to introduce environmental variables network similar to wCCD dApp example.

Sponsored Transactions Auction - Frontend UI and text changes

Description

Maybe we could add a bit more text to some of the steps. I don't know if we should just write the text in the boxes somewhere around input fields or we could add like a tooltip.

Proposing a change to the UI on step 1:
I think it is a bit confusing to ask to add Token ID in decimal, I believe some users might not understand that. I would rather put something as Insert a number that will represent your Cis2 Token Id. Tokens with that Id will be minted and added to your address.

Proposing changes to the UI on step 2:
Insert a number that will represent your Cis2 Token Id. Tokens with that Id can be used to bid for your item.

Proposing changes to the UI on step 3:
Insert a number that represents index of your auctioned item. Item index is generated after completing step 2.

Proposing changes to the UI on step 4:
First input field:
Insert the amount of Cis2 tokens (payment token) to bid for the item.
Third input field:
Insert the nonce, it can be found on the top of the page.

Add format to the comment to explain the format on the frontend part where ending election time is hardcoded.
export const AUCTION_END = '2050-01-01T12:00:00Z'; // Hardcoded value for simplicity for this demo dApp (format YYYY-MM-DD).

Versions

  • Software Version: 1.0.0

Check for version mismatch in docker release pipelines

Task description

Currently, if someone accidentally wrongly tags this repo e.g. euroe-demo/0.0.0, the docker hub release pipeline is triggered. The release pipeline would look up the correct version and publish it to docker hub. Nonetheless, to not rely on the reviewer/approver of the release pipeline to check for a version mismatch, it would be nice if the release action could check (when it was triggered via a tag) that the versions match. Research a nice solution for it.

#70 (comment)

Track And Trace Front End

Task description

The track and trace front end should connect the different components.

Sub-tasks

  • Allow the admin to change roles and create items.
  • Allow whitelisted addresses to change the status of an item and submit a sponsored transaction to the backend.
  • Display the history of the statuses of an item as an explorer using the values stored in the Postgres database (the indexer has to index these historical events first).

Update sponsored transaction dApp once mobile wallets can sign byte messages

Task description

Remaining TODOs after libraries are released:

BeerStore demo cant select another identity&account

Bug Description
While generating the proof app allows to pick any account tied to identity 1, but if there are multiple identities and accounts you cant see them.
Steps to Reproduce

  • Add another identity and create an account
Screenshot 2024-04-01 at 13 17 15 Screenshot 2024-04-01 at 13 17 51
  • Connect to the platform and click Verify
  • Look for the newly created account
    Expected Result

Actual Result

Versions

  • Browser

Add CIS3 (sponsored transaction) to the track-and-trace contract.

Task description

The change_item_status entrypoint in the track-and-trace contract should be able to be invoked via the sponsored transaction mechanism.
https://github.com/Concordium/concordium-dapp-examples/blob/main/trackAndTrace/smart-contract/src/lib.rs#L525

Similar smart contracts with sponsored transaction design can be used as a reference e.g.:
https://github.com/Concordium/concordium-rust-smart-contracts/tree/main/examples/cis2-multi/src
https://github.com/Concordium/concordium-rust-smart-contracts/tree/main/examples/cis3-nft-sponsored-txs

Sub-tasks

Update dapps to support protocol 7

Task description

The dapps need to be updated when SDKs are updated for protocol 7. In particular any dapp that has a Rust backend must be updated since it will otherwise most likely stop working on migration to protocol 7 due to changes in the node API.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.