This is an application exploring the capabilities of DAML as a smart contract language. The business logic being explored is the ability to track aid shipments in the UN according to a simplified process described below:
- An aid worker has an inventory of aid products ("AidProducts") available in an ad hoc warehouse that must be distributed to vulnerable groups during a hypothetical natural disaster.
- It should be possible for contract observers of the contract to view the status of aid delivery in real time.
- It should be possible to verify the delivery of the aid by tracking the shipment through its subsequent agents until it reaches the intended beneficiary, through a hypothetical mechanism that includes photos of the delivery event.
The text below is generated by the daml template
See documentation for details.
Please ask for help on the Daml forum if you encounter any issue!
You need to have Node.js and Daml installed.
First, start the Daml components:
daml start
This will:
- Build you Daml code once.
- Generate JavaScript code (and TypeScript definitions) for your Daml types.
- Start a Daml sandbox gRPC server (on 6865).
- Start a Daml HTTP JSON API server (on 7575).
- Watch for the
r
key press (r
+ Enter on Windows); when pressed, rebuild all of the Daml code, push the new DAR to the ledger, and rerun the JS/TS code generation.
Next, start the JS dev server:
cd ui
npm install
npm start
This starts a server on http://localhost:3000
which:
- Builds all of your TypeScript (or JavaScript) code (including type definitions from the codegen).
- Serves the result on :3000, redirecting
/v1
to the JSON API server (on127.0.0.1:7575
) so API calls are on the same origin as far as your browser is concerned. - Watch for changes in TS/JS code (including codegen), and immediately rebuild.
To build everything from scratch:
daml build
daml codegen js .daml/dist/create-daml-app-0.1.0.dar -o ui/daml.js
cd ui
npm install
npm run-script build
zip -r ../create-daml-app-ui.zip build
Next you need to create a ledger on Daml Hub, upload the files
.daml/dist/create-daml-app-0.1.0.dar
(created by the daml build
command)
and create-daml-app-ui.zip
(created by the zip
command based on the result
of npm run-script build
).
Once both files are uploaded, you need to tell Daml Hub to deploy them. A few seconds later, your website should be up and running.