Learn how to authenticate users, create embedded wallets, and send transactions in your Android app
sendCode
method.
Note: you must provide the phone number in E.164 format.
sendCode
will return Result.success
with no associated type.
If the provided phone number is invalid, or sending the OTP fails, sendCode
will return Result.failure
.
loginWithCode
method. Pass the following parameters to this method:
loginWithCode
will return Result.success
with an encapsulated PrivyUser
.
If the provided OTP/phone number combination is invalid, loginWithCode
will return Result.failure
.
createEthereumWallet
method on your PrivyUser
instance.EmbeddedEthereumWallet
object is returned as an encapsulated value of Result.success.This method will Result.failure
if:allowAdditional
is not set to true.personal_sign
).Once you have an instance of an EmbeddedEthereumWallet
, you can make RPC requests by using the provider: EmbeddedEthereumWalletProvider
hook and using its request
method. For example, wallet.provider.request(request: rpcRequest)
. This request method will suspend and await if the embedded wallet needs to wait for any internal ready state.EthereumRpcRequest
object that contains:method
: the name of the JSON-RPC method for the wallet to execute (e.g. 'personal_sign'
)params
: an array of parameters required by your specified method
chainId
in the transaction request.Example usage: