Skip to content
CCPEDIAby Unity Nodes
App Development

How to pass two input files param in daml script command

2 posts435 views2 likesLast activity Nov 2020

  1. Nishant_BansalOP 1

    Error: Unknown argument ‘parties.json’

    daml script --dar .daml/dist/quickstart-0.0.1.dar --script-name TestScript_Exercise:trade_exercise_iouTransfer_eurBank --ledger-host localhost --ledger-port 6865 --input-file result.json parties.json --output-file result1.json

    I am trying this for the below template.

    -- Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
    -- SPDX-License-Identifier: Apache-2.0
    
    
    module TestScript_Exercise where
    
    import Daml.Script
    import Iou
    import IouTrade()
    
    data Parties = Parties with
      alice : Party
      bob : Party
      usBank : Party
      eurBank : Party
    
    trade_exercise_iouTransfer_eurBank : (ContractId Iou,Parties) -> Script (ContractId IouTransfer)
    trade_exercise_iouTransfer_eurBank (cid_iou,parties) = do
      
    submit parties.eurBank do
      exerciseCmd cid_iou Iou_Transfer with newOwner = parties.alice
  2. cocreature 1

    You can only pass one input file. However, the input can be an arbitrary (serializable) DAML-LF value. (ContractId Iou, Parties) is such a value so you only need to know how to encode that as JSON. The :json command in daml repl can be handy for this or the documentation for how DAML types are translated to DAML-LF and the JSON encoding for DAML-LF values.

    Putting this together, a valid JSON input here would be the following:

    {
      "_1": "yourcontractidhere",
      "_2": 
        {
          "alice": "alicepartyid",
          "bob": "bobpartyid",
          "usBank": "usBankpartyid",
          "eurBank": "eurBankpartytid
        },
    }
    

    Replace the dummy contract id and the party ids by the ones you actually want to use.