# Finlib tutorial: Temporary account disclosure

**URL:** <https://forum.canton.network/t/finlib-tutorial-temporary-account-disclosure/5437>\
**Category:** App Development\
**Tags:** daml, daml-finance\
**Created:** [October 18, 2022, 12:03pm UTC](https://forum.canton.network/t/finlib-tutorial-temporary-account-disclosure/5437 "2022-10-18T12:03:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ianw1](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ianw1/32/7172_2.png) [@Ianw1](https://forum.canton.network/u/Ianw1)\
**Post date:** [October 18, 2022, 12:03pm UTC](https://forum.canton.network/t/finlib-tutorial-temporary-account-disclosure/5437/1 "2022-10-18T12:03:39Z")

</div>

Hi, I’m following the [finlib transfer tutorials](https://digital-asset.github.io/daml-finance/tutorials/getting-started/intro.html) but need a steer on the [temporary disclosure exercise](https://digital-asset.github.io/daml-finance/tutorials/getting-started/transfer.html#temporary-account-disclosure) please.

My approach has been to add a new choice to the `Workflow.Transfer.Request` template along the lines of:

```haskell
    nonconsuming choice AddObserver : ContractId Request
      with
        newObserver : Party
      controller receiverAccount.owner
      do
        (accountCid, _) <- fetchByKey @Account.I receiverAccount
        let disclosureCid = toInterfaceContractId accountCid
        -- call AddObservers choice on Disclosure using exerciseInterfaceByKey
        pure this

```

However this doesn’t seem to be the right approach. My import of Disclosure:

```haskell
import Daml.Finance.Interface.Util.Disclosure qualified as Disclosure (I)

```

fails as it is a member of a hidden package, and I am also not sure that fetchByKey is the correct way to go given that I want an interface Account and I’m not sure how to obtain this from the key. Thanks!

---

<div class="post-metadata">

**Author:** ![Matteo\_Limberto](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/matteo_limberto/32/2823_2.png) [@Matteo\_Limberto](https://forum.canton.network/u/Matteo_Limberto)\
**Post date:** [October 18, 2022, 2:39pm UTC](https://forum.canton.network/t/finlib-tutorial-temporary-account-disclosure/5437/2 "2022-10-18T14:39:02Z")

</div>

Hi @Ianw1,

Thanks for your question, this is useful feedback.

The hidden package error can be resolved by adding `Daml.Finance.Interface.Util` as a data dependency in your `daml.yaml` file. You will also need to include it in the `get-dependencies.sh` script.

Coming to the actual disclosure logic, your approach does make sense: within the choice, you want to

- fetch the `AccountCid` from its key
- use `toInterfaceContractId` to cast to the `Disclosure.I` interface
- exercise the `AddObservers` choice

Given that language support for interface keys is not there yet, we have written a helper function `Account.exerciseInterfaceByKey` that reproduces the above steps.

Specifically, you can invoke

```haskell
Account.exerciseInterfaceByKey @Disclosure.I receiverAccount receiverAccount.owner Disclosure.AddObservers
  with
    disclosers = singleton receiverAccount.owner
    observersToAdd = ("Disclosure context", singleton currentOwner)

```

You will notice that the choice actor `receiverAccount.owner` is repeated twice:

- the first input is used to fetch the account cid
- the second input is used as input to the `AddObservers` choice

If you are interested in understanding more of the workaround that we used to get key support for interfaces, I tried to explain it [here](https://discuss.daml.com/t/difference-between-interface-keys-and-contract-keys-why-do-we-need-interface-keys/5374/5).

That said, your post made me realise that it might not be the best idea to expose new users to this sort of workaround. Hence I might discuss with the team if it makes sense to remove the temporary disclosure exercise until interface key support lands.

Thanks,  
Matteo

---

<div class="post-metadata">

**Author:** ![Ianw1](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ianw1/32/7172_2.png) [@Ianw1](https://forum.canton.network/u/Ianw1)\
**Post date:** [October 19, 2022, 9:58am UTC](https://forum.canton.network/t/finlib-tutorial-temporary-account-disclosure/5437/3 "2022-10-19T09:58:05Z")

</div>

Thanks @Matteo_Limberto that worked. I did see `exerciseInterfaceByKey` but didn’t realise I could use it with the Disclosure interface in the above way. I see now that this makes sense!

I think the exercise is fine but maybe just needs a pointer or two for people new to this. Specifically I would say the two points you mentioned above: editing the get-dependencies.sh/daml.yaml and using `exerciseInterfaceByKey`.

---

<div class="post-metadata">

**Author:** ![Matteo\_Limberto](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/matteo_limberto/32/2823_2.png) [@Matteo\_Limberto](https://forum.canton.network/u/Matteo_Limberto)\
**Post date:** [October 19, 2022, 10:50am UTC](https://forum.canton.network/t/finlib-tutorial-temporary-account-disclosure/5437/4 "2022-10-19T10:50:48Z")

</div>

Thanks for the feedback, appreciated!
