Write and run test scripts for Daml smart contracts using Daml Script and dpm test.
Daml Script is the primary testing tool for Daml contracts. You write test scenarios as Script () values in Daml source files, then run them with dpm test. Scripts execute on a fresh, empty ledger and can allocate parties, submit commands, query state, and assert expected outcomes.For the complete function and type reference, see Daml.Script API Reference.
Writing a Test Script
A Daml Script is a function that returns Script (). Place your scripts in a test package that depends on your contract package (keep templates and tests in separate packages for clean deployment).
module MyTests whereimport Daml.Scriptimport Licensing.LicensetestCreateAndTransfer : Script ()testCreateAndTransfer = do -- Allocate test parties alice <- allocateParty "Alice" bob <- allocateParty "Bob" -- Create a contract licenseCid <- submit alice do createCmd License with owner = alice issuer = alice description = "Test License" -- Exercise a choice newLicenseCid <- submit alice do exerciseCmd licenseCid Transfer with newOwner = bob -- Query and assert Some license <- queryContractId bob newLicenseCid assert (license.owner == bob) pure ()
Running Tests
With dpm test
Run all scripts in the current package:
dpm test
The output shows each script’s result, the number of active contracts at the end, and the number of transactions executed. A summary at the end includes test coverage information:
Test SummaryMyTests.daml:testCreateAndTransfer: ok, 1 active contracts, 3 transactions.
In VS Code
If you have Daml Studio installed (dpm studio), a “Script results” lens appears above each script definition. Click it to run the script and see the results in a side panel. The panel shows two views:
Table view — Active contracts at the end of the script, with visibility per party
Transaction view — Every transaction and sub-transaction, useful for debugging authorization failures
Key Script Functions
Party Allocation
alice <- allocateParty "Alice"bob <- allocateParty "Bob"
Creates test parties that exist only for the duration of the script. Party names are for display only and do not need to match production party identifiers.
Command Submission
Use submit to send commands as a specific party:
-- Create a contractcid <- submit alice do createCmd MyTemplate with field1 = "value", field2 = alice-- Exercise a choiceresult <- submit alice do exerciseCmd cid MyChoice with choiceArg = 42
Use submitMustFail to assert that a command should be rejected (e.g., unauthorized access):
submitMustFail bob do exerciseCmd cid MyChoice with choiceArg = 42
Querying State
-- Query all active contracts of a type visible to a partycontracts <- query @MyTemplate alice-- Query a specific contract by IDoptContract <- queryContractId alice cid
Assertions
assert (length contracts == 3)assertMsg "Owner should be Bob" (contract.owner == bob)
Time Manipulation
For contracts with time-dependent logic (expiration, vesting schedules):
-- Advance ledger timepassTime (days 30)-- Set a specific timesetTime (time (date 2025 Jun 15) 0 0 0)
passTime is essential for testing workflows that depend on elapsed time, such as license expiration or payment schedules.
Test Organization
Structure your test packages to mirror your contract packages:
The tests/daml.yaml declares a dependency on the contracts package. Run dpm test from the tests/ directory, or dpm build --all and then dpm test from the project root.
Coverage Report
dpm test produces a coverage report showing which templates and choices your scripts exercised. This helps identify untested contract paths:
External templates 5 defined 4 ( 80.0%) created in any testsExternal template choices 12 defined 8 ( 66.7%) exercised in any tests
Aim for high coverage on all choices that will run in production. See the testing guide for a detailed walkthrough.
In this section we test the Token model from contracts using the Daml Script integration in Daml Studio. This includes:
Script basics
Running scripts
Creating contracts
Testing for failure
Archiving contracts
Viewing the ledger and ledger history
Remember that you can load all the code for this section into a folder called intro-daml-scripts by running dpm new intro-daml-scripts --template daml-intro-daml-scripts
Script basics
A Script is like a recipe for a test, letting you create a scenario where different parties submit a series of transactions to check that your templates behave as you expect. You can also script some external information like party identities and ledger time.Below is a basic script that creates a Token for a party called “Alice”:
token_test_1 = script do alice <- allocateParty "Alice" submit alice do createCmd Token with owner = alice
You declare a Script as a top-level variable and introduce it using script do. do always starts a block, so the rest of the script is indented.Before you can create any Token contracts, you need some parties on the test ledger. The above script uses the function allocateParty to put a party called “Alice” in a variable alice. There are two things of note there:
Use of <- instead of =.The reason for this is that allocateParty is an Action that can only be performed once the Script is run in the context of a ledger. <- means “run the action and bind the result”. It can only be run in that context because, depending on the ledger state, allocateParty gives you back a party with the name you specified or appends a suffix to that name if such a party has already been allocated. You can read more about Actions and do blocks in constraints.If that doesn’t quite make sense yet, for the time being you can think of this arrow as extracting the right-hand-side value from the ledger and storing it into the variable on the left.
The argument "Alice" to allocateParty does not have to be enclosed in brackets. Functions in Daml are called using the syntax fn arg1 arg2 arg3.
With a variable alice of type Party in hand, you can submit your first transaction using the submit function. submit takes two arguments: the Party and the Commands.Just like Script is a recipe for a test, Commands is a recipe for a transaction. createCmd Token with owner = alice is a Commands, which translates to a list of commands to be submitted to the ledger. These commands create a transaction which in turns creates a Token with owner Alice.You’ll learn all about the syntax Token with owner = alice in data.You could write this as submit alice (createCmd Token with owner = alice), but as with scripts, you can assemble commands using do blocks. A do block always takes the value of the last statement within it so the syntax shown in the commands above gives the same result, whilst being easier to read. Note, however, that the commands submitted as part of a transaction are not allowed to depend on each other.
Run the scripts
There are a few ways to run Daml Scripts:
In Daml Studio against a test ledger, providing visualizations of the resulting ledger.
Using the command line dpm test also against a test ledger, useful for continuous integration.
Against a real ledger. See the documentation for Daml Script for more information.
In Daml Studio, you should see the text “Script results” just above the line token_test_1 = do. Click on that text to display the outcome of the script.This opens the script view in a separate column in VS Code. The default view is a tabular representation of the final state of the ledger:What this display means:
The big title reading Token_Test:Token identifies the type of contract that’s listed below. Token_Test is the module name, Token is the template name.
The first column shows the ID of the contract. This will be explained later.
The second column shows the status of the contract, either active or archived.
The next section of columns show the contract arguments, with one column per field. As expected, here there is one field and thus one column: the field owner is 'Alice'. The single quotation marks indicate that Alice is a party.
The remaining columns, labelled vertically, show which parties know about which contracts. In this simple script, the sole party “Alice” knows about the contract she created.
To run the same test from the command line, save your module in a file Token_Test.daml and run dpm test --files Token_Test.daml. If your file contains more than one script, this runs all of them.
Test for failure
In contracts you learned that creating a Token requires the authority of its owner. In other words, it should not be possible for Alice to create a token for another party, e.g. Bob, or vice versa. A reasonable attempt to test that would be:
failing_test_1 = do alice <- allocateParty "Alice" bob <- allocateParty "Bob" submit alice do createCmd Token with owner = bob submit bob do createCmd Token with owner = alice
However, if you open the script view for that script, you see the following message:The script failed, as expected, but scripts abort at the first failure. This means that it only tested that Alice cannot create a token for Bob; the second submit statement was never reached.To test for failing submits and keep the script running thereafter, or fail if the submission succeeds, you can use the submitMustFail function:
token_test_2 = do alice <- allocateParty "Alice" bob <- allocateParty "Bob" submitMustFail alice do createCmd Token with owner = bob submitMustFail bob do createCmd Token with owner = alice submit alice do createCmd Token with owner = alice submit bob do createCmd Token with owner = bob
submitMustFail never has an impact on the ledger, so the resulting tabular script view only shows the two tokens resulting from the successful submit statements. Note the new column for Bob as well as the visibilities. Alice and Bob cannot see each others’ tokens.
Archive contracts
Archiving contracts is the counterpart to creating contracts. Contracts are immutable, so whenever you want to update one (loosely: change its state) you must archive the current contract residing on the ledger and create a new one.To archive a contract, use archiveCmd instead of createCmd. Whereas createCmd takes an instance of a template, archiveCmd takes a reference to a created contract. Archiving requires authorization from controllers.Contracts are also archived whenever a consuming choice is exercised.
Archive choices are present on all templates and cannot be removed.
References to contracts have the type ContractId a, where a is a type parameter representing the template type of the contract that the id refers to. For example, a reference to a Token would be a ContractId Token.To archiveCmd the token Alice has created, you need the contract id. Retrieve the contract id from the ledger with the <- notation. How this works is discussed in constraints.This script first checks that Bob cannot archive Alice’s token. Then Alice successfully archives it:
token_test_3 = do alice <- allocateParty "Alice" bob <- allocateParty "Bob" alice_token <- submit alice do createCmd Token with owner = alice submitMustFail bob do archiveCmd alice_token submit alice do archiveCmd alice_token
View the ledger and its history
Once you archive the contract the resulting script view is empty; there are no contracts left on the ledger. If you want to see the history of the ledger, e.g. to see how you got to that state, tick the “Show archived” box at the top of the ledger view:You can see that there was a Token contract, which is now archived, indicated both by the “archived” value in the status column as well as by a strikethrough.Click on the adjacent “Show transaction view” button to see the entire transaction graph:In the Daml Studio script runner, committed transactions are numbered sequentially. In the image above, the lines starting with TX indicate that there are three committed transactions, with ids #0, #1, and #2. These correspond to the three submit and submitMustFail statements in the script.Transaction #0 has one sub-transaction#0:0, which the arrow indicates is a create of a Token. Identifiers #X:Y mean commit X, sub-transaction Y. All transactions have this format in the script runner. However, this format is a testing feature. In general, you should consider transaction and contract IDs to be opaque.The lines above and below create Token_Test:Token give additional information:
consumed by: #2:0 tells you that the contract is archived in sub-transaction 0 of commit 2.
referenced by #2:0 tells you that the contract was used in other transactions, and lists their IDs.
disclosed to (since): 'Alice' (#0) tells you who knows about the contract. The fact that 'Alice' appears in the list is equivalent to an x in the tabular view. The (#0) gives you the additional information that Alice learned about the contract in commit #0.
Everything following with shows the create arguments.
Exercises
To get a better understanding of script, try the following exercises:
Write a template for a second type of token.
Write a script with two parties and two types of tokens, creating one token of each type for each party and archiving one token for each party, leaving one token of each type in the final ledger view.
In archiving you tested that Bob cannot archive Alice’s token. Can you guess why the submit fails? How can you find out why the submit fails?
Hint: Remember that in intro_2_failure we saw a proper error message for a failing submit.
Next up
In archive you will build a Daml archive, that you can upload to a Canton participant node to interact with its ledger.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Canton Network Docs","colors":{"primary":"#734BE2","light":"#A985FF","dark":"#7B59E8"},"logo":{"light":"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-dark.svg?fit=max\u0026auto=format\u0026n=OOy41G-b8QJx6Gkr\u0026q=85\u0026s=d5d59c10fc4ca9be021afb188db72e2f","dark":"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-white.svg?fit=max\u0026auto=format\u0026n=OOy41G-b8QJx6Gkr\u0026q=85\u0026s=820871bab1b1be90578959e03e4a3001","href":"/"},"favicon":"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-dark.svg?fit=max\u0026auto=format\u0026n=OOy41G-b8QJx6Gkr\u0026q=85\u0026s=d5d59c10fc4ca9be021afb188db72e2f","appearance":{"default":"system"},"footer":{"socials":{"x":"https://x.com/CantonNetwork","github":"https://github.com/canton-network","linkedin":"https://www.linkedin.com/company/canton-network","discord":"https://discord.gg/canton","telegram":"https://t.me/CantonNetwork1"},"links":[{"header":"Legal","items":[{"label":"Documentation License (CC-BY-4.0)","href":"https://creativecommons.org/licenses/by/4.0"},{"label":"Code License (Apache-2.0)","href":"https://www.apache.org/licenses/LICENSE-2.0"}]}]},"fonts":{"heading":{"family":"Inter","weight":700},"body":{"family":"Inter","weight":400}},"styling":{"eyebrows":"breadcrumbs","codeblocks":{"theme":{"light":"github-light","dark":"github-dark"}},"latex":true},"integrations":{"ga4":{"measurementId":"G-F2G1L137JX"},"cookies":{}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"markdown":{"instructions":"If you are building a Canton Network application, start from https://docs.canton.network/appdev/quickstart.md. To run only a local network for your own Daml code, without building the QuickStart demo, see https://docs.canton.network/sdks-tools/development-tools/localnet.md."},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"cantonfoundation","hasAudioNarration":false,"actualSubdomain":"cantonfoundation","customDomains":["docs.canton.network"],"gitSource":{"type":"github","owner":"canton-network","repo":"cf-docs","deployBranch":"main","contentDirectory":"docs-main","isPrivate":false,"mountPath":"","label":""},"feedback":{"contextualFeedback":{"allowEmail":true},"edits":true,"issues":true,"thumbs":true,"agentFeedback":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6b0ea6118007c388aa2daf7a","clientVersion":"0.0.4377","searchFilterCounts":[{"language":"default","tag":"API Reference","count":1006},{"language":"default","tag":"Packages","count":503},{"language":"default","tag":"Ledger API","count":449},{"language":"default","tag":"Services","count":283},{"language":"default","tag":"Splice APIs","count":272},{"language":"default","tag":"gRPC API","count":234},{"language":"default","tag":"Java Bindings","count":196},{"language":"default","tag":"Admin API","count":157},{"language":"default","tag":"com.daml.ledger.javaapi.data","count":151},{"language":"default","tag":"Release Notes","count":130}],"searchSettings":{"isFiltersEnabled":false,"showContentSnippets":true}},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"type":"link","url":"https://forum.canton.network/"}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"control","enabled":true,"payload":{"type":"string","value":"control"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"starterQuestions":[],"privacy":{"consentBanner":{"enabled":false}},"googleFontsInlined":false},"customCss":[{"filePath":"styles.css","content":":root{--canton-highlight: #734BE2;--canton-highlight-rgb: 115, 75, 226;--canton-selected-bg: rgba(115, 75, 226, 0.10);--canton-hover-bg: rgba(115, 75, 226, 0.05);--canton-inline-highlight-bg: rgba(115, 75, 226, 0.14);--canton-inline-highlight-border: rgba(115, 75, 226, 0.26);--canton-product-selector-line: rgba(115, 75, 226, 0.70);--canton-product-selector-line-active: #734BE2;--canton-product-selector-divider: rgba(75, 85, 99, 0.16);--x2mdx-ref-canvas: #F6F8FB;--x2mdx-ref-sidebar: #FBFCFD;--x2mdx-ref-surface: #FFFFFF;--x2mdx-ref-text-strong: #11131A;--x2mdx-ref-text: #252937;--x2mdx-ref-text-muted: #6B7280;--x2mdx-ref-border: rgba(17, 19, 26, 0.08);--x2mdx-ref-accent-soft: #F3EEFF;--x2mdx-ref-neutral-soft: #F4F5F7;--x2mdx-ref-info: #1D4ED8;--x2mdx-ref-info-soft: #EDF5FF;--x2mdx-ref-success: #15803D;--x2mdx-ref-success-soft: #ECFBF0;--x2mdx-ref-danger: #B91C1C;--x2mdx-ref-danger-soft: #FFF1F1;--x2mdx-ref-warning: #B16305;--x2mdx-ref-warning-soft: #FFF8E4;--canton-font-family: 'Inter', system-ui, -apple-system, sans-serif}[data-theme=\"dark\"],:root.dark{--canton-highlight: #A985FF;--canton-highlight-rgb: 169, 133, 255;--canton-selected-bg: rgba(169, 133, 255, 0.25);--canton-hover-bg: rgba(169, 133, 255, 0.05);--canton-inline-highlight-bg: rgba(169, 133, 255, 0.22);--canton-inline-highlight-border: rgba(169, 133, 255, 0.34);--canton-product-selector-line: rgba(169, 133, 255, 0.70);--canton-product-selector-line-active: #A985FF;--canton-product-selector-divider: rgba(255, 255, 255, 0.10);--x2mdx-ref-canvas: #111115;--x2mdx-ref-sidebar: #111115;--x2mdx-ref-surface: rgba(17, 24, 39, 0.78);--x2mdx-ref-text-strong: #F3F4F6;--x2mdx-ref-text: #E5E7EB;--x2mdx-ref-text-muted: #D1D5DB;--x2mdx-ref-border: rgba(255, 255, 255, 0.08);--x2mdx-ref-accent-soft: rgba(169, 133, 255, 0.16);--x2mdx-ref-neutral-soft: rgba(156, 163, 175, 0.12);--x2mdx-ref-info: #93C5FD;--x2mdx-ref-info-soft: rgba(29, 78, 216, 0.22);--x2mdx-ref-success: #86EFAC;--x2mdx-ref-success-soft: rgba(21, 128, 61, 0.22);--x2mdx-ref-danger: #FCA5A5;--x2mdx-ref-danger-soft: rgba(185, 28, 28, 0.22);--x2mdx-ref-warning: #FCD34D;--x2mdx-ref-warning-soft: rgba(177, 99, 5, 0.22)}::selection{background-color:var(--canton-selected-bg);color:inherit}::-moz-selection{background-color:var(--canton-selected-bg);color:inherit}mark{background-color:var(--canton-inline-highlight-bg);color:inherit;border-radius:0.25rem;box-shadow:inset 0 0 0 1px var(--canton-inline-highlight-border);padding:0.08em 0.18em}[class*=\"sidebar\"] a:hover,nav a:hover{background-color:var(--canton-hover-bg)}#navigation-items .sidebar-group-header{margin-bottom:0.25rem;line-height:1.25}#navigation-items .sidebar-group li a,#navigation-items .sidebar-group li button{padding-top:0.25rem;padding-bottom:0.25rem;line-height:1.5}:root a[class*=\"bg-primary\"],:root a.text-primary{background-color:rgba(115, 75, 226, 0.08)!important;color:#734BE2!important}[data-theme=\"dark\"] a[class*=\"bg-primary\"],[data-theme=\"dark\"] a.text-primary{background-color:rgba(169, 133, 255, 0.10)!important;color:#A985FF!important}.nav-dropdown-products-selector-trigger{box-shadow:inset 0 0 0 1.5px var(--canton-product-selector-line)!important}.nav-dropdown-products-selector-trigger:hover,.nav-dropdown-products-selector-trigger[aria-expanded=\"true\"]{background-color:var(--canton-hover-bg)!important;box-shadow:inset 0 0 0 2px var(--canton-product-selector-line-active)!important}.nav-dropdown-products-selector-content>a[href=\"/api-reference\"]{border-top:1px solid var(--canton-product-selector-divider);box-sizing:border-box;margin-top:0.35rem;padding-top:0.35rem;width:100%}[class*=\"toc\"] a[class*=\"active\"],[class*=\"toc\"] a[aria-current],[class*=\"TableOfContents\"] a[class*=\"active\"],[class*=\"tableofcontents\"] a[class*=\"active\"],aside[class*=\"right\"] a[class*=\"active\"],[class*=\"on-this-page\"] a[class*=\"active\"]{background-color:transparent!important;color:var(--canton-highlight)!important;font-weight:500}[class*=\"toc\"] a:not([class*=\"active\"]),[class*=\"TableOfContents\"] a:not([class*=\"active\"]),[class*=\"tableofcontents\"] a:not([class*=\"active\"]),aside[class*=\"right\"] a:not([class*=\"active\"]),[class*=\"on-this-page\"] a:not([class*=\"active\"]){background-color:transparent!important}[class*=\"toc\"] a:hover,[class*=\"TableOfContents\"] a:hover,[class*=\"tableofcontents\"] a:hover,aside[class*=\"right\"] a:hover,[class*=\"on-this-page\"] a:hover{background-color:transparent!important;color:var(--canton-highlight)!important}#footer.advanced-footer>div{gap:1.25rem!important;padding-top:2rem!important;padding-bottom:2rem!important}@media (max-width: 767px){#footer.advanced-footer>div{gap:1rem!important;padding-top:1.5rem!important;padding-bottom:1.5rem!important}}a:not([class]){color:var(--canton-highlight)}.prose strong,.prose b,strong,b{font-weight:600!important}:root.dark .prose strong,:root.dark .prose b,[data-theme=\"dark\"] .prose strong,[data-theme=\"dark\"] .prose b,:root.dark strong,:root.dark b,[data-theme=\"dark\"] strong,[data-theme=\"dark\"] b{font-weight:400!important}a:not([class]):hover{color:var(--canton-highlight);opacity:0.8}:not(pre)>code{background-color:rgba(115, 75, 226, 0.10);border-radius:4px;padding:0.125em 0.25em}:root.dark :not(pre)>code,[data-theme=\"dark\"] :not(pre)>code{background-color:rgba(169, 133, 255, 0.20)}pre code::selection,pre code::-moz-selection{background-color:var(--canton-selected-bg)}[class*=\"card\"]:hover{border-color:var(--canton-highlight)}button[class*=\"bg-primary\"],a[class*=\"bg-primary\"]:not([class~=\"card\"]){background-color:var(--canton-highlight)}button[class*=\"bg-primary\"]:hover,a[class*=\"bg-primary\"]:not([class~=\"card\"]):hover{opacity:0.9}table tbody tr:hover{background-color:var(--canton-hover-bg)}[data-component=\"network-variables\"] [role=\"tablist\"]{gap:0.35rem!important;padding:0.35rem!important}[data-component=\"network-variables\"] [role=\"tab\"]{border:1px solid transparent!important;border-radius:0.5rem!important}[data-component=\"network-variables\"] [role=\"tab\"][aria-selected=\"false\"]{border-color:var(--canton-product-selector-divider)!important}[data-component=\"network-variables\"] [role=\"tab\"][aria-selected=\"true\"]{border-color:var(--canton-highlight)!important;box-shadow:inset 0 0 0 1px var(--canton-highlight)!important;color:var(--canton-highlight)!important}table:has(pre){display:block;overflow-x:visible}table:has(pre)>colgroup{display:none}table:has(pre)>tbody,table:has(pre)>thead{display:block}table:has(pre)>tbody>tr,table:has(pre)>thead>tr{display:block}table:has(pre) td,table:has(pre) th{display:block;width:100%!important;max-width:100%}table:has(pre) td>pre,table:has(pre) th>pre{max-width:100%;overflow-x:auto}[data-component-part=\"search-item\"][data-highlighted]{background-color:var(--canton-inline-highlight-bg);color:inherit}[data-component-part=\"search-item-content\"]{white-space:normal;overflow:visible;text-overflow:unset}[data-component-part=\"search-item-breadcrumbs\"]{font-size:10px;line-height:1.25}[data-component-part=\"search-item-breadcrumbs\"] svg{stroke-width:4}[data-component-part=\"search-item-breadcrumbs\"] svg path{stroke-width:4}:focus-visible{outline:2px solid var(--canton-highlight);outline-offset:2px}::-webkit-scrollbar-thumb:hover{background-color:var(--canton-highlight)}[data-theme=\"dark\"]{--canton-text-primary: #F5F5F5;--canton-text-secondary: #B0B0B0}button[aria-haspopup=\"menu\"]:not(.nav-dropdown-trigger):not(#page-context-menu *){background-color:transparent!important;border:1px solid rgba(209, 213, 219, 0.7)!important;border-radius:0.85rem!important;padding:0.375rem 0.875rem!important}button[aria-haspopup=\"menu\"]:not(.nav-dropdown-trigger):not(#page-context-menu *):hover{background-color:rgba(75, 85, 99, 0.05)!important}[data-theme=\"dark\"] button[aria-haspopup=\"menu\"]:not(.nav-dropdown-trigger):not(#page-context-menu *){border-color:rgba(255, 255, 255, 0.07)!important}button[aria-haspopup=\"menu\"]:not(.nav-dropdown-trigger):not(#page-context-menu *) svg{color:rgb(156, 163, 175)!important;stroke:rgb(156, 163, 175)!important}button[aria-haspopup=\"menu\"]:not(.nav-dropdown-trigger):not(#page-context-menu *):hover svg{color:rgb(75, 85, 99)!important;stroke:rgb(75, 85, 99)!important}[data-theme=\"dark\"] button[aria-haspopup=\"menu\"]:not(.nav-dropdown-trigger):not(#page-context-menu *) svg{color:rgb(75, 85, 99)!important;stroke:rgb(75, 85, 99)!important}[data-theme=\"dark\"] button[aria-haspopup=\"menu\"]:not(.nav-dropdown-trigger):not(#page-context-menu *):hover svg{color:rgb(156, 163, 175)!important;stroke:rgb(156, 163, 175)!important}.mermaid{--mermaid-primary-color: var(--canton-highlight)}div.group.relative.overflow-hidden:has(svg)>div.absolute.bottom-2.right-2{opacity:0.1;transition:opacity 200ms ease-in-out}div.group.relative.overflow-hidden:has(svg):hover>div.absolute.bottom-2.right-2,div.group.relative.overflow-hidden:has(svg):focus-within>div.absolute.bottom-2.right-2{opacity:1}div.todo{display:none}body:has(.x2mdx-ref-page):not(:has(.x2mdx-ref-page--manual-api)) #background-color{background-color:var(--x2mdx-ref-canvas)!important}body:has(.x2mdx-ref-page):not(:has(.x2mdx-ref-page--manual-api)) #navbar{border-bottom:1px solid var(--x2mdx-ref-border);background-color:var(--x2mdx-ref-surface)}body:has(.x2mdx-ref-page):not(:has(.x2mdx-ref-page--manual-api)) #sidebar{background-color:var(--x2mdx-ref-sidebar)}body:has(.x2mdx-ref-page):not(:has(.x2mdx-ref-page--manual-api)) #content-container{color:var(--x2mdx-ref-text-muted)}body:has(.x2mdx-ref-page):not(:has(.x2mdx-ref-page--manual-api)) #content-container :is(h1,h2,h3,h4,h5,h6){color:var(--x2mdx-ref-text-strong)}.x2mdx-ref-back{margin:0 0 0.75rem;font-size:0.9rem}.x2mdx-ref-back a{color:var(--canton-highlight);text-decoration:none}.x2mdx-ref-hero{display:grid;min-width:0;max-width:100%;gap:0.75rem;margin:0 0 1.4rem}.x2mdx-ref-hero>*{min-width:0;max-width:100%;overflow-wrap:anywhere}#content-container:has(.x2mdx-ref-page):not(:has(.x2mdx-ref-page--manual-api)) #page-title{display:none!important}#content-container:has(.x2mdx-ref-page) #header>.mt-2.text-lg.prose{display:none!important}.x2mdx-ref-breadcrumbs{display:flex;flex-wrap:wrap;align-items:center;gap:0.5rem;margin:0 0 0.75rem;color:var(--x2mdx-ref-text-muted);font-size:0.9rem;line-height:1.35}.x2mdx-ref-breadcrumbs a{color:var(--canton-highlight);text-decoration:none}.x2mdx-ref-breadcrumbs a:hover{text-decoration:underline}.x2mdx-ref-breadcrumb-separator{color:rgb(156, 163, 175)}.x2mdx-ref-eyebrow{min-width:0;max-width:100%;margin:0;overflow-wrap:anywhere;font-size:0.78rem;font-weight:600;letter-spacing:0.08em;text-transform:uppercase;color:var(--x2mdx-ref-text-muted)}:root.dark .x2mdx-ref-eyebrow,[data-theme=\"dark\"] .x2mdx-ref-eyebrow{color:rgb(156, 163, 175)}.x2mdx-ref-title{min-width:0;max-width:100%;margin:0;overflow-wrap:anywhere;color:var(--x2mdx-ref-text-strong);font-size:clamp(2rem, 3vw, 2.7rem);line-height:1.05}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-title{max-width:100%;overflow:hidden;font-size:clamp(1.7rem, 2.2vw, 2.25rem);line-height:1.08;text-overflow:ellipsis;white-space:nowrap;word-break:normal;overflow-wrap:normal}#content-container:has(.x2mdx-ref-page--manual-api) .x2mdx-ref-title{overflow:visible;text-overflow:clip;white-space:normal}#content-container:has(.x2mdx-ref-page--manual-api) #page-title{font-size:2.25rem!important;font-weight:600!important;line-height:2.5rem!important}#content-container:has(.x2mdx-ref-page--manual-api) .mdx-content h2{margin-top:1.8rem!important;margin-bottom:0!important;font-size:1.125rem!important;font-weight:600!important;line-height:1.6875rem!important}@media (max-width: 1023px){#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-title{white-space:normal;overflow:visible;text-overflow:clip}}@media (max-width: 639px){#content-container:has(.x2mdx-ref-page--manual-api) #page-title{font-size:1.875rem!important;line-height:2.25rem!important}body:has(.x2mdx-ref-page) .breadcrumb-list{min-width:0;max-width:100%;flex-wrap:wrap}body:has(.x2mdx-ref-page) .breadcrumb-item,body:has(.x2mdx-ref-page) .breadcrumb-item a{min-width:0;max-width:100%;overflow-wrap:anywhere}body:has(.x2mdx-ref-page) .mdx-content>div.table{display:block!important;box-sizing:border-box;width:100%!important;max-width:100%!important;overflow-x:auto}#content-container:has(.x2mdx-ref-page) #pagination{align-items:stretch;flex-direction:column;gap:0.75rem;min-width:0;max-width:100%}#content-container:has(.x2mdx-ref-page) #pagination>a{width:100%;min-width:0;max-width:100%;margin-left:0!important}#content-container:has(.x2mdx-ref-page) #pagination>a span{min-width:0;overflow-wrap:anywhere}}.x2mdx-ref-summary{margin:0;max-width:58rem;color:var(--x2mdx-ref-text-muted);font-size:1.02rem}#content-container:has(.x2mdx-ref-page--manual-api) #content-area #header>div:has(>p){display:block!important}body:has(.x2mdx-ref-page--manual-api):has(#header p) .x2mdx-ref-page--manual-api+.x2mdx-ref-hero .x2mdx-ref-summary{display:none}.x2mdx-ref-api-header-badges{margin-top:0.75rem}body:has(#x2mdx-ref-api-header-badges) .x2mdx-ref-page--manual-api+.x2mdx-ref-hero .x2mdx-ref-badges{display:none}:root.dark .x2mdx-ref-summary,[data-theme=\"dark\"] .x2mdx-ref-summary{color:rgb(209, 213, 219)}.x2mdx-ref-page--operation{display:none}#content-container:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)){max-width:92rem!important}body:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) #table-of-contents-content,body:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) #content-side-layout,body:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) #table-of-contents-layout,body:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) #table-of-contents,body:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) aside:has(#table-of-contents-content),body:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) [aria-label=\"Table of contents\"]{display:none!important}#content-container:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) #content-area{width:100%!important}.x2mdx-ref-operation-shell{display:grid;grid-template-columns:minmax(0, 1fr) minmax(22rem, 26rem);gap:clamp(2rem, 4vw, 4rem);align-items:start;width:100%}.x2mdx-ref-operation-main{min-width:0}.x2mdx-ref-operation-shell:not(:has(.x2mdx-ref-right-rail)){grid-template-columns:minmax(0, 1fr)}.x2mdx-ref-right-rail{display:grid;position:sticky;top:6rem;z-index:1;width:100%;margin:0;gap:1rem}.x2mdx-ref-rail-panel{min-width:0}@media (max-width: 1180px){.x2mdx-ref-operation-shell{grid-template-columns:minmax(0, 1fr)}.x2mdx-ref-right-rail{position:static;width:100%;margin:0 0 2rem}}.x2mdx-ref-rail-code :is(.code-group,[class*=\"code-group\"]){margin:0}.x2mdx-ref-rail-code{display:grid;gap:0.65rem;min-width:0}.x2mdx-ref-rail-head{display:flex;align-items:center;justify-content:space-between;gap:0.75rem;min-width:0}.x2mdx-ref-rail-heading{min-width:0;max-width:13rem;overflow:hidden;color:rgb(31, 41, 55);font-family:ui-monospace, SFMono-Regular, SFMono-RegularFallback, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;font-size:0.82rem;font-weight:500;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}:root.dark .x2mdx-ref-rail-heading,[data-theme=\"dark\"] .x2mdx-ref-rail-heading{color:rgb(229, 231, 235)}.x2mdx-ref-operation-bar{display:flex;align-items:center;gap:0.75rem;width:100%;min-height:3.75rem;margin:0 0 3.25rem;padding:0.55rem 0.75rem;overflow:hidden;border:1px solid var(--x2mdx-ref-border);border-radius:1rem;background:var(--x2mdx-ref-surface);box-shadow:0 1px 2px rgba(13, 12, 17, 0.04)}:root.dark .x2mdx-ref-operation-bar,[data-theme=\"dark\"] .x2mdx-ref-operation-bar{border-color:rgba(255, 255, 255, 0.08);background:rgba(17, 17, 21, 0.6)}.x2mdx-ref-operation-method{flex:0 0 auto;padding:0.32rem 0.55rem;border-radius:0.55rem;background:rgba(22, 163, 74, 0.12);color:rgb(22, 163, 74);font-size:0.86rem;font-weight:700;line-height:1}.x2mdx-ref-operation-method--post,.x2mdx-ref-operation-method--json-rpc{background:rgba(37, 99, 235, 0.12);color:rgb(37, 99, 235)}.x2mdx-ref-operation-method--publish,.x2mdx-ref-operation-method--subscribe{background:rgba(124, 58, 237, 0.12);color:rgb(124, 58, 237)}.x2mdx-ref-operation-bar code{flex:1 1 auto;min-width:0;overflow:hidden;background:transparent;color:inherit;font-size:0.98rem;line-height:1.45;text-overflow:ellipsis;white-space:nowrap}#content-container:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) h2{margin-top:2.5rem!important;margin-bottom:1rem!important;font-size:1.35rem!important;font-weight:700!important;line-height:1.25!important}#content-container:has(.x2mdx-ref-page--operation):not(:has(.x2mdx-ref-page--manual-api)) h3{font-size:1rem!important;line-height:1.35!important}#content-container :is(a[id^=\"interface-\"],a[id^=\"type-alias-\"],a[id^=\"variable-\"],a[id^=\"function-\"])+h4:not(:first-of-type),#content-container :is(a[id^=\"class-\"],a[id^=\"constr-\"],a[id^=\"function-\"],a[id^=\"type-\"])+h3:not(:first-of-type){margin-top:2rem!important;padding-top:1.35rem!important;border-top:1px solid rgba(var(--canton-highlight-rgb), 0.54)}.x2mdx-ref-rail-code--response{position:relative}.x2mdx-ref-response-label{flex:0 1 auto;max-width:11rem;overflow:hidden;color:rgb(115, 114, 118);font-family:ui-monospace, SFMono-Regular, SFMono-RegularFallback, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;font-size:0.75rem;line-height:1.25;text-overflow:ellipsis;white-space:nowrap}:root.dark .x2mdx-ref-response-label,[data-theme=\"dark\"] .x2mdx-ref-response-label{color:rgb(162, 160, 165)}.x2mdx-ref-badges{display:flex;flex-wrap:wrap;gap:0.5rem}.x2mdx-ref-badge{display:inline-flex;align-items:center;min-height:1.55rem;padding:0.14rem 0.52rem;border:1px solid rgba(var(--canton-highlight-rgb), 0.16);border-radius:999px;background:var(--x2mdx-ref-accent-soft);color:var(--canton-highlight);font-size:0.76rem;font-weight:600;line-height:1.1;text-decoration:none}a.x2mdx-ref-badge:hover{filter:brightness(0.96);text-decoration:underline;text-underline-offset:0.16rem}a.x2mdx-ref-badge:focus-visible{outline:2px solid var(--canton-highlight);outline-offset:2px}.x2mdx-ref-badge--neutral{background:var(--x2mdx-ref-neutral-soft);border-color:rgba(107, 114, 128, 0.18);color:var(--x2mdx-ref-text-muted)}:root.dark .x2mdx-ref-badge--neutral,[data-theme=\"dark\"] .x2mdx-ref-badge--neutral{background:rgba(156, 163, 175, 0.12);border-color:rgba(156, 163, 175, 0.16);color:rgb(229, 231, 235)}.x2mdx-ref-badge--added{background:var(--x2mdx-ref-success-soft);border-color:rgba(21, 128, 61, 0.18);color:var(--x2mdx-ref-success)}.x2mdx-ref-badge--changed{background:var(--x2mdx-ref-info-soft);border-color:rgba(29, 78, 216, 0.18);color:var(--x2mdx-ref-info)}.x2mdx-ref-badge--removed{background:var(--x2mdx-ref-danger-soft);border-color:rgba(185, 28, 28, 0.18);color:var(--x2mdx-ref-danger)}.x2mdx-ref-meta-grid{display:grid;grid-template-columns:repeat(auto-fit, minmax(12rem, 1fr));gap:0.75rem;margin:0}.x2mdx-ref-meta-item{min-width:0;padding:0.85rem 0.95rem;border:1px solid var(--x2mdx-ref-border);border-radius:0.7rem;background:var(--x2mdx-ref-surface)}:root.dark .x2mdx-ref-meta-item,[data-theme=\"dark\"] .x2mdx-ref-meta-item{border-color:rgba(255, 255, 255, 0.08);background:rgba(17, 24, 39, 0.7)}.x2mdx-ref-meta-label{display:block;margin:0 0 0.3rem;font-size:0.77rem;font-weight:600;text-transform:uppercase;color:var(--x2mdx-ref-text-muted)}.x2mdx-ref-meta-value{display:block;margin:0;overflow-wrap:anywhere;font-size:0.96rem;font-weight:500;color:var(--x2mdx-ref-text)}.x2mdx-ref-card-grid{display:grid;grid-template-columns:repeat(auto-fit, minmax(16rem, 1fr));gap:1rem}.x2mdx-ref-card{display:grid;align-content:start;gap:0.8rem;min-height:100%;min-width:0;padding:1rem;border:1px solid var(--x2mdx-ref-border);border-radius:0.7rem;background:var(--x2mdx-ref-surface);color:inherit;text-decoration:none;transition:border-color 160ms ease, transform 160ms ease, background-color 160ms ease}.x2mdx-ref-card>*{min-width:0}:root.dark .x2mdx-ref-card,[data-theme=\"dark\"] .x2mdx-ref-card{border-color:rgba(255, 255, 255, 0.08);background:rgba(17, 24, 39, 0.78)}.x2mdx-ref-card:hover{border-color:rgba(var(--canton-highlight-rgb), 0.42);transform:translateY(-1px)}.x2mdx-ref-card-head{display:contents}.x2mdx-ref-card-title{order:0;margin:0;font-size:1rem;font-weight:700;line-height:1.3;color:var(--x2mdx-ref-text-strong);text-decoration:none;overflow-wrap:anywhere}.x2mdx-ref-card-title:hover{color:rgb(var(--canton-highlight-rgb))}.x2mdx-ref-card .x2mdx-ref-badges{order:2}.x2mdx-ref-card-summary{order:1;margin:0;color:var(--x2mdx-ref-text-muted);overflow-wrap:anywhere}.x2mdx-ref-card .x2mdx-ref-meta-grid{order:3}.x2mdx-ref-history{display:grid;gap:0.75rem;margin:0 0 2rem}.x2mdx-ref-history,.x2mdx-ref-history-event,.x2mdx-ref-history-event-head,.x2mdx-ref-history-event-detail{min-width:0;max-width:100%}.x2mdx-ref-history-event{display:grid;gap:0.5rem;padding:0.9rem 1rem;border:0;border-left:3px solid var(--x2mdx-ref-text-muted);border-radius:0.7rem;background:var(--x2mdx-ref-neutral-soft);scroll-margin-top:6rem}:root.dark .x2mdx-ref-history-event,[data-theme=\"dark\"] .x2mdx-ref-history-event{color:var(--x2mdx-ref-text)}.x2mdx-ref-history-event--introduced{border-left-color:var(--x2mdx-ref-success);background:var(--x2mdx-ref-success-soft)}.x2mdx-ref-history-event--changed,.x2mdx-ref-history-event--replacement{border-left-color:var(--x2mdx-ref-info);background:var(--x2mdx-ref-info-soft)}.x2mdx-ref-history-event--removed,.x2mdx-ref-history-event--deprecated,.x2mdx-ref-history-event--remove-as-of{border-left-color:var(--x2mdx-ref-danger);background:var(--x2mdx-ref-danger-soft)}.x2mdx-ref-history-event-head{display:flex;align-items:baseline;justify-content:space-between;gap:1rem}.x2mdx-ref-history-event-label{color:var(--x2mdx-ref-text-strong);font-size:0.92rem;font-weight:700;line-height:1.3}.x2mdx-ref-history-event-version{flex:0 0 auto;background:transparent;color:var(--x2mdx-ref-text-muted);font-size:0.82rem}:root.dark .x2mdx-ref-history-event-version,[data-theme=\"dark\"] .x2mdx-ref-history-event-version{color:rgb(209, 213, 219)}.x2mdx-ref-history-event-detail{margin:0;overflow-wrap:anywhere;color:var(--x2mdx-ref-text-muted);font-size:0.92rem;line-height:1.5}:root.dark .x2mdx-ref-history-event-detail,[data-theme=\"dark\"] .x2mdx-ref-history-event-detail{color:rgb(209, 213, 219)}@media (max-width: 640px){.x2mdx-ref-history-event-head{align-items:flex-start;flex-direction:column;gap:0.35rem}}:root.dark .x2mdx-ref-card-summary,[data-theme=\"dark\"] .x2mdx-ref-card-summary{color:rgb(209, 213, 219)}.x2mdx-ref-panel,.x2mdx-ref-schema{margin:0 0 1rem;padding:1rem;border:1px solid rgba(15, 23, 42, 0.08);border-radius:0.7rem;background:rgba(255, 255, 255, 0.82)}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-panel,#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-schema{margin:0 0 1.9rem;padding:0;border:0;border-radius:0;background:transparent}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-panel-head,#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-schema-head{margin-bottom:0.65rem}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-grid{display:flex;flex-wrap:wrap;gap:0.45rem 1.1rem;padding:0.8rem 0;border-top:1px solid rgba(15, 23, 42, 0.08);border-bottom:1px solid rgba(15, 23, 42, 0.08)}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-item{display:flex;align-items:baseline;gap:0.35rem;min-width:0;padding:0;border:0;border-radius:0;background:transparent}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-label{margin:0;font-size:0.72rem;letter-spacing:0;text-transform:none}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-label::after{content:\":\"}#content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-value{max-width:32rem;font-size:0.86rem;font-weight:500}:root.dark #content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-grid,[data-theme=\"dark\"] #content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-grid,:root.dark #content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-item,[data-theme=\"dark\"] #content-container:has(.x2mdx-ref-page--operation) .x2mdx-ref-meta-item{border-color:rgba(255, 255, 255, 0.08);background:transparent}:root.dark .x2mdx-ref-panel,:root.dark .x2mdx-ref-schema,[data-theme=\"dark\"] .x2mdx-ref-panel,[data-theme=\"dark\"] .x2mdx-ref-schema{border-color:rgba(255, 255, 255, 0.08);background:rgba(17, 24, 39, 0.78)}.x2mdx-ref-panel-head,.x2mdx-ref-schema-head{display:grid;gap:0.3rem;margin-bottom:0.9rem}.x2mdx-ref-panel-head h3,.x2mdx-ref-schema-head h3{margin:0;font-size:1rem;line-height:1.3;overflow-wrap:anywhere}.x2mdx-ref-schema-variants{display:grid;gap:0.8rem;margin-top:0.9rem}.x2mdx-ref-schema-variant-label{font-size:0.77rem;font-weight:700;text-transform:uppercase;color:rgb(107, 114, 128)}.x2mdx-ref-schema-variant{display:grid;gap:0.65rem;min-width:0;padding:0.85rem;border:1px solid rgba(15, 23, 42, 0.08);border-radius:0.65rem;background:rgba(248, 250, 252, 0.72)}:root.dark .x2mdx-ref-schema-variant,[data-theme=\"dark\"] .x2mdx-ref-schema-variant{border-color:rgba(255, 255, 255, 0.08);background:rgba(17, 24, 39, 0.58)}.x2mdx-ref-schema-variant-head{display:grid;gap:0.25rem}.x2mdx-ref-schema-variant-head h4{margin:0;font-size:0.94rem;line-height:1.3;overflow-wrap:anywhere}body:has(.x2mdx-ref-hero) #table-of-contents-content a,body:has(.x2mdx-ref-hero) [aria-label=\"Table of contents\"] a{overflow-wrap:anywhere;word-break:normal}.x2mdx-ref-panel-summary,.x2mdx-ref-schema-summary,.x2mdx-ref-schema-description{margin:0;color:rgb(75, 85, 99)}:root.dark .x2mdx-ref-panel-summary,:root.dark .x2mdx-ref-schema-summary,:root.dark .x2mdx-ref-schema-description,[data-theme=\"dark\"] .x2mdx-ref-panel-summary,[data-theme=\"dark\"] .x2mdx-ref-schema-summary,[data-theme=\"dark\"] .x2mdx-ref-schema-description{color:rgb(209, 213, 219)}.x2mdx-ref-fields{display:grid;margin-top:0.75rem;border-top:1px solid rgba(15, 23, 42, 0.08);border-bottom:1px solid rgba(15, 23, 42, 0.08);border-radius:0;overflow:hidden}:root.dark .x2mdx-ref-fields,[data-theme=\"dark\"] .x2mdx-ref-fields{border-color:rgba(255, 255, 255, 0.08)}.x2mdx-ref-field-row{display:grid;gap:0.35rem;padding:0.75rem 0;background:transparent}.x2mdx-ref-field-row+.x2mdx-ref-field-row{border-top:1px solid rgba(15, 23, 42, 0.08)}:root.dark .x2mdx-ref-field-row+.x2mdx-ref-field-row,[data-theme=\"dark\"] .x2mdx-ref-field-row+.x2mdx-ref-field-row{border-top-color:rgba(255, 255, 255, 0.08)}.x2mdx-ref-field-main{display:flex;flex-wrap:wrap;align-items:center;gap:0.45rem;min-width:0}.x2mdx-ref-field-name{background:transparent;color:var(--canton-highlight);font-size:0.94rem;font-weight:600}.x2mdx-ref-type-badge,.x2mdx-ref-required-badge{display:inline-flex;align-items:center;min-height:1.45rem;padding:0.1rem 0.45rem;border-radius:0.42rem;font-family:ui-monospace, SFMono-Regular, SFMono-RegularFallback, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace;font-size:0.76rem;line-height:1}.x2mdx-ref-type-badge{background:rgba(107, 114, 128, 0.12);color:rgb(55, 65, 81)}.x2mdx-ref-required-badge{background:rgba(220, 38, 38, 0.1);color:rgb(153, 27, 27)}.x2mdx-ref-field-description{color:rgb(75, 85, 99);font-size:0.9rem;line-height:1.45;white-space:pre-wrap}@media (max-width: 900px){.x2mdx-ref-field-row{padding:0.7rem 0}}.x2mdx-ref-example-heading{margin:1rem 0 0.45rem;font-size:0.88rem;font-weight:600;text-transform:uppercase;color:rgb(107, 114, 128)}.x2mdx-ref-change-list{display:grid;gap:0.7rem}.x2mdx-ref-change-item{display:grid;gap:0.35rem;padding:0.9rem 1rem;border-left:3px solid var(--canton-highlight);border-radius:0.6rem;background:rgba(var(--canton-highlight-rgb), 0.06)}.x2mdx-ref-change-version{font-size:0.82rem;font-weight:700;text-transform:uppercase;color:var(--canton-highlight)}.x2mdx-ref-enum-list{margin:0.8rem 0 0;padding-left:1rem}"}]}
{"page":{"pagePath":"sdks-tools/cli-tools/daml-script","slug":"/sdks-tools/cli-tools/daml-script","pageMetadata":{"title":"Daml Script","description":"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.","href":"/sdks-tools/cli-tools/daml-script"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,em:`em`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Tip,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Tip)_missingMdxReference(`Tip`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsxs(_components.p,{children:[`Daml Script is the primary testing tool for Daml contracts. You write test scenarios as `,_jsx(_components.code,{children:`Script ()`}),` values in Daml source files, then run them with `,_jsx(_components.code,{children:`dpm test`}),`. Scripts execute on a fresh, empty ledger and can allocate parties, submit commands, query state, and assert expected outcomes.`]}),`\n`,_jsxs(_components.p,{children:[`For the complete function and type reference, see `,_jsx(_components.a,{href:`/appdev/reference/daml-script/daml-script`,children:`Daml.Script API Reference`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`writing-a-test-script`,children:`Writing a Test Script`}),`\n`,_jsxs(_components.p,{children:[`A Daml Script is a function that returns `,_jsx(_components.code,{children:`Script ()`}),`. Place your scripts in a test package that depends on your contract package (keep templates and tests in separate packages for clean deployment).`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`28`,language:`haskell`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`haskell`,children:_jsxs(_components.code,{language:`haskell`,numberOfLines:`28`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`module`}),_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:` MyTests`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:` where`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:` Daml.Script`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`import`}),_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:` Licensing.License`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`testCreateAndTransfer `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`:`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` Script`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` ()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`testCreateAndTransfer `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:` do`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:` -- Allocate test parties`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` alice `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` allocateParty `}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Alice\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` bob `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` allocateParty `}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Bob\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:` -- Create a contract`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` licenseCid `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` submit alice `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` createCmd `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`License`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` with`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` owner `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` alice`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` issuer `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` alice`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` description `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` \"Test License\"`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:` -- Exercise a choice`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` newLicenseCid `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` submit alice `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` exerciseCmd licenseCid `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`Transfer`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` with`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` newOwner `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` bob`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:` -- Query and assert`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` Some`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` license `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` queryContractId bob newLicenseCid`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` assert (license`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`owner `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`==`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` bob)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` pure `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`()`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`running-tests`,children:`Running Tests`}),`\n`,_jsx(Heading,{level:`3`,id:`with-dpm-test`,children:`With dpm test`}),`\n`,_jsx(_components.p,{children:`Run all scripts in the current package:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#6F42C1`,\"--shiki-dark\":`#B392F0`},children:`dpm`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` test`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`The output shows each script’s result, the number of active contracts at the end, and the number of transactions executed. A summary at the end includes test coverage information:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`4`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`4`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Test Summary`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`MyTests.daml:testCreateAndTransfer: ok, 1 active contracts, 3 transactions.`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`3`,id:`in-vs-code`,children:`In VS Code`}),`\n`,_jsxs(_components.p,{children:[`If you have Daml Studio installed (`,_jsx(_components.code,{children:`dpm studio`}),`), a “Script results” lens appears above each script definition. Click it to run the script and see the results in a side panel. The panel shows two views:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Table view`}),` — Active contracts at the end of the script, with visibility per party`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Transaction view`}),` — Every transaction and sub-transaction, useful for debugging authorization failures`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`key-script-functions`,children:`Key Script Functions`}),`\n`,_jsx(Heading,{level:`3`,id:`party-allocation`,children:`Party Allocation`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`haskell`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`haskell`,children:_jsxs(_components.code,{language:`haskell`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`alice `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` allocateParty `}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Alice\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`bob `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` allocateParty `}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Bob\"`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Creates test parties that exist only for the duration of the script. Party names are for display only and do not need to match production party identifiers.`}),`\n`,_jsx(Heading,{level:`3`,id:`command-submission`,children:`Command Submission`}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`submit`}),` to send commands as a specific party:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`haskell`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`haskell`,children:_jsxs(_components.code,{language:`haskell`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`-- Create a contract`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`cid `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` submit alice `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` createCmd `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`MyTemplate`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` with field1 `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:` \"value\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`, field2 `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` alice`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`-- Exercise a choice`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`result `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` submit alice `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` exerciseCmd cid `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`MyChoice`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` with choiceArg `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` 42`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Use `,_jsx(_components.code,{children:`submitMustFail`}),` to assert that a command should be rejected (e.g., unauthorized access):`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`haskell`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`haskell`,children:_jsxs(_components.code,{language:`haskell`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`submitMustFail bob `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`do`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` exerciseCmd cid `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`MyChoice`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` with choiceArg `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`=`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` 42`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`querying-state`,children:`Querying State`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`haskell`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`haskell`,children:_jsxs(_components.code,{language:`haskell`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`-- Query all active contracts of a type visible to a party`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`contracts `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` query `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`@MyTemplate`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` alice`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`-- Query a specific contract by ID`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`optContract `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`\u003c-`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` queryContractId alice cid`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`assertions`,children:`Assertions`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`2`,language:`haskell`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`haskell`,children:_jsxs(_components.code,{language:`haskell`,numberOfLines:`2`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`assert (length contracts `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`==`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` 3`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`assertMsg `}),_jsx(_components.span,{style:{color:`#032F62`,\"--shiki-dark\":`#9ECBFF`},children:`\"Owner should be Bob\"`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` (contract`}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`.`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`owner `}),_jsx(_components.span,{style:{color:`#D73A49`,\"--shiki-dark\":`#F97583`},children:`==`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:` bob)`})]}),`\n`]})})}),`\n`,_jsx(Heading,{level:`3`,id:`time-manipulation`,children:`Time Manipulation`}),`\n`,_jsx(_components.p,{children:`For contracts with time-dependent logic (expiration, vesting schedules):`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`haskell`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`haskell`,children:_jsxs(_components.code,{language:`haskell`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`-- Advance ledger time`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`passTime (days `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`30`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6A737D`,\"--shiki-dark\":`#6A737D`},children:`-- Set a specific time`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`setTime (time (date `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`2025`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` Jun`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` 15`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`) `}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:`0`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` 0`}),_jsx(_components.span,{style:{color:`#005CC5`,\"--shiki-dark\":`#79B8FF`},children:` 0`}),_jsx(_components.span,{style:{color:`#24292E`,\"--shiki-dark\":`#E1E4E8`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`passTime`}),` is essential for testing workflows that depend on elapsed time, such as license expiration or payment schedules.`]}),`\n`,_jsx(Heading,{level:`2`,id:`test-organization`,children:`Test Organization`}),`\n`,_jsx(_components.p,{children:`Structure your test packages to mirror your contract packages:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`11`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`project/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` contracts/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` daml/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Licensing/License.daml`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` daml.yaml`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` tests/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` daml/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` Licensing/LicenseTests.daml`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` daml.yaml # depends on contracts/`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` multi-package.yaml`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`tests/daml.yaml`}),` declares a dependency on the `,_jsx(_components.code,{children:`contracts`}),` package. Run `,_jsx(_components.code,{children:`dpm test`}),` from the `,_jsx(_components.code,{children:`tests/`}),` directory, or `,_jsx(_components.code,{children:`dpm build --all`}),` and then `,_jsx(_components.code,{children:`dpm test`}),` from the project root.`]}),`\n`,_jsx(Heading,{level:`2`,id:`coverage-report`,children:`Coverage Report`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`dpm test`}),` produces a coverage report showing which templates and choices your scripts exercised. This helps identify untested contract paths:`]}),`\n`,_jsx(CodeBlock,{numberOfLines:`7`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`7`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`External templates`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 5 defined`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 4 ( 80.0%) created in any tests`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`External template choices`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 12 defined`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` 8 ( 66.7%) exercised in any tests`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Aim for high coverage on all choices that will run in production. See the `,_jsx(_components.a,{href:`/appdev/modules/m3-testing`,children:`testing guide`}),` for a detailed walkthrough.`]}),`\n`,_jsx(Heading,{level:`2`,id:`related-pages`,children:`Related Pages`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/appdev/modules/m3-testing`,children:`Testing Daml Contracts`}),` — Full testing tutorial with examples`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/sdks-tools/development-tools/sandbox`,children:`Sandbox`}),` — Integration testing beyond Daml Script`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.a,{href:`/sdks-tools/cli-tools/dpm`,children:`dpm command reference`}),` — `,_jsx(_components.code,{children:`dpm test`}),` options and flags`]}),`\n`]}),`\n`,_jsx(Heading,{level:`1`,id:`test-templates-using-daml-scripts`,children:`Test templates using Daml scripts`}),`\n`,_jsxs(_components.p,{children:[`In this section we test the `,_jsx(_components.code,{children:`Token`}),` model from `,_jsx(_components.code,{children:`contracts`}),` using the Daml Script integration in Daml Studio. This includes:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Script basics`}),`\n`,_jsx(_components.li,{children:`Running scripts`}),`\n`,_jsx(_components.li,{children:`Creating contracts`}),`\n`,_jsx(_components.li,{children:`Testing for failure`}),`\n`,_jsx(_components.li,{children:`Archiving contracts`}),`\n`,_jsx(_components.li,{children:`Viewing the ledger and ledger history`}),`\n`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Remember that you can load all the code for this section into a folder called `,_jsx(_components.code,{children:`intro-daml-scripts`}),` by running `,_jsx(_components.code,{children:`dpm new intro-daml-scripts --template daml-intro-daml-scripts`})]})}),`\n`,_jsx(Heading,{level:`2`,id:`script-basics`,children:`Script basics`}),`\n`,_jsxs(_components.p,{children:[`A `,_jsx(_components.code,{children:`Script`}),` is like a recipe for a test, letting you create a scenario where different parties submit a series of transactions to check that your templates behave as you expect. You can also script some external information like party identities and ledger time.`]}),`\n`,_jsxs(_components.p,{children:[`Below is a basic script that creates a `,_jsx(_components.code,{children:`Token`}),` for a party called “Alice”:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`5`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`5`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`token_test_1 = script do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` alice \u003c- allocateParty \"Alice\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submit alice do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = alice`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`You declare a `,_jsx(_components.code,{children:`Script`}),` as a top-level variable and introduce it using `,_jsx(_components.code,{children:`script do`}),`. `,_jsx(_components.code,{children:`do`}),` always starts a block, so the rest of the script is indented.`]}),`\n`,_jsxs(_components.p,{children:[`Before you can create any `,_jsx(_components.code,{children:`Token`}),` contracts, you need some parties on the test ledger. The above script uses the function `,_jsx(_components.code,{children:`allocateParty`}),` to put a party called “Alice” in a variable `,_jsx(_components.code,{children:`alice`}),`. There are two things of note there:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`Use of `,_jsx(_components.code,{children:`\u003c-`}),` instead of `,_jsx(_components.code,{children:`=`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`The reason for this is that `,_jsx(_components.code,{children:`allocateParty`}),` is an `,_jsx(_components.code,{children:`Action`}),` that can only be performed once the `,_jsx(_components.code,{children:`Script`}),` is run in the context of a ledger. `,_jsx(_components.code,{children:`\u003c-`}),` means “run the action and bind the result”. It can only be run in that context because, depending on the ledger state, `,_jsx(_components.code,{children:`allocateParty`}),` gives you back a party with the name you specified or appends a suffix to that name if such a party has already been allocated. You can read more about `,_jsx(_components.code,{children:`Actions`}),` and `,_jsx(_components.code,{children:`do`}),` blocks in `,_jsx(_components.code,{children:`constraints`}),`.`]}),`\n`,_jsx(_components.p,{children:`If that doesn’t quite make sense yet, for the time being you can think of this arrow as extracting the right-hand-side value from the ledger and storing it into the variable on the left.`}),`\n`]}),`\n`,_jsxs(_components.li,{children:[`\n`,_jsxs(_components.p,{children:[`The argument `,_jsx(_components.code,{children:`\"Alice\"`}),` to `,_jsx(_components.code,{children:`allocateParty`}),` does not have to be enclosed in brackets. Functions in Daml are called using the syntax `,_jsx(_components.code,{children:`fn arg1 arg2 arg3`}),`.`]}),`\n`]}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`With a variable `,_jsx(_components.code,{children:`alice`}),` of type `,_jsx(_components.code,{children:`Party`}),` in hand, you can submit your first transaction using the `,_jsx(_components.code,{children:`submit`}),` function. `,_jsx(_components.code,{children:`submit`}),` takes two arguments: the `,_jsx(_components.code,{children:`Party`}),` and the `,_jsx(_components.code,{children:`Commands`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`Just like `,_jsx(_components.code,{children:`Script`}),` is a recipe for a test, `,_jsx(_components.code,{children:`Commands`}),` is a recipe for a transaction. `,_jsx(_components.code,{children:`createCmd Token with owner = alice`}),` is a `,_jsx(_components.code,{children:`Commands`}),`, which translates to a list of commands to be submitted to the ledger. These commands create a transaction which in turns creates a `,_jsx(_components.code,{children:`Token`}),` with owner Alice.`]}),`\n`,_jsxs(_components.p,{children:[`You’ll learn all about the syntax `,_jsx(_components.code,{children:`Token with owner = alice`}),` in `,_jsx(_components.code,{children:`data`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`You could write this as `,_jsx(_components.code,{children:`submit alice (createCmd Token with owner = alice)`}),`, but as with scripts, you can assemble commands using `,_jsx(_components.code,{children:`do`}),` blocks. A `,_jsx(_components.code,{children:`do`}),` block always takes the value of the last statement within it so the syntax shown in the commands above gives the same result, whilst being easier to read. Note, however, that the commands submitted as part of a transaction are not allowed to depend on each other.`]}),`\n`,_jsx(Heading,{level:`2`,id:`run-the-scripts`,children:`Run the scripts`}),`\n`,_jsx(_components.p,{children:`There are a few ways to run Daml Scripts:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`In Daml Studio against a test ledger, providing visualizations of the resulting ledger.`}),`\n`,_jsxs(_components.li,{children:[`Using the command line `,_jsx(_components.code,{children:`dpm test`}),` also against a test ledger, useful for continuous integration.`]}),`\n`,_jsx(_components.li,{children:`Against a real ledger. See the documentation for Daml Script for more information.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`In Daml Studio, you should see the text “Script results” just above the line `,_jsx(_components.code,{children:`token_test_1 = do`}),`. Click on that text to display the outcome of the script.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png?fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=f6784333f4734ead1867a6e7560919ee`,alt:`images/daml-scripts/scenario_results1.png`,\"data-og-width\":`982`,width:`982`,\"data-og-height\":`300`,height:`300`,\"data-path\":`sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png?w=280\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=372d2219906fcc2d49ce65569a4191cb 280w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png?w=560\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=6ef8aabc30e79988b07fe3deaa6a2f2a 560w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png?w=840\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=7b2e01a20ae3a0b9b98674db0c799c16 840w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=e0c636029f295cca776f7fc27147edc6 1100w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=800cfbff84b2ba79bc96077fdf56585b 1650w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/scenario_results1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=e6934b8c7201dc08e1e250bb75cf597c 2500w`}),`\n`,_jsx(_components.p,{children:`This opens the script view in a separate column in VS Code. The default view is a tabular representation of the final state of the ledger:`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png?fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=490edcd97e89028cf2c4a47e02ef9a6b`,alt:`images/daml-scripts/tabular_view1.png`,\"data-og-width\":`1300`,width:`1300`,\"data-og-height\":`534`,height:`534`,\"data-path\":`sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png?w=280\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=ab89e2dc3a67a3e5a3d10b4ce333342e 280w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png?w=560\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=593ae223b999faf523ee579d90cbc63a 560w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png?w=840\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=561177981ecd7484544058e5453e306c 840w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png?w=1100\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=9aa51b1238e12d4a0a9571da1ed6a294 1100w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png?w=1650\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=8aff1785abbcc462ef126d93e25771b7 1650w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tabular_view1.png?w=2500\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=6c6ae36dba81c035313edb8795c40ec7 2500w`}),`\n`,_jsx(_components.p,{children:`What this display means:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`The big title reading `,_jsx(_components.code,{children:`Token_Test:Token`}),` identifies the type of contract that’s listed below. `,_jsx(_components.code,{children:`Token_Test`}),` is the module name, `,_jsx(_components.code,{children:`Token`}),` is the template name.`]}),`\n`,_jsx(_components.li,{children:`The first column shows the ID of the contract. This will be explained later.`}),`\n`,_jsxs(_components.li,{children:[`The second column shows the status of the contract, either `,_jsx(_components.code,{children:`active`}),` or `,_jsx(_components.code,{children:`archived`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`The next section of columns show the contract arguments, with one column per field. As expected, here there is one field and thus one column: the field `,_jsx(_components.code,{children:`owner`}),` is `,_jsx(_components.code,{children:`'Alice'`}),`. The single quotation marks indicate that `,_jsx(_components.code,{children:`Alice`}),` is a party.`]}),`\n`,_jsx(_components.li,{children:`The remaining columns, labelled vertically, show which parties know about which contracts. In this simple script, the sole party “Alice” knows about the contract she created.`}),`\n`]}),`\n`,_jsxs(_components.p,{children:[`To run the same test from the command line, save your module in a file `,_jsx(_components.code,{children:`Token_Test.daml`}),` and run `,_jsx(_components.code,{children:`dpm test --files Token_Test.daml`}),`. If your file contains more than one script, this runs all of them.`]}),`\n`,_jsx(Heading,{level:`2`,id:`test-for-failure`,children:`Test for failure`}),`\n`,_jsxs(_components.p,{children:[`In `,_jsx(_components.code,{children:`contracts`}),` you learned that creating a `,_jsx(_components.code,{children:`Token`}),` requires the authority of its owner. In other words, it should not be possible for Alice to create a token for another party, e.g. Bob, or vice versa. A reasonable attempt to test that would be:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`8`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`failing_test_1 = do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` alice \u003c- allocateParty \"Alice\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` bob \u003c- allocateParty \"Bob\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submit alice do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = bob`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submit bob do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = alice`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:`However, if you open the script view for that script, you see the following message:`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failure.png?fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=4b45a0197be29f782e1655da0b574d82`,alt:`images/daml-scripts/failure.png`,\"data-og-width\":`1174`,width:`1174`,\"data-og-height\":`378`,height:`378`,\"data-path\":`sdks-tools/cli-tools/images/daml-scripts/failure.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failure.png?w=280\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=ef6da15221da9ede22562148f3840295 280w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failure.png?w=560\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=746d711bdd2f96d87d0b9f98f3992c20 560w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failure.png?w=840\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=fcf0995b34bac91a6465f4d9dc0c036f 840w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failure.png?w=1100\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=6d91b45d84bad14fa2722be70e677bf2 1100w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failure.png?w=1650\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=c76c5249b4ea1fce90af30f97bb649bb 1650w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failure.png?w=2500\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=a469ebc16423a099db4b24db5d740ad0 2500w`}),`\n`,_jsxs(_components.p,{children:[`The script failed, as expected, but scripts abort at the first failure. This means that it only tested that Alice cannot create a token for Bob; the second `,_jsx(_components.code,{children:`submit`}),` statement was never reached.`]}),`\n`,_jsxs(_components.p,{children:[`To test for failing submits and keep the script running thereafter, or fail if the submission succeeds, you can use the `,_jsx(_components.code,{children:`submitMustFail`}),` function:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`14`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`14`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`token_test_2 = do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` alice \u003c- allocateParty \"Alice\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` bob \u003c- allocateParty \"Bob\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submitMustFail alice do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = bob`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submitMustFail bob do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = alice`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submit alice do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = alice`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submit bob do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = bob`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`submitMustFail`}),` never has an impact on the ledger, so the resulting tabular script view only shows the two tokens resulting from the successful `,_jsx(_components.code,{children:`submit`}),` statements. Note the new column for Bob as well as the visibilities. Alice and Bob cannot see each others’ tokens.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failuretable.png?fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=e221f7b550d39379e6be10fadf163cf5`,alt:`images/daml-scripts/failuretable.png`,\"data-og-width\":`1072`,width:`1072`,\"data-og-height\":`570`,height:`570`,\"data-path\":`sdks-tools/cli-tools/images/daml-scripts/failuretable.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failuretable.png?w=280\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=b111db742f783b2fee0f364000091b56 280w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failuretable.png?w=560\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=1d3b439520f37921769cfb78186bfb89 560w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failuretable.png?w=840\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=f2578a60ac7c9055123c8ba4d9f87962 840w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failuretable.png?w=1100\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=2922a2947c67db542545c06f2649a1ab 1100w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failuretable.png?w=1650\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=6ac4cc88956aa6cfc56914d264d2d152 1650w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/failuretable.png?w=2500\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=6a346197d6c515a4996047f7d4e173e3 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`archive-contracts`,children:`Archive contracts`}),`\n`,_jsx(_components.p,{children:`Archiving contracts is the counterpart to creating contracts. Contracts are immutable, so whenever you want to update one (loosely: change its state) you must archive the current contract residing on the ledger and create a new one.`}),`\n`,_jsxs(_components.p,{children:[`To archive a contract, use `,_jsx(_components.code,{children:`archiveCmd`}),` instead of `,_jsx(_components.code,{children:`createCmd`}),`. Whereas `,_jsx(_components.code,{children:`createCmd`}),` takes an instance of a template, `,_jsx(_components.code,{children:`archiveCmd`}),` takes a reference to a created contract. Archiving requires authorization from controllers.`]}),`\n`,_jsxs(_components.p,{children:[`Contracts are also archived whenever a `,_jsx(_components.a,{href:`/overview/reference/ledger-model/structure#def-action`,children:`consuming choice`}),` is exercised.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Archive choices are present on all templates and cannot be removed.`})}),`\n`,_jsxs(_components.p,{children:[`References to contracts have the type `,_jsx(_components.code,{children:`ContractId a`}),`, where `,_jsx(_components.code,{children:`a`}),` is a `,_jsx(_components.em,{children:`type parameter`}),` representing the template type of the contract that the id refers to. For example, a reference to a `,_jsx(_components.code,{children:`Token`}),` would be a `,_jsx(_components.code,{children:`ContractId Token`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`To `,_jsx(_components.code,{children:`archiveCmd`}),` the token Alice has created, you need the contract id. Retrieve the contract id from the ledger with the `,_jsx(_components.code,{children:`\u003c-`}),` notation. How this works is discussed in `,_jsx(_components.code,{children:`constraints`}),`.`]}),`\n`,_jsx(_components.p,{children:`This script first checks that Bob cannot archive Alice’s token. Then Alice successfully archives it:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`13`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light github-dark`,style:{backgroundColor:`#fff`,\"--shiki-dark-bg\":`#24292e`,color:`#24292e`,\"--shiki-dark\":`#e1e4e8`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`13`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`token_test_3 = do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` alice \u003c- allocateParty \"Alice\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` bob \u003c- allocateParty \"Bob\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` alice_token \u003c- submit alice do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` createCmd Token with owner = alice`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submitMustFail bob do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` archiveCmd alice_token`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` submit alice do`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:` archiveCmd alice_token`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`view-the-ledger-and-its-history`,children:`View the ledger and its history`}),`\n`,_jsx(_components.p,{children:`Once you archive the contract the resulting script view is empty; there are no contracts left on the ledger. If you want to see the history of the ledger, e.g. to see how you got to that state, tick the “Show archived” box at the top of the ledger view:`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/archived.png?fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=55eeb24812dc22f3108b204c5cd8557d`,alt:`images/daml-scripts/archived.png`,\"data-og-width\":`1310`,width:`1310`,\"data-og-height\":`530`,height:`530`,\"data-path\":`sdks-tools/cli-tools/images/daml-scripts/archived.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/archived.png?w=280\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=18596e8ad605c7b6f8ed9557b186afb0 280w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/archived.png?w=560\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=0aef0ceee3dbb666b92367393dbb68b7 560w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/archived.png?w=840\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=d457682e2db4438c67bbdc55c914c9d0 840w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/archived.png?w=1100\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=42bb646182f4526446a0673a2df5bad5 1100w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/archived.png?w=1650\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=f284607e042b36c2bd37d3c1e5b05553 1650w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/archived.png?w=2500\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=b66afb28d07011c7e069c4d97f11063e 2500w`}),`\n`,_jsxs(_components.p,{children:[`You can see that there was a `,_jsx(_components.code,{children:`Token`}),` contract, which is now archived, indicated both by the “archived” value in the `,_jsx(_components.code,{children:`status`}),` column as well as by a strikethrough.`]}),`\n`,_jsx(_components.p,{children:`Click on the adjacent “Show transaction view” button to see the entire transaction graph:`}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tx_graph.png?fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=426cf2798420e7479737b07abe4e8ef9`,alt:`images/daml-scripts/tx_graph.png`,\"data-og-width\":`1023`,width:`1023`,\"data-og-height\":`768`,height:`768`,\"data-path\":`sdks-tools/cli-tools/images/daml-scripts/tx_graph.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tx_graph.png?w=280\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=af5738511d795fa471e0d071b89911ec 280w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tx_graph.png?w=560\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=3e685f8b6429b4a43deed3d1fd4944cd 560w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tx_graph.png?w=840\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=90da3c342634708a616193dec611c093 840w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tx_graph.png?w=1100\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=58208ccebed07238bdbf9af16740003a 1100w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tx_graph.png?w=1650\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=37274bf46bc493f5cd18a6fdb721ae3b 1650w, https://mintcdn.com/cantonfoundation/805bfL5zagaL0yiJ/sdks-tools/cli-tools/images/daml-scripts/tx_graph.png?w=2500\u0026fit=max\u0026auto=format\u0026n=805bfL5zagaL0yiJ\u0026q=85\u0026s=429d27c7580b04eefce44a82d6d5d5ca 2500w`}),`\n`,_jsxs(_components.p,{children:[`In the Daml Studio script runner, committed transactions are numbered sequentially. In the image above, the lines starting with `,_jsx(_components.code,{children:`TX`}),` indicate that there are three committed transactions, with ids `,_jsx(_components.code,{children:`#0`}),`, `,_jsx(_components.code,{children:`#1`}),`, and `,_jsx(_components.code,{children:`#2`}),`. These correspond to the three `,_jsx(_components.code,{children:`submit`}),` and `,_jsx(_components.code,{children:`submitMustFail`}),` statements in the script.`]}),`\n`,_jsxs(_components.p,{children:[`Transaction `,_jsx(_components.code,{children:`#0`}),` has one `,_jsx(_components.em,{children:`sub-transaction`}),` `,_jsx(_components.code,{children:`#0:0`}),`, which the arrow indicates is a `,_jsx(_components.code,{children:`create`}),` of a `,_jsx(_components.code,{children:`Token`}),`. Identifiers `,_jsx(_components.code,{children:`#X:Y`}),` mean `,_jsx(_components.code,{children:`commit X, sub-transaction Y`}),`. All transactions have this format in the script runner. However, this format is a testing feature. In general, you should consider transaction and contract IDs to be opaque.`]}),`\n`,_jsxs(_components.p,{children:[`The lines above and below `,_jsx(_components.code,{children:`create Token_Test:Token`}),` give additional information:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`consumed by: #2:0`}),` tells you that the contract is archived in sub-transaction `,_jsx(_components.code,{children:`0`}),` of commit `,_jsx(_components.code,{children:`2`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`referenced by #2:0`}),` tells you that the contract was used in other transactions, and lists their IDs.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`disclosed to (since): 'Alice' (#0)`}),` tells you who knows about the contract. The fact that `,_jsx(_components.code,{children:`'Alice'`}),` appears in the list is equivalent to an `,_jsx(_components.code,{children:`x`}),` in the tabular view. The `,_jsx(_components.code,{children:`(#0)`}),` gives you the additional information that `,_jsx(_components.code,{children:`Alice`}),` learned about the contract in commit `,_jsx(_components.code,{children:`#0`}),`.`]}),`\n`,_jsxs(_components.li,{children:[`Everything following `,_jsx(_components.code,{children:`with`}),` shows the create arguments.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`2`,id:`exercises`,children:`Exercises`}),`\n`,_jsx(_components.p,{children:`To get a better understanding of script, try the following exercises:`}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsx(_components.li,{children:`Write a template for a second type of token.`}),`\n`,_jsx(_components.li,{children:`Write a script with two parties and two types of tokens, creating one token of each type for each party and archiving one token for each party, leaving one token of each type in the final ledger view.`}),`\n`,_jsxs(_components.li,{children:[`In `,_jsx(_components.code,{children:`archiving`}),` you tested that Bob cannot archive Alice’s token. Can you guess why the submit fails? How can you find out why the submit fails?`]}),`\n`]}),`\n`,_jsx(Tip,{children:_jsxs(_components.p,{children:[`Hint: Remember that in `,_jsx(_components.code,{children:`intro_2_failure`}),` we saw a proper error message for a failing submit.`]})}),`\n`,_jsx(Heading,{level:`2`,id:`next-up`,children:`Next up`}),`\n`,_jsxs(_components.p,{children:[`In `,_jsx(_components.code,{children:`archive`}),` you will build a Daml archive, that you can upload to a Canton participant node to interact with its ledger.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"codeStyling":{"theme":{"light":"github-light","dark":"github-dark"}},"config":{},"pageMetadata":{"title":"Daml Script","description":"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.","href":"/sdks-tools/cli-tools/daml-script"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Writing a Test Script","slug":"writing-a-test-script","depth":2,"children":[]},{"title":"Running Tests","slug":"running-tests","depth":2,"children":[{"title":"With dpm test","slug":"with-dpm-test","depth":3,"children":[]},{"title":"In VS Code","slug":"in-vs-code","depth":3,"children":[]}]},{"title":"Key Script Functions","slug":"key-script-functions","depth":2,"children":[{"title":"Party Allocation","slug":"party-allocation","depth":3,"children":[]},{"title":"Command Submission","slug":"command-submission","depth":3,"children":[]},{"title":"Querying State","slug":"querying-state","depth":3,"children":[]},{"title":"Assertions","slug":"assertions","depth":3,"children":[]},{"title":"Time Manipulation","slug":"time-manipulation","depth":3,"children":[]}]},{"title":"Test Organization","slug":"test-organization","depth":2,"children":[]},{"title":"Coverage Report","slug":"coverage-report","depth":2,"children":[]},{"title":"Related Pages","slug":"related-pages","depth":2,"children":[]},{"title":"Test templates using Daml scripts","slug":"test-templates-using-daml-scripts","depth":1,"children":[]},{"title":"Script basics","slug":"script-basics","depth":2,"children":[]},{"title":"Run the scripts","slug":"run-the-scripts","depth":2,"children":[]},{"title":"Test for failure","slug":"test-for-failure","depth":2,"children":[]},{"title":"Archive contracts","slug":"archive-contracts","depth":2,"children":[]},{"title":"View the ledger and its history","slug":"view-the-ledger-and-its-history","depth":2,"children":[]},{"title":"Exercises","slug":"exercises","depth":2,"children":[]},{"title":"Next up","slug":"next-up","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/cantonfoundation/9c03e72e153d6207/mintlify-sidebar-footer-patch.js","/_mintlify/custom/cantonfoundation/17537d003d412865/osano.js","/_mintlify/custom/cantonfoundation/ab79e5cc3fdba73d/giscus.js","/_mintlify/custom/cantonfoundation/675ffe7726579720/nav-transition.js","/_mintlify/custom/cantonfoundation/9b7a7a7db37d0115/ga-analytics-adjust.js"],"subdomain":"cantonfoundation","siteName":"Canton Network Docs","title":"Daml Script - Canton Network Docs","contextualStarterQuestions":[],"navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-11-24T02:31:16.906Z","originalFileLocation":"sdks-tools/cli-tools/daml-script.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Canton Network Docs\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/svg+xml\" sizes=\"180x180\" href=\"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-dark.svg?fit=max\u0026amp;auto=format\u0026amp;n=OOy41G-b8QJx6Gkr\u0026amp;q=85\u0026amp;s=d5d59c10fc4ca9be021afb188db72e2f\">\u003clink data-mint-head rel=\"icon\" type=\"image/svg+xml\" sizes=\"32x32\" href=\"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-dark.svg?fit=max\u0026amp;auto=format\u0026amp;n=OOy41G-b8QJx6Gkr\u0026amp;q=85\u0026amp;s=d5d59c10fc4ca9be021afb188db72e2f\">\u003clink data-mint-head rel=\"icon\" type=\"image/svg+xml\" sizes=\"16x16\" href=\"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-dark.svg?fit=max\u0026amp;auto=format\u0026amp;n=OOy41G-b8QJx6Gkr\u0026amp;q=85\u0026amp;s=d5d59c10fc4ca9be021afb188db72e2f\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/svg+xml\" href=\"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-dark.svg?fit=max\u0026amp;auto=format\u0026amp;n=OOy41G-b8QJx6Gkr\u0026amp;q=85\u0026amp;s=d5d59c10fc4ca9be021afb188db72e2f\">\u003cmeta data-mint-head property=\"og:title\" content=\"Daml Script - Canton Network Docs\">\u003cmeta data-mint-head property=\"og:description\" content=\"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Canton Network Docs\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.canton.network/sdks-tools/cli-tools/daml-script\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://cantonfoundation.mintlify.site/_mintlify/api/og/v2?division=CLI+Tools\u0026amp;title=Daml+Script\u0026amp;description=Write+and+run+test+scripts+for+Daml+smart+contracts+using+Daml+Script+and+dpm+test.\u0026amp;theme=ffe2080e38fe73bda4a88670\u0026amp;signature=37961a208943ee84aad325ba05aac3eb1d90ed399ee6edc3ec26fd529eaa0bc5\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Daml Script - Canton Network Docs\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://cantonfoundation.mintlify.site/_mintlify/api/og/v2?division=CLI+Tools\u0026amp;title=Daml+Script\u0026amp;description=Write+and+run+test+scripts+for+Daml+smart+contracts+using+Daml+Script+and+dpm+test.\u0026amp;theme=ffe2080e38fe73bda4a88670\u0026amp;signature=37961a208943ee84aad325ba05aac3eb1d90ed399ee6edc3ec26fd529eaa0bc5\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"https://mintlify.s3.us-west-1.amazonaws.com/cantonfoundation/_generated/favicon/browserconfig.xml?v=3\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Canton Network Docs\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#734BE2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.canton.network/sdks-tools/cli-tools/daml-script\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/sdks-tools/cli-tools/daml-script.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.canton.network/#organization\",\"name\":\"Canton Network Docs\",\"url\":\"https://docs.canton.network\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/cantonfoundation/OOy41G-b8QJx6Gkr/images/canton-logo-dark.svg?fit=max\u0026auto=format\u0026n=OOy41G-b8QJx6Gkr\u0026q=85\u0026s=d5d59c10fc4ca9be021afb188db72e2f\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.canton.network#website\",\"name\":\"Canton Network Docs\",\"url\":\"https://docs.canton.network\",\"publisher\":{\"@id\":\"https://docs.canton.network/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script#webpage\",\"url\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script\",\"name\":\"Daml Script\",\"description\":\"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.\",\"dateModified\":\"2026-11-24T02:31:16.906Z\",\"isPartOf\":{\"@id\":\"https://docs.canton.network#website\"},\"breadcrumb\":{\"@id\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"CLI Tools\",\"item\":\"https://docs.canton.network/sdks-tools/cli-tools/dpm\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Daml Script\",\"item\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script#article\",\"headline\":\"Daml Script\",\"name\":\"Daml Script\",\"description\":\"Write and run test scripts for Daml smart contracts using Daml Script and dpm test.\",\"url\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script\",\"mainEntityOfPage\":{\"@id\":\"https://docs.canton.network/sdks-tools/cli-tools/daml-script#webpage\"},\"dateModified\":\"2026-11-24T02:31:16.906Z\",\"publisher\":{\"@id\":\"https://docs.canton.network/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.canton.network#website\"}}]}\u003c/script>","agentPointerHref":"/sdks-tools/cli-tools/daml-script.md","siteName":"Canton Network Docs","nav":{"global":null,"products":[{"product":"Overview","icon":"book-open","pages":[{"title":"Overview","href":"/overview/understand/what-is-canton"}]},{"product":"App Development","icon":"code","pages":[{"title":"App Development","href":"/appdev/get-started/choose-your-path"}]},{"product":"Global Synchronizer","icon":"server","pages":[{"title":"Global Synchronizer","href":"/global-synchronizer/understand/overview"}]},{"product":"Integrations","icon":"plug","pages":[{"title":"Integrations","href":"/integrations/overview"}]},{"product":"SDKs and Tools","icon":"wrench","groups":[{"group":"Overview","pages":[{"title":"SDKs and Tools","href":"/sdks-tools/overview"}]},{"group":"SDKs","pages":[{"title":"Daml SDK","href":"/sdks-tools/sdks/daml-sdk"},{"group":"Wallet SDK","pages":[{"title":"Overview","href":"/sdks-tools/sdks/wallet-sdk/overview"},{"title":"Quickstart","href":"/sdks-tools/sdks/wallet-sdk/quickstart"},{"group":"Using the SDK","pages":[{"title":"Configuration","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/configuration"},{"title":"Registering Plugins","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/registering-plugins"},{"group":"v0 to v1 migration","pages":[{"title":"SDK v0 to v1 Migration Guide","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration"},{"title":"Migration cheat sheet","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/migration-cheat-sheet"},{"title":"Party Namespace","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/party"},{"title":"Token Namespace","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/token"},{"title":"User Namespace","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/user"},{"title":"Amulet Namespace","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/amulet"},{"title":"Ledger Namespace","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/ledger"},{"title":"Asset Namespace","href":"/sdks-tools/sdks/wallet-sdk/using-the-sdk/v0-to-v1-migration/asset"}]}]},{"group":"Guides","pages":[{"title":"Creating an External Party","href":"/sdks-tools/sdks/wallet-sdk/guides/creating-an-external-party"},{"title":"Finding and Reading Data From the Ledger","href":"/sdks-tools/sdks/wallet-sdk/guides/finding-and-reading-data"},{"title":"Preparing and Signing a Transaction","href":"/sdks-tools/sdks/wallet-sdk/guides/preparing-and-signing-a-transaction"},{"title":"Transfer Types","href":"/sdks-tools/sdks/wallet-sdk/guides/transfer-types"},{"title":"Performing a CC Tap on DevNet or LocalNet","href":"/sdks-tools/sdks/wallet-sdk/guides/performing-a-cc-tap"},{"title":"Signing Transactions from Third-Party dApps","href":"/sdks-tools/sdks/wallet-sdk/guides/signing-transactions-from-third-party-dapps"},{"title":"User Management","href":"/sdks-tools/sdks/wallet-sdk/guides/user-management"}]},{"title":"Wallet SDK","sidebarTitle":"Release Notes","href":"/integrations/release-notes/wallet-sdk"}]},{"group":"dApp SDK","pages":[{"title":"Overview","href":"/sdks-tools/sdks/dapp-sdk/overview"},{"title":"Quickstart","href":"/sdks-tools/sdks/dapp-sdk/quickstart"},{"group":"Guides","pages":[{"title":"Connect \u0026 Sessions","href":"/sdks-tools/sdks/dapp-sdk/guides/connect-and-sessions"},{"title":"Parties \u0026 Transactions","href":"/sdks-tools/sdks/dapp-sdk/guides/parties-and-transactions"},{"title":"Handle Events","href":"/sdks-tools/sdks/dapp-sdk/guides/handle-events"},{"title":"Wallet Discovery","href":"/sdks-tools/sdks/dapp-sdk/guides/wallet-discovery"}]},{"group":"API Reference","pages":[{"title":"SDK Methods","href":"/sdks-tools/sdks/dapp-sdk/reference/sdk-methods"},{"title":"Events","href":"/sdks-tools/sdks/dapp-sdk/reference/events"},{"title":"Provider API","href":"/sdks-tools/sdks/dapp-sdk/reference/provider-api"},{"title":"Errors","href":"/sdks-tools/sdks/dapp-sdk/reference/errors"}]},{"group":"Wallet Providers","pages":[{"title":"Integration Overview","href":"/sdks-tools/sdks/dapp-sdk/wallet-providers/integration-overview"},{"title":"Browser Extension","href":"/sdks-tools/sdks/dapp-sdk/wallet-providers/browser-extension"},{"title":"Remote Wallet","href":"/sdks-tools/sdks/dapp-sdk/wallet-providers/remote-wallet"},{"title":"WalletConnect","href":"/sdks-tools/sdks/dapp-sdk/wallet-providers/walletconnect"}]},{"title":"dApp SDK","sidebarTitle":"Release Notes","href":"/integrations/release-notes/dapp-sdk"}]}]},{"group":"Language Bindings","pages":[{"title":"Java Codegen","href":"/sdks-tools/language-bindings/java"},{"title":"Java LAPI Bindings","href":"/sdks-tools/language-bindings/java-client-libraries"},{"title":"Ledger Client Standard","href":"/sdks-tools/language-bindings/client-standard"},{"title":"JavaScript Codegen","href":"/sdks-tools/language-bindings/javascript"},{"title":"Community Bindings","href":"/sdks-tools/language-bindings/community"}]},{"group":"CLI Tools","pages":[{"title":"dpm (Daml Package Manager)","href":"/sdks-tools/cli-tools/dpm"},{"title":"Canton Console","description":"Scala REPL for managing Canton nodes, topology, and debugging operational issues.","href":"/sdks-tools/cli-tools/canton-console"},{"title":"Daml Script","href":"/sdks-tools/cli-tools/daml-script"},{"title":"Daml Shell","description":"Interactive command-line tool for inspecting and debugging the Canton ledger","href":"/sdks-tools/cli-tools/daml-shell"}]},{"group":"Development Tools","pages":[{"title":"Daml Studio","href":"/sdks-tools/development-tools/daml-studio"},{"title":"The Daml Compiler","href":"/sdks-tools/development-tools/daml-compiler"},{"title":"Daml Profiler","href":"/sdks-tools/development-tools/daml-profiler"},{"title":"LocalNet","href":"/sdks-tools/development-tools/localnet"},{"title":"Sandbox","href":"/sdks-tools/development-tools/sandbox"},{"title":"Darsyncer Docker Image","href":"/sdks-tools/development-tools/darsyncer"},{"group":"Splice Portfolio dApp UI","pages":[{"title":"Overview","href":"/sdks-tools/development-tools/splice-portfolio/overview"},{"title":"First-Time Setup","href":"/sdks-tools/development-tools/splice-portfolio/first-time-setup"},{"title":"Navigation","href":"/sdks-tools/development-tools/splice-portfolio/navigation"},{"title":"Transfers","href":"/sdks-tools/development-tools/splice-portfolio/transfers"},{"title":"Allocations","href":"/sdks-tools/development-tools/splice-portfolio/allocations"},{"title":"Add a Registry","href":"/sdks-tools/development-tools/splice-portfolio/add-a-registry"},{"title":"Enable Pre-Approvals","href":"/sdks-tools/development-tools/splice-portfolio/pre-approvals"},{"title":"DevNet Faucet","href":"/sdks-tools/development-tools/splice-portfolio/devnet-faucet"},{"title":"Switch Parties","href":"/sdks-tools/development-tools/splice-portfolio/switch-parties"},{"title":"Error Handling and Troubleshooting","href":"/sdks-tools/development-tools/splice-portfolio/troubleshooting"}]},{"group":"PQS","pages":[{"title":"PQS (Participant Query Store)","href":"/sdks-tools/development-tools/pqs"},{"title":"Configure","href":"/sdks-tools/development-tools/pqs/configure"},{"title":"Operate","href":"/sdks-tools/development-tools/pqs/operate"},{"title":"Optimize","href":"/sdks-tools/development-tools/pqs/optimize"},{"title":"Troubleshoot","href":"/sdks-tools/development-tools/pqs/troubleshoot"}]}]},{"group":"API Overview","pages":[{"group":"Ledger API","pages":[{"title":"Ledger API","href":"/sdks-tools/api-reference/ledger-api"},{"title":"gRPC Ledger API Services","href":"/sdks-tools/api-reference/ledger-api-services"},{"title":"JSON API","href":"/sdks-tools/api-reference/json-api"},{"title":"JSON Ledger API Migration to V2 guide","href":"/sdks-tools/api-reference/json-ledger-api-migration-to-v2"}]},{"title":"Admin API","href":"/sdks-tools/api-reference/admin-api"},{"group":"Splice APIs","pages":[{"title":"Splice Architecture","href":"/sdks-tools/api-reference/splice-architecture"},{"title":"Splice APIs","href":"/sdks-tools/api-reference/splice-apis"},{"title":"Splice APIs Overview","href":"/sdks-tools/api-reference/splice-overview"},{"title":"Splice HTTP APIs","href":"/sdks-tools/api-reference/splice-http-apis"},{"group":"Scan APIs","pages":[{"title":"Scan APIs","href":"/sdks-tools/api-reference/splice-scan-api"},{"title":"Scan Aggregates API","href":"/sdks-tools/api-reference/splice-scan-aggregates-api"},{"title":"Scan Bulk Data API","href":"/sdks-tools/api-reference/splice-scan-bulk-data-api"},{"title":"Scan Canton Coin Reference Data API","href":"/sdks-tools/api-reference/splice-scan-cc-reference-data-api"},{"title":"Scan API for Current State of CC and Synchronizer Traffic","href":"/sdks-tools/api-reference/splice-scan-current-state-api"},{"title":"Scan Global Synchronizer Connectivity API","href":"/sdks-tools/api-reference/splice-scan-gs-connectivity-api"},{"title":"Scan Global Synchronizer Operations API","href":"/sdks-tools/api-reference/splice-scan-gs-operations-api"},{"title":"Scan Open API Reference","href":"/sdks-tools/api-reference/splice-scan-openapi"}]},{"title":"Validator APIs","href":"/sdks-tools/api-reference/splice-validator-api"}]}]},{"group":"Reference Projects","pages":[{"title":"cn-quickstart","href":"/sdks-tools/reference-projects/cn-quickstart"},{"title":"Splice Reference Apps","href":"/sdks-tools/reference-projects/splice-reference-apps"}]}]},{"product":"API Reference","icon":"book-open","pages":[{"title":"API Reference","href":"/api-reference"}]},{"product":"Release Notes","icon":"note","pages":[{"title":"Release Notes","href":"/release-notes"}]},{"product":"Version Dashboard","icon":"table","pages":[{"title":"Version Dashboard","href":"/shared/version-compatibility-dashboard"}]},{"product":"Page templates","icon":"file-pen","hidden":true,"pages":[{"title":"Page templates","href":"/src/appdev/deep-dives/token-standard"}]}]},"basePath":"","title":"Daml Script - Canton Network Docs","deploymentId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","buildId":"dpl_Ab6nteg7kvyK8iL73naC2n7fmsWK","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-DHIkV4p4.js","lightbox-handle-r17bVUz3.js"]}