Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/Usage examples of exerciseByKey - @daml/ledgerForum ↗

Usage examples of exerciseByKey - @daml/ledger

App Development4 posts726 views6 likesLast activity Aug 2020
AL
alex_mOP
Aug 2020

Are there any usage examples of exerciseByKey? Can contract keys be easily constructed and used in something like this:

ledger.exerciseByKey(Handover, { "_1": owner, "_2": id }, { newHandler: handler })

…or do the JS contract keys have unattractive type signatures? (requiring you to hold on to a reference to the key, as opposed to constructing it when needed).

Thanks for the help,
Alex

AL
alex_m
Aug 2020

Never mind, got it working with:
await ledger.exerciseByKey(Product.HandoverProduct, { _1: product.owner, _2: product.productId }, { newHandler: product.handler });

LE
Leonid_Rozenberg
Aug 2020

@alex_m I was going to suggest looking at this code in DAVL. Glad that you got it to work.

AL
alex_m
Aug 2020

Cheers! I’ll check it out anyway.

← Back to Discussions