The sdk should allow to set the message sender for a given (or group of) calls to a specified Identity in test functions.
Not having this capability really limits the way we can do and organize our tests, specially for functions that have some kind of authorization check.
Update: I’m aware of the workaround of deploying the needed contract, in the case sender needs to be a contract, and take advantage of the deterministic id, as said on the first sway office hours. Though ideally it would be best if I didn’t need to do this.
Given the situation where we have a Contract B
that has a function that can only be called by a Contract A
, with this workaround I need to have access to A
’s code in my project B
. Which is not ideal. And if A
’s function that calls the intended B
’s function has requirements by itself, things get messy very quick.
Having something like Foundry’s prank() would be very useful for these situations.