Is it possible to use a variable as the entry_point
for a callback in smartpy?
This works:
@sp.entry_point
def getProofs(self, address, callback_address):
c = sp.contract(TGetProofsResponsePayload, callback_address, entry_point="getProofsCallback").open_some()
sp.transfer(sp.record(address=address, proofs=self.data.identities[address]), sp.mutez(0), c)
This does not:
@sp.entry_point
def getProofs(self, address, callback_address, callback_entrypoint):
c = sp.contract(TGetProofsResponsePayload, callback_address, entry_point=callback_entrypoint).open_some()
sp.transfer(sp.record(address=address, proofs=self.data.identities[address]), sp.mutez(0), c)
Getting the following error:
Error: Error in Scenario
Expression format error (a 4) (contract (attr (params 64) callback_entrypoint 170)
(record
((address address) (callback_entrypoint string)
(proofs
(map string
(record
((meta (map string string)) (register_date timestamp) (verified bool))
None))))
None)
(attr (params 64) callback_address 170) 68)
Any ideas? 🤷♂️
I guess I can pass a routing_key
or callback_id
to handle different scenarios for the callback, but seems cleaner not to force the callback entrypoint name? 😅
Thanks ❤️