#Soroban Invoker Address

16 messages · Page 1 of 1 (latest)

fleet phoenix
#

When I invoke a soroban contract function, I want to get invoker's wallet address. How do I do it? There is not a word about it in documentation.

stable shuttle
sudden sail
#

Do you mean that you want to store the address of the invoker to the contract?

primal sequoia
#

You accept the address as an argument in the function or have it in storage usually

#

Getting the invoker address might be possible by parsing the call stack but not recommended

#

No way for u to know ahead of time if its a user or contract. So usually tske an argument in the function called like 'user' then use user.require_auth()

fleet phoenix
fleet phoenix
sudden sail
fleet phoenix
sudden sail
fleet phoenix
#

And how do I acquire public key for transaction then? Manual input only?

#

That's not very convinient way for users

primal sequoia
#

You connect their wallet

small shoal
#

just to be clear, soroban works with account abstraction out of the box. that makes your contracts really flexible on one hand (you just write your contract once and it will be compatible with any types of accounts, such as the existing Stellar accounts, or any type of smart wallet that may use passkeys, suppport subscriptions, spend limits and what not). but on the other hand it unfortunately makes it so some patterns you might be used to don't exist, specifically 'use the invoker as authorizer'. you do need to provide the addresses you want to require auth from explicitly. the benefit is that there may be more than one address and also that you're not really limited by the direct invoker - a single signature may be used to authorize a whole tree of cross contract calls (say, authorize the DEX operation, do a bunch of transfers etc. - all with the same signature)