Running this script to test things out, ledger party and JWT token are from hub
import asyncio
import dazl
async def main():
async with dazl.connect(
oauth_token="<token>",
url="https://c3botnnnzwyalbec.daml.app",
) as client:
contract = {"admin": "<ledger-party>"}
await client.create("UserAdmin:Admin", contract)
asyncio.run(main())
The error is
root@2ea78427c1d1:/app# python daml.py
Traceback (most recent call last):
File "daml.py", line 14, in <module>
asyncio.run(main())
File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
return loop.run_until_complete(main)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 579, in run_until_complete
return future.result()
File "daml.py", line 11, in main
await client.create("UserAdmin:Admin", contract)
File "/usr/local/lib/python3.7/site-packages/dazl/ledger/grpc/conn_aio.py", line 221, in create
request = self._submit_and_wait_request(commands, meta)
File "/usr/local/lib/python3.7/site-packages/dazl/ledger/grpc/conn_aio.py", line 516, in _submit_and_wait_request
act_as_party = act_as[0]
IndexError: tuple index out of range
The daml template inside UserAdmin.daml is
template Admin
with
admin : Party
where
signatory admin
nonconsuming choice OnBoardBank : ContractId Bank
with
bank: Party
name: Text
controller admin
do
create Bank with ..
nonconsuming choice CreateLoanRequestByKey : ContractId LoanRequest
with
id: Text
farmer: Party
public: Party
controller admin
do
exerciseByKey @ApprovedCreditRequest (admin, farmer, id) CreateLoanRequest with ..
Is act_as supposed to come from hub? because when supplying oauth_token it doesn’t allow setting act_as or read_as?