I was trying to run 2 script with daml script command then execution of second script is failing with error Parties arguments are invalid as it is already assigned
.
Attaching the 2 script file that I am running one after the another.
daml script --dar .\.daml\dist\quickstart-0.0.1.dar --script-name Main:initialize --ledger-host localhost --ledger-port 6865
daml script --dar .\.daml\dist\quickstart-0.0.1.dar --script-name Main1:initialize --ledger-host localhost --ledger-port 6865
As I am new to Daml so I am not allowed to attach the script files so pasting content of the script file here -
Main.daml
-- Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module Main where
import Daml.Script
import Iou
import IouTrade()
initialize : Script ()
initialize = do
-- allocate parties
alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
usBank <- allocatePartyWithHint "USD_Bank" (PartyIdHint "USD_Bank")
eurBank <- allocatePartyWithHint "EUR_Bank" (PartyIdHint "EUR_Bank")
-- Banks issue IOU transfers.
iouEurBankCid <- submit eurBank do
createCmd Iou with
issuer = eurBank
owner = eurBank
currency = "EUR"
amount = 100.0
observers = []
iouTransferAliceCid <- submit eurBank do
exerciseCmd iouEurBankCid Iou_Transfer with newOwner = alice
pure ()
Main1.daml
-- Copyright (c) 2020 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
-- SPDX-License-Identifier: Apache-2.0
module Main1 where
import Daml.Script
import Iou
import IouTrade()
initialize : Script ()
initialize = do
-- allocate parties
alice <- allocatePartyWithHint "Alice" (PartyIdHint "Alice")
bob <- allocatePartyWithHint "Bob" (PartyIdHint "Bob")
usBank <- allocatePartyWithHint "USD_Bank" (PartyIdHint "USD_Bank")
eurBank <- allocatePartyWithHint "EUR_Bank" (PartyIdHint "EUR_Bank")
iouUsBankCid <- submit usBank do
createCmd Iou with
issuer = usBank
owner = usBank
currency = "USD"
amount = 110.0
observers = [alice, bob, eurBank]
iouTransferBobCid <- submit usBank do
exerciseCmd iouUsBankCid Iou_Transfer with newOwner = bob
submit bob do exerciseCmd iouTransferBobCid IouTransfer_Accept
pure()
Note : I have tried removing allocate party logic from second script file that runs later but then compilation is complaining