├── .github └── workflows │ └── cla.yml ├── .gitignore ├── LICENSE ├── README.md ├── _config.yml ├── _data └── blocks.yml ├── _includes ├── blocks.html ├── en │ ├── Basics.md │ ├── Choices.md │ ├── CommandLine.md │ ├── Concepts.md │ ├── ContractKeys.md │ ├── Data.md │ ├── Functions.md │ ├── JavaScript.md │ ├── Resources.md │ ├── Scripts.md │ ├── Templates.md │ ├── Types.md │ ├── Updates.md │ └── What-is.md └── header.html ├── _layouts └── default.html ├── cheatsheet.css ├── daml-logo.png └── index.html /.github/workflows/cla.yml: -------------------------------------------------------------------------------- 1 | name: "CLA Assistant" 2 | on: 3 | issue_comment: 4 | types: [created] 5 | pull_request_target: 6 | types: [opened,closed,synchronize] 7 | 8 | # explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings 9 | permissions: 10 | actions: write 11 | contents: write # this can be 'read' if the signatures are in remote repository 12 | pull-requests: write 13 | statuses: write 14 | 15 | jobs: 16 | CLAAssistant: 17 | runs-on: ubuntu-latest 18 | steps: 19 | - name: "CLA Assistant" 20 | if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have hereby read the Digital Asset CLA and agree to its terms') || github.event_name == 'pull_request_target' 21 | uses: digital-asset/cla-action@v0.0.2 22 | env: 23 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 24 | # the below token should have repo scope and must be manually added by you in the repository's secret 25 | # This token is required only if you have configured to store the signatures in a remote repository/organization 26 | PERSONAL_ACCESS_TOKEN: ${{ secrets.PAT_FG_CCI_VALIDATOR_CLA }} 27 | with: 28 | path-to-document: 'https://github.com/digital-asset/daml/blob/main/CODE_OF_CONDUCT.md' # e.g. a CLA or a DCO document 29 | # branch should not be protected 30 | branch: 'main' 31 | allowlist: bot* 32 | custom-notsigned-prcomment: '🎉 Thank you for your contribution! It appears you have not yet signed the Agreement [DA Contributor License Agreement (CLA)](https://gist.github.com/digitalasset-cla), which is required for your changes to be incorporated into an Open Source Software (OSS) project. Please kindly read the and reply on a new comment with the following text to agree:' 33 | custom-pr-sign-comment: 'I have hereby read the Digital Asset CLA and agree to its terms' 34 | custom-allsigned-prcomment: '✅ All required contributors have signed the CLA for this PR. Thank you!' 35 | # Remote repository storing CLA signatures. 36 | remote-organization-name: DACH-NY 37 | remote-repository-name: cla-action-data 38 | # Branch where CLA signatures are stored. 39 | path-to-signatures: signatures/signatures.json 40 | 41 | # the followings are the optional inputs - If the optional inputs are not given, then default values will be taken 42 | #remote-organization-name: enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository) 43 | #remote-repository-name: enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository) 44 | #create-file-commit-message: 'For example: Creating file for storing CLA Signatures' 45 | #signed-commit-message: 'For example: $contributorName has signed the CLA in $owner/$repo#$pullRequestNo' 46 | #custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign' 47 | #custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA' 48 | #custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.' 49 | #lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true) 50 | #use-dco-flag: true - If you are using DCO instead of CLA 51 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.jl.cov 2 | *.jl.*.cov 3 | *.jl.mem 4 | deps/deps.jl 5 | .vscode 6 | _site 7 | .jekyll-cache 8 | .jekyll-metadata 9 | default.nix 10 | .envrc 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2015 Ian Hellström 4 | Copyright (c) 2016 Harris Brakmic 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Daml logo](daml-logo.png)](https://www.daml.com) 2 | 3 | [![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/DACH-NY/daml-cheat-sheat/blob/master/LICENSE) 4 | 5 | Copyright 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All Rights Reserved. 6 | SPDX-License-Identifier: MIT 7 | 8 | # Daml Cheat-Sheet 9 | 10 | This repository contains the source code behind the Daml cheat-sheet. 11 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | title: The Fast Track to Daml 2 | baseurl: "." # this needs to be set for deployment! 3 | description: "The Fast Track to Daml - Daml Cheat Sheet" 4 | github_username: digitalasset 5 | markdown: kramdown 6 | 7 | t: 8 | en: 9 | name: "English" 10 | fast-track: "The Fast Track to " 11 | quick-dirty: "The TL;DR; for " 12 | github-1: "This page's source is" 13 | github-2: "located here" 14 | github-3: "Pull requests are welcome!" 15 | translate: "Help translate!" # Not used for `en` 16 | -------------------------------------------------------------------------------- /_data/blocks.yml: -------------------------------------------------------------------------------- 1 | - file: What-is.md 2 | title: What is…? 3 | - file: Concepts.md 4 | title: Concepts 5 | - file: CommandLine.md 6 | title: Command line tools 7 | - file: Basics.md 8 | title: Basics 9 | - file: Types.md 10 | title: Types 11 | - file: Data.md 12 | title: Data 13 | - file: Functions.md 14 | title: Functions 15 | - file: Templates.md 16 | title: Contract Templates 17 | - file: ContractKeys.md 18 | title: Contract keys 19 | - file: Choices.md 20 | title: Choices 21 | - file: Updates.md 22 | title: Updates 23 | - file: Scripts.md 24 | title: Scripts 25 | - file: JavaScript.md 26 | title: JavaScript/React API 27 | - file: Resources.md 28 | title: DAML resources 29 | -------------------------------------------------------------------------------- /_includes/blocks.html: -------------------------------------------------------------------------------- 1 |
2 | 22 |
23 | -------------------------------------------------------------------------------- /_includes/en/Basics.md: -------------------------------------------------------------------------------- 1 | | | | 2 | | -------------------- | ----------------------------------------------------- | 3 | | End-of-line comment | `let i = 1 -- This is a comment` | 4 | | Delimited comment | `{- This is another comment -}` | 5 | 6 | Every Daml file starts with a module header like this: 7 | 8 | ``` 9 | module Foo where 10 | ``` 11 | -------------------------------------------------------------------------------- /_includes/en/Choices.md: -------------------------------------------------------------------------------- 1 | The choices of a contract template specify the rules on how and by whom contract data can be 2 | changed. 3 | 4 | ``` 5 | (nonconsuming) choice NameOfChoice : () 6 | -- optional nonconsuming annotation, name and choice return type 7 | with 8 | party1 : Party -- choice arguments 9 | party2 : Party 10 | i : Int 11 | controller party1, party2 -- parties that can execute this choice 12 | do -- the update that will be executed 13 | assert (i == 42) 14 | create ... 15 | exercise ... 16 | return () 17 | ``` 18 | 19 | Choices can be `consuming` or `nonconsuming`. 20 | 21 | | -------------------- | ----------------------------------------------------- | 22 | |`consuming`| The default. The contract is consumed by this choice. Trying to exercise another choice on the same contract id will fail.| 23 | |`nonconsuming`| The contract is not consumed by this choice and more choices can be exercised. | 24 | -------------------------------------------------------------------------------- /_includes/en/CommandLine.md: -------------------------------------------------------------------------------- 1 | | | | 2 | | -------------------- | ----------------------------------------------------- | 3 | | Install the daml assistant | `curl -sSL https://get.daml.com | sh -s ` | 4 | | Create a new Daml project | `daml new ` | 5 | | Create a new Daml/React full stack project | `daml new --template create-daml-app` | 6 | | Start the IDE | `daml studio` | 7 | | Build project | `daml build` | 8 | | Build project, start the sandbox and JSON-API | `daml start` | 9 | | Start the sandbox ledger (in wall-clock time-mode) | `daml sandbox` | 10 | | Start the sandbox ledger (in static time-mode) | `daml sandbox --static-time` | 11 | | Start the JSON-API server (requires a running ledger) | `daml json-api --ledger-host localhost --ledger-port 6865 --http-port 7575`| 12 | | Upload a dar to the ledger | `daml ledger upload-dar ` | 13 | | Run all test scripts and output test coverage report | `daml test --show-coverage --all --files Test.daml` | 14 | | Project configuration file | `daml.yaml` | 15 | -------------------------------------------------------------------------------- /_includes/en/Concepts.md: -------------------------------------------------------------------------------- 1 | | -------------------- | ----------------------------------------------------- | 2 | | `Party` | A party represents a person or legal entity (for example a bank). Parties can create contracts and exercise choices and are represented by the `Party` data type in Daml.

| 3 | | `Signatories, observers, and controllers` | Signatories, observers, and controllers are parties involved in actions taken on a contract, i.e., actions that are *exercised* on a contract. Signatories, observers, and controllers are therefore represented by the `Party` data type. They control who can read, create and archive a contract.

| 4 | | `Contract` | Contracts are created from blueprints called `templates` - this is the Daml code you write. Templates include:

- contract data (e.g., date, description, parties involved etc.)
- roles (signatory, observer)
- choices and their respective controllers (*who* gets to do *what*)

Every contract is a *template instance* stored as a row on the ledger. Contracts are immutable: once they are created on the ledger, the information in the contract cannot be changed. In order to "change" a contract you need to create a new one with the desired contract data.

| 5 | | `Choice` | A choice is something that a party can exercise (take action) on a contract. Choices give you a way to transform the data in a contract: while the contract itself is immutable, you can write a choice that archives the contract and creates a new version of it with the updated data.

A choice can only be exercised by its controller and contains the `authorization` of all of the contract's signatories as well as of the controller.

| 6 | | `Ledger` | The ledger represents the database where all contracts are recorded. More information on Daml Ledgers can be found here.

| 7 | 8 | If you are interested you can find the detailed glossary here and a free online course here. 9 | -------------------------------------------------------------------------------- /_includes/en/ContractKeys.md: -------------------------------------------------------------------------------- 1 | Contract keys are unique and stable references to a contract that won't change even if the contract 2 | id of that contract changes due to an update. 3 | 4 | Contract keys are optional. 5 | 6 | Contract keys have an associated set of key maintainer parties. These parties guarantee the uniquess 7 | of their maintained keys. 8 | 9 | Contract keys are specified on a contract template with the `key` and `maintainer` keywords. If you 10 | specify a `key` you also have to specify its `maintainers`. 11 | 12 | | -------------------- | ----------------------------------------------------- | 13 | | `key` | Can be any expression of the contract arguments that does _not_ contain a contract id. It _must_ include all maintainer parties specified in the `maintainer` field. | 14 | |`maintainer` | Keys are unique for all specified maintainers. The maintainers need to be a projection of the expression specified with `key`.| 15 | -------------------------------------------------------------------------------- /_includes/en/Data.md: -------------------------------------------------------------------------------- 1 | | | | 2 | | -------------------- | ----------------------------------------------------- | 3 | | Record | `data MyRecord = MyRecord { label1 : Int, label2 : Text}` | 4 | | Product type | `data IntAndText = IntAndText with myInt : Int, myText : Text` | 5 | | Sum type | `data IntOrText = MyInt Int | MyText Text` | 6 | | Record with type parameters | `data MyRecord a b = MyRecord {label1 : a, label2 : b}` | 7 | | Deriving Show/Eq instances | `data MyRecord = MyRecord {label : Int} deriving (Show, Eq)` | 8 | -------------------------------------------------------------------------------- /_includes/en/Functions.md: -------------------------------------------------------------------------------- 1 | | ------------------------ | ------------------------------------------------- | 2 | | Signature | `f : Text -> Text -> Text` 3 | | Definition | `f x y = x <> " " <> y` | 4 | | Lambda definition | `\x y -> x <> y` | 5 | | Polymorphic functions | `f : (Show a, Eq a) => a -> Text -> Text`| 6 | | Function application | `f "hello" "world!"` | 7 | | Partial application of functions | `salute : Text -> Text`
`salute = f "Hello"`| 8 | 9 | Functions are first class members of Daml, in particular, functions can be arguments to functions 10 | ``` 11 | apply : (Text -> Text) -> Text -> Text 12 | apply h x = h x 13 | 14 | apply salute "John" -- "Hello John" 15 | ``` 16 | -------------------------------------------------------------------------------- /_includes/en/JavaScript.md: -------------------------------------------------------------------------------- 1 | Daml ledgers expose a unified API for interaction. 2 | 3 | The following describes how to interact with a ledger using the TypeScript libraries `@daml/ledger`, `@daml/react` in a 5 | frontend build with React . 6 | 7 | Import the libraries via: 8 | 9 | ``` 10 | import Ledger from @daml/ledger 11 | import {useParty, ...} from @daml/react 12 | ``` 13 | 14 | React entry point: 15 | 16 | ```typescript 17 | import DamlLeddger from @daml/react 18 | 19 | const App: React.FC = () => { 20 | 22 | httpBaseUrl?: 23 | wsBaseUrl?: 24 | party: 25 | > 26 | 27 | 28 | }; 29 | ``` 30 | 31 | | -------------------- | ----------------------------------------------------- | 32 | | Get the logged in party | `const party = useParty();`
`...`
`

You're logged in as {party}

`| 33 | | Query the ledger | `const {contracts: queryResult, loading: isLoading, } = useQuery(ContractTemplate, () => ({field: value}), [dep1, dep2, ...]) ` | 34 | | Query for contract keys | `const {contracts, loading} = useFetchByKey(ContractTemplate, () => key, [dep1, dep2, ...])` | 35 | | Reload the query results | `reload = useReload();`
`...`
`onClick={() => reload()}`| 36 | | Query the ledger, returns a refreshing stream | `const {contracts, loading}` = useStreamQuery(ContractTemplate, () => ({field: value}), [dep1, dep2, ...]) ` | 37 | | Query for contract keys, returns a refreshing stream | `const {contracts, loading} = useStreamFetchByKey(ContractTemplate, () => key, [dep1, dep2, ...])` | 38 | | Create a contract on the ledger | `const ledger = useLedger();`
`const newContract = await ledger.create(ContractTemplate, arguments)`| 39 | | Archive a contract on the ledger | `const ledger = useLedger();`
`const archiveEvent = await ledger.archive(ContractTemplate, contractId)`| 40 | | Exercise a contract choice on the ledger | `const ledger = useLedger();`
`const [choiceReturnValue, events] = await ledger.exercise(ContractChoice, contractId, choiceArguments)`| 41 | -------------------------------------------------------------------------------- /_includes/en/Resources.md: -------------------------------------------------------------------------------- 1 | - [Official documentation](https://docs.daml.com) 2 | - [The Daml code repository](https://github.com/digital-asset/daml) 3 | - [A Daml project template](https://github.com/digital-asset/create-daml-app) 4 | - [Read about how people are using Daml on the Daml Blog](https://daml.com/blog) 5 | -------------------------------------------------------------------------------- /_includes/en/Scripts.md: -------------------------------------------------------------------------------- 1 | Daml script is a scripting language to run Daml commands against a ledger. For example: 2 | 3 | ``` 4 | module Test where 5 | 6 | import Daml.Script 7 | 8 | test : Script () 9 | test = do 10 | alice <- allocateParty "Alice" 11 | bob <- allocateParty "Bob" 12 | c <- submit alice $ createCmd NewContract with ... 13 | submit bob $ exerciseCmd c Accept with ... 14 | ``` 15 | 16 | Scripts are compiled like usual Daml code to a `dar` package with the `daml build` command. 17 | 18 | | -------------------- | ----------------------------------------------------- | 19 | | Running a script | `daml script --dar example-0.0.1.dar --script-name ModuleName:scriptFunction --ledger-host localhost --ledger-port 6865` 20 | | Running a script with initial arguments given | `daml script --dar example-0.0.1.dar --input-file arguments_in_damllf_json.json --script-name ModuleName:scriptFunction --ledger-host localhost --ledger-port 6865` | 21 | | Allocating a party on the ledger | `alice <- allocateParty "Alice"` | 22 | | List all known parties on the ledger | `parties <- listKnownParties` | 23 | | Query for a given contract template visible to a given party | `query @ExampleTemplate alice` | 24 | | Create a new contract | `createCmd ExampleTemplate with ...` | 25 | | Exercise a choice on a contract | `exerciseCmd contractId ChoiceName with ... ` | 26 | | Exercise a choice on a contract by contract key | `exerciseByKeyCmd contractKey ChoiceName with ... ` | 27 | | Create and then exercise a choice on the created contract | `createAndExerciseCmd (ExampleTemplate with ... ) (ChoiceName with ...)` | 28 | | Pass time on the ledger (only applicable for a ledger running in **STATIC TIME MODE**, like the in-memory ledger of Daml Studio or `daml test`) | `passTime (hours 10)` | 29 | | Set time on the ledger (only applicable for a ledger running in **STATIC TIME MODE**, like the in-memory ledger of Daml Studio or `daml test`) | `setTime (time (date 2007 Apr 5) 14 30 05)` | 30 | -------------------------------------------------------------------------------- /_includes/en/Templates.md: -------------------------------------------------------------------------------- 1 | Contract templates describe data that will be stored on the ledger. Templates determine who can read 2 | and write data; and by whom and how this data can be altered. 3 | A contract template is defined with the `template` keyword: 4 | 5 | ``` 6 | template MyData 7 | with 8 | i : Int 9 | party1 : Party 10 | party2 : Party 11 | dataKey : (Party, Text) 12 | where 13 | signatory party1 14 | observer party2 15 | key dataKey : (Party, Text) 16 | maintainer key._1 17 | 18 | choice MyChoice : () 19 | ... 20 | ``` 21 | 22 | `with` and `where` are keywords to structure the template. 23 | 24 | | -------------------- | ----------------------------------------------------- | 25 | | `signatory` | Observes the contract and its evolution. Gives the signatory's authority to all the defined contract updates in the contract choices. | 26 | | `observer` | Observes the contract and its evolution. | 27 | | `key` | A field of the contract data used as primary index of contracts defined by this template, see `Contract Keys`. | 28 | | `maintainer` | A set of parties that guarantee uniqueness of contract keys of this template on the ledger, see `Contract Keys`. | 29 | 30 | -------------------------------------------------------------------------------- /_includes/en/Types.md: -------------------------------------------------------------------------------- 1 | | ------------------------ | ------------------------------------------------- | 2 | | Type annotation | `myVar : TypeName`| 3 | | Builtin types | `Int, Decimal, Numeric n, Text, Bool, Party, Date, Time, RelTime` | 4 | | Type synonym | `type MyInt = Int` | 5 | | Lists | `type ListOfInts = [Int]`| 6 | | Tuples | `type MyTuple = (Int, Text)` | 7 | | Polymorphic types | `type MyType a b = [(a, b)]`| 8 | -------------------------------------------------------------------------------- /_includes/en/Updates.md: -------------------------------------------------------------------------------- 1 | Updates specify the transactions that will be committed to the ledger. Updates are described within 2 | a `do` block: 3 | 4 | ``` 5 | do 6 | cid <- create NewContract with field1 = 1 7 | , field2 = "hello world" 8 | let answer = 42 9 | exercise cid SomeChoice with choiceArgument = "123" 10 | return answer 11 | ``` 12 | 13 | 14 | | -------------------- | ----------------------------------------------------- | 15 | | `create` | create an instance of the given template on the ledger
`create NameOfTemplate with exampleParameters` | 16 | | `exercise` | exercise a choice on a given contract by contract id
`exercise IdOfContract NameOfChoiceContract with choiceArgument1 = value1 `| 17 | | `exerciseByKey` | exercise a choice on a given contract by contract key
`exerciseByKey @ContractType contractKey NameOfChoiceOnContract with choiceArgument1 = value1 ` | 18 | | `fetch` | fetch the contract data from the ledger by contract id
`fetchedContract <- fetch IdOfContract `| 19 | | `fetchByKey` | fetch the contract id and data from the ledger by contract key
`fetchedContract <- fetchByKey @ContractType contractKey` | 20 | | `lookupByKey` | check whether a contract with the given key exists and if yes, return the contract id
`fetchedContractId <- lookupByKey @ContractType contractKey` | 21 | | `abort` | abort a transaction with an error message, the transaction will not be committed to the ledger
`abort errorMessage` | 22 | | `assert` | assert that a given predicate holds, otherwise fail the transaction
`assert (condition == True)` | 23 | | `getTime` | get the ledger effective time
`currentTime <- getTime `| 24 | | `return` | return a value from a `do` block
`return 42`| 25 | | `let` | bind a local variable or define a local function within the update `do` block
`let createContract x = create NameOfContract with issuer = x; owner = x`
`let answer = 42 `| 26 | | `this` | refers to the current contract data that contains this update in a choice
`create NewContract with owner = this.owner` | 27 | | `forA` | run a for loop of actions over a list
`forA [alice, bob, charlie] $ \p -> create NewContract with owner = p` | 28 | -------------------------------------------------------------------------------- /_includes/en/What-is.md: -------------------------------------------------------------------------------- 1 | [Daml](https://daml.com) is an open-source smart contract language designed to build composable 2 | applications on an abstract ledger model. 3 | 4 | Daml is a high level language that focuses on data privacy and authorization of distributed 5 | applications. These concepts are represented first class in the language. 6 | 7 | By abstracting data privacy and authorization, Daml takes the burden off the programmer to think 8 | about concrete cryptographic primitives and lets her focus on workflow logic. 9 | 10 | Daml is a statically typed functional language. 11 | 12 | The full documentation of Daml can be found here . 13 | -------------------------------------------------------------------------------- /_includes/header.html: -------------------------------------------------------------------------------- 1 |
2 |
3 |

{{ site.t[page.lang]["fast-track"] }}

4 |

{{ site.t[page.lang]["quick-dirty"] }}

5 |
6 | DAML 7 | 8 | 9 | 10 |
11 | 12 |
13 | {{ site.t[page.lang]["github-1"] }} 14 | 15 | {{ site.t[page.lang]["github-2"] }} 16 | . 17 | {{ site.t[page.lang]["github-3"] }} 18 |
19 | -------------------------------------------------------------------------------- /_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The Fast Track to DAML 6 | 7 | 8 | 9 | 10 | 17 | 18 | 19 | 20 | 21 | 22 | {% include header.html %} 23 | 24 | {{ content }} 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /cheatsheet.css: -------------------------------------------------------------------------------- 1 | @import url(https://fonts.googleapis.com/css?family=Ubuntu); 2 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Condensed); 3 | @import url(https://fonts.googleapis.com/css?family=Ubuntu+Mono); 4 | 5 | /******************************************************************* 6 | * CSS reset adapted from http://meyerweb.com/eric/tools/css/reset * 7 | *******************************************************************/ 8 | 9 | html, 10 | body, 11 | div, 12 | span, 13 | applet, 14 | object, 15 | iframe, 16 | h1, 17 | h2, 18 | h3, 19 | h4, 20 | h5, 21 | h6, 22 | p, 23 | blockquote, 24 | pre, 25 | a, 26 | abbr, 27 | acronym, 28 | address, 29 | big, 30 | cite, 31 | code, 32 | del, 33 | dfn, 34 | em, 35 | img, 36 | ins, 37 | kbd, 38 | q, 39 | s, 40 | samp, 41 | small, 42 | strike, 43 | sub, 44 | sup, 45 | tt, 46 | var, 47 | b, 48 | u, 49 | i, 50 | center, 51 | dl, 52 | dt, 53 | dd, 54 | ol, 55 | ul, 56 | li, 57 | fieldset, 58 | form, 59 | label, 60 | legend, 61 | table, 62 | caption, 63 | tbody, 64 | tfoot, 65 | thead, 66 | tr, 67 | th, 68 | td, 69 | article, 70 | aside, 71 | canvas, 72 | details, 73 | embed, 74 | figure, 75 | figcaption, 76 | footer, 77 | header, 78 | hgroup, 79 | menu, 80 | nav, 81 | output, 82 | ruby, 83 | section, 84 | summary, 85 | time, 86 | mark, 87 | audio, 88 | video { 89 | margin: 0; 90 | padding: 0; 91 | border: 0; 92 | font-size: 100%; 93 | font: inherit; 94 | vertical-align: baseline; 95 | text-decoration: none; 96 | } 97 | 98 | article, 99 | aside, 100 | details, 101 | figcaption, 102 | figure, 103 | footer, 104 | header, 105 | hgroup, 106 | menu, 107 | nav, 108 | section { 109 | display: block; 110 | } 111 | 112 | body { 113 | line-height: 1; 114 | } 115 | 116 | blockquote, 117 | q { 118 | quotes: none; 119 | } 120 | 121 | blockquote:before, 122 | blockquote:after, 123 | q:before, 124 | q:after { 125 | content: ''; 126 | content: none; 127 | } 128 | 129 | table { 130 | border-collapse: collapse; 131 | border-spacing: 0; 132 | width: 100%; 133 | } 134 | 135 | 136 | /****************** 137 | * Custom styling * 138 | ******************/ 139 | 140 | body { 141 | font-family: 'Ubuntu', sans-serif; 142 | text-align: center; 143 | color: #2a2a2a; 144 | margin: 1em; 145 | } 146 | 147 | h1 { 148 | display: table-cell; 149 | font-size: 200%; 150 | font-weight: bold; 151 | vertical-align: middle; 152 | text-align: right; 153 | } 154 | 155 | h2 { 156 | font-size: 1.2em; 157 | margin: 8px 0px 8px 20px; 158 | font-weight: bold; 159 | } 160 | 161 | #top h1 { 162 | display: block; 163 | text-align: right; 164 | } 165 | 166 | #top h2 { 167 | font-family: 'Ubuntu Condensed', sans-serif; 168 | font-size: 120%; 169 | text-align: right; 170 | font-weight: normal; 171 | } 172 | 173 | footer { 174 | font-size: 80%; 175 | } 176 | 177 | #thanks:before { 178 | content: "Thanks (alphabetically): "; 179 | font-size: larger; 180 | } 181 | 182 | #top { 183 | display: inline-flex; 184 | } 185 | 186 | #title { 187 | margin: auto; 188 | } 189 | 190 | #version { 191 | font-size: larger; 192 | vertical-align: bottom; 193 | margin-left: 0em; 194 | margin-top: auto; 195 | margin-bottom: 1.5em; 196 | } 197 | 198 | #contents { 199 | -webkit-columns: 6 34em; 200 | -moz-columns: 6 34em; 201 | columns: 6 34em; 202 | -webkit-column-gap: 0.25em; 203 | -moz-column-gap: 0.25em; 204 | column-gap: 0.25em; 205 | } 206 | 207 | 208 | /* 209 | * Note: a coloured box title for a rounded box would require a hidden overflow to 210 | * avoid colour spilling over the border. This, however, clashes with tooltips in 211 | * all but the very first column due to the absolute positioning. 212 | */ 213 | 214 | .box { 215 | display: inline-block; 216 | position: relative; 217 | border: 1px solid #2a2a2a; 218 | border-bottom-left-radius: 0.5em; 219 | border-bottom-right-radius: 0.5em; 220 | text-align: left; 221 | background-color: #e6f2ff; 222 | margin: 0.5em; 223 | padding-bottom: 0.5em; 224 | width: 35em; 225 | word-wrap: break-word; 226 | } 227 | 228 | #contents>ol, 229 | ul { 230 | list-style: none; 231 | } 232 | 233 | .box .title { 234 | /*background: linear-gradient(180deg, #bf655f, #f6f6f6);*/ 235 | background: #4d64ae; 236 | padding: .5em; 237 | margin-bottom: 1em; 238 | } 239 | 240 | .box h1 { 241 | font-family: 'Consolas', sans-serif; 242 | font-size: 120%; 243 | font-weight: bold; 244 | padding-left: 0.25em; 245 | padding-right: 0.25em; 246 | color: white; 247 | } 248 | 249 | .box p { 250 | padding: 0.25em 0.5em 0.25em 0.5em; 251 | text-align: justify; 252 | } 253 | 254 | .box em { 255 | font-style: italic; 256 | } 257 | 258 | le .box table { 259 | border-spacing: 0.1em; 260 | border-collapse: collapse; 261 | margin-left: 0.5em; 262 | margin-right: 0.5em; 263 | } 264 | 265 | .box table td { 266 | padding: 0.1em 0.5em 0.1em 0.5em; 267 | vertical-align: middle; 268 | } 269 | 270 | .box table tr:nth-child(odd) { 271 | background-color: #ffffff; 272 | } 273 | 274 | .box ul li { 275 | list-style-type: square; 276 | margin-left: 2em; 277 | } 278 | 279 | .centred { 280 | display: table; 281 | margin-left: auto; 282 | margin-right: auto; 283 | } 284 | 285 | .indented { 286 | display: block; 287 | margin-left: auto; 288 | margin-right: auto; 289 | width: 32em; 290 | } 291 | 292 | pre { 293 | font-family: 'Ubuntu Mono', monospace; 294 | color: #80ab5d; 295 | } 296 | 297 | code { 298 | display: inline-block; 299 | white-space: pre-wrap; 300 | font-family: 'Ubuntu Mono', monospace; 301 | color: darkgreen; 302 | } 303 | 304 | pre code { 305 | margin-left: 20px; 306 | } 307 | 308 | a { 309 | color: #7182dc; 310 | text-decoration: #2a2a2e; 311 | } 312 | 313 | a:hover { 314 | color: #2e44b9; 315 | text-decoration: underline; 316 | } 317 | 318 | 319 | /******************************************************************** 320 | * Tooltip adapted from http://www.menucool.com/tooltip/css-tooltip * 321 | ********************************************************************/ 322 | 323 | a.tooltip { 324 | outline: none; 325 | color: #9e7abe; 326 | } 327 | 328 | a.tooltip:hover { 329 | color: #6b458d; 330 | text-decoration: none; 331 | cursor: help; 332 | } 333 | 334 | a.tooltip span { 335 | display: none; 336 | max-width: 33.5em; 337 | padding: 0.25em; 338 | text-align: center; 339 | color: #2a2a2a; 340 | } 341 | 342 | a.tooltip:hover span { 343 | display: block; 344 | position: absolute; 345 | border: 1px solid #5d5d5d; 346 | background: rgba(195, 195, 195, 0.9); 347 | } 348 | 349 | a.tooltip span { 350 | border-radius: 0.25em; 351 | box-shadow: 0.1em 0.1em 0.1em #909090; 352 | } 353 | 354 | .footer-text { 355 | padding-top: 2em; 356 | padding-bottom: 1em; 357 | } 358 | 359 | .individual-styling>.bold { 360 | color: blue; 361 | } 362 | 363 | .github-info { 364 | font-style: italic; 365 | font-size: smaller; 366 | } 367 | 368 | small { 369 | font-size: smaller; 370 | font-style: italic; 371 | } 372 | 373 | .languages { 374 | display: inline-block; 375 | float: left; 376 | left: 20px; 377 | margin: 20px; 378 | text-align: left; 379 | position: absolute; 380 | transition: 0.1s; 381 | } 382 | 383 | .language { 384 | width: 32px; 385 | padding: 3px; 386 | vertical-align: middle; 387 | } 388 | 389 | .language-link { 390 | font-size: 1.25em; 391 | background: #e6f2ff; 392 | padding: 5px; 393 | } 394 | 395 | .language-link:hover { 396 | background: #fafcff; 397 | } 398 | 399 | .others { 400 | border: 2px #4d64ae solid; 401 | visibility: hidden; 402 | position: absolute; 403 | z-index: 1; 404 | opacity: 0; 405 | min-width: 260px; 406 | transform: translateY(-2em); 407 | transition: all 0.2s ease-in-out 0s, visibility 0s linear 0.2s; 408 | } 409 | 410 | .languages:hover .others { 411 | visibility: visible; 412 | transform: translateY(0em); 413 | opacity: 1; 414 | transition-delay: 0s, 0s; 415 | } 416 | 417 | .languages a { 418 | text-decoration: none; 419 | color: black; 420 | } 421 | 422 | @media(min-width:576px) {} 423 | 424 | @media(min-width:768px) {} 425 | 426 | @media(min-width:992px) { 427 | .box { 428 | width: 35em; 429 | } 430 | } 431 | 432 | @media(min-width:1500px) { 433 | .box { 434 | width: 43em; 435 | } 436 | } 437 | 438 | @media(min-width:1600px) { 439 | .box { 440 | width: 30em; 441 | } 442 | } 443 | -------------------------------------------------------------------------------- /daml-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digital-asset/daml-cheat-sheet/59d1912a70168d48ddb93ea9b6c765ac0448754b/daml-logo.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | --- 2 | lang: en 3 | layout: default 4 | --- 5 | 6 | {% include blocks.html %} 7 | --------------------------------------------------------------------------------