Hi all, I am unable to initialise my script and start the navigator for some reason. My test script works fine and I can see the in memory ledger, but for some reason when I run daml start, it compiles successfully but fails to start the Sandbox.
Below is my code:
template RemittanceServiceRequest
with
client : Party
networkAdmin : Party – to make sure that the trasaction is legit
telephoneCompany : Party – mobile money company
provider : Party – this is the ForExNetwork
recipient : Text — recipients name
telphone : Text – electronic wallet
paymentMethod : Text – mobile phone account (electronic wallet)
baseCurrency : Text --currency that is tradable on the network
localCurrency : Text — to currency that is not tradable on the network
baseCurrencyAmount : Numeric 2 --Decimal
country : Text
issued : Time
where
signatory networkAdmin, client, provider
–observer telephoneCompany
controller provider, client can
nonconsuming SendRemittanceServiceReq : ContractId RemittanceServiceRequest
do
sendToTelephoneCompany <- create RemittanceServiceRequest
with
..
return (sendToTelephoneCompany)
controller telephoneCompany can
AcceptRemittanceServiceReq : (ContractId RemittanceServiceRequest, ContractId RemittanceFee, ContractId Payable, ContractId MobileMoneyPayment)
do
let
rate = 1.0
amountToPayOut = rate * baseCurrencyAmount
fromclientToTelCom <- create RemittanceServiceRequest
with
..
demandRemittanceFeePay <- create RemittanceFee
with
amount = baseCurrencyAmount * 0.1 ---exchange fee of 1% the amount sent
currency = baseCurrency
from = client
to = telephoneCompany
reference = "Remittance fee"
transactionId = "transaction MobileMoney"
received = issued
paymentfromClient <- create Payable
with
quoteAmountToReceive = amountToPayOut
quote = baseCurrency
rate = rate
from = client
to = telephoneCompany
baseCurrencyAmount = baseCurrencyAmount
baseCurrency= baseCurrency
reference = "Mobile Money transaction"
payrecipient <- create MobileMoneyPayment
with
from = telephoneCompany
to = recipient
amount = amountToPayOut --exchangeAmount
currency = localCurrency
sender = client
paymentMethod = paymentMethod -- this is to the recipient's mobile phone
return (fromclientToTelCom , demandRemittanceFeePay, paymentfromClient, payrecipient )
controller telephoneCompany can
DenyRemittanceService : ()
do return ()
###Test #####
forExchange_Test = script do
setTime (time (D.date 2022 Jan 12)0 0 0)
mtn ← allocatePartyWithHint “MTN” (PartyIdHint “mtn”)
orangeTel ← allocatePartyWithHint “OrangeTel” (PartyIdHint"orangeTel")
forexBroker ← allocatePartyWithHint “ForexBroker” (PartyIdHint"forexBroker")
patience ← allocatePartyWithHint “Patience” (PartyIdHint"patience")
becky ← allocatePartyWithHint “Becky” (PartyIdHint"becky")
networkAdmin ← allocatePartyWithHint “NetworkAdmin” (PartyIdHint “networkAdmin”)
curTime ← getTime
createProvider ← submitMulti [forexBroker, networkAdmin ][] do – these two parties are the two signatories to the contract
createCmd Provider
with
networkAdmin = networkAdmin
provider =forexBroker
createTelcomRegistration ← submitMulti [networkAdmin, mtn] [] do
createCmd TelComRegistration
with
telcomName = “Mobile Telcom Network”
telCombank = “Zenith Bank”
cashOutagent = “MTN Mobile Money”
telephone = “22-33-44”
telComEmail = “mtn@global.com”
telephoneCompany = mtn
networkAdmin = networkAdmin
createClientRegistration ← submit networkAdmin do
createCmd ClientRegistration
with
networkAdmin = networkAdmin
client = patience
createRemittance ← submitMulti[forexBroker, networkAdmin , becky, mtn][] do
createCmd RemittanceServiceRequest with
client = becky
networkAdmin = networkAdmin – to make sure that the trasaction is legit
telephoneCompany = mtn-- mobile money company
provider = forexBroker – this is the ForExNetwork
recipient = “John Hunt” — recipients name
telphone = “23-44-99” – electronic wallet
paymentMethod = “mobile wallet” – mobile phone account (electronic wallet)
baseCurrency = “CNY” --currency that is tradable on the network
localCurrency = “XAF” — to currency that is not tradable on the network
baseCurrencyAmount = 400.0–Decimal
country= “Cameroon”
issued = curTime
sendtRemittanceServiceReq ← submitMulti[forexBroker, networkAdmin, becky, mtn][] do
exerciseCmd createRemittance SendRemittanceServiceReq
acceptRemittanceServiceReq ← submitMulti[forexBroker, networkAdmin,becky, mtn][] do
exerciseCmd createRemittance AcceptRemittanceServiceReq
pure()
Error log below when I run “daml start”
18:58:30.619 [program-resource-pool-3] INFO com.daml.platform.sandboxnext.Runner - Initialized sandbox version 1.16.0 with ledger-id = fee9f2ad-1c81-4c00-84b8-0d9888e609a4, port = 6865, dar file = List(.daml\dist\ForExNetwork-0.0.1.dar), time mode = static time, ledger = in-memory, auth-service = AuthServiceWildcard$, contract ids seeding = strong
Running the initialization script.
Exception in thread “main” java.lang.IllegalArgumentException: unknown definition 8bdf5d8eb8590464664adcd735816f3db33ec6cc5c3d1a4954f53ad09a00bc2b:Main:forExNetwork_Test while looking for value 8bdf5d8eb8590464664adcd735816f3db33ec6cc5c3d1a4954f53ad09a00bc2b:Main:forExNetwork_Test
at com.daml.lf.data.package$.$anonfun$assertRight$1(package.scala:10)
at scala.util.Either.fold(Either.scala:190)
at com.daml.lf.data.package$.assertRight(package.scala:10)
at com.daml.lf.engine.script.Runner$.run(Runner.scala:309)
at com.daml.lf.engine.script.RunnerMain$.$anonfun$main$12(RunnerMain.scala:108)
at scala.concurrent.impl.Promise$Transformation.run(Promise.scala:434)
at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:53)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:48)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
daml-helper: Received ExitFailure 1 when running
Raw command: java “-Dlogback.configurationFile=C:\Users\patie\AppData\Roaming\daml\sdk\1.16.0\daml-sdk/script-logback.xml” -jar “C:\Users\patie\AppData\Roaming\daml\sdk\1.16.0\daml-sdk/daml-sdk.jar” script --dar “.daml\dist\ForExNetwork-0.0.1.dar” --script-name Main:forExNetwork_Test --static-time --ledger-host localhost --ledger-port 6865
daml-helper: Received ExitFailure 1 when running
Shell command: "“C:\Users\patie\AppData\Roaming\daml\bin\daml.cmd” “script” “–dar” “.daml\dist\ForExNetwork-0.0.1.dar” “–script-name” “Main:forExNetwork_Test” “–static-time”
“–ledger-host” “localhost” “–ledger-port” “6865"”
I will really appreciate your help and suggestions as I am fairly new to Daml.