Using global wallets
When you request a signature or transaction from a user’s embedded wallet from another app, Privy requires the user to explicitly confirm the signature or transaction. This is accomplished by opening a popup to the provider app’s domain, where the user confirms the action in an isolated environment.
To request signatures and transactions from a user’s embedded wallet from a provider app, use the signMessage
, signTypedData
, and sendTransaction
methods returned by Privy’s useCrossAppAccounts
hook
These methods are similar to the signMessage
, signTypedData
, and sendTransaction
methods returned by usePrivy
except they all require an additional CrossAppWalletOptions
object of the following type:
The address for the cross-app embedded wallet that you’d like to request a signature/transaction from.
If the address
you specify in this CrossAppWalletOptions
object is not a valid embedded wallet that
has been linked to the current user from a provider app, these wallet methods will error.
signMessage
To the signMessage
method returned by useCrossAppAccounts
, pass the following parameters:
The message the user must sign as a string
.
Options for the cross-app embedded wallet, which must include the requested wallet’s address.
signTypedData
To the signTypedData
method returned by useCrossAppAccounts
, pass the following parameters:
A JSON object that conforms to the EIP-712 TypedData JSON schema.
Options for the cross-app embedded wallet, which must include the requested wallet’s address.
sendTransaction
To the sendTransaction
method returned by useCrossAppAccounts
, pass the following parameters:
The transaction request to be sent.
Options for the cross-app embedded wallet, which must include the requested wallet’s address.
Example signature request
As an example, you might request a signature from a user’s cross-app wallet like so:
Was this page helpful?