Skip to content
CCPEDIAby Unity Nodes
App Development

How can I see all the history of a contract in UI?

3 posts274 viewsLast activity May 2023

  1. cohen.avrahamOP

    G-d willing

    Hello, assuming I have a simple contract like the following:

    template Simple
      with
        owner: Party
        status : Int
      where
        signatory owner
    
      choice ChangeStatus : ContractId Simple
      controller owner 
        do
          create this with status = status + 1
    

    How can I fetch the data of this contract knowing when the status was equal to 1 or 2 and etc…?
    I need this for a system where I need to show the history of a contract in a UI application.

    Thanks,

  2. cocreature

    The JSON API does not provide access to historical data at the moment. Your best option is to build a custom (Java) backend using the Java bindings + codegen that stores the history you’re interested in based on the data it receives on the transaction/transaction tree stream and then expose that through an HTTP API to your frontend.

  3. cohen.avraham

    G-d willing

    I am not sure I understood you completely.
    Are you suggesting I use a database where I will store all the history I need - and not use the ledger?
    If this is what you mean, how do I take advantage of a ledger that holds all the contract’s history?