illus --> Is there any way I can get other return types than Promise through cross-contract-call?
Benji | NEAR --> I’m a solid 80% sure that you can only use promises. <@!austinabell> can u give a more definitive answer haha. In docs, it says NEAR introduced promises to make dev’s lives easier but does that mean promises are the only way to deal with cross-contract calls?
illus --> It’s too complex even get result of other contract’s getter function…
austinabell --> Do you mean like the return type from the function you are calling? If so, you can’t and the reason is because that function call is not done within the current execution and is happening later (usually next block) so you can’t use a value that may or may not succeed in the future.
Generally the pattern for following up with this data is with callbacks, which essentially uses this data from this future computation and continues to execute with the resolved value you want. Unfortunately breaking up the logic into pieces like this is the only way to handle this asynchronous execution, but hopefully in the future we can abstract over this 🙂
See some docs on callbacks here: https://www.near-sdk.io/cross-contract/callbacks