I have two contracts contract_one
and contract_two
. On contract_two
I have an on-chain-view defined like this:
@sp.onchain_view()
def get(self, id):
sp.result(self.data.map[id])
This view works correctly. Now what I want is to call this view from contract_one
. Here's what I've tried:
@sp.onchain_view()
def get(self, id):
contract_address = sp.local("contract_address", sp.address('CONTRACT_ONE_ADDRESS'))
result = sp.local("result", sp.view("get", contract_address.value, id, t = sp.TRecord( data = sp.TString, address = sp.TAddress )).open_some("Invalid view"))
sp.result(result.value)
Although the contract is compiled successfully, I cannot originate it to hangzhounet, getting the following error:
"Http error response: (400) Failed to parse the request body: No case matched:\n...
The error then lists several /kind
reasons.
My question is, what I'm trying to do, is it possible to achieve? Is there another way to do this? My final goal is to call this view with Taquito and get a result.