Skip to content
CCPEDIAby Unity Nodes
App Development

GetView - Daml.Finance.Interface.Instrument.Bond.FloatingRate.Instrument

2 posts312 views3 likesLast activity Mar 2023

  1. jvelasco.intellecteuOP 1

    Hi,

    Is there a reason why the Interface Daml.Finance.Interface.Instrument.Bond.FloatingRate.Instrument and the rest of Bond instrument interfaces do not provide a choice GetView like for instance Daml.Finance.Interface.Instrument.Token.Instrument or Daml.Finance.Interface.Instrument.Equity.Instrument?

    Thanks!
    Jose

  2. Johan_Sjodin 2

    Hi @jvelasco.intellecteu,

    No, there is no reason for that. I think we should add a GetView choice to each instrument interface to be consistent. I have opened a ticket where we can track this.

    github.com/digital-asset/daml-finance

    Add `GetView` choice to all `Instrument`s (to be consistent)

    opened 01:28PM - 15 Mar 23 UTC
    component-bond

    `Daml.Finance.Interface.Instrument.Bond.FloatingRate.Instrument` and the rest of…

    It’s worth noting that each instrument has a GetView from the Base.Instrument, but this won’t provide access to all of the contract’s data.

    The purpose of the GetView choice is to allow a party, say Alice, to get the view of a contract, without necessarily being a stakeholder of the contract. This can be useful in situations where someone needs access to reference data, but shouldn’t be a stakeholder of the contract. For example, if publicParty is an observer of an instrumentCid, and Alice has readAs rights of publicParty, she can get the view by running:

    submitMulti [alice] [publicParty] do 
      exerciseCmd instrumentCid GetView with actor = alice
    

    Without a GetView choice, Alice could try to get the data by a fetch or fetchByKey. However, fetch instrumentCid is not an option for Alice since the submitting party must be a stakeholder. Similarly, Alice cannot use fetchByKey without authorization from at least one stakeholder of the contract. Therefore, the GetView choice provides a more accessible way for parties to obtain view-only access to a contract’s data.

    Thanks for raising this!

    Johan